]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.1.9 release/0.1.9
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Aug 1997 01:31:07 +0000 (03:31 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Aug 1997 01:31:07 +0000 (03:31 +0200)
252 files changed:
.dstreamrc
AUTHORS.text
BUGS
Documentation/CodingStyle.pod
Documentation/faq.pod
INSTALL.text
NEWS
TODO
VERSION
flower/choleski.cc
flower/data-file.cc
flower/diagonal-storage.cc
flower/directed-graph.cc
flower/dstream.cc
flower/flower-debug.cc
flower/flower-version.cc
flower/full-storage.cc
flower/include/cursor.icc
flower/include/cursor.tcc
flower/include/full-storage.icc
flower/include/interval.tcc
flower/include/link.icc
flower/include/list.icc
flower/include/list.tcc
flower/include/pcursor.tcc
flower/include/plist.icc
flower/include/plist.tcc
flower/include/pointer.tcc
flower/include/string-data.icc
flower/include/string-handle.icc
flower/interval.cc
flower/lgetopt.cc
flower/libc-extension.cc
flower/matrix-debug.cc
flower/matrix-storage.cc
flower/matrix.cc
flower/path.cc
flower/rational.cc
flower/scalar.cc
flower/string-convert.cc
flower/string.cc
flower/stringtest.cc
flower/text-db.cc
flower/text-stream.cc
flower/unionfind.cc
flower/vector.cc
init/paper16.ly
init/symbol.ly
init/table16.ly
input/cadenza.ly
input/gallina.ly
input/gallina.tex [new file with mode: 0644]
input/header.ly
input/kortjakje.ly
input/rhythm.ly
input/s.ly [deleted file]
input/scales.ly
input/scsii-menuetto.ly
input/standchen.ly
input/toccata-fuga-E.ly
input/twinkle-pop.ly
input/twinkle.ly
input/wohltemperirt.ly
lib/duration-convert.cc
lib/duration.cc
lib/file-storage.cc
lib/includable-lexer.cc
lib/include/duration-convert.hh
lib/include/duration.hh
lib/include/plet.hh [new file with mode: 0644]
lib/input.cc
lib/plet.cc [new file with mode: 0644]
lib/simple-file-storage.cc
lib/source-file.cc
lib/source.cc
lily/VERSION
lily/atom.cc
lily/audio-column.cc
lily/audio-item.cc
lily/audio-score.cc
lily/audio-staff.cc
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/axis-group.cc
lily/axis.cc
lily/bar-column-grav.cc
lily/bar-column.cc
lily/bar-grav.cc
lily/bar-number-grav.cc
lily/bar.cc
lily/beam.cc
lily/bow.cc
lily/boxes.cc
lily/break-align-item.cc
lily/break.cc
lily/clef-grav.cc
lily/clef-item.cc
lily/col-info.cc
lily/colhpos.cc
lily/collision-grav.cc
lily/collision.cc
lily/command-request.cc
lily/crescendo.cc
lily/debug.cc
lily/dimen.cc
lily/directional-spanner.cc
lily/dynamic-grav.cc
lily/elem-group-item.cc
lily/elem-group.cc
lily/engraver-group.cc
lily/engraver.cc
lily/general-script-def.cc
lily/global-gravs.cc
lily/global-performers.cc
lily/global-translator.cc
lily/gourlay-breaking.cc
lily/grouping.cc
lily/head-column.cc
lily/head-grav.cc
lily/horizontal-align-item.cc
lily/horizontal-group-item.cc
lily/idealspacing.cc
lily/identifier.cc
lily/include/header.hh [new file with mode: 0644]
lily/include/identifier.hh
lily/include/lily-proto.hh
lily/include/my-lily-lexer.hh
lily/include/paper-def.hh
lily/include/score.hh
lily/include/spring-spacer.hh
lily/ineq-constrained-qp.cc
lily/input-translator.cc
lily/item.cc
lily/key-grav.cc
lily/key-item.cc
lily/key-performer.cc
lily/key.cc
lily/keyword.cc
lily/leastsquares.cc
lily/lexer.l
lily/lexerinit.cc
lily/lily-version.cc
lily/line-group-grav.cc
lily/line-spacer.cc
lily/local-key-grav.cc
lily/local-key-item.cc
lily/lookup.cc
lily/lyric-grav.cc
lily/lyric-performer.cc
lily/main.cc
lily/meter-grav.cc
lily/meter-performer.cc
lily/meter.cc
lily/midi-def.cc
lily/midi-item.cc
lily/midi-stream.cc
lily/midi-walker.cc
lily/misc.cc
lily/molecule.cc
lily/music-iterator.cc
lily/music-list.cc
lily/music.cc
lily/musical-request.cc
lily/my-lily-lexer.cc
lily/my-lily-parser.cc
lily/note-column-grav.cc
lily/note-column.cc
lily/note-performer.cc
lily/note.cc
lily/notehead.cc
lily/notename-table.cc
lily/p-col.cc
lily/p-score.cc
lily/paper-def.cc
lily/parser.y
lily/performer-group-performer.cc
lily/performer.cc
lily/qlp.cc
lily/qlpsolve.cc
lily/request.cc
lily/rest-collision-grav.cc
lily/rest-collision.cc
lily/rest-column.cc
lily/score-align-grav.cc
lily/score-align-gravs.cc
lily/score-column.cc
lily/score-elem-info.cc
lily/score-elem.cc
lily/score-grav.cc
lily/score-halign-grav.cc
lily/score-performer.cc
lily/score.cc
lily/scoreline.cc
lily/scores.cc
lily/script-column.cc
lily/script-def.cc
lily/script-grav.cc
lily/script.cc
lily/slur-grav.cc
lily/slur.cc
lily/span-bar-grav.cc
lily/span-bar.cc
lily/span-score-bar-grav.cc
lily/span-score-bar.cc
lily/spanner-elem-group.cc
lily/spanner.cc
lily/spring-spacer.cc
lily/staff-info.cc
lily/staff-performer.cc
lily/staff-side.cc
lily/staff-sym-grav.cc
lily/staff-sym.cc
lily/stem-beam-grav.cc
lily/stem.cc
lily/super-elem.cc
lily/swallow-grav.cc
lily/symbol.cc
lily/symtable.cc
lily/template5.cc
lily/tex-beam.cc
lily/tex-slur.cc
lily/tex-stream.cc
lily/tex.cc
lily/text-def.cc
lily/text-grav.cc
lily/text-item.cc
lily/text-spanner.cc
lily/tie-grav.cc
lily/tie.cc
lily/time-description.cc
lily/timing-grav.cc
lily/translator.cc
lily/version.cc
lily/vertical-align-elem.cc
lily/vertical-align-grav.cc
lily/voice-group-gravs.cc
lily/warn.cc
lily/word-wrap.cc
make/lilypond.lsm
make/lilypond.spec
mi2mu/main.cc
mi2mu/mi2mu-version.cc
mi2mu/mudela-column.cc
mi2mu/mudela-item.cc
mi2mu/mudela-score.cc
mi2mu/mudela-staff.cc
mi2mu/mudela-stream.cc
mi2mu/mudela-voice.cc
mi2mu/my-midi-lexer.cc
mi2mu/my-midi-parser.cc
mi2mu/version.cc
tex/taupindefs.tex

index b4b324820312812e0dcdee5b2485921a6bf32a6c..211edb54f50f5fb4f9ff9086466ce3d75c1c42f3 100644 (file)
@@ -77,8 +77,9 @@ Staff_commands                0
 Stem                   0
 Stem                   0
 Stem_req               0
-Symtable               0
-Symtables              0
+Symtable               1
+Symtables              1
+
 Text_def               0
 Text_req               0
 Time_description       0
index a035909c097fd336f7175b26ce17225c9c8a3b51..e8e36bb310ba4304b7de37070910203e525ea80f 100644 (file)
@@ -61,6 +61,6 @@ C\bC\bC\bCO\bO\bO\bON\bN\bN\bNT\bT\bT\bTR\bR\bR\bRI\bI\bI\bIB\bB\bB\bBU\bU\bU\bUT\bT\bT\bTO\bO\bO\bOR\bR\bR\bRS\bS
 
 
 
-12/Aug/97                 LilyPond 0.1.7                        1
+12/Aug/97                 LilyPond 0.1.9                        1
 
 
diff --git a/BUGS b/BUGS
index c5f7e685f6bf20307828f7b2887d27f2ac5b053d..31bb2b7211621ade80f619fcd35076a586234a68 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -45,3 +45,10 @@ bc=\melodic{
   }
 }
 ***************************
+
+       \score { < 
+               \melodic { \id "Staff" ""; c'4 g'4 }
+               \lyric {   \id "Lyric" ""; hello4 bye4 < a chord > }
+               \lyric {   \id "Lyric" ""; bye4 hello4 }
+               \melodic { \id "Staff" ""; c'4 g'4 }
+       > }
index db238815e64678c27eb31fc3373fe2f8b5b7f8bd..cddf90b58ead3a012aa72e3b7587a3583574736d 100644 (file)
@@ -179,10 +179,28 @@ Standard methods:
        Presence of these methods usually imply that it is not feasible to this
        via  a constructor
        */
-       add( .. )
+       add (..)
 
        /// replace some data of *this
-       set( .. )
+       set (..)
+
+=head2 Constructor
+
+Every class should have a default constructor.  
+
+Don't use non-default constructors if this can be avoided:
+
+       Foo f(1)
+
+is less readable than
+
+       Foo f;
+       f.x = 1
+
+or 
+       Foo f(Foo_convert::int_to_foo (1))
+
+
 
 =head1 HUNGARIAN NOTATION NAMING CONVENTION
 
index 9d58aaec2f5457c32b251392fac375227a3324b8..2a505782f0eb12ad2edf7badddb5430f5666794d 100644 (file)
@@ -11,9 +11,9 @@ Some questions that have been answered before.
 Q: I get all kinds of errors while  compiling parser.cc
 
 A: LilyPond uses features of bison version 1.25. Please confirm that
-you are using a version 1.25 or better. Don't forget to do "make
-clean" after installing it. Don't forget to remove the stale
-bison.simple as well.
+you are using a version 1.25 or better, that is B<GNU> bison
+B<1.25>. Don't forget to do "make clean" after installing it. Don't
+forget to remove the stale F<bison.simple> as well.
 
 If the problem persists, then please mail me.
 
index a91ed8b4efb5d52080a1dfa5a25f4e3d0ef84d09..bbbec823a1e501b07f2fd5fa67ae399819ecc976 100644 (file)
@@ -61,7 +61,7 @@ R\bR\bR\bRU\bU\bU\bUN\bN\bN\bNN\bN\bN\bNI\bI\bI\bIN\bN\bN\bNG\bG\bG\bG
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        1
+8/Aug/97                  LilyPond 0.1.9                        1
 
 
 
@@ -127,7 +127,7 @@ C\bC\bC\bCO\bO\bO\bON\bN\bN\bNF\bF\bF\bFI\bI\bI\bIG\bG\bG\bGU\bU\bU\bUR\bR\bR\bRI\bI\bI\bIN\bN\bN\bNG\bG\bG\bG a\b
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        2
+8/Aug/97                  LilyPond 0.1.9                        2
 
 
 
@@ -193,7 +193,7 @@ INSTALL(1)            LilyPond documentation           INSTALL(1)
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        3
+8/Aug/97                  LilyPond 0.1.9                        3
 
 
 
@@ -259,7 +259,7 @@ I\bI\bI\bIN\bN\bN\bNS\bS\bS\bST\bT\bT\bTA\bA\bA\bAL\bL\bL\bLL\bL\bL\bLI\bI\bI\bIN\bN\bN\bNG\bG\bG\bG
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        4
+8/Aug/97                  LilyPond 0.1.9                        4
 
 
 
@@ -325,7 +325,7 @@ R\bR\bR\bRE\bE\bE\bED\bD\bD\bDH\bH\bH\bHA\bA\bA\bAT\bT\bT\bT L\bL\bL\bLI\bI\bI\bIN\bN\bN\bNU\bU\bU\bUX\bX\bX\bX
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        5
+8/Aug/97                  LilyPond 0.1.9                        5
 
 
 
@@ -391,6 +391,6 @@ A\bA\bA\bAU\bU\bU\bUT\bT\bT\bTH\bH\bH\bHO\bO\bO\bOR\bR\bR\bRS\bS\bS\bS
 
 
 
-8/Aug/97                  LilyPond 0.1.7                        6
+8/Aug/97                  LilyPond 0.1.9                        6
 
 
diff --git a/NEWS b/NEWS
index 24972f432686ffbd6a3ac8cfaf52d5a4d1e74cf5..6c757d5207f2db961b79ce05ba3abf08c39ba7ce 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,19 @@
+pl 9   
+       - declare rhythic_request
+       - preliminary support for real \mudelaheaders
+       - context-sensitive arithmetic spacing. Looks alot better
+       - silly GNU braces.
+       - JCN fixes for pl 8
+       - bf: midi instrument
+       - Vocabs from GMP-I
+
+pl 8.mb:
+       - use log of duration-name
 
+*******
+aug 15
 pl 8
+
        - gif -> xpm
        - bf: Whoops! Open eyes now, when finding shortest note in
 spring-spacer. Fixes spacing problems.
@@ -9,14 +23,14 @@ spring-spacer. Fixes spacing problems.
        - Identifier doesn't store its name. Much cleaner now.  
        - bf: Rest_collision_engraver now always announces
        - bf: announce Staff_sym only once
-       - rewrite of mi2mu (JCN)
-
-********
-aug 14
 pl 0.1.7.jcn1
        - complete redo mid/back-end of mi2mu
        - bf: do not create/play empty Audio-{text,instrument} events
 
+
+********
+aug 14
+
 pl 7
        - Audio_element as base for Audio_item and Audio_staff. fixes
 midi-lyric segfault
@@ -77,9 +91,6 @@ Interface via File_storage. (Now using Simple_file_storage)
        - mudela: parse tempo requests, \midi{ \tempo 4= 60;}
 
 ******
-pl 0.1.3.jcn1
-       - mi2mu: simplification +bf lily_stream: indentation and wordwrap
-       - mi2mu: bf: blunt: non-alpha(num) chars from identifiers
 aug 8
 pl 3
        - don't crash if no Clef_engraver.
diff --git a/TODO b/TODO
index d53e6e6b69995700d31ffa8036a27d54a3fe942c..8b8b9c403ddbaf588cffc07613bead3013a15af6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,76 +6,6 @@ done, or is an idea that I want to think about
 Most of the items are marked in the code as well, with full explanation. 
 grep for TODO and ugh/ugr
 
-       * Generate TeX titles from MudelaHeader
-
-       * integrate midi-elts from mi2mu and lily
-
-       * virtualise PCols to make encapsulated spacing problems
-       * Doc Mutopia (Music To The People) 
-
-       * context in spring-spacer.
-
-       * don't count bars which are not on first beat.
-
-       * generate stuff in out/default, out/sun5-irix etc iso out/ 
-       and out-sun5/
-
-       * derive lily_stream, Dstream, texstream from ostream?
-
-       * check libtool, automake
-
-       * have make dist produce tarball in out/ directory.
-
-       * write a faster Spring_spacer ( without matrices if possible )
-
-       * A decent scalar type
-
-       * relate energybound to linelen unitspace fontsize etc.
-
-       * naming of Voice_group/Voice
-
-       * benchmark band_matrices.
-
-       * versioning stuff (cvt mudela, mudela, etc.)
-
-       * get rid of gif files.
-
-       * dots into separate item.
-
-       * use String iso Text_def for lyrics.
-
-       * use position 0 for center of staff iso bottom.
-
-       * Klavarskribo?
-
-       * return status on exit
-
-       * lyrics in chords still fuck up.
-
-       * rewire acknowledge_element() logic with a process_acknowledged()
-       
-       * Global type registration.
-
-               My_class * p = create_object( My_class )
-               Type t = get_type ( *p );
-               if ( t <= get_type( q ))
-                       ..
-
-       * progress when creating MIDI elts.
-
-       * pushgroup/popgroup
-
-       * whole head on ledger line
-
-       * piano staff
-
-       * update 20 pt table
-
-       * decent TeX page layout
-
-       * a tutorial
-
 3RD PARTY BUGS:
 
        * ICE: spring-spacer::calcideal()
@@ -96,19 +26,47 @@ grep for TODO and ugh/ugr
 
        * (where are the) gcc compile warnings on linux
 
-LILY BUGS
+PROJECTS
 
-       \score { < 
-               \melodic { \id "Staff" ""; c'4 g'4 }
-               \lyric {   \id "Lyric" ""; hello4 bye4 < a chord > }
-               \lyric {   \id "Lyric" ""; bye4 hello4 }
-               \melodic { \id "Staff" ""; c'4 g'4 }
-       > }
+       * Spring_spacer:
+       - write a faster Spring_spacer ( without matrices if possible )
+       - relate energybound to linelen unitspace fontsize etc.
+       -used fixed fp
 
-PROJECTS
+       * \header
+       - Generate TeX titles from \header: 
+
+               title = XXX
+               -> \def\title{XXXX}
+       - revise lexer mode
+       - write perl script for handling it
 
        * emacs-mode for mudela
 
+       * Makefile stuff:
+       - have make dist produce tarball in out/ directory.
+       - Use Automake
+       - shared lib on Solaris too.
+       - check libtool, automake
+
+       - generate stuff in out/default, out/sun5-irix etc iso out/ 
+       and out-sun5/
+
+       * chords
+       - guitar chords
+       - chord names
+       - basso continuo
+       - Syntax/parser
+       - MIDI output?
+       - typesetting
+
+       * integrate midi-elts from mi2mu and lily
+
+       * Debug logs:
+       - derive lily_stream, Dstream, texstream from ostream?
+       - indentable stream as baseclass for TeX stream, lily stream, Dstream.
+       - use dstream feature in mi2mu
+
        * input converters
        - NIFF?
        - ABC? 
@@ -139,6 +97,8 @@ PROJECTS
        - quiet/ignore-version options
        - logfile output
 
+       * piano staff
+
        * elaborate Staff_side baseclass:
        - scripts
        - text
@@ -153,6 +113,12 @@ PROJECTS
        - PostScript output (esp. Beams, Slurs, etc)
        - Move PScore, Items, Spanners etc. into libmutype.a
 
+       * Documentation
+       - Doc Mutopia (Music To The People) 
+       - Doc (C) stuff of sheet music
+       - a tutorial
+
        * separate Score_elem settings in user-settable (properties
        .. ) and non-user-settable part. Maybe use something like X-resources:
        "Staff=oboe*dir: 0", "Staff=*.Voice_group=solo*dir: 1"
@@ -173,7 +139,7 @@ PROJECTS
        - beams over bars
 
 
-       * Redo font support 
+       * Redo font  
        - rename mf fonts to avoid conflicts with musixtex
        - use own fonts/update musixtex fonts/find older (c)-less fonts
        - hack up mf sources for decent spacing info (and then 
@@ -181,6 +147,11 @@ PROJECTS
        - use MF to generate rules.
        - rewrite : make a metafont iso font
 
+       * Font support:
+       - update 20 pt table
+       - mixed fontsizes
+
+
        * lines:
        - Ledger lines, should be separate item: Ledger_lines, Ledger_lines
        - set different line sizes / thicknesses
@@ -216,13 +187,15 @@ PROJECTS
        - specify number of lines
        - set linelength per line
 
+       * Rhythmic staff.
+
 SEVERELY LACKING:
 
        * SPEED!
 
        * multibar rests
 
-       * barnumbers, markers
+       * markers
 
        * abbreviations c4=16
 
@@ -235,8 +208,6 @@ INPUTLANGUAGE
 
        * <c f a>4 ?
 
-       * should have \require{package.ly} to read req'd packages.
-
        * Viola mode?
 
                @c c g e g 
@@ -255,71 +226,64 @@ INPUTLANGUAGE
 
        * configure pitch_byte
 
-       * figured bass?
-
        * rest name configurable
 
        * Raw request syntax
 
-PROJECTS
-
-       * Do RTTI i.s.o. static_name(), name() and request-junk.
 
 SMALLISH PROJECTS
 
+       * progress when creating MIDI elts.
+
        * A range for context errors (eg. mark both { and }. )
 
-       * lyric in staff  (sharpsharp in staff, text below)
+       * merge Atom and Symbol
 
-       * fix Egler definitions ( see tex/eglerdefs.tex )
+       * lyric in staff  (sharpsharp in staff, text below)
 
        * replace Score_elem member access by get()/set() methods, to enable
        future embedded code.
 
-       * --fast/--draft: leave out constraints
-
        * write Dynamic_line (to group dynamics horizontally)
 
        * write Rest_collision
 
        * use Real for y positions.
 
-       * shared lib on Solaris too.
-
-       * cleanup lily-proto.hh and proto.hh
-
        * half-sharps, half-flats
 
        * adaptive accidental spacing.
 
        * unix style paths for LILYINCLUDE env
 
-       * indentable stream as baseclass for TeX stream, lily stream, Dstream.
-
        * handle EOF graciously in error messages.
 
        * caching Item/spanner dimensions.
 
        * centered whole rest
 
-       * use dstream feature in mi2mu
-
         * qtor, btor, mtor-> tor( QUIET_ver ), tor( DEBUG_ver ), etc.
        - use tors feature in lily (?)
 
-       * declare symtab
-
        * declare notenametab?
 
        * midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
 
        * parshape
 
+       * Flower types:
+       - A decent scalar type
+       - String hash
+       - Pointer hash
+
+
        * binsearch/hash for identifiers
 
        * stafftypes: voice names/ instrument names.
 
-       * Decent TeX titledefs (\tempo, \metron, etc. )
+       * TeX stuff:    
+       - Decent TeX titledefs (\tempo, \metron, etc. )
+       - decent TeX page layout
 
        * lily \tempo
 
@@ -327,40 +291,34 @@ SMALLISH PROJECTS
 
        * textspanner: center position
 
-       * script-spacing
 
        * Brackets
        
-       * use (char *) iso. String for communication between lexer and
-       parser.
+       * Scricts:
+       - stack scripts in chords:
+         % fingering:        footing:
+           < a-4 c-2 g-1 >   < c-\ltoe e-\lheel >
+       - script-spacing
+       - slur parts as a script
+       - stackparameterised scripts for fingering and footing:
 
-       * configure idealspacing: arithmetic spacing
+            % toe to bheel   four to five
+           %   ^_u            4_5  
+           %     -                           
+           %  --|x--         --|x--
+           %  --|---         --|---
+           %  --|---         --|---
+          (where "to" is a tiny bow)
 
 DOC
-       * Score_elem structure.
-
        * all errors
        
-       * config of TeX macros
-
-       * a test suite
-
        * hacking-HOWTO
 
 FUTURE
 
        * auxilliary file for caching info.
 
-       * Reg_configure_request
-
-       * slur parts as a script
-       
-       * mixed fontsizes
-
-       * put scripts on bars
-
-       * guitar chord
-
        * Text_crescendo
 
        * clean solution for staffsize in items.
@@ -371,8 +329,6 @@ FUTURE
 
 IDEAS
 
-       * derive PCol from Score_elem? More in Score_elems? Spacing?
-
        * scoping in Lexer: do general id- assignments in mudela.
 
        ID '=' EXPR;
@@ -390,10 +346,6 @@ IDEAS
 
        * y -dims in internote? Staff-space? X-dimensions?
 
-       * merge Atom and Symbol?
-
-       * merge common code of Item, Atom/Molecule
-
        * Spacing_request for manually adjusting spacing
 
        * caching breakpoints
@@ -404,23 +356,45 @@ IDEAS
 
        * used fixedpoint arithmetic for min. energy.
 
-       * default convert mudela-file.ly -> mudela-file.tex
-         - rename {standchen,scsii-menuetto,...}.tex
+       * move towards incremental algorithms.
 
-       * stack scripts in chords:
-         % fingering:        footing:
-           < a-4 c-2 g-1 >   < c-\ltoe e-\lheel >
+       * design meta-language like TeX and Metafont
 
-       * stackparameterised scripts for fingering and footing:
+       * Global type registration.
 
-            % toe to bheel   four to five
-           %   ^_u            4_5  
-           %     -                           
-           %  --|x--         --|x--
-           %  --|---         --|---
-           %  --|---         --|---
-          (where "to" is a tiny bow)
+               My_class * p = create_object( My_class )
+               Type t = get_type ( *p );
+               if ( t <= get_type( q ))
+                       ..
 
-       * move towards incremental algorithms.
+       
+       * virtualise PCols to make encapsulated spacing problems
+
+       * don't count bars which are not on first beat.
+
+       * naming of Voice_group/Voice
+
+       * benchmark band_matrices.
+
+       * versioning stuff (cvt mudela, mudela, etc.)
+
+       * a real convert-mudela
+
+       * dots into separate item.
+
+       * use String iso Text_def for lyrics.
+
+       * use position 0 for center of staff iso bottom.
+
+       * Klavarskribo?
+
+       * return status on exit
+
+       * lyrics in chords still fuck up.
+
+       * rewire acknowledge_element() logic with a process_acknowledged()
+       
+       * pushgroup/popgroup
+
+       * whole head on ledger line
 
-       * design meta-language like TeX and Metafont
diff --git a/VERSION b/VERSION
index 3248c2e3ff003a5d641061ec2e2482a941823999..b5229ae0ebaabbcdd76371fdee8052dff69a9244 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 TOPLEVEL_MAJOR_VERSION = 0
 TOPLEVEL_MINOR_VERSION = 1
-TOPLEVEL_PATCH_LEVEL = 8
+TOPLEVEL_PATCH_LEVEL = 9
 
 # use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL = .jcn1
+TOPLEVEL_MY_PATCH_LEVEL = 
index eae3c49cea5a999f756af105a364160419382ff4..4a98301af3ec39e63d61ebee2590e5a2dce6b22a 100644 (file)
@@ -15,26 +15,28 @@ const Real EPS = 1e-7;              // so sue me. Hard coded
 void
 Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const
 {
-    int n= rhs.dim();
-    assert (n == L.dim());
-    Vector y;
-    y.set_dim (n);
-    out.set_dim (n);
-    
-    // forward substitution
-    for (int i=0; i < n; i++) {
+  int n= rhs.dim();
+  assert (n == L.dim());
+  Vector y;
+  y.set_dim (n);
+  out.set_dim (n);
+  
+  // forward substitution
+  for (int i=0; i < n; i++) 
+    {
        Real sum (0.0);
        for (int j=0; j < i; j++)
            sum += y (j) * L(i,j);
        y (i) = (rhs (i) - sum)/L(i,i);
     }
-    
-    for (int i=0; i < n; i++)
+  
+  for (int i=0; i < n; i++)
        y (i) /= D(i);
 
-    // backward subst
-    Vector &x (out);           // using input as return val.
-    for (int i=n-1; i >= 0; i--) {
+  // backward subst
+  Vector &x (out);             // using input as return val.
+  for (int i=n-1; i >= 0; i--) 
+    {
        Real sum (0.0);
        for (int j=i+1; j < n; j++)
            sum += L(j,i)*x (j);
@@ -45,28 +47,30 @@ Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const
 void
 Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const
 {
-    int n= rhs.dim();
-    int b = L.band_i();
-    assert (n == L.dim());
+  int n= rhs.dim();
+  int b = L.band_i();
+  assert (n == L.dim());
 
-      out.set_dim (n);
+    out.set_dim (n);
+  
+  Vector y;
+  y.set_dim (n);
   
-    Vector y;
-    y.set_dim (n);
-    
-    // forward substitution
-    for (int i=0; i < n; i++) {
+  // forward substitution
+  for (int i=0; i < n; i++) 
+    {
        Real sum (0.0);
        for (int j= 0 >? i - b; j < i; j++)
            sum += y (j) * L(i,j);
        y (i) = (rhs (i) - sum)/L(i,i);
     }
-    for (int i=0; i < n; i++)
+  for (int i=0; i < n; i++)
        y (i) /= D(i);
 
-    // backward subst
-    Vector &x (out);           // using input as return val.
-    for (int i=n-1; i >= 0; i--) {
+  // backward subst
+  Vector &x (out);             // using input as return val.
+  for (int i=n-1; i >= 0; i--) 
+    {
        Real sum (0.0);
        for (int j=i+1; j <= i + b&&j < n ; j++)
            sum += L(j,i)*x (j);
@@ -77,18 +81,20 @@ Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const
 void
 Choleski_decomposition::solve (Vector &x, Vector const &rhs)const
 {
-    if (L.band_b()) {
+  if (L.band_b()) 
+    {
        band_matrix_solve (x,rhs);
-    } else
+    }
+  else
        full_matrix_solve (x,rhs);
 }
 
 Vector
 Choleski_decomposition::solve (Vector rhs)const
 {
-    Vector r;
-    solve (r, rhs);
-    return r;
+  Vector r;
+  solve (r, rhs);
+  return r;
 }
 
 void
@@ -96,14 +102,16 @@ Choleski_decomposition::full_matrix_decompose (Matrix const & P)
 {
  
    int n = P.dim();
-    L.unit();
-    for (int k= 0; k < n; k++) {
-       for (int j = 0; j < k; j++){
+  L.unit();
+  for (int k= 0; k < n; k++) 
+    {
+       for (int j = 0; j < k; j++)
+         {
            Real sum (0.0);
            for (int l=0; l < j; l++)
                sum += L(k,l)*L(j,l)*D(l);
            L(k,j) = (P(k,j) - sum)/D(j);
-       }
+         }
        Real sum=0.0;
        
        for (int l=0; l < k; l++)
@@ -117,17 +125,19 @@ Choleski_decomposition::full_matrix_decompose (Matrix const & P)
 void
 Choleski_decomposition::band_matrix_decompose (Matrix const &P)
 {
-    int n = P.dim();
-    int b = P.band_i();
-    L.unit();
-    
-    for (int i= 0; i < n; i++) {
-       for (int j = 0 >? i - b; j < i; j++){
+  int n = P.dim();
+  int b = P.band_i();
+  L.unit();
+  
+  for (int i= 0; i < n; i++) 
+    {
+       for (int j = 0 >? i - b; j < i; j++)
+         {
            Real sum (0.0);
            for (int l=0 >? i - b; l < j; l++)
                sum += L(i,l)*L(j,l)*D(l);
            L(i,j) = (P(i,j) - sum)/D(j);
-       }
+         }
        Real sum=0.0;
        
        for (int l=0 >? i - b; l < i; l++)
@@ -135,8 +145,8 @@ Choleski_decomposition::band_matrix_decompose (Matrix const &P)
        Real d = P(i,i) - sum;
        D(i) = d;
     }
-    L.try_set_band();
-    assert ( L.band_i() == P.band_i ());
+  L.try_set_band();
+  assert ( L.band_i() == P.band_i ());
 }
 
 
@@ -150,46 +160,47 @@ Choleski_decomposition::Choleski_decomposition (Matrix const & P)
    : L(P.dim()), D(P.dim ())
 { 
 #ifdef PARANOID
-    assert ((P-P.transposed()).norm ()/P.norm () < EPS);
+  assert ((P-P.transposed()).norm ()/P.norm () < EPS);
 #endif
-    if  (P.band_b()) 
+  if  (P.band_b()) 
        band_matrix_decompose (P);
-    else
+  else
        full_matrix_decompose (P);
  
 
 #ifdef PARANOID
-    assert ((original()-P).norm () / P.norm () < EPS);
+  assert ((original()-P).norm () / P.norm () < EPS);
 #endif
 }
 
 Matrix
 Choleski_decomposition::original() const
 {
-    Matrix T(L.dim());
-    T.set_diag (D);
-    return L*T*L.transposed();
+  Matrix T(L.dim());
+  T.set_diag (D);
+  return L*T*L.transposed();
 }
 
 Matrix
 Choleski_decomposition::inverse() const
 {
-    int n=L.dim();
-    Matrix invm (n);
-    Vector e_i (n);
-    Vector inv (n);
-    for (int i = 0; i < n; i++) {
+  int n=L.dim();
+  Matrix invm (n);
+  Vector e_i (n);
+  Vector inv (n);
+  for (int i = 0; i < n; i++) 
+    {
        e_i.set_unit (i);
        solve (inv, e_i);
        for (int j = 0 ; j<n; j++)
            invm (i,j) = inv (j);
     }
-    
+  
 #ifdef PARANOID
-    Matrix I1(n), I2(original());
-    I1.unit();
-    assert ((I1-I2*invm).norm()/I2.norm () < EPS);
+  Matrix I1(n), I2(original());
+  I1.unit();
+  assert ((I1-I2*invm).norm()/I2.norm () < EPS);
 #endif
-    
-    return invm;
+  
+  return invm;
 }
index b324f200397266f6499cd586924c81ef3f2599d6..251380d3c806f5a11a16a0696253019e181ccccb 100644 (file)
@@ -6,21 +6,21 @@
 void 
 Data_file::gobble_white()
 {
-    char c;
-    
-    while ((c=data_get()) == ' ' ||c == '\t')
+  char c;
+  
+  while ((c=data_get()) == ' ' ||c == '\t')
        if (eof()) 
            break;
 
-    data_unget (c);
+  data_unget (c);
 }
 
 String
 Data_file::get_word() 
 {// should handle escape seq's
-    String s;
+  String s;
 
-    while (1) 
+  while (1) 
        {
        char    c  = data_get();
        
@@ -28,7 +28,7 @@ Data_file::get_word()
            {
            data_unget (c);
            break;
-           }
+             }
        
        
        if (c == '\"')
@@ -46,9 +46,9 @@ Data_file::get_word()
            }       
        else
            s += c;             
-       }
-    
-    return s;        
+         }
+  
+  return s;          
 }
 
 /**  get a char 
@@ -56,39 +56,41 @@ Data_file::get_word()
    */
 char
 Data_file::data_get() {
-    char c =  get(); 
-    if (!rawmode && c == '#') // gobble comment
+  char c =  get(); 
+  if (!rawmode && c == '#') // gobble comment
        {       
        while ((c = get()) != '\n' && !eof ()) 
            ;
            return '\n';
-       }    
+         }
 
-    return c;
+  return c;
 }
 
 /// read line, gobble '\n'    
 String Data_file::get_line()     
 {
-    char c; 
-    String s;
+  char c; 
+  String s;
 
-    while ((c  = data_get()) != '\n' && !eof ())
+  while ((c  = data_get()) != '\n' && !eof ())
        s += c;
-    return s;  
+  return s;    
 }
 
 /// gobble stuff before first entry on a line.    
 void
 Data_file::gobble_leading_white() 
 {
-    // eat blank lines.
-    while (!eof()) {
+  // eat blank lines.
+  while (!eof()) 
+    {
        char c = data_get();                
-       if (!isspace (c)) {
+       if (!isspace (c)) 
+         {
            data_unget (c);
            break;
-       }
+         }
     }
 }
 
index 92ed98920712e4bf971e62db8cf0bb2e098d4fe0..17699384cd14152cbef24d2401c2359c780b1a00 100644 (file)
@@ -21,7 +21,7 @@
 int
 Diagonal_storage::dim()const
 {
-    return band_.rows();
+  return band_.rows();
 }
 
 Diagonal_storage::Diagonal_storage()
@@ -31,27 +31,28 @@ Diagonal_storage::Diagonal_storage()
 int
 Diagonal_storage::rows() const
 {
-    return band_.rows();
+  return band_.rows();
 }
 
 int
 Diagonal_storage::cols() const
 {
-    return band_.rows();
+  return band_.rows();
 }
 
 int
 Diagonal_storage::band_size_i()const
 {
-    return (band_.cols()-1)/2;
+  return (band_.cols()-1)/2;
 }
 
 void
 Diagonal_storage::set_band_size (int s)
 {
-    assert (s>=0);
-    Full_storage f (dim(), 2*s+1);
-    for (int i=0; i < dim(); i++) {
+  assert (s>=0);
+  Full_storage f (dim(), 2*s+1);
+  for (int i=0; i < dim(); i++) 
+    {
        int k=-s;
        for ( ;  k < -band_size_i(); k++)
            f.elem (i,k + s) = 0.0;
@@ -61,7 +62,7 @@ Diagonal_storage::set_band_size (int s)
            f.elem (i, k + s) =0.0;
     }
 
-    band_ = f;
+  band_ = f;
 }
 
 
@@ -72,13 +73,13 @@ Diagonal_storage::set_band_size (int s)
 void
 Diagonal_storage::insert_row (int)
 {
-    assert (false);
+  assert (false);
 }
 
 void
 Diagonal_storage::delete_row (int)
 {
-    assert (false);
+  assert (false);
 }
 
 void
@@ -94,9 +95,9 @@ Diagonal_storage::resize (int)
 void
 Diagonal_storage::delete_column (int)
 {
-    assert (false);
+  assert (false);
 }
-    
+  
 Diagonal_storage::~Diagonal_storage()
 {
 }
@@ -105,27 +106,28 @@ Diagonal_storage::~Diagonal_storage()
 bool
 Diagonal_storage::band_elt_b (int i,int j)const
 {
-    return abs (i-j) <= band_size_i();
+  return abs (i-j) <= band_size_i();
 }
 
 void
 Diagonal_storage::assert_valid (int i,int j)const
 {
-    assert (band_elt_b (i,j));
-    assert (i >=0 && j >=0 && i < dim() && j < dim ());
+  assert (band_elt_b (i,j));
+  assert (i >=0 && j >=0 && i < dim() && j < dim ());
 }
 
 
 void
 Diagonal_storage::resize_dim (int d)
 {
-    Full_storage f (d, 2*band_size_i()+1);
-    for (int i=0; i < d && i < dim(); i++) {
+  Full_storage f (d, 2*band_size_i()+1);
+  for (int i=0; i < d && i < dim(); i++) 
+    {
        for ( int k=0;  k < 2*band_size_i(); k++)
            f.elem (i,k) = elem (i,k);
     }
 
-    band_ = f;
+  band_ = f;
 }
 
 
@@ -133,16 +135,17 @@ Diagonal_storage::resize_dim (int d)
 bool
 Diagonal_storage::mult_ok (int i,int)const
 {
-    return i < dim();
+  return i < dim();
 }
 
 void
 Diagonal_storage::mult_next (int &i, int &j)const
 {
-    j++;
-    if ( j < i - band_size_i()) 
+  j++;
+  if ( j < i - band_size_i()) 
        j = i- band_size_i();
-    if ( j > i + band_size_i() || j >= dim ()) {
+  if ( j > i + band_size_i() || j >= dim ()) 
+    {
        i++;
        j = 0 >? i - band_size_i(); 
     }
@@ -151,17 +154,18 @@ Diagonal_storage::mult_next (int &i, int &j)const
 bool
 Diagonal_storage::trans_ok (int ,int j)const
 {
-    return j < dim();
+  return j < dim();
 }
 
 void
 Diagonal_storage::trans_next (int &i, int& j)const
 {
-    i++;
-    if ( i < j - band_size_i())
+  i++;
+  if ( i < j - band_size_i())
        i = j-band_size_i();
-    
-    if ( i >= dim() || i > j + band_size_i ()) {
+  
+  if ( i >= dim() || i > j + band_size_i ()) 
+    {
        j++;
        i = 0 >? j - band_size_i(); 
     }
@@ -172,23 +176,23 @@ static Real nul_entry=0.0;
 Real 
 Diagonal_storage::elem (int i, int j)const
 {
-    if (abs ( i-j) > band_size_i())
+  if (abs ( i-j) > band_size_i())
        return 0;
-    else
+  else
        return band_.elem (i, j - i +band_size_i());
 }
 
 Real &
 Diagonal_storage::elem (int i, int j)
 {
-    /*
-      if this fails, the previous call fucked up
-      */
-    assert (!nul_entry);
+  /*
+    if this fails, the previous call fucked up
+    */
+  assert (!nul_entry);
 
-    if (abs ( i-j) > band_size_i())  
+  if (abs ( i-j) > band_size_i())  
        return nul_entry;
-    else
+  else
        return band_.elem (i, j - i + band_size_i());
 }
 
@@ -200,17 +204,19 @@ bool
 Diagonal_storage::try_right_multiply (Matrix_storage*dest,
                                     const Matrix_storage*right)const
 {
-    if ( right->name() != Diagonal_storage::static_name ()) 
+  if ( right->name() != Diagonal_storage::static_name ()) 
        return false;
-    
-    const Diagonal_storage*  right_diag = (Diagonal_storage const*)right;
-    int band2 = right_diag->band_size_i();
-    int n = dim();
-    /*
-      should check if dest is a Diagonal_storage of sufficient size too.
-     */
-    for (int i=0;  i < n; i++) {
-       for (int j = 0; j < n; j++) {
+  
+  const Diagonal_storage*  right_diag = (Diagonal_storage const*)right;
+  int band2 = right_diag->band_size_i();
+  int n = dim();
+  /*
+    should check if dest is a Diagonal_storage of sufficient size too.
+   */
+  for (int i=0;  i < n; i++) 
+    {
+       for (int j = 0; j < n; j++) 
+         {
            int startk = i - band_size_i() >? 0 >? j - band2;
            int stopk = i + band_size_i() <? n-1 <? j  + band2;
            int relk =  startk + band_size_i() -i;
@@ -219,9 +225,9 @@ Diagonal_storage::try_right_multiply (Matrix_storage*dest,
                sum += band_.elem (i, relk++) * right_diag->elem (k, j);
            dest->elem (i, j) = sum;
            
-       }
+         }
     }
-    return true;
+  return true;
 }
 
 IMPLEMENT_IS_TYPE_B1(Diagonal_storage, Matrix_storage);
@@ -229,17 +235,17 @@ IMPLEMENT_IS_TYPE_B1(Diagonal_storage, Matrix_storage);
 
 Diagonal_storage::Diagonal_storage (Matrix_storage*stor_l, int band_i)
 {
-    set_band_size (band_i);
-    resize_dim (stor_l->dim());
+  set_band_size (band_i);
+  resize_dim (stor_l->dim());
 
-    for ( int i=0,j=0; mult_ok (i,j); mult_next (i,j))
+  for ( int i=0,j=0; mult_ok (i,j); mult_next (i,j))
        band_.elem (i, j + band_i -i) = stor_l->elem (i,j);
 }
 
 void
 Diagonal_storage::OK() const
 {
-    band_.OK();
+  band_.OK();
 }
 
 IMPLEMENT_VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage);
index 2c55688011c804ea4265abed04789fa0a491b58d..46511b4c319bfe0c4d41eb2a9b60eac6a508cee3 100644 (file)
 Link_array<Directed_graph_node> const &
 Directed_graph_node::get_in_edge_arr() const
 {
-    return edge_in_l_arr_;
+  return edge_in_l_arr_;
 }
 
 Link_array<Directed_graph_node> const &
 Directed_graph_node::get_out_edge_arr()const
 {
-    return edge_out_l_arr_;
+  return edge_out_l_arr_;
 }
 
 /**
@@ -37,7 +37,7 @@ Directed_graph_node::Directed_graph_node (Directed_graph_node const&)
 void
 Directed_graph_node::copy_edges_out (Directed_graph_node const &s)
 {
-    for (int i=0; i < s.edge_out_l_arr_.size(); i++)
+  for (int i=0; i < s.edge_out_l_arr_.size(); i++)
        add (s.edge_out_l_arr_[i]);
 }
 
@@ -45,11 +45,12 @@ void
 Directed_graph_node::OK() const
 { 
 #ifndef NDEBUG
-    for (int i=0; i < edge_out_l_arr_.size(); i++) {
+  for (int i=0; i < edge_out_l_arr_.size(); i++) 
+    {
        assert (edge_out_l_arr_[i]->
               edge_in_l_arr_.find_l (this));
     }
-    for (int i=0; i < edge_in_l_arr_.size(); i++)
+  for (int i=0; i < edge_in_l_arr_.size(); i++)
        assert (edge_in_l_arr_[i]->contains_b (this));
 #endif
 }
@@ -57,52 +58,53 @@ Directed_graph_node::OK() const
 bool
 Directed_graph_node::contains_b (const Directed_graph_node *d)const
 {
-    return edge_out_l_arr_.find_l ((Directed_graph_node*)d);
+  return edge_out_l_arr_.find_l ((Directed_graph_node*)d);
 }
-    
+  
 void
 Directed_graph_node::remove_edge_out_idx (int i)
 {
-    PARANOID_OK();
-    Directed_graph_node * d_l = edge_out_l_arr_.get (i);
+  PARANOID_OK();
+  Directed_graph_node * d_l = edge_out_l_arr_.get (i);
 
-    int j = d_l->edge_in_l_arr_.find_i (this);
-    assert (j>=0);
-    d_l->edge_in_l_arr_.unordered_del (j);
-    PARANOID_OK();
+  int j = d_l->edge_in_l_arr_.find_i (this);
+  assert (j>=0);
+  d_l->edge_in_l_arr_.unordered_del (j);
+  PARANOID_OK();
 }
 
 void
 Directed_graph_node::remove_edge_in (Directed_graph_node *d_l)
 {
-    PARANOID_OK();
-    d_l->remove_edge_out (this);
-    PARANOID_OK();
+  PARANOID_OK();
+  d_l->remove_edge_out (this);
+  PARANOID_OK();
 }
  
 void
 Directed_graph_node::remove_edge_out (Directed_graph_node *d_l)
 {
-    PARANOID_OK();
-    for (int i=0; i < edge_out_l_arr_.size();) {
+  PARANOID_OK();
+  for (int i=0; i < edge_out_l_arr_.size();) 
+    {
        if (edge_out_l_arr_[i]== d_l)
            remove_edge_out_idx (i);
        else
            i++;
     }
-    PARANOID_OK();
+  PARANOID_OK();
 }
 bool
 Directed_graph_node::linked_b()const
 {
-    return edge_out_l_arr_.size() || edge_in_l_arr_.size ();
+  return edge_out_l_arr_.size() || edge_in_l_arr_.size ();
 }
 
 void
 Directed_graph_node::junk_links()
 {
-    edge_in_l_arr_.set_size (0);
-    edge_out_l_arr_.set_size (0);
+  edge_in_l_arr_.set_size (0);
+  edge_out_l_arr_.set_size (0);
 }
 
 
@@ -130,21 +132,21 @@ Directed_graph_node::unlink()
 
 Directed_graph_node::~Directed_graph_node()
 {
-    assert (!linked_b());
+  assert (!linked_b());
 }
 
-    
+  
 void
 Directed_graph_node::add (Directed_graph_node* dep_l)
 {
-    PARANOID_OK();
-    if (!dep_l)
+  PARANOID_OK();
+  if (!dep_l)
        return ;
-    dep_l->edge_in_l_arr_.push (this);
-    edge_out_l_arr_.push (dep_l);
-    PARANOID_OK();
+  dep_l->edge_in_l_arr_.push (this);
+  edge_out_l_arr_.push (dep_l);
+  PARANOID_OK();
 }
-    
+  
 
 Directed_graph_node::Directed_graph_node()
 {
index f6d1d48867faf0090bac8093052c83bd4c356cd0..f11576d5900e1fafc0575e5737653f66d54e3119 100644 (file)
@@ -23,88 +23,91 @@ const INDTAB = 2;
 static String
 strip_pretty (String pretty_str)
 {
-    int i = pretty_str.index_i ('(');
-    if (i>=0)
+  int i = pretty_str.index_i ('(');
+  if (i>=0)
        pretty_str = pretty_str.left_str (i);
-    
-    int l = pretty_str.index_last_i (' '); // strip until last ' '
-    if (l>=0)
+  
+  int l = pretty_str.index_last_i (' '); // strip until last ' '
+  if (l>=0)
        pretty_str = pretty_str.nomid_str (0,l+1);
-    return pretty_str;
+  return pretty_str;
 }
 
 static String
 strip_member (String pret)
 {
-    int l=pret.index_last_i (':')-1;
-    if (l>=0)
+  int l=pret.index_last_i (':')-1;
+  if (l>=0)
        pret = pret.left_str (l);
-    return pret;
+  return pret;
 }
 
 Dstream&
 Dstream::identify_as (String name)
 {
-    if (!os_l_)
+  if (!os_l_)
        return *this;
-    
-    String mem (strip_pretty (name));
-    String cl (strip_member (mem));
-    String idx = cl;
-    
-    if (silent_assoc_p_->elt_b (mem))
+  
+  String mem (strip_pretty (name));
+  String cl (strip_member (mem));
+  String idx = cl;
+  
+  if (silent_assoc_p_->elt_b (mem))
        idx  = mem;
-    else if (silent_assoc_p_->elt_b (cl))
+  else if (silent_assoc_p_->elt_b (cl))
        idx = cl;
-    else {
+  else 
+    {
        (*silent_assoc_p_)[idx] = false;
     }
-    local_silence_b_ = (*silent_assoc_p_)[idx];
-    if (current_classname_str_ != idx && !local_silence_b_) {
+  local_silence_b_ = (*silent_assoc_p_)[idx];
+  if (current_classname_str_ != idx && !local_silence_b_) 
+    {
        current_classname_str_=idx;
        if (!(*silent_assoc_p_)["Dstream"])
            *os_l_ << "[" << current_classname_str_ << ":]"; // messy.
     }
-    return *this;
+  return *this;
 }
 
 bool
 Dstream::silence (String s)
 {
-    if (!silent_assoc_p_->elt_b (s))
+  if (!silent_assoc_p_->elt_b (s))
        return false;
-    return (*silent_assoc_p_)[s];
+  return (*silent_assoc_p_)[s];
 }
 
 Dstream &
 Dstream::operator<<(String s)
 {
-    output (s);
-    return *this;
+  output (s);
+  return *this;
 }
 
 Dstream &
 Dstream::operator<<(void const *v_l)
 {
-    output (String_convert::pointer_str (v_l));
-    return *this;
+  output (String_convert::pointer_str (v_l));
+  return *this;
 }
 
 Dstream &
 Dstream::operator<<(char const *ch_l)
 {
-    output (ch_l);
-    return *this;
+  output (ch_l);
+  return *this;
 }
 
 void
 Dstream::output (String s)
 {
-    if (local_silence_b_|| !os_l_)
+  if (local_silence_b_|| !os_l_)
        return ;
-    
-    for (char const *cp = s  ; *cp; cp++)
-       switch (*cp) {
+  
+  for (char const *cp = s  ; *cp; cp++)
+       switch (*cp) 
+         {
            case '{':
            case '[':
            case '(': indent_level_i_ += INDTAB;
@@ -126,33 +129,34 @@ Dstream::output (String s)
            default:
                *os_l_ << *cp;
                break;
-           }
-    return ;    
+             }
+  return ;    
 }
 
 
 Dstream::Dstream (ostream *r, char const * cfg_nm)
 {
-    os_l_ = r;
-    silent_assoc_p_ = new Assoc<String,bool>;
-    indent_level_i_ = 0;
-    if (!os_l_)
+  os_l_ = r;
+  silent_assoc_p_ = new Assoc<String,bool>;
+  indent_level_i_ = 0;
+  if (!os_l_)
        return;
-    
-    char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
-    {
+  
+  char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
+  {
        ifstream ifs (fn);      // can't open
        if (!ifs)
            return;
     }
 
-    Text_db cfg (fn);
-    while (! cfg.eof()){            
+  Text_db cfg (fn);
+  while (! cfg.eof()){      
         Text_record  r (cfg++);
-        if (r.size() != 2) {
+        if (r.size() != 2) 
+          {
             r.message ("not enough fields in Dstream init.");
             continue;
-        }
+          }
         (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
     }
 
@@ -161,14 +165,15 @@ Dstream::Dstream (ostream *r, char const * cfg_nm)
 
 Dstream::~Dstream()
 {    
-    delete silent_assoc_p_;
-    assert (!indent_level_i_) ;
+  delete silent_assoc_p_;
+  assert (!indent_level_i_) ;
 }
 
 void
 Dstream::clear_silence() 
 {
-    for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++) {
+  for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++) 
+    {
        i.val() = 0;
     }
 }
index 5ea5e50dc051ec66ee459bc03dddc34eae48c52b..52156f983a86f0da23d94caa82cd3f7b8b36f45d 100644 (file)
@@ -13,11 +13,11 @@ Dstream *flower_dstream  = &default_flower_stream;
 void set_flower_debug (Dstream&ds, bool b)
 {
 #ifdef NPRINT
-    if (b)
+  if (b)
        cout << "Debug printout disabled, see the installation guide." << endl;
 #endif
-    
-    flower_check_debug = b;
-    flower_dstream = &ds;
+  
+  flower_check_debug = b;
+  flower_dstream = &ds;
 }
 
index 84cfd803d32aafaf4eda8f6b17394ee33d6ee506..6372f502779c76ed5661ff81c20d41d126791fd1 100644 (file)
@@ -10,7 +10,7 @@ static const int build=
 char const * 
 flower_version_sz()
 {
-    static char v[1024];
-    sprintf (v, s, build);
-    return v;
+  static char v[1024];
+  sprintf (v, s, build);
+  return v;
 }
index 34dcdad1b8ceb1bed7e181dbf5bd2fedc43ecc0d..ee59ea23ed968cc9f6b553eea7731fdce5bd1254 100644 (file)
 void
 Full_storage::operator=(Full_storage const &fs)
 {
-    resize (fs.height_i_, fs.width_i_);
-    OK();
-    fs.OK();
-    for (int i=0; i<height_i_; i++)
+  resize (fs.height_i_, fs.width_i_);
+  OK();
+  fs.OK();
+  for (int i=0; i<height_i_; i++)
        for (int j=0; j<width_i_; j++)
            els_p_p_[i][j]= fs.els_p_p_[i][j];
 }
@@ -26,9 +26,9 @@ Full_storage::OK() const
 {
 #ifndef NDEBUG
 
-    assert (max_height_i_ >= height_i_ && max_width_i_ >= width_i_);
-    assert (height_i_ >= 0 && width_i_ >= 0);
-    assert (els_p_p_||!max_height_i_);
+  assert (max_height_i_ >= height_i_ && max_width_i_ >= width_i_);
+  assert (height_i_ >= 0 && width_i_ >= 0);
+  assert (els_p_p_||!max_height_i_);
 #endif
 }
 
@@ -37,18 +37,18 @@ Full_storage::OK() const
 
 Full_storage::~Full_storage() 
 {
-    for (int i=0; i < max_height_i_; i++)
+  for (int i=0; i < max_height_i_; i++)
        delete [] els_p_p_[i];
-    delete[] els_p_p_;
+  delete[] els_p_p_;
 }
 
 void
 
 Full_storage::resize (int rows, int cols)
 {
-    OK();
-    resize_cols (rows);
-    resize_rows (cols);
+  OK();
+  resize_cols (rows);
+  resize_rows (cols);
 }
 
 
@@ -56,14 +56,14 @@ Full_storage::resize (int rows, int cols)
 bool
 Full_storage::mult_ok (int i, int) const
 {
-    return i < height_i_;
+  return i < height_i_;
 }
 
 
 bool
 Full_storage::trans_ok (int , int j) const
 {
-       return j < width_i_;
+     return j < width_i_;
 } 
 
 
@@ -71,9 +71,10 @@ Full_storage::trans_ok (int , int j) const
 void
 Full_storage::trans_next (int &i, int &j) const
 {
-    assert (trans_ok (i,j));
-    i++;
-    if (i >= height_i_) {
+  assert (trans_ok (i,j));
+  i++;
+  if (i >= height_i_) 
+    {
        i=0;
        j ++;
     }
@@ -83,9 +84,10 @@ Full_storage::trans_next (int &i, int &j) const
 void
 Full_storage::mult_next (int &i, int &j) const
 {
-    assert (mult_ok (i,j));
-    j++;
-    if (j >= width_i_) {
+  assert (mult_ok (i,j));
+  j++;
+  if (j >= width_i_) 
+    {
        j=0;
        i++;
     }
@@ -95,22 +97,22 @@ Full_storage::mult_next (int &i, int &j) const
 void
 Full_storage::delete_column (int k)
 {
-    assert (0 <= k &&k<width_i_);    
-    for (int i=0; i< height_i_ ; i++)
+  assert (0 <= k &&k<width_i_);    
+  for (int i=0; i< height_i_ ; i++)
        for (int j=k+1; j <width_i_; j++)
            els_p_p_[i][j-1]=els_p_p_[i][j];
-    width_i_--;
+  width_i_--;
 }
 
 
 void
 Full_storage::delete_row (int k)
 {
-    assert (0 <= k &&k<height_i_);
-    for (int i=k+1; i < height_i_ ; i++)
+  assert (0 <= k &&k<height_i_);
+  for (int i=k+1; i < height_i_ ; i++)
        for (int j=0; j < width_i_; j++)
            els_p_p_[i-1][j]=els_p_p_[i][j];
-    height_i_--;
+  height_i_--;
 }
 
 
@@ -118,9 +120,9 @@ Full_storage::delete_row (int k)
 void
 Full_storage::insert_row (int k)
 {
-    assert (0 <= k&& k <=height_i_);
-    resize_cols (height_i_+1);
-    for (int i=height_i_-1; i > k ; i--)
+  assert (0 <= k&& k <=height_i_);
+  resize_cols (height_i_+1);
+  for (int i=height_i_-1; i > k ; i--)
        for (int j=0; j <width_i_; j++)
            els_p_p_[i][j]=els_p_p_[i-1][j];
 
@@ -129,57 +131,59 @@ Full_storage::insert_row (int k)
 bool
 Full_storage::try_right_multiply (Matrix_storage * dest, Matrix_storage const * right)const
 {
-    if (dest->name() != Full_storage::static_name () ||
+  if (dest->name() != Full_storage::static_name () ||
        right->name() != Full_storage::static_name ())
        return false;
 
-    Full_storage *d_l = (Full_storage*)dest;
-    Full_storage *r_l = (Full_storage*)right;
-    
-    d_l->set_size (height_i_, r_l->width_i_);
-    for (int i=0; i < d_l->height_i_; i++)
-       for (int j = 0; j < d_l->width_i_; j++) {
+  Full_storage *d_l = (Full_storage*)dest;
+  Full_storage *r_l = (Full_storage*)right;
+  
+  d_l->set_size (height_i_, r_l->width_i_);
+  for (int i=0; i < d_l->height_i_; i++)
+       for (int j = 0; j < d_l->width_i_; j++) 
+         {
            Real &r (d_l->els_p_p_[i][j]);
            r=0.0;
            for (int k = 0; k < width_i_; k++)
                r += els_p_p_[i][k] * r_l->els_p_p_[k][j];
            
-       }
-    return true;
-    
-    
+         }
+  return true;
+  
+  
 }
 IMPLEMENT_IS_TYPE_B1(Full_storage,Matrix_storage);
 void
 Full_storage::resize_cols (int newh)
 {
-    if (newh <= max_height_i_) {
+  if (newh <= max_height_i_) 
+    {
        height_i_=newh;
        return;
     }
    
-    Real ** newa=new Real*[newh];
-    int j=0;
-    for (; j < height_i_; j++)
+  Real ** newa=new Real*[newh];
+  int j=0;
+  for (; j < height_i_; j++)
        newa[j] = els_p_p_[j];
-    for (; j < newh; j++)
+  for (; j < newh; j++)
        newa[j] = new Real[max_width_i_];
-    delete[] els_p_p_;
-    els_p_p_=newa;
+  delete[] els_p_p_;
+  els_p_p_=newa;
 
-    height_i_ = max_height_i_ = newh;
+  height_i_ = max_height_i_ = newh;
 }
 
 
 
 Full_storage::Full_storage (Matrix_storage*m)
 {
-    set_size (m->rows(), m->cols ());
-    if ( !m->is_type_b ( Full_storage::static_name()))
+  set_size (m->rows(), m->cols ());
+  if ( !m->is_type_b ( Full_storage::static_name()))
        for (int i=0; i<height_i_; i++)
            for (int j=0; j<width_i_; j++)
                els_p_p_[i][j]=0.0;
-    for (int i,j=0; m->mult_ok (i,j); m->mult_next (i,j))
+  for (int i,j=0; m->mult_ok (i,j); m->mult_next (i,j))
        els_p_p_[i][j] = m->elem (i,j);
 }
 
@@ -187,11 +191,13 @@ Full_storage::Full_storage (Matrix_storage*m)
 void
 Full_storage::resize_rows (int neww)
 {
-    if (neww <= max_width_i_) {
+  if (neww <= max_width_i_) 
+    {
        width_i_=neww;
        return;
     }
-    for (int i=0; i < max_height_i_ ; i++) {
+  for (int i=0; i < max_height_i_ ; i++) 
+    {
        Real* newa = new Real[neww];
        for (int k=0; k < width_i_; k++)
            newa[k] = els_p_p_[i][k];
@@ -199,7 +205,7 @@ Full_storage::resize_rows (int neww)
        delete[] els_p_p_[i];
        els_p_p_[i] = newa;
     }
-    width_i_ = max_width_i_ = neww;    
+  width_i_ = max_width_i_ = neww;      
 }
 
 #ifdef INLINE
index d0b2439af41d61b23d9d917eee687dd8d10a14e6..4fce0b19537a0976bd4e129142a2425c8cffcbd2 100644 (file)
@@ -20,126 +20,126 @@ inline
 Cursor<T>::Cursor()
  :   list_(*(List<T> *)0)      // ugh
 {
-    pointer_ = 0;
+  pointer_ = 0;
 }
 
 
 template<class T>
 inline
 Cursor<T>::Cursor (const List<T>& list, Link<T>* pointer) : 
-    list_((List<T>&) list)
+  list_((List<T>&) list)
 {
-    if ( list.size())
-        pointer_ = pointer ? pointer : list.top_;
-    else
-        pointer_ = pointer;
+  if ( list.size())
+      pointer_ = pointer ? pointer : list.top_;
+  else
+      pointer_ = pointer;
 }
 
 template<class T>
 inline
 Cursor<T>::Cursor (const Cursor<T>& cursor) :
-    list_( cursor.list_)
+  list_( cursor.list_)
 {
-    pointer_ = cursor.pointer_;
+  pointer_ = cursor.pointer_;
 }
 
 template<class T>
 inline T&
 Cursor<T>::thing()
 {
-    assert (pointer_);
-    return pointer_->thing();
+  assert (pointer_);
+  return pointer_->thing();
 }
 
 template<class T>
 Cursor<T>
 Cursor<T>::operator =( const Cursor<T>& c)
 {   
-    assert (&list_ == &c.list_);
-    pointer_ = c.pointer_;
-    return *this;
+  assert (&list_ == &c.list_);
+  pointer_ = c.pointer_;
+  return *this;
 }
 
 template<class T>
 inline void
 Cursor<T>::add (const T& th)
 {
-    list_.add (th, *this);
+  list_.add (th, *this);
 }
 
 template<class T>
 inline void
 Cursor<T>::insert (const T& th)
 {
-    list_.insert (th, *this);
+  list_.insert (th, *this);
 }
 
 template<class T>
 inline  List<T>&
 Cursor<T>::list() const
 {
-    return list_;
+  return list_;
 }
 
 template<class T>
 inline Link<T>*
 Cursor<T>::pointer()
 {
-    return pointer_;
+  return pointer_;
 }
 
 template<class T>
 inline bool
 Cursor<T>::backward()const
 {
-    return ( pointer_ != 0);
+  return ( pointer_ != 0);
 }
 
 template<class T>
 inline bool
 Cursor<T>::forward()const
 {
-    return ( pointer_ != 0);
+  return ( pointer_ != 0);
 }
 
 template<class T>
 inline bool
 Cursor<T>::ok()const
 {
-    return ( pointer_ != 0);
+  return ( pointer_ != 0);
 }
 template<class T>
 inline void
 Cursor<T>::next() 
 {
-    assert (pointer_);
-    pointer_ = pointer_->next();
+  assert (pointer_);
+  pointer_ = pointer_->next();
 }
 
 template<class T>
 inline Cursor<T> 
 Cursor<T>::operator ++( int)    
 {
-    Cursor<T> r (*this);
-    next();
-    return r;
+  Cursor<T> r (*this);
+  next();
+  return r;
 }
 
 template<class T>
 inline void
 Cursor<T>::previous() 
 {
-    assert (pointer_);
-    pointer_ = pointer_->previous();
+  assert (pointer_);
+  pointer_ = pointer_->previous();
 }
 
 template<class T>
 inline Cursor<T>
 Cursor<T>::operator --( int)
 {
-    Cursor<T> r (*this);
-    previous();
-    return r;
+  Cursor<T> r (*this);
+  previous();
+  return r;
 }
 
 
index 18f1fbb42aac75a993387d0941b878dfbc4792cf..4bf6347a1d04d775f4e5f4b33be003b14b259f6a 100644 (file)
@@ -8,21 +8,21 @@ template<class T>
  void
 Cursor<T>::backspace()
 {
-    Cursor<T> c (*this);
-    if ( c.ok())
+  Cursor<T> c (*this);
+  if ( c.ok())
        c--;        
-    list_.remove (*this);
+  list_.remove (*this);
 }
 
 template<class T>
  void
 Cursor<T>::del()
 {
-    Cursor<T> c (*this);
-    if ( c.ok())
+  Cursor<T> c (*this);
+  if ( c.ok())
        c++;
-    list_.remove (*this);    
-    *this = c;
+  list_.remove (*this);    
+  *this = c;
 }
 
 
@@ -30,46 +30,46 @@ template<class T>
 Cursor<T> 
 Cursor<T>::operator -=( int j)    
 {
-    while (j--)
+  while (j--)
        (*this)--;
-    return *this;
+  return *this;
 }
 template<class T>
 Cursor<T> 
 Cursor<T>::operator +=( int j)    
 {
-    while (j++)
+  while (j++)
        (*this)++;
-    return *this;
+  return *this;
 }
 
 template<class T>
 Cursor<T> 
 Cursor<T>::operator +( int i) const    
 {
-    Cursor<T> r = *this;
+  Cursor<T> r = *this;
 
-    if (i<0)
+  if (i<0)
        return r -(-i);
 
-    while (i--)
+  while (i--)
        r++;
 
-    return r;
+  return r;
 }
 
 template<class T>
 Cursor<T>
 Cursor<T>::operator -( int i) const
 {
-    Cursor<T> r = *this;
-    if (i<0)
+  Cursor<T> r = *this;
+  if (i<0)
        return r +(-i);
 
-    while (i--)
+  while (i--)
        r--;
-    
-    return r;
+  
+  return r;
 }
 /*
   warning:  can't use Cursor::operator == (Cursor),
@@ -79,31 +79,33 @@ template<class T>
 int
 Cursor<T>::operator-(Cursor<T> rhs) const
 {
-    assert (rhs.list == list);
-    int dif = 0;
+  assert (rhs.list == list);
+  int dif = 0;
 
-    // search from *this on further up (positive difference)
-    Cursor<T> c (*this);
-    while (c.ok() && c.pointer_ != rhs.pointer_) {
+  // search from *this on further up (positive difference)
+  Cursor<T> c (*this);
+  while (c.ok() && c.pointer_ != rhs.pointer_) 
+    {
        c--;
        dif++;
     }
-    
-    if (c.ok())
+  
+  if (c.ok())
        goto gotcha;            // so, sue me.
 
-    // search in direction of bottom. (negative diff)
-    dif =0;
-    c=*this;    
-    while (c.ok() && c.pointer_ !=rhs.pointer_) {
+  // search in direction of bottom. (negative diff)
+  dif =0;
+  c=*this;    
+  while (c.ok() && c.pointer_ !=rhs.pointer_) 
+    {
        dif --;
        c++;
     }
-    assert (c.ok());
+  assert (c.ok());
 
 gotcha:
-    assert ((*this - dif).pointer_ == c.pointer_);
-    return dif;
+  assert ((*this - dif).pointer_ == c.pointer_);
+  return dif;
 }
 
 #endif
index d71dbe07e775acfba6b1178f7862ec51ac11d211..0e45f15b247468b6365a54c46a1c4ef475722e5d 100644 (file)
 INLINE void
 Full_storage::init()
 {
-    els_p_p_=0;
-    height_i_=width_i_=max_height_i_=max_width_i_=0;
+  els_p_p_=0;
+  height_i_=width_i_=max_height_i_=max_width_i_=0;
 }
 INLINE bool
 Full_storage::valid (int i, int j)const
 {
-    return (i>=0 && i < height_i_)
+  return (i>=0 && i < height_i_)
        && (j < width_i_ && j >=0);
 }
 
@@ -28,64 +28,64 @@ Full_storage::valid (int i, int j)const
 INLINE
 Full_storage::Full_storage (Full_storage const&s)
 {
-    init();
-    (*this) = s;
+  init();
+  (*this) = s;
 }
 
 INLINE Real& 
 Full_storage::elem (int i,int j)
 {
-    assert (valid (i,j));
-    return els_p_p_[i][j];
+  assert (valid (i,j));
+  return els_p_p_[i][j];
 }
 
 INLINE Real
 Full_storage::elem (int i, int j) const {
-    assert (valid (i,j));
-    return els_p_p_[i][j];
+  assert (valid (i,j));
+  return els_p_p_[i][j];
 }
 
 INLINE
 Full_storage::Full_storage() {
-    init();
+  init();
 }
 
 
 INLINE int
 Full_storage::rows() const
 {
-    return height_i_;
+  return height_i_;
 }
 INLINE int
 Full_storage::cols() const
 {
-    return width_i_;
+  return width_i_;
 }
 INLINE int
 Full_storage::dim()const
 {
-    assert (rows()==cols ());
-    return rows();
+  assert (rows()==cols ());
+  return rows();
 }
 
 INLINE void
 Full_storage::resize (int i)
 {
-    resize (i,i);
+  resize (i,i);
 }
 
 INLINE   
 Full_storage::Full_storage (int i,int j)
 {
-    init();
-    set_size (i,j);
+  init();
+  set_size (i,j);
 }
 
 INLINE 
 Full_storage::Full_storage (int i)
 {
-    init();
-    set_size (i);
+  init();
+  set_size (i);
 }
  
 INLINE
index efb7644133f4203dd8a9d5e4fca81868587ffb7d..50864b78943b40e3d10f1e19964c01a550f55a1b 100644 (file)
@@ -20,60 +20,60 @@ template<class T>
 int
 _Interval__compare (const Interval_t<T>&a,Interval_t<T> const&b)
 {
-    if (a.left == b.left && a.right == b.right)
+  if (a.left == b.left && a.right == b.right)
        return 0;
-    
-    if (a.left <= b.left && a.right >= b.right)
+  
+  if (a.left <= b.left && a.right >= b.right)
        return 1;
 
-    if (a.left >= b.left && a.right <= b.right)
+  if (a.left >= b.left && a.right <= b.right)
        return -1;
 
-    return -2;
+  return -2;
 }
 
 template<class T>
 bool 
 Interval_t<T>::contains_b (Interval_t<T> const& a)const
 {
-    int c_i= _Interval__compare (*this, a);
-    if (c_i == -2)
+  int c_i= _Interval__compare (*this, a);
+  if (c_i == -2)
        return false;
-    return c_i >= 0;
+  return c_i >= 0;
 }
 
 template<class T>
 int
 Interval__compare (const Interval_t<T>&a,Interval_t<T> const&b)
 {
-    int i = _Interval__compare (a,b);
-    if (i < -1)
+  int i = _Interval__compare (a,b);
+  if (i < -1)
        assert (false);
-    return i;
+  return i;
 }
 
 template<class T>
 void
 Interval_t<T>::set_empty()
 {
-    left = (T) infinity();
-    right = (T) -infinity();
+  left = (T) infinity();
+  right = (T) -infinity();
 }
 
 template<class T>
 T
 Interval_t<T>::length() const {
-    assert (right >= left);
-    return right-left;
+  assert (right >= left);
+  return right-left;
 }
 
 template<class T>
 void
 Interval_t<T>::unite (Interval_t<T> h)
 {
-    if (h.left<left)
+  if (h.left<left)
        left = h.left;
-    if (h.right>right)
+  if (h.right>right)
        right = h.right;
 }
 
@@ -86,11 +86,11 @@ void
 Interval_t<T>::intersect (Interval_t<T> h)
 {
 #if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
-    left = h.left >? left;
-    right = h.right <?right;
+  left = h.left >? left;
+  right = h.right <?right;
 #else
-    left = max (h.left, left);
-    right = min (h.right, right);
+  left = max (h.left, left);
+  right = min (h.right, right);
 #endif
 }
 
@@ -98,26 +98,26 @@ template<class T>
 Interval_t<T>
 intersect (Interval_t<T> x, Interval_t<T> const &y)
 {
-    x.intersect (y);
-    return x;
+  x.intersect (y);
+  return x;
 }
 
 template<class T>
 String
 Interval_t<T>::str() const
 {
-    if (empty_b())
+  if (empty_b())
        return "[empty]";
-    String s ("[");
+  String s ("[");
  
-    return s + String (left) + String ("," ) + String (right ) + String ("]" );
+  return s + String (left) + String ("," ) + String (right ) + String ("]" );
 }
 
 template<class T>
 bool
 Interval_t<T>::elt_b (T r)
 {
-    return r >= left && r <= right;
+  return r >= left && r <= right;
 }
 
 
index 68b87a73fc23d26d6d041958c4b8ba047205799a..7699f1dfbc8f28aa47a674157ac100bba086c94f 100644 (file)
@@ -8,10 +8,12 @@ void
 Link<T>::OK() const
 {
 #ifndef NDEBUG
-    if (previous_) {
+  if (previous_) 
+    {
        assert (previous_->next_ == this);
     }
-    if (next_) {
+  if (next_) 
+    {
        assert (next_->previous_ == this);
     }
 #endif    
@@ -20,18 +22,18 @@ Link<T>::OK() const
 template<class T>
 inline
 Link<T>::Link (const T& thing) : 
-    thing_( thing)
+  thing_( thing)
 {
-    previous_ = next_ = 0;
+  previous_ = next_ = 0;
 }
 
 template<class T>
 inline
 Link<T>::Link (Link<T>* previous, Link<T>* next, const T& thing) : 
-    thing_( thing)
+  thing_( thing)
 {
-    previous_ = previous;
-    next_ = next;
+  previous_ = previous;
+  next_ = next;
 }
 
 template<class T>
@@ -39,7 +41,7 @@ inline
 Link<T>*
 Link<T>::next()
 {
-    return next_;
+  return next_;
 }
 
 template<class T>
@@ -47,7 +49,7 @@ inline
 Link<T>*
 Link<T>::previous()
 {
-    return previous_;
+  return previous_;
 }
 
 template<class T>
@@ -55,40 +57,40 @@ inline
 void
 Link<T>::add (const T& thing)
 {
-    
-    Link<T>* l = new Link<T>( this, next_, thing);
-    if ( next_)
-        next_->previous_ = l;
-    next_ = l;
+  
+  Link<T>* l = new Link<T>( this, next_, thing);
+  if ( next_)
+      next_->previous_ = l;
+  next_ = l;
 }
 
 template<class T>
 inline void
 Link<T>::insert (const T& thing)
 {
-    //    Link<T>* l = new Link<T>( next_, this, thing);
+  //    Link<T>* l = new Link<T>( next_, this, thing);
                                // bugfix hwn 16/9/96
-    Link<T>* l = new Link<T>( previous_, this, thing);
-    if ( previous_)
-        previous_->next_ = l;
-    previous_ = l;
+  Link<T>* l = new Link<T>( previous_, this, thing);
+  if ( previous_)
+      previous_->next_ = l;
+  previous_ = l;
 }
 
 /*
-    don't forget to adjust #l#'s top_ and bottom_.
-    */
+  don't forget to adjust #l#'s top_ and bottom_.
+  */
 template<class T>
 inline void
 Link<T>::remove (List<T> &l)
 {
-    if ( previous_) 
-        previous_->next_ = next_;
-    else 
+  if ( previous_) 
+      previous_->next_ = next_;
+  else 
        l.top_ = next_;
 
-    if ( next_)
-        next_->previous_ = previous_;
-    else
+  if ( next_)
+      next_->previous_ = previous_;
+  else
        l.bottom_ = previous_;
 }
 
@@ -97,6 +99,6 @@ inline
 T&
 Link<T>::thing()
 {
-    return thing_;
+  return thing_;
 }
 #endif
index 83ec3aa7961f9e8fdac1dae585be4563bf834b48..80d12f56ba2323ea6e2bb5a4556a603b045c296b 100644 (file)
@@ -7,26 +7,27 @@ template<class T>
 inline
 List<T>::List()
 {
-    set_empty();
+  set_empty();
 }
 
 template<class T>
 inline void
 List<T>::set_empty()
 {
-    top_ = bottom_ = 0;
-    size_ = 0;
+  top_ = bottom_ = 0;
+  size_ = 0;
 }
 
 template<class T>
 inline void
 List<T>::remove (Cursor<T> me)
 {
-    if ( me.ok()){
+  if ( me.ok())
+    {
        Link<T> *lp = me.pointer();     
        lp->remove (*this);
        delete lp;
-        size_--;
+      size_--;
     }
 }
 
@@ -34,14 +35,14 @@ template<class T>
 inline int
 List<T>::size() const
 { 
-    return size_;
+  return size_;
 }
 
 template<class T>
 inline Cursor<T>
 List<T>::top()const
 {
-    return Cursor<T>( *this, top_);
+  return Cursor<T>( *this, top_);
 }
 
 
@@ -49,7 +50,7 @@ template<class T>
 inline Cursor<T>
 List<T>::bottom()const
 {
-    return Cursor<T>( *this, bottom_);
+  return Cursor<T>( *this, bottom_);
 }
 
 
index fb64cd3ee044d3359fee484679af38cdc17e44b2..1233c4821d6613b6a6d1b467eeaff60a39f6522c 100644 (file)
@@ -18,9 +18,9 @@
 template<class T>
 List<T>::List (List const&src)
 {
-    set_empty();
-    // probably el stupido
-    for (Cursor<T> c (src); c.ok(); c++)
+  set_empty();
+  // probably el stupido
+  for (Cursor<T> c (src); c.ok(); c++)
        bottom().add (c);
 }
 
@@ -28,37 +28,39 @@ template<class T>
 void
 List<T>::OK() const
 {
-    int i = size_;
-    Link<T> *lp = top_;
-    while (i--) {
+  int i = size_;
+  Link<T> *lp = top_;
+  while (i--) 
+    {
        assert (lp);
        lp->OK();
        lp = lp->next();
     }
-    assert (!lp);
-     i = size_;
-    lp = bottom_;
-    while (i--) {
+  assert (!lp);
+   i = size_;
+  lp = bottom_;
+  while (i--) 
+    {
        assert (lp);
        lp->OK();
        lp = lp->previous();
     }
-    assert (!lp);
+  assert (!lp);
 }
 
 template<class T>
 void
 List<T>::junk_links()
 {
-    Cursor<T> c (*this);
-    while (c.ok())
+  Cursor<T> c (*this);
+  while (c.ok())
        c.del();
 }
 
 template<class T>
 List<T>::~List()
 {
-    junk_links();
+  junk_links();
 }
 
 /** 
@@ -77,11 +79,12 @@ template<class T>
 void
 List<T>::add (T const & thing, Cursor<T> &after_me)
 {
-    if (!size_) {              // not much choice if list is empty
-        bottom_ = top_ = new Link<T>( thing);
+  if (!size_) {                // not much choice if list is empty
+      bottom_ = top_ = new Link<T>( thing);
        if (!after_me.ok())
            after_me = bottom();
-    } else {                   // add at aprioprate place
+    }
+  else {                       // add at aprioprate place
        if (!after_me.ok())
            after_me = bottom();
        Link<T> *p =after_me.pointer();
@@ -90,19 +93,22 @@ List<T>::add (T const & thing, Cursor<T> &after_me)
            bottom_ = p->next();
     }
 
-    size_++;
+  size_++;
 }
 
 template<class T>
 void
 List<T>::insert (T const & thing, Cursor<T> &before_me)
 {
-    if (!size_) {
+  if (!size_) 
+    {
        bottom_ = top_ = new Link<T>( thing);
        if (!before_me.ok())
            before_me = top();
        
-    } else {
+    }
+  else 
+    {
        if (!before_me.ok())
            before_me = top();
        
@@ -113,7 +119,7 @@ List<T>::insert (T const & thing, Cursor<T> &before_me)
            top_ = p->previous();
     }
 
-    size_++;
+  size_++;
 }
 
 
@@ -121,8 +127,9 @@ template<class T>
 void
 List<T>::concatenate (List<T> const&s)
 {
-    Cursor<T> b (bottom());
-    for (Cursor<T> c (s); c.ok(); c++) {
+  Cursor<T> b (bottom());
+  for (Cursor<T> c (s); c.ok(); c++) 
+    {
        b.add (c);
        b++;
     }
index e8de3d5da163c0616d23c72684f3862abdd25fa8..c2b459a267e66ba72e46facc83c448cbbe1ad400 100644 (file)
@@ -5,12 +5,12 @@ void
 PCursor<T>::junk()
 {
 #if !defined (NDEBUG) && defined (PARANOID)
-    list().OK();
+  list().OK();
 #endif
 
-    delete ptr();
+  delete ptr();
 #if !defined (NDEBUG)&&defined (PARANOID)
-    thing() = 0;
-    list().OK();
+  thing() = 0;
+  list().OK();
 #endif
 }
index f4a3713761c4325abadc53755a912dab260b07a3..7fda7abb2c5cbc9302045fe1bf867e2e68905b9a 100644 (file)
@@ -11,7 +11,8 @@ template<class T>
 void
 PL_copy (Pointer_list<T*> &to, Pointer_list<T*> const&src)
 {
-    for (PCursor<T*> pc (src); pc.ok(); pc++) {
+  for (PCursor<T*> pc (src); pc.ok(); pc++) 
+    {
        T *q = pc;
        T *p=new T(*q) ; 
        to.bottom().add (p);
index f7733d508d0e77b8bba75eadd00554cc9c7c3170..07c1a0118f77ae6d0b67afbe3f36d2b05bac88d0 100644 (file)
@@ -9,8 +9,9 @@ template<class T>
 void
 Pointer_list<T>::junk()
 {
-    PCursor<T> c (*this);
-    while (c.ok()) {
+  PCursor<T> c (*this);
+  while (c.ok()) 
+    {
        delete c.remove_p();
     }
 }
@@ -19,9 +20,9 @@ template<class T>
 PCursor<T> 
 Link_list<T>::find (T what) const
 {
-    PCursor<T> i (*this);
-    for (; i.ok(); i++)
+  PCursor<T> i (*this);
+  for (; i.ok(); i++)
        if (i.ptr() == what)
           break;
-    return i;    
+  return i;    
 }
index c35f92c4970bcdef9eda19c1af0ab27745ea4a45..5eed1f4ef68af155ac11401ccfd59dec4e78d5ea 100644 (file)
@@ -15,7 +15,7 @@ inline
 T *
 P<T>::copy_p()const
 {
-    return t_p? new T(*t_p) : 0;
+  return t_p? new T(*t_p) : 0;
 }
 
 template<class T>
@@ -23,7 +23,7 @@ inline
 void
 P<T>::copy (T const *l_C)
 {
-    t_p = l_C ? new T(*l_C) : 0;
+  t_p = l_C ? new T(*l_C) : 0;
 }
 
 template<class T>
@@ -31,15 +31,15 @@ inline
 void
 P<T>::junk()
 {
-    delete t_p;
-    t_p =0;
+  delete t_p;
+  t_p =0;
 }
 
 template<class T>
 inline
 P<T>::P(P<T> const &s) 
 {
-    t_p = s.copy_p();
+  t_p = s.copy_p();
 }
 
 template<class T>
@@ -47,15 +47,15 @@ inline
 P<T> &
 P<T>::operator =(P const&s)
 {
-    junk();
-    copy (s.t_p);
-    return *this;
+  junk();
+  copy (s.t_p);
+  return *this;
 }
 
 template<class T>
 inline
 P<T>::~P() {
-    junk();
+  junk();
 }
 
 template<class T>
@@ -63,11 +63,11 @@ inline
 void
 P<T>::set_p (T * np) 
 {
-    if (np == t_p)
+  if (np == t_p)
        return;
-    delete t_p;
-    
-    t_p = np;
+  delete t_p;
+  
+  t_p = np;
 }
 
 
@@ -76,11 +76,11 @@ inline
 void
 P<T>::set_l (T const * l_C) 
 {
-    if (t_p == l_C)
+  if (t_p == l_C)
        return;
-    
-    junk();
-    copy (l_C);
+  
+  junk();
+  copy (l_C);
 }
 
 
index 2a285db24f8fff7e762441836eb5a7cf066e8a57..6a88eef8c94cf3014b138703c77a993b8aa91a8d 100644 (file)
@@ -20,53 +20,54 @@ const int INITIALMAX=8;
 INLINE void 
 String_data::OKW() 
 {
-    assert (references == 1);
+  assert (references == 1);
 }
 
 INLINE void 
 String_data::OK() 
 {
-    assert (maxlen >= length_i_);
-    assert (bool (data_byte_p_));
-    assert (references >= 1);
+  assert (maxlen >= length_i_);
+  assert (bool (data_byte_p_));
+  assert (references >= 1);
 }
 
 
 INLINE
 String_data::String_data() 
 {
-    references=0;
-    maxlen = INITIALMAX;
-    data_byte_p_ = new Byte[maxlen + 1];
-    data_byte_p_[0] = 0;
-    length_i_ = 0;
+  references=0;
+  maxlen = INITIALMAX;
+  data_byte_p_ = new Byte[maxlen + 1];
+  data_byte_p_[0] = 0;
+  length_i_ = 0;
 }
 
 INLINE
 String_data::String_data (String_data const &src) 
 {
-    references=0;      
-    maxlen = length_i_ = src.length_i_;                
-    data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.      
-    memcpy (data_byte_p_, src.data_byte_p_, length_i_ + 1);    
+  references=0;        
+  maxlen = length_i_ = src.length_i_;          
+  data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.        
+  memcpy (data_byte_p_, src.data_byte_p_, length_i_ + 1);      
 }
 
 INLINE
 String_data::~String_data() 
 {
-    assert (references == 0);
-    delete[] data_byte_p_;
+  assert (references == 0);
+  delete[] data_byte_p_;
 }
 
 INLINE void 
 String_data::setmax (int j) 
 {      
-    OKW();
-    if (j > maxlen) {
+  OKW();
+  if (j > maxlen) 
+    {
        delete data_byte_p_;
        maxlen = j;
        data_byte_p_ = new Byte[maxlen + 1];
-    
+  
        data_byte_p_[0] = 0;
        length_i_ = 0;
     }
@@ -84,8 +85,9 @@ String_data::setmax (int j)
 INLINE void 
 String_data::remax (int j) 
 {
-    OKW();
-    if (j > maxlen) {
+  OKW();
+  if (j > maxlen) 
+    {
        Byte *p = new Byte[j + 1];      
        memcpy (p, data_byte_p_, ( maxlen <? length_i_) + 1 );      
        maxlen = j;
@@ -97,31 +99,31 @@ String_data::remax (int j)
 INLINE void 
 String_data::tighten() 
 { // should be dec'd const
-    maxlen = length_i_;
-    Byte *p = new Byte[maxlen + 1];        
-    memcpy (p, data_byte_p_, length_i_ + 1);       
-    delete[] data_byte_p_;
-    data_byte_p_ = p;          
+  maxlen = length_i_;
+  Byte *p = new Byte[maxlen + 1];          
+  memcpy (p, data_byte_p_, length_i_ + 1);         
+  delete[] data_byte_p_;
+  data_byte_p_ = p;            
 }
 // assignment.
 INLINE void 
 String_data::set (Byte const* byte_C, int length_i) 
 {
-    OKW();
+  OKW();
 
-    assert (byte_C && byte_C != data_byte_p_);
+  assert (byte_C && byte_C != data_byte_p_);
 
-    length_i_ = length_i;
-    remax (length_i_);     // copies too
-    memcpy (data_byte_p_, byte_C, length_i_);
-    data_byte_p_[ length_i_ ] = 0;
+  length_i_ = length_i;
+  remax (length_i_);     // copies too
+  memcpy (data_byte_p_, byte_C, length_i_);
+  data_byte_p_[ length_i_ ] = 0;
 }
 
 INLINE
 void 
 String_data::set (char const* ch_C) 
 {
-    set ((Byte const*)ch_C, strlen (ch_C) );
+  set ((Byte const*)ch_C, strlen (ch_C) );
 }
 
 
@@ -129,21 +131,21 @@ String_data::set (char const* ch_C)
 INLINE void 
 String_data::append (Byte const* byte_C, int length_i) 
 {
-    OK();
-    OKW();
-    int old_i = length_i_;
-    
-    length_i_ += length_i;
-    remax (length_i_);
-    memcpy (data_byte_p_ + old_i, byte_C, length_i);   
-    data_byte_p_[ length_i_ ] = 0;
+  OK();
+  OKW();
+  int old_i = length_i_;
+  
+  length_i_ += length_i;
+  remax (length_i_);
+  memcpy (data_byte_p_ + old_i, byte_C, length_i);     
+  data_byte_p_[ length_i_ ] = 0;
 }
 
 INLINE
 void 
 String_data::operator += ( char const* ch_C) 
 {
-    append ((Byte const*)ch_C, strlen (ch_C) );
+  append ((Byte const*)ch_C, strlen (ch_C) );
 }
 
 
@@ -152,56 +154,56 @@ INLINE
 char const*
 String_data::ch_C() const
 {
-    return (char const*)data_byte_p_; 
+  return (char const*)data_byte_p_; 
 }
 INLINE char* 
 String_data::ch_l() 
 { 
-    return (char*)data_byte_p_; 
+  return (char*)data_byte_p_; 
 }
 
 INLINE Byte const*
 String_data::byte_C() const 
 { 
-    return data_byte_p_; 
+  return data_byte_p_; 
 }
 
 INLINE Byte* 
 String_data::byte_l() 
 {
-    OKW();
-    return data_byte_p_;
+  OKW();
+  return data_byte_p_;
 }
 
 INLINE
 void 
 String_data::trunc (int j) 
 {
-    OKW(); 
-    assert (j >= 0 && j <= length_i_);
-    data_byte_p_[j] = 0;
-    length_i_ = j;
+  OKW(); 
+  assert (j >= 0 && j <= length_i_);
+  data_byte_p_[j] = 0;
+  length_i_ = j;
 }
 
 INLINE bool
 String_data::is_binary_bo()const
 {
 //    return !memchr (data_byte_p_, length_i_, 0);
-    return ( (int)strlen ((char const*)data_byte_p_) != length_i_ );
+  return ( (int)strlen ((char const*)data_byte_p_) != length_i_ );
 }
 
 INLINE Byte&
 String_data::operator [](int j) 
 {
-    assert (j >= 0 && j <= length_i_);
-    return data_byte_p_[j] ; 
+  assert (j >= 0 && j <= length_i_);
+  return data_byte_p_[j] ; 
 }
 
 INLINE Byte 
 String_data::operator [](int j) const 
 {
-    assert (j >= 0 && j <= length_i_);
-    return data_byte_p_[j]; 
+  assert (j >= 0 && j <= length_i_);
+  return data_byte_p_[j]; 
 }
 
 
index e398e0a4ed575cd4f70f907fad4d162c8d7ebde5..0f97839d825c0f42b34dd520f464ce3461d8e62c 100644 (file)
 INLINE void 
 String_handle::down() 
 { 
-    if (!(--data->references)) delete data; data = 0; 
+  if (!(--data->references)) delete data; data = 0; 
 }
 
 /// increase ref count
 INLINE void 
 String_handle::up (String_data *d) 
 { 
-    data=d; data->references ++; 
+  data=d; data->references ++; 
 }
 
 INLINE void 
 String_handle::copy() 
 {
-    if (data->references !=1){
+  if (data->references !=1)
+    {
        String_data *newdata = new String_data (*data);
        down();
        up (newdata);
@@ -42,68 +43,68 @@ String_handle::copy()
 INLINE
 String_handle::String_handle() 
 {
-    up (new String_data);
+  up (new String_data);
 }
 
 INLINE
 String_handle::~String_handle() 
 {      
-    down();
+  down();
 }    
 
 INLINE
 String_handle::String_handle (String_handle const & src) 
 {      
-    up (src.data);
+  up (src.data);
 }
 
 INLINE Byte* 
 String_handle::byte_l() 
 {
-    copy();
-    return data->byte_l();
+  copy();
+  return data->byte_l();
 }
 
 INLINE char* 
 String_handle::ch_l() 
 {
-    copy();
-    return (char*)data->byte_l();
+  copy();
+  return (char*)data->byte_l();
 }
 
 INLINE Byte 
 const* String_handle::byte_C() const 
 {
-    return data->byte_C();
+  return data->byte_C();
 }
 
 INLINE char const* 
 String_handle::ch_C() const 
 {
-    return (char const*)data->byte_C();
+  return (char const*)data->byte_C();
 }
 
 INLINE void 
 String_handle::operator =(String_handle const &src) 
 {
-    if (this == &src)
+  if (this == &src)
        return;
-    down();
-    up (src.data);
+  down();
+  up (src.data);
 }
 
 INLINE void 
 String_handle::operator += (char const *s) 
 {      
-    copy();
-    *data += s;
+  copy();
+  *data += s;
 }    
 
 
 INLINE Byte 
 String_handle::operator[](int j) const 
 { 
-    return (*data)[j]; 
+  return (*data)[j]; 
 }
 
 // !NOT SAFE!
@@ -111,46 +112,46 @@ String_handle::operator[](int j) const
 INLINE Byte &
 String_handle::operator[](int j) 
 {
-    copy();    // hmm. Not efficient
-    return data->byte_l()[j];
+  copy();      // hmm. Not efficient
+  return data->byte_l()[j];
 }
 
 INLINE void 
 String_handle::append (Byte const* byte_C, int length_i) 
 {
-    copy();
-    data->append (byte_C, length_i);
+  copy();
+  data->append (byte_C, length_i);
 }
                           
 INLINE void 
 String_handle::set (Byte const* byte_C, int length_i) 
 {
-    copy();
-    data->set (byte_C, length_i);
+  copy();
+  data->set (byte_C, length_i);
 }
                           
 INLINE void 
 String_handle::operator = (char const *p) 
 {
-    copy();
-    data->set (p);
+  copy();
+  data->set (p);
 }
                           
 INLINE void 
 String_handle::trunc (int j) 
 {
-    copy(); data->trunc (j); 
+  copy(); data->trunc (j); 
 }
 
 INLINE int 
 String_handle::length_i() const 
 { 
-    return data->length_i_; 
+  return data->length_i_; 
 }
 
 INLINE bool
 String_handle::is_binary_bo() const {
-    return data->is_binary_bo();
+  return data->is_binary_bo();
 }
 
 #endif
index a50b10a464f8559d17345942908a9c205e9511a5..433ca727aa0a1454f2687ce6ee0217e591f07557 100644 (file)
@@ -15,5 +15,5 @@ template INTERVAL__INSTANTIATE(Real);
 Real
 Interval_t<Real>::infinity() 
 {
-    return HUGE_VAL;
+  return HUGE_VAL;
 }
index 7ab4eb122b67299b09ef66edab0edb631bed641f..a73334fe008ee59f767388a5af82631677efe06d 100644 (file)
 long
 Getopt_long::argument_to_i()
 {
-    long l;
-    if (!optional_argument_ch_C_ 
+  long l;
+  if (!optional_argument_ch_C_ 
        || sscanf (optional_argument_ch_C_, "%ld", &l) != 1)
        report (E_ILLEGALARG);
-    
-    return l;
+  
+  return l;
 }
 
 const Long_option_init *
 Getopt_long::parselong()
 {
-    char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ;
-    assert (*optnm);
-    
-    char const *endopt = strchr (optnm, '=');
-    int searchlen  = (endopt) ? endopt - optnm : strlen (optnm);
-    
-    found_option_l_=0;
-    for (int i=0; i< table_len_i_; i++) {
+  char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ;
+  assert (*optnm);
+  
+  char const *endopt = strchr (optnm, '=');
+  int searchlen  = (endopt) ? endopt - optnm : strlen (optnm);
+  
+  found_option_l_=0;
+  for (int i=0; i< table_len_i_; i++) 
+    {
        char const *ln = option_a_[i].longname;
 
-       if (ln && !strncmp (ln, optnm, searchlen)) {
+       if (ln && !strncmp (ln, optnm, searchlen)) 
+         {
            found_option_l_ = option_a_+i;
            break;
-       }
-    }  
+         }
+  }    
 
-    if (!found_option_l_) {
+  if (!found_option_l_) 
+    {
        report (E_UNKNOWNOPTION);
        return 0;
     }
-    array_index_i_++;
-    argument_index_i_ = 0;
+  array_index_i_++;
+  argument_index_i_ = 0;
 
-    
-    if (found_option_l_->take_arg) {
+  
+  if (found_option_l_->take_arg) 
+    {
        if (endopt)
            optional_argument_ch_C_ = endopt +1; // a '='
-       else {
+       else 
+         {
            optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
            array_index_i_++;
-       }
+         }
        if (!optional_argument_ch_C_)
            report (E_ARGEXPECT);
 
-    } else {
+    }
+  else 
+    {
        optional_argument_ch_C_ = 0;
        if (endopt)
            report (E_NOARGEXPECT);
     }
-    
-    return found_option_l_;
+  
+  return found_option_l_;
 }
 
 
 void
 Long_option_init::printon (ostream &errorout)const
 {
-    if (shortname)     
+  if (shortname)       
        errorout <<"-" << shortname;
-    if (shortname && longname)
+  if (shortname && longname)
        errorout << ", ";
-    if (longname)      
+  if (longname)        
        errorout << "`--" << longname << "'";
 }
 
@@ -81,23 +88,24 @@ Long_option_init::printon (ostream &errorout)const
 void
 Getopt_long::report (Errorcod c)
 {
-    error_ = c;
-    if (!error_ostream_l_)
+  error_ = c;
+  if (!error_ostream_l_)
        return;
 
-    *error_ostream_l_ << arg_value_ch_a_a_[0] << ": ";
-    switch (c) {
-    case E_ARGEXPECT:
+  *error_ostream_l_ << arg_value_ch_a_a_[0] << ": ";
+  switch (c) 
+    {
+  case E_ARGEXPECT:
        *error_ostream_l_<< "option ";
        found_option_l_->printon (*error_ostream_l_);
        *error_ostream_l_ << "requires an argument"<<endl;
        break;
-    case  E_NOARGEXPECT:
+  case  E_NOARGEXPECT:
        *error_ostream_l_ << "option `--" <<
            found_option_l_->longname << "' does not allow an argument"<<endl;
        break;
        
-    case E_UNKNOWNOPTION:
+  case E_UNKNOWNOPTION:
        *error_ostream_l_ << "unrecognized option ";
        if (argument_index_i_)
            *error_ostream_l_ << "-" << arg_value_ch_a_a_[array_index_i_][argument_index_i_] << endl;
@@ -105,113 +113,124 @@ Getopt_long::report (Errorcod c)
            *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl;
 
        break;
-    case E_ILLEGALARG:
+  case E_ILLEGALARG:
        *error_ostream_l_ << "illegal argument `" << optional_argument_ch_C_ << "\'to option ";
        found_option_l_->printon (*error_ostream_l_);
        *error_ostream_l_ << '\n';
-    default:
+  default:
        assert (false);
     }
-    exit (2); 
+  exit (2); 
 }
-    
+  
 const Long_option_init *
 Getopt_long::parseshort()
 {
-    char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_];
-    found_option_l_=0;
-    assert (c);
-    
-    for (int i=0; i < table_len_i_; i++)
-       if (option_a_[i].shortname == c) {
+  char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_];
+  found_option_l_=0;
+  assert (c);
+  
+  for (int i=0; i < table_len_i_; i++)
+       if (option_a_[i].shortname == c) 
+         {
            found_option_l_  = option_a_+i;
            break;
-       }
+         }
 
-    if (!found_option_l_){
+  if (!found_option_l_)
+    {
        report (E_UNKNOWNOPTION);
        return 0;
     }
 
-    argument_index_i_++;
-    if (!found_option_l_->take_arg){
+  argument_index_i_++;
+  if (!found_option_l_->take_arg)
+    {
        optional_argument_ch_C_ = 0;
        return found_option_l_;
     }
-    optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_] + argument_index_i_;
+  optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_] + argument_index_i_;
 
-    array_index_i_ ++;
-    argument_index_i_ = 0;
-    
-    if (!optional_argument_ch_C_[0]) {
+  array_index_i_ ++;
+  argument_index_i_ = 0;
+  
+  if (!optional_argument_ch_C_[0]) 
+    {
        optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_];
        array_index_i_ ++;
     }
-    if (!optional_argument_ch_C_) {
+  if (!optional_argument_ch_C_) 
+    {
        report (E_ARGEXPECT);
     }
-    
-    return found_option_l_;
+  
+  return found_option_l_;
 }
 
 const Long_option_init *
 Getopt_long::operator()() 
 {
-    if (!ok())
+  if (!ok())
        return 0;
-    
-    next();
-    
-    if (argument_index_i_)
+  
+  next();
+  
+  if (argument_index_i_)
        return parseshort();
-    
-    const char * argument_C = arg_value_ch_a_a_[array_index_i_];
-    
-    if (argument_C[0] != '-')
+  
+  const char * argument_C = arg_value_ch_a_a_[array_index_i_];
+  
+  if (argument_C[0] != '-')
        return 0;
 
-    if (argument_C[1] == '-') {// what to do with "command  --  bla"
+  if (argument_C[1] == '-') {// what to do with "command  --  bla"
        if ( argument_C[2])
            return parselong();
        else
            return 0;
-    } else {
-       if (argument_C[ 1 ]) {
+    }
+  else 
+    {
+       if (argument_C[ 1 ]) 
+         {
            argument_index_i_ = 1;
            return parseshort();
-       } else {
+         }
+       else 
+         {
            return 0;
-       }
+         }
     }
 }
 
 Getopt_long::Getopt_long (int c, char  **v, Long_option_init *lo)
 {
-    option_a_ = lo;
-    error_ostream_l_ = &cerr;
-    arg_value_ch_a_a_ = v;
-    argument_count_i_ = c;
-    array_index_i_ = 1;
-    argument_index_i_ = 0;
-
-    //    reached end of option table?
-    table_len_i_ =0;
-    for (int i = 0;  option_a_[i].longname ||option_a_[i].shortname; i++)
+  option_a_ = lo;
+  error_ostream_l_ = &cerr;
+  arg_value_ch_a_a_ = v;
+  argument_count_i_ = c;
+  array_index_i_ = 1;
+  argument_index_i_ = 0;
+
+  //    reached end of option table?
+  table_len_i_ =0;
+  for (int i = 0;  option_a_[i].longname ||option_a_[i].shortname; i++)
        table_len_i_ ++;
 }
 
 bool
 Getopt_long::ok()const
 {
-    return  array_index_i_ < argument_count_i_;
+  return  array_index_i_ < argument_count_i_;
 }
 
 void
 Getopt_long::next()
 {
-    error_ = E_NOERROR;
-    while (array_index_i_ < argument_count_i_
-          && !arg_value_ch_a_a_[array_index_i_][argument_index_i_]) {
+  error_ = E_NOERROR;
+  while (array_index_i_ < argument_count_i_
+          && !arg_value_ch_a_a_[array_index_i_][argument_index_i_]) 
+            {
        array_index_i_++;
        argument_index_i_ = 0;
     }
@@ -220,19 +239,20 @@ Getopt_long::next()
 char const *
 Getopt_long::current_arg()
 {
-    if (array_index_i_ >= argument_count_i_)
+  if (array_index_i_ >= argument_count_i_)
        return 0;
-    char const * a = arg_value_ch_a_a_[array_index_i_];
-    return a + argument_index_i_;
+  char const * a = arg_value_ch_a_a_[array_index_i_];
+  return a + argument_index_i_;
 }
 
 char const *
 Getopt_long::get_next_arg()
 {
-    char const * a = current_arg();
-    if (a) {
+  char const * a = current_arg();
+  if (a) 
+    {
        array_index_i_ ++;
        argument_index_i_= 0;
     }
-    return a;
+  return a;
 }
index c786a51efe456b41bf4e4406293cdbc11ce8f0bc..b380b1fd2d90671ac2a7e1b5d731ad6a139e484f 100644 (file)
@@ -16,7 +16,8 @@ char*
 strnlwr (char* start_l ,int n)
 {
     char * p = start_l + n;
-    while ( --p >= start_l) {
+    while (--p >= start_l) 
+    {
        *p = tolower (*p);    /* a macro on some compilers */
     }
     return start_l;
@@ -26,7 +27,8 @@ char*
 strnupr (char* start_l, int n)
 {
     char * p = start_l + n;
-    while ( --p >= start_l) {
+    while (--p >= start_l) 
+    {
        *p = toupper (*p);    /* a macro on some compilers */
     }
     return start_l;
@@ -40,17 +42,19 @@ strnupr (char* start_l, int n)
 
 char *
 memmem (Byte const * haystack, int haystack_len,
-       Byte const *needle,int needle_len)
+       Byte const *needle,int needle_len)
 {
     Byte const * end_haystack = haystack + haystack_len - needle_len;
     Byte const * end_needle = needle + needle_len ;
 
     /* Ahhh ... Some minimal lowlevel stuff. This *is* nice; Varation
-      is the spice of life */
-    while (haystack < end_haystack) {
+       is the spice of life */
+    while (haystack < end_haystack) 
+    {
        Byte const *subneedle_l = needle;
        Byte const *subhaystack_l = haystack;
-       while (subneedle_l < end_needle) {
+       while (subneedle_l < end_needle) 
+       {
            if (*subneedle_l++ != *subhaystack_l++)
                goto next;      // yeah. I should be prosecuted.
        }
@@ -68,7 +72,8 @@ Byte *
 memrchr (Byte const * p, int n, char c)
 {
     const    Byte * q = p+n;
-    while (q > p) {
+    while (q > p) 
+    {
        if (*--q == c)
            return (Byte*)q;
     }
@@ -88,19 +93,20 @@ my_swap (T &t1, T &t2, T &tmp)
 Byte*
 strrev (Byte* byte_l, int length_i)
 {
-  Byte tmp_byte;
+    Byte tmp_byte;
   
-  Byte* left_l = byte_l;
-  Byte* right_l = byte_l + length_i;
+    Byte* left_l = byte_l;
+    Byte* right_l = byte_l + length_i;
 
-  while ( right_l > left_l) {
-      my_swap (*right_l-- , *left_l++ , tmp_byte);
-  }
-  return byte_l;
+    while (right_l > left_l) 
+    {
+       my_swap (*right_l-- , *left_l++ , tmp_byte);
+    }
+    return byte_l;
 }
 
 #if ! HAVE_SNPRINTF
-int snprintf ( char *str, size_t,
+int snprintf (char *str, size_t,
               char const *format, ...)
 {
     va_list ap;
index 7126c1378ef9721b5f2cb72dbd6567cb663edf5f..81aa05f39ce1109c2e55a3931d6b86e564285815 100644 (file)
 
 Matrix::operator String() const
 {
-    String s;
+  String s;
 #ifndef NPRINT
-    Matrix_storage const * stor_c_l = dat;
-    s=String ("matrix { (")  + dat->name() + ")\n";
-    for (int i=0; i< rows(); i++){
-       for (int j = 0; j < cols(); j++) {
+  Matrix_storage const * stor_c_l = dat;
+  s=String ("matrix { (")  + dat->name() + ")\n";
+  for (int i=0; i< rows(); i++)
+    {
+       for (int j = 0; j < cols(); j++) 
+         {
            s+= String (stor_c_l->elem (i,j), "%6f ");
-       }
+         }
        s+="\n";
     }
-    s+="}\n";
+  s+="}\n";
 #endif
-    return s;
+  return s;
 }
 
 
@@ -34,21 +36,22 @@ void
 Matrix::print() const
 {
 #ifndef NPRINT
-    fdebug << *this;
+  fdebug << *this;
 #endif
 }
 
 Vector::operator String() const
 {
-    String s;
+  String s;
 #ifndef NPRINT
-    s="vector [";
-    for (int i=0; i < dim(); i++) {
+  s="vector [";
+  for (int i=0; i < dim(); i++) 
+    {
        s += String (dat[i], "%6f") + String (' ');
     }
-    s+="]";
+  s+="]";
 #endif
-    return s;
+  return s;
 }
 
 
@@ -56,6 +59,6 @@ void
 Vector::print() const
 {
 #ifndef NDEBUG
-    fdebug << *this<<'\n';
+  fdebug << *this<<'\n';
 #endif
 }
index 5ebc0e9072010dbc4187052136c532ae4e84c185..698f673b25e9fe33a403d486d9b79a3d41938a92 100644 (file)
 void
 Matrix_storage::set_addition_result (Matrix_storage *&dat, Matrix_storage *right)
 {
-    if (dat && dat->name() == Diagonal_storage::static_name () 
-        && right->name() == Diagonal_storage::static_name ()) {
+  if (dat && dat->name() == Diagonal_storage::static_name () 
+        && right->name() == Diagonal_storage::static_name ()) 
+          {
        Diagonal_storage *L = (Diagonal_storage*)dat;
        Diagonal_storage* R = (Diagonal_storage*) right;
 
-       if ( R->band_size_i() > L->band_size_i ()) { 
+       if ( R->band_size_i() > L->band_size_i ()) 
+         {
            L->set_band_size (R->band_size_i());
-       }
+         }
            return ;
     }
-    if  (!dat || !dat->is_type_b (Full_storage::static_name())) {
+  if  (!dat || !dat->is_type_b (Full_storage::static_name())) 
+    {
 
        Matrix_storage *new_stor = (dat)? new Full_storage (dat) : 
            new Full_storage (right->rows(), right->cols ());
@@ -34,11 +37,11 @@ Matrix_storage::set_addition_result (Matrix_storage *&dat, Matrix_storage *right
 Matrix_storage*
 Matrix_storage::get_product_result (Matrix_storage*left, Matrix_storage*right)
 {
-    Matrix_storage* dest =0;
-    set_product_result (dest, left,right);
-    return dest;
+  Matrix_storage* dest =0;
+  set_product_result (dest, left,right);
+  return dest;
 }
-    
+  
 
 /*
   hairy
@@ -47,25 +50,31 @@ void
 Matrix_storage::set_product_result (Matrix_storage*&dest, 
                           Matrix_storage*left, Matrix_storage*right)
 {
-    if ( left->name() == Diagonal_storage::static_name () 
-        && right->name() == Diagonal_storage::static_name ()) {
+  if ( left->name() == Diagonal_storage::static_name () 
+        && right->name() == Diagonal_storage::static_name ()) 
+          {
        Diagonal_storage *L = (Diagonal_storage*)left;
        Diagonal_storage* R = (Diagonal_storage*) right;
 
-       if  (L->band_size_i() + R->band_size_i () < L->dim ()/2) {
-           if (dest ->name() != Diagonal_storage::static_name ()){
+       if  (L->band_size_i() + R->band_size_i () < L->dim ()/2) 
+         {
+           if (dest ->name() != Diagonal_storage::static_name ())
+             {
                delete dest;
                dest = new Diagonal_storage;
-           }
+             }
         
            dest->set_size (L->dim());
            return;
-       }
+         }
     }
 
-    if ( dest && dest->name() == Full_storage::static_name ()) {
+  if ( dest && dest->name() == Full_storage::static_name ()) 
+    {
        dest->set_size (left->rows(), right->cols ());
-    } else {
+    }
+  else 
+    {
        delete dest;
        dest = new Full_storage (left->rows(), right->cols ());
     }
@@ -76,7 +85,7 @@ IMPLEMENT_IS_TYPE_B(Matrix_storage);
 Matrix_storage *
 Matrix_storage::get_full (int n, int m)
 {
-    return new Full_storage (n,m);
+  return new Full_storage (n,m);
 }
 
 
@@ -85,38 +94,38 @@ Matrix_storage::get_full (int n, int m)
 Matrix_storage::try_right_multiply (Matrix_storage *, 
                                   const Matrix_storage *)const
 {
-    return false;
+  return false;
 }
 
 Array<Real>
 Matrix_storage::row (int n) const
 {
-    Array<Real> r;
-    for (int j = 0; j < cols(); j++)
+  Array<Real> r;
+  for (int j = 0; j < cols(); j++)
        r.push (elem (n,j));
-    return r;
+  return r;
 }
 
 Array<Real>
 Matrix_storage::column (int n) const
 {
-    Array<Real> r;
-    for (int i = 0; i < rows(); i++)
+  Array<Real> r;
+  for (int i = 0; i < rows(); i++)
        r.push (elem (i,n));
-    return r;
+  return r;
 }
 
 void
 Matrix_storage::set_size (int rows, int cols)
 {
-        
-    resize (rows,cols);
+      
+  resize (rows,cols);
 }
        
 void
 Matrix_storage::set_size (int rows)
 {
-        
+      
        resize (rows);
 }
        
@@ -124,16 +133,16 @@ Matrix_storage::set_size (int rows)
 void
 Matrix_storage::set_band (Matrix_storage *&mat, int b)
 {
-    Matrix_storage* ns = new Diagonal_storage (mat, b);
-    delete mat;
-    mat=ns;
+  Matrix_storage* ns = new Diagonal_storage (mat, b);
+  delete mat;
+  mat=ns;
 }
        
 
 void
 Matrix_storage::set_full (Matrix_storage *&mat)
 {
-    Matrix_storage* ns = new Full_storage (mat);
-    delete mat;
-    mat=ns;
+  Matrix_storage* ns = new Full_storage (mat);
+  delete mat;
+  mat=ns;
 }
index fdb6085f7cd7d733d44b3072273008cf51067d32..3f9b28f835b5b165c274d5c26328f863dc7a1c3f 100644 (file)
 bool
 Matrix::band_b()const
 {
-    return dat->is_type_b (Diagonal_storage::static_name());
+  return dat->is_type_b (Diagonal_storage::static_name());
 }
 
 void
 Matrix::set_full() const
 {
-    if ( dat->name() != Full_storage::static_name ()) {
+  if ( dat->name() != Full_storage::static_name ()) 
+    {
        Matrix_storage::set_full (((Matrix*)this)->dat);
     }
 }
@@ -27,64 +28,64 @@ Matrix::set_full() const
 void
 Matrix::try_set_band()const
 {
-    if (band_b())
+  if (band_b())
        return;
-    
-    int b = band_i();
-    if (  b > dim()/2)
+  
+  int b = band_i();
+  if (  b > dim()/2)
        return;
-    // it only looks constant
-    Matrix*self  = (Matrix*)this;
-    Matrix_storage::set_band (self->dat,b);
+  // it only looks constant
+  Matrix*self  = (Matrix*)this;
+  Matrix_storage::set_band (self->dat,b);
 }
 
 Real
 Matrix::norm() const
 {
-    Real r =0.0;
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  Real r =0.0;
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        r += sqr (dat->elem (i,j));
-    return sqrt (r);
+  return sqrt (r);
 }
 
 void
 Matrix::fill (Real r)
 {
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dat->elem (i,j)=r;
 }
 
 void
 Matrix::set_diag (Real r)
 {
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))         
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))   
        dat->elem (i,j)=(i==j) ? r: 0.0;
 }
 
 void
 Matrix::set_diag (Vector d)
 {
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))         
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))   
        dat->elem (i,j)=(i==j) ? d (i): 0.0;
 }
 
 void
 Matrix::operator+=(Matrix const &m)
 {
-    Matrix_storage::set_addition_result (dat, m.dat);
-    assert (m.cols() == cols ());
-    assert (m.rows() == rows ());
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  Matrix_storage::set_addition_result (dat, m.dat);
+  assert (m.cols() == cols ());
+  assert (m.rows() == rows ());
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dat->elem (i,j) += m (i,j);
 }
  
 void
 Matrix::operator-=(Matrix const &m)
 {
-    Matrix_storage::set_addition_result (dat, m.dat);
-    assert (m.cols() == cols ());
-    assert (m.rows() == rows ());
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  Matrix_storage::set_addition_result (dat, m.dat);
+  assert (m.cols() == cols ());
+  assert (m.rows() == rows ());
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dat->elem (i,j) -= m (i,j);
 }
 
@@ -92,28 +93,30 @@ Matrix::operator-=(Matrix const &m)
 void
 Matrix::operator*=(Real a)
 {
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dat->elem (i,j) *= a;
 }
 
 void
 Matrix::operator=(Matrix const &m)
 {
-    if (&m == this)
+  if (&m == this)
        return ;
-    delete dat;
-    dat = m.dat->clone();
+  delete dat;
+  dat = m.dat->clone();
 }
 
 int
 Matrix::band_i()const
 {
-    if ( band_b()) {
+  if ( band_b()) 
+    {
        Diagonal_storage const * diag = (Diagonal_storage*) dat;
        return diag->band_size_i();
     }
-    int starty = dim();
-    while (starty >= 0) {
+  int starty = dim();
+  while (starty >= 0) 
+    {
        for ( int i = starty, j = 0; i < dim(); i++, j++)
            if (dat->elem (i,j))
                goto gotcha;
@@ -123,38 +126,38 @@ Matrix::band_i()const
        starty --;
     }
 gotcha:
-    return  starty;
+  return  starty;
 }
-    
+  
 Matrix::Matrix (Matrix const &m)
 {
-    m.OK();
-    
-    dat = m.dat->clone();
+  m.OK();
+  
+  dat = m.dat->clone();
 }
 
 
 Matrix::Matrix (int n, int m)
 {
-    dat = Matrix_storage::get_full (n,m);
-    fill (0);
+  dat = Matrix_storage::get_full (n,m);
+  fill (0);
 }
 
 Matrix::Matrix (Matrix_storage*stor_p)
 {
-    dat = stor_p;
+  dat = stor_p;
 }
 
 Matrix::Matrix (int n)
 {
-    dat = Matrix_storage::get_full (n,n);
-    fill (0);
+  dat = Matrix_storage::get_full (n,n);
+  fill (0);
 }
 
 Matrix::Matrix (Vector v, Vector w)
 {   
-    dat = Matrix_storage::get_full (v.dim(), w.dim ());
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  dat = Matrix_storage::get_full (v.dim(), w.dim ());
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dat->elem (i,j)=v (i)*w (j);
 }
 
@@ -162,52 +165,52 @@ Matrix::Matrix (Vector v, Vector w)
 Vector
 Matrix::row (int k) const
 {
-    int n=cols();
+  int n=cols();
 
-    
-    Vector v (n);
-    for (int i=0; i < n; i++)
+  
+  Vector v (n);
+  for (int i=0; i < n; i++)
        v (i)=dat->elem (k,i);
 
-    return v;
+  return v;
 }
 
 Vector
 Matrix::col (int k) const
 {
-    int n=rows();
-    Vector v (n);
-    for (int i=0; i < n; i++)
+  int n=rows();
+  Vector v (n);
+  for (int i=0; i < n; i++)
        v (i)=dat->elem (i,k);
-    return v;
+  return v;
 }
 
 Vector
 Matrix::left_multiply (Vector const & v) const
 {
-     Vector dest (v.dim());
-    assert (dat->cols()==v.dim ());
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+   Vector dest (v.dim());
+  assert (dat->cols()==v.dim ());
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dest (i)+= dat->elem (j,i)*v (j);
-    return dest;
+  return dest;
 }
 
 Vector
 Matrix::operator *(Vector const & v) const
 {
-    Vector dest (rows());
-    assert (dat->cols()==v.dim ());
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
+  Vector dest (rows());
+  assert (dat->cols()==v.dim ());
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j))
        dest (i)+= dat->elem (i,j)*v (j);
-    return dest;
+  return dest;
 }
 
 Matrix
 operator /(Matrix const& m1,Real a)
 {
-    Matrix m (m1);
-    m /= a;
-    return  m;
+  Matrix m (m1);
+  m /= a;
+  return  m;
 }
 
 /*
@@ -217,7 +220,8 @@ void
 Matrix::transpose()            // delegate to storage?
 {
 #if 1
-    for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) {
+  for (int i=0, j=0; dat->mult_ok (i,j); dat->mult_next (i,j)) 
+    {
        if (i >= j)
            continue;
        Real r=dat->elem (i,j);
@@ -230,40 +234,41 @@ Matrix::transpose()               // delegate to storage?
 Matrix
 Matrix::operator-() const
 {
-    OK();
-    Matrix m (*this);
-    m*=-1.0;    
-    return m;
+  OK();
+  Matrix m (*this);
+  m*=-1.0;    
+  return m;
 }
 
 Matrix
 Matrix::transposed() const
 {
-    Matrix m (*this);
-    m.transpose();
-    return m;
+  Matrix m (*this);
+  m.transpose();
+  return m;
 }
 
 Matrix
 operator *(Matrix const &m1, Matrix const &m2)
 {
-    Matrix result (Matrix_storage::get_product_result (m1.dat, m2.dat));
+  Matrix result (Matrix_storage::get_product_result (m1.dat, m2.dat));
 
-    result.set_product (m1,m2);
-    return result;
+  result.set_product (m1,m2);
+  return result;
 }
 
 void
 Matrix::set_product (Matrix const &m1, Matrix const &m2)
 {
-    assert (m1.cols()==m2.rows ());
-    assert (cols()==m2.cols () && rows ()==m1.rows ());
-    
-    if (m1.dat->try_right_multiply (dat, m2.dat))
+  assert (m1.cols()==m2.rows ());
+  assert (cols()==m2.cols () && rows ()==m1.rows ());
+  
+  if (m1.dat->try_right_multiply (dat, m2.dat))
        return; 
-    
-    for (int i=0, j=0; dat->mult_ok (i,j);
-        dat->mult_next (i,j)) {
+  
+  for (int i=0, j=0; dat->mult_ok (i,j);
+        dat->mult_next (i,j)) 
+          {
        Real r=0.0;
        for (int k = 0; k < m1.cols(); k++)
            r += m1(i,k)*m2(k,j);
@@ -274,10 +279,10 @@ Matrix::set_product (Matrix const &m1, Matrix const &m2)
 void
 Matrix::insert_row (Vector v, int k)
 {
-    int c = cols();
-    assert (v.dim()==cols ());
-    dat->insert_row (k);
-    for (int j=0; j < c; j++)
+  int c = cols();
+  assert (v.dim()==cols ());
+  dat->insert_row (k);
+  for (int j=0; j < c; j++)
        dat->elem (k,j)=v (j);
 }
 
@@ -285,9 +290,10 @@ Matrix::insert_row (Vector v, int k)
 void
 Matrix::swap_columns (int c1, int c2)
 {
-    assert (c1>=0&& c1 < cols()&&c2 < cols () && c2 >=0);
-    int r = rows();
-    for (int i=0; i< r; i++) {
+  assert (c1>=0&& c1 < cols()&&c2 < cols () && c2 >=0);
+  int r = rows();
+  for (int i=0; i< r; i++) 
+    {
        Real r=dat->elem (i,c1);
        dat->elem (i,c1) = dat->elem (i,c2);
        dat->elem (i,c2)=r;
@@ -297,9 +303,10 @@ Matrix::swap_columns (int c1, int c2)
 void
 Matrix::swap_rows (int c1, int c2)
 {
-    assert (c1>=0&& c1 < rows()&&c2 < rows () && c2 >=0);
-    int c = cols();
-    for (int i=0; i< c; i++) {
+  assert (c1>=0&& c1 < rows()&&c2 < rows () && c2 >=0);
+  int c = cols();
+  for (int i=0; i< c; i++) 
+    {
        Real r=dat->elem (c1,i);
        dat->elem (c1,i) = dat->elem (c2,i);
        dat->elem (c2,i)=r;
@@ -310,8 +317,8 @@ Matrix::swap_rows (int c1, int c2)
 int
 Matrix::dim() const
 {
-    assert (cols() == rows ());
-    return rows();
+  assert (cols() == rows ());
+  return rows();
 }
 
 
index be5f56a7f06c7b8d0d62cf674023b52350cb7435..e880b200ae163c2c83da2ddbc7b8a8245f93a9e4 100644 (file)
@@ -17,36 +17,36 @@ void
 split_path (String path, 
           String &drive, String &dirs, String &filebase, String &extension)
 {
-    // peel off components, one by one.
-    int di = path.index_i (':');
-    if (di >= 0) 
+  // peel off components, one by one.
+  int di = path.index_i (':');
+  if (di >= 0) 
        {
        drive = path.left_str (di + 1);
        path = path.right_str (path.len() - di -1);
-       } 
-    else
+         }
+  else
        drive = "";
-    
-    di = path.index_last_i (PATHSEP);
-    if (di >=0) 
+  
+  di = path.index_last_i (PATHSEP);
+  if (di >=0) 
        {
        dirs = path.left_str (di + 1);
        path = path.right_str (path.len()-di -1);
-       }
-    else
+         }
+  else
        dirs = "";
-    
-    di = path.index_last_i ('.');
-    if (di >= 0) 
+  
+  di = path.index_last_i ('.');
+  if (di >= 0) 
        {
        filebase = path.left_str (di);
        extension =path.right_str (path.len()-di);      
-       } 
-    else 
+         }
+  else 
        {
        extension = "";   
        filebase = path;
-       }
+         }
 }
 
 /** find a file. 
@@ -57,10 +57,11 @@ String
 File_path::find (String nm)const
 
 {
-    fdebug << "looking for " << nm << ": ";
-    if ( !nm.length_i() || ( nm == "-") )
+  fdebug << "looking for " << nm << ": ";
+  if ( !nm.length_i() || ( nm == "-") )
        return nm;
-    for (int i=0; i < size(); i++) {
+  for (int i=0; i < size(); i++) 
+    {
 
         String path  = elem(i);
         if ( path.length_i() )
@@ -70,12 +71,13 @@ File_path::find (String nm)const
 
         fdebug << path << "? ";
         FILE *f = fopen (path.ch_C(), "r"); // ugh!
-        if (f) {
+        if (f) 
+          {
             fdebug << "found\n";
             fclose (f);
             return path;
-        }
+          }
      }
-    fdebug << "\n";
-    return "";
+  fdebug << "\n";
+  return "";
 }
index 5b36be916cbbb29e617ec28424fccf6b2d60e4c4..11963238b576632ea3b4e0cbc85eb30aac322e92 100644 (file)
@@ -12,7 +12,7 @@
 void
 print_rat (Rational const &m)
 {
-    cout << String (m) << flush;
+  cout << String (m) << flush;
 }
-    
+  
 
index 1a5e54ec27c3104af75f087dfe656b436653ca3c..db0b9ddb8c15d546089e613fb5a35146c17a45a5 100644 (file)
@@ -3,55 +3,56 @@
 #include "scalar.hh"
 
 Scalar::Scalar (Rational r)
-    :String (r)
+  :String (r)
 {
 
 }
 
 Scalar::operator Rational()
 {
-    int p = index_i ('/');
-    if (p == -1)
+  int p = index_i ('/');
+  if (p == -1)
        return int (*this);
-    
-    String s2 = right_str (len()-p-1);
-    String s1 = left_str (p);
+  
+  String s2 = right_str (len()-p-1);
+  String s1 = left_str (p);
 
-    return Rational (s1.value_i(), s2.value_i ());
+  return Rational (s1.value_i(), s2.value_i ());
 }
 
 bool
 Scalar::isnum()
 {
-    int conv = false;
-    if (len()) {
+  int conv = false;
+  if (len()) 
+    {
        long l =0;
        conv = sscanf (strh_.ch_C(), "%ld", &l);
     }
-    return len() && conv;
+  return len() && conv;
 }
 
 Scalar::operator Real()
 {
-    assert (isnum());
-    return value_f();
+  assert (isnum());
+  return value_f();
 }
 
 Scalar::operator int()
 {
-    assert (isnum());
-    return value_i();
+  assert (isnum());
+  return value_i();
 }
 
 
 Scalar::operator bool() const
 {
-    if (!len())
+  if (!len())
        return false;
-    if (*this == "0")
+  if (*this == "0")
        return false;
-    String u (*this);
-    if ( u.upper_str() == "FALSE")
+  String u (*this);
+  if ( u.upper_str() == "FALSE")
        return false;
-    return true;
+  return true;
 }
index 2f5ab5bfa366fc1026a77b3d2ac4c3ed1a7e477d..c105169cee55d179e8963dd9dbb95febefb08741 100644 (file)
@@ -27,119 +27,122 @@ static const int STRING_BUFFER_LEN=1024;
 String
 String_convert::bin2hex_str (String bin_str)
 {
-    String str;
-    Byte const* byte_C = bin_str.byte_C();
-    for ( int i = 0; i < bin_str.length_i(); i++) {
+  String str;
+  Byte const* byte_C = bin_str.byte_C();
+  for ( int i = 0; i < bin_str.length_i(); i++) 
+    {
        str += (char)nibble2hex_byte (*byte_C >> 4);
        str += (char)nibble2hex_byte (*byte_C++);
     }
-    return str;
+  return str;
 }
 
 int
 String_convert::bin2_i (String bin_str)
 {
-    assert (bin_str.length_i() <= 4);
+  assert (bin_str.length_i() <= 4);
 
-    int result_i = 0;
-    for ( int i = 0; i < bin_str.length_i(); i++) {
+  int result_i = 0;
+  for ( int i = 0; i < bin_str.length_i(); i++) 
+    {
        result_i <<= 8;
        result_i += (Byte)bin_str[ i ];
     }
-    return result_i;
+  return result_i;
 }
 
 // breendet imp from String
 int
 String_convert::dec2_i (String dec_str)
 {
-    if ( !dec_str.length_i())
-       return 0;
+  if ( !dec_str.length_i())
+       return 0;
 
-    long l = 0;
-    int conv = sscanf (dec_str.ch_C(), "%ld", &l);
-    assert (conv);
+  long l = 0;
+  int conv = sscanf (dec_str.ch_C(), "%ld", &l);
+  assert (conv);
 
-    return (int)l;
+  return (int)l;
 }
 
 String
 String_convert::i64_str (I64 i64, char const* fmt)
 {
-    char buffer[STRING_BUFFER_LEN];
-    snprintf (buffer, STRING_BUFFER_LEN,
+  char buffer[STRING_BUFFER_LEN];
+  snprintf (buffer, STRING_BUFFER_LEN,
             (fmt ? fmt : "%Ld"), i64);     // assume radix 10
-    return String (buffer);
+  return String (buffer);
 
 }
 // breendet imp from String
 double
 String_convert::dec2_f (String dec_str)
 {
-    if ( !dec_str.length_i())
-       return 0;
-    double d = 0;
-    int conv = sscanf (dec_str.ch_C(), "%lf", &d);
-    assert (conv);
-    return d;
+  if ( !dec_str.length_i())
+       return 0;
+  double d = 0;
+  int conv = sscanf (dec_str.ch_C(), "%lf", &d);
+  assert (conv);
+  return d;
 }
 
 int
 String_convert::hex2bin_i (String hex_str, String& bin_str_r)
 {
-    if ( hex_str.length_i() % 2)
-        hex_str = "0" + hex_str;
-
-    bin_str_r = "";
-    Byte const* byte_C= hex_str.byte_C();
-    int i = 0;
-    while ( i < hex_str.length_i()) {   
-        int high_i = hex2nibble_i (*byte_C++);
-        int low_i = hex2nibble_i (*byte_C++);
-        if ( high_i < 0 || low_i < 0)
-            return 1; // illegal char
-        bin_str_r += String ((char)( high_i << 4 | low_i), 1 );
-        i += 2;
+  if ( hex_str.length_i() % 2)
+      hex_str = "0" + hex_str;
+
+  bin_str_r = "";
+  Byte const* byte_C= hex_str.byte_C();
+  int i = 0;
+  while ( i < hex_str.length_i()) 
+    {
+      int high_i = hex2nibble_i (*byte_C++);
+      int low_i = hex2nibble_i (*byte_C++);
+      if ( high_i < 0 || low_i < 0)
+          return 1; // illegal char
+      bin_str_r += String ((char)( high_i << 4 | low_i), 1 );
+      i += 2;
     }
-    return 0;
+  return 0;
 }
 
 String 
 String_convert::hex2bin_str (String hex_str)
 {
-    String 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 error_i = hex2bin_i (hex_str, str);
+  assert (!error_i);
+  return str;
 }
 
 int 
 String_convert::hex2nibble_i (Byte byte)
 {
-    if ( byte >= '0' && byte <= '9')
-        return byte - '0';
-    if ( byte >= 'A' && byte <= 'F')
-        return byte - 'A' + 10;
-    if ( byte >= 'a' && byte <= 'f')
-        return byte - 'a' + 10;
-    return -1;
+  if ( byte >= '0' && byte <= '9')
+      return byte - '0';
+  if ( byte >= 'A' && byte <= 'F')
+      return byte - 'A' + 10;
+  if ( byte >= 'a' && byte <= 'f')
+      return byte - 'a' + 10;
+  return -1;
 }
 
 // stupido.  Should use int_str()
 String 
 String_convert::i2dec_str (int i, int length_i, char ch)
 {
-    char fill_ch = ch;
-    if ( fill_ch)
-        fill_ch = '0';
-
-    // ugh
-    String dec_str (i);
-    
-    // ugh
-    return String (fill_ch, length_i - dec_str.length_i()) + dec_str;
+  char fill_ch = ch;
+  if ( fill_ch)
+      fill_ch = '0';
+
+  // ugh
+  String dec_str (i);
+  
+  // ugh
+  return String (fill_ch, length_i - dec_str.length_i()) + dec_str;
 }
 
 
@@ -147,38 +150,39 @@ String_convert::i2dec_str (int i, int length_i, char ch)
 String 
 String_convert::u2hex_str (unsigned u, int length_i, char fill_ch)
 {
-    String str;
-    if ( !u)
+  String str;
+  if ( !u)
        str = "0";
 
 #if 1 // both go...
-    while ( u) {
+  while ( u) 
+    {
        str = String ((char)( ( u % 16)["0123456789abcdef"] ) ) + str;
        u /= 16;
     }
 #else
-    str += int_str (u, "%x");  // hmm. %lx vs. %x -> portability?
+  str += int_str (u, "%x");    // hmm. %lx vs. %x -> portability?
 #endif
 
-    str = String (fill_ch, length_i - str.length_i()) + str;
-    while ( ( str.length_i() > length_i) &&  ( str[ 0 ] == 'f' ) )
-       str = str.mid_str (2, INT_MAX);
+  str = String (fill_ch, length_i - str.length_i()) + str;
+  while ( ( str.length_i() > length_i) &&  ( str[ 0 ] == 'f' ) )
+       str = str.mid_str (2, INT_MAX);
 
-    return str;
+  return str;
 }
 
 String 
 String_convert::i2hex_str (int i, int length_i, char fill_ch)
 {
-    return u2hex_str ((unsigned)i, length_i, fill_ch);
+  return u2hex_str ((unsigned)i, length_i, fill_ch);
 }
 
 Byte
 String_convert::nibble2hex_byte (Byte byte)
 {
-    if ( ( byte & 0x0f) <= 9 )
+  if ( ( byte & 0x0f) <= 9 )
        return ( byte & 0x0f) + '0';
-    else
+  else
        return ( byte & 0x0f) - 10 + 'a';
 }
 /**
@@ -190,10 +194,10 @@ String_convert::nibble2hex_byte (Byte byte)
 String
 String_convert::int_str (int i, char const* fmt)
 {
-    char buffer[STRING_BUFFER_LEN];
-    snprintf (buffer, STRING_BUFFER_LEN,
+  char buffer[STRING_BUFFER_LEN];
+  snprintf (buffer, STRING_BUFFER_LEN,
             (fmt ? fmt : "%d"), i);     // assume radix 10
-    return String (buffer);
+  return String (buffer);
 }
 
 /**
@@ -204,49 +208,50 @@ String_convert::int_str (int i, char const* fmt)
 String
 String_convert::double_str (double f, char const* fmt)
 {
-    char buf[STRING_BUFFER_LEN]; 
+  char buf[STRING_BUFFER_LEN]; 
 
-    snprintf (buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
-    return String (buf);
+  snprintf (buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
+  return String (buf);
 }
 
 /**
   Make a string from a single character.
 
   @param
-    #n# is a repetition count, default value is 1
+  #n# is a repetition count, default value is 1
  */
 String
 String_convert::char_str (char c, int n)
 {
-    n = n >= 0 ? n : 0;
-    char* ch_p = new char[ n ];
-    memset (ch_p, c, n);
-    String s ((Byte*)ch_p, n);
-    delete ch_p;
-    return s;
+  n = n >= 0 ? n : 0;
+  char* ch_p = new char[ n ];
+  memset (ch_p, c, n);
+  String s ((Byte*)ch_p, n);
+  delete ch_p;
+  return s;
 }
 
 String
 String_convert::rational_str (Rational r)
 {
-    char * n = Itoa (r.numerator()); // LEAK????
-    
-    String s = n;
-    if (r.denominator() != 1) {
+  char * n = Itoa (r.numerator()); // LEAK????
+  
+  String s = n;
+  if (r.denominator() != 1) 
+    {
        char * d = Itoa (r.denominator());
        s +=  String ('/') + String (d);
        //delete d;
     }
 /*    delete n;
-    */
-    return s;
+  */
+  return s;
 }
 
 String
 String_convert::pointer_str (void const *l)
 {
-    char buffer[STRING_BUFFER_LEN];
-    snprintf (buffer, STRING_BUFFER_LEN, "%p", l);     // assume radix 10
-    return String (buffer);
+  char buffer[STRING_BUFFER_LEN];
+  snprintf (buffer, STRING_BUFFER_LEN, "%p", l);     // assume radix 10
+  return String (buffer);
 }
index 1bd236114ca75b97857a6c0094c50e585d5def0c..6651475b37f3d9890f9adbe995ecc9f834c3488c 100644 (file)
@@ -25,17 +25,17 @@ void* mymemmove (void* dest, void const* src, size_t n);
 Byte*
 String::copy_byte_p() const
 {
-    Byte const* src = strh_.byte_C();
-    Byte* dest = new Byte[strh_.length_i() + 1];
-    memcpy (dest, src, strh_.length_i() + 1);
-    return dest;    
+  Byte const* src = strh_.byte_C();
+  Byte* dest = new Byte[strh_.length_i() + 1];
+  memcpy (dest, src, strh_.length_i() + 1);
+  return dest;    
 }
 void
 String::print_on (ostream& os) const
 {
-    if (!strh_.is_binary_bo())
-        os << ch_C();
-    else
+  if (!strh_.is_binary_bo())
+      os << ch_C();
+  else
        for ( int i = 0; i < length_i(); i++)
            os << (Byte)(*this)[ i ];
 }
@@ -46,24 +46,24 @@ String::print_on (ostream& os) const
 String&
 String::operator = (String const&source)
 {
-    strh_ = source.strh_;
-    return *this;
+  strh_ = source.strh_;
+  return *this;
 }
 
 
 String::String (Rational r)
 {
-    *this = String_convert::rational_str (r);
+  *this = String_convert::rational_str (r);
 }
 
 String::String (double f, char const* fmt)
 {
-    *this= String_convert::double_str (f,fmt);
+  *this= String_convert::double_str (f,fmt);
 }
 
 String::String (char c,  int n)
 {
-    *this = String_convert::char_str (c,n);
+  *this = String_convert::char_str (c,n);
 }
 
 /**
@@ -72,71 +72,71 @@ String::String (char c,  int n)
  */
 String::String (int i, char const * format)
 {
-    *this = String_convert::int_str (i,format);
+  *this = String_convert::int_str (i,format);
 }
 
 String::String (bool b)
 {
-    *this = (char const*) (b ? "true" : "false");
+  *this = (char const*) (b ? "true" : "false");
 }
 
 String::String (char const* source)
 {   
-    assert (source);    
-    strh_ = source;    
+  assert (source);    
+  strh_ = source;    
 }
 
 String::String (Byte const* byte_l, int length_i)
 {   
-    strh_.set (byte_l, length_i);    
+  strh_.set (byte_l, length_i);    
 }
 \f
 void
 String::append (String s)
 {
-    strh_.append (s.byte_C(), s.length_i());
+  strh_.append (s.byte_C(), s.length_i());
 }
 void
 String::operator +=(String s)
 {
-    append (s);
+  append (s);
 }
 
 void
 String::prepend (String s)
 {
-    s += *this;
-    *this = s;
+  s += *this;
+  *this = s;
 }
 
 int
 String::length_i() const
 {
-    return strh_.length_i();
+  return strh_.length_i();
 }
 
 Byte const*
 String::byte_C() const
 {
-    return strh_.byte_C();
+  return strh_.byte_C();
 }
 
 char const*
 String::ch_C() const
 {
-    return strh_.ch_C();
+  return strh_.ch_C();
 }
 
 Byte*
 String::byte_l()
 {
-    return strh_.byte_l();
+  return strh_.byte_l();
 }
 
 char*
 String::ch_l()
 {
-    return strh_.ch_l();
+  return strh_.ch_l();
 }
 
 /**
@@ -145,50 +145,51 @@ String::ch_l()
 int
 String::compare_i (String const& s1, String const& s2) 
 {
-    Byte const* p1 = s1.byte_C();
-    Byte const* p2 = s2.byte_C();
-    if ( p1 == p2)
+  Byte const* p1 = s1.byte_C();
+  Byte const* p2 = s2.byte_C();
+  if ( p1 == p2)
        return 0;
 
-    int i1 = s1.length_i();
-    int i2 = s2.length_i();
+  int i1 = s1.length_i();
+  int i2 = s2.length_i();
 
-    int result=  memcmp (p1, p2, i1 <? i2);
-    return result ? result : i1-i2;
+  int result=  memcmp (p1, p2, i1 <? i2);
+  return result ? result : i1-i2;
 }
 
 \f
 int
 String::index_last_i (char const c) const
 {
-    if ( !length_i()) 
+  if ( !length_i()) 
        return -1;
 
-    char const* me = strh_.ch_C();
-    char const* p = memrchr (me, length_i(), c);
-    if ( p)
+  char const* me = strh_.ch_C();
+  char const* p = memrchr (me, length_i(), c);
+  if ( p)
        return p - me;
-    return -1;
+  return -1;
 }
 
 int
 String::index_last_i (char const* string) const // UGK!
 {
-    assert (false);            // broken
-    int length = strlen (string); // ugrh
-    if ( !length_i() || !length) 
+  assert (false);              // broken
+  int length = strlen (string); // ugrh
+  if ( !length_i() || !length) 
        return -1;
-    
-    int next_i = index_i (string);
-    if ( next_i == -1)
+  
+  int next_i = index_i (string);
+  if ( next_i == -1)
        return -1;
-    
-    int index_i = 0;
-    while (next_i >= 0) {
+  
+  int index_i = 0;
+  while (next_i >= 0) 
+    {
        index_i += next_i;
        next_i = right_str (length_i() - index_i - length).index_i (string );
     }
-    return index_i;
+  return index_i;
 }
 
 /** find  a character.
@@ -202,11 +203,11 @@ String::index_last_i (char const* string) const // UGK!
 int
 String::index_i (char c) const
 {
-    char const* me = strh_.ch_C();
-    char const* p = (char const *) memchr (me,c,  length_i());
-    if ( p)
+  char const* me = strh_.ch_C();
+  char const* p = (char const *) memchr (me,c,  length_i());
+  if ( p)
        return p - me;
-    return -1;
+  return -1;
 }
 
 /**
@@ -218,13 +219,13 @@ String::index_i (char c) const
 int
 String::index_i (String searchfor) const
 {
-    char const* me = strh_.ch_C();
-    char const* p = (char const *) memmem (
+  char const* me = strh_.ch_C();
+  char const* p = (char const *) memmem (
        me, length_i(), searchfor.ch_C(), searchfor.length_i ());
-    
-    if ( p)
+  
+  if ( p)
        return p - me;
-    else
+  else
        return -1;
 }
 
@@ -236,59 +237,62 @@ String::index_i (String searchfor) const
 int
 String::index_any_i (String set) const
 {
-    int n = length_i();
-    if ( !n)
+  int n = length_i();
+  if ( !n)
        return -1;
 
-    void const * me_l = (void const *) strh_.ch_C();
-    for (int i=0; i  < set.length_i(); i++) {
+  void const * me_l = (void const *) strh_.ch_C();
+  for (int i=0; i  < set.length_i(); i++) 
+    {
        char * found=(char*) memchr (me_l, set[i], n );
-       if (found) {
+       if (found) 
+         {
            return found - me_l;
-       }
+         }
     }
-    return -1;
+  return -1;
 }
 \f
 String
 String::left_str (int n) const
 {
-    if (n >= length_i())
+  if (n >= length_i())
        return *this;
 
-    String retval;     
-    if (n < 1)
-        return retval;
-    
-    retval = *this;
-    retval.strh_.trunc (n);
-    return retval;
+  String retval;       
+  if (n < 1)
+      return retval;
+  
+  retval = *this;
+  retval.strh_.trunc (n);
+  return retval;
 }
 
 String
 String::right_str (int n) const
 {
-    if (n > length_i())
+  if (n > length_i())
        return *this;
-    
-    if ( n < 1)
-        return "";
-    
-    return String (strh_.byte_C() + length_i() - n, n); 
+  
+  if ( n < 1)
+      return "";
+  
+  return String (strh_.byte_C() + length_i() - n, n); 
 }
 
 
 String
 String::nomid_str (int index_i, int n) const
 {
-    if ( index_i < 0) {
+  if ( index_i < 0) 
+    {
        n += index_i;
        index_i = 0;
     }
-    if ( n <= 0)
+  if ( n <= 0)
        return *this;
-    
-    return
+  
+  return
        left_str (index_i)   +
        right_str (length_i() - index_i - n) ;
 }
@@ -299,67 +303,68 @@ String::nomid_str (int index_i, int n) const
 String
 String::mid_str (int index_i, int n) const
 {
-    if (index_i <0) {
+  if (index_i <0) 
+    {
        n += index_i;
        index_i=0;
     }
-    
-    if ( !length_i() || ( index_i < 0) || ( index_i >= length_i () ) || ( n < 1 ) )
+  
+  if ( !length_i() || ( index_i < 0) || ( index_i >= length_i () ) || ( n < 1 ) )
        return String();
 
-    if ( ( n > length_i()) ||  ( index_i + n > length_i () ) )
+  if ( ( n > length_i()) ||  ( index_i + n > length_i () ) )
        n = length_i() - index_i;
 
-    return String (byte_C() + index_i, n);
+  return String (byte_C() + index_i, n);
 }
 \f
 String
 String::upper_str() const
 {
-    String str = *this;
-    str.to_upper();
-    return str;
+  String str = *this;
+  str.to_upper();
+  return str;
 }
 void
 String::to_upper()
 {
-    char *s = (char*)strh_.byte_l();
-    strnupr (s ,length_i());
+  char *s = (char*)strh_.byte_l();
+  strnupr (s ,length_i());
 }
 
 void
 String::to_lower()
 {
-    char* s = strh_.ch_l();
-    strnlwr (s,length_i());    
+  char* s = strh_.ch_l();
+  strnlwr (s,length_i());    
 }
 
 
 String 
 String::lower_str() const
 {
-    String str = *this;
-    str.to_lower();
-    return str;
+  String str = *this;
+  str.to_lower();
+  return str;
 }
 String 
 String::reversed_str() const
 {
-    String str = *this;
-    strrev (str.byte_l(), str.length_i ());
-    return str;    
+  String str = *this;
+  strrev (str.byte_l(), str.length_i ());
+  return str;    
 }
 
 int
 String::value_i() const
 {
-    return String_convert::dec2_i (*this);
+  return String_convert::dec2_i (*this);
 }
 
 double
 String::value_f() const
 {
-    return String_convert::dec2_f (*this);
+  return String_convert::dec2_f (*this);
 }
 
 
index b415de36e2e865c746f53ff9310bbf61f883d570..bc431567b929aa66e8ee04256d8f7e2c28731eb3 100644 (file)
 void
 ctors()
 {
-    cout << "constructors"<<endl;
-
-    String str ("hai");
-    String def;
-    String fromi (10);
-    String fromc ('c');
-    String fromf (1.32e-2, "%g");
-
-    cout << str << endl;
-    cout << def << endl;
-    cout << fromi<< endl;
-    cout << fromc<< endl;       
-    cout << fromf<< endl;
+  cout << "constructors"<<endl;
+
+  String str ("hai");
+  String def;
+  String fromi (10);
+  String fromc ('c');
+  String fromf (1.32e-2, "%g");
+
+  cout << str << endl;
+  cout << def << endl;
+  cout << fromi<< endl;
+  cout << fromc<< endl;       
+  cout << fromf<< endl;
 }
 
 void
 cmp()
 {
-    Array<String> a;
-    a.push ("abcd");
-    a.push ("zxy");
-    a.push ("abc");
-    a.push ("");
-    a.sort (String::compare_i);
-    cout << "compares: "<<endl;
-    for (int i=0; i < a.size(); i++)
+  Array<String> a;
+  a.push ("abcd");
+  a.push ("zxy");
+  a.push ("abc");
+  a.push ("");
+  a.sort (String::compare_i);
+  cout << "compares: "<<endl;
+  for (int i=0; i < a.size(); i++)
        cout << a[i] << endl;
 }
 
@@ -44,74 +44,75 @@ cmp()
 void
 searching()
 {
-    String hay = "foobarbazblub";
-
-    char c =   'b';
-    String cstr =c;
-    String set = "bar";
-    cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
-    cout << "index_i ('"<< c<<"') " << c << "= " << hay.index_i (c) <<endl;
-    cout << "last_index_i ('"<< c<<"') " << c << "= " << hay.index_last_i (c) <<endl;    
+  String hay = "foobarbazblub";
+
+  char c =   'b';
+  String cstr =c;
+  String set = "bar";
+  cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
+  cout << "index_i ('"<< c<<"') " << c << "= " << hay.index_i (c) <<endl;
+  cout << "last_index_i ('"<< c<<"') " << c << "= " << hay.index_last_i (c) <<endl;    
 //    cout << "last index of cstr " << c << ": " << hay.index_last_i (cstr) <<endl;    
 //    cout << "index_last_i (\""<<set<<"\"): " << hay.index_last_i (set) <<endl;
-    cout << "index_i (\""<<set<<"\"): " << hay.index_i (set) <<endl;    
-    cout << "index_any (\"" << set << "\"): " << cstr << ": " << hay.index_any_i (cstr) <<endl;
+  cout << "index_i (\""<<set<<"\"): " << hay.index_i (set) <<endl;    
+  cout << "index_any (\"" << set << "\"): " << cstr << ": " << hay.index_any_i (cstr) <<endl;
 
-    
-    
+  
+  
 }
 
 
 void
 kutenpeer()
 {
-    String str ("hai");
-    for (int i=-1; i < str.length_i()+2; i++) {
+  String str ("hai");
+  for (int i=-1; i < str.length_i()+2; i++) 
+    {
        cout<<" left_str (" << i<<"): " << str.left_str (i) << endl;
        cout<<" right_str ("<<i<<"): " << str.right_str (i) << endl;
     }
-    str = "blonde haren";
-    cout << str<<endl;
-    cout << "mid (2,6)="<<str.mid_str (2,3)<<endl;
-    cout << "nomid (2,6)="<<str.nomid_str (2,3)<<endl;
+  str = "blonde haren";
+  cout << str<<endl;
+  cout << "mid (2,6)="<<str.mid_str (2,3)<<endl;
+  cout << "nomid (2,6)="<<str.nomid_str (2,3)<<endl;
 }
 
 int 
 main()
 {
-    ctors();
-    cmp();
-    searching();
-    kutenpeer();
-    String str ("hai");
-    cout <<  str << endl;
-    cout << "left" << endl;
-    str += " daar";
-    cout << str << endl;
-
-    str = String ("Hallo") + " daaR" + '!';
-    cout << str << endl;
-
-    cout << "up: " << str.upper_str() << " down: " << str.lower_str ()<<endl;
-    
-    if ( str == String ("") )
-        cout << str << " is empty" << endl;
-    else
+  ctors();
+  cmp();
+  searching();
+  kutenpeer();
+  String str ("hai");
+  cout <<  str << endl;
+  cout << "left" << endl;
+  str += " daar";
+  cout << str << endl;
+
+  str = String ("Hallo") + " daaR" + '!';
+  cout << str << endl;
+
+  cout << "up: " << str.upper_str() << " down: " << str.lower_str ()<<endl;
+  
+  if ( str == String ("") )
+      cout << str << " is empty" << endl;
+  else
        cout << str << " is not empty"<<endl;
 
-    
-    String fn = "";
-    if ( fn == "")
-        cout << fn << " is empty" << endl;
-    else
+  
+  String fn = "";
+  if ( fn == "")
+      cout << fn << " is empty" << endl;
+  else
        assert (false);
-    
-    fn = "";
-    fn += "";
-    delete fn.copy_byte_p();
-    delete str.copy_byte_p();
+  
+  fn = "";
+  fn += "";
+  delete fn.copy_byte_p();
+  delete str.copy_byte_p();
 
-    cout << String_convert::bin2hex_str (String ((char)0xff) ) << endl;
+  cout << String_convert::bin2hex_str (String ((char)0xff) ) << endl;
 }
 
 #endif STRING_TEST
index 3624d46ff72dc9ca85cff093267712cc1d4a1531..fef860eb31cb77de92c87d64b973130d60d0fab9 100644 (file)
@@ -2,30 +2,33 @@
 bool
 Text_db::eof()
 {
-    Data_file::gobble_leading_white();
-    return  Data_file::eof();
+  Data_file::gobble_leading_white();
+  return  Data_file::eof();
 }
 
 void
 Text_db::gobble_leading_white()
 {
-    while (1) {
+  while (1) 
+    {
        Data_file::gobble_leading_white();
        if (eof())
            return ;
        char c;
-       if  ((c = data_get()) !='\n'){
+       if  ((c = data_get()) !='\n')
+         {
            data_unget (c);
            return ;
        }       
-    }  
+  }    
 }
 
 
 Text_record
 Text_db::get_record() 
 {
-   while (1) {
+   while (1) 
+   {
        String s;
        Array<String> fields;
        assert (!eof());
@@ -34,12 +37,12 @@ Text_db::get_record()
            {
            fields.push (s);    
            gobble_white();
-           }
+             }
             
 
        if (get_line() != "")
            assert (false);
-      
+    
        assert (fields.size());
        return Text_record (fields, get_name(), line ());
    }
index a8eb695ea22840383cbb47c0aed61d5dc6b7e2e2..530c6f8ecd5f1c5b5b84fa7627b3b3e6c1ab70ab 100644 (file)
@@ -2,23 +2,24 @@
 
 Text_stream::Text_stream (String fn)
 {
-    ios::sync_with_stdio();
-    if (fn == "") 
+  ios::sync_with_stdio();
+  if (fn == "") 
            {
            name = "<STDIN>";       
            f = stdin;
-           }
+             }
        
        else 
            {
            name = fn;      
            f = fopen (fn, "r");
-           }
+             }
        
-       if (!f) {
+       if (!f) 
+         {
            cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
            exit (1);
-       }
+         }
 
        line_no = 1;
     }
@@ -26,6 +27,6 @@ Text_stream::Text_stream (String fn)
 void
 Text_stream::message (String s)
 {
-    cerr << "\n"<<get_name() << ": " << line ()<<": "<<s<<endl;
+  cerr << "\n"<<get_name() << ": " << line ()<<": "<<s<<endl;
 }
 
index 1108f1459a9be2e7bb00a15aaf076dbdf1e06e2f..1bbf1f409ce279ce8e2b960136949848c4e6c687 100644 (file)
@@ -1,13 +1,14 @@
 #include "unionfind.hh"
 /*
-    see a book on data structures
-    */
+  see a book on data structures
+  */
 
 Union_find::Union_find (int n)
 {
-    classes.set_size (n);
+  classes.set_size (n);
 
-    for (int i=0; i < n; i++) {
+  for (int i=0; i < n; i++) 
+    {
        classes[i] = i;
     }
 }
@@ -15,21 +16,22 @@ Union_find::Union_find (int n)
 int
 Union_find::find (int i)
 {
-    int rep = i;
-    while (classes[rep] != rep)
+  int rep = i;
+  while (classes[rep] != rep)
        rep = classes[rep];
-    while (classes[i] != rep) {
+  while (classes[i] != rep) 
+    {
        int next =classes[i];
        classes[i] = rep;
        i = next;
     }
-    return rep;
+  return rep;
 }
 
 void
 Union_find::connect (int i, int j)
 {
-    i = find (i);
-    j = find (j);
-    classes[i] = j;    
+  i = find (i);
+  j = find (j);
+  classes[i] = j;    
 }
index ebe2a729d632cf5136e9f6436c14d17b86fd1d26..8f88b14f50c3b3dc6c9948ef9cf818ce13a90da2 100644 (file)
@@ -1,25 +1,25 @@
 #include "vector.hh"
 Vector::Vector (Array<Real> d)
-       : dat (d)
+     : dat (d)
 {
  
 }
 Vector::Vector (Vector const &n)
-    : dat (n.dat)
+  : dat (n.dat)
 {
 }    
 
 Vector
 Vector::operator-() const
 {
-    Vector v (*this);
-    v*=-1;
-    return v;
+  Vector v (*this);
+  v*=-1;
+  return v;
 }
 
 void
 Vector::set_unit (int j)
 {
-    fill (0.0);
-    dat[j] = 1.0;
+  fill (0.0);
+  dat[j] = 1.0;
 }
index de6a68c3ac724342d2e0fade60324417677a8d88..52278f321745479f5f8213dcefa860085346535f 100644 (file)
@@ -13,13 +13,18 @@ default_paper = \paper {
        notewidth = 5.0\pt;
        wholewidth = 4.8\pt;
        unitspace = 22.\pt;
-       basicspace = 4.\pt;
+       %geometric = 1.414;
+       %basicspace = 4.\pt;
 
+       geometric = 0.;
+       arithmetic_basicspace = 2.;
+        arithmetic_multiplier = 4.8\pt;
+   
        %
        interbeam = 2.667\pt;
-       geometric = 1.414;
-       gourlay_energybound = 50000.;
-       gourlay_maxmeasures = 6.;
+
+       gourlay_energybound = 100000.;
+       gourlay_maxmeasures = 14.;
        castingalgorithm = \Gourlay;
        \symboltables { \table_sixteen }
        \requesttranslator { \orchestral_score_translator }
index 8d84256d94e0a0e23f779864e0001ceccf87f166..65bced4151d4122d6a5d92534bedb4faf582c0bf 100644 (file)
@@ -1,7 +1,12 @@
 \version "0.1.1";
 
+breve = \duration { -1 0 }
+longa = \duration { -2 0 }
+
 \include "dynamic.ly"
 \include "dutch.ly" 
+
+
 \include "script.ly"
 \include "paper16.ly"
 
index f3fdd6de458fc62a2d11ec636d1a491c20098291..71cc34dcbade0fab5ac617065e4bd3a7cb968ff7 100644 (file)
@@ -74,9 +74,10 @@ table_sixteen=
      }
 
      "balls" = \table {
-            "1"        "\wholeball"    0.0\pt  6.0\pt  -2.0\pt 2.0\pt
-            "2"        "\halfball"     0.0\pt  5.0\pt  -2.0\pt 2.0\pt
-            "4"        "\quartball"    0.0\pt  5.0\pt  -2.0\pt 2.0\pt
+            "-1"       "\breveball"    0.0\pt  6.0\pt  -2.0\pt 2.0\pt
+            "0"        "\wholeball"    0.0\pt  6.0\pt  -2.0\pt 2.0\pt
+            "1"        "\halfball"     0.0\pt  5.0\pt  -2.0\pt 2.0\pt
+            "2"        "\quartball"    0.0\pt  5.0\pt  -2.0\pt 2.0\pt
      }
 
      "slur" = \table {
@@ -110,19 +111,21 @@ table_sixteen=
      }
 
      "rests" = \table {
-            "1o"       "\outsidewholerest"     0.0\pt  6.0\pt  0.0\pt  2.0\pt
-            "1"        "\wholerest"            0.0\pt  6.0\pt  0.0\pt  2.0\pt
-            "2"        "\halfrest"             0.0\pt  6.0\pt  -2.0\pt 0.0\pt
-            "2o"       "\outsidehalfrest"              0.0\pt  6.0\pt  -2.0\pt 0.0\pt
-            "4o"       "\quartrest"            -5.0\pt 2.0\pt  -5.0\pt 5.0\pt
-            "8o"       "\eighthrest"           0.0\pt  5.0\pt  0.0\pt  8.0\pt
-            "16o"      "\sixteenthrest"                0.0\pt  6.0\pt  0.0\pt  12.0\pt
-            "4"        "\quartrest"            -5.0\pt 2.0\pt  -5.0\pt 5.0\pt
-            "8"        "\eighthrest"           0.0\pt  5.0\pt  0.0\pt  8.0\pt
-            "16"       "\sixteenthrest"                0.0\pt  6.0\pt  0.0\pt  12.0\pt
-            "32"       "\thirtysecondrest"     0.0\pt  6.0\pt  0.0\pt  16.0\pt
-            "64"       "\sixtyfourthrest"      0.0\pt  6.0\pt  0.0\pt  16.0\pt
-            "128"      "\hundredtwentyeighthrest"      0.0\pt  6.0\pt  0.0\pt  16.0\pt
+            "-1o"      "\breverest"            0.0\pt  6.0\pt  0.0\pt  4.0\pt
+            "-1"       "\breverest"            0.0\pt  6.0\pt  0.0\pt  4.0\pt
+            "0o"       "\outsidewholerest"     0.0\pt  6.0\pt  0.0\pt  2.0\pt
+            "0"        "\wholerest"            0.0\pt  6.0\pt  0.0\pt  2.0\pt
+            "1"        "\halfrest"             0.0\pt  6.0\pt  -2.0\pt 0.0\pt
+            "1o"       "\outsidehalfrest"              0.0\pt  6.0\pt  -2.0\pt 0.0\pt
+            "2o"       "\quartrest"            -5.0\pt 2.0\pt  -5.0\pt 5.0\pt
+            "3o"       "\eighthrest"           0.0\pt  5.0\pt  0.0\pt  8.0\pt
+            "4o"       "\sixteenthrest"                0.0\pt  6.0\pt  0.0\pt  12.0\pt
+            "2"        "\quartrest"            -5.0\pt 2.0\pt  -5.0\pt 5.0\pt
+            "3"        "\eighthrest"           0.0\pt  5.0\pt  0.0\pt  8.0\pt
+            "4"        "\sixteenthrest"                0.0\pt  6.0\pt  0.0\pt  12.0\pt
+            "5"        "\thirtysecondrest"     0.0\pt  6.0\pt  0.0\pt  16.0\pt
+            "6"        "\sixtyfourthrest"      0.0\pt  6.0\pt  0.0\pt  16.0\pt
+            "7"        "\hundredtwentyeighthrest"      0.0\pt  6.0\pt  0.0\pt  16.0\pt
      }
 
      "meters" = \table {
index 9814cad784cff7c994c6be7a09f628fea97ce864..9c96602041f350f6893f371b2cac813ee2679170 100644 (file)
@@ -1,14 +1,14 @@
-%{MudelaHeader
- filename: cadenza.ly
- title: Cadenza ad libitum
- description: Cadenza to Mozart Horn concerto 3
- composer(s): unknown
- entered-by: HWN
- copyright: public domain
-
- Tested Features: cadenza mode
+\header{
+filename       cadenza.ly
+title  Cadenza ad libitum
+description    Cadenza to Mozart Horn concerto 3
+composer       unknown
+enteredby      HWN
+copyright      public domain
+}
 
-EndMudelaHeader
+%{
+Tested Features: cadenza mode
 %}
 
 \version "0.1.1";
@@ -58,9 +58,6 @@ cad = \melodic  {\id "Staff" "french horn";
 \score {
        \melodic { \cad }
        \paper {
-       
-               unitspace= 16.0\mm;
-               geometric= 1.4;
        }
        \midi { \tempo 4 = 90; }
 }
index 89b429867963177833898b3526e99066c49cae4a..6509c9cd06b3c276d07af9578ff6086f43d5696f 100644 (file)
@@ -1,3 +1,14 @@
+\header{
+title  La Gallina a 2 violini
+date   1637
+source the manuscript of Canzoni overo Sonate Concertate 
+       libro terzo, opera duodecima 
+composer        Tarquinio Merula (1594/95-1665)
+enteredby       Mats Bengtsson
+copyright       Public Domain 
+}
+
+
 %{
 From mats.bengtsson@s3.kth.seThu Aug 14 02:11:19 1997
 Date: Wed, 13 Aug 1997 18:24:53 +0200
@@ -20,20 +31,12 @@ either.
 
       /Mats
 
---------------------------------------------------
-%}
-%{
- title: La Gallina a 2 violini
- date: 1637
- source: the manuscript of Canzoni overo Sonate Concertate 
-   libro terzo, opera duodecima 
- composer(s): Tarquinio Merula (?-?)
- entered-by: Mats Bengtsson
- copyright: Public Domain 
 
- Tested Features: Note placement, multipart score, figured base
+Tested Features: Note placement, multipart score, figured base, \breve
 
+note: the sharp signs hoovering over the bass part are no mistake, but
+part of the basso continuo
 %}
 
 vi1=\melodic{
@@ -43,7 +46,7 @@ vi1=\melodic{
   d8 d d d d4 A16 B c A |
   B8 G G G16 A B8 G G G16 A | 
   B8 G G A16 B c4 B |
-  A8 D G4. Fis16 E Fis4 |
+  A8 D G2 Fis4 |
   G2 r2 |
   r1 |
   d8 d d d d4 A16 B c A |
@@ -58,12 +61,12 @@ vi1=\melodic{
   d8 G c2 B4 |
   c8 G G G16 A B4 G |
   r8 G G G16 A B4 G |
-  r8 E16 Fis G8 G  Fis G G Fis|
+  r8 E16 Fis G8 G  Fis! G G Fis! |
   G2 r |
   r1 |
   r16 d c B A G Fis E D8 d d d16 c |
   B8 d d d16 c B8 d d d16 e |
-  fis4 g2 fis4 |
+  fis4 g2 fis!4 |
   r16 g f e d c B A G8 g g g16 f |
   e8 g g g16 f e8 g g g16 a |
   b4 c'2 b4 |
@@ -78,11 +81,11 @@ vi1=\melodic{
   d1. |
   r4 d8 c B4 c8 d G4 A8 B |
   E1. |
-  r4 e8 d cis4 d8 e A4 B8 cis |
+  r4 e8 d cis4 d8 e A4 B8 cis! |
   Fis1. |
   r4 d d d d d |
   e e8 d c4 d8 e A4 B8 c |
-  Fis4 fis8 e d4 e8 fis B4 c8 d |
+  Fis4 fis8 e d4 e8 fis! B4 c8 d |
   G4 g g g g g |
   a4 c'8 b a4 b8 c' f4 g8 a |
   d4 g g g g g |
@@ -95,12 +98,13 @@ vi1=\melodic{
   c2 r |
   g8 g g g g4 d16 e f d |
   e8 G G G16 A B8 d d d16 e |
-  fis4 g2 fis4 |
+  fis4 g2 fis!4 |
   r16 g f e d c B A G8 g g g16 f |
   e2 r8 d d d16 e |
   fis a g fis e d c B A8 d d d16 e |
-  fis4 g2 fis4 |
-  g1
+  fis4 g2 fis!4 |
+  \cadenza 1;
+  g\breve
   \bar "|.";
 }
 
@@ -112,7 +116,7 @@ vi2=\melodic{
   d8 d d d d4 A16 B c A |
   B8 G G G16 A B8 G G G16 A | 
   B8 G G A16 B c4 B |
-  A8 D G4. Fis16 E Fis4 |
+  A8 D G2 Fis4 |
   G2 r2 |
   r1 |
   g8 g g g g4 d16 e f d |
@@ -127,7 +131,7 @@ vi2=\melodic{
   c4 B A2 |
   G r16 d c B A G Fis E |
   D8 d d d16 c B8 d d d16 e |
-  fis4 g g4. fis8 |
+  fis4 g g4. fis!8 |
   g2 r |
   r16 d c B A G Fis E D8 d d d16 c |
   B4 c2 B4 |
@@ -141,18 +145,18 @@ vi2=\melodic{
   r1. |
   r4 g8 f e4 f8 g c4 d8 e |
   A1. |
-  r4 a8 g fis4 g8 a d4 e8 fis |
+  r4 a8 g fis4 g8 a d4 e8 fis! |
   B1. |
   r4 g g g g g |
   a1. |
   r4 a a a a a |
   b d8 c B4 c8 d G4 A8 B |
   E4 g8 f e4 f8 g c4 d8 e |
-  A4 a8 g fis4 g8 a d4 e8 fis |
+  A4 a8 g fis4 g8 a d4 e8 fis! |
   B4 b8 a g4 a8 b e4 fis8 g |
   c4 A A A A A |
   B d8 c B4 c8 d D4 E |
-  Fis2 G Fis |
+  Fis2 G Fis! |
   \meter 4/4;
   G1 |
   r1 | r1 |
@@ -165,7 +169,8 @@ vi2=\melodic{
   c8 G G G16 A B d c B A G Fis E |
   D8 d d d16 e fis16 a g fis e d c B |
   A d c B A G Fis E D4 d |
-  B1
+  \cadenza 1;
+  B\breve
   \bar "|.";
 }
 
@@ -192,6 +197,7 @@ bc=\melodic{
   G1 |
   \meter 3/2;
   g1. | c |
+       % 30
   f | d^"\sharp" |
   g | c |
   A | d^"\sharp" |
@@ -206,7 +212,9 @@ bc=\melodic{
   G^"3 4 3" | c2 G |
   d1^"3 4 3" | G^"3 4 3" |
   c2 G | d1^"\sharp" ( |
-  ) d^"3 4 3" | G |
+  ) d^"3 4 3" | 
+  \cadenza 1;
+  G\breve 
   \bar "|.";
 }
 
@@ -217,9 +225,13 @@ bc=\melodic{
     \bc
   >
   \paper{
-    linewidth=18.\cm;
-    gourlay_maxmeasures=5.;
+    %linewidth=18.\cm;
+     \output "gallina.out";
+    gourlay_maxmeasures=7.;
   }
+ \midi{ 
+       \tempo 4=90;
+}
 }
 
 
diff --git a/input/gallina.tex b/input/gallina.tex
new file mode 100644 (file)
index 0000000..db760e4
--- /dev/null
@@ -0,0 +1,24 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% gallina.tex
+% Mats Bengtsson, 17/8 1997
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\documentclass[a4paper]{article}
+
+\addtolength{\oddsidemargin}{-1cm}
+\addtolength{\topmargin}{-1cm}
+\setlength{\textwidth}{15cm}
+\begin{document}
+\input lilyponddefs
+\input titledefs
+
+\title{La Gallina a 2 violini \\ 
+  \normalsize from \textit{Canzoni overo Sonate Concertate 
+   libro terzo, opera duodecima}, 1637}
+\composer{Tarquinio Merula (1594/95-1665)}
+%\instrument{M\"a\ss ig} % heu
+%#%\tempo{M\"a\ss ig}
+\maketit
+\input{gallina.out}
+
+
+\end{document}
index 71b146c9134232fa1571d0f95792a045b94fca21..49d223676e1d4fb2d24173bd3e35fbe7195693ac 100644 (file)
@@ -1,17 +1,16 @@
-%{MudelaHeader
+\header {
+filename       
+title  
+date   
+description     
+opus   
+source 
+composers      
+enteredby      
+copyright      
+remarks        
+}
 
- filename:
- title:
- date:
- description: 
- opus:
- source:
- composers:
- entered-by:
- copyright:
- remarks:
- Tested Features:
-
-EndMudelaHeader
+%{
+Tested Features:
 %}
-\version "0.1.1";
index 6f0451ef6fe8c57e7bbe8a28c8c03afd01c16f86..6c580c2467a0da6dc120437606a77444e65ccc5c 100644 (file)
@@ -1,14 +1,15 @@
-%{MudelaHeader
 
- filename: kortjakje.ly
- title: Ah,  vous dirais-je, maman (variations)
- description:  bare bones version. (written down from memory :-)
- composers: Mozart, KV 265
- entered-by: HWN
- copyright: PD
+\header{
+filename               kortjakje.ly
+title          Ah,  vous dirais-je, maman (variations)
+description             bare bones version. (written down from memory :-)
+composers              Mozart, KV 265
+entered-by             HWN
+copyright              PD
+}
+%{
+Tested Features: example file with comments
 
- Tested Features: example file with comments
-EndMudelaHeader
 %}
 \version "0.1.1";
 
index a2ab5383812bf7973ee8fe75d586d9e642d51cfa..14454306a25a76d648040b04fca7ea39d8441bac 100644 (file)
@@ -63,7 +63,5 @@ yanother =
        >
        
        \paper{
-               unitspace =2.0\cm;
-               geometric =1.6;
        }
 }
diff --git a/input/s.ly b/input/s.ly
deleted file mode 100644 (file)
index f3aba77..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-vi1=\melodic{
-  \meter 4/4;
-  \octave c'';
-
-  B8 G G G16 A B8 G G G16 A | 
-       
-}
-
-vi2=\melodic{
-  \meter 4/4;
-  \octave c'';
-
-% r16
-  r1
-}
-
-%{
-bc=\melodic{
-  \clef "bass";
-  \meter 4/4;
-  \octave c;
-
-  G1 |
-}
-%}
-
-\score{
-  < \multi 3;
-    \vi1
-    \vi2
-
-  >
-
-  \paper{
-    geometric=1.2;
-    unitspace=8.\mm;
-    linewidth=18.\cm;
-    gourlay_maxmeasures=4.;
-    gourlay_energybound = 70000.;
-       basicspace = 2.8\pt;
-  }
-}
index f69bc1b650a9ee20adecd659a3fee9ad2bfd8144..ce2c3ba854c9637919e3af665099acba052a52dd 100644 (file)
@@ -1,12 +1,9 @@
-%{MudelaHeader
-
- filename: scales.ly
- title:
- description: 
- composers:
- entered-by: HWN
- copyright: public domain
-
+\header{
+filename       scales.ly
+enteredby      HWN
+copyright      public domain
+}
+%{
  Tested Features: scripts, beams, transposition, 
 EndMudelaHeader
 %}
@@ -89,7 +86,5 @@ c1
 \score{
        \melodic {\blah}
        \paper{
-               unitspace= 1.5 \cm;
-               geometric= 1.4;
        }
 }
index 35ba9023f2ef40a1fd3c6e805bdb959eae87147c..72d61415a1d6b840522732feaf4c59fa97a1865c 100644 (file)
@@ -1,18 +1,16 @@
-%{MudelaHeader
-
- filename: scsii-menuetto.ly
- title: Solo Cello Suites, Suite II part V, Menuetto I
- description: Cello suite transcribed for Viola
- source: ?
- opus: BWV 1008 no. 5
- composers: Johann Sebastian Bach (1685-1750)
- entered-by: JCN
- copyright: public domain
+\header{
+filename       scsii-menuetto.ly
+title          Solo Cello Suites, Suite II part V, Menuetto I
+description    Cello suite transcribed for Viola
+source         ?
+opus           BWV 1008 no. 5
+composers      Johann Sebastian Bach (1685-1750)
+enteredby      JCN
+copyright      public domain
+}
 
+%{
  Tested Features:breaking algorithm, chords, multivoice, accents
-
-
-EndMudelaHeader
 %}
 
 \version "0.1.1";
@@ -107,9 +105,7 @@ IImenuetto = \melodic{
                \id "Staff" "cello"; \IImenuetto 
        }
        \paper{
-               unitspace= 9.0\mm  ;% to get lily to use only three lines
-               geometric= 1.40;
-               linewidth= 195.0\mm;
+               linewidth= 150.0\mm;
                \output "scsii-menuetto.out";
        }
        \midi{ 
index 58d1dd27c1fa4e912836f8f54a9a791a2bb0443f..e9daad73785127e3b15e161d8732406d42219a05 100644 (file)
@@ -1,13 +1,13 @@
-%{MudelaHeader
-
- filename: standchen.ly
- title: St\"andchen (Serenade) "Leise flehen meine Lieder"
- opus:  D. 957 No. 4
composers: Franz Schubert (1797-1828)
-        Text by Ludwig Rellstab (1799-1860)
- entered-by:JCN
- copyright: public domain
-
+\header{
+filename       standchen.ly
+title          St\"andchen (Serenade) "Leise flehen meine Lieder"
+opus           D. 957 No. 4
+composers      Franz Schubert (1797-1828)
              Text by Ludwig Rellstab (1799-1860)
+enteredby      JCN
+copyright      public domain
+}
+%{
  Tested Features: multivoice, accents, lyrics, chords, piano music
 
 EndMudelaHeader
@@ -480,11 +480,11 @@ tekstII = \lyric{
                >
        >
        \paper{
-               linewidth= 195.\mm;
+               linewidth= 150.\mm;
 
+               gourlay_maxmeasures = 8.;
                % on two pages...
                unitspace= 9.\mm;
-               geometric= 1.2;
                \output "standchen.out";
        }
        \midi{
index 828796f9d0631d4df0d4d4455016ece5c5f3ee0b..4e75271f8fdfc4f2d1bb36587fd795ac0a715736 100644 (file)
@@ -1,22 +1,23 @@
-%{MudelaHeader
+\header{
 
- filename: toccata-fuga-E.ly
- title: toccata and fuga in E-major 
- opus: BWV 566
toccata: 3 bar excerpt
2nd fuga: transposed subject --- 4 bar excerpt
+filename       toccata-fuga-E.ly
+title  toccata and fuga in E-major 
+opus   BWV 566
      toccata         3 bar excerpt
      2nd fuga        transposed subject --- 4 bar excerpt
 
- composers: Johann Sebastian Bach (1685-1750)
- entered-by: JCN
- copyright: public domain
+composers      Johann Sebastian Bach (1685-1750)
+enteredby      JCN
+copyright      public domain
 
+}
+
+%{
  Tested Features:
  purpose of this file is testing: 
      * real-life collisions
      * multi-voice input --- splitting?
      * organ staff...
-
-EndMudelaHeader
 %}
 
 
index 41561e6a449514d17d785306f433f18e10fb5579..1feeeb2eec6f9d528ae2d4aaa43e11bd86928b24 100644 (file)
@@ -1,15 +1,15 @@
-%{MudelaHeader
-
- filename: twinkle.ly
- title: Ah, vous dirais-je, maman 
- description: twinkle twinkle in pop-song-settings
- composers: traditional
-
- entered-by: HWN, chords by Johan Vromans
- copyright: public domain
+\header{
+filename               twinkle.ly
+title          Ah, vous dirais-je, maman 
+description            twinkle twinkle in pop-song-settings
+composers              traditional
+
+enteredby              HWN, chords by Johan Vromans
+copyright              public domain
+}
 
- Tested Features: lyrics and chords
-EndMudelaHeader
+%{
+Tested Features                lyrics and chords
 %}
 
 \version "0.1.1";
@@ -43,5 +43,5 @@ texte = \lyric{
         <  \melodic <  \id "Piano" "";  \melodie >
            \lyric   < \id "Lyric" "";  \texte >
         >
-        \paper { unitspace= 2.5\cm; }
+        \paper {  }
 }
index ba47c25d35b2f9df74ad339bec25f9e9a0a5775c..588b26a33e6cd231db80762d65e4459361873f81 100644 (file)
@@ -1,19 +1,18 @@
-%{MudelaHeader
-
- filename: twinkle.ly
- title: twinkle twinkle little star
- description: 
-  traditional song in various languages.
-  "Ah, vous dirais-je, maman" 
-  "Altijd is Kortjakje ziek"
-  "Twinkle twinkle little star"
-
- composers: Traditional
- entered-by: HWN & JCN
- copyright: public domain
-
- Tested Features: lyrics
-EndMudelaHeader
+\header{
+filename        twinkle.ly
+title  twinkle twinkle little star
+description    traditional song in various languages.
+        "Ah, vous dirais-je, maman" 
+        "Altijd is Kortjakje ziek"
+        "Twinkle twinkle little star"
+
+composers      Traditional
+enteredby      HWN & JCN
+copyright      public domain
+}
+%{
+Tested Features: lyrics
+
 %}
 \version "0.1.1";
 
@@ -140,7 +139,6 @@ textiii = \lyric{
                
        >
        \paper{
-               unitspace= 2.5\cm;
        }
        \midi{ 
                \tempo 4 = 120 ;
index 95ad2fc3ab91f0b0502cc131dfefaa67b91e6bd0..97429e7d88d079d2a9a0185d702e7829badfaa40 100644 (file)
@@ -1,13 +1,14 @@
+\header{
+filename               wohltemperirt.ly
+title          Fuga a 3
+description            Das Wohltemperirte Clavier I, Fuga II (c-minor)
+opus           BWV ?
+source         Henle's Urtext
+composer               Johann Sebastian Bach (1685-1750)
+enteredby              HWN and Werner Lemberg
+copyright              Public Domain"
+}
 %{
- filename: wohltemperirt.ly
- title: Fuga a 3
- description: Das Wohltemperirte Clavier I, Fuga II (c-minor) 
- Opus: BWV ?
- source: Henle's Urtext
- composer(s): Johann Sebastian Bach (1685-1750)
- entered-by: HWN and Werner Lemberg
- copyright: Public Domain 
-
  Tested Features: stem direction, multivoice, forced accidentals.
 %}
 
@@ -176,7 +177,7 @@ bassdux =
              >
 
     \paper{
-       gourlay_maxmeasures =4.;
+       gourlay_maxmeasures =5.;
        
     }
     \midi {
index b2a71951032b5696ffea33e009e064f4e6caf631..c96273e5baee2e8ce7d495abcabe34761a806988 100644 (file)
@@ -23,8 +23,12 @@ Duration_convert::dur2_str( Duration dur )
 {
        if ( dur.ticks_i_ )
                return String( "["  ) + String( dur.ticks_i_ ) + "]";
-
-       String str( dur.type_i_ );
+       
+       String str;
+       if (dur.durlog_i_ >= 0)
+           str="breve";
+       else
+           str= String( type2_i(dur.durlog_i_) );
        str += String( '.', dur.dots_i_ );
        if ( dur.plet_b())
                str += String( "*" ) + String( dur.plet_.iso_i_ )
@@ -48,6 +52,27 @@ Duration_convert::dur2ticks_i( Duration dur )
        return dur2_mom( dur ) * Moment( Duration::division_1_i_s );
 }
 
+
+int
+Duration_convert::i2_type(int i)
+{
+    int t=0;
+    while (!(i & 1)) {
+       i >>= 1;
+       t++;
+           }
+    return t;
+}
+
+int
+Duration_convert::type2_i(int type)
+{
+    if (type<0)
+       return 0; 
+    else
+       return 1 << type;
+}
+
 Moment
 Duration_convert::dur2_mom( Duration dur )
 {
@@ -55,16 +80,20 @@ Duration_convert::dur2_mom( Duration dur )
                return Moment( dur.ticks_i_, Duration::division_1_i_s );        
 
        // or simply assert?
-       if ( !dur.type_i_ )
+       if ( dur.durlog_i_<-10 )
                return Moment( 0 );
-
-       Moment mom = Moment( 1 , dur.type_i_ );
+       Moment mom;
+       if (dur.durlog_i_<0)
+           mom = Moment( type2_i( -dur.durlog_i_ ), 1 );
+       else
+           mom = Moment( 1 , type2_i( dur.durlog_i_ ) );
 
        Moment delta = mom;
-       while ( dur.dots_i_-- ) {
+       while ( dur.dots_i_-- ) 
+         {
                delta /= 2.0;
                mom += delta;
-       }
+         }
 
        return mom * plet_factor_mom( dur );    
 }
@@ -86,11 +115,12 @@ Duration_convert::i2_mom( int time_i, int division_1_i )
 Duration
 Duration_convert::mom2_dur( Moment mom )
 {
-    if (!mom) {
+    if (!mom) 
+      {
        Duration dur;
        dur.set_plet(0,1);
        return dur;
-    }
+      }
        
 
        Duration dur = mom2standardised_dur( mom );
@@ -117,25 +147,28 @@ Duration_convert::mom2standardised_dur( Moment mom )
        if ( !dur_array_s.size() )
                set_array();
        assert( dur_array_s.size() );
-       for ( int i = 0; i < dur_array_s.size() - 1; i++ ) {
+       for ( int i = 0; i < dur_array_s.size() - 1; i++ ) 
+         {
                Moment lower_mom = dur2_mom( dur_array_s[ i ] );
-               if ( mom <= lower_mom ) {
+               if ( mom <= lower_mom ) 
+                 {
                        // all arbitrary, but 3/4 will get rid of the noise...
                        // kinda ok
                        if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) )
                                return dur_array_s[ i ];
-                       else {
+                       else 
+                         {
                            Duration d;
-                           d.type_i_ = 0;
+                           d.durlog_i_ = -100;
                            return d;
-                       }
-               }
+                         }
+                 }
                Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] );
                if ( ( mom < upper_mom )
                         && ( ( mom - lower_mom ) / lower_mom
                                < ( upper_mom - mom ) / upper_mom ) )
                        return dur_array_s[ i ];
-       }
+         }
        return dur_array_s[ dur_array_s.size() - 1 ];
 }
 
@@ -181,7 +214,7 @@ Duration_convert::ticks2_dur( int ticks_i )
                
 // huh?
 #if 0
-       dur.type_i_ = 0;
+       dur.durlog_i_ = -100;
        dur.dots_i_ = 0;
        dur.set_ticks( ticks_i );
        return dur;
@@ -200,9 +233,9 @@ Duration_convert::ticks2standardised_dur( int ticks_i )
 
 Duration_iterator::Duration_iterator()
 {
-       cursor_dur_.type_i_ = 128;
+       cursor_dur_.durlog_i_ = 7;
        if ( Duration_convert::no_smaller_than_i_s )
-               cursor_dur_.type_i_ = Duration_convert::no_smaller_than_i_s;
+               cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
 //     cursor_dur_.set_plet( 1, 1 );
 }
 
@@ -240,7 +273,7 @@ Duration_iterator::forward_dur()
                16.     0.0938
                8       0.1250
                16..    0.1406
-               4:2/3   0.1667
+       4:2/3   0.1667
                8.      0.1875
                
        */
@@ -248,29 +281,33 @@ Duration_iterator::forward_dur()
 
        Duration dur = cursor_dur_;
 
-       if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() ) {
-               cursor_dur_.type_i_ *= 2;
+       if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() ) 
+         {
+               cursor_dur_.durlog_i_ += 1;
                cursor_dur_.dots_i_ = 2;
-       }
-       else if ( cursor_dur_.dots_i_ == 2 ) {
+         }
+       else if ( cursor_dur_.dots_i_ == 2 ) 
+         {
                assert( !cursor_dur_.plet_b() );
                cursor_dur_.dots_i_ = 0;
-               cursor_dur_.type_i_ /= 4;
+               cursor_dur_.durlog_i_ -=2;
                cursor_dur_.set_plet( 2, 3 );
-       }
+         }
        else if ( cursor_dur_.plet_b() 
                && ( cursor_dur_.plet_.iso_i_ == 2 )
-               && ( cursor_dur_.plet_.type_i_ == 3 ) ) {
+               && ( cursor_dur_.plet_.type_i_ == 3 ) ) 
+                 {
                assert( !cursor_dur_.dots_i_ );
                cursor_dur_.set_plet( 1, 1 );
-               cursor_dur_.type_i_ *= 2;
+               cursor_dur_.durlog_i_ += 1;
                cursor_dur_.dots_i_ = 1;
-       }
-       else if ( cursor_dur_.dots_i_ == 1 ) {
+         }
+       else if ( cursor_dur_.dots_i_ == 1 ) 
+         {
                assert( !cursor_dur_.plet_b() );
                cursor_dur_.dots_i_ = 0;
-               cursor_dur_.type_i_ /= 2;
-       }
+               cursor_dur_.durlog_i_ -= 1;
+         }
                
        if ( Duration_convert::no_triplets_b_s
             && cursor_dur_.plet_b() && ok() )
@@ -279,16 +316,16 @@ Duration_iterator::forward_dur()
             && ( cursor_dur_.dots_i_ == 2 ) && ok() )
                forward_dur();
        if ( Duration_convert::no_smaller_than_i_s
-            && ( cursor_dur_.type_i_ > Duration_convert::no_smaller_than_i_s ) && ok() )
+            && ( cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s ) && ok() )
                forward_dur();
        if ( Duration_convert::no_smaller_than_i_s
             && cursor_dur_.dots_i_
-            && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s )
+            && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s )
             && ok() )
                forward_dur();
        if ( Duration_convert::no_smaller_than_i_s
             && ( cursor_dur_.dots_i_ == 2 )
-            && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s / 2 )
+            && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2 )
             && ok() )
                forward_dur();
 
@@ -298,6 +335,6 @@ Duration_iterator::forward_dur()
 bool
 Duration_iterator::ok()
 {
-       return ( cursor_dur_.type_i_ 
-               && !( ( cursor_dur_.type_i_ == 1 ) && ( cursor_dur_.dots_i_ > 2 ) ) );
+       return ( cursor_dur_.durlog_i_ 
+               && !( ( cursor_dur_.durlog_i_ == 0 ) && ( cursor_dur_.dots_i_ > 2 ) ) );
 }
index f81b3c2be92ed9d0e74ee6248259b2ac7a7aa7b9..c26699c5bd773d3f38dc408a901feded7a24fe42 100644 (file)
@@ -22,29 +22,25 @@ int Duration::division_1_i_s = 384 * 4;
 
 Duration::Duration()
 {
-       type_i_ = 1;
-       dots_i_ = 0;
-       ticks_i_ = 0;
+  durlog_i_ = 0;
+  dots_i_ = 0;
+  ticks_i_ = 0;
 }
 
 Duration::Duration( int type_i, int dots_i = 0 )
 {
-       type_i_ = type_i;
-       dots_i_ = dots_i;
-       ticks_i_ = 0;
+  durlog_i_ = type_i;
+  dots_i_ = dots_i;
+  ticks_i_ = 0;
 }
 
 bool
 Duration::duration_type_b(int t)
 {
-    int bit_i=0;
-    while (t > 0)
-    {
-       int rem = t % 2;
-       t /= 2;
-       bit_i += (rem == 1);
-    }
-    return bit_i == 1;
+  /*
+    ugh. Assuming behavior of conversion funcs on broken input.
+   */
+  return t == Duration_convert::type2_i( Duration_convert::i2_type(t));
 }
 
 // ugh, what's this?
@@ -52,58 +48,40 @@ Duration::duration_type_b(int t)
 Moment
 Duration::length() const
 {
-    return Duration_convert::dur2_mom(*this);
+  return Duration_convert::dur2_mom(*this);
 }
 
 void
 Duration::set_plet(int i, int t)
 {
-    plet_.iso_i_ = i; 
-    plet_.type_i_ = t;
+  plet_.iso_i_ = i; 
+  plet_.type_i_ = t;
 }
 
 void
 Duration::set_plet(Duration d)
 {
-    plet_.iso_i_ = d.plet_.iso_i_; 
-    plet_.type_i_ = d.plet_.type_i_;
+  plet_.iso_i_ = d.plet_.iso_i_; 
+  plet_.type_i_ = d.plet_.type_i_;
 }
 
 void
 Duration::set_ticks( int ticks_i )
 {
-       assert( !type_i_ );
-       assert( !dots_i_ );
-       ticks_i_ = ticks_i;
+  assert( durlog_i_ <10 );
+  assert( !dots_i_ );
+  ticks_i_ = ticks_i;
 }
 
 String
 Duration::str()const
 {
-    return Duration_convert::dur2_str(*this);
+  return Duration_convert::dur2_str(*this);
 }
 
-Plet::Plet()
-{
-    type_i_ = 1;
-    iso_i_ = 1;
-}
-
-Moment
-Plet::mom()const
-{
-    return  Moment( iso_i_, type_i_ );
-}
 
 bool
 Duration::plet_b()
 {
-    return !plet_.unit_b();
+  return !plet_.unit_b();
 }
-
-bool
-Plet::unit_b()const
-{
-    return type_i_ == 1 && iso_i_ == 1;
-}
-
index 16bee29c68d3e4600e289294f6aad47e6427491d..849c27c994caa80be71d7508781c9f8f5509137d 100644 (file)
@@ -55,10 +55,11 @@ Mapped_file_storage::open(String name_str)
 {
     fildes_i_ = ::open( name_str, O_RDONLY );  
            
-    if ( fildes_i_ == -1 ) {
+    if ( fildes_i_ == -1 ) 
+      {
        warning( String( "can't open: " ) + name_str + String( ": " ) + strerror( errno )); 
         return;
-    }
+      }
 
     struct stat file_stat;
     fstat( fildes_i_, &file_stat );
@@ -69,21 +70,23 @@ Mapped_file_storage::open(String name_str)
 void
 Mapped_file_storage::unmap()
 {
-    if ( data_caddr_ ) {
+    if ( data_caddr_ ) 
+      {
        munmap( data_caddr_, size_off_ );
        data_caddr_ = 0;
        size_off_ = 0;
-    }
+      }
 }
 
 void
 Mapped_file_storage::close()
 {
     unmap();
-    if ( fildes_i_ ) {
+    if ( fildes_i_ ) 
+      {
        ::close( fildes_i_ );
        fildes_i_ = 0;
-    }
+      }
 }
 
 int
index 6b4348d5f2a9a6e49b9a0f439af1cc5d692b8ddb..73d00498a80fa00b7333ff5b5580e41ac792648e 100644 (file)
@@ -24,10 +24,11 @@ void
 Includable_lexer::new_input(String s, Sources  * global_sources)
 {
     Source_file * sl = global_sources->get_file_l(s);
-    if (!sl) {
+    if (!sl) 
+      {
        LexerError("Can't find file `" + s+ "'");
        return; 
-    }
+      }
 
     
     char_count_stack_.push(0);
@@ -59,12 +60,14 @@ Includable_lexer::close_input()
     cout << "]"<<flush;
     yy_delete_buffer(yy_current_buffer );
     yy_current_buffer = 0;
-    if (state_stack_.empty()) {
+    if (state_stack_.empty()) 
+      {
        return false;
-    }else {
+    }else 
+      {
        yy_switch_to_buffer(state_stack_.pop());
        return true;
-    }    
+      }
 }
 
 char const*
@@ -77,7 +80,8 @@ Includable_lexer::here_ch_C()
 
 Includable_lexer::~Includable_lexer()
 {
-    while (!include_stack_.empty()) {
+    while (!include_stack_.empty()) 
+      {
        close_input();
     };
 }
index 3f34a7650b4816fa0f630a34d20a59abc808d079..d321c4598edd11edc388131db5ec2ac828240dae 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
          duration-convert.hh -- declare 
 
@@ -51,6 +50,13 @@ struct Duration_convert {
     /// Return number of ticks in (ticks, division_1) representation
     static int dur2ticks_i( Duration dur );
        
+    /// Return the type_i representation of note length i
+    static int i2_type(int i);
+
+    /// Return the note length corresponding to the type_i representation
+    /// Return 0 if longer than whole note.
+    static int type2_i(int type);
+
     /// Return Moment representation (fraction of whole note).
     static Moment dur2_mom( Duration dur );
 
index 0c5b313e4b62c0810be30a65335b528180534315..c7f2ef3a47dd0986004346defb2d52766e84fc9b 100644 (file)
 
 #include "fproto.hh"
 #include "moment.hh"
-
+#include "plet.hh"
 // ugh, to get me in lily lib
 extern bool no_triplets_bo_g;
 
-/** 
-  The type and replacement value of a  plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3.
-  
-  (plet)
- */
-struct Plet {
-    Plet();
-    Moment mom()const;
-    bool unit_b()const;
-    int iso_i_;  // 2/3; 2 is not duration, maar of count!
-    int type_i_;
-};
 
 /**
   Class to handle "musical" durations. This means: balltype 1,2,4,etc. and dots.
@@ -37,24 +25,26 @@ struct Plet {
   (dur)
   */
 struct Duration {
-    /**
-      Ctor of Duration. type_i should be a power of 2. 
-       */
-    Duration();
-    Duration( int type_i, int dots_i = 0 );
-    /// is the "plet factor" of this note != 1 ?
-    bool plet_b();
-    String str()const;
-    void set_plet(int,int );
-    void set_plet(Duration );
-    static bool duration_type_b(int t);
-    void set_ticks( int ticks_i );
-    Moment length() const ;    // zo naai mij
-    static int division_1_i_s;
-    int type_i_;
-    int dots_i_;
-    Plet plet_;
-    int ticks_i_;
+  /**
+    Ctor of Duration. 
+    */
+  Duration();
+  Duration( int type_i, int dots_i = 0 );
+  /// is the "plet factor" of this note != 1 ?
+  bool plet_b();
+  String str()const;
+  void set_plet(int,int );
+  void set_plet(Duration );
+  static bool duration_type_b(int t);
+  void set_ticks( int ticks_i );
+  Moment length() const ;      // zo naai mij
+  static int division_1_i_s;
+
+  /// Logarithm of the base duration.
+  int durlog_i_;
+  int dots_i_;
+  Plet plet_;
+  int ticks_i_;
 };
 #endif // DURATION_HH
 
diff --git a/lib/include/plet.hh b/lib/include/plet.hh
new file mode 100644 (file)
index 0000000..1f1033f
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  plet.hh -- declare Plet
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef PLET_HH
+#define PLET_HH
+#include "moment.hh"
+
+/** 
+  The type and replacement value of a  plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3.
+  
+  (plet)
+ */
+struct Plet {
+  Plet();
+  Moment mom()const;
+  bool unit_b()const;
+  int iso_i_;  // 2/3; 2 is not duration, maar of count!
+  int type_i_; 
+};
+
+#endif // PLET_HH
index 84788100528629696e7909e089d999d3c9cccb70..6f05290422b128aae18787e0f00495395e091121 100644 (file)
@@ -40,15 +40,17 @@ Input::message(String message_str)const
 {
     String str = "";
     
-    if ( source_file_l_ ) {
+    if ( source_file_l_ ) 
+      {
        str += location_str() + String(": ");
-    }
+      }
     
     str += message_str;
-    if ( source_file_l_ ) {
+    if ( source_file_l_ ) 
+      {
        str += ":\n";
        str += source_file_l_->error_str( defined_ch_C_);
-    }
+      }
     cerr << str << endl;
 }
 
diff --git a/lib/plet.cc b/lib/plet.cc
new file mode 100644 (file)
index 0000000..73df524
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  plet.cc -- implement Plet
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "plet.hh"
+
+
+Plet::Plet()
+{
+  type_i_ = 1;
+  iso_i_ = 1;
+}
+
+Moment
+Plet::mom()const
+{
+  return  Moment( iso_i_, type_i_ );
+}
+
+bool
+Plet::unit_b()const
+{
+  return type_i_ == 1 && iso_i_ == 1;
+}
+
index be022cee02db95d8ae283187f2a1dcf327e03c9f..d66c2c2d9b1b34dfd6c254d628d88eadfa90d387 100644 (file)
@@ -29,10 +29,11 @@ Simple_file_storage::Simple_file_storage(String s)
 {
     data_p_ =0;
     FILE * f = fopen ( s.ch_C(), "r");
-    if ( !f ) {
+    if ( !f ) 
+      {
        warning("can't open file\n");
        return ;
-    }
+      }
 
     int ret = fseek( f, 0, SEEK_END);
     len_i_ = ftell(f);
index ffc7a341ed1d3004b1e93a82c95b474ef4890ee4..a67b46630016a03a21c33bcb564901d6a3e26ed2 100644 (file)
@@ -32,14 +32,16 @@ Source_file::istream_l()
     if ( !name_str_.length_i())
        return &cin;
     
-    if ( !istream_p_ ) {
+    if ( !istream_p_ ) 
+      {
        if ( length_i() ) // can-t this be done without such a hack?
            istream_p_ = new istrstream( ch_C(), length_i() );
-        else {
+        else 
+          {
            istream_p_ = new istrstream( "", 0 );
            istream_p_->set(ios::eofbit);
-       }
-    }
+         }
+      }
     return istream_p_;
 }
 
@@ -74,17 +76,19 @@ Source_file::error_str( char const* pos_ch_C )const
        pos_ch_C --;
     char const* begin_ch_C = pos_ch_C;
     while ( begin_ch_C > data_ch_C )
-        if ( *--begin_ch_C == '\n' ) {
+        if ( *--begin_ch_C == '\n' ) 
+          {
            begin_ch_C++;
            break;
-       }
+         }
 
     char const* end_ch_C = pos_ch_C;
     while ( end_ch_C < eof_C_ )
-        if ( *end_ch_C++ == '\n' ) {
+        if ( *end_ch_C++ == '\n' ) 
+          {
          end_ch_C--;
          break;
-       }
+         }
   
        //    String( char const* p, int length ) is missing!?
     String line_str( (Byte const*)begin_ch_C, end_ch_C - begin_ch_C );
index ec490f17e727fed3142d70c04ef86009d6b9bf3b..e60041553c84050e6237ce1e6ed35a5a714bdb2c 100644 (file)
@@ -34,12 +34,13 @@ Sources::set_path(File_path *f_C)
 Source_file*
 Sources::get_file_l(String &file_str ) //UGH
 {
-    if (path_C_){
+    if (path_C_)
+      {
        String file_str_o = path_C_->find(file_str); 
        if ( ( file_str_o == "" ) && ( file_str != "" ) )
            return 0;
        file_str = file_str_o;
-    }
+      }
     Source_file * f_p= (!binary_b_) ?
        new Source_file(file_str) : new Binary_source_file(file_str);
     add(f_p);
index d87385f58721cfef70a17ef7c2138703479fc7dd..7b9611af008e0cdef86459ab4dfe6f2488c7d913 100644 (file)
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 0
 MINOR_VERSION = 1
-PATCH_LEVEL = 8
+PATCH_LEVEL = 9
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
 
index ac3c246a03e8724e950ac918b32564a09cb64224..fbb6e973f830de43557dba8ec5524399082a4c94 100644 (file)
@@ -17,36 +17,36 @@ void
 Atom::print() const
 {
 #ifndef NPRINT
-    DOUT << "texstring: " <<sym_.tex<<"\n";    
+  DOUT << "texstring: " <<sym_.tex<<"\n";    
 #endif
 }
 
 Box
 Atom::extent() const
 {
-    Box b (sym_.dim);
-    b.translate (off_);
-    return b;
+  Box b (sym_.dim);
+  b.translate (off_);
+  return b;
 }
 
 Atom::Atom (Symbol s)
 {
-    sym_=s;
+  sym_=s;
 }
 
 
 String
 Atom::TeX_string() const
 {
-    /* infinity checks. */
-    assert (abs (off_.x()) < 100 CM);
-    assert (abs (off_.y()) < 100 CM);
-    
-    // whugh.. Hard coded...
-    String s ("\\placebox{%}{%}{%}");
-    Array<String> a;
-    a.push (print_dimen (off_.y()));
-    a.push (print_dimen (off_.x()));
-    a.push (sym_.tex);
-    return substitute_args (s, a);
+  /* infinity checks. */
+  assert (abs (off_.x()) < 100 CM);
+  assert (abs (off_.y()) < 100 CM);
+  
+  // whugh.. Hard coded...
+  String s ("\\placebox{%}{%}{%}");
+  Array<String> a;
+  a.push (print_dimen (off_.y()));
+  a.push (print_dimen (off_.x()));
+  a.push (sym_.tex);
+  return substitute_args (s, a);
 }
index e0d87b1a9921cb551da56028018407c2c215fdfd..1df586be6234d8564372d392d1c7ef22bb5b5c15 100644 (file)
 
 Audio_column::Audio_column (Moment at_mom)
 {
-    at_mom_ = at_mom;
-    audio_score_l_ = 0;
+  at_mom_ = at_mom;
+  audio_score_l_ = 0;
 }
 
 void
 Audio_column::add (Audio_item* l)
 {
-    audio_item_l_list_.bottom().add (l);
-    l->audio_column_l_ = this; 
+  audio_item_l_list_.bottom().add (l);
+  l->audio_column_l_ = this; 
 }
 
 Moment
 Audio_column::at_mom() const
 {
-    return at_mom_;
+  return at_mom_;
 }
 
 void
 Audio_column::print() const
 {
 #ifndef NPRINT
-    DOUT << "Audio_column {";
-    DOUT << "at: " << at_mom_ << "\n";
-    DOUT << "}\n";
+  DOUT << "Audio_column {";
+  DOUT << "at: " << at_mom_ << "\n";
+  DOUT << "}\n";
 #endif 
 }
 
index e5fbda129ba9c64a8db79bba78b25af7b187f842..eaa895049a2651cbc4eb9a85708266b0afdc1c4c 100644 (file)
 Audio_instrument::Audio_instrument (String instrument_str)
        : Audio_item (0)
 {
-    str_ = instrument_str;
+  str_ = instrument_str;
 }
 
 Midi_item*
 Audio_instrument::midi_item_p()
 {
-    return str_.length_i() ? new Midi_instrument( 0, str_ ) : 0;
+  return str_.length_i() ? new Midi_instrument( 0, str_ ) : 0;
 }
-                                      
+                                    
 Audio_item::Audio_item (Request* req_l)
 {
-    audio_column_l_ = 0;
-    req_l_ = req_l;
+  audio_column_l_ = 0;
+  req_l_ = req_l;
 }
 
 Audio_key::Audio_key (Request* req_l)
@@ -35,7 +35,7 @@ Audio_key::Audio_key (Request* req_l)
 Midi_item*
 Audio_key::midi_item_p()
 {
-    return new Midi_key (this);
+  return new Midi_key (this);
 }
 
 
@@ -47,19 +47,19 @@ Audio_note::Audio_note (Request* req_l)
 Midi_item*
 Audio_note::midi_item_p()
 {
-    return new Midi_note (this);
+  return new Midi_note (this);
 }
 
 Audio_tempo::Audio_tempo (int per_minute_4_i)
        : Audio_item (0)
 {
-    per_minute_4_i_ = per_minute_4_i;
+  per_minute_4_i_ = per_minute_4_i;
 }
 
 Midi_item*
 Audio_tempo::midi_item_p()
 {
-    return new Midi_tempo (this);
+  return new Midi_tempo (this);
 }
 
 Audio_meter::Audio_meter (Request* req_l)
@@ -70,7 +70,7 @@ Audio_meter::Audio_meter (Request* req_l)
 Midi_item*
 Audio_meter::midi_item_p()
 {
-    return new Midi_meter (this);
+  return new Midi_meter (this);
 }
 
 Audio_text::Audio_text (Audio_text::Type type, String text_str)
@@ -83,7 +83,7 @@ Audio_text::Audio_text (Audio_text::Type type, String text_str)
 Midi_item*
 Audio_text::midi_item_p()
 {
-    return text_str_.length_i() ? new Midi_text( this ) : 0;
+  return text_str_.length_i() ? new Midi_text( this ) : 0;
 }
 
 
index 57f012e2332aeee71c6af769d4837bea08c1a293..1c406c5b7f7b6bdb0f66edd9b7230aa4753fa319 100644 (file)
 
 Audio_score::Audio_score (Score* l)
 {
-    score_l_ = l;
+  score_l_ = l;
 }
 
 void
 Audio_score::add (Audio_column* p)
 {
-    p->audio_score_l_ = this;
-    audio_column_p_list_.bottom().add (p);
+  p->audio_score_l_ = this;
+  audio_column_p_list_.bottom().add (p);
 }
 
 void
 Audio_score::output (Midi_stream& midi_stream_r)
 {
-    int tracks_i = audio_staff_l_list_.size() + 1;
-    // ugh
-    int clocks_per_4_i = 384;
-    midi_stream_r << Midi_header (1, tracks_i, clocks_per_4_i);
-    output_header_track (midi_stream_r);
-    int n = 1;
-    for ( PCursor<Audio_staff*> i (audio_staff_l_list_); i.ok(); i++ )
+  int tracks_i = audio_staff_l_list_.size() + 1;
+  // ugh
+  int clocks_per_4_i = 384;
+  midi_stream_r << Midi_header (1, tracks_i, clocks_per_4_i);
+  output_header_track (midi_stream_r);
+  int n = 1;
+  for ( PCursor<Audio_staff*> i (audio_staff_l_list_); i.ok(); i++ )
        i->output (midi_stream_r, n++);
 }
 
 void
 Audio_score::output_header_track (Midi_stream& midi_stream_r)
 {
-    Midi_track midi_track;
-    
-    time_t t = time (0);
+  Midi_track midi_track;
+  
+  time_t t = time (0);
 
-    // perhaps multiple text events?
-    String str = String ("Creator: ") + get_version_str() + "\n";
+  // perhaps multiple text events?
+  String str = String ("Creator: ") + get_version_str() + "\n";
 
-    Midi_text creator (Midi_text::TEXT, str);
-    midi_track.add (Moment (0), &creator );
+  Midi_text creator (Midi_text::TEXT, str);
+  midi_track.add (Moment (0), &creator );
 
-    str = "Automatically generated at ";
-    str += ctime (&t);
-    str = str.left_str (str.length_i() - 1);
-    str += "\n";
-    Midi_text generate (Midi_text::TEXT, str);
-    midi_track.add (Moment (0), &generate );
+  str = "Automatically generated at ";
+  str += ctime (&t);
+  str = str.left_str (str.length_i() - 1);
+  str += "\n";
+  Midi_text generate (Midi_text::TEXT, str);
+  midi_track.add (Moment (0), &generate );
 
-    str = "from musical definition: ";
+  str = "from musical definition: ";
 
-    str += score_l_->location_str();
-    Midi_text from (Midi_text::TEXT, str);
-    midi_track.add (Moment (0), &from );
+  str += score_l_->location_str();
+  Midi_text from (Midi_text::TEXT, str);
+  midi_track.add (Moment (0), &from );
 
-    Midi_text track_name (Midi_text::TRACK_NAME, "Track " 
+  Midi_text track_name (Midi_text::TRACK_NAME, "Track " 
                          + String_convert::i2dec_str (0, 0, '0') );
-    midi_track.add (Moment (0), &track_name );
+  midi_track.add (Moment (0), &track_name );
 
-    Midi_tempo tempo (score_l_->midi_p_->get_tempo_i (Moment (1, 4) ) );
-    midi_track.add (Moment (0), &tempo);
+  Midi_tempo tempo (score_l_->midi_p_->get_tempo_i (Moment (1, 4) ) );
+  midi_track.add (Moment (0), &tempo);
 
-    midi_stream_r  << midi_track;
+  midi_stream_r  << midi_track;
 }
 
 void
 Audio_score::add_staff (Audio_staff* l)
 {
-    audio_staff_l_list_.bottom().add (l);
+  audio_staff_l_list_.bottom().add (l);
 }
 
 void
 Audio_score::add (Audio_element *p)
 {
-    audio_elem_p_list_.bottom().add (p);
+  audio_elem_p_list_.bottom().add (p);
 }
 
 void
 Audio_score::print() const
 {    
 #ifndef NPRINT
-    DOUT << "Audio_score { ";
-    score_l_->midi_p_->print();
-    DOUT << "\ncolumns: ";
-    for ( PCursor<Audio_column*> i (audio_column_p_list_); i.ok(); i++ )
+  DOUT << "Audio_score { ";
+  score_l_->midi_p_->print();
+  DOUT << "\ncolumns: ";
+  for ( PCursor<Audio_column*> i (audio_column_p_list_); i.ok(); i++ )
        i->print();
-    DOUT << "}\n";
+  DOUT << "}\n";
 #endif 
 }
 
index c23b339b2b32abcdc596cb4cc8da0bfe9c10293c..21de1e0c9e40d9e2a25335e383f1e4ddf045d578 100644 (file)
 void
 Audio_staff::add (Audio_item* l)
 {
-    audio_item_l_list_.bottom().add (l);
+  audio_item_l_list_.bottom().add (l);
 }
 
 void
 Audio_staff::output (Midi_stream& midi_stream_r, int track_i)
 {
-    Midi_track midi_track;
-    midi_track.number_i_ =  track_i;
-    for ( Midi_walker i (this, &midi_track); i.ok(); i++ )
+  Midi_track midi_track;
+  midi_track.number_i_ =  track_i;
+  for ( Midi_walker i (this, &midi_track); i.ok(); i++ )
        i.process();
-    midi_stream_r << midi_track;
+  midi_stream_r << midi_track;
 }
 
 IMPLEMENT_IS_TYPE_B1(Audio_staff, Audio_element);
index c39a12c67367312cecc3164c49de55214dfbcc0e..325c2a029723f93f5352fb357b030ba1f605a24e 100644 (file)
@@ -13,8 +13,9 @@ IMPLEMENT_IS_TYPE_B2(Axis_group_item, Axis_group_element, Item);
 void
 Axis_group_item::OK() const
 {
-    Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
-    for (int i=0; i < elems.size(); i++) {
+  Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
+  for (int i=0; i < elems.size(); i++) 
+    {
        Item * it_l = elems[i]->item();
        assert (it_l);
   
@@ -26,25 +27,27 @@ Axis_group_item::OK() const
 void
 Axis_group_item::do_breakable_col_processing()
 {
-    if (!pcol_l_->breakable_b())
+  if (!pcol_l_->breakable_b())
        return;
-    OK();
-    copy_breakable_items();
-    
+  OK();
+  copy_breakable_items();
+  
            
-    Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
-    for (int i=0; i < elems.size(); i++) {
+  Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
+  for (int i=0; i < elems.size(); i++) 
+    {
        Item* it_l = elems[i]->item();
-       for ( int j=0; j < 2; j++) {
+       for ( int j=0; j < 2; j++) 
+         {
            Item *new_l = it_l->find_prebroken_piece (broken_to_a_[j]->pcol_l_);
            ((Axis_group_item*)broken_to_a_[j])->add_element (new_l);
-       }
+         }
     }
-    Item::do_breakable_col_processing();
+  Item::do_breakable_col_processing();
 }
 
 void
 Axis_group_item::do_print() const
 { 
-    Axis_group_element::do_print(); 
+  Axis_group_element::do_print(); 
 }
index a7fd4fa62b7e059bbe0a17c3be5f032abad95f35..1d45de3ae0e3bd003c7ff457ec5daf88ab859bcd 100644 (file)
 void
 Axis_group_spanner::do_break_processing_if_unbroken()
 {
-    Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
-    Line_of_score *my_line = line_l();
-    for (int i=0; i < elems.size(); i++) {
-       if (!elems[i]->line_l()) {
+  Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
+  Line_of_score *my_line = line_l();
+  for (int i=0; i < elems.size(); i++) 
+    {
+       if (!elems[i]->line_l()) 
+         {
            Item * item_l = elems[i]->item();
            if  (item_l
                 && item_l->breakable_b_ 
-                && item_l->break_status_i() == 0) {
+                && item_l->break_status_i() == 0) 
+                  {
                // last two checks are paranoia
                Item * broken_item_l = 
                    item_l->find_prebroken_piece (my_line);
                add_element (broken_item_l);
-           }
+             }
            remove_element (elems[i]);  
-       }
+         }
     }
-    
+  
 }
 void
 Axis_group_spanner::do_break_processing()
 {
-    set_my_columns();
-    bool breaking_self_b = ! Spanner::line_l();
-    if (!breaking_self_b)  {
+  set_my_columns();
+  bool breaking_self_b = ! Spanner::line_l();
+  if (!breaking_self_b)  
+    {
        do_break_processing_if_unbroken();
        Spanner::do_break_processing();
        return;
     }
 
-    break_into_pieces (true);
-    Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
-    remove_all();
-    
-    for (int i=0; i < loose_elems.size(); i++) {
+  break_into_pieces (true);
+  Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
+  remove_all();
+  
+  for (int i=0; i < loose_elems.size(); i++) 
+    {
        Score_elem * elt = loose_elems[i];
        Line_of_score *elt_line = elt->line_l();
        
-       if ( ! elt_line){
+       if ( ! elt_line)
+         {
            /* this piece doesn't know where it belongs.
               Find out if it was broken, and use the broken remains
               */
-           if (elt->spanner()) {
+           if (elt->spanner()) 
+             {
                Spanner * sp = elt->spanner();
                
-               for (int j =0; j < broken_into_l_arr_.size(); j++) {
+               for (int j =0; j < broken_into_l_arr_.size(); j++) 
+                 {
                    Axis_group_spanner * my_broken_l
                         = (Axis_group_spanner*)broken_into_l_arr_[j];
                    
@@ -72,13 +80,16 @@ Axis_group_spanner::do_break_processing()
                    if (broken_span_l) 
                        my_broken_l->add_element (broken_span_l);
                    
-               }
-           } else if (elt->item() 
+                 }
+             }
+           else if (elt->item() 
                       && elt->item()->breakable_b_ 
-                      && elt->item()->break_status_i () == 0) {
+                      && elt->item()->break_status_i () == 0) 
+                        {
 
                // broken items
-               for (int j =0; j < 2; j++) {
+               for (int j =0; j < 2; j++) 
+                 {
                    Item * my_item = elt->item()->broken_to_a_[j];
                    Line_of_score * item_line_l = my_item->line_l() ;
                    if ( ! item_line_l) 
@@ -88,26 +99,28 @@ Axis_group_spanner::do_break_processing()
                        = (Axis_group_spanner*)find_broken_piece (item_line_l);
                    if (v)
                        v->add_element (my_item);
-               }
+                 }
                    
-           }
-       } else {
+             }
+         }
+       else 
+         {
          /* this piece *does* know where it belongs.
             Put it in appropriate piece of this spanner
             */
            Axis_group_spanner * my_broken_l
                = (Axis_group_spanner*)find_broken_piece (elt->line_l());
            my_broken_l->add_element (elt);
-       }
+         }
     }
-    
-    Spanner::do_break_processing();
+  
+  Spanner::do_break_processing();
 }
 
 void
 Axis_group_spanner::do_print() const
 {
-    Axis_group_element::do_print();
+  Axis_group_element::do_print();
 }
 
 
index 4e09739471a23572291ba06fbdf10dc918a135c1..c0fff8176058f50db1c470a88c9213e5b5c4c05a 100644 (file)
 /** don't copy anything: an element can only be in one
   Axis_group_element at one time.  */
 Axis_group_administration::Axis_group_administration (
-    Axis_group_administration const&)
+  Axis_group_administration const&)
 {
 }
 
 bool 
 Axis_group_administration::contains_b (Score_elem const *e)const
 {
-    return elem_l_arr_.find_l (e);
+  return elem_l_arr_.find_l (e);
 }
 
 Interval
 Axis_group_administration::extent (Axis axis)const
 {
-    Interval r;
-    for (int i=0; i < elem_l_arr_.size(); i++) 
+  Interval r;
+  for (int i=0; i < elem_l_arr_.size(); i++) 
        r.unite (elem_l_arr_[i]->extent (axis));
-    return r;
+  return r;
 }
 
 void
 Axis_group_administration::add_element (Score_elem*e,
                                       Axis_group_element*g, Axis a1, Axis a2)
 {
-    assert (! e->axis_group_l_a_[a1] && !e->axis_group_l_a_[a2]);
-    e->axis_group_l_a_[a1] = g;
-    e->axis_group_l_a_[a2] = g;    
-    elem_l_arr_.push ( e);
+  assert (! e->axis_group_l_a_[a1] && !e->axis_group_l_a_[a2]);
+  e->axis_group_l_a_[a1] = g;
+  e->axis_group_l_a_[a2] = g;    
+  elem_l_arr_.push ( e);
 }
 
 
@@ -47,22 +47,23 @@ Axis_group_administration::add_element (Score_elem*e,
 void
 Axis_group_administration::remove_element (Score_elem*e, Axis a1, Axis a2)
 {
-    assert (contains_b (e));
-    elem_l_arr_.unordered_substitute (e,0);
-    
-    e->axis_group_l_a_[a1] = 0;
-    e->axis_group_l_a_[a2] = 0;    
+  assert (contains_b (e));
+  elem_l_arr_.unordered_substitute (e,0);
+  
+  e->axis_group_l_a_[a1] = 0;
+  e->axis_group_l_a_[a2] = 0;    
 }
 
 void
 Axis_group_administration::remove_all (Axis a1, Axis a2)
 {
-    for (int i=0; i < elem_l_arr_.size(); i++) { 
+  for (int i=0; i < elem_l_arr_.size(); i++) 
+    {
        Score_elem*e=elem_l_arr_[i];
        e->axis_group_l_a_[a1] = 0;
        e->axis_group_l_a_[a2] = 0;  
     }
-    elem_l_arr_.clear();
+  elem_l_arr_.clear();
 }
 
 
@@ -70,7 +71,7 @@ void
 Axis_group_administration::print() const
 {
 #ifndef NPRINT
-    for (int i=0; i < elem_l_arr_.size(); i++) 
+  for (int i=0; i < elem_l_arr_.size(); i++) 
        DOUT << elem_l_arr_[i]->name() << ' ';
 #endif
 }
index 821748434050c3b566adfdebef02758ec802b565..d98d745b4c57347aef35b78390767ddba401664c 100644 (file)
@@ -12,5 +12,5 @@
 String
 axis_name_str (Axis a)
 {
-    return String (a + 'x');
+  return String (a + 'x');
 }
index 19b523cf786efbf7ee7214b476fe193fb0cc4dbc..4c073ac57edf180b90e1ce8ac6e73ca70b3afa1b 100644 (file)
 
 Bar_column_engraver::Bar_column_engraver()
 {
-    bar_l_ =0;
-    barcol_p_ =0;
+  bar_l_ =0;
+  barcol_p_ =0;
 }
 
 
 void
 Bar_column_engraver::acknowledge_element (Score_elem_info info)
 {
-    if (info.elem_l_->is_type_b (Script::static_name()) 
+  if (info.elem_l_->is_type_b (Script::static_name()) 
        && info.req_l_->command()
-       && info.origin_grav_l_arr_.size() == 1) {
+       && info.origin_grav_l_arr_.size() == 1) 
+         {
        script_l_arr_.push ((Script*)info.elem_l_->item());
-    } else {
+    }
+  else 
+    {
        if  (info.origin_grav_l_arr_.size() == 1 
             && info.elem_l_->is_type_b (Bar::static_name()))
             bar_l_ = (Bar*)info.elem_l_->item();
     }
        
-    if ( bar_l_ && !barcol_p_) {
+  if ( bar_l_ && !barcol_p_) 
+    {
        barcol_p_ = new Bar_column;
        barcol_p_->breakable_b_ =true;
        barcol_p_->set_bar (bar_l_);
        announce_element (Score_elem_info (barcol_p_, 0));
     }
 
-    if  (barcol_p_) {
-       for (int i=0; i < script_l_arr_.size(); i++) {
+  if  (barcol_p_) 
+    {
+       for (int i=0; i < script_l_arr_.size(); i++) 
+         {
            script_l_arr_[i]->breakable_b_ = true;
            barcol_p_->add (script_l_arr_[i]);
-       }
+         }
        script_l_arr_.clear();
     }
 }
@@ -52,7 +58,8 @@ Bar_column_engraver::acknowledge_element (Score_elem_info info)
 void
 Bar_column_engraver::do_pre_move_processing()
 {
-    if (barcol_p_) {
+  if (barcol_p_) 
+    {
        typeset_element (barcol_p_);
        barcol_p_ =0;
     }
@@ -61,8 +68,8 @@ Bar_column_engraver::do_pre_move_processing()
 void
 Bar_column_engraver::do_post_move_processing()
 {
-    script_l_arr_.clear();
-    bar_l_ =0;
+  script_l_arr_.clear();
+  bar_l_ =0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Bar_column_engraver, Engraver);
index 5f5dbf894b5d105da87bcc16116afa898209321e..f4c4d2f96ba59272cf6fb936deb6e7c66e16cddd 100644 (file)
 
 Bar_column::Bar_column()
 {
-    bar_l_ =0;
-    breakable_b_ = true;
+  bar_l_ =0;
+  breakable_b_ = true;
 }
 
 void
 Bar_column::set_bar (Bar*b)
 {
-    Script_column::add_support (b);
-    bar_l_ = b;        
+  Script_column::add_support (b);
+  bar_l_ = b;  
 }
 
 void
 Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    Script_column::do_substitute_dependency (o,n);
-    if ( o == bar_l_) {
+  Script_column::do_substitute_dependency (o,n);
+  if ( o == bar_l_) 
+    {
        bar_l_ = n ? (Bar*)n->item() : 0;
     }
 }
index 740f5d5d0413a6f53436a10c3055d0fbb2610680..c390c78a31420cc04586cead10e5d28d5a6b6fc2 100644 (file)
 
 Bar_engraver::Bar_engraver()
 {
-    do_post_move_processing();
+  do_post_move_processing();
 }
 
 bool
 Bar_engraver::do_try_request (Request*r_l)
 {
-    Command_req* c_l = r_l->command();
-    if (!c_l|| !c_l->bar()) 
+  Command_req* c_l = r_l->command();
+  if (!c_l|| !c_l->bar()) 
        return false;
-    Bar_req  * b= c_l->bar();
-    if (bar_req_l_ && bar_req_l_->equal_b (b))
+  Bar_req  * b= c_l->bar();
+  if (bar_req_l_ && bar_req_l_->equal_b (b))
        return false;
-    
-    bar_req_l_ = b;
+  
+  bar_req_l_ = b;
 
-    return true;
+  return true;
 }
 
 void
 Bar_engraver::do_process_requests()
 {
-    if (bar_req_l_) {
+  if (bar_req_l_) 
+    {
        bar_p_ = new Bar;
        bar_p_->type_str_=bar_req_l_->type_str_;
-    } else if (!get_staff_info().time_C_->whole_in_measure_) {
+    }
+  else if (!get_staff_info().time_C_->whole_in_measure_) 
+    {
        bar_p_ = new Bar;
     }
-    
-    if (bar_p_){
+  
+  if (bar_p_)
+    {
        announce_element (Score_elem_info (bar_p_, bar_req_l_));
-    } else {
+    }
+  else 
+    {
        Disallow_break_req r;
        daddy_grav_l_->try_request (&r);
     }
@@ -54,7 +60,8 @@ Bar_engraver::do_process_requests()
 void 
 Bar_engraver::do_pre_move_processing()
 {
-      if (bar_p_) {
+    if (bar_p_) 
+      {
          typeset_element (bar_p_);
          bar_p_ =0;
       }
@@ -63,8 +70,8 @@ Bar_engraver::do_pre_move_processing()
 void
 Bar_engraver::do_post_move_processing()
 {
-    bar_req_l_ = 0;
-    bar_p_ =0;
+  bar_req_l_ = 0;
+  bar_p_ =0;
 }
 
 
index e824462a761c7a16ca0fba9bfe909a01b03ad4db..4a468119c7960e816c47670a33ec1a6ed5cf75d1 100644 (file)
@@ -15,8 +15,8 @@
 
 Bar_number_grav::Bar_number_grav()
 {
-    number_i_ =1;
-    script_p_ =0;
+  number_i_ =1;
+  script_p_ =0;
 }
 
 static Command_script_req dummy;
@@ -24,8 +24,9 @@ static Command_script_req dummy;
 void
 Bar_number_grav::acknowledge_element (Score_elem_info i)
 {
-    if (i.origin_grav_l_arr_.size() == 1 &&
-       i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) {
+  if (i.origin_grav_l_arr_.size() == 1 &&
+       i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) 
+         {
 
        script_p_ = new Script;
        Text_def *td_p =new Text_def;
@@ -41,7 +42,8 @@ Bar_number_grav::acknowledge_element (Score_elem_info i)
 void
 Bar_number_grav::do_pre_move_processing()
 {
-    if ( script_p_) {
+  if ( script_p_) 
+    {
        typeset_element (script_p_);
        script_p_ =0;
     }
index 2f4b47b3b5faa7ea88d1844bc572913dbdc504e1..7dc97c7c59787885016533994bb7d5f4c079f8bd 100644 (file)
@@ -15,9 +15,9 @@
 
 Bar::Bar()
 {
-    breakable_b_ = true;
-    type_str_ = "|";
-    spanned_i_ = 0;
+  breakable_b_ = true;
+  type_str_ = "|";
+  spanned_i_ = 0;
 }
 
 
@@ -27,17 +27,17 @@ IMPLEMENT_IS_TYPE_B1(Bar,Item);
 void
 Bar::do_print()const
 {
-    DOUT << type_str_;
+  DOUT << type_str_;
 }
 
 Molecule*
 Bar::brew_molecule_p()const
 {    
-    Paper_def *p = paper();
-    Symbol s = p->lookup_l()->bar (type_str_, 
+  Paper_def *p = paper();
+  Symbol s = p->lookup_l()->bar (type_str_, 
                                   p->get_var ("bar_size"));
-    Molecule*output = new Molecule (Atom (s));
-    return output;
+  Molecule*output = new Molecule (Atom (s));
+  return output;
 }
 
 /**
@@ -45,27 +45,28 @@ Bar::brew_molecule_p()const
   TODO: parametrise this (input-settable)
  */
 static char const *bar_breaks[][3] ={
-    {":|", ":|:", "|:"},
-    {"|", "|", ""},
-    {"", "|:", "|:"},
-    {"||.", "||.", ""},
-    {":|", ":|", ""},
-    {0,0,0}
+  {":|", ":|:", "|:"},
+  {"|", "|", ""},
+  {"", "|:", "|:"},
+  {"||.", "||.", ""},
+  {":|", ":|", ""},
+  {0,0,0}
 };
 
 void
 Bar::do_pre_processing()
 {
-    for (int i=0; bar_breaks[i][0]; i++) {
+  for (int i=0; bar_breaks[i][0]; i++) 
+    {
        if (bar_breaks[i][1] == type_str_)
            type_str_ = bar_breaks[i][break_status_i()+1];
     }
   
-    /*
-      span_score_bar needs dims, so don't do
+  /*
+    span_score_bar needs dims, so don't do
+  
+    transparent_b_ = empty_b_ = (type_str_ == "");
     
-      transparent_b_ = empty_b_ = (type_str_ == "");
-      
-      */
+    */
 }
-    
+  
index 1f595cddb62b234427921a540ac189de44c2da34..70a1ce88d0ee69d130d2ead7fa137d8d33d6e1dc 100644 (file)
 
 
 struct Stem_info {
-    Real x;
-    int dir_i_;
-    Real idealy_f_;
-    Real miny_f_;
-    int beams_i_;
-
-    Stem_info(){}
-    Stem_info (Stem const *);
+  Real x;
+  int dir_i_;
+  Real idealy_f_;
+  Real miny_f_;
+  int beams_i_;
+
+  Stem_info(){}
+  Stem_info (Stem const *);
 };
 
 Stem_info::Stem_info (Stem const *s)
 {
-    x = s->hpos_f();
-    dir_i_ = s->dir_i_;
-    beams_i_ = intlog2( s->flag_i_) - 2;
+  x = s->hpos_f();
+  dir_i_ = s->dir_i_;
+  beams_i_ = intlog2( s->flag_i_) - 2;
 
-    /*
-     [todo] 
-         * get algorithm
+  /*
+   [todo] 
+       * get algorithm
         * runtime
 
-     Breitkopf + H\"artel:
-         miny_f_ = interline + #beams * interbeam
+   Breitkopf + H\"artel:
+       miny_f_ = interline + #beams * interbeam
         ideal8 = 2 * interline + interbeam
         ideal16,32,64,128 = 1.5 * interline + #beams * interbeam
 
-     * B\"arenreiter:
-         miny_f_ = interline + #beams * interbeam
+   * B\"arenreiter:
+       miny_f_ = interline + #beams * interbeam
         ideal8,16 = 2 interline + #beams * interbeam
         ideal32,64,128 = 1.5 interline + #beams * interbeam
-         
-     */
+       
+   */
 
-    Real notehead_y = s->paper()->interline_f ();
-    // huh? why do i need the / 2
+  Real notehead_y = s->paper()->interline_f ();
+  // huh? why do i need the / 2
 //    Real interbeam_f = s->paper()->interbeam_f ();
-    Real interbeam_f = s->paper()->interbeam_f () / 2;
-           
-    /* well eh, huh?
-    idealy_f_  = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; 
-    if ( beams_i_ < 3)
+  Real interbeam_f = s->paper()->interbeam_f () / 2;
+         
+  /* well eh, huh?
+  idealy_f_  = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; 
+  if ( beams_i_ < 3)
        idealy_f_ += 2 * interline_f;
-    else
+  else
        idealy_f_ += 1.5 * interline_f;
-    */
+  */
 
-    idealy_f_  = dir_i_ * s->stem_end_f();
+  idealy_f_  = dir_i_ * s->stem_end_f();
 
-    miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
+  miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f;
 
-    idealy_f_ =  miny_f_ >? idealy_f_;
+  idealy_f_ =  miny_f_ >? idealy_f_;
 //    assert (miny_f_ <= idealy_f_);
 }
 
@@ -92,54 +92,58 @@ Stem_info::Stem_info (Stem const *s)
 Offset
 Beam::center()const
 {
-    Real w=(paper()->note_width () + width ().length ())/2.0;
-    return Offset (w, (left_pos + w* slope)*paper()->internote_f ());
+  Real w=(paper()->note_width () + width ().length ())/2.0;
+  return Offset (w, (left_pos + w* slope)*paper()->internote_f ());
 }
 
 
 Beam::Beam()
 {
-    slope = 0;
-    left_pos = 0.0;
+  slope = 0;
+  left_pos = 0.0;
 }
 
 void
 Beam::add (Stem*s)
 {
-    stems.push (s);
-    s->add_dependency (this);
-    s->print_flag_b_ = false;
+  stems.push (s);
+  s->add_dependency (this);
+  s->print_flag_b_ = false;
 }
 
 void
 Beam::set_default_dir()
 {
-    int up = 0, down = 0;
-    int up_count = 0, down_count = 0;
+  int up = 0, down = 0;
+  int up_count = 0, down_count = 0;
 
-    for (int i=0; i <stems.size(); i++) {
+  for (int i=0; i <stems.size(); i++) 
+    {
        Stem *sl = stems[i];
        int cur_down = sl->get_center_distance_from_top();
        int cur_up = sl->get_center_distance_from_bottom();
-       if (cur_down) {
+       if (cur_down) 
+         {
            down += cur_down;
            down_count++;
-       }
-       if (cur_up) {
+         }
+       if (cur_up) 
+         {
            up += cur_up;
            up_count++;
-       }
+         }
     }
-    if (!down)
+  if (!down)
        down_count = 1;
-    if (!up)
+  if (!up)
        up_count = 1;
 
-    // the following relation is equal to
-    //        up / up_count > down / down_count
-    dir_i_ = (up * down_count > down * up_count) ? 1 : -1;
+  // the following relation is equal to
+  //        up / up_count > down / down_count
+  dir_i_ = (up * down_count > down * up_count) ? 1 : -1;
 
-   for (int i=0; i <stems.size(); i++) {
+   for (int i=0; i <stems.size(); i++) 
+   {
        Stem *sl = stems[i];
        sl->dir_i_ = dir_i_;
    }
@@ -156,8 +160,9 @@ Beam::set_default_dir()
 void
 Beam::solve_slope()
 {
-    Array<Stem_info> sinfo;
-    for (int j=0; j <stems.size(); j++) {
+  Array<Stem_info> sinfo;
+  for (int j=0; j <stems.size(); j++) 
+    {
        Stem *i = stems[j];
 
        i->set_default_extents();
@@ -167,53 +172,59 @@ Beam::solve_slope()
        Stem_info info (i);
        sinfo.push (info);
     }
-    if (! sinfo.size())
+  if (! sinfo.size())
        slope = left_pos = 0;
-    else if (sinfo.size() == 1) {
+  else if (sinfo.size() == 1) 
+    {
        slope = 0;
        left_pos = sinfo[0].idealy_f_;
-    } else {
+    }
+  else 
+    {
        
        Real leftx = sinfo[0].x;
        Least_squares l;
-       for (int i=0; i < sinfo.size(); i++) {
+       for (int i=0; i < sinfo.size(); i++) 
+         {
            sinfo[i].x -= leftx;
            l.input.push (Offset (sinfo[i].x, sinfo[i].idealy_f_));
-       }
+         }
 
        l.minimise (slope, left_pos);
     }
-    
-    Real dy = 0.0;
-    for (int i=0; i < sinfo.size(); i++) {
+  
+  Real dy = 0.0;
+  for (int i=0; i < sinfo.size(); i++) 
+    {
        Real y = sinfo[i].x * slope + left_pos;
        Real my = sinfo[i].miny_f_;
 
        if (my - y > dy)
            dy = my -y; 
     }
-    left_pos += dy;
-    left_pos *= dir_i_;    
+  left_pos += dy;
+  left_pos *= dir_i_;    
 
-    slope *= dir_i_;
+  slope *= dir_i_;
 
-    /*
-      This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds
-      with some tables in [Wanske]
-     */
-    slope = 0.6 * tanh (slope);  
+  /*
+    This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds
+    with some tables in [Wanske]
+   */
+  slope = 0.6 * tanh (slope);  
 
                                // ugh
-    Real sl = slope*paper()->internote_f ();
-    paper()->lookup_l ()->beam (sl, 20 PT);
-    slope = sl /paper()->internote_f ();
+  Real sl = slope*paper()->internote_f ();
+  paper()->lookup_l ()->beam (sl, 20 PT);
+  slope = sl /paper()->internote_f ();
 }
 
 void
 Beam::set_stemlens()
 {
-    Real x0 = stems[0]->hpos_f();    
-    for (int j=0; j <stems.size(); j++) {
+  Real x0 = stems[0]->hpos_f();    
+  for (int j=0; j <stems.size(); j++) 
+    {
        Stem *s = stems[j];
 
        Real x =  s->hpos_f()-x0;
@@ -225,34 +236,36 @@ Beam::set_stemlens()
 void
 Beam::do_post_processing()
 {
-    if ( stems.size() < 2) {
+  if ( stems.size() < 2) 
+    {
        warning ("Beam with less than 2 stems");
        transparent_b_ = true;
        return ;
     }
-    solve_slope();    
-    set_stemlens();
+  solve_slope();    
+  set_stemlens();
 }
 
 void
 Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur)
 {
-    def.OK();
-    cur.OK();
-    assert (cur.children.size() == stems.size ());
-    
-    cur.split (def);
+  def.OK();
+  cur.OK();
+  assert (cur.children.size() == stems.size ());
+  
+  cur.split (def);
 
-    Array<int> b;
-    {
+  Array<int> b;
+  {
        Array<int> flags;
-       for (int j=0; j <stems.size(); j++) {
+       for (int j=0; j <stems.size(); j++) 
+         {
            Stem *s = stems[j];
 
            int f = intlog2(abs (s->flag_i_))-2;
            assert (f>0);
            flags.push (f);
-       }
+         }
        int fi =0;
        b= cur.generate_beams (flags, fi);
        b.insert (0,0);
@@ -260,7 +273,8 @@ Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur)
        assert (stems.size() == b.size ()/2);
     }
 
-    for (int j=0, i=0; i < b.size() && j <stems.size (); i+= 2, j++) {
+  for (int j=0, i=0; i < b.size() && j <stems.size (); i+= 2, j++) 
+    {
        Stem *s = stems[j];
        s->beams_left_i_ = b[i];
        s->beams_right_i_ = b[i+1];
@@ -270,7 +284,7 @@ Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur)
 void
 Beam::do_pre_processing()
 {
-    if (!dir_i_)
+  if (!dir_i_)
        set_default_dir();
 
 }
@@ -279,7 +293,7 @@ Beam::do_pre_processing()
 Interval
 Beam::do_width() const
 {
-    return Interval (stems[0]->hpos_f(),
+  return Interval (stems[0]->hpos_f(),
                     stems.top()->hpos_f ());
 }
 
@@ -289,19 +303,20 @@ Beam::do_width() const
 Molecule
 Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const
 {
-    assert (!next || next->hpos_f() > here->hpos_f () );
-    assert (!prev || prev->hpos_f() < here->hpos_f () );
+  assert (!next || next->hpos_f() > here->hpos_f () );
+  assert (!prev || prev->hpos_f() < here->hpos_f () );
 //    Real dy=paper()->internote_f ()*2;
-    Real dy = paper()->interbeam_f ();
-    Real stemdx = paper()->rule_thickness ();
-    Real sl = slope*paper()->internote_f ();
-    paper()->lookup_l ()->beam (sl, 20 PT);
+  Real dy = paper()->interbeam_f ();
+  Real stemdx = paper()->rule_thickness ();
+  Real sl = slope*paper()->internote_f ();
+  paper()->lookup_l ()->beam (sl, 20 PT);
 
-    Molecule leftbeams;
-    Molecule rightbeams;
+  Molecule leftbeams;
+  Molecule rightbeams;
 
-    /* half beams extending to the left. */
-    if (prev) {
+  /* half beams extending to the left. */
+  if (prev) 
+    {
        int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ;
        int lwholebeams= here->beams_left_i_ <? prev->beams_right_i_ ;
        Real w = (here->hpos_f() - prev->hpos_f ())/4;
@@ -310,14 +325,16 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const
        if (lhalfs)             // generates warnings if not
            a =  paper()->lookup_l ()->beam (sl, w);
        a.translate (Offset (-w, -w * sl));
-       for (int j = 0; j  < lhalfs; j++) {
+       for (int j = 0; j  < lhalfs; j++) 
+         {
            Atom b (a);
            b.translate (-dir_i_ * dy * (lwholebeams+j), Y_AXIS);
            leftbeams.add (b);
-       }
+         }
     }
        
-    if (next){
+  if (next)
+    {
        int rhalfs = here->beams_right_i_ - next->beams_left_i_;
        int rwholebeams = here->beams_right_i_ <? next->beams_left_i_; 
 
@@ -325,25 +342,27 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const
        Atom a = paper()->lookup_l ()->beam (sl, w + stemdx);
        
        int j = 0;
-       for (; j  < rwholebeams; j++) {
+       for (; j  < rwholebeams; j++) 
+         {
            Atom b (a);
            b.translate (-dir_i_ * dy * j, Y_AXIS);
            rightbeams.add (b); 
-       }
+         }
 
        w /= 4;
        if (rhalfs)
            a = paper()->lookup_l ()->beam (sl, w);
        
-       for (; j  < rwholebeams + rhalfs; j++) {
+       for (; j  < rwholebeams + rhalfs; j++) 
+         {
            Atom b (a);
            b.translate (-dir_i_ * dy * j, Y_AXIS);
            rightbeams.add (b); 
-       }
+         }
        
     }
-    leftbeams.add (rightbeams);
-    return leftbeams;
+  leftbeams.add (rightbeams);
+  return leftbeams;
 }
 
 
@@ -351,12 +370,13 @@ Molecule*
 Beam::brew_molecule_p() const 
 {
  
-    Molecule *mol_p = new Molecule;
-    // huh? inter-what
+  Molecule *mol_p = new Molecule;
+  // huh? inter-what
 //    Real inter_f = paper()->interbeam_f ();
-    Real inter_f = paper()->internote_f ();
-    Real x0 = stems[0]->hpos_f();
-    for (int j=0; j <stems.size(); j++) {
+  Real inter_f = paper()->internote_f ();
+  Real x0 = stems[0]->hpos_f();
+  for (int j=0; j <stems.size(); j++) 
+    {
        Stem *i = stems[j];
        Stem * prev = (j > 0)? stems[j-1] : 0;
        Stem * next = (j < stems.size()-1) ? stems[j+1] :0;
@@ -366,8 +386,8 @@ Beam::brew_molecule_p() const
        sb.translate (Offset (x, (x * slope  + left_pos)* inter_f));
        mol_p->add (sb);
     }
-    mol_p->translate (x0 - left_col_l_->hpos_f_, X_AXIS);
-    return mol_p;
+  mol_p->translate (x0 - left_col_l_->hpos_f_, X_AXIS);
+  return mol_p;
 }
 
 
@@ -377,15 +397,16 @@ void
 Beam::do_print()const
 {
 #ifndef NPRINT
-    DOUT << "slope " <<slope << "left ypos " << left_pos;
-    Spanner::do_print();
+  DOUT << "slope " <<slope << "left ypos " << left_pos;
+  Spanner::do_print();
 #endif
 }
 
 void
 Beam::do_substitute_dependent (Score_elem*o,Score_elem*n)
 {
-    if (o->is_type_b (Stem::static_name())) {
+  if (o->is_type_b (Stem::static_name())) 
+    {
        stems.substitute ((Stem*)o->item(),  n?(Stem*) n->item ():0);
     }
 }
index 728f9817a6aedba249c51aa86f15d47b9e02a6d5..1ef733c61a7705f2827b62702a0ec24f66bb5741 100644 (file)
 
 Bow::Bow()
 {
-    left_pos_i_ = right_pos_i_ = 0;
-    left_dx_f_ = right_dx_f_ = 0.0;
+  left_pos_i_ = right_pos_i_ = 0;
+  left_dx_f_ = right_dx_f_ = 0.0;
 }
 
 
 Offset
 Bow::center() const
 {
-    int dy =  right_pos_i_-left_pos_i_;
+  int dy =  right_pos_i_-left_pos_i_;
 
-    Real w = width().length ();
+  Real w = width().length ();
 
-    return Offset (w/2,dy * paper()->internote_f ());
+  return Offset (w/2,dy * paper()->internote_f ());
 }
 
 
 Molecule*
 Bow::brew_molecule_p() const
 {
-    Molecule*output = new Molecule;
-    Real w = width().length ();
-    
-    int dy = right_pos_i_ - left_pos_i_;
-    
-    Real nw_f = paper()->note_width ();
-    Real nh_f = paper()->internote_f ();
-
-    
-    w+= (right_dx_f_ - left_dx_f_) * nw_f ;
-    Real round_w = w;          // slur lookup rounds the slurwidth .
-    
-    Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_i_);
-
-    Real error = w-round_w;
-    
-    Atom a (sl);
-    a.translate (Offset ((left_dx_f_ + 0.5)*nw_f + error/2,
+  Molecule*output = new Molecule;
+  Real w = width().length ();
+  
+  int dy = right_pos_i_ - left_pos_i_;
+  
+  Real nw_f = paper()->note_width ();
+  Real nh_f = paper()->internote_f ();
+
+  
+  w+= (right_dx_f_ - left_dx_f_) * nw_f ;
+  Real round_w = w;            // slur lookup rounds the slurwidth .
+  
+  Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_i_);
+
+  Real error = w-round_w;
+  
+  Atom a (sl);
+  a.translate (Offset ((left_dx_f_ + 0.5)*nw_f + error/2,
                       left_pos_i_ * nh_f));
-    output->add (a);
-    return output;
+  output->add (a);
+  return output;
 }
 
 
index 756ce877571789d15049b313495f1dbad43b9552..4a219a4864cbac2e299372ec8df701dee2fc630d 100644 (file)
@@ -8,7 +8,7 @@ Box::Box()
 
 Box::Box (Interval ix, Interval iy)
 {
-    x() = ix;
-    y() = iy;
+  x() = ix;
+  y() = iy;
 }
 
index d3c9e5df79ee8e567de1f2980b6a88414c4cc2a9..b2ffbaee602c5aa897184f35325e2cb507217d7c 100644 (file)
@@ -12,8 +12,8 @@ void
 Break_align_item::do_pre_processing()
 {
 
-    align_i_ = break_status_i();
-    Horizontal_align_item::do_pre_processing();
+  align_i_ = break_status_i();
+  Horizontal_align_item::do_pre_processing();
 }
 
 IMPLEMENT_IS_TYPE_B1(Break_align_item, Horizontal_align_item);
index 2fb1935dfef8d6200af9179dc0d65566677ca1e0..3ebba2eb63646998e01843dd91240ae3ab2cd148 100644 (file)
 
 String
 Col_stats::str() const { 
-    String s (count_i_);
-    s += " lines";
-    if  (count_i_)
+  String s (count_i_);
+  s += " lines";
+  if  (count_i_)
        s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)");
-    
-    return s;
+  
+  return s;
 }
 
 void
 Col_stats::add (Line_of_cols const& line)
 {
-    count_i_++;
-    cols_i_ += line.size();
+  count_i_++;
+  cols_i_ += line.size();
 }
 
 
 Col_stats::Col_stats()
 {
-    count_i_ =0;
-    cols_i_ =0;
+  count_i_ =0;
+  cols_i_ =0;
 }
 
 /* **************************************************************** */
@@ -44,49 +44,50 @@ Col_stats::Col_stats()
 Line_of_cols
 Break_algorithm::all_cols()const
 {
-    Line_of_cols retval;
-    for (PCursor<PCol*> c (pscore_l_->col_p_list_.top()); 
-        c.ok(); c++) {
+  Line_of_cols retval;
+  for (PCursor<PCol*> c (pscore_l_->col_p_list_.top()); 
+        c.ok(); c++) 
+          {
        
        retval.push (c);
     }
-    return retval;
+  return retval;
 }
 
 Array<int> 
 Break_algorithm::find_break_indices() const
 {
-    Line_of_cols all (all_cols());
-    Array<int> retval;
-    
-    for (int i=0; i < all.size(); i++)
+  Line_of_cols all (all_cols());
+  Array<int> retval;
+  
+  for (int i=0; i < all.size(); i++)
        if (all[i]->breakable_b())
            retval.push (i);
-    
-    if ( linelength <=0)
+  
+  if ( linelength <=0)
        while ( retval.size() >2)
            retval.del (1);
 
-    return retval;
+  return retval;
 }
 
 ///  return all breakable columns
 Line_of_cols
 Break_algorithm::find_breaks() const
 {
-    Line_of_cols all (all_cols());
-    Line_of_cols retval;
-    
-    for (int i=0; i < all.size(); i++)
+  Line_of_cols all (all_cols());
+  Line_of_cols retval;
+  
+  for (int i=0; i < all.size(); i++)
        if (all[i]->breakable_b())
            retval.push (all[i]);
 
 
-    if ( linelength <=0)
+  if ( linelength <=0)
        while ( retval.size() >2)
            retval.del (1);
 
-    return retval;
+  return retval;
 }
 
 
@@ -96,86 +97,86 @@ Break_algorithm::find_breaks() const
 Line_spacer*
 Break_algorithm::generate_spacing_problem (Line_of_cols curline)const
 {
-    Line_spacer * sp= (*get_line_spacer)();
+  Line_spacer * sp= (*get_line_spacer)();
 
-    sp->paper_l_ = pscore_l_->paper_l_;
-    sp->add_column (curline[0], true, 0.0);
-    for (int i=1; i< curline.size()-1; i++)
+  sp->paper_l_ = pscore_l_->paper_l_;
+  sp->add_column (curline[0], true, 0.0);
+  for (int i=1; i< curline.size()-1; i++)
        sp->add_column (curline[i]);
 
-    if ( linelength > 0)
+  if ( linelength > 0)
        sp->add_column (curline.top(), true, linelength);
-    else
+  else
        sp->add_column (curline.top());
 
-    sp->prepare();
-    return sp;
+  sp->prepare();
+  return sp;
 }
 
 Break_algorithm::Break_algorithm()
 {
-    pscore_l_ = 0;
-    get_line_spacer =0;
-    linelength = 0;
+  pscore_l_ = 0;
+  get_line_spacer =0;
+  linelength = 0;
 }
 
 void
 Break_algorithm::set_pscore (Paper_score*s)
 {
-    pscore_l_ = s;
-    linelength = s->paper_l_->linewidth_f();
-    do_set_pscore();
+  pscore_l_ = s;
+  linelength = s->paper_l_->linewidth_f();
+  do_set_pscore();
 }
 
 bool
 Break_algorithm::feasible (Line_of_cols curline) const
 {
-    if (linelength <=  0)
+  if (linelength <=  0)
        return true;
-    
-    Real l =0;
-    for (int i=0; i < curline.size(); i++)
+  
+  Real l =0;
+  for (int i=0; i < curline.size(); i++)
        l +=curline[i]->width().length ();
-    return l < linelength;    
+  return l < linelength;    
 }
 
 void
 Break_algorithm::problem_OK() const
 {
-    if (!pscore_l_->col_p_list_.size())
+  if (!pscore_l_->col_p_list_.size())
        error ("Score does not have any columns");
-    OK();
+  OK();
 }
 
 void
 Break_algorithm::OK()const
 {
 #ifndef NDEBUG
-    iter_top (pscore_l_->col_p_list_,start);
-    PCursor<PCol *> end (pscore_l_->col_p_list_.bottom());
-    
-    assert (start->breakable_b());    
-    assert (end->breakable_b());
+  iter_top (pscore_l_->col_p_list_,start);
+  PCursor<PCol *> end (pscore_l_->col_p_list_.bottom());
+  
+  assert (start->breakable_b());    
+  assert (end->breakable_b());
 #endif
 }
 
 Array<Col_hpositions>
 Break_algorithm::solve()const
 {
-    return do_solve();
+  return do_solve();
 }
 
 void
 Break_algorithm::do_set_pscore()
 {
-    
+  
 }
 
 void
 Break_algorithm::print_stats()const
 {
-    if (approx_stats_.count_i_)
+  if (approx_stats_.count_i_)
        *mlog << "\nApproximated: " << approx_stats_.str() << "\n";
-    if (exact_stats_.count_i_)
+  if (exact_stats_.count_i_)
        *mlog << "Calculated exactly: " << exact_stats_.str() << "\n";
 }
index 93abaf29310042b6bfee0d6441f455d7d552fb4c..1afaa3cc4470eee7bfe993ffd06f3947f8f01a77 100644 (file)
 
 Clef_engraver::Clef_engraver()
 {
-    clef_p_ = 0;
-    clef_req_l_ =0;
-    
-    set_type ("violin");
+  clef_p_ = 0;
+  clef_req_l_ =0;
+  
+  set_type ("violin");
 }
 
 bool
 Clef_engraver::set_type (String s)
 {
-    clef_type_str_  = s;
-    if (clef_type_str_ == "violin") {
+  clef_type_str_  = s;
+  if (clef_type_str_ == "violin") 
+    {
        c0_position_i_= -2;
-    } else if (clef_type_str_ == "alto") {
+    }
+  else if (clef_type_str_ == "alto") 
+    {
        c0_position_i_= 4;
-    } else if (clef_type_str_ == "tenor") {
+    }
+  else if (clef_type_str_ == "tenor") 
+    {
        c0_position_i_= 6;
-    } else if (clef_type_str_ == "bass") {
+    }
+  else if (clef_type_str_ == "bass") 
+    {
        c0_position_i_= 10;
-    } else 
+    }
+  else 
        return false;
-    
-    return true;
+  
+  return true;
 }
 
 void
 Clef_engraver::fill_staff_info (Staff_info &i)
 {
-    i.c0_position_i_l_ = &c0_position_i_;
+  i.c0_position_i_l_ = &c0_position_i_;
 }
 
 void 
 Clef_engraver::read_req (Clef_change_req*c_l)
 {
-    if (!set_type (c_l->clef_str_))
+  if (!set_type (c_l->clef_str_))
        c_l->error ("unknown clef type ");
 }
 void
 Clef_engraver::acknowledge_element (Score_elem_info info)
 {
-    if (info.elem_l_->name() == Bar::static_name ()) {
+  if (info.elem_l_->name() == Bar::static_name ()) 
+    {
        create_clef();
        if ( !clef_req_l_)
            clef_p_->default_b_ = true;
@@ -65,37 +74,39 @@ Clef_engraver::acknowledge_element (Score_elem_info info)
 void
 Clef_engraver::do_creation_processing()
 {
-    create_clef();
-    clef_p_->default_b_ = false;
+  create_clef();
+  clef_p_->default_b_ = false;
 }
 
 bool
 Clef_engraver::do_try_request (Request * r_l)
 {
-    Command_req* creq_l= r_l->command();
-    if (!creq_l || !creq_l->clefchange())
+  Command_req* creq_l= r_l->command();
+  if (!creq_l || !creq_l->clefchange())
        return false;
 
-    clef_req_l_ = creq_l->clefchange();
-    
-    read_req (clef_req_l_); 
-    return true;
+  clef_req_l_ = creq_l->clefchange();
+  
+  read_req (clef_req_l_); 
+  return true;
 }
 
 void 
 Clef_engraver::create_clef()
 {
-    if (!clef_p_) {
+  if (!clef_p_) 
+    {
        clef_p_ = new Clef_item;
-        announce_element (Score_elem_info (clef_p_,clef_req_l_));
+      announce_element (Score_elem_info (clef_p_,clef_req_l_));
     }
-    clef_p_->read (*this);
+  clef_p_->read (*this);
 }
 
 void
 Clef_engraver::do_process_requests()
 {
-    if (clef_req_l_) {
+  if (clef_req_l_) 
+    {
        create_clef();
        clef_p_->default_b_ = false;
     }
@@ -104,23 +115,23 @@ Clef_engraver::do_process_requests()
 void
 Clef_engraver::do_pre_move_processing()
 {
-    if (!clef_p_)
+  if (!clef_p_)
        return;
-    typeset_element (clef_p_);
-    clef_p_ = 0;
+  typeset_element (clef_p_);
+  clef_p_ = 0;
 }
-    
+  
 void
 Clef_engraver::do_post_move_processing()
 {
-    clef_req_l_ = 0;
+  clef_req_l_ = 0;
 }
 
 void
 Clef_engraver::do_removal_processing()
 {
-    delete clef_p_;
-    clef_p_ =0;
+  delete clef_p_;
+  clef_p_ =0;
 }
 
 
index b1a9c4a66555d34bce99fd1f197400c5f59037b8..8a2534b111782dab90037a25b793821db102c259 100644 (file)
 void
 Clef_item::do_pre_processing()
 {
-    change_b_ = ! (break_status_i() == 1);
+  change_b_ = ! (break_status_i() == 1);
 
-    if (default_b_){
+  if (default_b_)
+    {
        empty_b_ = (break_status_i() != 1);
        transparent_b_ = (break_status_i() != 1);
     }
@@ -27,41 +28,41 @@ Clef_item::do_pre_processing()
 
 Clef_item::Clef_item()
 {
-    breakable_b_ =true;
-    default_b_ = false;
-    change_b_ = true;
-    read ("violin");
+  breakable_b_ =true;
+  default_b_ = false;
+  change_b_ = true;
+  read ("violin");
 }
 
 void
 Clef_item::read (String t)
 {
-    type_= t;
-    if (type_ == "violin")
+  type_= t;
+  if (type_ == "violin")
        y_off = 2;
-    if (type_ == "alto")
+  if (type_ == "alto")
        y_off = 4;
-    if (type_ == "tenor")
+  if (type_ == "tenor")
        y_off = 6;
-    if (type_ == "bass")
+  if (type_ == "bass")
        y_off = 6;
 }
 void
 Clef_item::read (Clef_engraver const &k)
 {
-    read (k.clef_type_str_);
+  read (k.clef_type_str_);
 }
 
 Molecule*
 Clef_item::brew_molecule_p()const
 {
-    String t = type_;
-    if  (change_b_)
+  String t = type_;
+  if  (change_b_)
        t += "_change";
-    Symbol s = paper()->lookup_l ()->clef (t);
-    Molecule*output = new Molecule (Atom (s));
-    output->translate (paper()->internote_f () * y_off, Y_AXIS);
-    return output;
+  Symbol s = paper()->lookup_l ()->clef (t);
+  Molecule*output = new Molecule (Atom (s));
+  output->translate (paper()->internote_f () * y_off, Y_AXIS);
+  return output;
 }
 
 
index deb2dee7308191acecace5d4a7cddfbb99fd9c61..e05498f0e15c489718c901b3c25d72ca4f33237d 100644 (file)
@@ -14,28 +14,28 @@ void
 Colinfo::print() const
 {
 #ifndef NPRINT
-    DOUT << "column { ";
-    if (fixed())
+  DOUT << "column { ";
+  if (fixed())
        DOUT << "fixed at " << fixed_position()<<", ";
-    assert (pcol_l_);
-    DOUT << "[" << minleft() << ", " << minright () << "]";
-    DOUT <<"}\n";
+  assert (pcol_l_);
+  DOUT << "[" << minleft() << ", " << minright () << "]";
+  DOUT <<"}\n";
 #endif
 }
 
 Colinfo::Colinfo (PCol *col_l, Real const *fixed_C)
 {
-    if (fixed_C)
+  if (fixed_C)
        fixpos_p_.set_l (fixed_C);
-    ugh_b_ = false;
-    pcol_l_ = col_l;
-    width = pcol_l_->width();
+  ugh_b_ = false;
+  pcol_l_ = col_l;
+  width = pcol_l_->width();
 }
 
 
 Colinfo::Colinfo()
 {
-    ugh_b_ = false;
-    pcol_l_ =0;
+  ugh_b_ = false;
+  pcol_l_ =0;
 }
 
index 23d42e65ff7dd3d24accbd40e4bbad4089abf0d9..d7850f5c27f1ccf0cf3f43587d20cfccf109dc22 100644 (file)
 
 Col_hpositions::Col_hpositions()
 {
-    energy_f_ = infinity_f;
-    ugh_b_ = false;
-    satisfies_constraints_b_ = false;
-    spacer_l_ =0;
+  energy_f_ = infinity_f;
+  ugh_b_ = false;
+  satisfies_constraints_b_ = false;
+  spacer_l_ =0;
 }
 
 Col_hpositions::~Col_hpositions()
@@ -28,17 +28,17 @@ Col_hpositions::~Col_hpositions()
 void
 Col_hpositions::add (PCol*c)
 {
-    cols.push (c);
+  cols.push (c);
 }
 
 void
 Col_hpositions::print() const
 {
 #ifndef NPRINT
-    DOUT << "energy : " << energy_f_ << '\n';
-    DOUT << "line of " << config.size() << " cols\n";
-    Vector v (config);
-    DOUT << v;
+  DOUT << "energy : " << energy_f_ << '\n';
+  DOUT << "line of " << config.size() << " cols\n";
+  Vector v (config);
+  DOUT << v;
 #endif
 }
 
@@ -46,29 +46,29 @@ void
 Col_hpositions::OK()const
 {
 #ifndef NDEBUG
-    assert (config.size() == cols.size ());
+  assert (config.size() == cols.size ());
 #endif
 }
 
 void
 Col_hpositions::stupid_solution()
 {
-    energy_f_ = infinity_f;
-    ugh_b_ = true;
-    config = spacer_l_->default_solution();
+  energy_f_ = infinity_f;
+  ugh_b_ = true;
+  config = spacer_l_->default_solution();
 }
 
 void
 Col_hpositions::solve_line() 
 {
-    spacer_l_->solve (this);
+  spacer_l_->solve (this);
 }
 
 
 void
 Col_hpositions::approximate_solve_line() 
 {
-    spacer_l_->lower_bound_solution (this);
+  spacer_l_->lower_bound_solution (this);
 }
 
 
index 600703bcd2daf5347232ddf5cd85d872d8275150..e25f24949388316b9db5f460c624072a96bfab7c 100644 (file)
 void
 Collision_engraver::acknowledge_element (Score_elem_info i)
 {
-    if (!(i.elem_l_->name() == Note_column::static_name ()))
+  if (!(i.elem_l_->name() == Note_column::static_name ()))
        return;
 
-    if (!col_p_) {
+  if (!col_p_) 
+    {
        col_p_ = new Collision;
        announce_element (Score_elem_info (col_p_,0));
     }
-    col_p_->add ((Note_column*)i.elem_l_->item());
+  col_p_->add ((Note_column*)i.elem_l_->item());
 }
 
 void
 Collision_engraver::do_pre_move_processing()
 {
-    if (col_p_) {
+  if (col_p_) 
+    {
        typeset_element (col_p_);
        col_p_ =0;
     }
 }
 Collision_engraver::Collision_engraver()
 {
-    col_p_ =0;
+  col_p_ =0;
 }
 
 
index 798c74be456131b13f0ccce229078b192759d6d2..a5fd6aee0b3df972fc52f7b131f98e5bc37a001c 100644 (file)
@@ -18,9 +18,9 @@ Collision::Collision()
 void
 Collision::add (Note_column* ncol_l)
 {
-    clash_l_arr_.push (ncol_l);
-    add_element (ncol_l);
-    add_dependency (ncol_l);
+  clash_l_arr_.push (ncol_l);
+  add_element (ncol_l);
+  add_dependency (ncol_l);
 }
 /**
   should derive of Array.
@@ -28,11 +28,11 @@ Collision::add (Note_column* ncol_l)
 static 
 int idx (int dir, bool h_shift_b)
 {
-    assert (abs (dir) == 1);
-    int j = dir > 0 ? 0 : 3;
-    if ( h_shift_b) 
+  assert (abs (dir) == 1);
+  int j = dir > 0 ? 0 : 3;
+  if ( h_shift_b) 
        j += dir;
-    return j;
+  return j;
 }
 
 /** This complicated routine moves note columns around horizontally
@@ -46,101 +46,114 @@ int idx (int dir, bool h_shift_b)
 void
 Collision::do_pre_processing()
 {
-    if (clash_l_arr_.size() <= 1)
+  if (clash_l_arr_.size() <= 1)
        return;
-    
-    /*
-      [stem up, stem up shifted, stem down shifted, stem down]
-     */
-    Array<Note_column*> clash_group_arr_a[4];
-    
-    for (int i=0; i < clash_l_arr_.size(); i++) {
+  
+  /*
+    [stem up, stem up shifted, stem down shifted, stem down]
+   */
+  Array<Note_column*> clash_group_arr_a[4];
+  
+  for (int i=0; i < clash_l_arr_.size(); i++) 
+    {
        Note_column* c_l = clash_l_arr_[i];
-       if (! c_l->dir_i_) {
+       if (! c_l->dir_i_) 
+         {
            warning ("No stem direction set. Ignoring column in clash. ");
            continue;
-       }
+         }
        int d = (c_l->dir_i_);
        
        clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l);
     }
-    
-    
-    for (int j=0; j < 4; j++) {
-       if (clash_group_arr_a[j].size() > 1) {
+  
+  
+  for (int j=0; j < 4; j++) 
+    {
+       if (clash_group_arr_a[j].size() > 1) 
+         {
            warning ("Too many clashing notecolumns. Ignoring them.");
            return;
-       }
+         }
     }
-    int d = 1;
-    do {
-       if (!clash_group_arr_a[idx (d, false)].size()){
+  int d = 1;
+  do 
+    {
+       if (!clash_group_arr_a[idx (d, false)].size())
+         {
            clash_group_arr_a[idx (d,  false)] = clash_group_arr_a[idx (d, true)];
            clash_group_arr_a[idx (d, true)].clear();
-       }
-    } while ((d *= -1) != 1);
+         }
+  } while ((d *= -1) != 1);
                                  
 
-    Interval_t<int> y_extent[4];
-    Note_column * col_l_a[4];
-    Real x_off [4];
-    int y_off[4];
-    
-    for (int j =0 ; j < 4; j++) {
+  Interval_t<int> y_extent[4];
+  Note_column * col_l_a[4];
+  Real x_off [4];
+  int y_off[4];
+  
+  for (int j =0 ; j < 4; j++) 
+    {
        if (clash_group_arr_a[j].size()) 
            col_l_a[j] = clash_group_arr_a[j][0];
        else
            col_l_a[j] = 0;
        
-       if (col_l_a[j]) {
+       if (col_l_a[j]) 
+         {
            y_extent[j] = col_l_a[j]->head_positions_interval();
-       }
+         }
 
 
        x_off [j] = 0.0;
        y_off[j] = 0;
     }
-    
-    do {
+  
+  do 
+    {
        x_off[idx (d, true)] = d*0.5;
-    } while ((d *= -1) != 1);
+  } while ((d *= -1) != 1);
 
   
-    // y_extent: smallest y-pos noteball interval containing all balls
-    // 4 (0..3) groups: stem up/down; shift on/off; 
-    Interval_t<int> middle (y_extent[idx (-1,0)].max(),
+  // y_extent: smallest y-pos noteball interval containing all balls
+  // 4 (0..3) groups: stem up/down; shift on/off; 
+  Interval_t<int> middle (y_extent[idx (-1,0)].max(),
                            y_extent[idx (1,0)].min());
-    Interval_t<int> open_middle (y_extent[idx (-1,0)].max()+1, y_extent[idx (1,0)].min ()-1);
-    do{
+  Interval_t<int> open_middle (y_extent[idx (-1,0)].max()+1, y_extent[idx (1,0)].min ()-1);
+  do
+    {
        if (!open_middle.contains_b (y_extent[idx (d,true)]))
            x_off[idx (d, true)] = d *1.0 ;
-    } while ((d *= -1) != 1);
+  } while ((d *= -1) != 1);
    
-    if (!middle.empty_b() 
+  if (!middle.empty_b() 
        && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) {  
 // reproduction of bugfix at 3am ?
        Note_head * nu_l= col_l_a[idx (1,0)]->head_l_arr_[0];
        Note_head * nd_l = col_l_a[idx (-1,0)]->head_l_arr_.top();
        if (! (nu_l->balltype_i_ == nd_l->balltype_i_ 
-              && nu_l->dots_i_ == nd_l->dots_i_  && middle.length() == 0)) {
+              && nu_l->dots_i_ == nd_l->dots_i_  && middle.length() == 0)) 
+                {
            x_off[idx (1,0)] -= 0.5;
            x_off[idx (1,1)] -= 0.5;
            x_off[idx (-1,1)] += 0.5;
            x_off[idx (-1,0)] += 0.5;
-       }
+         }
        
-    }    
-    Real inter_f = paper()->internote_f ();
-    Real wid_f = paper()->note_width ();
-    for (int j=0; j < 4; j++) {
-       if (col_l_a[j]) {
+    }
+  Real inter_f = paper()->internote_f ();
+  Real wid_f = paper()->note_width ();
+  for (int j=0; j < 4; j++) 
+    {
+       if (col_l_a[j]) 
+         {
            /* collision.cc:138: request for method `translate' is ambiguous 
               
               (shaddup)
             */
            Offset o (x_off[j] * wid_f, y_off[j] * inter_f);
            ((Score_elem*)col_l_a[j])->translate (o);
-       }
+         }
     }
 }
 
@@ -150,6 +163,6 @@ IMPLEMENT_IS_TYPE_B1(Collision, Item);
 void
 Collision::do_substitute_dependency (Score_elem*o_l,Score_elem*n_l)
 {
-    clash_l_arr_.substitute ((Note_column*)o_l->item(), 
+  clash_l_arr_.substitute ((Note_column*)o_l->item(), 
                            (Note_column*)(n_l?n_l->item():0));
 }
index 1c77d60f0f80d16cc04cc213833e0562045c14fd..051ce84465731951952cc2894cf32f607ec4158c 100644 (file)
@@ -24,21 +24,21 @@ void
 Cadenza_req::do_print()const
 {
 #ifndef NPRINT
-    DOUT << on_b_;
+  DOUT << on_b_;
 #endif
 }
 
 bool
 Cadenza_req::do_equal_b (Request*r)const
 {
-    Cadenza_req*cad =  r->command()->timing ()->cadenza ();
-    
-    return cad->on_b_ == on_b_;
+  Cadenza_req*cad =  r->command()->timing ()->cadenza ();
+  
+  return cad->on_b_ == on_b_;
 }
 
 Cadenza_req::Cadenza_req (bool b)
 {
-    on_b_ =b;
+  on_b_ =b;
 }
 /* *************** */
 
@@ -46,8 +46,8 @@ Cadenza_req::Cadenza_req (bool b)
 bool
 Bar_req::do_equal_b (Request*r)const
 {
-    Bar_req * b = r->command()->bar ();
-    return type_str_ == b->type_str_;
+  Bar_req * b = r->command()->bar ();
+  return type_str_ == b->type_str_;
 }
 
 
@@ -56,25 +56,25 @@ IMPLEMENT_IS_TYPE_B1(Bar_req,Command_req);
 void
 Bar_req::do_print() const
 {
-    DOUT << type_str_;
+  DOUT << type_str_;
 }
 
 Bar_req::Bar_req (String s)
 {
-    type_str_ = s;
+  type_str_ = s;
 }
 
 Partial_measure_req::Partial_measure_req (Moment m)
 {
-    duration_ =m;
+  duration_ =m;
 }
 
 bool
 Partial_measure_req::do_equal_b (Request* r)const
 {
-    Partial_measure_req *p = r->command()->timing ()->partial ();
+  Partial_measure_req *p = r->command()->timing ()->partial ();
 
-    return p->duration_ == duration_;
+  return p->duration_ == duration_;
 }
 
 
@@ -105,7 +105,7 @@ Barcheck_req::do_print() const{}
 bool
 Barcheck_req::do_equal_b (Request*)const
 {
-    return true;
+  return true;
 }
 /* *************** */
 
@@ -115,13 +115,13 @@ void
 Clef_change_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << clef_str_ ;
+  DOUT << clef_str_ ;
 #endif
 }
 
 Clef_change_req::Clef_change_req (String s)
 {
-    clef_str_ = s;
+  clef_str_ = s;
 }
 /* *************** */
 
@@ -131,7 +131,7 @@ void
 Group_feature_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << type_str_ << "=" << value_str_;
+  DOUT << type_str_ << "=" << value_str_;
 #endif
 }
 
@@ -143,7 +143,7 @@ IMPLEMENT_IS_TYPE_B1(Partial_measure_req,Timing_req);
 void
 Partial_measure_req::do_print() const
 {
-    DOUT << duration_;
+  DOUT << duration_;
 }
 
 
@@ -153,52 +153,52 @@ void
 Meter_change_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << beats_i_ << "/" << one_beat_i_;
+  DOUT << beats_i_ << "/" << one_beat_i_;
 #endif
 }
 
 bool
 Meter_change_req::do_equal_b (Request * r)const
 {
-    Meter_change_req * m = r->command()->timing ()->meterchange ();
-    
-    return m->beats_i_ == beats_i_ 
+  Meter_change_req * m = r->command()->timing ()->meterchange ();
+  
+  return m->beats_i_ == beats_i_ 
        && one_beat_i_ == m->one_beat_i_;
 }
 
 Meter_change_req::Meter_change_req()
 {
-    beats_i_ = 0;
-    one_beat_i_ =0;
+  beats_i_ = 0;
+  one_beat_i_ =0;
 }
 
 void
 Meter_change_req::set (int b,int o)
 {
-    beats_i_=b;
-    one_beat_i_=o;
+  beats_i_=b;
+  one_beat_i_=o;
 }
 
 
 Tempo_req::Tempo_req()
 {
-    metronome_i_ = 60;
-    dur_. type_i_ = 4;
+  metronome_i_ = 60;
+  dur_. durlog_i_ = 2;
 }
 
 void
 Tempo_req::do_print()const
 {
-    DOUT << dur_.str() << " = " <<metronome_i_ ;
+  DOUT << dur_.str() << " = " <<metronome_i_ ;
 }
 IMPLEMENT_IS_TYPE_B1(Tempo_req, Timing_req);
 
 bool
 Tempo_req::do_equal_b (Request *r)const
 {
-    Tempo_req *t = r->command()->timing ()->tempo ();
-    
-    return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
+  Tempo_req *t = r->command()->timing ()->tempo ();
+  
+  return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
 }
 
 /* *************** */
@@ -209,7 +209,8 @@ IMPLEMENT_IS_TYPE_B1(Measure_grouping_req,Timing_req);
 void
 Measure_grouping_req::do_print() const
 {
-    for (int i=0; i < elt_length_arr_.size(); i++) {
+  for (int i=0; i < elt_length_arr_.size(); i++) 
+    {
        DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
     }
 }
@@ -218,7 +219,7 @@ Measure_grouping_req::do_print() const
 bool 
 Measure_grouping_req::do_equal_b (Request*)const
 {
-    return false;              // todo
+  return false;                // todo
 }
 
 /* *************** */
@@ -226,8 +227,9 @@ Measure_grouping_req::do_equal_b (Request*)const
 void
 Key_change_req::transpose (Melodic_req const & d)const
 {
-    WARN << "don't know how to transpose a key. \n";
-    for (int i=0; i < melodic_p_arr_.size(); i++) {
+  WARN << "don't know how to transpose a key. \n";
+  for (int i=0; i < melodic_p_arr_.size(); i++) 
+    {
        melodic_p_arr_[i]->transpose (d);
     }
 }
@@ -237,7 +239,8 @@ IMPLEMENT_IS_TYPE_B1(Key_change_req,Command_req);
 void
 Key_change_req::squash_octaves()
 {
-    for (int i=0; i < melodic_p_arr_.size(); i++) {
+  for (int i=0; i < melodic_p_arr_.size(); i++) 
+    {
        melodic_p_arr_[i]->octave_i_ = 0;
     }
 }
@@ -246,7 +249,8 @@ void
 Key_change_req::do_print() const
 {
 #ifndef NPRINT
-    for (int i=0; i < melodic_p_arr_.size(); i++) {
+  for (int i=0; i < melodic_p_arr_.size(); i++) 
+    {
        melodic_p_arr_[i]->print();
     }
 #endif
@@ -276,12 +280,13 @@ int
 Key_change_req::flats_i()
 {
        int flats_i = 0;
-       for ( int i = 0; i < melodic_p_arr_.size(); i++) {
+       for ( int i = 0; i < melodic_p_arr_.size(); i++) 
+         {
                Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
                assert (mel_l);
                if ( mel_l->accidental_i_ < 0)
                        flats_i -= mel_l->accidental_i_;
-       }
+         }
        return flats_i;
 }
 
@@ -295,12 +300,13 @@ int
 Key_change_req::sharps_i()
 {
        int sharps_i = 0;
-       for ( int i = 0; i < melodic_p_arr_.size(); i++) {
+       for ( int i = 0; i < melodic_p_arr_.size(); i++) 
+         {
                Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
                assert (mel_l);
                if ( mel_l->accidental_i_ > 0)
                        sharps_i+= mel_l->accidental_i_;
-       }
+         }
        return sharps_i;
 }
 
index 574b91c9ffd88849ebaa3e74eaecb897892e56be..d5c16cb442e5e607fbdbe9d2b0ac81e99429b5ee 100644 (file)
 
 Crescendo::Crescendo()
 {
-    grow_dir_i_ =0;
-    dir_i_ = -1 ;
-    left_dyn_b_ = right_dyn_b_ =false;
-    inside_staff_b_ = false;
+  grow_dir_i_ =0;
+  dir_i_ = -1 ;
+  left_dyn_b_ = right_dyn_b_ =false;
+  inside_staff_b_ = false;
 }
 
 Interval
 Crescendo::symbol_height()const
 {
-    return get_symbol().dim[Y_AXIS];
+  return get_symbol().dim[Y_AXIS];
 }
 
 static Real absdyn_dim = 10 PT;        // ugh
@@ -32,35 +32,38 @@ static Real absdyn_dim = 10 PT;     // ugh
 Symbol
 Crescendo::get_symbol()const
 {    
-    Real w_dim = width().length ();
-    if ( left_dyn_b_) {
+  Real w_dim = width().length ();
+  if ( left_dyn_b_) 
+    {
        w_dim -= absdyn_dim;
     }
-    if ( right_dyn_b_) {
+  if ( right_dyn_b_) 
+    {
        w_dim -= absdyn_dim;
     }
-    
-    if (w_dim < 0) {
+  
+  if (w_dim < 0) 
+    {
        warning ("Crescendo too small");
        w_dim = 0;
     }
 
-    return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0));
+  return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0));
 }
 
 Molecule*
 Crescendo::brew_molecule_p() const
 {
-    Molecule* m_p =0;
-    Real x_off_dim=0.0;
-    if ( left_dyn_b_)
+  Molecule* m_p =0;
+  Real x_off_dim=0.0;
+  if ( left_dyn_b_)
        x_off_dim += absdyn_dim;
-    
-    m_p = new Molecule;
-    Symbol s (get_symbol());
-    m_p->add (Atom (s));
-    m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ()));
-    return m_p;
+  
+  m_p = new Molecule;
+  Symbol s (get_symbol());
+  m_p->add (Atom (s));
+  m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ()));
+  return m_p;
 }
 
 
index 964353f34861babed84159cfff7d32ed1c1f7660..2141be63a461435f1550ee6c9ec392e5142523fb 100644 (file)
@@ -13,11 +13,13 @@ ostream * nulldev =0;
 
 // ugh
 struct _Dinit {
-    _Dinit() {
+  _Dinit() 
+    {
        nulldev = new ofstream ("/dev/null");
        monitor = new Dstream (&cout,".dstreamrc");
     }
-    ~_Dinit() {
+  ~_Dinit() 
+    {
        delete nulldev;
        delete monitor;
     }
@@ -31,14 +33,14 @@ struct _Dinit {
 void
 mynewhandler()
 {
-    assert (false);
+  assert (false);
 }
 
 void
 float_handler (int)
 {
-    cerr << "Floating point exception .. \n"<< flush;
-    assert (false);
+  cerr << "Floating point exception .. \n"<< flush;
+  assert (false);
 }
 
 /// just to make sure print_rat is linked in
@@ -47,13 +49,13 @@ static void (*rat_printer)(Moment const&);
 void
 debug_init()
 {
-    rat_printer = print_rat;   
+  rat_printer = print_rat;     
 #ifndef NDEBUG
-    set_new_handler (&mynewhandler);
+  set_new_handler (&mynewhandler);
 #endif
-    set_flower_debug (*monitor, check_debug);
-    
-    signal (SIGFPE, float_handler);
+  set_flower_debug (*monitor, check_debug);
+  
+  signal (SIGFPE, float_handler);
 }   
 
 bool check_debug=false;
@@ -61,8 +63,8 @@ bool check_debug=false;
 void
 set_debug (bool b)
 {
-    check_debug =b;
-    set_flower_debug (*monitor, check_debug);
+  check_debug =b;
+  set_flower_debug (*monitor, check_debug);
 }
 
 
index 4809adb9514c2aff0975ae41d4158de66d83c001..73fa9d3ca7706561f7f1189fa88cf01dd43b4528 100644 (file)
@@ -6,34 +6,35 @@
 Real
 parse_dimen (String dim)
 {
-    int i=dim.length_i()-1;
-    char const *s = dim;
-    while  (i > 0 && (isspace (s[i]) || isalpha (s[i]))){
+  int i=dim.length_i()-1;
+  char const *s = dim;
+  while  (i > 0 && (isspace (s[i]) || isalpha (s[i])))
+    {
        i--;
     }
-    String unit (s + i+1);
-    return convert_dimen (dim.value_f(), unit); 
+  String unit (s + i+1);
+  return convert_dimen (dim.value_f(), unit); 
 }
 
 
 Real
 convert_dimen (Real quant, String unit)
 {
-    if (unit == "cm")
+  if (unit == "cm")
        return quant * CM_TO_PT;
-    if (unit == "pt")
+  if (unit == "pt")
        return quant;
-    if (unit == "mm")
+  if (unit == "mm")
        return quant*CM_TO_PT/10;
-    if (unit == "in")
+  if (unit == "in")
        return quant * INCH_TO_PT;
-    error ("unknown length unit: `" + unit+"'");
+  error ("unknown length unit: `" + unit+"'");
 }
 
 String
 print_dimen (Real r)
 {
-    String s (r, "%.3f");
-    s += "pt ";
-    return s;
+  String s (r, "%.3f");
+  s += "pt ";
+  return s;
 }
index 0e1c058f4904215afbc8be16c1b7b17a926b5ce3..837fae76d9827ede96ab1b331561c92813f5c8d5 100644 (file)
@@ -3,17 +3,17 @@
 void
 Directional_spanner::set_default_dir()
 {
-    dir_i_ = -1;
+  dir_i_ = -1;
 }
 
 void
 Directional_spanner::do_pre_processing()
 {
-    if (!dir_i_)
+  if (!dir_i_)
        set_default_dir();
 }
 
 Directional_spanner::Directional_spanner()
 {
-    dir_i_ = 0;
+  dir_i_ = 0;
 }
index 6bfe5585d797d6f219a0575dda8ae1487e36ec13..a159d32d7268dfa34460f2bff1ad64a107962f5f 100644 (file)
 
 Dynamic_engraver::Dynamic_engraver()
 {
-    dir_i_ =0;
-    do_post_move_processing();
-    dynamic_p_ =0;
-    to_end_cresc_p_ = cresc_p_ = 0;
-    cresc_req_l_ = 0;
+  dir_i_ =0;
+  do_post_move_processing();
+  dynamic_p_ =0;
+  to_end_cresc_p_ = cresc_p_ = 0;
+  cresc_req_l_ = 0;
 }
 
 void
 Dynamic_engraver::do_post_move_processing()
 {
-    dynamic_req_l_arr_.clear();
+  dynamic_req_l_arr_.clear();
 }
 
 bool    
 Dynamic_engraver::do_try_request (Request * r)
 {
-    Musical_req * m = r->musical();
-    if (!m || !m->dynamic())
+  Musical_req * m = r->musical();
+  if (!m || !m->dynamic())
        return false;
-    dynamic_req_l_arr_.push (m->dynamic());
-    return true;
+  dynamic_req_l_arr_.push (m->dynamic());
+  return true;
 }
 void
 Dynamic_engraver::do_process_requests()
 {
-    Crescendo*  new_cresc_p=0; 
-    for (int i=0; i < dynamic_req_l_arr_.size(); i++) {
+  Crescendo*  new_cresc_p=0; 
+  for (int i=0; i < dynamic_req_l_arr_.size(); i++) 
+    {
        Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
-       if (dreq_l->absdynamic()) {
+       if (dreq_l->absdynamic()) 
+         {
            Text_def * td_p = new Text_def;
            td_p->align_i_ = 0;
            String loud =Dynamic_req::loudness_str (
@@ -59,46 +61,58 @@ Dynamic_engraver::do_process_requests()
                
            dynamic_p_ = new Text_item (td_p);
            announce_element (Score_elem_info (dynamic_p_, dreq_l));
-       } else if (dreq_l->span_dynamic()) {
+         }
+       else if (dreq_l->span_dynamic()) 
+         {
 
            Span_dynamic_req* span_l = dreq_l->span_dynamic();
-           if (span_l->spantype == Span_req::STOP) {
-               if (!cresc_p_) {
+           if (span_l->spantype == Span_req::STOP) 
+             {
+               if (!cresc_p_) 
+                 {
                    span_l->warning ("Can't find cresc to end ");
-               } else {
+                 }
+               else 
+                 {
                    assert (!to_end_cresc_p_);
                    to_end_cresc_p_ =cresc_p_;
                    cresc_p_ = 0;
-               }
-           } else if (span_l->spantype == Span_req::START) {
+                 }
+             }
+           else if (span_l->spantype == Span_req::START) 
+             {
                cresc_req_l_ = span_l;
                assert (!new_cresc_p);
                new_cresc_p  = new Crescendo;
                new_cresc_p->grow_dir_i_ = span_l->dynamic_dir_i_;
                announce_element (Score_elem_info (new_cresc_p, span_l));
-           }
-       }
+             }
+         }
     }
 
-    if ( new_cresc_p) {
+  if ( new_cresc_p) 
+    {
        cresc_p_ = new_cresc_p;
        cresc_p_->left_col_l_ = get_staff_info().musical_l ();
-       if (dynamic_p_) {
+       if (dynamic_p_) 
+         {
            cresc_p_->left_dyn_b_ = true;
-       }
+         }
     }
 }
 
 void
 Dynamic_engraver::do_pre_move_processing()
 {
-    Staff_symbol* s_l = get_staff_info().staff_sym_l_;
-    if (dynamic_p_) {
+  Staff_symbol* s_l = get_staff_info().staff_sym_l_;
+  if (dynamic_p_) 
+    {
        dynamic_p_->set_staffsym (s_l);
        typeset_element (dynamic_p_);
        dynamic_p_ = 0;
     }
-    if ( to_end_cresc_p_) {
+  if ( to_end_cresc_p_) 
+    {
        if (dynamic_p_)
            to_end_cresc_p_->right_dyn_b_=true;
        
@@ -112,7 +126,7 @@ Dynamic_engraver::do_pre_move_processing()
 void
 Dynamic_engraver::set_feature (Feature i)
 {
-    if (i.type_ == "vdir")     
+  if (i.type_ == "vdir")       
        dir_i_ = i.value_;
 }
 
@@ -122,17 +136,19 @@ ADD_THIS_ENGRAVER(Dynamic_engraver);
 
 Dynamic_engraver::~Dynamic_engraver()
 {
-    delete dynamic_p_;
-    delete to_end_cresc_p_;
-    if (cresc_p_) {
+  delete dynamic_p_;
+  delete to_end_cresc_p_;
+  if (cresc_p_) 
+    {
        cresc_req_l_->warning ("unended crescendo");
     }
-    delete cresc_p_;
+  delete cresc_p_;
 }
 void
 Dynamic_engraver::acknowledge_element (Score_elem_info i)
 {
-    if (i.elem_l_->name() == Note_column::static_name ()) {
+  if (i.elem_l_->name() == Note_column::static_name ()) 
+    {
        if (dynamic_p_) dynamic_p_->add_support (i.elem_l_);
        if (to_end_cresc_p_)
            to_end_cresc_p_->add_support (i.elem_l_);
index c22739a849cd149e70282771510049746b4cd060..ec744fee4563e588281bd81258382dfceabdacd7 100644 (file)
@@ -13,7 +13,7 @@
 void
 Horizontal_vertical_group_item::do_print()const
 {
-    Horizontal_vertical_group_element::do_print();
+  Horizontal_vertical_group_element::do_print();
 }
 
 IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
index e1902867ad9b0fc402475423788236c43f86117f..807573384f4022aa696d16eacafcc7b30159f9dc 100644 (file)
 void
 Axis_group_element::do_unlink()
 {
-    remove_all();
+  remove_all();
 }
 
 
 bool
 Axis_group_element::contains_b (Score_elem const*e)const
 {
-    return axis_admin_.contains_b (e);
+  return axis_admin_.contains_b (e);
 }
 
 Link_array<Score_elem>
 Axis_group_element::get_extra_dependencies()const
 {
-    return axis_admin_.elem_l_arr_;
+  return axis_admin_.elem_l_arr_;
 }
 
 void
 Axis_group_element::do_print()const
 {
-    axis_admin_.print();
+  axis_admin_.print();
 }
 
 // ****************
@@ -42,51 +42,51 @@ Axis_group_element::do_print()const
 void
 Vertical_group_element::add_element (Score_elem*e)
 {
-    axis_admin_.add_element (e, this, Y_AXIS, Y_AXIS);
+  axis_admin_.add_element (e, this, Y_AXIS, Y_AXIS);
 }
 
 void
 Vertical_group_element::remove_element (Score_elem*e)
 {
-    axis_admin_.remove_element (e, Y_AXIS, Y_AXIS);
+  axis_admin_.remove_element (e, Y_AXIS, Y_AXIS);
 }
 
 
 Interval
 Vertical_group_element::do_height() const
 {
-    return axis_admin_.extent (Y_AXIS);
+  return axis_admin_.extent (Y_AXIS);
 }
 void
 Vertical_group_element::remove_all()
 {
-    axis_admin_.remove_all (Y_AXIS,Y_AXIS);
+  axis_admin_.remove_all (Y_AXIS,Y_AXIS);
 }
 // ****************
 
 void
 Horizontal_group_element::remove_all()
 {
-    axis_admin_.remove_all (X_AXIS,X_AXIS);
+  axis_admin_.remove_all (X_AXIS,X_AXIS);
 }
 
 void
 Horizontal_group_element::add_element (Score_elem*e)
 {
-    axis_admin_.add_element (e,this, X_AXIS,X_AXIS);
+  axis_admin_.add_element (e,this, X_AXIS,X_AXIS);
 }
 
 void
 Horizontal_group_element::remove_element (Score_elem*e)
 {
-    axis_admin_.remove_element (e,X_AXIS,X_AXIS);
+  axis_admin_.remove_element (e,X_AXIS,X_AXIS);
 }
 
 
 Interval
 Horizontal_group_element::do_width()const
 {
-    return axis_admin_.extent (X_AXIS);
+  return axis_admin_.extent (X_AXIS);
 }
 
 
@@ -95,18 +95,18 @@ Horizontal_group_element::do_width()const
 void
 Horizontal_vertical_group_element::remove_all()
 {
-    axis_admin_.remove_all (X_AXIS,Y_AXIS);
+  axis_admin_.remove_all (X_AXIS,Y_AXIS);
 }
 void
 Horizontal_vertical_group_element::add_element (Score_elem *e)
 {
-    axis_admin_.add_element (e, this, X_AXIS, Y_AXIS);
+  axis_admin_.add_element (e, this, X_AXIS, Y_AXIS);
 }
 
 void
 Horizontal_vertical_group_element::remove_element (Score_elem*e)
 {
-    axis_admin_.remove_element (e, X_AXIS, Y_AXIS);
+  axis_admin_.remove_element (e, X_AXIS, Y_AXIS);
 }
 
 
index acf0c2587e63d2bd38c0684ce531254b4de63b6b..aae1051fb2360c6ec213b091a1456e42e18e9d60 100644 (file)
@@ -20,18 +20,19 @@ Engraver* get_engraver_p (String);
 void
 Engraver_group_engraver::print()const
 { 
-    Engraver::print(); 
+  Engraver::print(); 
 }
 
 Engraver_group_engraver::~Engraver_group_engraver()
 {
-    assert (removable_b());
+  assert (removable_b());
 }
 
 void
 Engraver_group_engraver::check_removal()
 {
-    for (int i =0; i < group_l_arr_.size();) {
+  for (int i =0; i < group_l_arr_.size();) 
+    {
        group_l_arr_[i]->check_removal();
        if (group_l_arr_[i]->removable_b())
            terminate_engraver (group_l_arr_[i]);
@@ -43,20 +44,21 @@ Engraver_group_engraver::check_removal()
 bool
 Engraver_group_engraver::removable_b()const
 {
-    return !iterator_count_&& !group_l_arr_.size() ;
+  return !iterator_count_&& !group_l_arr_.size() ;
 }
 
 Engraver_group_engraver::Engraver_group_engraver()
 {
-    itrans_l_ = 0;
+  itrans_l_ = 0;
 }
 
 void
 Engraver_group_engraver::set_feature (Feature d)
 {
-    PCursor<Engraver*> i (grav_list_.top());
-    // why the while construct?
-    while (i.ok()) {
+  PCursor<Engraver*> i (grav_list_.top());
+  // why the while construct?
+  while (i.ok()) 
+    {
        // this construction to ensure clean deletion
        Engraver *grav_l = i++; 
        grav_l->set_feature (d);
@@ -66,8 +68,9 @@ Engraver_group_engraver::set_feature (Feature d)
 void
 Engraver_group_engraver::sync_features()
 {
-    PCursor<Engraver*> i (grav_list_.top());
-    while (i.ok()) {
+  PCursor<Engraver*> i (grav_list_.top());
+  while (i.ok()) 
+    {
        Engraver *grav_l = i++; 
        grav_l->sync_features();
     }
@@ -76,8 +79,9 @@ Engraver_group_engraver::sync_features()
 void
 Engraver_group_engraver::do_pre_move_processing()
 {
-    PCursor<Engraver*> i (grav_list_.top());
-    while (i.ok()) {
+  PCursor<Engraver*> i (grav_list_.top());
+  while (i.ok()) 
+    {
        Engraver *grav_l = i++; 
        grav_l->pre_move_processing();
     }
@@ -86,8 +90,9 @@ Engraver_group_engraver::do_pre_move_processing()
 void
 Engraver_group_engraver::do_process_requests()
 {
-    PCursor<Engraver*> i (grav_list_.top());
-    while (i.ok()) {
+  PCursor<Engraver*> i (grav_list_.top());
+  while (i.ok()) 
+    {
        Engraver *grav_l = i++; 
        grav_l->process_requests();
     }
@@ -97,8 +102,9 @@ Engraver_group_engraver::do_process_requests()
 void
 Engraver_group_engraver::do_post_move_processing()
 {
-    PCursor<Engraver*> i (grav_list_.top());
-    while (i.ok()) {
+  PCursor<Engraver*> i (grav_list_.top());
+  while (i.ok()) 
+    {
                // this construction to ensure clean deletion
        Engraver *grav_l = i++; 
        grav_l->post_move_processing();
@@ -109,14 +115,14 @@ Engraver_group_engraver::do_post_move_processing()
 bool
 Engraver_group_engraver::contains_b (Engraver* grav_l)const
 {
-    bool parent_b = Engraver::contains_b (grav_l);
-    
-    if (parent_b)
+  bool parent_b = Engraver::contains_b (grav_l);
+  
+  if (parent_b)
        return true;
-    for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
+  for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
        if (i->contains_b (grav_l))
            return true;
-    return false;
+  return false;
 }
        
 
@@ -124,29 +130,32 @@ Engraver_group_engraver::contains_b (Engraver* grav_l)const
 bool
 Engraver_group_engraver::do_try_request (Request*req_l)
 {
-    bool hebbes_b =false;
-    for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
+  bool hebbes_b =false;
+  for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
        hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
-    if (!hebbes_b && daddy_grav_l_)
+  if (!hebbes_b && daddy_grav_l_)
        hebbes_b = daddy_grav_l_->try_request (req_l);
-    return hebbes_b ;
+  return hebbes_b ;
 }
 
 bool
 Engraver_group_engraver::try_request (Request* r)
 {
-    return Engraver::try_request (r);
+  return Engraver::try_request (r);
 }
 
 void
 Engraver_group_engraver::add (Engraver *grav_p)
 {
-    grav_list_.bottom().add (grav_p);
-    grav_p->daddy_grav_l_ = this;
+  grav_list_.bottom().add (grav_p);
+  grav_p->daddy_grav_l_ = this;
 
-    if (grav_p->is_type_b (Engraver_group_engraver::static_name())) {
+  if (grav_p->is_type_b (Engraver_group_engraver::static_name())) 
+    {
        group_l_arr_.push ((Engraver_group_engraver*)grav_p);
-    } else {
+    }
+  else 
+    {
        nongroup_l_arr_ .push (grav_p);
     }
 }
@@ -155,21 +164,21 @@ Engraver_group_engraver::add (Engraver *grav_p)
 Engraver *
 Engraver_group_engraver::remove_engraver_p (Engraver*grav_l)
 {
-    group_l_arr_.substitute ((Engraver_group_engraver*)grav_l,0);
-    nongroup_l_arr_.substitute (grav_l,0);
-    PCursor<Engraver*> grav_cur (grav_list_.find (grav_l));
-    
-    return grav_cur.remove_p();
+  group_l_arr_.substitute ((Engraver_group_engraver*)grav_l,0);
+  nongroup_l_arr_.substitute (grav_l,0);
+  PCursor<Engraver*> grav_cur (grav_list_.find (grav_l));
+  
+  return grav_cur.remove_p();
 }
 
 void
 Engraver_group_engraver::terminate_engraver (Engraver*r_l)
 {
-    DOUT << "Removing " << r_l->name() << " at " << get_staff_info ().when () << "\n";
-    r_l->removal_processing();
-    Engraver * grav_p =remove_engraver_p (r_l);
-    
-    delete grav_p;
+  DOUT << "Removing " << r_l->name() << " at " << get_staff_info ().when () << "\n";
+  r_l->removal_processing();
+  Engraver * grav_p =remove_engraver_p (r_l);
+  
+  delete grav_p;
 }
 
 IMPLEMENT_IS_TYPE_B2(Engraver_group_engraver,Engraver, Translator);
@@ -180,11 +189,11 @@ void
 Engraver_group_engraver::do_print()const
 {
 #ifndef NPRINT
-    if ( !check_debug)
+  if ( !check_debug)
        return ;
-    DOUT << "ID: " << id_str_ ;
-    DOUT << " iterators: " << iterator_count_<< "\n";
-    for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
+  DOUT << "ID: " << id_str_ ;
+  DOUT << " iterators: " << iterator_count_<< "\n";
+  for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
        i->print();
 #endif
 }
@@ -193,24 +202,27 @@ Engraver_group_engraver::do_print()const
 Engraver_group_engraver*
 Engraver_group_engraver::find_engraver_l (String n, String id)
 {
-    if (name() == n && id_str_ == id)
+  if (name() == n && id_str_ == id)
        return this;
-    Engraver_group_engraver * r = 0;
-    for (int i =0; !r && i<  group_l_arr_.size(); i++) {
+  Engraver_group_engraver * r = 0;
+  for (int i =0; !r && i<  group_l_arr_.size(); i++) 
+    {
        r = group_l_arr_[i]->find_engraver_l (n,id);
     }
-    
-    return r;
+  
+  return r;
 }
 
 Translator*
 Engraver_group_engraver::find_get_translator_l (String n,String id)
 {
-    Translator * ret=0;
-    Input_translator * itrans_l= itrans_l_-> recursive_find ( n);
-    if (itrans_l) {
+  Translator * ret=0;
+  Input_translator * itrans_l= itrans_l_-> recursive_find ( n);
+  if (itrans_l) 
+    {
        ret = find_engraver_l (n,id);
-       if (!ret) {
+       if (!ret) 
+         {
            Engraver_group_engraver * group = 
                itrans_l-> get_group_engraver_p();
            
@@ -222,110 +234,115 @@ Engraver_group_engraver::find_get_translator_l (String n,String id)
            else
                return ret->find_get_translator_l (n,id);
 
-       }
-    } else if (daddy_grav_l_)
+         }
+    }
+  else if (daddy_grav_l_)
        ret =daddy_grav_l_->find_get_translator_l (n,id);
-    else {
+  else 
+    {
        warning ("Can't find or create `" + n + "' called `" + id + "'\n");
        ret =0;
     }
-    return ret;
+  return ret;
 }
 
 int
 Engraver_group_engraver::depth_i()const
 {
-    return daddy_grav_l_->depth_i()  + 1;
+  return daddy_grav_l_->depth_i()  + 1;
 }
 
 Translator*
 Engraver_group_engraver::ancestor_l (int l)
 {
-    if (!l || !daddy_grav_l_)
+  if (!l || !daddy_grav_l_)
        return this;
-    
-    return daddy_grav_l_->ancestor_l (l-1);
+  
+  return daddy_grav_l_->ancestor_l (l-1);
 }
 
 void
 Engraver_group_engraver::announce_element (Score_elem_info info)
 {
-    announce_info_arr_.push (info);
-    Engraver::announce_element (info);
+  announce_info_arr_.push (info);
+  Engraver::announce_element (info);
 }
 
 void
 Engraver_group_engraver::do_announces()
 {
-    for (int i=0; i < group_l_arr_.size(); i++) {
+  for (int i=0; i < group_l_arr_.size(); i++) 
+    {
        group_l_arr_[i]->do_announces();
     }
-    
-    Request dummy_req;
+  
+  Request dummy_req;
  
-    for (int j =0; j < announce_info_arr_.size(); j++){
-       Score_elem_info info = announce_info_arr_[j];
-       
-       if (!info.req_l_)
+  for (int j =0; j < announce_info_arr_.size(); j++)
+    {
+     Score_elem_info info = announce_info_arr_[j];
+     
+     if (!info.req_l_)
            info.req_l_ = &dummy_req;
-       for (int i=0; i < nongroup_l_arr_.size(); i++) {        // Is this good enough?6
+     for (int i=0; i < nongroup_l_arr_.size(); i++) {  // Is this good enough?6
           if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0])
               nongroup_l_arr_[i]->acknowledge_element (info);
        }
     }
-    announce_info_arr_.clear();
+  announce_info_arr_.clear();
 }
 
 
 void
 Engraver_group_engraver::do_removal_processing()
 {
-    for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
+  for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++)
        i->removal_processing();
 }
 
 Staff_info
 Engraver_group_engraver::get_staff_info()const
 {
-    Staff_info inf = Engraver::get_staff_info();
+  Staff_info inf = Engraver::get_staff_info();
 
-    for (int i=0; i < nongroup_l_arr_.size(); i++)
+  for (int i=0; i < nongroup_l_arr_.size(); i++)
        nongroup_l_arr_[i]->fill_staff_info (inf);
-    
-    return inf;
+  
+  return inf;
 }
 
 Translator*
 Engraver_group_engraver::get_default_interpreter()
 {
-    // ? 
-    if ( is_bottom_engraver_b())
+  // ? 
+  if ( is_bottom_engraver_b())
        return daddy_grav_l_->get_default_interpreter();
 
-    Engraver_group_engraver *grav_p= itrans_l_->
+  Engraver_group_engraver *grav_p= itrans_l_->
        get_default_itrans_l()->get_group_engraver_p ();
-    add (grav_p);
-    if (grav_p->is_bottom_engraver_b())
+  add (grav_p);
+  if (grav_p->is_bottom_engraver_b())
        return grav_p;
-    else
+  else
        return grav_p->get_default_interpreter();
 }
 
 bool
 Engraver_group_engraver::is_bottom_engraver_b()const
 {
-    return !itrans_l_->get_default_itrans_l();
+  return !itrans_l_->get_default_itrans_l();
 }
 
 Engraver*
 Engraver_group_engraver::get_simple_engraver (char const *type)const
 {
-    for (int i=0; i < nongroup_l_arr_.size(); i++) {
+  for (int i=0; i < nongroup_l_arr_.size(); i++) 
+    {
        if (nongroup_l_arr_[i]->name() == type)
            return nongroup_l_arr_[i];
     }
-    if ( daddy_grav_l_)
+  if ( daddy_grav_l_)
        return daddy_grav_l_->get_simple_engraver (type);
-    return 0;
+  return 0;
 }
 
index f3cf488c0ca49e5baf3048a489841e257951cc0f..52eba772e03b7caf8a9c961a4d97997b0f9448a5 100644 (file)
 void
 Engraver::post_move_processing()
 {
-    if (status < CREATION_INITED) {
+  if (status < CREATION_INITED) 
+    {
        do_creation_processing();
        status = CREATION_INITED;
     }
-    if (status >= MOVE_INITED)
+  if (status >= MOVE_INITED)
        return;
 
-    do_post_move_processing();
-    status = MOVE_INITED;
+  do_post_move_processing();
+  status = MOVE_INITED;
 }
 
 void
 Engraver::removal_processing()
 {
-    if ( status < CREATION_INITED)
+  if ( status < CREATION_INITED)
        do_creation_processing();
-    
-    do_removal_processing();
+  
+  do_removal_processing();
 }
 
 bool
 Engraver::try_request (Request * r)
 {
-    if (status < MOVE_INITED)
+  if (status < MOVE_INITED)
        post_move_processing();
 
-    return do_try_request (r);
+  return do_try_request (r);
 }
 
 void
 Engraver::process_requests()
 {
-    if (status < PROCESSED_REQS)
+  if (status < PROCESSED_REQS)
        post_move_processing();
-    else if (status >= PROCESSED_REQS)
+  else if (status >= PROCESSED_REQS)
        return; 
-    
-    status = PROCESSED_REQS;
-    do_process_requests();
+  
+  status = PROCESSED_REQS;
+  do_process_requests();
 }
 
 void
 Engraver::pre_move_processing()
 {
-    do_pre_move_processing();
-    status = CREATION_INITED;
+  do_pre_move_processing();
+  status = CREATION_INITED;
 }
 
 void
 Engraver::fill_staff_info (Staff_info&)
 {
-    
+  
 }
 
 Scalar
 Engraver::get_feature (String t)
 {
-    return daddy_grav_l_->get_feature (t);
+  return daddy_grav_l_->get_feature (t);
 }
 
 bool
 Engraver::do_try_request (Request*)
 {
-    return false;
+  return false;
 }
 
 Engraver::Engraver()
 {
-    status = VIRGIN;
-    daddy_grav_l_ = 0;
+  status = VIRGIN;
+  daddy_grav_l_ = 0;
 }
 
 void
 Engraver::announce_element (Score_elem_info i)
 {
-    i.origin_grav_l_arr_.push (this);
-    daddy_grav_l_->announce_element (i);
+  i.origin_grav_l_arr_.push (this);
+  daddy_grav_l_->announce_element (i);
 }
 
 void
 Engraver::typeset_element (Score_elem*p)
 {
-    daddy_grav_l_->typeset_element (p);
+  daddy_grav_l_->typeset_element (p);
 }
 
 Paper_def*
 Engraver::paper()const
 {
-    return daddy_grav_l_->paper();
+  return daddy_grav_l_->paper();
 }
 
 bool
 Engraver::contains_b (Engraver *grav_l)const
 {
-    return this == grav_l;
+  return this == grav_l;
 }
 
 Staff_info
 Engraver::get_staff_info() const
 {
-    return daddy_grav_l_->get_staff_info();
+  return daddy_grav_l_->get_staff_info();
 }
 
 void
 Engraver::print() const
 {
 #ifndef NPRINT
-    DOUT << "\n" << name() << " {";
-    do_print();
-    DOUT << "}";
+  DOUT << "\n" << name() << " {";
+  do_print();
+  DOUT << "}";
 #endif
 }
 
index 06b678a965078a313484db7b0b05dc45addbdc9a..f3b202e8055ed5dba03a7c30de404a2c1789ad35 100644 (file)
 int
 General_script_def::staff_dir_i()const
 {
-    return -1;
+  return -1;
 }
 int
 General_script_def::rel_stem_dir_i()const
 {
-    return 0;
+  return 0;
 }
 int
 General_script_def::priority_i()const
 {
-    return 1000;
+  return 1000;
 }
 
 bool
 General_script_def::inside_b()const
 {
-    return false;
+  return false;
 }
 
 bool
 General_script_def::equal_b (General_script_def const&g)const
 {
-    if (name() != g.name ())
+  if (name() != g.name ())
        return false;
 
-    return do_equal_b (&g);
+  return do_equal_b (&g);
 }
 
 bool
 General_script_def::do_equal_b (General_script_def const*)const
 {
-    return true;
+  return true;
 }
 
 
 void
 General_script_def::print() const
 {
-    DOUT << name() << "{";
-    do_print();
-    DOUT << "}";
+  DOUT << name() << "{";
+  do_print();
+  DOUT << "}";
 }
 
 void
@@ -64,8 +64,8 @@ General_script_def::do_print() const
 Atom
 General_script_def::get_atom (Paper_def*, int)const
 {
-    Symbol s;
-    return Atom (s);
+  Symbol s;
+  return Atom (s);
 }
 
 IMPLEMENT_IS_TYPE_B(General_script_def);
index df0df5322ae943540e27f01bd142853e09460cda..784c1939391c468adb4f377af1b9132b6e1aac3e 100644 (file)
 #include "engraver.hh"
 
 struct Engraver_table_entry {
-    String name_str_;
-    Grav_ctor ctor_l_;
-    Engraver_table_entry (String s, Grav_ctor f) {
+  String name_str_;
+  Grav_ctor ctor_l_;
+  Engraver_table_entry (String s, Grav_ctor f) 
+    {
        name_str_ =s;
        ctor_l_ = f;
     }
-    Engraver_table_entry()
-    {
+  Engraver_table_entry()
+  {
        ctor_l_ =0;
     }
 };
@@ -30,38 +31,40 @@ static Array<Engraver_table_entry> *grav_table=0;
 void
 add_engraver (String s, Grav_ctor f)
 {
-    if (!grav_table)
+  if (!grav_table)
        grav_table = new Array<Engraver_table_entry>;
-    
-    grav_table->push (Engraver_table_entry (s, f));
+  
+  grav_table->push (Engraver_table_entry (s, f));
 }
 
 
 Engraver*
 get_engraver_p (String s)
 {
-    for (int i=0; i < grav_table->size(); i++) {
+  for (int i=0; i < grav_table->size(); i++) 
+    {
        if ((*grav_table)[i].name_str_ == s)
            return (*(*grav_table)[i].ctor_l_)();
     }
-    error ("Unknown engraver `" + s +"\'");
-    return 0;
+  error ("Unknown engraver `" + s +"\'");
+  return 0;
 }
 
 #if 0
 
 struct Performer_table_entry
 {
-    String name_str_;
-    Perf_ctor ctor_l_;
-    Performer_table_entry (String s, Perf_ctor f) {
+  String name_str_;
+  Perf_ctor ctor_l_;
+  Performer_table_entry (String s, Perf_ctor f) 
+    {
        name_str_ =s;
        ctor_l_ = f;
     }
-    Performer_table_entry()
-    {
+  Performer_table_entry()
+  {
        ctor_l_ =0;
-    }  
+    }
 }
 
 static Array<Performer_table_entry> *perf_table=0;
@@ -69,21 +72,22 @@ static Array<Performer_table_entry> *perf_table=0;
 void
 add_performer (String s, Perf_ctor f)
 {
-    if (!perf_table)
+  if (!perf_table)
        perf_table = new Array<Performer_table_entry>;
-    
-    perf_table->push (Performer_table_entry (s, f));
+  
+  perf_table->push (Performer_table_entry (s, f));
 }
 
 
 Performer*
 get_performer_p (String s)
 {
-    for (int i=0; i < perf_table->size(); i++) {
+  for (int i=0; i < perf_table->size(); i++) 
+    {
        if ((*perf_table)[i].name_str_ == s)
            return (*(*perf_table)[i].ctor_l_)();
     }
-    error ("Unknown performer `" + s +"\'");
-    return 0;
+  error ("Unknown performer `" + s +"\'");
+  return 0;
 }
 #endif
index 126a1093199b3c73a3f2869e6f6c2d3c4401583f..69102aaf234b3ae07f8454597bda5744be86d450 100644 (file)
@@ -4,7 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-           Jan Nieuwenhuizen <jan@digicash.com>
+         Jan Nieuwenhuizen <jan@digicash.com>
 */
 
 #include "proto.hh"
 #include "performer.hh"
 
 struct Performer_table_entry {
-    String name_str_;
-    Perf_ctor ctor_l_;
-    Performer_table_entry (String s, Perf_ctor f) {
+  String name_str_;
+  Perf_ctor ctor_l_;
+  Performer_table_entry (String s, Perf_ctor f) 
+    {
        name_str_ =s;
        ctor_l_ = f;
     }
-    Performer_table_entry()
-    {
+  Performer_table_entry()
+  {
        ctor_l_ =0;
     }
 };
@@ -31,20 +32,21 @@ static Array<Performer_table_entry> *perf_table=0;
 void
 add_Performer (String s, Perf_ctor f)
 {
-    if (!perf_table)
+  if (!perf_table)
        perf_table = new Array<Performer_table_entry>;
-    
-    perf_table->push (Performer_table_entry (s, f));
+  
+  perf_table->push (Performer_table_entry (s, f));
 }
 
 
 Performer*
 get_performer_p (String s)
 {
-    for (int i=0; i < perf_table->size(); i++) {
+  for (int i=0; i < perf_table->size(); i++) 
+    {
        if ((*perf_table)[i].name_str_ == s)
            return (*(*perf_table)[i].ctor_l_)();
     }
-    error ("Unknown performer `" + s +"\'");
-    return 0;
+  error ("Unknown performer `" + s +"\'");
+  return 0;
 }
index 39cc56bc3da6c1f7b69089f6cef6ebc0ae5850d4..f92156e6e4bb1cee36a881d0cc0b8d10f0336eea 100644 (file)
 
 Global_translator::Global_translator()
 {
-    score_l_ = 0;
-    last_mom_ = 0;
+  score_l_ = 0;
+  last_mom_ = 0;
 }
 
 Translator*
 Global_translator::ancestor_l (int)
 {
-    return this;
+  return this;
 }
 
 void
 Global_translator::add_moment_to_process (Moment m)
 {
-    if (m  > last_mom_)
+  if (m  > last_mom_)
        return;
-    
-    for (int i=0; i <  extra_mom_pq_.size(); i++)
+  
+  for (int i=0; i <  extra_mom_pq_.size(); i++)
        if (extra_mom_pq_[i] == m)
            return;
-    extra_mom_pq_.insert (m);
+  extra_mom_pq_.insert (m);
 }
 
 int
 Global_translator::depth_i()const
 {
-    return 0;
+  return 0;
 }
 
 void
 Global_translator::set_score (Score *s)
 {
-    score_l_ = s;
-    last_mom_ = score_l_->music_p_->time_int().max ();
+  score_l_ = s;
+  last_mom_ = score_l_->music_p_->time_int().max ();
 }
 
 void
 Global_translator::modify_next (Moment &w)
 {
-    while (extra_mom_pq_.size() && 
+  while (extra_mom_pq_.size() && 
        extra_mom_pq_.front() <= w)
        
        w =extra_mom_pq_.get();
@@ -60,7 +60,7 @@ Global_translator::modify_next (Moment &w)
 int
 Global_translator::moments_left_i()const
 {
-    return extra_mom_pq_.size();
+  return extra_mom_pq_.size();
 }
 
 void
index 85533c517b02ad5b79d122bfa492898fc8d900d5..90d07e68512f7a8ce3a4d3b997f74a7ecea535d1 100644 (file)
@@ -21,16 +21,17 @@ const HAPPY_DOTS_I = 3;
   Helper to trace back an optimal path 
  */
 struct Break_node {
-    /** this was the previous. If negative, this break should not be
-      considered: this path has infinite energy
-      
-     */
-    int prev_break_i_;
-    Real energy_f_;
-    Col_hpositions line_config_;
-    Break_node() {
-       prev_break_i_ = -1;
-    }
+  /** this was the previous. If negative, this break should not be
+    considered: this path has infinite energy
+    
+    */
+  int prev_break_i_;
+  Real energy_f_;
+  Col_hpositions line_config_;
+  Break_node() 
+  {
+    prev_break_i_ = -1;
+  }
 };
 
 /**
@@ -41,141 +42,164 @@ Array<Col_hpositions>
 Gourlay_breaking::do_solve()const
 {
 
-    Array<Break_node> optimal_paths;
-    Line_of_cols all = all_cols();
-    Array<int> breaks = find_break_indices();
-    
-    optimal_paths.set_size (breaks.size());
+  Array<Break_node> optimal_paths;
+  Line_of_cols all = all_cols();
+  Array<int> breaks = find_break_indices();
+  
+  optimal_paths.set_size (breaks.size());
 
-    Break_node first_node ;
-    first_node.prev_break_i_ = -1;
-    first_node.line_config_.energy_f_ = 0;
-    
-    optimal_paths[0] = first_node; 
-    int break_idx=1;
+  Break_node first_node ;
+  first_node.prev_break_i_ = -1;
+  first_node.line_config_.energy_f_ = 0;
+  
+  optimal_paths[0] = first_node; 
+  int break_idx=1;
 
   
-    for (; break_idx< breaks.size(); break_idx++) {
-       Array<int> candidates;
-       Array<Col_hpositions> candidate_lines;
-       Pointer_list<Line_spacer*> spacer_p_list;
+  for (; break_idx< breaks.size(); break_idx++) 
+    {
+      Array<int> candidates;
+      Array<Col_hpositions> candidate_lines;
+      Pointer_list<Line_spacer*> spacer_p_list;
        
-       /*
-         start with a short line, add measures. At some point 
-         the line becomes infeasible. Then we don't try to add more 
-        */
-       for (int start_idx = break_idx; start_idx--;){
-           if  (break_idx - start_idx > max_measures_i_) 
-               break;
-
-           if (optimal_paths[start_idx].prev_break_i_ < 0
-               && optimal_paths[start_idx].line_config_.energy_f_)
+      /*
+       start with a short line, add measures. At some point 
+       the line becomes infeasible. Then we don't try to add more 
+       */
+      for (int start_idx = break_idx; start_idx--;)
+       {
+         if  (break_idx - start_idx > max_measures_i_) 
+           break;
+
+         if (optimal_paths[start_idx].prev_break_i_ < 0
+             && optimal_paths[start_idx].line_config_.energy_f_)
                
-               continue;
+           continue;
            
-           Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
+         Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
            
-           line[0] = line[0]->postbreak_p_;
-           line.top() = line.top ()->prebreak_p_;
+         line[0] = line[0]->postbreak_p_;
+         line.top() = line.top ()->prebreak_p_;
            
-           if (!feasible (line))
-               break;
+         if (!feasible (line))
+           break;
            
-           Col_hpositions approx;
-           approx.cols = line;
+         Col_hpositions approx;
+         approx.cols = line;
            
-           approx.spacer_l_ = generate_spacing_problem (line);
-           spacer_p_list.bottom().add (approx.spacer_l_);
+         approx.spacer_l_ = generate_spacing_problem (line);
+         spacer_p_list.bottom().add (approx.spacer_l_);
 
-           ((Break_algorithm*)this)->approx_stats_.add (approx.cols);
-           approx.approximate_solve_line();
+         ((Break_algorithm*)this)->approx_stats_.add (approx.cols);
+         approx.approximate_solve_line();
            
-           if  (approx.energy_f_  > energy_bound_f_){ 
-               continue;
+         if  (approx.energy_f_  > energy_bound_f_)
+           {
+             continue;
            }
 
            
-           // this is a likely candidate. Store it.
-           candidate_lines.push (approx);
-           candidates.push (start_idx);
+         // this is a likely candidate. Store it.
+         candidate_lines.push (approx);
+         candidates.push (start_idx);
        }
 
            
-       int minimal_j = -1;
-       Real minimal_energy = infinity_f;
-       for (int j=0; j < candidates.size(); j++) {
-           int start = candidates[j];
-           if ( optimal_paths[start].line_config_.energy_f_
-                + candidate_lines[j].energy_f_  > minimal_energy)
+      int minimal_j = -1;
+      Real minimal_energy = infinity_f;
+      for (int j=0; j < candidates.size(); j++) 
+       {
+         int start = candidates[j];
+         if ( optimal_paths[start].line_config_.energy_f_
+              + candidate_lines[j].energy_f_  > minimal_energy)
                
-               continue;
+           continue;
 
-           if ( !candidate_lines[j].satisfies_constraints_b_) {
-                candidate_lines[j].solve_line();
-                ((Break_algorithm*)this)->exact_stats_.add ( candidate_lines[j].cols);
+         if ( !candidate_lines[j].satisfies_constraints_b_) 
+           {
+             candidate_lines[j].solve_line();
+             ((Break_algorithm*)this)->exact_stats_.add ( candidate_lines[j].cols);
            }
            
-           Real this_energy 
-               = optimal_paths[start].line_config_.energy_f_ 
-               + candidate_lines[j].energy_f_ ;
+         Real this_energy 
+           = optimal_paths[start].line_config_.energy_f_ 
+           + candidate_lines[j].energy_f_ ;
            
-           if ( this_energy < minimal_energy) {
-               minimal_j = j;
-               minimal_energy = this_energy;
+         if ( this_energy < minimal_energy) 
+           {
+             minimal_j = j;
+             minimal_energy = this_energy;
            }
        }
 
-       if (minimal_j < 0) {
-           optimal_paths[break_idx].prev_break_i_ = -1;
-           optimal_paths[break_idx].line_config_.energy_f_ = infinity_f;
-       } else {
-           optimal_paths[break_idx].prev_break_i_ = candidates[minimal_j];
-           optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j];
+      if (minimal_j < 0) 
+       {
+         optimal_paths[break_idx].prev_break_i_ = -1;
+         optimal_paths[break_idx].line_config_.energy_f_ = infinity_f;
+       }
+      else 
+       {
+         optimal_paths[break_idx].prev_break_i_ = candidates[minimal_j];
+         optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j];
        }
 
-       if ( !(break_idx % HAPPY_DOTS_I))
-           *mlog << "[" << break_idx << "]"<<flush;
-    }
-
-    if  ( break_idx % HAPPY_DOTS_I) 
+      if ( !(break_idx % HAPPY_DOTS_I))
        *mlog << "[" << break_idx << "]"<<flush;
-    print_stats();
+    }
 
-    
+  if  ( break_idx % HAPPY_DOTS_I) 
+    *mlog << "[" << break_idx << "]"<<flush;
 
-    Array<int> final_breaks;
+  Array<int> final_breaks;
 
-    Array<Col_hpositions> lines;
-    /* skip 0-th element, since it is a "dummy" elt*/
-    for (int i = optimal_paths.size()-1; i> 0;) {
-       final_breaks.push ( i);
-       assert ( i > optimal_paths[i].prev_break_i_);
+  Array<Col_hpositions> lines;
+  Real min_energy_f_ = infinity_f;
+  Real max_energy_f_ = 0;
+  
+  /* skip 0-th element, since it is a "dummy" elt*/
+  for (int i = optimal_paths.size()-1; i> 0;) 
+    {
+      final_breaks.push ( i);
+      assert ( i > optimal_paths[i].prev_break_i_);
+
+      // there was no "feasible path"
+      if (!optimal_paths[i].line_config_.config.size()) {
+       final_breaks.set_size (0);
+       break;
+      }
+      i = optimal_paths[i].prev_break_i_;
+    }
 
-       // there was no "feasible path"
-       if (!optimal_paths[i].line_config_.config.size())
-          return lines; 
-       i = optimal_paths[i].prev_break_i_;
+  print_stats();
+  /*
+    TODO print variation in energy
+   */
+  if (max_energy_f_ ) 
+    {
+      ;
     }
+  
+  
 
-    for (int i= final_breaks.size(); i--;) 
-       lines.push ( optimal_paths[final_breaks[i]].line_config_);
+  for (int i= final_breaks.size(); i--;) 
+    lines.push ( optimal_paths[final_breaks[i]].line_config_);
 
-    
-    return lines;
+  
+  return lines;
 }
 
 
 Gourlay_breaking::Gourlay_breaking()
 {
-    get_line_spacer = Spring_spacer::constructor;
-    energy_bound_f_ = infinity_f;
-    max_measures_i_ = INT_MAX;
+  get_line_spacer = Spring_spacer::constructor;
+  energy_bound_f_ = infinity_f;
+  max_measures_i_ = INT_MAX;
 }
 
 void
 Gourlay_breaking::do_set_pscore()
 {
-    energy_bound_f_ = pscore_l_->paper_l_->get_var ("gourlay_energybound");
-    max_measures_i_ =int (rint (pscore_l_->paper_l_->get_var ("gourlay_maxmeasures")));
+  energy_bound_f_ = pscore_l_->paper_l_->get_var ("gourlay_energybound");
+  max_measures_i_ =int (rint (pscore_l_->paper_l_->get_var ("gourlay_maxmeasures")));
 }
 
index ffda40e14fd707bbac65b696e2b38d47695f4743..c106db08619a7971ce79e4db86bfb1f6fca62a9c 100644 (file)
 void
 Rhythmic_grouping::init()
 {
-    interval_ = 0;
-    children.clear();     
+  interval_ = 0;
+  children.clear();     
 }
 
 void
 Rhythmic_grouping::OK()const
 {
 #ifndef NDEBUG
-    assert (bool (children.size()) != bool (interval_));
+  assert (bool (children.size()) != bool (interval_));
 
-    for (int i= 0; i < children.size(); i++) {
+  for (int i= 0; i < children.size(); i++) 
+    {
        children[i]->OK();
        if (i>0)
            assert (children[i-1]->interval().right ==
@@ -35,15 +36,15 @@ Rhythmic_grouping::OK()const
 Moment
 Rhythmic_grouping::length() const
 {
-    return interval().length ();
+  return interval().length ();
 }
 
 MInterval
 Rhythmic_grouping::interval()const
 {
-    if (interval_)
+  if (interval_)
        return *interval_;
-    else
+  else
        return
            MInterval (children[0]->interval().left,
                     children.top()->interval ().right);
@@ -52,17 +53,19 @@ Rhythmic_grouping::interval()const
 void
 Rhythmic_grouping::split (Rhythmic_grouping r)
 {
-    if (interval_)
+  if (interval_)
        return ;
-    
-    r.intersect (interval());
-    split (r.intervals());
-    
-    for (int i= 0; i < children.size(); i++) {
-       if (!children[i]->interval_) {
+  
+  r.intersect (interval());
+  split (r.intervals());
+  
+  for (int i= 0; i < children.size(); i++) 
+    {
+       if (!children[i]->interval_) 
+         {
            Rhythmic_grouping here (r); 
            children[i]->split (here);
-       }
+         }
     }
 }
 
@@ -70,37 +73,46 @@ Rhythmic_grouping::split (Rhythmic_grouping r)
 Array<MInterval>
 Rhythmic_grouping::intervals()
 {
-    Array<MInterval> r;
-    if (interval_ || children.size() == 1) {
+  Array<MInterval> r;
+  if (interval_ || children.size() == 1) 
+    {
        MInterval i (interval());
        MInterval r1(i), r2(i);
        r1.right = r2.left = i.center();
        r.push (r1); r.push (r2);
-    } else {
+    }
+  else 
+    {
        for (int i=0; i < children.size(); i++)
            r.push (children[i]->interval());
     }
-    return r;
+  return r;
 }
 
 void
 Rhythmic_grouping::intersect (MInterval t)
 {
-    if (interval_) {
+  if (interval_) 
+    {
        interval_->intersect (t);
        return;
     }
-    
-    for (int i=0; i < children.size(); i++) {
+  
+  for (int i=0; i < children.size(); i++) 
+    {
        MInterval inter = intersection (t, children[i]->interval());
-       if (inter.empty_b() || inter.length () <= Rational (0)) {
+       if (inter.empty_b() || inter.length () <= Rational (0)) 
+         {
            delete children[i];
            children[i] =0;
-       } else {
+         }
+       else 
+         {
            children[i]->intersect (t);
-       }
+         }
     }
-    for (int i=0; i < children.size();) {
+  for (int i=0; i < children.size();) 
+    {
        if (!children[i])
            children.del (i);
        else
@@ -120,164 +132,180 @@ Rhythmic_grouping::intersect (MInterval t)
 void
 Rhythmic_grouping::split (Array<MInterval> splitpoints)
 {
-    //check on splitpoints..
-    int j = 0, i = 0, starti = 0, startj = 0;
-    
-    Array<Rhythmic_grouping*> ch;
-    while (1) {
+  //check on splitpoints..
+  int j = 0, i = 0, starti = 0, startj = 0;
+  
+  Array<Rhythmic_grouping*> ch;
+  while (1) 
+    {
        if  ( i >= children.size() || j >= splitpoints.size ())
            break;
        
        assert (
            children[starti]->interval().left== splitpoints[startj].left);
-               if (children[i]->interval().right < splitpoints[j].right) {
+               if (children[i]->interval().right < splitpoints[j].right) 
+                 {
            i ++;
-       } else if (children[i]->interval().right > splitpoints[j].right) {
+         }
+       else if (children[i]->interval().right > splitpoints[j].right) 
+         {
            j ++;
-       } else {
+         }
+       else 
+         {
 
-           if (i == starti) {
+           if (i == starti) 
+             {
                ch.push (children[i]);
-           } else {
+             }
+           else 
+             {
                Rhythmic_grouping *newchild=new Rhythmic_grouping (
                    children.slice (starti, i+1));
 
                ch.push (newchild);
-           }
+             }
            i ++;
            j++;
            starti = i;
            startj = j;
 
 
-       }
+         }
     }
-    if (ch.size() != 1)
+  if (ch.size() != 1)
        children = ch;
     }
 
 
 Rhythmic_grouping::Rhythmic_grouping (MInterval t, int n)
 {
-    init();
-    if (n == 1 || !n) {
+  init();
+  if (n == 1 || !n) 
+    {
        interval_ = new MInterval (t);
        return;
     }
-    Moment dt = t.length()/Rational (n);
-    MInterval basic = MInterval (t.left, t.left+dt);
-    for (int i= 0; i < n; i++)
+  Moment dt = t.length()/Rational (n);
+  MInterval basic = MInterval (t.left, t.left+dt);
+  for (int i= 0; i < n; i++)
        children.push (new Rhythmic_grouping (dt*Rational (i) + basic));
 }
 
 
 Rhythmic_grouping::Rhythmic_grouping (Array<Rhythmic_grouping*> r)
-    :children (r)
+  :children (r)
 {
-    interval_ =0;
+  interval_ =0;
 }
 
 Rhythmic_grouping::~Rhythmic_grouping()
 {
-    junk();    
+  junk();    
 }
 
 void
 Rhythmic_grouping::copy (Rhythmic_grouping const&s)
 {
-    interval_ =  (s.interval_)? new MInterval (*s.interval_) : 0;
-    for (int i=0; i < s.children.size(); i++)
-       children.push (new Rhythmic_grouping (*s.children[i]));
+  interval_ =  (s.interval_)? new MInterval (*s.interval_) : 0;
+  for (int i=0; i < s.children.size(); i++)
+     children.push (new Rhythmic_grouping (*s.children[i]));
 }
 
 void
 Rhythmic_grouping::operator=(Rhythmic_grouping const &s)
 {
-    junk();
-    copy (s);
+  junk();
+  copy (s);
 }
 
 Rhythmic_grouping::Rhythmic_grouping (Rhythmic_grouping const&s)
 {
-    init();
-    copy (s);
+  init();
+  copy (s);
 }
 
 void
 Rhythmic_grouping::junk()
 {
-    delete interval_;
-    for (int i=0; i < children.size(); i++)
+  delete interval_;
+  for (int i=0; i < children.size(); i++)
        delete children[i];
-    init();
+  init();
 }
 
 void
 Rhythmic_grouping::print()const    
 {
 #ifndef NPRINT
-    DOUT << "{ \n";
-    if (interval_)
+  DOUT << "{ \n";
+  if (interval_)
        DOUT <<" Interval "<< interval_->str();
-    for (int i=0; i < children.size(); i++) {
+  for (int i=0; i < children.size(); i++) 
+    {
        children[i]->print();
     }
-    DOUT << "}\n";
+  DOUT << "}\n";
 #endif
 }
 
 bool
 Rhythmic_grouping::child_fit_b (Moment start)
 {
-    if (children.size())
+  if (children.size())
        return ( children.top()->interval ().right== start);
 
-    return true;
+  return true;
 }  
 
 void
 Rhythmic_grouping::add_child (Moment start, Moment len)
 {
-    Moment stop = start+len;
+  Moment stop = start+len;
 
-    assert (child_fit_b (start));
-    children.push (new Rhythmic_grouping (MInterval (start, stop)));
+  assert (child_fit_b (start));
+  children.push (new Rhythmic_grouping (MInterval (start, stop)));
 }
 
 Rhythmic_grouping::Rhythmic_grouping()
 {
-    interval_ =0;
+  interval_ =0;
 }
 
 int
 min_elt (Array<int> v)
 {
-    int i = 1000;              // ugh
-    for (int j = 0 ; j <  v.size(); j++)
+  int i = 1000;                // ugh
+  for (int j = 0 ; j <  v.size(); j++)
        i = i <? v[j];
-    return i;
+  return i;
 }
 
 Array<int>
 Rhythmic_grouping::generate_beams (Array<int> flags, int &flagidx)
 {
-    assert (!interval_) ;
-    
-    Array< Array<int> > children_beams;
-    for (int i=0; i < children.size(); i++) {
+  assert (!interval_) ;
+  
+  Array< Array<int> > children_beams;
+  for (int i=0; i < children.size(); i++) 
+    {
        Array<int> child_beams;
-       if (children[i]->interval_) {
+       if (children[i]->interval_) 
+         {
            int f = flags[flagidx++];
            child_beams.push (f);
-       } else {
+         }
+       else 
+         {
            child_beams = children[i]->
                generate_beams (flags, flagidx);
-       }
+         }
        children_beams.push (child_beams);
     }
-    Array<int> beams;
-    int lastm, m, nextm;
-    for (int i=0; i  < children_beams.size(); i++) {
+  Array<int> beams;
+  int lastm, m, nextm;
+  for (int i=0; i  < children_beams.size(); i++) 
+    {
        bool add_left =  (i >0);
        bool add_right = (i  < children_beams.size() -1);
 
@@ -286,31 +314,34 @@ Rhythmic_grouping::generate_beams (Array<int> flags, int &flagidx)
        if (add_right)
            nextm = min_elt (children_beams[i+1]);
        
-       if (children_beams[i].size() == 1) {
+       if (children_beams[i].size() == 1) 
+         {
            if (add_right)
                beams.push (m);
            if (add_left)
                beams.push (m);
-       } else {
+         }
+       else 
+         {
            if (add_left) 
                beams.push (lastm <? m);
            beams.concat (children_beams[i]);
            if (add_right)
                beams.push (m <? nextm);
-       }
+         }
        lastm = m;
        m = nextm;      
     }
-    assert (!(beams.size()%2));
-    return beams;
+  assert (!(beams.size()%2));
+  return beams;
 }
 
 void
 Rhythmic_grouping::translate (Moment m)
 {
-    if (interval_)
+  if (interval_)
        *interval_ += m;
-    else
+  else
        for (int i=0; i < children.size(); i++)
            children[i]->translate (m);
 }
@@ -318,33 +349,36 @@ Rhythmic_grouping::translate (Moment m)
 void
 Rhythmic_grouping::extend (MInterval m)const
 {    
-    assert (m.left >= interval().left);
-    while (m.right  >interval().right) {
+  assert (m.left >= interval().left);
+  while (m.right  >interval().right) 
+    {
        Array<Rhythmic_grouping*> a (children);
-       for (int i=0; i < a.size(); i++) {
+       for (int i=0; i < a.size(); i++) 
+         {
            a[i] =new Rhythmic_grouping (*children[i]);
            a[i]->translate (children.top()->interval ().right);            
-       }
+         }
        ((Rhythmic_grouping*)this)->children.concat (a);
     }
-    assert (m.right <= interval().right);
-    OK();
+  assert (m.right <= interval().right);
+  OK();
 }
 
 Rhythmic_grouping
 parse_grouping (Array<int> beat_i_arr, Array<Moment> elt_length_arr)
 {
-    Moment here =0;
-    assert (beat_i_arr.size() == elt_length_arr.size ());
-    
-    Array<Rhythmic_grouping*> children;
-    for (int i=0; i < beat_i_arr.size(); i++) {
+  Moment here =0;
+  assert (beat_i_arr.size() == elt_length_arr.size ());
+  
+  Array<Rhythmic_grouping*> children;
+  for (int i=0; i < beat_i_arr.size(); i++) 
+    {
        Moment last = here;
        here += elt_length_arr[i] * Moment (beat_i_arr[i]);
        children.push (
            new Rhythmic_grouping (MInterval (last, here),
                                  beat_i_arr[i]));
     }
-    return Rhythmic_grouping (children);
+  return Rhythmic_grouping (children);
 }
 
index af7001db90d85283f2e8c72e671042c3d5580ff8..a5d1ecbebd9363e773823c74f964e8e6997b2cbb 100644 (file)
 
 Head_column::Head_column()
 {
-    stem_l_ = 0;
-    dir_i_ =0;
+  stem_l_ = 0;
+  dir_i_ =0;
 }
 
 void
 Head_column::do_substitute_dependency (Score_elem*o,
                                      Score_elem*n)
 {
-    Script_column::do_substitute_dependency (o,n);
-    if (o->name() == Note_head::static_name ()) {
+  Script_column::do_substitute_dependency (o,n);
+  if (o->name() == Note_head::static_name ()) 
+    {
        head_l_arr_.substitute ((Note_head*)o->item(), 
                                (n)? (Note_head*)n->item() : 0);
     }
-    if (stem_l_ == o) {
+  if (stem_l_ == o) 
+    {
        stem_l_ = n ? (Stem*)n->item():0;
     }
 }
@@ -36,24 +38,24 @@ Head_column::do_substitute_dependency (Score_elem*o,
 void
 Head_column::set (Stem*stem_l)
 {
-    stem_l_ = stem_l;
-    Score_elem::add_dependency (stem_l);
-    for (int i=0; script_l_arr_.size(); i++)
+  stem_l_ = stem_l;
+  Score_elem::add_dependency (stem_l);
+  for (int i=0; script_l_arr_.size(); i++)
        script_l_arr_[i]->set_stem (stem_l);
 }
 
 void
 Head_column::add (Script *script_l)
 {
-    Script_column::add (script_l) ;
-    if  (stem_l_)
+  Script_column::add (script_l) ;
+  if  (stem_l_)
        script_l->set_stem (stem_l_);
 }
 void
 Head_column::add (Note_head *n_l)
 {
-    add_support (n_l);
-    head_l_arr_.push (n_l);
+  add_support (n_l);
+  head_l_arr_.push (n_l);
 }
 
 
@@ -64,16 +66,17 @@ void
 Head_column::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "heads: " << head_l_arr_.size();
+  DOUT << "heads: " << head_l_arr_.size();
 #endif
 }
 
 void
 Head_column::do_pre_processing()
 {
-    if (!dir_i_){
+  if (!dir_i_)
+    {
        if (stem_l_)
            dir_i_ = stem_l_->dir_i_;
     }
-    Script_column::do_pre_processing();
+  Script_column::do_pre_processing();
 }
index d1aaaed0af747fd3b456daf62b6a7cff7c3487e6..29da2be66e18c979e0cc74d61e138767ee03537f 100644 (file)
 
 Note_head_engraver::Note_head_engraver()
 {
-    note_p_ = 0;
-    do_post_move_processing();
+  note_p_ = 0;
+  do_post_move_processing();
 }
 
 bool
 Note_head_engraver::do_try_request (Request *req_l) 
 {
-    if (note_req_l_)
+  if (note_req_l_)
        return false;
-    
-    if (req_l->musical() && (req_l->musical ()->note () || req_l->musical ()->rest ()))
+  
+  if (req_l->musical() && (req_l->musical ()->note () || req_l->musical ()->rest ()))
        note_req_l_=req_l->musical()->rhythmic ();
-    else
+  else
        return false;
 
-    return true;
+  return true;
 }
 
 void
 Note_head_engraver::do_process_requests()
 {
-    if (!note_req_l_)
+  if (!note_req_l_)
        return;
-    
-    Note_head*n_p = new Note_head (8); // ugh
-    note_p_ = n_p;
-    n_p->set_rhythmic (note_req_l_->rhythmic());
+  
+  Note_head*n_p = new Note_head (8);   // ugh
+  note_p_ = n_p;
+  n_p->set_rhythmic (note_req_l_->rhythmic());
 
-    if (note_req_l_->note()) {
+  if (note_req_l_->note()) 
+    {
        n_p->position_i_ = note_req_l_->note()->height ();
        Staff_info inf = get_staff_info();
        if (inf.c0_position_i_l_)
            n_p->position_i_ += *inf.c0_position_i_l_;
-    } else if (note_req_l_->rest()) {
+    }
+  else if (note_req_l_->rest()) 
+    {
        n_p->rest_b_ = true;
     }
-    
-    Score_elem_info itinf (note_p_,note_req_l_);
-    announce_element (itinf);
+  
+  Score_elem_info itinf (note_p_,note_req_l_);
+  announce_element (itinf);
 }
  
 void
 Note_head_engraver::do_pre_move_processing()
 {
-    if (note_p_) {
+  if (note_p_) 
+    {
        typeset_element (note_p_);
        note_p_ = 0;
     }
@@ -63,7 +67,7 @@ Note_head_engraver::do_pre_move_processing()
 void
 Note_head_engraver::do_post_move_processing()
 {
-    note_req_l_ = 0;
+  note_req_l_ = 0;
 }
 
 
index de24eed51d31a2de5c6c07fe3b68ed9eff9b77be..163a1bf61c12df191437e150ce98f7c0d607aeaa 100644 (file)
@@ -14,28 +14,29 @@ void
 Horizontal_align_item::OK() const
 {
    for  (int i =0; i < item_l_arr_.size(); i++) 
-       assert ( pcol_l_ == item_l_arr_[i]->pcol_l_);
+     assert ( pcol_l_ == item_l_arr_[i]->pcol_l_);
 }
 bool
 Horizontal_align_item::contains_b (Item *i)const
 {
-    return item_l_arr_.find_l (i);
+  return item_l_arr_.find_l (i);
 }
 
 void
 Horizontal_align_item::add (Item *i,int p)
 {
-    assert (! contains_b (i));
-    priority_i_arr_.push (p);
-    item_l_arr_.push (i);
-    add_dependency (i);
+  assert (! contains_b (i));
+  priority_i_arr_.push (p);
+  item_l_arr_.push (i);
+  add_dependency (i);
 }
 
 void
 Horizontal_align_item::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    int i;
-    while ((i = item_l_arr_.find_i (o->item())) >=0) {
+  int i;
+  while ((i = item_l_arr_.find_i (o->item())) >=0) 
+    {
        if (n)
            item_l_arr_[i] = n->item();
        else
@@ -44,25 +45,27 @@ Horizontal_align_item::do_substitute_dependency (Score_elem*o,Score_elem*n)
 }
 
 struct Horizontal_align_item_content {
-    Item * item_l_;
-    int priority_i_;
-    static int compare (Horizontal_align_item_content const &h1, 
-                       Horizontal_align_item_content const &h2) {
+  Item * item_l_;
+  int priority_i_;
+  static int compare (Horizontal_align_item_content const &h1, 
+                       Horizontal_align_item_content const &h2) 
+                         {
        return h1.priority_i_ - h2.priority_i_;
     }
-    Horizontal_align_item_content (Item*i, int p) {
+  Horizontal_align_item_content (Item*i, int p) 
+    {
        priority_i_ = p;
        item_l_ = i;
     }
-    Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; }
+  Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; }
 };
 
 
 void
 Horizontal_align_item::do_pre_processing()
 {
-    OK();
-    {  
+  OK();
+  {  
        Array<Horizontal_align_item_content> content;
        for  (int i =0; i < item_l_arr_.size(); i++) 
            content.push (
@@ -71,43 +74,47 @@ Horizontal_align_item::do_pre_processing()
        content.sort (Horizontal_align_item_content::compare);
        item_l_arr_.clear();
        priority_i_arr_.clear();
-       for  (int i =0; i < content.size(); i++) {
+       for  (int i =0; i < content.size(); i++) 
+         {
            item_l_arr_.push (content[i].item_l_);
            priority_i_arr_.push (content[i].priority_i_);
-       }
+         }
     }
-    
-    Array<Interval> dims;
-    Real total =0;
-    for  (int i =0; i < item_l_arr_.size(); i++) {
+  
+  Array<Interval> dims;
+  Real total =0;
+  for  (int i =0; i < item_l_arr_.size(); i++) 
+    {
        
        Interval item_width= item_l_arr_[i]->width();
-       if (item_width.empty_b()) {
+       if (item_width.empty_b()) 
+         {
            item_width = Interval (0,0);
-       }
+         }
        dims.push (item_width);
        total += item_width.length();
     }
 
-    Real where_f= total * (align_i_-1.0)/2.0;
-    Real center_dx_f = 0;
-    for ( int i=0 ;  i < item_l_arr_.size(); i++) {
+  Real where_f= total * (align_i_-1.0)/2.0;
+  Real center_dx_f = 0;
+  for ( int i=0 ;  i < item_l_arr_.size(); i++) 
+    {
        Real dx = where_f -dims[i][-1];
        item_l_arr_[i]->translate (dx , X_AXIS);
        if (item_l_arr_[i] == center_l_)
            center_dx_f = where_f;
        where_f += dims[i].length();
     }
-    if (center_dx_f && !align_i_)
+  if (center_dx_f && !align_i_)
        for ( int i=0 ;  i < item_l_arr_.size(); i++) 
            item_l_arr_[i]->translate (- center_dx_f , X_AXIS);
-    
+  
 }
 
 Interval
 Horizontal_align_item::do_width() const
 {
-    return Interval (0,0);
+  return Interval (0,0);
 }
 
 void
@@ -117,8 +124,8 @@ Horizontal_align_item::do_print()const
 
 Horizontal_align_item::Horizontal_align_item()
 {
-    center_l_ = 0;
-    align_i_ = 0;
-    empty_b_ = true;
-    transparent_b_ = true;
+  center_l_ = 0;
+  align_i_ = 0;
+  empty_b_ = true;
+  transparent_b_ = true;
 }
index 409f2feadf324c3bc59ef092e8679e331a83350d..6b3afaf3da7c2a8e633892e37341cab171ef76ea 100644 (file)
@@ -14,5 +14,5 @@ IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group_element, Axis_group
 void
 Horizontal_group_item::do_print() const
 { 
-    Axis_group_item::do_print(); 
+  Axis_group_item::do_print(); 
 }
index 1209cc22f5c4db8809a1aa6df7c57c61134d1372..16298be1e11613652a55bd2ccd23f9a87ca8f9a1 100644 (file)
@@ -15,22 +15,22 @@ void
 Idealspacing::print() const
 {
 #ifndef NPRINT
-    DOUT << "idealspacing {" ;
-    DOUT << "distance "<<space_f_<< " strength " << hooke_f_ ;
-    DOUT << "left " << left_i_ << " right " << right_i_ << "}\n";
+  DOUT << "idealspacing {" ;
+  DOUT << "distance "<<space_f_<< " strength " << hooke_f_ ;
+  DOUT << "left " << left_i_ << " right " << right_i_ << "}\n";
 #endif
 }
 
 Idealspacing::Idealspacing()
 {
-    space_f_ = 0.0;
-    hooke_f_ = 0.0;
-    left_i_ = -1;
-    right_i_ = -1;
+  space_f_ = 0.0;
+  hooke_f_ = 0.0;
+  left_i_ = -1;
+  right_i_ = -1;
 }
 
 void
 Idealspacing::OK() const
 {
-    assert (hooke_f_ >= 0);
+  assert (hooke_f_ >= 0);
 }
index ff75e9331158187935a11bc3247b966dc74b42e0..ad7f5de1f4664be02b4bc44a8eb2b2793fdb52f6 100644 (file)
@@ -24,36 +24,36 @@ IMPLEMENT_IS_TYPE_B(Identifier);
 
 Identifier::~Identifier()
 {
-    if (!accessed_b_ && !init_b_)
+  if (!accessed_b_ && !init_b_)
        warning ("Variable not used");
 }
 void
 Identifier::error (String expect)
 {
-    String e ("Wrong identifier type: ");
-    e += String (name()) + "(expected " + expect + ")";
-    ::error (e);
+  String e ("Wrong identifier type: ");
+  e += String (name()) + "(expected " + expect + ")";
+  ::error (e);
 }
 
 Identifier::Identifier ( int code)
 {
-    token_code_i_ = code; 
-    accessed_b_ = 0;
-    init_b_ = 0;
+  token_code_i_ = code; 
+  accessed_b_ = 0;
+  init_b_ = 0;
 }
 
 void
 Identifier::print()const
 {
-    DOUT << "identifier ";
-    do_print();
+  DOUT << "identifier ";
+  do_print();
 }
 
 /* ugh. */
 #define DEFAULT_PRINT(Class, Content_type, accessor) \
 void \
 Class::do_print() const { \
-    ((Class*)this)->accessor()->print(); \
+  ((Class*)this)->accessor()->print(); \
 } \
 class Class
 
@@ -68,24 +68,29 @@ DEFAULT_PRINT(Score_id, Score, score);
 DEFAULT_PRINT(Midi_def_id,Midi_def, mididef);
 DEFAULT_PRINT(Paper_def_id,Paper_def, paperdef);
 
+
+void
+Duration_id::do_print()const
+{}
+
 void
 Real_id::do_print() const
 {
-    DOUT << *data_p_<< "\n";
+  DOUT << *data_p_<< "\n";
 }
 
 void
 Int_id::do_print() const
 {
-    DOUT << *data_p_<< "\n";
+  DOUT << *data_p_<< "\n";
 }
 
 
 #define DEFAULT_ACCESSOR(Idclass, Class, accessor)\
 Class*\
 Idclass::accessor () {\
-    accessed_b_ = true;\
-    return new Class (*data_p_);\
+  accessed_b_ = true;\
+  return new Class (*data_p_);\
 }
 
 #define VIRTUAL_ACCESSOR(Idclass, Class, accessor)\
@@ -100,7 +105,7 @@ Idclass::accessor () {\
        Idclass::~Idclass() { delete data_p_; }\
        Idclass::Idclass (Class*st, int code):Identifier (code) { data_p_ = st; }\
 
-
+IMPLEMENT_ID_CLASS(Duration_id, Duration, duration);
 IMPLEMENT_ID_CLASS(Input_translator_id, Input_translator, input_translator);
 IMPLEMENT_ID_CLASS(Int_id, int, intid);
 IMPLEMENT_ID_CLASS(Real_id, Real, real);
@@ -115,9 +120,10 @@ IMPLEMENT_ID_CLASS(Paper_def_id, Paper_def, paperdef);
 
 Identifier::Identifier (Identifier const&)
 {
-    assert (false);
+  assert (false);
 }
 
+DEFAULT_ACCESSOR(Duration_id, Duration, duration);
 DEFAULT_ACCESSOR(Input_translator_id,Input_translator, input_translator);
 DEFAULT_ACCESSOR(Int_id, int, intid);
 DEFAULT_ACCESSOR(Real_id, Real, real);
diff --git a/lily/include/header.hh b/lily/include/header.hh
new file mode 100644 (file)
index 0000000..e48733e
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+  header.hh -- declare 
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef HEADER_HH
+#define HEADER_HH
+
+#include "string.hh"
+#include "assoc.hh"
+
+
+struct Header : Assoc<String, String>
+{
+};
+
+#endif // HEADER_HH
index 08e8346e80ccbc974114196b799db2d02a48b663..dd4b8f75f82b5577381f95454ccce8643217fdd0 100644 (file)
@@ -42,6 +42,7 @@ struct Identifier : public Input {
     IDACCESSOR(Request, request)
     IDACCESSOR(Score, score)
     IDACCESSOR(int, intid)
+    IDACCESSOR(Duration, duration)
 
 protected:
     virtual void do_print()const=0;
@@ -61,6 +62,7 @@ struct Idclass : Identifier {\
 
 
 DECLARE_ID_CLASS(Input_translator_id, Input_translator, input_translator);
+DECLARE_ID_CLASS(Duration_id, Duration, duration);
 DECLARE_ID_CLASS(Real_id, Real, real);
 DECLARE_ID_CLASS(Script_id, General_script_def, script);
 DECLARE_ID_CLASS(Lookup_id, Lookup, lookup);
index 5e42f95f1e06f9ee52202f7031178403a3b485b0..c024791de5cac2fcff7058e95a8f010e3c85d43b 100644 (file)
@@ -71,6 +71,7 @@ struct Global_translator;
 struct Group_change_req;
 struct Group_feature_req;
 struct Head_column;
+struct Header;
 struct Horizontal_align_item;
 struct Horizontal_group_element;
 struct Horizontal_group_item;
index d472a3ffa674b87dcd18e5f28e870f5fdc8b63eb..6928a0efeae339afc74fb1a4261ad676709f6e85 100644 (file)
@@ -44,6 +44,7 @@ public:
     void clear_notenames();
     Identifier*lookup_identifier (String s);
     Melodic_req* lookup_melodic_req_l (String s);
+  void push_header_state();
     void push_note_state();
     void push_lyric_state();
     void pop_state();
index cb75f8437f683a3a08e7ae1432f0b06bd3cf999a..41b8e2d38e8d5c5464a9df9e7b40a1a1fec69d99 100644 (file)
@@ -77,7 +77,10 @@ public:
     /** convert a duration to an idealspacing
       influence using the geometric_ and  parameters.
       */
-    Real duration_to_dist (Moment);
+    Real duration_to_dist (Moment, Real)const;
+  Real geometric_spacing(Moment)const;
+  Real arithmetic_constant(Moment minimal_mom)const;
+  Real arithmetic_spacing( Moment mom,Real constant)const;
 };
 
 #endif // Paper_def_HH
index e99e448a056b4cb9211855d8244c4db18eff3803..aa2501d9c22a6949fbc8f0dfd33f42268beee119 100644 (file)
@@ -28,6 +28,7 @@ public:
     Music * music_p_;
     Paper_score *pscore_p_;
     Audio_score* audio_score_p_;
+    Header * header_p_;
 
     int errorlevel_i_;
     
index 27985d8e9ec09ebbe21d527efe76aa2105400013..e8dc25db3be5c260e83b0782093eb0f85652ca3b 100644 (file)
@@ -14,6 +14,7 @@
 #include "plist.hh"
 #include "col-info.hh"
 #include "colhpos.hh"
+#include "moment.hh"
 
 /** 
   Determine positions of columns connected by springs and held apart by rods.
 */
 
 class Spring_spacer : public Line_spacer {
-    friend class Durations_iter;
+  friend class Durations_iter;
     
-    Pointer_list<Idealspacing *> ideal_p_list_;
-    Array<Colinfo> cols;
-    Array<Colinfo> loose_col_arr_;
+  Pointer_list<Idealspacing *> ideal_p_list_;
+  Array<Colinfo> cols;
+  Array<Colinfo> loose_col_arr_;
     
-    /// mark column #i# as being loose.
-    void loosen_column (int i);
-    /// the index of #c# in #cols#
-    int col_id (PCol const *c) const;
+  /// mark column #i# as being loose.
+  void loosen_column (int i);
+  /// the index of #c# in #cols#
+  int col_id (PCol const *c) const;
 
-    /// generate an (nonoptimal) solution
-    Vector find_initial_solution() const;
+  /// generate an (nonoptimal) solution
+  Vector find_initial_solution() const;
 
-    /// check if problem is too tight
-    bool check_feasible() const;
+  /// check if problem is too tight
+  bool check_feasible() const;
 
-    /// does #this# contain the column #w#? 
-    bool contains (PCol const *w);
+  /// does #this# contain the column #w#? 
+  bool contains (PCol const *w);
 
-    /// make the energy function
-    void make_matrices (Matrix &quad, Vector &lin,Real&) const;
+  /// make the energy function
+  void make_matrices (Matrix &quad, Vector &lin,Real&) const;
+  void get_ruling_durations(Array<Moment>&, Array<Moment>&);
 
-    /// generate the LP constraints
-    void make_constraints (Mixed_qp& lp) const;
+  /// generate the LP constraints
+  void make_constraints (Mixed_qp& lp) const;
 
 
-    void handle_loose_cols();
-    void position_loose_cols (Vector &) const;
-   /**
-       add a idealspacing to the problem.
+  void handle_loose_cols();
+  void position_loose_cols (Vector &) const;
+  /**
+    add a idealspacing to the problem.
       
     One pair of columns can have no, one or more idealspacings,
     since they can be "summed" if the columns to which #i# refers are
     not in this problem, the spacing is ignored.
     */
-    void add_ideal (Idealspacing const *i);
-    Vector try_initial_solution() const;
-    void calc_idealspacing();
-    void set_fixed_cols (Mixed_qp&)const;
-
-    Score_column* scol_l (int);
-    void connect (int i,int j, Real,Real);
-    Line_of_cols error_pcol_l_arr()const;
+  void add_ideal (Idealspacing const *i);
+  Vector try_initial_solution() const;
+  void calc_idealspacing();
+  void set_fixed_cols (Mixed_qp&)const;
+
+  Score_column* scol_l (int);
+  void connect (int i,int j, Real,Real);
+  Line_of_cols error_pcol_l_arr()const;
 public:
-    static Line_spacer *constructor();
+  static Line_spacer *constructor();
 
-    virtual void solve (Col_hpositions*) const;
-    virtual void lower_bound_solution (Col_hpositions*) const;
-    virtual void add_column (PCol  *, bool fixed=false, Real fixpos=0.0);
+  virtual void solve (Col_hpositions*) const;
+  virtual void lower_bound_solution (Col_hpositions*) const;
+  virtual void add_column (PCol  *, bool fixed=false, Real fixpos=0.0);
  
 
-    virtual Vector default_solution() const;
-    virtual bool check_constraints (Vector v) const;
-    virtual void OK() const;
-    virtual void print() const;
-    virtual void prepare();
-    virtual ~Spring_spacer(){}
+  virtual Vector default_solution() const;
+  virtual bool check_constraints (Vector v) const;
+  virtual void OK() const;
+  virtual void print() const;
+  virtual void prepare();
+  virtual ~Spring_spacer(){}
 };
 
 #endif // SPRING_SPACER_HH
index 29905fd3ae0049d60db48a03ad52a906db774e88..f7b204fcff11c58de7311c6b68179cf77be02a56 100644 (file)
 const int MAXITER=100;         // qlpsolve.hh
 
 /*
-    assume x (idx) == value, and adjust constraints, lin and quad accordingly
+  assume x (idx) == value, and adjust constraints, lin and quad accordingly
 
-    TODO: add const_term
-    */
+  TODO: add const_term
+  */
 void
 Ineq_constrained_qp::eliminate_var (int idx, Real value)
 {
-    Vector row (quad.row (idx));
-    row*= value;
+  Vector row (quad.row (idx));
+  row*= value;
 
-    quad.delete_row (idx);
+  quad.delete_row (idx);
 
-    quad.delete_column (idx);
+  quad.delete_column (idx);
 
-    lin.del (idx);
-    row.del (idx);
-    lin +=row ;
+  lin.del (idx);
+  row.del (idx);
+  lin +=row ;
 
-   for (int i=0; i < cons.size(); i++) {
-      consrhs[i] -= cons[i](idx) *value;
-      cons[i].del (idx);
+   for (int i=0; i < cons.size(); i++) 
+   {
+    consrhs[i] -= cons[i](idx) *value;
+    cons[i].del (idx);
    }
 }
 
 void
 Ineq_constrained_qp::add_inequality_cons (Vector c, double r)
 {
-    cons.push (c);
-    consrhs.push (r);
+  cons.push (c);
+  consrhs.push (r);
 }
 
 Ineq_constrained_qp::Ineq_constrained_qp (int novars):
-    quad (novars),
-    lin (novars),
-    const_term (0.0)
+  quad (novars),
+  lin (novars),
+  const_term (0.0)
 {
 }
 
@@ -59,77 +60,81 @@ void
 Ineq_constrained_qp::OK() const
 {
 #if !defined (NDEBUG) && defined (PARANOID)
-    assert (cons.size() == consrhs.size ());
-    Matrix Qdif= quad - quad.transposed();
-    assert (Qdif.norm()/quad.norm () < EPS);
+  assert (cons.size() == consrhs.size ());
+  Matrix Qdif= quad - quad.transposed();
+  assert (Qdif.norm()/quad.norm () < EPS);
 #endif    
 }
-     
+   
 
 Real
 Ineq_constrained_qp::eval (Vector v)
 {
-    return v * quad * v + lin * v + const_term;
+  return v * quad * v + lin * v + const_term;
 }
 
 
 int
 min_elt_index (Vector v)
 {
-    Real m=infinity_f; 
-    int idx=-1;
-    for (int i = 0; i < v.dim(); i++){
-       if (v (i) < m) {
+  Real m=infinity_f; 
+  int idx=-1;
+  for (int i = 0; i < v.dim(); i++)
+    {
+       if (v (i) < m) 
+         {
            idx = i;
            m = v (i);
-       }
+         }
        assert (v (i) <= infinity_f);
     }
-    return idx;
+  return idx;
 }
 
 
 /**the numerical solving. Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
-    Prentice Hall.
+  Prentice Hall.
 
-    Section 13.3
+  Section 13.3
 
-    This is a "projected gradient" algorithm. Starting from a point x
-    the next point is found in a direction determined by projecting
-    the gradient onto the active constraints.  (well, not really the
-    gradient. The optimal solution obeying the active constraints is
-    tried. This is why H = Q^-1 in initialisation))
+  This is a "projected gradient" algorithm. Starting from a point x
+  the next point is found in a direction determined by projecting
+  the gradient onto the active constraints.  (well, not really the
+  gradient. The optimal solution obeying the active constraints is
+  tried. This is why H = Q^-1 in initialisation))
 
 
-    */
+  */
 Vector
 Ineq_constrained_qp::constraint_solve (Vector start) const 
 {    
-    if (!dim())
+  if (!dim())
        return Vector (0);
-    
-    // experimental
-    if (quad.dim() > 10)
+  
+  // experimental
+  if (quad.dim() > 10)
        quad.try_set_band();
-    
-    Active_constraints act (this);
-    act.OK();    
+  
+  Active_constraints act (this);
+  act.OK();    
 
-    
-    Vector x (start);
-    Vector gradient=quad*x+lin;
+  
+  Vector x (start);
+  Vector gradient=quad*x+lin;
        //    Real fvalue = x*quad*x/2 + lin*x + const_term;
        // it's no use.
 
-    Vector last_gradient (gradient);
-    int iterations=0;
-    
-    while (iterations++ < MAXITER) {
+  Vector last_gradient (gradient);
+  int iterations=0;
+  
+  while (iterations++ < MAXITER) 
+    {
        Vector direction= - act.find_active_optimum (gradient);
-               
+       
        DOUT << "gradient "<< gradient<< "\ndirection " << direction<<"\n";
        
-       if (direction.norm() > EPS) {
+       if (direction.norm() > EPS) 
+         {
            DOUT << act.status() << '\n';
            
            Real minalf = infinity_f;
@@ -141,19 +146,21 @@ Ineq_constrained_qp::constraint_solve (Vector start) const
            we know the optimum on this "hyperplane". Check if we
            bump into the edges of the simplex
            */
-    
-           for (Inactive_iter ia (act); ia.ok(); ia++) {
+  
+           for (Inactive_iter ia (act); ia.ok(); ia++) 
+             {
 
                if (ia.vec() * direction >= 0)
                    continue;
                Real alfa= - (ia.vec()*x - ia.rhs ())/
                    (ia.vec()*direction);
                
-               if (minalf > alfa) {
+               if (minalf > alfa) 
+                 {
                    minidx = ia;
                    minalf = alfa;
-               }
-           }
+                 }
+             }
            Real unbounded_alfa = 1.0;
            Real optimal_step = min (minalf, unbounded_alfa);
 
@@ -164,48 +171,55 @@ Ineq_constrained_qp::constraint_solve (Vector start) const
            DOUT << "step = " << optimal_step<< " (|dx| = " <<
                deltax.norm() << ")\n";     
           
-           if (minalf < unbounded_alfa) {
+           if (minalf < unbounded_alfa) 
+             {
                /* bumped into an edge. try again, in smaller space. */
                act.add (minidx.idx());
                DOUT << "adding cons "<< minidx.idx()<<'\n';
                continue;
-           }
+             }
            /*ASSERT: we are at optimal solution for this "plane"*/
-    
-    
-       }
+  
+  
+         }
        
        Vector lagrange_mult=act.get_lagrange (gradient);       
        int m= min_elt_index (lagrange_mult);
        
-       if (m>=0 && lagrange_mult (m) > 0) {
+       if (m>=0 && lagrange_mult (m) > 0) 
+         {
            break;              // optimal sol.
-       } else if (m<0) {
+         }
+       else if (m<0) 
+         {
            assert (gradient.norm() < EPS) ;
            
            break;
-       }
+         }
        
        DOUT << "dropping cons " << m<<'\n';
        act.drop (m);
     }
-    if (iterations >= MAXITER)
+  if (iterations >= MAXITER)
        WARN<<"didn't converge!\n";
-    
-    DOUT <<  ": found " << x<<" in " << iterations <<" iterations\n";
-    assert_solution (x);
-    return x;
+  
+  DOUT <<  ": found " << x<<" in " << iterations <<" iterations\n";
+  assert_solution (x);
+  return x;
 } 
 
-    
+  
 Vector
 Ineq_constrained_qp::solve (Vector start)const
 { 
-    /* no hassle if no constraints*/
-    if ( ! cons.size()) {
+  /* no hassle if no constraints*/
+  if ( ! cons.size()) 
+    {
        Choleski_decomposition chol (quad);
        return - chol.solve (lin);
-    } else {
+    }
+  else 
+    {
        return constraint_solve (start);
     }
 }
index ddc0163053ca180d22e614e3dbb8bad82b84cdef..34a65b7f3e1f49f6bea2bb26c9561107b92ff3ab 100644 (file)
 bool
 Input_translator::is_name_b (String n)
 {
-    for (int i=0; i < alias_str_arr_.size(); i++)
+  for (int i=0; i < alias_str_arr_.size(); i++)
        if (alias_str_arr_[i] == n)
            return true;
-    return false;
+  return false;
 }
 
 void
 Input_translator::print() const
 {
 #ifndef NPRINT
-    if ( ! check_debug)
+  if ( ! check_debug)
        return ;
-    DOUT << base_str_ <<" " << type_str_<<" {\n";
-    DOUT << "Consists of ";
-    for (int i=0; i< consists_str_arr_.size(); i++)
+  DOUT << base_str_ <<" " << type_str_<<" {\n";
+  DOUT << "Consists of ";
+  for (int i=0; i< consists_str_arr_.size(); i++)
        DOUT << consists_str_arr_[i] << ',';
-    if (contains_itrans_p_list_.size())
+  if (contains_itrans_p_list_.size())
        DOUT << "\nContains " ;
-    for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) 
+  for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) 
        i->print();
-    DOUT << "}\n";
+  DOUT << "}\n";
 #endif 
 }
 
@@ -46,86 +46,90 @@ Input_translator::print() const
 Input_translator *
 Input_translator::recursive_find (String nm)
 {
-    if ( is_name_b (nm))
+  if ( is_name_b (nm))
        return this;
 
-    Input_translator * r =0;
-    // what bout for() ?
-    PCursor<Input_translator*> i (contains_itrans_p_list_.top());
-    for (; !r &&i.ok(); i++) {
+  Input_translator * r =0;
+  // what bout for() ?
+  PCursor<Input_translator*> i (contains_itrans_p_list_.top());
+  for (; !r &&i.ok(); i++) 
+    {
        if (i->recursive_find (nm))
            r = i.ptr();
     }
 
-    return r;
+  return r;
 }
 
 Input_translator *
 Input_translator::find_itrans_l (String nm)
 {
-    for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) 
+  for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) 
        if (i->is_name_b (nm))
            return i;
 
-    return 0;
+  return 0;
 }
 
 
 Engraver_group_engraver *
 Input_translator::get_group_engraver_p()
 {
-    assert (base_str_ == "Engraver");
-    Engraver_group_engraver * grav_p = (Engraver_group_engraver*)
+  assert (base_str_ == "Engraver");
+  Engraver_group_engraver * grav_p = (Engraver_group_engraver*)
        get_engraver_p (type_str_);
 
-    for (int i=0; i < consists_str_arr_.size(); i++) {
+  for (int i=0; i < consists_str_arr_.size(); i++) 
+    {
        grav_p->add (get_engraver_p (consists_str_arr_[i]));
     }
-    grav_p->itrans_l_ = this;
-    grav_p->id_str_ = default_id_str_;
-    return grav_p;
+  grav_p->itrans_l_ = this;
+  grav_p->id_str_ = default_id_str_;
+  return grav_p;
 }
 
 Performer_group_performer*
 Input_translator::get_group_performer_p()
 {    
-    assert (base_str_ == "Performer");
-    Performer_group_performer * perf_p = (Performer_group_performer*)
+  assert (base_str_ == "Performer");
+  Performer_group_performer * perf_p = (Performer_group_performer*)
        get_performer_p (type_str_);
 
-    for (int i=0; i < consists_str_arr_.size(); i++) {
+  for (int i=0; i < consists_str_arr_.size(); i++) 
+    {
        perf_p->add (get_performer_p (consists_str_arr_[i]));
     }
-    perf_p->itrans_l_ = this;
-    perf_p->id_str_ = default_id_str_;
-    return perf_p;
+  perf_p->itrans_l_ = this;
+  perf_p->id_str_ = default_id_str_;
+  return perf_p;
 }
 
 bool
 Input_translator::accept_req_b()
 {
-    return ! contains_itrans_p_list_.size();
+  return ! contains_itrans_p_list_.size();
 }
 
 void
 Input_translator::add (Input_translator *ip)
 {
-    contains_itrans_p_list_.bottom().add (ip);
+  contains_itrans_p_list_.bottom().add (ip);
 }
 
 Input_translator*
 Input_translator::get_default_itrans_l()
 {
-    if ( contains_itrans_p_list_.size())
+  if ( contains_itrans_p_list_.size())
        return contains_itrans_p_list_.top();
-    else
+  else
        return 0;
 }
 
 
 Input_translator_list::Input_translator_list (Input_translator_list const &s)
 {
-    for (PCursor<Input_translator*> pc (s); pc.ok(); pc++) {
+  for (PCursor<Input_translator*> pc (s); pc.ok(); pc++) 
+    {
        Input_translator *q = pc;
        Input_translator *p=new Input_translator (*q) ; 
        bottom().add (p);
index b47ac190e9fb698e6150051d69a3114a73c1fd2a..6c4a7699c814da15146eba6ce18e0a8f8c9a0a00 100644 (file)
 
 Item::Item()
 {
-    breakable_b_ = false;
-    break_status_i_ = 0;
-    pcol_l_ = 0;
-    broken_to_a_[0] = broken_to_a_[1]=0;
+  breakable_b_ = false;
+  break_status_i_ = 0;
+  pcol_l_ = 0;
+  broken_to_a_[0] = broken_to_a_[1]=0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Item, Score_elem);
@@ -26,7 +26,7 @@ void
 Item::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "(unknown)";
+  DOUT << "(unknown)";
 #endif
 }
 
@@ -34,28 +34,29 @@ Item::do_print() const
 Real 
 Item::hpos_f()const
 {
-    return pcol_l_->hpos_f_ + absolute_coordinate (X_AXIS);
+  return pcol_l_->hpos_f_ + absolute_coordinate (X_AXIS);
 }
 
 Line_of_score *
 Item::line_l()const
 {
-    return pcol_l_->line_l_;
+  return pcol_l_->line_l_;
 }
 
 int
 Item::break_status_i() const
 {
-    return break_status_i_;
+  return break_status_i_;
 }
 
 void
 Item::copy_breakable_items()
 {
-    if ( broken_to_a_[0] || broken_to_a_[1])
+  if ( broken_to_a_[0] || broken_to_a_[1])
        return;
-    Item *new_copies[2];
-    for (int i=0; i < 2; i++) {
+  Item *new_copies[2];
+  for (int i=0; i < 2; i++) 
+    {
        Item * item_p = clone()->item ();
        item_p->copy_dependencies (*this);
        
@@ -64,56 +65,56 @@ Item::copy_breakable_items()
        item_p->handle_prebroken_dependencies();
        new_copies[i] =item_p;
     }
-    broken_to_a_= new_copies;
+  broken_to_a_= new_copies;
 }
 
 void
 Item::do_breakable_col_processing()
 {
-    if (!breakable_b_ || !pcol_l_->breakable_b())
+  if (!breakable_b_ || !pcol_l_->breakable_b())
        return;
 
-    copy_breakable_items();
-    handle_prebroken_dependencies();
+  copy_breakable_items();
+  handle_prebroken_dependencies();
 
-    /*
-      Otherwise the broken items won't be pre_process()'ed.
-     */
-    add_dependency (broken_to_a_[0]);
-    add_dependency (broken_to_a_[1]);    
+  /*
+    Otherwise the broken items won't be pre_process()'ed.
+   */
+  add_dependency (broken_to_a_[0]);
+  add_dependency (broken_to_a_[1]);    
 
 }
 
 Item*
 Item::find_prebroken_piece (Line_of_score*l) const
 {
-    if (line_l() == l) 
+  if (line_l() == l) 
        return (Item*)this;
-    else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l)
+  else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l)
        return broken_to_a_[0];
-    else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l)
+  else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l)
        return broken_to_a_[1];
 
-    return 0;
+  return 0;
 }
 
 Item*
 Item::find_prebroken_piece (PCol*c)const
 {
-    if (c == pcol_l_)
+  if (c == pcol_l_)
        return (Item *) this;   // ugh
 
-    if (c == pcol_l_->prebreak_p_)
+  if (c == pcol_l_->prebreak_p_)
        return (Item *) broken_to_a_[0];
-    else if (c==pcol_l_->postbreak_p_)
+  else if (c==pcol_l_->postbreak_p_)
        return  (Item *)broken_to_a_[1];
 
-    assert (false);
+  assert (false);
 }
 
 void
 Item::handle_prebroken_dependencies()
 {
-    if ( breakable_b_)
+  if ( breakable_b_)
        Score_elem::handle_prebroken_dependencies();
 }
index a29879bbf4a53adb7f342d6eaebd50d2ac06aa56..96d51998c4732303ee95a695c4cbc0ca17ba9ecd 100644 (file)
 
 Key_engraver::Key_engraver()
 {
-    kit_p_ = 0;
-    do_post_move_processing();
+  kit_p_ = 0;
+  do_post_move_processing();
 }
 
 void
 Key_engraver::create_key()
 {
-    if (!kit_p_) {
+  if (!kit_p_) 
+    {
        int c0_i=0;
 
        Staff_info inf = get_staff_info();
@@ -36,31 +37,34 @@ Key_engraver::create_key()
        
        kit_p_ = new Key_item (c0_i);
        announce_element (Score_elem_info (kit_p_,keyreq_l_));
-       kit_p_->read (*this);
+       kit_p_->read (*this);
     }
 }
 
 bool
 Key_engraver::do_try_request (Request * req_l)
 {
-    Command_req* creq_l= req_l->command();
-    if (!creq_l|| !creq_l->keychange())
+  Command_req* creq_l= req_l->command();
+  if (!creq_l|| !creq_l->keychange())
        return false;
-     
-    if (keyreq_l_)
+   
+  if (keyreq_l_)
        return false;           // TODO
-    keyreq_l_ = creq_l->keychange();
-    read_req (keyreq_l_);
-    return true;
+  keyreq_l_ = creq_l->keychange();
+  read_req (keyreq_l_);
+  return true;
 }
 
 void
 Key_engraver::acknowledge_element (Score_elem_info info)
 {
-    Command_req * r_l = info.req_l_->command() ;
-    if (r_l && r_l->clefchange()) {
+  Command_req * r_l = info.req_l_->command() ;
+  if (r_l && r_l->clefchange()) 
+    {
        create_key();
-    } else if (info.elem_l_->name() == Bar::static_name ()) {
+    }
+  else if (info.elem_l_->name() == Bar::static_name ()) 
+    {
        if ( !keyreq_l_)
            default_key_b_ = true;
        create_key();
@@ -71,9 +75,12 @@ Key_engraver::acknowledge_element (Score_elem_info info)
 void
 Key_engraver::do_process_requests()
 {
-    if (key_.multi_octave_b_) {
+  if (key_.multi_octave_b_) 
+    {
        assert (false); // TODO . 
-    } else if (keyreq_l_) {
+    }
+  else if (keyreq_l_) 
+    {
        create_key();
     }
 }
@@ -81,7 +88,8 @@ Key_engraver::do_process_requests()
 void
 Key_engraver::do_pre_move_processing()
 { 
-    if (kit_p_) {
+  if (kit_p_) 
+    {
        kit_p_->default_b_ = default_key_b_;
        typeset_element (kit_p_);
        kit_p_ = 0;
@@ -89,13 +97,14 @@ Key_engraver::do_pre_move_processing()
 }
 
 
-    
+  
 void
 Key_engraver::read_req (Key_change_req * r)
 {
-    key_.multi_octave_b_ = r->multi_octave_b_;
-    accidental_idx_arr_.clear();
-    for (int i = 0; i < r->melodic_p_arr_.size(); i ++) {
+  key_.multi_octave_b_ = r->multi_octave_b_;
+  accidental_idx_arr_.clear();
+  for (int i = 0; i < r->melodic_p_arr_.size(); i ++) 
+    {
        Melodic_req *  m_l =r->melodic_p_arr_[i];
        int n_i =m_l->notename_i_;
        int a_i = m_l->accidental_i_;
@@ -111,8 +120,8 @@ Key_engraver::read_req (Key_change_req * r)
 void
 Key_engraver::do_post_move_processing()
 {
-    keyreq_l_ = 0;
-    default_key_b_ = false;
+  keyreq_l_ = 0;
+  default_key_b_ = false;
 }
 
 
index c765fd0206cc55331cd314f5d507a8653d7f0b2f..12276dcbbf8653a20993fb586ffe1ffa818f56ac 100644 (file)
@@ -22,17 +22,18 @@ const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
 
 Key_item::Key_item (int c)
 {
-    breakable_b_ =true;
-    default_b_ = false;
-    set_c_position (c);
+  breakable_b_ =true;
+  default_b_ = false;
+  set_c_position (c);
 }
 
 void
 Key_item::read (Key_engraver const & key_grav_r)
 {
-    assert (!key_grav_r.key_.multi_octave_b_);
-    const Array<int> &idx_arr =key_grav_r.accidental_idx_arr_; 
-    for (int i = 0 ; i< idx_arr.size(); i++) {
+  assert (!key_grav_r.key_.multi_octave_b_);
+  const Array<int> &idx_arr =key_grav_r.accidental_idx_arr_; 
+  for (int i = 0 ; i< idx_arr.size(); i++) 
+    {
        int note = idx_arr[i];
        int acc = ((Key &) key_grav_r.key_).oct (0).acc (note);
 
@@ -43,44 +44,47 @@ Key_item::read (Key_engraver const & key_grav_r)
 void 
 Key_item::set_c_position (int c0)
 {
-    int octaves =(abs (c0) / 7) +1 ;
-    c_position=(c0 + 7*octaves)%7;
+  int octaves =(abs (c0) / 7) +1 ;
+  c_position=(c0 + 7*octaves)%7;
 }
 
 
 void
 Key_item::add (int p, int a)
 {
-    if ((a<0 && p>FLAT_TOP_PITCH) ||
-        (a>0 && p>SHARP_TOP_PITCH)) {
-      p -= 7; /* Typeset below c_position */
+  if ((a<0 && p>FLAT_TOP_PITCH) ||
+      (a>0 && p>SHARP_TOP_PITCH)) 
+        {
+    p -= 7; /* Typeset below c_position */
     }
-    pitch.push (p);
-    acc.push (a);
+  pitch.push (p);
+  acc.push (a);
 }
 
 
 Molecule*
 Key_item::brew_molecule_p()const
 {
-    Molecule*output = new Molecule;
-    Real inter = paper()->internote_f ();
-    
-    for (int i =0; i < pitch.size(); i++) {
+  Molecule*output = new Molecule;
+  Real inter = paper()->internote_f ();
+  
+  for (int i =0; i < pitch.size(); i++) 
+    {
        Symbol s= paper()->lookup_l ()->accidental (acc[i]);
        Atom a (s);
        a.translate ((c_position + pitch[i]) * inter, Y_AXIS);
        Molecule m (a);
        output->add_right (m);  
     }
-    if ( pitch.size()) {
+  if ( pitch.size()) 
+    {
        Molecule m (paper()->lookup_l ()->fill (Box (
        Interval (0, paper()->note_width ()),
        Interval (0,0))));
 
        output->add_right (m);
     }
-    return output;
+  return output;
 }
 
 IMPLEMENT_IS_TYPE_B1(Key_item,Item);
@@ -88,7 +92,8 @@ IMPLEMENT_IS_TYPE_B1(Key_item,Item);
 void 
 Key_item::do_pre_processing()
 {
-    if (default_b_) {
+  if (default_b_) 
+    {
        empty_b_ = transparent_b_ = (break_status_i() != 1);
     }
 }
index 0dfe7092f17bed44076cfae1c4c858473745e700..d4d0527aa06e1d20f987da38e4ef8a0a2cf15177 100644 (file)
@@ -17,7 +17,7 @@ ADD_THIS_PERFORMER(Key_performer);
 
 Key_performer::Key_performer()
 {
-    key_req_l_ = 0;
+  key_req_l_ = 0;
 }
 
 Key_performer::~Key_performer()
@@ -28,31 +28,31 @@ void
 Key_performer::do_print() const
 {
 #ifndef NPRINT
-    if ( key_req_l_)
-       key_req_l_->print();
+  if ( key_req_l_)
+       key_req_l_->print();
 #endif
 }
 
 void
 Key_performer::process_requests()
 {
-    if ( key_req_l_)
+  if ( key_req_l_)
        play (new Audio_key (key_req_l_) );
-    key_req_l_ = 0;
+  key_req_l_ = 0;
 }
 
 bool
 Key_performer::do_try_request (Request* req_l)
 {
-    if ( key_req_l_)
+  if ( key_req_l_)
        return false;
 
-    if ( req_l->command())
+  if ( req_l->command())
        key_req_l_ = req_l->command()->keychange ();
 
-    if ( key_req_l_)
+  if ( key_req_l_)
        return true;
 
-    return false;
+  return false;
 }
 
index d755b68b3dbde79b224ab41797a34deeab5c552d..1a7892d4b13a67c2388c7ce415f860c5eddb143e 100644 (file)
@@ -16,40 +16,40 @@ const int ZEROOCTAVE=7;
 
 Octave_key::Octave_key()
 {
-    accidental_i_arr_.set_size (7);
-    for (int i= 0; i < 7 ; i++)
+  accidental_i_arr_.set_size (7);
+  for (int i= 0; i < 7 ; i++)
        accidental_i_arr_[i] = 0;
 }
 
 Key::Key()
 {
-    multi_octave_b_ = false;
-    octaves.set_size (OCTAVES);
+  multi_octave_b_ = false;
+  octaves.set_size (OCTAVES);
 }
 
 Octave_key&
 Key::oct (int i)
 {
-    return octaves[i+ZEROOCTAVE];    
+  return octaves[i+ZEROOCTAVE];    
 }
 
 
 void
 Octave_key::set (int i, int a)
 {
-    assert (a > -3 && a < 3);
-    accidental_i_arr_[i]=a;
+  assert (a > -3 && a < 3);
+  accidental_i_arr_[i]=a;
 }
 
 void
 Key::set (int o, int n , int a)
 {
-    octaves[o + ZEROOCTAVE].set (n,a);
+  octaves[o + ZEROOCTAVE].set (n,a);
 }
 
 void
 Key::set (int n, int a)
 {
-    for (int i= 0; i < OCTAVES ; i++)
+  for (int i= 0; i < OCTAVES ; i++)
        octaves[i].set (n,a);
 }
index 4eec8b4f72fe843d5002f645ac4de10f4d4ee944..f027ee86d91591151fcd7622221cf948ffbab497 100644 (file)
@@ -9,36 +9,36 @@
 /* for the keyword table */
 struct Keyword_ent
 {
-    char const *name;
-    int     tokcode;
+  char const *name;
+  int     tokcode;
 };
 
 struct Keyword_table
 {
-    Keyword_ent *table;
-    int     maxkey;
-    Keyword_table (Keyword_ent *);
-    int     lookup (char const *s) const;
+  Keyword_ent *table;
+  int     maxkey;
+  Keyword_table (Keyword_ent *);
+  int     lookup (char const *s) const;
 };
 
 
 /* for qsort */
 int
-        tabcmp (void const * p1, void const * p2)
+      tabcmp (void const * p1, void const * p2)
 {
-    return strcmp (((Keyword_ent const *) p1)->name,
-                  ((Keyword_ent const *) p2)->name);
+  return strcmp (((Keyword_ent const *) p1)->name,
+                ((Keyword_ent const *) p2)->name);
 }
 
 Keyword_table::Keyword_table (Keyword_ent *tab)
 {
-    table = tab;
+  table = tab;
 
-    /* count keywords */
-    for (maxkey = 0; table[maxkey].name; maxkey++);
+  /* count keywords */
+  for (maxkey = 0; table[maxkey].name; maxkey++);
 
-    /* sort them */
-    qsort (table, maxkey, sizeof (Keyword_ent), tabcmp);
+  /* sort them */
+  qsort (table, maxkey, sizeof (Keyword_ent), tabcmp);
 }
 
 /*
@@ -47,30 +47,31 @@ Keyword_table::Keyword_table (Keyword_ent *tab)
 int
 Keyword_table::lookup (char const *s)const
 {
-    int     lo,
-            hi,
-            cmp,
-            result;
-    lo = 0;
-    hi = maxkey;
+  int     lo,
+          hi,
+          cmp,
+          result;
+  lo = 0;
+  hi = maxkey;
 
-    /* binary search */
-    do
-    {
-        cmp = (lo + hi) / 2;
+  /* binary search */
+  do
+  {
+      cmp = (lo + hi) / 2;
 
-        result = strcmp (s, table[cmp].name);
+      result = strcmp (s, table[cmp].name);
 
-        if (result < 0)
-            hi = cmp;
-        else
-            lo = cmp;
+      if (result < 0)
+          hi = cmp;
+      else
+          lo = cmp;
     }
-    while (hi - lo > 1);
-    if (!strcmp (s, table[lo].name))
-    {
-        return table[lo].tokcode;
-    } else
-        return -1;              /* not found */
+  while (hi - lo > 1);
+  if (!strcmp (s, table[lo].name))
+  {
+      return table[lo].tokcode;
+    }
+  else
+      return -1;              /* not found */
 }
 
index 7f274bf4d19ca04ed146666050a12f02e304c70a..ab718a97f76bca922a7deed174a2836cbdb00469 100644 (file)
@@ -2,23 +2,24 @@
 void
 Least_squares::OK() const
 {
-    assert (input.size() > 1);
-    Real dx = 0.0;
-    for (int i=1; i < input.size(); i++)
+  assert (input.size() > 1);
+  Real dx = 0.0;
+  for (int i=1; i < input.size(); i++)
        dx += abs (input[i-1].x() - input[i].x ());
 
-    assert (dx);
+  assert (dx);
 }
 void
 Least_squares::minimise (Real &coef, Real &offset)
 {
-    OK();
-    Real sx = 0.0;
-    Real sy = 0.0;
-    Real sqx =0.0;
-    Real sxy = 0.0;
+  OK();
+  Real sx = 0.0;
+  Real sy = 0.0;
+  Real sqx =0.0;
+  Real sxy = 0.0;
 
-    for (int i=0; i < input.size();i++) {
+  for (int i=0; i < input.size();i++) 
+    {
        Real x=input[i].x();
        Real y = input[i].y();
        sx += x;
@@ -26,10 +27,10 @@ Least_squares::minimise (Real &coef, Real &offset)
        sqx += sqr (x);
        sxy += x*y;
     }
-    int N = input.size();
-    
+  int N = input.size();
+  
 
-    coef = (N * sxy - sx*sy)/(N*sqx - sqr (sx));
-    offset = (sy - coef * sx)/N;
+  coef = (N * sxy - sx*sy)/(N*sqx - sqr (sx));
+  offset = (sy - coef * sx)/N;
        
 }
index 0372e75e98aa83c0008db3738e98198af95adfa3..8e702b7c793d00b52041edad18b5473f1d298d2f 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include <stdio.h>
+#include <ctype.h>
 
 #include "string.hh"
 #include "string-convert.hh"
@@ -32,6 +33,9 @@
 #include "parseconstruct.hh"
 #include "main.hh"
 #include "identifier.hh"
+void strip_trailing_white(String&);
+void strip_leading_white(String&);
+
 
 #define start_quote()  \
        yy_push_state(quote);\
@@ -52,6 +56,7 @@
 %option warn
 
 %x incl
+%x header
 %x lyrics
 %x notes
 %x quote
@@ -73,6 +78,7 @@ INT           -?{N}+
 REAL           ({INT}\.{N}*)|(-?\.{N}+)
 KEYWORD                \\{WORD}
 WHITE          [ \n\t\f]
+HORIZONTALWHITE                [ \t]
 BLACK          [^ \n\t\f]
 RESTNAME       [rs]
 NOTECOMMAND    \\{A}+
@@ -94,7 +100,7 @@ LYRICS               ({AA}|{NATIONAL})[^0-9 \t\n\f]*
   %[^{\n].*    {
   }
   {WHITE}+     {
-       
+
   }
 }
 
@@ -107,13 +113,37 @@ LYRICS            ({AA}|{NATIONAL})[^0-9 \t\n\f]*
        "%"+"}"         {
                yy_pop_state();
        }
+       <<EOF>>         {
+               LexerError("EOF found inside a comment");
+               if (! close_input()) 
+                 yyterminate(); // can't move this, since it actually rets a YY_NULL
+       }
 }
-<longcomment><<EOF>> {
-       LexerError("EOF found inside a comment");
-       if (! close_input()) { 
-         yyterminate(); // can't move this, since it actually rets a YY_NULL
+<header>{
+       [\{\}]  {
+               return YYText()[0];
+       }
+       ^{WORD}         {
+               String s=YYText();
+               yylval.string = new String(s);
+               return FIELDNAME;
+       }
+       {HORIZONTALWHITE}+{BLACK}.*\n           {
+               String s=YYText();
+               strip_leading_white(s);
+               strip_trailing_white(s);
+               yylval.string = new String(s);
+               return RECORDLINE;
+       }
+       {WHITE}*        {
+       }
+
+       .               {
+               return YYText()[0];
        }
 }
+
+
 <notes,INITIAL,lyrics>\\include           {
        yy_push_state(incl);
 }
@@ -375,3 +405,29 @@ My_lily_lexer::lyric_state_b() const
 {
        return YY_START == lyrics;
 }
+
+void 
+My_lily_lexer::push_header_state() 
+{
+       yy_push_state(header);
+}
+
+void strip_trailing_white(String&s)
+{
+       int i=0;
+       for (;  i < s.length_i(); i++) 
+               if (!isspace(s[i]))
+                       break;
+
+       s = s.nomid_str(0, i);
+}
+void strip_leading_white(String&s)
+{
+       int i=s.length_i();     
+       while (i--) 
+               if (!isspace(s[i]))
+                       break;
+
+       s = s.left_str(i+1);
+
+}
index 698bc8bf7b762b28c0adb2576905295d4a5883ed..6f5cd27f2653bd19f22a193d5cc9fdc0d4773953 100644 (file)
@@ -26,5 +26,5 @@ yylex() {
 bool
 busy_parsing()
 {
-    return lexer;      
+  return lexer;        
 }
index 65d8c72548b0e22297963bd5ae6ca5b15c146759..68a6b49037351430abc3162cca94ccea9a83038b 100644 (file)
@@ -10,7 +10,7 @@ static const int build=
 char const * 
 lily_version_sz()
 {
-    static char v[1024];       // ugh
-    sprintf (v, s, build);
-    return v;
+  static char v[1024]; // ugh
+  sprintf (v, s, build);
+  return v;
 }
index f023df2e1ad0b1cb2b47f8ff4fc3bb538c690afd..9d544d061e371867ff1451d72946b1d05d473bff 100644 (file)
 
 Line_group_engraver::Line_group_engraver()
 {
-    staffline_p_ =0;
+  staffline_p_ =0;
 }
 
 void
 Line_group_engraver::acknowledge_element (Score_elem_info  elem)
 {
-    if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS])
+  if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS])
        staffline_p_->add_element (elem.elem_l_);
 }
 
@@ -29,19 +29,19 @@ Line_group_engraver::acknowledge_element (Score_elem_info  elem)
 void
 Line_group_engraver::do_removal_processing()
 {
-    staffline_p_->right_col_l_ = get_staff_info().command_pcol_l ();
-    typeset_element (staffline_p_);
-    staffline_p_ = 0;
+  staffline_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  typeset_element (staffline_p_);
+  staffline_p_ = 0;
 }
 
 void
 Line_group_engraver::do_creation_processing()
 {
-    staffline_p_ = new Vertical_group_spanner ;
-    staffline_p_->left_col_l_ = get_staff_info().command_pcol_l ();
+  staffline_p_ = new Vertical_group_spanner ;
+  staffline_p_->left_col_l_ = get_staff_info().command_pcol_l ();
 
-    // don't broadcast to self.
-    announce_element (Score_elem_info (staffline_p_,0));
+  // don't broadcast to self.
+  announce_element (Score_elem_info (staffline_p_,0));
 }
 
 
index 3729744ec09d180c0d0cca75ad8a0b598473a49a..5f51ad3ad43929b4a8881762b643abc70d1562df 100644 (file)
 
 Line_spacer::Line_spacer()
 {
-    paper_l_ =0;
+  paper_l_ =0;
 }
 Paper_def*
 Line_spacer::paper_l()const
 { 
-    return paper_l_ ;
+  return paper_l_ ;
 }
index b1e6cb6b903d917ab0f8ac71bb6ef77262b35c9f..82134c860846ba8e7395d9d4482c4114df238297 100644 (file)
 
 Local_key_engraver::Local_key_engraver()
 {
-    key_C_ = 0;
+  key_C_ = 0;
 }
 
 void
 Local_key_engraver::do_pre_move_processing()
 {
-    Local_key_item *key_item_p = 0;
-    if (mel_l_arr_.size()) {
-       for (int i=0; i  < mel_l_arr_.size(); i++) {
+  Local_key_item *key_item_p = 0;
+  if (mel_l_arr_.size()) 
+    {
+       for (int i=0; i  < mel_l_arr_.size(); i++) 
+         {
            Item * support_l = support_l_arr_[i];
            Note_req * note_l = mel_l_arr_[i];
 
@@ -37,10 +39,8 @@ Local_key_engraver::do_pre_move_processing()
                local_key_.oct (note_l->octave_i_).acc (note_l->notename_i_)
                == note_l->accidental_i_) 
                continue;
-               
-               
-
-           if (!key_item_p) {
+           if (!key_item_p) 
+             {
                int c0_i=0;
 
                Staff_info inf = get_staff_info();
@@ -48,52 +48,61 @@ Local_key_engraver::do_pre_move_processing()
                    c0_i = *get_staff_info().c0_position_i_l_;  
                
                key_item_p = new Local_key_item (c0_i);
-           }
+             }
            key_item_p->add (note_l);
            key_item_p->add_support (support_l);
            local_key_.oct (note_l->octave_i_)
                .set (note_l->notename_i_, note_l->accidental_i_);
-       }
+         }
        
     }
-    if (key_item_p) {
+  if (key_item_p) 
+    {
        for (int i=0; i < support_l_arr_.size(); i++)
            key_item_p->add_support (support_l_arr_[i]);
        
        announce_element (Score_elem_info (key_item_p, 0)); // ugh ugh ugh
        typeset_element (key_item_p);
     }
-    
-    mel_l_arr_.clear();
-    tied_l_arr_.clear();
-    support_l_arr_.clear();
-    forced_l_arr_.clear();     
+  
+  mel_l_arr_.clear();
+  tied_l_arr_.clear();
+  support_l_arr_.clear();
+  forced_l_arr_.clear();       
 }
+
 /*
   whoah .. this looks hairy!
  */
 void
 Local_key_engraver::acknowledge_element (Score_elem_info info)
 {    
-    Score_elem * elem_l = info.elem_l_;
-    if (info.req_l_->musical() && info.req_l_->musical ()->note ()) {
+  Score_elem * elem_l = info.elem_l_;
+  if (info.req_l_->musical() && info.req_l_->musical ()->note ()) 
+    {
        Note_req * note_l = info.req_l_->musical()->note ();
        Item * item_l = info.elem_l_->item();
 
        mel_l_arr_.push (note_l);
        support_l_arr_.push (item_l);
        
-    } else if (info.req_l_->command()
-              && info.req_l_->command()->keychange ()) { 
+    }
+  else if (info.req_l_->command()
+              && info.req_l_->command()->keychange ()) 
+                {
        Key_engraver * key_grav_l =
            (Key_engraver*)info.origin_grav_l_arr_[0];
        key_C_ = &key_grav_l->key_;
        local_key_ = *key_C_;
-    } else if (elem_l->name() == Key_item::static_name ()) {
+    }
+  else if (elem_l->name() == Key_item::static_name ()) 
+    {
        Key_engraver * key_grav_l =
            (Key_engraver*)info.origin_grav_l_arr_[0];
        key_C_ = &key_grav_l->key_;
-    } else if (elem_l->name() == Tie::static_name ()) {
+    }
+  else if (elem_l->name() == Tie::static_name ()) 
+    {
        Tie * tie_l = (Tie*)elem_l->spanner();
        if (tie_l->same_pitch_b_)
            tied_l_arr_.push (tie_l-> right_head_l_);
@@ -103,8 +112,9 @@ Local_key_engraver::acknowledge_element (Score_elem_info info)
 void
 Local_key_engraver::do_process_requests()
 {
-    Time_description const * time_C_ = get_staff_info().time_C_;
-    if (time_C_ && !time_C_->whole_in_measure_){
+  Time_description const * time_C_ = get_staff_info().time_C_;
+  if (time_C_ && !time_C_->whole_in_measure_)
+    {
        if (key_C_)
            local_key_= *key_C_;
     }
index 51464e9eb65ead5149e022b0d7bb6e95e3e497c6..b81adc5fcf2b6be148e965778e350fd9963dae52 100644 (file)
 
 Local_key_item::Local_key_item (int i)
 {
-    c0_position  = i;
+  c0_position  = i;
 }
 
 void
 Local_key_item::add_support (Item*head_l)
 {
-    support_items_.push (head_l);
-    add_dependency (head_l);
+  support_items_.push (head_l);
+  add_dependency (head_l);
 }
 
 void
 Local_key_item::add (Melodic_req*m_l)
 {
-    add (m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
+  add (m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
 }
 
 void
 Local_key_item::add (int o, int p , int a)
 {
-    Local_acc l;
-    l.octave_i_ = o;
-    l.name_i_ = p;
-    l.accidental_i_ = a;
-    for (int i=0; i< accs.size(); i++)
+  Local_acc l;
+  l.octave_i_ = o;
+  l.name_i_ = p;
+  l.accidental_i_ = a;
+  for (int i=0; i< accs.size(); i++)
        if (!Local_acc::compare (l, accs[i]))
            return;
-    
-    accs.push (l);
+  
+  accs.push (l);
 }
 
 void
 Local_key_item::do_pre_processing()
 {
-    accs.sort (Local_acc::compare);
+  accs.sort (Local_acc::compare);
 }
 
 Molecule*
 Local_key_item::brew_molecule_p()const
 {
-    Molecule* output = new Molecule;
-    Molecule*octmol = 0;
-    int lastoct = -100;
-    for  (int i = 0; i <  accs.size(); i++) {
+  Molecule* output = new Molecule;
+  Molecule*octmol = 0;
+  int lastoct = -100;
+  for  (int i = 0; i <  accs.size(); i++) 
+    {
        // do one octave
-       if (accs[i].octave_i_ != lastoct) {
-           if (octmol){
+       if (accs[i].octave_i_ != lastoct) 
+         {
+           if (octmol)
+             {
                Real dy =lastoct*7*paper()->internote_f ();
                octmol->translate (dy, Y_AXIS);
                output->add (*octmol);
                delete octmol;
-           }
+             }
            octmol= new Molecule;
-       }
+         }
        lastoct = accs[i].octave_i_;
        Symbol s =paper()->lookup_l ()->accidental (accs[i].accidental_i_);   
        Atom a (s);
@@ -81,28 +84,29 @@ Local_key_item::brew_molecule_p()const
        octmol->add_right (a);
     }
 
-    if (octmol){
+  if (octmol)
+    {
        Real dy =lastoct*7*paper()->internote_f ();
        octmol->translate (dy, Y_AXIS);
        output->add (*octmol);
        delete octmol;
     }
 
-    Interval head_width=itemlist_width (support_items_);
-    output->translate (-output->extent().x ().right + head_width.left , X_AXIS);
-    
-    return output;
+  Interval head_width=itemlist_width (support_items_);
+  output->translate (-output->extent().x ().right + head_width.left , X_AXIS);
+  
+  return output;
 }
 
 int
 Local_acc::compare (Local_acc&a, Local_acc&b)
 {
-    if (a.octave_i_ - b.octave_i_)
+  if (a.octave_i_ - b.octave_i_)
        return a.octave_i_ - b.octave_i_;
-    if (a.name_i_ - b.name_i_)
+  if (a.name_i_ - b.name_i_)
        return a.name_i_ - b.name_i_;
-    
-    return a.accidental_i_ - b.accidental_i_;
+  
+  return a.accidental_i_ - b.accidental_i_;
 };
 
 IMPLEMENT_IS_TYPE_B1(Local_key_item,Item);
@@ -110,8 +114,8 @@ IMPLEMENT_IS_TYPE_B1(Local_key_item,Item);
 void
 Local_key_item::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    Item* o_l = o->item();
-    Item* n_l = n?n->item():0;
+  Item* o_l = o->item();
+  Item* n_l = n?n->item():0;
 
-    support_items_.substitute (o_l, n_l);
+  support_items_.substitute (o_l, n_l);
 }
index 6cdf8356048a416e8105f717123e8bcfec2df9fc..18407dece2e63f86c6d32713d720a77e9d682ebc 100644 (file)
 
 Lookup::Lookup()
 {
-    paper_l_ = 0;
-    texsetting = "\\unknowntexsetting";
-    symtables_ = new Symtables;
+  paper_l_ = 0;
+  texsetting = "\\unknowntexsetting";
+  symtables_ = new Symtables;
 }
 
 Lookup::Lookup (Lookup const &s)
 {
-    paper_l_ = s.paper_l_;
-    texsetting = s.texsetting;
-    symtables_ = new Symtables (*s.symtables_);
+  paper_l_ = s.paper_l_;
+  texsetting = s.texsetting;
+  symtables_ = new Symtables (*s.symtables_);
 }
 Lookup::~Lookup()
 {
-    delete symtables_;
+  delete symtables_;
 }
 
 void
 Lookup::add (String s, Symtable*p)
 {
-    symtables_->add (s, p);
+  symtables_->add (s, p);
 }
 
 void
 Lookup::print()const
 {
-    #ifndef NPRINT
-    DOUT << "Lookup: " << texsetting << " {\n";
-    symtables_->print();
-    DOUT << "}\n";
-    #endif
+  #ifndef NPRINT
+  DOUT << "Lookup: " << texsetting << " {\n";
+  symtables_->print();
+  DOUT << "}\n";
+  #endif
 }
 
 Symbol
 Lookup::text (String style, String text, int dir) const
 {
-    Array<String> a;
+  Array<String> a;
  
-    a.push (text);
-    Symbol tsym =  (*symtables_)("style")->lookup (style);
-    a[0] = substitute_args (tsym.tex,a);
-
-    Symbol s = (*symtables_)("align")->lookup (dir);
-    s.tex = substitute_args (s.tex,a);
-    s.dim = tsym.dim;
-    return s;
+  a.push (text);
+  Symbol tsym =  (*symtables_)("style")->lookup (style);
+  a[0] = substitute_args (tsym.tex,a);
+
+  Symbol s = (*symtables_)("align")->lookup (dir);
+  s.tex = substitute_args (s.tex,a);
+  s.dim = tsym.dim;
+  return s;
 }
 
 
@@ -74,170 +74,175 @@ Lookup::text (String style, String text, int dir) const
 Symbol
 Lookup::ball (int j) const
 {
-    if (j > 4)
-       j = 4;
+  if (j > 2)
+       j = 2;
 
-    Symtable * st = (*symtables_)("balls");
-    return st->lookup (String (j));
+  Symtable * st = (*symtables_)("balls");
+  return st->lookup (String (j));
 }
 
 Symbol
 Lookup::rest (int j, bool o) const
 {
-    return (*symtables_)("rests")->lookup (String (j) + (o ? "o" : ""));
+  return (*symtables_)("rests")->lookup (String (j) + (o ? "o" : ""));
 }
 
 Symbol
 Lookup::fill (Box b) const
 {
-    Symbol s ((*symtables_)("param")->lookup ("fill"));
-    s.dim = b;
-    return s;
+  Symbol s ((*symtables_)("param")->lookup ("fill"));
+  s.dim = b;
+  return s;
 }
 
 Symbol
 Lookup::accidental (int j) const
 {
-    return (*symtables_)("accidentals")->lookup (String (j));
+  return (*symtables_)("accidentals")->lookup (String (j));
 }
 
 
 Symbol
 Lookup::bar (String s, Real h) const
 {
-    Array<String> a;
-    a.push (print_dimen (h));
-    Symbol ret=(*symtables_)("bars")->lookup (s);;
-    ret.tex = substitute_args (ret.tex, a);
-    ret.dim.y() = Interval (0, h);
-    return ret;
+  Array<String> a;
+  a.push (print_dimen (h));
+  Symbol ret=(*symtables_)("bars")->lookup (s);;
+  ret.tex = substitute_args (ret.tex, a);
+  ret.dim.y() = Interval (0, h);
+  return ret;
 }
 
 Symbol
 Lookup::script (String s) const
 {
-    return (*symtables_)("scripts")->lookup (s);
+  return (*symtables_)("scripts")->lookup (s);
 }
 
 Symbol
 Lookup::dynamic (String s) const
 {
-    return (*symtables_)("dynamics")->lookup (s);
+  return (*symtables_)("dynamics")->lookup (s);
 }
 
 Symbol
 Lookup::clef (String s) const
 {
-    return (*symtables_)("clefs")->lookup (s);
+  return (*symtables_)("clefs")->lookup (s);
 }
  
 Symbol
 Lookup::dots (int j) const
 {
-    if (j>3) {
+  if (j>3) 
+    {
        j = 3;
        warning ("max 3 dots"); // todo
     }
-    return (*symtables_)("dots")->lookup (j);
+  return (*symtables_)("dots")->lookup (j);
 }
 
 Symbol
 Lookup::flag (int j) const
 {
-    return (*symtables_)("flags")->lookup (j);
+  return (*symtables_)("flags")->lookup (j);
 }
 
 Symbol
 Lookup::streepjes (int i) const
 {
-    assert (i);
-    
-    int arg;
-    String idx;
-    
-    if (i < 0) {
+  assert (i);
+  
+  int arg;
+  String idx;
+  
+  if (i < 0) 
+    {
        idx = "botlines";
        arg = -i;
-    } else {
+    }
+  else 
+    {
        arg = i;
        idx = "toplines";
     }
-    Symbol ret = (*symtables_)("streepjes")->lookup (idx);
-    
-    Array<String> a;
-    a.push (arg);
-    ret.tex = substitute_args (ret.tex, a);
+  Symbol ret = (*symtables_)("streepjes")->lookup (idx);
+  
+  Array<String> a;
+  a.push (arg);
+  ret.tex = substitute_args (ret.tex, a);
 
-    return ret;
+  return ret;
 }
 
 Symbol
 Lookup::hairpin (Real &wid, bool decresc) const
 {
-    int idx = int (rint (wid / 6 PT));
-    if (!idx) idx ++;
-    wid = idx*6 PT;
-    String idxstr = (decresc)? "decrescendosym" : "crescendosym";
-    Symbol ret=(*symtables_)("param")->lookup (idxstr);
-       
-    Array<String> a;
-    a.push (idx);
-    ret.tex = substitute_args (ret.tex, a);
-    ret.dim.x() = Interval (0,wid);
-    return ret;
+  int idx = int (rint (wid / 6 PT));
+  if (!idx) idx ++;
+  wid = idx*6 PT;
+  String idxstr = (decresc)? "decrescendosym" : "crescendosym";
+  Symbol ret=(*symtables_)("param")->lookup (idxstr);
+     
+  Array<String> a;
+  a.push (idx);
+  ret.tex = substitute_args (ret.tex, a);
+  ret.dim.x() = Interval (0,wid);
+  return ret;
 }
 
 Symbol
 Lookup::linestaff (int lines, Real wid) const
 {
-    Real internote_f = paper_l_ ->internote_f();
-    Symbol s;
-    Real dy = (lines >0) ? (lines-1)*internote_f : 0;
-    s.dim = Box (Interval (0,wid), Interval (0,dy));
+  Real internote_f = paper_l_ ->internote_f();
+  Symbol s;
+  Real dy = (lines >0) ? (lines-1)*internote_f : 0;
+  s.dim = Box (Interval (0,wid), Interval (0,dy));
 
-    Array<String> a;
-    a.push (lines);
-    a.push (print_dimen (wid));
+  Array<String> a;
+  a.push (lines);
+  a.push (print_dimen (wid));
 
-    s.tex = (*symtables_)("param")->lookup ("linestaf").tex;
-    s.tex = substitute_args (s.tex, a);
+  s.tex = (*symtables_)("param")->lookup ("linestaf").tex;
+  s.tex = substitute_args (s.tex, a);
 
-    return s;
+  return s;
 }
 
 
 Symbol
 Lookup::meter (Array<Scalar> a) const
 {
-    Symbol s;
-    s.dim.x() = Interval (0 PT, 10 PT);
-    s.dim.y() = Interval (0, 20 PT);   // todo
-    String src = (*symtables_)("param")->lookup ("meter").tex;
-    s.tex = substitute_args (src,a);
-    return s;    
+  Symbol s;
+  s.dim.x() = Interval (0 PT, 10 PT);
+  s.dim.y() = Interval (0, 20 PT);     // todo
+  String src = (*symtables_)("param")->lookup ("meter").tex;
+  s.tex = substitute_args (src,a);
+  return s;    
 }
 
 
 Symbol
 Lookup::stem (Real y1,Real y2) const
 {
-    if (y1 > y2) {
+  if (y1 > y2) 
+    {
        Real t = y1;
        y1 = y2;
        y2 = t;
     }
-    Symbol s;
-    
-    s.dim.x() = Interval (0,0);
-    s.dim.y() = Interval (y1,y2);
-    
-    Array<String> a;
-    a.push (print_dimen (y1));
-    a.push (print_dimen (y2));
+  Symbol s;
+  
+  s.dim.x() = Interval (0,0);
+  s.dim.y() = Interval (y1,y2);
+  
+  Array<String> a;
+  a.push (print_dimen (y1));
+  a.push (print_dimen (y2));
        
-    String src = (*symtables_)("param")->lookup ("stem").tex;
-    s.tex = substitute_args (src,a);
-    return s;
+  String src = (*symtables_)("param")->lookup ("stem").tex;
+  s.tex = substitute_args (src,a);
+  return s;
 }
 
 /*
@@ -246,25 +251,27 @@ Lookup::stem (Real y1,Real y2) const
 Symbol
 Lookup::vbrace (Real &y) const
 {
-    if (y < 2* 20 PT) {
+  if (y < 2* 20 PT) 
+    {
        warning ( "piano brace too small (" + print_dimen (y)+ ")");
        y = 2*20 PT;
     }
-    if (y > 67 * 2 PT) {
+  if (y > 67 * 2 PT) 
+    {
        warning ( "piano brace too big (" + print_dimen (y)+ ")");      
        y = 67 *2 PT;
     }
-    
-    int idx = int (rint ((y/2.0 - 20) + 148));
-    
-    Symbol s = (*symtables_)("param")->lookup ("brace");
-    {
+  
+  int idx = int (rint ((y/2.0 - 20) + 148));
+  
+  Symbol s = (*symtables_)("param")->lookup ("brace");
+  {
        Array<String> a;
        a.push (idx);
        s.tex = substitute_args (s.tex,a);
        s.dim.y() = Interval (0,y);
     }
-    {
+  {
        Array<String> a;
        a.push (print_dimen (y/2));
        a.push (print_dimen (0));
@@ -273,5 +280,5 @@ Lookup::vbrace (Real &y) const
     }
 
        
-    return s;
+  return s;
 }
index c4a09ac34ccf9dd9736a657c3a83c8b3dbe8e6d3..c29b46d5fe1741d56b6cb9f35d10854dab1937f1 100644 (file)
 
 Lyric_engraver::Lyric_engraver()
 {
-    lreq_l_ =0;
-    lyric_item_p_ =0;
+  lreq_l_ =0;
+  lyric_item_p_ =0;
 }
 
 bool
 Lyric_engraver::do_try_request (Request*r)
 {
-    Musical_req * m =r->musical();
-    if (!m || ! m->lreq_l()) 
+  Musical_req * m =r->musical();
+  if (!m || ! m->lreq_l()) 
        return false;
-    lreq_l_ = m->lreq_l();
+  lreq_l_ = m->lreq_l();
 
-    return true;
+  return true;
 }
 
 void
 Lyric_engraver::do_process_requests()
 {
-    if ( lreq_l_) {  
+  if ( lreq_l_) 
+    {
        lyric_item_p_ =  new Text_item (lreq_l_->tdef_p_);
 
        lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS);
@@ -46,13 +47,14 @@ Lyric_engraver::do_process_requests()
 void
 Lyric_engraver::do_post_move_processing()
 {
-    lreq_l_ =0;
+  lreq_l_ =0;
 }
 
 void
 Lyric_engraver::do_pre_move_processing()
 {
-    if ( lyric_item_p_){
+  if ( lyric_item_p_)
+    {
        typeset_element (lyric_item_p_);
        lyric_item_p_ =0;
     }
index cccc64216d261dd7adc131347dba90ce8566595a..b800f3d1adaeca6d94564677a208910c9949753b 100644 (file)
@@ -28,27 +28,27 @@ void
 Lyric_performer::do_print() const
 {
 #ifndef NPRINT
-    if ( lreq_arr_.size())
-       lreq_arr_[ 0 ]->print();
+  if ( lreq_arr_.size())
+       lreq_arr_[ 0 ]->print();
 #endif
 }
 
 void
 Lyric_performer::process_requests()
 {
-    if ( lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i() )
+  if ( lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i() )
        play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_) );
-    lreq_arr_.clear();
+  lreq_arr_.clear();
 }
 
 bool
 Lyric_performer::do_try_request (Request* req_l)
 {
-    Musical_req* m_l = req_l->musical();
-    if ( !m_l || ! m_l->lreq_l()) 
+  Musical_req* m_l = req_l->musical();
+  if ( !m_l || ! m_l->lreq_l()) 
        return false;
-    lreq_arr_.push (m_l->lreq_l());
+  lreq_arr_.push (m_l->lreq_l());
 
-    return true;
+  return true;
 }
 
index a32b0a6a866602ec88c60ccb30bb4091400ac348..eb9f611543d0df08c6262e8a973d62a68d910d61 100644 (file)
@@ -28,27 +28,27 @@ int exit_status_i_;
 void destill_inname (String &name_str_r);
 
 Long_option_init theopts[] = {
-    {1, "output", 'o'},
-    {0, "warranty", 'w'},
-    {0, "help", 'h'},
-    {0, "debug", 'd'},
-    {1, "init", 'i'},
-    {1, "include", 'I'},
-    {0, "midi", 'M'},
-    {0, "ignore-version", 'V'},
-    {0,0,0}
+  {1, "output", 'o'},
+  {0, "warranty", 'w'},
+  {0, "help", 'h'},
+  {0, "debug", 'd'},
+  {1, "init", 'i'},
+  {1, "include", 'I'},
+  {0, "midi", 'M'},
+  {0, "ignore-version", 'V'},
+  {0,0,0}
 };
 
 void
 usage()
 {
-    cout <<
-       "Usage: lilypond [options] [mudela-file]\n"
+  cout <<
+       "Usage: lilypond [options] [mudela-file]\n"
        "Typeset and or produce midi output from mudela-file or stdin\n"
        "\n"
        "Options:\n"
        "  -d, --debug            enable debugging output\n"
-        "  -I, --include=DIR      add DIR to search path\n"
+      "  -I, --include=DIR      add DIR to search path\n"
        "  -i, --init=FILE        use FILE as init file\n"
        "  -h, --help             this help\n"
        "  -w, --warranty         show warranty and copyright\n"
@@ -71,14 +71,14 @@ usage()
        "\n";
        
        ;
-    
-    
+  
+  
 }
 
 void 
 notice()
 {
-    cout <<
+  cout <<
        "\n"
        "GNU LilyPond -- The GNU Project music typesetter.\n"
        "Copyright 1996,97 by\n"
@@ -106,49 +106,54 @@ static File_path path;
 void
 do_one_file (String init_str, String file_str)
 {
-    if ( init_str != "" && "" == path.find (init_str) ) {
+  if ( init_str != "" && "" == path.find (init_str) ) 
+    {
        error ( "Can not find `" + init_str +"\'");
        return ;
     }
-    if ( file_str!= "" && path.find (file_str) == "" ) {
+  if ( file_str!= "" && path.find (file_str) == "" ) 
+    {
        error ( "Can not find `" + file_str + "'");
        return ;
     }
-    
-    Sources sources;
-    source_l_g = &sources; 
-    source_l_g->set_path (&path);
-    {
+  
+  Sources sources;
+  source_l_g = &sources; 
+  source_l_g->set_path (&path);
+  {
        My_lily_parser parser (source_l_g);
        parser.set_version_check (version_ignore_b_);
        parser.parse_file (init_str, file_str);
     }
-    do_scores();
-    source_l_g = 0;
+  do_scores();
+  source_l_g = 0;
 }
 
 int
 main (int argc, char **argv)
 {    
-    debug_init();              // should be first
+  debug_init();                // should be first
 
 
-    // must override (come before) "/usr/local/share/lilypond"!
-    char const * env_l=getenv ("LILYINCLUDE");
-    if (env_l) {
+  // must override (come before) "/usr/local/share/lilypond"!
+  char const * env_l=getenv ("LILYINCLUDE");
+  if (env_l) 
+    {
        path.add (env_l);
     }
-    path.add ("");
-    path.add (String (DIR_DATADIR) + "/init/" );
-    
-    path.push (DIR_DATADIR);
-
-    Getopt_long oparser (argc, argv,theopts);
-    cout << get_version_str() << endl;
-    String init_str ("symbol.ly");
-    
-    while (Long_option_init const * opt = oparser()) {
-       switch ( opt->shortname){
+  path.add ("");
+  path.add (String (DIR_DATADIR) + "/init/" );
+  
+  path.push (DIR_DATADIR);
+
+  Getopt_long oparser (argc, argv,theopts);
+  cout << get_version_str() << endl;
+  String init_str ("symbol.ly");
+  
+  while (Long_option_init const * opt = oparser()) 
+    {
+       switch ( opt->shortname)
+         {
        case 'o':
            set_default_output (oparser.optional_argument_ch_C_);
            break;
@@ -178,31 +183,33 @@ main (int argc, char **argv)
        default:
            assert (false);
            break;
-       }
+         }
     }
 
-    int p=0;
-    const char *arg ;
-    while ( (arg= oparser.get_next_arg())) {
+  int p=0;
+  const char *arg ;
+  while ( (arg= oparser.get_next_arg())) 
+    {
        String f (arg);
        destill_inname (f);
        do_one_file (init_str,f);
        p++;
     }
-    if (!p) {
+  if (!p) 
+    {
        do_one_file (init_str, "");     
     }
 
-    return exit_status_i_;
+  return exit_status_i_;
 }
 
 /// make input file name: add default extension. "" is stdin.
 void
 destill_inname (String &name_str_r)
 {
-    if ( name_str_r.length_i())
-        {
-        if (name_str_r[ 0 ] != '-') 
+  if ( name_str_r.length_i())
+      {
+      if (name_str_r[ 0 ] != '-') 
            {
            String a,b,c,d;
            split_path (name_str_r,a,b,c,d);
@@ -211,7 +218,8 @@ destill_inname (String &name_str_r)
            if (d == "") 
                d = ".ly";
            name_str_r = a+b+c+d;
-           }
-       } else name_str_r = "";   
+             }
+         }
+       else name_str_r = "";   
 }
 
index eff12b4a6c366c1f90f15b60d8ae1f8b2704c6e0..7f5a0d3bc8bf190b9d6d291034daead654d15ed3 100644 (file)
 
 Meter_engraver::Meter_engraver()
 { 
-    meter_req_l_ = 0;
-    meter_p_ =0;
-    default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh
+  meter_req_l_ = 0;
+  meter_p_ =0;
+  default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh
 }
 
 void
 Meter_engraver::fill_staff_info (Staff_info&inf)
 {
-    inf.time_C_ = &time_;
-    inf.rhythmic_C_ = &default_grouping_;
+  inf.time_C_ = &time_;
+  inf.rhythmic_C_ = &default_grouping_;
 }
 
 bool
 Meter_engraver::do_try_request (Request*r)
 {
-    bool gotcha = false;
+  bool gotcha = false;
 
-    if (r->command() && r->command ()->timing ()) {
+  if (r->command() && r->command ()->timing ()) 
+    {
        gotcha = true;
        Timing_req * tr_l = r->command()->timing ();
        Meter_change_req *m_l = tr_l->meterchange();
-       if (m_l) {
+       if (m_l) 
+         {
            meter_req_l_ = m_l;
 
            int b_i= m_l->beats_i_;
            int o_i = m_l->one_beat_i_;
            if (! time_.allow_meter_change_b())
                tr_l->warning ("Meter change not allowed here");
-           else{
+           else
+             {
                time_.set_meter (b_i, o_i);
                default_grouping_ = 
                    Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
-           }
-       } else if (tr_l->partial()) {
+             }
+         }
+       else if (tr_l->partial()) 
+         {
            Moment m = tr_l->partial()->duration_;
            String error = time_.try_set_partial_str (m);
-           if (error != "") {
+           if (error != "") 
+             {
                tr_l->warning (error);
-           } else 
+             }
+           else 
                time_.setpartial (m);
-       } else if (tr_l->barcheck()) {
-           if (time_.whole_in_measure_) {
+         }
+       else if (tr_l->barcheck()) 
+         {
+           if (time_.whole_in_measure_) 
+             {
                tr_l ->warning ("Barcheck failed");
            
                time_.whole_in_measure_ = 0; // resync
                time_.error_b_ = true;
-           }
+             }
 
-       } else if (tr_l->cadenza()) {
+         }
+       else if (tr_l->cadenza()) 
+         {
            time_.set_cadenza (tr_l->cadenza()->on_b_);
 
-       } else if (tr_l->measuregrouping()) {
+         }
+       else if (tr_l->measuregrouping()) 
+         {
            default_grouping_ = parse_grouping (
                    tr_l->measuregrouping()->beat_i_arr_,
                    tr_l->measuregrouping()->elt_length_arr_);
 
        }       
     }
-    
-    return gotcha;
+  
+  return gotcha;
 }
 
 void
 Meter_engraver::do_creation_processing()
 {
-    time_.when_ = get_staff_info().when ();
+  time_.when_ = get_staff_info().when ();
 }
 
 void
 Meter_engraver::do_process_requests()
 {
-    if (meter_req_l_) {
+  if (meter_req_l_) 
+    {
        Array<Scalar> args;
        args.push (meter_req_l_->beats_i_);
        args.push (meter_req_l_->one_beat_i_);
@@ -92,33 +107,35 @@ Meter_engraver::do_process_requests()
        meter_p_ = new Meter (args);
     }
 
-    if (meter_p_)
+  if (meter_p_)
        announce_element (Score_elem_info (meter_p_, meter_req_l_));
 }
 
 void
 Meter_engraver::do_pre_move_processing()
 {
-    if (meter_p_) {
+  if (meter_p_) 
+    {
        typeset_element (meter_p_);
        meter_p_ =0;
        meter_req_l_ = 0;
     }
 
-    Engraver_group_engraver * grav_l = daddy_grav_l_;
-    while (grav_l->daddy_grav_l_) {
+  Engraver_group_engraver * grav_l = daddy_grav_l_;
+  while (grav_l->daddy_grav_l_) 
+    {
        grav_l = grav_l->daddy_grav_l_;
     }
-    
-    assert (grav_l->name() == Score_engraver::static_name ());
-    if (!time_.cadenza_b_)
+  
+  assert (grav_l->name() == Score_engraver::static_name ());
+  if (!time_.cadenza_b_)
        ((Score_engraver*)grav_l)->add_moment_to_process (time_.next_bar_moment());
 }
 
 void
 Meter_engraver::do_post_move_processing()
 {
-    time_.add (get_staff_info().when ()  - time_.when_);
+  time_.add (get_staff_info().when ()  - time_.when_);
 }
 
 
index 6d6d1ee4a9b5f713cafc80eeb3cd757e51dbdfa1..0d23bb9a9bf7ce7c48a3249d12518cac448dcc68 100644 (file)
@@ -15,7 +15,7 @@ ADD_THIS_PERFORMER(Meter_performer);
 
 Meter_performer::Meter_performer()
 {
-    meter_req_l_ = 0;
+  meter_req_l_ = 0;
 }
 
 Meter_performer::~Meter_performer()
@@ -26,31 +26,31 @@ void
 Meter_performer::do_print() const
 {
 #ifndef NPRINT
-    if ( meter_req_l_)
-       meter_req_l_->print();
+  if ( meter_req_l_)
+       meter_req_l_->print();
 #endif
 }
 
 void
 Meter_performer::process_requests()
 {
-    if ( meter_req_l_)
+  if ( meter_req_l_)
        play (new Audio_meter (meter_req_l_) );
-    meter_req_l_ = 0;
+  meter_req_l_ = 0;
 }
 
 bool
 Meter_performer::do_try_request (Request* req_l)
 {
-    if ( meter_req_l_)
+  if ( meter_req_l_)
        return false;
 
-    if ( req_l->command())
+  if ( req_l->command())
        meter_req_l_ = req_l->command()->meterchange ();
 
-    if ( meter_req_l_)
+  if ( meter_req_l_)
        return true;
 
-    return false;
+  return false;
 }
 
index dc7efa3a5cec8eb1e0f1481feac598bd44c082cc..e8fcd8f9f04883c75e94c9c6d721a9af697e614d 100644 (file)
@@ -5,16 +5,16 @@
 #include "lookup.hh"
 
 Meter::Meter (Array<Scalar>a)
-    :args (a)
+  :args (a)
 {
-    breakable_b_ = true;
+  breakable_b_ = true;
 }
 
 Molecule*
 Meter::brew_molecule_p()const
 {
-    Symbol s = paper()->lookup_l ()->meter (args);
-    return new Molecule (Atom (s));
+  Symbol s = paper()->lookup_l ()->meter (args);
+  return new Molecule (Atom (s));
 }
 
 
index 95b3e25b0c49a665f35471b63567113cdf85967b..2307155ba826342cee66815480e70d1c063b0bb3 100644 (file)
@@ -29,66 +29,66 @@ int Midi_def::num_i_s = 4;
 
 Midi_def::Midi_def()
 {
-    outfile_str_ = ""; 
-    itrans_p_ = 0;
-    // ugh
-    set_tempo (Moment (1, 4), 60 );
+  outfile_str_ = ""; 
+  itrans_p_ = 0;
+  // ugh
+  set_tempo (Moment (1, 4), 60 );
 }
 
 Midi_def::Midi_def (Midi_def const& s)
 {
-    whole_seconds_f_ = s.whole_seconds_f_;
-    itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_) : 0;
-    outfile_str_ = s.outfile_str_;
+  whole_seconds_f_ = s.whole_seconds_f_;
+  itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_) : 0;
+  outfile_str_ = s.outfile_str_;
 }
 
 Midi_def::~Midi_def()
 {
-    delete itrans_p_;
+  delete itrans_p_;
 }
 
 Real
 Midi_def::duration_to_seconds_f (Moment mom)
 {
-    if ( !mom)
+  if ( !mom)
        return 0;
-    
-    return Moment (whole_seconds_f_) * mom;
+  
+  return Moment (whole_seconds_f_) * mom;
 }
 
 Global_translator*
 Midi_def::get_global_translator_p() const
 {
-    return  itrans_p_->get_group_performer_p()->global_l ();
+  return  itrans_p_->get_group_performer_p()->global_l ();
 }
 
 int
 Midi_def::get_tempo_i (Moment moment)
 {
-    return Moment (whole_seconds_f_) * Moment (60 ) * moment;
+  return Moment (whole_seconds_f_) * Moment (60 ) * moment;
 }
 
 void
 Midi_def::print() const
 {
 #ifndef NPRINT
-    DOUT << "Midi {";
-    DOUT << "4/min: " << Real (60) / ( whole_seconds_f_ * 4 );
-    DOUT << "out: " << outfile_str_;
-    DOUT << "}\n";
+  DOUT << "Midi {";
+  DOUT << "4/min: " << Real (60) / ( whole_seconds_f_ * 4 );
+  DOUT << "out: " << outfile_str_;
+  DOUT << "}\n";
 #endif
 }
 
 void
 Midi_def::set (Input_translator* itrans_p)
 {
-    delete itrans_p_;
-    itrans_p_ = itrans_p;
+  delete itrans_p_;
+  itrans_p_ = itrans_p;
 }
 
 void
 Midi_def::set_tempo (Moment moment, int count_per_minute_i)
 {
-    whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60 ) / moment;
+  whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60 ) / moment;
 }
 
index b2341e17349c5cc561942751e29344c8f8fb9cbe..47af53eb3b59591637a8bb4628a939b1dbbd52a4 100644 (file)
@@ -32,451 +32,451 @@ IMPLEMENT_IS_TYPE_B1(Midi_text, Midi_item);
 IMPLEMENT_IS_TYPE_B1(Midi_track, Midi_chunk);
 
 Midi_chunk::Midi_chunk()
-    : Midi_item (0)
+  : Midi_item (0)
 {
 }
 
 void
 Midi_chunk::add (String str)
 {
-    data_str_ += str;
+  data_str_ += str;
 }
 
 void
 Midi_chunk::set (String header_str, String data_str, String footer_str)
 {
-    data_str_ = data_str;
-    footer_str_ = footer_str;
-    header_str_ = header_str;
+  data_str_ = data_str;
+  footer_str_ = footer_str;
+  header_str_ = header_str;
 }
   
 String
 Midi_chunk::str() const
 {
-    String str = header_str_;
-    String length_str = String_convert::i2hex_str (data_str_.length_i() + footer_str_.length_i (), 8, '0');
-    length_str = String_convert::hex2bin_str (length_str);
-    str += length_str;
-    str += data_str_;
-    str += footer_str_;
-    return str;
+  String str = header_str_;
+  String length_str = String_convert::i2hex_str (data_str_.length_i() + footer_str_.length_i (), 8, '0');
+  length_str = String_convert::hex2bin_str (length_str);
+  str += length_str;
+  str += data_str_;
+  str += footer_str_;
+  return str;
 }
 
 Midi_duration::Midi_duration (Real seconds_f)
-    : Midi_item (0)
+  : Midi_item (0)
 {
-    seconds_f_ = seconds_f;
+  seconds_f_ = seconds_f;
 }
 
 String
 Midi_duration::str() const
 {
-    return String ("<duration: ") + String (seconds_f_ ) + ">";
+  return String ("<duration: ") + String (seconds_f_ ) + ">";
 }
 
 Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i)
-    : Midi_chunk()
+  : Midi_chunk()
 {
-    String str;
+  String str;
        
-    String format_str = String_convert::i2hex_str (format_i, 4, '0');
-    str += String_convert::hex2bin_str (format_str);
+  String format_str = String_convert::i2hex_str (format_i, 4, '0');
+  str += String_convert::hex2bin_str (format_str);
        
-    String tracks_str = String_convert::i2hex_str (tracks_i, 4, '0');
-    str += String_convert::hex2bin_str (tracks_str);
+  String tracks_str = String_convert::i2hex_str (tracks_i, 4, '0');
+  str += String_convert::hex2bin_str (tracks_str);
 
-    String tempo_str = String_convert::i2hex_str (clocks_per_4_i, 4, '0');
-    str += String_convert::hex2bin_str (tempo_str);
+  String tempo_str = String_convert::i2hex_str (clocks_per_4_i, 4, '0');
+  str += String_convert::hex2bin_str (tempo_str);
 
-    set ("MThd", str, "");
+  set ("MThd", str, "");
 }
 
 char const* const instrument_name_sz_a_[ ] = {
 
- /* default is usually piano */
- /* 0 */ "piano",
-
- /* (1-8 piano) */
- /* 1 */ "acoustic grand",
- /* 2 */ "bright acoustic",
- /* 3 */ "electric grand",
- /* 4 */ "honky-tonk",
- /* 5 */ "electric piano 1",
- /* 6 */ "electric piano 2",
- /* 7 */ "harpsichord",
- /* 8 */ "clav",
-
- /* (9-16 chrom percussion) */
- /* 9 */ "celesta",
- /* 10 */ "glockenspiel",
- /* 11 */ "music box",
- /* 12 */ "vibraphone",
- /* 13 */ "marimba",
- /* 14 */ "xylophone",
- /* 15 */ "tubular bells",
- /* 16 */ "dulcimer",
-
- /* (17-24 organ) */
- /* 17 */ "drawbar organ",
- /* 18 */ "percussive organ",
- /* 19 */ "rock organ",
- /* 20 */ "church organ",
- /* 21 */ "reed organ",
- /* 22 */ "accoridan",
- /* 23 */ "harmonica",
- /* 24 */ "tango accordian",
-
- /* (25-32 guitar) */
- /* 25 */ "acoustic guitar (nylon)",
- /* 26 */ "acoustic guitar (steel)",
- /* 27 */ "electric guitar (jazz)",
- /* 28 */ "electric guitar (clean)",
- /* 29 */ "electric guitar (muted)",
- /* 30 */ "overdriven guitar",
- /* 31 */ "distortion guitar",
- /* 32 */ "guitar harmonics",
-
- /* (33-40 bass) */
- /* 33 */ "acoustic bass",
- /* 34 */ "electric bass (finger)",
- /* 35 */ "electric bass (pick)",
- /* 36 */ "fretless bass",
- /* 37 */ "slap bass 1",
- /* 38 */ "slap bass 2",
- /* 39 */ "synth bass 1",
- /* 40 */ "synth bass 2",
-
- /* (41-48 strings) */
- /* 41 */ "violin",
- /* 42 */ "viola",
- /* 43 */ "cello",
- /* 44 */ "contrabass",
- /* 45 */ "tremolo strings",
- /* 46 */ "pizzicato strings",
- /* 47 */ "orchestral strings",
- /* 48 */ "timpani",
-
- /* (49-56 ensemble) */
- /* 49 */ "string ensemble 1",
- /* 50 */ "string ensemble 2",
- /* 51 */ "synthstrings 1",
- /* 52 */ "synthstrings 2",
- /* 53 */ "choir aahs",
- /* 54 */ "voice oohs",
- /* 55 */ "synth voice",
- /* 56 */ "orchestra hit",
-
- /* (57-64 brass) */
- /* 57 */ "trumpet",
- /* 58 */ "trombone",
- /* 59 */ "tuba",
- /* 60 */ "muted trumpet",
- /* 61 */ "french horn",
- /* 62 */ "brass section",
- /* 63 */ "synthbrass 1",
- /* 64 */ "synthbrass 2",
-
- /* (65-72 reed) */
- /* 65 */ "soprano sax",
- /* 66 */ "alto sax",
- /* 67 */ "tenor sax",
- /* 68 */ "baritone sax",
- /* 69 */ "oboe",
- /* 70 */ "english horn",
- /* 71 */ "bassoon",
- /* 72 */ "clarinet",
-
- /* (73-80 pipe) */
- /* 73 */ "piccolo",
- /* 74 */ "flute",
- /* 75 */ "recorder",
- /* 76 */ "pan flute",
- /* 77 */ "blown bottle",
- /* 78 */ "skakuhachi",
- /* 79 */ "whistle",
- /* 80 */ "ocarina",
-
- /* (81-88 synth lead) */
- /* 81 */ "lead 1 (square)",
- /* 82 */ "lead 2 (sawtooth)",
- /* 83 */ "lead 3 (calliope)",
- /* 84 */ "lead 4 (chiff)",
- /* 85 */ "lead 5 (charang)",
- /* 86 */ "lead 6 (voice)",
- /* 87 */ "lead 7 (fifths)",
- /* 88 */ "lead 8 (bass+lead)",
-
- /* (89-96 synth pad) */
- /* 89 */ "pad 1 (new age)",
- /* 90 */ "pad 2 (warm)",
- /* 91 */ "pad 3 (polysynth)",
- /* 92 */ "pad 4 (choir)",
- /* 93 */ "pad 5 (bowed)",
- /* 94 */ "pad 6 (metallic)",
- /* 95 */ "pad 7 (halo)",
- /* 96 */ "pad 8 (sweep)",
-
- /* (97-104 synth effects) */
- /* 97 */ "fx 1 (rain)",
- /* 98 */ "fx 2 (soundtrack)",
- /* 99 */ "fx 3 (crystal)",
- /* 100 */ "fx 4 (atmosphere)",
- /* 101 */ "fx 5 (brightness)",
- /* 102 */ "fx 6 (goblins)",
- /* 103 */ "fx 7 (echoes)",
- /* 104 */ "fx 8 (sci-fi)",
-
- /* (105-112 ethnic) */
- /* 105 */ "sitar",
- /* 106 */ "banjo",
- /* 107 */ "shamisen",
- /* 108 */ "koto",
- /* 109 */ "kalimba",
- /* 110 */ "bagpipe",
- /* 111 */ "fiddle",
- /* 112 */ "shanai",
-
- /* (113-120 percussive) */
- /* 113 */ "tinkle bell",
- /* 114 */ "agogo",
- /* 115 */ "steel drums",
- /* 116 */ "woodblock",
- /* 117 */ "taiko drum",
- /* 118 */ "melodic tom",
- /* 119 */ "synth drum",
- /* 120 */ "reverse cymbal",
-
- /* (121-128 sound effects) */
- /* 121 */ "guitar fret noise",
- /* 122 */ "breath noise",
- /* 123 */ "seashore",
- /* 124 */ "bird tweet",
- /* 125 */ "telephone ring",
- /* 126 */ "helicopter",
- /* 127 */ "applause",
- /* 128 */ "gunshot",
-        0
 /* default is usually piano */
 /* 0 */ "piano",
+
        /* (1-8 piano) */
        /* 1 */ "acoustic grand",
        /* 2 */ "bright acoustic",
        /* 3 */ "electric grand",
        /* 4 */ "honky-tonk",
        /* 5 */ "electric piano 1",
        /* 6 */ "electric piano 2",
        /* 7 */ "harpsichord",
        /* 8 */ "clav",
+
        /* (9-16 chrom percussion) */
        /* 9 */ "celesta",
        /* 10 */ "glockenspiel",
        /* 11 */ "music box",
        /* 12 */ "vibraphone",
        /* 13 */ "marimba",
        /* 14 */ "xylophone",
        /* 15 */ "tubular bells",
        /* 16 */ "dulcimer",
+
        /* (17-24 organ) */
        /* 17 */ "drawbar organ",
        /* 18 */ "percussive organ",
        /* 19 */ "rock organ",
        /* 20 */ "church organ",
        /* 21 */ "reed organ",
        /* 22 */ "accoridan",
        /* 23 */ "harmonica",
        /* 24 */ "tango accordian",
+
        /* (25-32 guitar) */
        /* 25 */ "acoustic guitar (nylon)",
        /* 26 */ "acoustic guitar (steel)",
        /* 27 */ "electric guitar (jazz)",
        /* 28 */ "electric guitar (clean)",
        /* 29 */ "electric guitar (muted)",
        /* 30 */ "overdriven guitar",
        /* 31 */ "distortion guitar",
        /* 32 */ "guitar harmonics",
+
        /* (33-40 bass) */
        /* 33 */ "acoustic bass",
        /* 34 */ "electric bass (finger)",
        /* 35 */ "electric bass (pick)",
        /* 36 */ "fretless bass",
        /* 37 */ "slap bass 1",
        /* 38 */ "slap bass 2",
        /* 39 */ "synth bass 1",
        /* 40 */ "synth bass 2",
+
        /* (41-48 strings) */
        /* 41 */ "violin",
        /* 42 */ "viola",
        /* 43 */ "cello",
        /* 44 */ "contrabass",
        /* 45 */ "tremolo strings",
        /* 46 */ "pizzicato strings",
        /* 47 */ "orchestral strings",
        /* 48 */ "timpani",
+
        /* (49-56 ensemble) */
        /* 49 */ "string ensemble 1",
        /* 50 */ "string ensemble 2",
        /* 51 */ "synthstrings 1",
        /* 52 */ "synthstrings 2",
        /* 53 */ "choir aahs",
        /* 54 */ "voice oohs",
        /* 55 */ "synth voice",
        /* 56 */ "orchestra hit",
+
        /* (57-64 brass) */
        /* 57 */ "trumpet",
        /* 58 */ "trombone",
        /* 59 */ "tuba",
        /* 60 */ "muted trumpet",
        /* 61 */ "french horn",
        /* 62 */ "brass section",
        /* 63 */ "synthbrass 1",
        /* 64 */ "synthbrass 2",
+
        /* (65-72 reed) */
        /* 65 */ "soprano sax",
        /* 66 */ "alto sax",
        /* 67 */ "tenor sax",
        /* 68 */ "baritone sax",
        /* 69 */ "oboe",
        /* 70 */ "english horn",
        /* 71 */ "bassoon",
        /* 72 */ "clarinet",
+
        /* (73-80 pipe) */
        /* 73 */ "piccolo",
        /* 74 */ "flute",
        /* 75 */ "recorder",
        /* 76 */ "pan flute",
        /* 77 */ "blown bottle",
        /* 78 */ "skakuhachi",
        /* 79 */ "whistle",
        /* 80 */ "ocarina",
+
        /* (81-88 synth lead) */
        /* 81 */ "lead 1 (square)",
        /* 82 */ "lead 2 (sawtooth)",
        /* 83 */ "lead 3 (calliope)",
        /* 84 */ "lead 4 (chiff)",
        /* 85 */ "lead 5 (charang)",
        /* 86 */ "lead 6 (voice)",
        /* 87 */ "lead 7 (fifths)",
        /* 88 */ "lead 8 (bass+lead)",
+
        /* (89-96 synth pad) */
        /* 89 */ "pad 1 (new age)",
        /* 90 */ "pad 2 (warm)",
        /* 91 */ "pad 3 (polysynth)",
        /* 92 */ "pad 4 (choir)",
        /* 93 */ "pad 5 (bowed)",
        /* 94 */ "pad 6 (metallic)",
        /* 95 */ "pad 7 (halo)",
        /* 96 */ "pad 8 (sweep)",
+
        /* (97-104 synth effects) */
        /* 97 */ "fx 1 (rain)",
        /* 98 */ "fx 2 (soundtrack)",
        /* 99 */ "fx 3 (crystal)",
        /* 100 */ "fx 4 (atmosphere)",
        /* 101 */ "fx 5 (brightness)",
        /* 102 */ "fx 6 (goblins)",
        /* 103 */ "fx 7 (echoes)",
        /* 104 */ "fx 8 (sci-fi)",
+
        /* (105-112 ethnic) */
        /* 105 */ "sitar",
        /* 106 */ "banjo",
        /* 107 */ "shamisen",
        /* 108 */ "koto",
        /* 109 */ "kalimba",
        /* 110 */ "bagpipe",
        /* 111 */ "fiddle",
        /* 112 */ "shanai",
+
        /* (113-120 percussive) */
        /* 113 */ "tinkle bell",
        /* 114 */ "agogo",
        /* 115 */ "steel drums",
        /* 116 */ "woodblock",
        /* 117 */ "taiko drum",
        /* 118 */ "melodic tom",
        /* 119 */ "synth drum",
        /* 120 */ "reverse cymbal",
+
        /* (121-128 sound effects) */
        /* 121 */ "guitar fret noise",
        /* 122 */ "breath noise",
        /* 123 */ "seashore",
        /* 124 */ "bird tweet",
        /* 125 */ "telephone ring",
        /* 126 */ "helicopter",
        /* 127 */ "applause",
        /* 128 */ "gunshot",
+         0
 }; 
 
 Midi_instrument::Midi_instrument (int channel_i, String instrument_str)
-    : Midi_item (0)
+  : Midi_item (0)
 {
-    instrument_str_ = instrument_str;
-    instrument_str_.to_lower();
-    channel_i_ = channel_i;
+  instrument_str_ = instrument_str;
+  instrument_str_.to_lower();
+  channel_i_ = channel_i;
 }
-                                      
+                                    
 String
 Midi_instrument::str() const
 {
-    Byte program_byte = 0;
-    for ( int i = 0; instrument_name_sz_a_[i]; i++)
-       if ( instrument_str_ == String (instrument_name_sz_a_[ i ])) { 
-           program_byte = (Byte)i;
-           break;
-       }
+  Byte program_byte = 0;
+  for ( int i = 0; instrument_name_sz_a_[i]; i++)
+    if ( instrument_str_ == String (instrument_name_sz_a_[ i ])) 
+      {
+       program_byte = (Byte)i;
+       break;
+      }
 
-    if ( !program_byte)
-       return String ("");
-
-    String str = String ((char)( 0xc0 + channel_i_) );
-    str += String ((char)program_byte);
-    return str;
+  String str = String ((char)( 0xc0 + channel_i_) );
+  str += String ((char)program_byte);
+  return str;
 }
 
 Midi_item::Midi_item (Audio_item* audio_item_l)
 {
-    audio_item_l_ = audio_item_l;
-    channel_i_ = 0;
+  audio_item_l_ = audio_item_l;
+  channel_i_ = 0;
 }
 
 void
 Midi_item::output (Midi_stream* midi_stream_l) const
 {
-    *midi_stream_l << str();
+  *midi_stream_l << str();
 }
 
 String
 Midi_item::i2varint_str (int i)
 {
-    int buffer_i = i & 0x7f;
-    while ( (i >>= 7) > 0) {
-       buffer_i <<= 8;
-       buffer_i |= 0x80;
-       buffer_i += (i & 0x7f);
+  int buffer_i = i & 0x7f;
+  while ( (i >>= 7) > 0) 
+    {
+      buffer_i <<= 8;
+      buffer_i |= 0x80;
+      buffer_i += (i & 0x7f);
     }
 
-    String str;
-    while ( 1) {
-       str += (char)buffer_i;
-       if ( buffer_i & 0x80)
-           buffer_i >>= 8;
-       else
-           break;
+  String str;
+  while ( 1) 
+    {
+      str += (char)buffer_i;
+      if ( buffer_i & 0x80)
+       buffer_i >>= 8;
+      else
+       break;
     }
-    return str;
+  return str;
 }
 
 Midi_key::Midi_key (Audio_item* audio_item_l)
-    : Midi_item (audio_item_l)
+  : Midi_item (audio_item_l)
 {
 }
 
 String
 Midi_key::str() const
 {
-    Key_change_req* k = audio_item_l_->req_l_->command()->keychange ();
-    int sharps_i = k->sharps_i();
-    int flats_i = k->flats_i();
+  Key_change_req* k = audio_item_l_->req_l_->command()->keychange ();
+  int sharps_i = k->sharps_i();
+  int flats_i = k->flats_i();
 
-    // midi cannot handle non-conventional keys
-    if ( flats_i && sharps_i)
-       return "";
-    int accidentals_i = sharps_i - flats_i;
+  // midi cannot handle non-conventional keys
+  if ( flats_i && sharps_i)
+    return "";
+  int accidentals_i = sharps_i - flats_i;
 
-    String str = "ff5902";
-    str += String_convert::i2hex_str (accidentals_i, 2, '0');
-    int minor_i = k->minor_b();
-    str += String_convert::i2hex_str (minor_i, 2, '0');
-    return String_convert::hex2bin_str (str);
+  String str = "ff5902";
+  str += String_convert::i2hex_str (accidentals_i, 2, '0');
+  int minor_i = k->minor_b();
+  str += String_convert::i2hex_str (minor_i, 2, '0');
+  return String_convert::hex2bin_str (str);
 }
 
 Midi_meter::Midi_meter (Audio_item* audio_item_l)
-    : Midi_item (audio_item_l)
+  : Midi_item (audio_item_l)
 {
-    clocks_per_1_i_ = 18;
+  clocks_per_1_i_ = 18;
 }
 
 String
 Midi_meter::str() const
 {
-    Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange ();
-    int num_i = m->beats_i_;
-    int den_i = m->one_beat_i_;
+  Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange ();
+  int num_i = m->beats_i_;
+  int den_i = m->one_beat_i_;
 
-    String str = "ff5804";
-    str += String_convert::i2hex_str (num_i, 2, '0');
-    str += String_convert::i2hex_str (intlog2( den_i) , 2, '0' );
-    str += String_convert::i2hex_str (clocks_per_1_i_, 2, '0');
-    str += String_convert::i2hex_str (8, 2, '0');
-    return String_convert::hex2bin_str (str);
+  String str = "ff5804";
+  str += String_convert::i2hex_str (num_i, 2, '0');
+  str += String_convert::i2hex_str (intlog2( den_i) , 2, '0' );
+  str += String_convert::i2hex_str (clocks_per_1_i_, 2, '0');
+  str += String_convert::i2hex_str (8, 2, '0');
+  return String_convert::hex2bin_str (str);
 }
 
 Midi_note::Midi_note (Audio_item* audio_item_l)
-    : Midi_item (audio_item_l)
+  : Midi_item (audio_item_l)
 {
-    dynamic_byte_ = 0x7f;
+  dynamic_byte_ = 0x7f;
 }
 
 Moment
 Midi_note::duration() const
 {
-    return audio_item_l_->req_l_->musical()->rhythmic ()->duration ();
+  return audio_item_l_->req_l_->musical()->rhythmic ()->duration ();
 }
 
 int
 Midi_note::pitch_i() const
 {
-    return audio_item_l_->req_l_->musical()->melodic ()->pitch ();
+  return audio_item_l_->req_l_->musical()->melodic ()->pitch ();
 }
 
 String
 Midi_note::str() const
 {
-    if ( pitch_i() == INT_MAX)
-       return String ("");
+  if ( pitch_i() == INT_MAX)
+    return String ("");
 
-    Byte status_byte = (char)( 0x90 + channel_i_);
+  Byte status_byte = (char)( 0x90 + channel_i_);
 
-    String str = String ((char)status_byte);
-    str += (char)( pitch_i() + c0_pitch_i_c_);
+  String str = String ((char)status_byte);
+  str += (char)( pitch_i() + c0_pitch_i_c_);
 
-    // poor man's staff dynamics:
-    str += (char)( dynamic_byte_ - 0x10 * channel_i_);
+  // poor man's staff dynamics:
+  str += (char)( dynamic_byte_ - 0x10 * channel_i_);
 
-    return str;
+  return str;
 }
 
 Midi_note_off::Midi_note_off (Midi_note* midi_note_l)
-    : Midi_item (midi_note_l->audio_item_l_)
+  : Midi_item (midi_note_l->audio_item_l_)
 {
-    // 0x64 is supposed to be neutral, but let's try
-    aftertouch_byte_ = 0x64;
-    channel_i_ = midi_note_l->channel_i_;
+  // 0x64 is supposed to be neutral, but let's try
+  aftertouch_byte_ = 0x64;
+  channel_i_ = midi_note_l->channel_i_;
 }
 
 int
 Midi_note_off::pitch_i() const
 {
-    return audio_item_l_->req_l_->musical()->melodic ()->pitch ();
+  return audio_item_l_->req_l_->musical()->melodic ()->pitch ();
 }
 
 String
 Midi_note_off::str() const
 {
-    if ( pitch_i() == INT_MAX)
-       return String ("");
+  if ( pitch_i() == INT_MAX)
+    return String ("");
 
-    Byte status_byte = (char)( 0x80 + channel_i_);
+  Byte status_byte = (char)( 0x80 + channel_i_);
 
-    String str = String ((char)status_byte);
-    str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_);
-    str += (char)aftertouch_byte_;
-    return str;
+  String str = String ((char)status_byte);
+  str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_);
+  str += (char)aftertouch_byte_;
+  return str;
 }
 
 Midi_tempo::Midi_tempo (Audio_item* audio_item_l)
-    : Midi_item (audio_item_l)
+  : Midi_item (audio_item_l)
 {
-    per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_;
+  per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_;
 }
 
 Midi_tempo::Midi_tempo (int per_minute_4_i)
-    : Midi_item (0)
+  : Midi_item (0)
 {
-    per_minute_4_i_ = per_minute_4_i;
+  per_minute_4_i_ = per_minute_4_i;
 }
 
 String
 Midi_tempo::str() const
 {
-    int useconds_per_4_i = 60 * (int)1e6 / per_minute_4_i_;
-    String str = "ff5103";
-    str += String_convert::i2hex_str (useconds_per_4_i, 6, '0');
-    return String_convert::hex2bin_str (str);
+  int useconds_per_4_i = 60 * (int)1e6 / per_minute_4_i_;
+  String str = "ff5103";
+  str += String_convert::i2hex_str (useconds_per_4_i, 6, '0');
+  return String_convert::hex2bin_str (str);
 }
 
 Midi_text::Midi_text (Audio_item* audio_item_l)
-    : Midi_item (audio_item_l)
+  : Midi_item (audio_item_l)
 {
-    text_str_ = ( (Audio_text*)audio_item_l_)->text_str_;
-    type_ = (Type)( (Audio_text*)audio_item_l_)->type_;
+  text_str_ = ( (Audio_text*)audio_item_l_)->text_str_;
+  type_ = (Type)( (Audio_text*)audio_item_l_)->type_;
 }
 
 Midi_text::Midi_text (Midi_text::Type type, String text_str)
-    : Midi_item (0)
+  : Midi_item (0)
 {
-    text_str_ = text_str;
-    type_ = type;
+  text_str_ = text_str;
+  type_ = type;
 }
 
 String
 Midi_text::str() const
 {
-    String str = "ff" + String_convert::i2hex_str (type_, 2, '0');
-    str = String_convert::hex2bin_str (str);
-    str += i2varint_str (text_str_.length_i());
-    str += text_str_;
-    return str;
+  String str = "ff" + String_convert::i2hex_str (type_, 2, '0');
+  str = String_convert::hex2bin_str (str);
+  str += i2varint_str (text_str_.length_i());
+  str += text_str_;
+  return str;
 }
 
 Midi_track::Midi_track()
-    : Midi_chunk()
+  : Midi_chunk()
 {
-//                4D 54 72 6B     MTrk
-//                00 00 00 3B     chunk length (59)
-//        00      FF 58 04 04 02 18 08    time signature
-//        00      FF 51 03 07 A1 20       tempo
+  //                4D 54 72 6B     MTrk
+  //                00 00 00 3B     chunk length (59)
+  //        00      FF 58 04 04 02 18 08    time signature
+  //        00      FF 51 03 07 A1 20       tempo
  
 // FF 59 02 sf mi  Key Signature
 //         sf = -7:  7 flats
@@ -487,47 +487,48 @@ Midi_track::Midi_track()
 //         mi = 0:  major key
 //         mi = 1:  minor key
 
-    number_i_ = 0;
+  number_i_ = 0;
        
-    char const* data_ch_C = ""
-//        "00" "ff58" "0404" "0218" "08"
-//     "00" "ff51" "0307" "a120"
-// why a key at all, in midi?
-// key: C
-//     "00" "ff59" "02" "00" "00"
-// key: F (scsii-menuetto)
-//                               "00" "ff59" "02" "ff" "00"
+  char const* data_ch_C = ""
+    //        "00" "ff58" "0404" "0218" "08"
+    // "00" "ff51" "0307" "a120"
+    // why a key at all, in midi?
+    // key: C
+    // "00" "ff59" "02" "00" "00"
+    // key: F (scsii-menuetto)
+    //                           "00" "ff59" "02" "ff" "00"
        ;
 
-    String data_str;
-    // only for format 0 (currently using format 1)?
-    data_str += String_convert::hex2bin_str (data_ch_C);
+  String data_str;
+  // only for format 0 (currently using format 1)?
+  data_str += String_convert::hex2bin_str (data_ch_C);
 
-    char const* footer_ch_C = "00" "ff2f" "00";
-    String footer_str = String_convert::hex2bin_str (footer_ch_C);
+  char const* footer_ch_C = "00" "ff2f" "00";
+  String footer_str = String_convert::hex2bin_str (footer_ch_C);
 
-    set ("MTrk", data_str, footer_str);
+  set ("MTrk", data_str, footer_str);
 }
 
 void 
 Midi_track::add (int delta_time_i, String event_str)
 {
-    if ( delta_time_i < 0) {
-       cout << String_convert::bin2hex_str (i2varint_str (delta_time_i) ) << endl;
-       cout << String_convert::bin2hex_str (event_str) << endl;
+  if ( delta_time_i < 0) 
+    {
+      cout << String_convert::bin2hex_str (i2varint_str (delta_time_i) ) << endl;
+      cout << String_convert::bin2hex_str (event_str) << endl;
     }
-    assert (delta_time_i >= 0);
-    assert(event_str.length_i());
-    Midi_chunk::add (i2varint_str (delta_time_i) + event_str );
+  assert (delta_time_i >= 0);
+  assert(event_str.length_i());
+  Midi_chunk::add (i2varint_str (delta_time_i) + event_str );
 }
 
 void 
 Midi_track::add (Moment delta_time_moment, Midi_item* mitem_l)
 {
-    // use convention of 384 clocks per 4
-    // use Duration_convert
-    int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4 );
-    // ? int ( delta_time_moment * 4 * 384) 
-    add (delta_time_i, mitem_l->str());
+  // use convention of 384 clocks per 4
+  // use Duration_convert
+  int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4 );
+  // ? int ( delta_time_moment * 4 * 384) 
+  add (delta_time_i, mitem_l->str());
 }
 
index fadd2f06f5e7ed9561e6b1fa1e4ca65295c46aef..5f1b3ee501652a6494d9463950ca771526014b7d 100644 (file)
 
 Midi_stream::Midi_stream (String filename_str)
 {
-    filename_str_ = filename_str;
-    os_p_ = 0;
-    open();
+  filename_str_ = filename_str;
+  os_p_ = 0;
+  open();
 }
 
 Midi_stream::~Midi_stream()
 {
-    delete os_p_;
+  delete os_p_;
 }
 
 Midi_stream&
 Midi_stream::operator <<( String str)
 {
-    if ( check_debug)
+  if ( check_debug)
        str = String_convert::bin2hex_str (str);
-    
-    *os_p_ << str;
+  
+  *os_p_ << str;
 
-    if ( check_debug)
-        *os_p_ << "\n";
+  if ( check_debug)
+      *os_p_ << "\n";
 
-    return *this;
+  return *this;
 }
 
 Midi_stream&
 Midi_stream::operator <<( Midi_item const& mitem_c_r)
 {
 //    *this << mitem_c_r.str();
-    mitem_c_r.output (this);
-    if ( check_debug)
-        *os_p_ << "\n";
-    return *this;
+  mitem_c_r.output (this);
+  if ( check_debug)
+      *os_p_ << "\n";
+  return *this;
 }
 
 Midi_stream&
 Midi_stream::operator <<( int i)
 {
-    // output binary string ourselves
-    *this << Midi_item::i2varint_str (i);
-    return *this;
+  // output binary string ourselves
+  *this << Midi_item::i2varint_str (i);
+  return *this;
 }
 
 void
 Midi_stream::open()
 {
-    os_p_ = new ofstream (filename_str_);
-    if ( !*os_p_)
+  os_p_ = new ofstream (filename_str_);
+  if ( !*os_p_)
        error ("can't open `" + filename_str_ + "\'");
 }
index 9c2d9ff75dd1f5d522aa555f11f93f2dab4459f9..aea8fcc0d7091e3ce3b423d155bbc821f0af05c0 100644 (file)
@@ -4,7 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-           Jan Nieuwenhuizen <jan@digicash.com>
+         Jan Nieuwenhuizen <jan@digicash.com>
  */
 
 #include "midi-walker.hh"
 
 Midi_note_event::Midi_note_event() 
 { 
-    ignore_b_ = false;
+  ignore_b_ = false;
 }
 
 int
 compare (Midi_note_event const& left, Midi_note_event const& right)
 {
-    return sign (left.key - right.key);
+  return sign (left.key - right.key);
 }
 
 Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l)
-    : PCursor<Audio_item*>( audio_staff_l->audio_item_l_list_)
+  : PCursor<Audio_item*>( audio_staff_l->audio_item_l_list_)
 {
-    track_l_ = track_l;
-    last_mom_ = 0;
+  track_l_ = track_l;
+  last_mom_ = 0;
 }
 
 Midi_walker::~Midi_walker()
 { 
-    // ugh
-    do_stop_notes (last_mom_ + Moment (10, 1) );
+  // ugh
+  do_stop_notes (last_mom_ + Moment (10, 1) );
 }
 
 /**
@@ -45,22 +45,24 @@ Midi_walker::~Midi_walker()
 void 
 Midi_walker::do_start_note (Midi_note* note_l)
 {
-    Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
-    for ( int i=0; i < stop_note_queue.size(); i++) {
-       if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) {
+  Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
+  for ( int i=0; i < stop_note_queue.size(); i++) 
+    {
+       if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) 
+         {
            if ( stop_note_queue[ i ].key < stop_mom)
                stop_note_queue[ i ].ignore_b_ = true;
            else // skip the stopnote 
                return; 
-       }
+         }
     }
 
-    Midi_note_event e;
-    e.val = new Midi_note_off (note_l);
-    e.key = stop_mom;
-    stop_note_queue.insert (e);
-    
-    output_event (ptr()->audio_column_l_->at_mom (), note_l);
+  Midi_note_event e;
+  e.val = new Midi_note_off (note_l);
+  e.key = stop_mom;
+  stop_note_queue.insert (e);
+  
+  output_event (ptr()->audio_column_l_->at_mom (), note_l);
 }
 
 /**
@@ -69,7 +71,8 @@ Midi_walker::do_start_note (Midi_note* note_l)
 void
 Midi_walker::do_stop_notes (Moment max_mom)
 {
-    while ( stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) {
+  while ( stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) 
+    {
        Midi_note_event e = stop_note_queue.get();
        if ( e.ignore_b_) 
            continue;
@@ -87,26 +90,26 @@ Midi_walker::do_stop_notes (Moment max_mom)
 void
 Midi_walker::output_event (Moment now_mom, Midi_item* l)
 {
-    Moment delta_t = now_mom - last_mom_ ;
-    last_mom_ += delta_t;
-    track_l_->add (delta_t, l);
+  Moment delta_t = now_mom - last_mom_ ;
+  last_mom_ += delta_t;
+  track_l_->add (delta_t, l);
 }
 
 void
 Midi_walker::process()
 {
-    do_stop_notes (ptr()->audio_column_l_->at_mom ());
+  do_stop_notes (ptr()->audio_column_l_->at_mom ());
 
-    Midi_item* p = ptr()->midi_item_p ();
-    if ( !p )
+  Midi_item* p = ptr()->midi_item_p ();
+  if ( !p )
        return;
-    p->channel_i_ = track_l_->number_i_;
-    
-    if ( p->name() != Midi_note::static_name ())
+  p->channel_i_ = track_l_->number_i_;
+  
+  if ( p->name() != Midi_note::static_name ())
        output_event (ptr()->audio_column_l_->at_mom (), p);
-    else
+  else
        do_start_note ((Midi_note*)p);
        
-    delete p;
+  delete p;
 }
 
index 946e27e4bb4025d8c88fc79da6c77e080cdb978f..d150d557926ecc4ecd7293a03659cd7c9666d81f 100644 (file)
 
 int
 intlog2(int d) {
-    int i=0;
-    while (!(d&1)) {
+  int i=0;
+  while (!(d&1)) 
+    {
        d/= 2;
        i++;
     }
-    assert (!(d/2));
-    return i;
+  assert (!(d/2));
+  return i;
 }
 
 double
 log_2(double x) {
-    return log (x)  /log (2.0);
+  return log (x)  /log (2.0);
 }
 
 #if 1
 Interval
 itemlist_width (const Array<Item*> &its)
 {
-    Interval iv ;
-    iv.set_empty();
-     
-    for (int j =0; j < its.size(); j++){
+  Interval iv ;
+  iv.set_empty();
+   
+  for (int j =0; j < its.size(); j++)
+    {
        iv.unite (its[j]->width());
 
     }
-    return iv;
+  return iv;
 }
 
 #endif
index 663a554e93a3a7e9c771b290b3dd4ea731e75f26..ad176da26fbcf6bc251e0b80d848b36b1cc19a78 100644 (file)
 String
 Molecule::TeX_string() const
 {
-    String s;
-    for (iter_top (ats,c); c.ok(); c++)
+  String s;
+  for (iter_top (ats,c); c.ok(); c++)
        s+=c->TeX_string();
-    return s;
+  return s;
 }
 
 Box
 Molecule::extent() const
 {
-    Box b;
-    for (iter_top (ats,c); c.ok(); c++)
+  Box b;
+  for (iter_top (ats,c); c.ok(); c++)
        b.unite (c->extent());
-    return b;
+  return b;
 }
 
 void
 Molecule::translate (Offset o)
 {
-    for (iter_top (ats,c); c.ok(); c++)
+  for (iter_top (ats,c); c.ok(); c++)
        c->translate (o);
 }
 
 void
 Molecule::translate (Real x,Axis a)
 {
-    for (iter_top (ats,c); c.ok(); c++)
+  for (iter_top (ats,c); c.ok(); c++)
        c->translate (x,a);
 }
 
 void
 Molecule::add (Molecule const &m)
 {
-    for (iter_top (m.ats,c); c.ok(); c++) {
+  for (iter_top (m.ats,c); c.ok(); c++) 
+    {
        add (**c);
     }
 }
@@ -57,78 +58,82 @@ Molecule::add (Molecule const &m)
 void
 Molecule::add_right (Molecule const &m)
 {
-     if (!ats.size()) {
+   if (!ats.size()) 
+     {
        add (m);
        return;
     }
-     Real xof=extent().x ().right - m.extent ().x ().left;
+   Real xof=extent().x ().right - m.extent ().x ().left;
  
-     
-    Molecule toadd (m);
-    toadd.translate (Offset (xof, 0.0));
-    add (toadd);
+   
+  Molecule toadd (m);
+  toadd.translate (Offset (xof, 0.0));
+  add (toadd);
 }
 
 void
 Molecule::add_left (Molecule const &m)
 {
-    if (!ats.size()) {
+  if (!ats.size()) 
+    {
        add (m);
        return;
     }
   Real xof=extent().x ().left - m.extent ().x ().right;
    
-    Molecule toadd (m);
-    toadd.translate (Offset (xof, 0.0));
-    add (toadd);
+  Molecule toadd (m);
+  toadd.translate (Offset (xof, 0.0));
+  add (toadd);
 }
 
 
 void
 Molecule::add_top (Molecule const &m)
 {
-      if (!ats.size()) {
+    if (!ats.size()) 
+      {
        add (m);
        return;
     }
    Real yof=extent().y ().right - m.extent ().y ().left;
 
-    Molecule toadd (m);
-    toadd.translate (yof, Y_AXIS);
-    add (toadd);
+  Molecule toadd (m);
+  toadd.translate (yof, Y_AXIS);
+  add (toadd);
 }
 
 void
 Molecule::add_bottom (Molecule const &m)
 {
-    if (!ats.size()) {
+  if (!ats.size()) 
+    {
        add (m);
        return;
     }
-     Real yof=extent().y ().left- m.extent ().y ().right;
-    Molecule toadd (m);
-    toadd.translate (yof, Y_AXIS);
-    add (toadd);
+   Real yof=extent().y ().left- m.extent ().y ().right;
+  Molecule toadd (m);
+  toadd.translate (yof, Y_AXIS);
+  add (toadd);
 }
 
 void
 Molecule::operator = (Molecule const &)
 {
-    assert (false);
+  assert (false);
 }
 
 Molecule::Molecule (Molecule const &s)
 {
-    add (s);
+  add (s);
 }
 
 void
 Molecule::print() const
 {
 #ifndef NPRINT
-    if (! check_debug)
+  if (! check_debug)
        return;
-    for (iter_top (ats,c); c.ok(); c++)
+  for (iter_top (ats,c); c.ok(); c++)
        c->print();
 #endif
 }
@@ -136,5 +141,5 @@ Molecule::print() const
 void
 Molecule::add (Atom const &a)
 {
-    ats.bottom().add (new Atom (a)); 
+  ats.bottom().add (new Atom (a)); 
 }
index 23143201653c39b790a3d4e3394dd0aca4741e75..56a6476ff6d379d3e4782d88e729af88d939756a 100644 (file)
@@ -29,60 +29,60 @@ void
 Music_iterator::print() const
 {
 #ifndef NPRINT
-    if ( !check_debug)
+  if ( !check_debug)
        return ;
-    DOUT << name() << "{";
-    DOUT << "report to " << 
+  DOUT << name() << "{";
+  DOUT << "report to " << 
        report_to_l() << " (" << report_to_l ()->name () << ")\n";
-    DOUT << "next at " << next_moment() << " ";
-    do_print();
-    DOUT << "}\n";
+  DOUT << "next at " << next_moment() << " ";
+  do_print();
+  DOUT << "}\n";
 #endif
 }
 
 Translator *
 Music_iterator::get_req_translator_l()
 {
-    assert (report_to_l());
-    if (report_to_l()->is_bottom_engraver_b ())
+  assert (report_to_l());
+  if (report_to_l()->is_bottom_engraver_b ())
        return report_to_l();
 
-    set_translator (report_to_l()->get_default_interpreter ());
-    return report_to_l();
+  set_translator (report_to_l()->get_default_interpreter ());
+  return report_to_l();
 }
 
 void
 Music_iterator::push_translator (Translator*t)
 {
-    report_to_l_arr_.push (t);
-    t->iterator_count_ ++;
+  report_to_l_arr_.push (t);
+  t->iterator_count_ ++;
 }
 
 void
 Music_iterator::pop_translator()
 {
-    report_to_l()->iterator_count_ --;
-    assert (report_to_l()->iterator_count_ >=0);
-    report_to_l_arr_.pop();
+  report_to_l()->iterator_count_ --;
+  assert (report_to_l()->iterator_count_ >=0);
+  report_to_l_arr_.pop();
 }
 
 Translator* 
 Music_iterator::report_to_l()const
 {
-    if (! report_to_l_arr_.size())
+  if (! report_to_l_arr_.size())
        return 0;
-    return report_to_l_arr_.top();
+  return report_to_l_arr_.top();
 }
 
 
 void
 Music_iterator::set_translator (Translator*trans)
 {   
-    if (report_to_l()==trans)
+  if (report_to_l()==trans)
        return;
-    if ( report_to_l())
+  if ( report_to_l())
        pop_translator();
-    if (trans)
+  if (trans)
        push_translator (trans);
 }
 
@@ -94,86 +94,90 @@ Music_iterator::construct_children()
 
 Music_iterator::~Music_iterator()
 {
-    set_translator (0);
+  set_translator (0);
 }
 
 Moment
 Music_iterator::next_moment()const
 {
-    return 0;
+  return 0;
 }
 
 void
 Music_iterator::process_and_next (Moment)
 {
-    first_b_ = false;
+  first_b_ = false;
 }
 
 bool
 Music_iterator::ok()const
 {
-    return first_b_;
+  return first_b_;
 }
 
 Music_iterator*
 Music_iterator::static_get_iterator_p (Music *m,
                                      Translator *report_l)
 {
-    Music_iterator * p =0;
-    if (m->is_type_b (Request_chord::static_name()))
+  Music_iterator * p =0;
+  if (m->is_type_b (Request_chord::static_name()))
        p = new Request_chord_iterator ((Request_chord*) m);
-    else if (m->is_type_b (Chord::static_name())) 
+  else if (m->is_type_b (Chord::static_name())) 
        p =  new Chord_iterator ((Chord*) m);
-    else if (m->is_type_b (Voice::static_name())) 
+  else if (m->is_type_b (Voice::static_name())) 
        p =  new Voice_iterator ((Voice*) m);
-    
-    if (m -> type_str_ != "") {
+  
+  if (m -> type_str_ != "") 
+    {
        Translator * a =report_l->
            find_get_translator_l (m-> type_str_, m->id_str_);
            p->set_translator (a);
-    } 
+    }
 
 
-    if (! p->report_to_l())
+  if (! p->report_to_l())
         p ->set_translator (report_l);
-    
-    return p;
+  
+  return p;
 }
 
 Music_iterator*
 Music_iterator::get_iterator_p (Music*m)const
 {
-    Music_iterator*p = static_get_iterator_p (m,report_to_l());
-    p->daddy_iter_l_ = (Music_iterator*)this;
-    p->construct_children();
-    return p;
+  Music_iterator*p = static_get_iterator_p (m,report_to_l());
+  p->daddy_iter_l_ = (Music_iterator*)this;
+  p->construct_children();
+  return p;
 }
 
 Music_iterator::Music_iterator()
 {
-    daddy_iter_l_ =0;
-    first_b_ = true;
+  daddy_iter_l_ =0;
+  first_b_ = true;
 }
 
 /* ************** */
 
 Chord_iterator::Chord_iterator (Chord const *chord_C)
 {
-    chord_C_ = chord_C;
+  chord_C_ = chord_C;
 }
 
 void
 Chord_iterator::construct_children()
 {
-    int j = 0;
-    for (PCursor<Music*> i (chord_C_->music_p_list_.top());  //, int j = 0; 
-       i.ok(); j++, i++) {
+  int j = 0;
+  for (PCursor<Music*> i (chord_C_->music_p_list_.top());  //, int j = 0; 
+       i.ok(); j++, i++) 
+         {
        Music_iterator * mi =  get_iterator_p (i.ptr());
-       if ( mi->ok()) {
+       if ( mi->ok()) 
+         {
            set_translator (mi->report_to_l()->ancestor_l (
                chord_C_->multi_level_i_) );
            children_p_list_.bottom().add (mi);
-       } else 
+         }
+       else 
            delete mi;
     }
 }
@@ -181,7 +185,8 @@ void
 Chord_iterator::do_print() const
 {
 #ifndef NPRINT
-    for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++) {
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++) 
+    {
        i->print();
     }
 #endif
@@ -190,16 +195,18 @@ Chord_iterator::do_print() const
 void
 Chord_iterator::process_and_next (Moment until)
 {
-    for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();) {
-       if  (i->next_moment() == until) {
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok ();) 
+    {
+       if  (i->next_moment() == until) 
+         {
            i->process_and_next (until);
-       }
+         }
        if (!i->ok()) 
            delete i.remove_p();
        else
            i++;
     }
-    Music_iterator::process_and_next (until);
+  Music_iterator::process_and_next (until);
 }
 
 
@@ -208,10 +215,10 @@ IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator);
 Moment
 Chord_iterator::next_moment()const
 {
-    Moment next_ = infinity_mom;
-    for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
+  Moment next_ = infinity_mom;
+  for (PCursor<Music_iterator*> i (children_p_list_.top()); i.ok (); i++)
        next_ = next_ <? i->next_moment() ;
-    return next_;
+  return next_;
 }
 
 
@@ -219,7 +226,7 @@ Chord_iterator::next_moment()const
 bool
 Chord_iterator::ok()const
 {
-    return children_p_list_.size();
+  return children_p_list_.size();
 }
 
 /* ************** */
@@ -227,60 +234,64 @@ Chord_iterator::ok()const
 void
 Voice_iterator::do_print()const
 {
-    if (iter_p_)
+  if (iter_p_)
        iter_p_->print();
 }
 
 Voice_iterator::Voice_iterator (Voice const*v)
-    : PCursor<Music*> ( v->music_p_list_)
+  : PCursor<Music*> ( v->music_p_list_)
 {
-    here_mom_ = v->offset_mom_;
-    voice_C_ = v;
-    iter_p_ =0;
+  here_mom_ = v->offset_mom_;
+  voice_C_ = v;
+  iter_p_ =0;
 }
 
 void
 Voice_iterator::construct_children()
 {
-    while (PCursor<Music*>::ok()) {
+  while (PCursor<Music*>::ok()) 
+    {
        start_next_element();
-       if ( !iter_p_->ok()) {
+       if ( !iter_p_->ok()) 
+         {
            leave_element();
-       } else {
+         }
+       else 
+         {
            set_voice_translator();
            break;
-       }
+         }
     }
 }
 
 void 
 Voice_iterator::leave_element()
 {
-    delete iter_p_;
-    iter_p_ =0;
-    MInterval elt_time = ptr()->time_int ();
-    if (!elt_time.empty_b())
+  delete iter_p_;
+  iter_p_ =0;
+  MInterval elt_time = ptr()->time_int ();
+  if (!elt_time.empty_b())
        here_mom_ += elt_time.length();
-    PCursor<Music*>::next();
+  PCursor<Music*>::next();
 }
 
 void
 Voice_iterator::start_next_element()
 {
-    assert (!iter_p_);
-    iter_p_ = get_iterator_p (ptr());
+  assert (!iter_p_);
+  iter_p_ = get_iterator_p (ptr());
 }
 
 void
 Voice_iterator::set_voice_translator()
 {
-    if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
+  if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ())
        set_translator (iter_p_->report_to_l());
 }
 
 Voice_iterator::~Voice_iterator()
 {
-    assert (! iter_p_);
+  assert (! iter_p_);
 }
 
 
@@ -289,42 +300,48 @@ IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator);
 void
 Voice_iterator::process_and_next (Moment until)
 {
-    while (1) {
+  while (1) 
+    {
        Moment local_until = until - here_mom_;
-       while ( iter_p_->ok()) {
+       while ( iter_p_->ok()) 
+         {
            Moment here = iter_p_->next_moment();
            if (here != local_until)
                goto loopexit;
            
            iter_p_->process_and_next (local_until);
-       }
+         }
 
-       if (!iter_p_->ok()) {
+       if (!iter_p_->ok()) 
+         {
            leave_element();
-           if ( PCursor<Music*>::ok()) {
+           if ( PCursor<Music*>::ok()) 
+             {
                start_next_element();
                set_voice_translator();
-           } else {
+             }
+           else 
+             {
                goto loopexit;
-           }
-       }
+             }
+         }
     }
 
 loopexit:
 
-    Music_iterator::process_and_next (until);
+  Music_iterator::process_and_next (until);
 }
 
 Moment
 Voice_iterator::next_moment()const
 {
-    return iter_p_->next_moment() + here_mom_;
+  return iter_p_->next_moment() + here_mom_;
 }
 
 bool
 Voice_iterator::ok()const
 {
-    return iter_p_;
+  return iter_p_;
 }
 
 
@@ -333,21 +350,21 @@ IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator);
 void
 Request_chord_iterator::construct_children()
 {
-    get_req_translator_l();
+  get_req_translator_l();
 }
 
 Request_chord_iterator::Request_chord_iterator (Request_chord*el_l)
 {
-    elt_l_ = el_l;
-    elt_duration_ = el_l->time_int().length (); 
-    last_b_ = false;
+  elt_l_ = el_l;
+  elt_duration_ = el_l->time_int().length (); 
+  last_b_ = false;
 }
 
 
 bool
 Request_chord_iterator::ok()const
 {
-    return (elt_duration_ && !last_b_) || first_b_; 
+  return (elt_duration_ && !last_b_) || first_b_; 
 }
 
 
@@ -355,34 +372,36 @@ Request_chord_iterator::ok()const
 Moment
 Request_chord_iterator::next_moment()const
 {
-    Moment m (0);
-    if  (!first_b_) 
+  Moment m (0);
+  if  (!first_b_) 
        m = elt_duration_;
-    return m;
+  return m;
 }
 
 void
 Request_chord_iterator::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "duration: " << elt_duration_;
+  DOUT << "duration: " << elt_duration_;
 #endif
 }
 void
 Request_chord_iterator::process_and_next (Moment mom)
 {
-    if ( first_b_) {
-       for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++) {
+  if ( first_b_) 
+    {
+       for (PCursor<Music*> i (elt_l_->music_p_list_); i.ok(); i++) 
+         {
            assert (i->is_type_b (Request::static_name()));
            Request * req_l = (Request*)i.ptr();
            bool gotcha = report_to_l()->try_request (req_l);
            if (!gotcha)
                req_l->warning ("Junking request: " + String (req_l->name()));
 
-       }
+         }
        first_b_ = false;
     }
 
-    if ( mom >= elt_duration_)
+  if ( mom >= elt_duration_)
        last_b_ = true;  
 }
index 8fd903f0d30b991605bec4ee933d05e86eed5079..ad10bce46e277864fad7bb445557610a3d89543d 100644 (file)
 #include "music-list.hh"
 
 Music_list::Music_list (Music_list const&s)
-    : Music (s)
+  : Music (s)
 {
-    multi_level_i_ = s.multi_level_i_;   
-    for (iter (s.music_p_list_.top(), i); i.ok (); i++)
+  multi_level_i_ = s.multi_level_i_;   
+  for (iter (s.music_p_list_.top(), i); i.ok (); i++)
        add (i->clone());
 }
 
@@ -27,17 +27,17 @@ IMPLEMENT_IS_TYPE_B1(Chord,Music_list);
 MInterval
 Chord::time_int()const
 {
-    MInterval m;
-    for (iter (music_p_list_.top(), i); i.ok (); i++)
+  MInterval m;
+  for (iter (music_p_list_.top(), i); i.ok (); i++)
        m.unite (i->time_int());
 
-    return m;
+  return m;
 }
 
 void
 Chord::translate (Moment m)
 {
-    for (iter (music_p_list_.top(), i); i.ok (); i++)
+  for (iter (music_p_list_.top(), i); i.ok (); i++)
        i->translate (m); 
 }
 
@@ -48,51 +48,52 @@ Chord::Chord()
 
 Voice::Voice()
 {
-    offset_mom_ =0;
+  offset_mom_ =0;
 }
 
 MInterval
 Voice::time_int() const
 {
-    Moment last=0;
-    for (iter (music_p_list_.top(), i); i.ok (); i++) {
+  Moment last=0;
+  for (iter (music_p_list_.top(), i); i.ok (); i++) 
+    {
        MInterval interval = i->time_int();
        
-        /*
+      /*
          c4 <> c4
-        */
+      */
        if ( !interval.empty_b())
            last += interval.length();
     }
-    return  offset_mom_ + MInterval (0,last);
+  return  offset_mom_ + MInterval (0,last);
 }
 
 void
 Voice::translate (Moment dt)
 {
-    offset_mom_ += dt;
+  offset_mom_ += dt;
 }
 
 
 Music_list::Music_list()
 {
-    multi_level_i_ = 0;
+  multi_level_i_ = 0;
 }
 
 void
 Music_list::add (Music*m_p)
 {
-    if (!m_p)
+  if (!m_p)
        return;
 
-    m_p->parent_music_l_ = this;
-    music_p_list_.bottom().add (m_p);
+  m_p->parent_music_l_ = this;
+  music_p_list_.bottom().add (m_p);
 }
 
 void
 Music_list::transpose (Melodic_req const*rq)
 {
-    for (iter (music_p_list_.top(),i); i.ok (); i++)
+  for (iter (music_p_list_.top(),i); i.ok (); i++)
        i->transpose (rq);    
 }
 
@@ -100,7 +101,7 @@ void
 Music_list::do_print()const
 {
 #ifndef NPRINT
-    for (iter (music_p_list_.top(),i); i.ok (); i++)
+  for (iter (music_p_list_.top(),i); i.ok (); i++)
        i->print();
 #endif 
 }
@@ -110,5 +111,5 @@ IMPLEMENT_IS_TYPE_B1(Request_chord, Chord);
 
 Request_chord::Request_chord()
 {
-    multi_level_i_ =0;
+  multi_level_i_ =0;
 }
index b9dcde679dfd31b698d4939024957e4f69e06f59..6cd34fc2a0ed8f91abf96da7a58b671ed09fefe2 100644 (file)
 MInterval
 Music::time_int() const
 {
-    return MInterval (0,0);
+  return MInterval (0,0);
 }
 
 void
 Music::print()const
 {
 #ifndef NPRINT
-    if ( ! check_debug)
+  if ( ! check_debug)
        return ;
-    DOUT << name() << "{";
-    if  (type_str_!="" || id_str_!="")
+  DOUT << name() << "{";
+  if  (type_str_!="" || id_str_!="")
        DOUT << "`" <<type_str_ << " = " << id_str_<<"\'";
-    do_print();
-    DOUT << "}\n";
+  do_print();
+  DOUT << "}\n";
 #endif
 }
 
 void
 Music::transpose (Melodic_req const*)
 {
-    
+  
 }
 
 void
@@ -52,10 +52,10 @@ IMPLEMENT_IS_TYPE_B(Music);
 
 
 
-    
+  
 Music::Music()
 {
-    parent_music_l_ =0;
+  parent_music_l_ =0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Change_reg,Music)
index 8efe633200da4111dbe50352f0d88b65043876b1..4924a934be1b6246489ee83b5d35cc902e0080d9 100644 (file)
@@ -20,14 +20,14 @@ void
 Stem_req::do_print() const
 {
 #ifndef NPRINT
-    Rhythmic_req::do_print();
-    DOUT << "dir : " << dir_i_;
+  Rhythmic_req::do_print();
+  DOUT << "dir : " << dir_i_;
 #endif
 }
 
 Stem_req::Stem_req()
 {
-    dir_i_ = 0;
+  dir_i_ = 0;
 }
 
 /* ************** */
@@ -50,15 +50,15 @@ void
 Span_req::do_print() const    
 {
 #ifndef NPRINT
-    DOUT << spantype ;
+  DOUT << spantype ;
 #endif
 }
 
 Spacing_req::Spacing_req()
 {
-    next = 0;
-    distance = 0;
-    strength = 0;
+  next = 0;
+  distance = 0;
+  strength = 0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Spacing_req,Request);
@@ -67,7 +67,7 @@ void
 Spacing_req::do_print()const
 {
 #ifndef NPRINT
-    DOUT << "next " << next << "dist " << distance << "strength\n";
+  DOUT << "next " << next << "dist " << distance << "strength\n";
 #endif
 }
 
@@ -77,34 +77,36 @@ IMPLEMENT_IS_TYPE_B2(Blank_req,Spacing_req,Rhythmic_req);
 void
 Blank_req::do_print()const
 {
-    Spacing_req::do_print();
+  Spacing_req::do_print();
 }
 /* *************** */
 
 Melodic_req::Melodic_req()
 {
-    notename_i_ = 0;
-    octave_i_ = 0;
-    accidental_i_ = 0;
+  notename_i_ = 0;
+  octave_i_ = 0;
+  accidental_i_ = 0;
 }
 
 void
 Melodic_req::transpose (Melodic_req const & delta)
 {
-    int old_pitch = pitch();
-    int delta_pitch = delta.pitch();
-    octave_i_ += delta.octave_i_;
-    notename_i_ += delta.notename_i_;
-    while  (notename_i_ >= 7) {
+  int old_pitch = pitch();
+  int delta_pitch = delta.pitch();
+  octave_i_ += delta.octave_i_;
+  notename_i_ += delta.notename_i_;
+  while  (notename_i_ >= 7) 
+    {
        notename_i_ -= 7;
        octave_i_ ++;
     }
 
-    int new_pitch = pitch();
-    int delta_acc = new_pitch - old_pitch - delta_pitch;
-    
-    accidental_i_ -= delta_acc;
-    if (abs (accidental_i_) > 2) {
+  int new_pitch = pitch();
+  int delta_acc = new_pitch - old_pitch - delta_pitch;
+  
+  accidental_i_ -= delta_acc;
+  if (abs (accidental_i_) > 2) 
+    {
        delta.warning ("transposition makes accidental larger than 2");
     }
 }
@@ -114,31 +116,31 @@ IMPLEMENT_IS_TYPE_B1(Melodic_req,Musical_req);
 bool
 Melodic_req::do_equal_b (Request*r)const
 {
-    Melodic_req* m= r->musical()->melodic ();
-    return !compare (*m, *this);
+  Melodic_req* m= r->musical()->melodic ();
+  return !compare (*m, *this);
 }
 
 int
 Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2)
 {
-    int o=  m1.octave_i_ - m2.octave_i_;
-    int n = m1.notename_i_ - m2.notename_i_;
-    int a = m1.accidental_i_ - m2.accidental_i_;
-    
-    if (o)
+  int o=  m1.octave_i_ - m2.octave_i_;
+  int n = m1.notename_i_ - m2.notename_i_;
+  int a = m1.accidental_i_ - m2.accidental_i_;
+  
+  if (o)
        return o;
-    if ( n)
+  if ( n)
        return n;
-    if (a)
+  if (a)
        return a;
-    return 0;
+  return 0;
 }
 
 void
 Melodic_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "notename: " << notename_i_ 
+  DOUT << "notename: " << notename_i_ 
         << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
 #endif
 }
@@ -146,7 +148,7 @@ Melodic_req::do_print() const
 int
 Melodic_req::height() const
 {
-    return  notename_i_ + octave_i_*7;
+  return  notename_i_ + octave_i_*7;
 }
 
 /*
@@ -157,28 +159,28 @@ static Byte pitch_byte_a[  ] = { 0, 2, 4, 5, 7, 9, 11 };
 int
 Melodic_req::pitch() const
 {
-    return  pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
+  return  pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
 }
 
 /* *************** */
 int
 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
 {
-    return (r1.duration() - r2.duration ());
+  return (r1.duration() - r2.duration ());
 }
 
 bool
 Rhythmic_req::do_equal_b (Request*r)const
 {
-    Rhythmic_req* rh = r->musical()->rhythmic ();
+  Rhythmic_req* rh = r->musical()->rhythmic ();
 
-    return !compare (*this, *rh);
+  return !compare (*this, *rh);
 }
 
 void
 Rhythmic_req::set_duration (Duration d)
 {
-    duration_ = d;
+  duration_ = d;
 }
 
 Rhythmic_req::Rhythmic_req()
@@ -192,22 +194,22 @@ void
 Rhythmic_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "duration { " <<duration_.str() << "}";
+  DOUT << "duration { " <<duration_.str() << "}";
 #endif
 }
 
 
 Moment
 Rhythmic_req::duration() const {    
-    return duration_.length();
+  return duration_.length();
 }
 /* *************** */
 
 Lyric_req::Lyric_req (Text_def* def_p)
-    :Text_req (0, def_p)
+  :Text_req (0, def_p)
 {
-    def_p->align_i_ = 0;       // centre
-    dir_i_ = -1;               // lyrics below (invisible) staff
+  def_p->align_i_ = 0; // centre
+  dir_i_ = -1;         // lyrics below (invisible) staff
 }
 
 
@@ -216,21 +218,21 @@ IMPLEMENT_IS_TYPE_B2(Lyric_req,Musical_req,Rhythmic_req);
 void
 Lyric_req::do_print() const
 {    
-    Rhythmic_req::do_print();
-    Text_req::do_print();
+  Rhythmic_req::do_print();
+  Text_req::do_print();
 }
 
 /* *************** */
 bool
 Note_req::do_equal_b (Request*r)const
 {
-    return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r);
+  return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r);
 }
 
 
 Note_req::Note_req()
 {
-    forceacc_b_ = false;
+  forceacc_b_ = false;
 }
 
 IMPLEMENT_IS_TYPE_B2(Note_req,Melodic_req,Rhythmic_req);
@@ -239,11 +241,12 @@ void
 Note_req::do_print() const
 {
 #ifndef NPRINT
-    Melodic_req::do_print();
-    if (forceacc_b_) {
+  Melodic_req::do_print();
+  if (forceacc_b_) 
+    {
        DOUT << " force accidental\n";
     }
-    Rhythmic_req::do_print();
+  Rhythmic_req::do_print();
 #endif
 }
 /* *************** */
@@ -253,13 +256,13 @@ IMPLEMENT_IS_TYPE_B1(Rest_req,Rhythmic_req);
 void
 Rest_req::do_print() const
 {
-        Rhythmic_req::do_print();
+      Rhythmic_req::do_print();
 }
 
 /* *************** */
 Beam_req::Beam_req()
 {
-    nplet = 0;
+  nplet = 0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req);
@@ -276,20 +279,20 @@ Slur_req::do_print()const{}
 bool
 Span_req:: do_equal_b (Request*r)const
 {
-    Span_req * s = r->span();
-    return spantype - s->spantype;
+  Span_req * s = r->span();
+  return spantype - s->spantype;
 }
 
 Span_req::Span_req()
 {
-    spantype = NOSPAN;
+  spantype = NOSPAN;
 }
 
 /* *************** */
 Script_req::Script_req (Script_req const&s)
 {
-    dir_i_ = s.dir_i_;
-    scriptdef_p_ = s.scriptdef_p_ ? s.scriptdef_p_->clone() : 0;
+  dir_i_ = s.dir_i_;
+  scriptdef_p_ = s.scriptdef_p_ ? s.scriptdef_p_->clone() : 0;
 }
 
 /*
@@ -300,15 +303,15 @@ Script_req::Script_req (Script_req const&s)
 bool
 Script_req::do_equal_b (Request*r)const
 {
-    Script_req * s = r->script();
-    
-    return  scriptdef_p_->equal_b (*s->scriptdef_p_);
+  Script_req * s = r->script();
+  
+  return  scriptdef_p_->equal_b (*s->scriptdef_p_);
 }
 
 Script_req::Script_req()
 {
-    dir_i_ = 0;
-    scriptdef_p_ = 0;
+  dir_i_ = 0;
+  scriptdef_p_ = 0;
 }
 
 
@@ -318,15 +321,15 @@ void
 Script_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << " dir " << dir_i_ ;
-    scriptdef_p_->print();
+  DOUT << " dir " << dir_i_ ;
+  scriptdef_p_->print();
 #endif
 }
 
 void
 Musical_script_req::do_print() const
 {
-    Script_req::do_print();
+  Script_req::do_print();
 }
 
 
@@ -335,27 +338,27 @@ IMPLEMENT_IS_TYPE_B2(Musical_script_req,Musical_req, Script_req);
 
 Script_req::~Script_req()
 {
-    delete scriptdef_p_;
+  delete scriptdef_p_;
 }
 /* *************** */
 
 
 Text_req::~Text_req()
 {
-    delete tdef_p_;
-    tdef_p_ = 0;
+  delete tdef_p_;
+  tdef_p_ = 0;
 }
 
 Text_req::Text_req (Text_req const& src)
 {
-    tdef_p_ = new Text_def (*src.tdef_p_);
-    dir_i_ = src.dir_i_;
+  tdef_p_ = new Text_def (*src.tdef_p_);
+  dir_i_ = src.dir_i_;
 }
 
 Text_req::Text_req (int dir_i, Text_def* tdef_p)       
 {
-    dir_i_ = dir_i;
-    tdef_p_ = tdef_p;
+  dir_i_ = dir_i;
+  tdef_p_ = tdef_p;
 }
 
 
@@ -365,8 +368,8 @@ void
 Text_req::do_print() const
 {
 #ifndef NPRINT
-    DOUT << " dir " << dir_i_ ;
-    tdef_p_->print();
+  DOUT << " dir " << dir_i_ ;
+  tdef_p_->print();
 #endif
 }
 
@@ -380,7 +383,7 @@ Skip_req::do_print() const
 {
 #ifndef NPRINT
 
-    DOUT << "duration: " << duration();
+  DOUT << "duration: " << duration();
 #endif
 }
 
@@ -391,7 +394,7 @@ IMPLEMENT_IS_TYPE_B1(Dynamic_req,Musical_req);
 void
 Dynamic_req::do_print() const
 {
-    Musical_req::do_print();
+  Musical_req::do_print();
 }
 
 
@@ -401,37 +404,38 @@ void
 Absolute_dynamic_req::do_print() const
 {
 #ifndef NPRINT
-    Dynamic_req::do_print();
-    DOUT << " loudness " <<loudness_str (loudness_);
+  Dynamic_req::do_print();
+  DOUT << " loudness " <<loudness_str (loudness_);
 #endif
 }
 
 String
 Dynamic_req::loudness_str (Loudness l) 
 {
-    switch (l) {
-    case FFF: return "fff";
-    case FF: return "ff";
-    case F: return "f";
-    case MF: return "mf";
-    case MP: return "mp";
-    case P: return "p";
-    case PP: return "pp";
-    case PPP: return "ppp";
+  switch (l) 
+    {
+  case FFF: return "fff";
+  case FF: return "ff";
+  case F: return "f";
+  case MF: return "mf";
+  case MP: return "mp";
+  case P: return "p";
+  case PP: return "pp";
+  case PPP: return "ppp";
     }
-    assert (false);
-    return "";
+  assert (false);
+  return "";
 }
 
 Absolute_dynamic_req::Absolute_dynamic_req()
 {
-    loudness_ = MF;
+  loudness_ = MF;
 }
 
 
 Span_dynamic_req::Span_dynamic_req()
 {
-    dynamic_dir_i_  = 0;
+  dynamic_dir_i_  = 0;
 }
 
 
@@ -441,8 +445,8 @@ void
 Span_dynamic_req::do_print()const
 {
 #ifndef NPRINT
-    Span_req::do_print();
-    DOUT << "louder/louder: " <<dynamic_dir_i_;
+  Span_req::do_print();
+  DOUT << "louder/louder: " <<dynamic_dir_i_;
 #endif
 }
 
index 1160b86af148ea0625f1ca443f478e5f9713f2da..857d364ede06983728cef17f530f3e72070876db 100644 (file)
 #include "parseconstruct.hh"
 
 static Keyword_ent the_key_tab[]={
-    {"accepts", ACCEPTS},
-    {"alias", ALIAS},
-    {"bar", BAR},
-    {"cadenza", CADENZA},
-    {"clear", CLEAR},
-    {"clef", CLEF},
-    {"cm", CM_T},
-    {"consists", CONSISTS},
-    {"contains", CONTAINS},
-    {"duration", DURATIONCOMMAND},
-    {"absdynamic", ABSDYNAMIC},
-    {"group", GROUP},
-    {"hshift", HSHIFT},
-    {"id", ID},
-    {"in", IN_T},
-    {"requesttranslator", REQUESTTRANSLATOR},
-    {"lyric", LYRIC},
-    {"key", KEY},
-    {"melodic" , MELODIC},
-    {"melodic_request", MELODIC_REQUEST},
-    {"meter", METER},
-    {"midi", MIDI},
-    {"mm", MM_T},
-    {"multi", MULTI},
-    {"notenames", NOTENAMES},
-    {"octave", OCTAVECOMMAND},
-    {"output", OUTPUT},
-    {"partial", PARTIAL},
-    {"paper", PAPER},
-    {"plet", PLET},
-    {"pt", PT_T},
-    {"score", SCORE},
-    {"script", SCRIPT},
-    {"skip", SKIP},
-    {"staff", STAFF},
-    {"stem", STEM},
-    {"table", TABLE},
-    {"spandynamic", SPANDYNAMIC}, 
-    {"symboltables", SYMBOLTABLES},
-    {"tempo", TEMPO},
-    {"texid", TEXID},
-    {"textstyle", TEXTSTYLE},
-    {"transpose", TRANSPOSE},
-    {"version", VERSION},
-    {"grouping", GROUPING},
-    {0,0}
+  {"accepts", ACCEPTS},
+  {"alias", ALIAS},
+  {"bar", BAR},
+  {"cadenza", CADENZA},
+  {"clear", CLEAR},
+  {"clef", CLEF},
+  {"cm", CM_T},
+  {"consists", CONSISTS},
+  {"contains", CONTAINS},
+  {"duration", DURATION},
+  {"absdynamic", ABSDYNAMIC},
+  {"group", GROUP},
+  {"hshift", HSHIFT},
+  {"id", ID},
+  {"in", IN_T},
+  {"requesttranslator", REQUESTTRANSLATOR},
+  {"lyric", LYRIC},
+  {"key", KEY},
+  {"melodic" , MELODIC},
+  {"melodic_request", MELODIC_REQUEST},
+  {"meter", METER},
+  {"midi", MIDI},
+  {"mm", MM_T},
+  {"multi", MULTI},
+  {"header", HEADER},
+  {"notenames", NOTENAMES},
+  {"octave", OCTAVE},
+  {"output", OUTPUT},
+  {"partial", PARTIAL},
+  {"paper", PAPER},
+  {"plet", PLET},
+  {"pt", PT_T},
+  {"score", SCORE},
+  {"script", SCRIPT},
+  {"skip", SKIP},
+  {"staff", STAFF},
+  {"stem", STEM},
+  {"table", TABLE},
+  {"spandynamic", SPANDYNAMIC}, 
+  {"symboltables", SYMBOLTABLES},
+  {"tempo", TEMPO},
+  {"texid", TEXID},
+  {"textstyle", TEXTSTYLE},
+  {"transpose", TRANSPOSE},
+  {"version", VERSION},
+  {"grouping", GROUPING},
+  {0,0}
 };
 
 My_lily_lexer::My_lily_lexer()
 {
-    keytable_p_ = new Keyword_table (the_key_tab);
-    identifier_assoc_p_ = new Assoc<String, Identifier*>;
-    errorlevel_i_ = 0;
-    post_quotes_b_ = false;
-    note_tab_p_ = new Notename_table;
+  keytable_p_ = new Keyword_table (the_key_tab);
+  identifier_assoc_p_ = new Assoc<String, Identifier*>;
+  errorlevel_i_ = 0;
+  post_quotes_b_ = false;
+  note_tab_p_ = new Notename_table;
 }
 
 int
 My_lily_lexer::lookup_keyword (String s)
 {
-    return keytable_p_->lookup (s);
+  return keytable_p_->lookup (s);
 }
 
 Identifier*
 My_lily_lexer::lookup_identifier (String s)
 {
-    if (!identifier_assoc_p_->elt_b (s))
+  if (!identifier_assoc_p_->elt_b (s))
        return 0;
-    
-    return (*identifier_assoc_p_)[s];
+  
+  return (*identifier_assoc_p_)[s];
 }
 
 
 void
 My_lily_lexer::set_identifier (String name_str, Identifier*i)
 {
-    Identifier *old = lookup_identifier (name_str);
-    if  (old) {
+  Identifier *old = lookup_identifier (name_str);
+  if  (old) 
+    {
        old->warning( "redeclaration of \\" + name_str);
        delete old;
     }
-    (*identifier_assoc_p_)[name_str] = i;
+  (*identifier_assoc_p_)[name_str] = i;
 }
 
 My_lily_lexer::~My_lily_lexer()
 {
-    delete keytable_p_;
+  delete keytable_p_;
 
-    for (Assoc_iter<String,Identifier*>
-            ai (*identifier_assoc_p_); ai.ok(); ai++) {
+  for (Assoc_iter<String,Identifier*>
+            ai (*identifier_assoc_p_); ai.ok(); ai++) 
+              {
        DOUT << "deleting: " << ai.key()<<'\n';
        delete ai.val();
     }
-    delete note_tab_p_;
-    delete identifier_assoc_p_;
+  delete note_tab_p_;
+  delete identifier_assoc_p_;
 }
 void
 My_lily_lexer::print_declarations (bool init_b)const
 {
-    for (Assoc_iter<String,Identifier*> ai (*identifier_assoc_p_); ai.ok(); 
-        ai++) {
-       if (ai.val()->init_b_ == init_b) {
+  for (Assoc_iter<String,Identifier*> ai (*identifier_assoc_p_); ai.ok(); 
+        ai++) 
+          {
+       if (ai.val()->init_b_ == init_b) 
+         {
            DOUT << ai.key() << '=';
            ai.val()->print ();
-       }
+         }
     }
 }
 
 void
 My_lily_lexer::LexerError (char const *s)
 {
-    if (include_stack_.empty()) {
+  if (include_stack_.empty()) 
+    {
        *mlog << "error at EOF" << s << '\n';
-    } else {
+    }
+  else 
+    {
        errorlevel_i_ |= 1;
  
        Input spot (source_file_l(),here_ch_C());
@@ -146,18 +154,18 @@ My_lily_lexer::LexerError (char const *s)
 Melodic_req*
 My_lily_lexer::lookup_melodic_req_l (String s)
 {
-    return note_tab_p_->get_l (s);
+  return note_tab_p_->get_l (s);
 }
 
 void
 My_lily_lexer::add_notename (String s, Melodic_req *p)
 {
-    note_tab_p_->add (s,p);
+  note_tab_p_->add (s,p);
 }
 
 void
 My_lily_lexer::clear_notenames()
 {
-    delete note_tab_p_;
-    note_tab_p_ = new Notename_table;
+  delete note_tab_p_;
+  note_tab_p_ = new Notename_table;
 }
index a8db01da1846c710c70f333ac36380008a4060e4..f195e9ef5ed1a51b73d3a474084807624c156eb6 100644 (file)
 void
 My_lily_parser::clear_notenames()
 {
-    lexer_p_->clear_notenames();
+  lexer_p_->clear_notenames();
 }
 void
 My_lily_parser::set_version_check (bool ig)
 {
-    ignore_version_b_ = ig;
+  ignore_version_b_ = ig;
 }
 void
 My_lily_parser::set_debug()
 {
 #ifndef NPRINT
-    String s = "";
-    if (init_parse_b_) 
+  String s = "";
+  if (init_parse_b_) 
        s = "Init";
-    set_yydebug (!monitor->silence (s+"Parser") && check_debug);
-    lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug);
+  set_yydebug (!monitor->silence (s+"Parser") && check_debug);
+  lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug);
 #endif
 }
 
@@ -41,11 +41,12 @@ void
 My_lily_parser::print_declarations()
 {
 #ifndef NPRINT
-    String s = "";
-    
-    if (init_parse_b_) 
+  String s = "";
+  
+  if (init_parse_b_) 
        s = "Init";
-    if (!monitor->silence (s+"Declarations") && check_debug) {
+  if (!monitor->silence (s+"Declarations") && check_debug) 
+    {
        lexer_p_->print_declarations (init_parse_b_);
     }
 #endif   
@@ -54,71 +55,73 @@ My_lily_parser::print_declarations()
 void
 My_lily_parser::parse_file (String init, String s)
 {
-    lexer_p_ = new My_lily_lexer;
-    init_str_ = init;
-    
-    *mlog << "Parsing ... ";
-    
-    init_parse_b_ = true;
-    lexer_p_->new_input (init, source_l_);
-    do_yyparse();
-    print_declarations();
-
-    init_parse_b_ = false;
-    lexer_p_->new_input (s , source_l_);
-    do_yyparse();
-    print_declarations();
-
-    
-    if (!define_spot_array_.empty())
+  lexer_p_ = new My_lily_lexer;
+  init_str_ = init;
+  
+  *mlog << "Parsing ... ";
+  
+  init_parse_b_ = true;
+  set_debug();
+  lexer_p_->new_input (init, source_l_);
+  do_yyparse();
+  print_declarations();
+
+  init_parse_b_ = false;
+    set_debug();
+  lexer_p_->new_input (s , source_l_);
+  do_yyparse();
+  print_declarations();
+
+  
+  if (!define_spot_array_.empty())
        warning ("Braces don't match.");
 }
 
 My_lily_parser::~My_lily_parser()
 {
-    delete lexer_p_;
+  delete lexer_p_;
 }
-    
+  
 void
 My_lily_parser::remember_spot()
 {
-    define_spot_array_.push (here_input());
+  define_spot_array_.push (here_input());
 }
 
 char const * 
 My_lily_parser::here_ch_C()const
 {
-    return lexer_p_->here_ch_C();
+  return lexer_p_->here_ch_C();
 }
 
 void
 My_lily_parser::parser_error (String s)
 {
-    here_input().error (s);
-    if ( fatal_error_i_)
+  here_input().error (s);
+  if ( fatal_error_i_)
        exit (fatal_error_i_);
-    error_level_i_ = 1;
+  error_level_i_ = 1;
 }
 
 void
 My_lily_parser::set_duration_mode (String s)
 {
-    s = s.upper_str();
-    last_duration_mode_b_ = (s== "LAST");
+  s = s.upper_str();
+  last_duration_mode_b_ = (s== "LAST");
 }
 
 void
 My_lily_parser::set_default_duration (Duration const *d)
 {
-    last_duration_mode_b_ = false;
-    default_duration_ = *d;
+  last_duration_mode_b_ = false;
+  default_duration_ = *d;
 }
 
 
 void
 My_lily_parser::set_last_duration (Duration const *d)
 {
-    if (last_duration_mode_b_)
+  if (last_duration_mode_b_)
        default_duration_ = *d;
 }
 
@@ -126,57 +129,59 @@ My_lily_parser::set_last_duration (Duration const *d)
 Chord*
 My_lily_parser::get_word_element (Text_def* tdef_p, Duration * duration_p)
 {
-    Chord* velt_p = new Request_chord;
-    
-    Lyric_req* lreq_p = new Lyric_req (tdef_p);
+  Chord* velt_p = new Request_chord;
+  
+  Lyric_req* lreq_p = new Lyric_req (tdef_p);
 
-    lreq_p->duration_ = *duration_p;
-    lreq_p->set_spot (here_input());
+  lreq_p->duration_ = *duration_p;
+  lreq_p->set_spot (here_input());
 
-    velt_p->add (lreq_p);
+  velt_p->add (lreq_p);
 
-    delete  duration_p;
-    return velt_p;
+  delete  duration_p;
+  return velt_p;
 }
 
 Chord *
 My_lily_parser::get_rest_element (String s,  Duration * duration_p)
 {    
-    Chord* velt_p = new Request_chord;
-    velt_p->set_spot (here_input());
+  Chord* velt_p = new Request_chord;
+  velt_p->set_spot (here_input());
 
-    if (s=="s") { /* Space */
+  if (s=="s") { /* Space */
        Skip_req * skip_p = new Skip_req;
        skip_p->duration_ = *duration_p;
 
        skip_p->set_spot (here_input());
        velt_p->add (skip_p);
     }
-    else {
+  else 
+    {
        Rest_req * rest_req_p = new Rest_req;
        rest_req_p->duration_ = *duration_p;
        rest_req_p->set_spot (here_input());
        
        velt_p->add (rest_req_p);
     }
-    Stem_req * stem_p = new Stem_req;
-    stem_p->duration_ = *duration_p;
-    stem_p->set_spot ( here_input());
-    velt_p->add (stem_p);
+  Stem_req * stem_p = new Stem_req;
+  stem_p->duration_ = *duration_p;
+  stem_p->set_spot ( here_input());
+  velt_p->add (stem_p);
 
-    delete duration_p;
-    return velt_p;
+  delete duration_p;
+  return velt_p;
 }
 
 Chord *
 My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
 {
-    Chord*v = new Request_chord;
-    v->set_spot (here_input());
+  Chord*v = new Request_chord;
+  v->set_spot (here_input());
 
-    v->add (rq);
-    
-    if (duration_p->type_i_ >= 2) {
+  v->add (rq);
+  
+  if (duration_p->durlog_i_ >= 1) 
+    {
        Stem_req * stem_req_p = new Stem_req();
        stem_req_p->duration_ = *duration_p;
        
@@ -184,114 +189,119 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
        v->add (stem_req_p);
     }
 
-    rq->set_duration (*duration_p);
-    rq->set_spot (here_input());
-    delete duration_p ;
-    return v;
+  rq->set_duration (*duration_p);
+  rq->set_spot (here_input());
+  delete duration_p ;
+  return v;
 }
 
 Request*
 My_lily_parser::get_parens_request (char c)
 {
-    Request* req_p=0;
-    switch (c) {
+  Request* req_p=0;
+  switch (c) 
+    {
 
-    case '~':
+  case '~':
        req_p = new Tie_req;
        break;
-    case '[':
-    case ']':
-    {
+  case '[':
+  case ']':
+  {
        Beam_req*b = new Beam_req;
        int p_i=plet_.type_i_ ; // ugh . Should junk?
        if (p_i!= 1)
            b->nplet = p_i;
        req_p = b;
     }
-    break;
+  break;
 
-    case '>':
-    case '!':
-    case '<':
+  case '>':
+  case '!':
+  case '<':
        req_p = new Span_dynamic_req;
        break;
-    
-    case ')':
-    case '(':
+  
+  case ')':
+  case '(':
        req_p = new Slur_req;
        break;
-    default:
+  default:
        assert (false);
        break;
     }
-    
-    switch (c) {
-    case '<':
-    case '>':
-    case '(':
-    case '[':
+  
+  switch (c) 
+    {
+  case '<':
+  case '>':
+  case '(':
+  case '[':
        req_p->span()->spantype = Span_req::START;
        break;
-    case '!':
-    case ')':
-    case ']':
+  case '!':
+  case ')':
+  case ']':
        req_p->span()->spantype = Span_req::STOP;
        break;
        
-    default:
+  default:
        break;
     }
 
-   if (req_p->musical()->span_dynamic ()) {
+   if (req_p->musical()->span_dynamic ()) 
+   {
        Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ;
        s_l->dynamic_dir_i_ = (c == '<') ? 1:-1;
     }
 
-    req_p->set_spot (here_input());
-    return req_p;
+  req_p->set_spot (here_input());
+  return req_p;
 }
 
 My_lily_parser::My_lily_parser (Sources * source_l)
 {
-    first_b_ = true;
-    source_l_ = source_l;
-    lexer_p_ = 0;
-    default_duration_.type_i_ = 4;
-    default_octave_i_ = 0;
-    textstyle_str_="roman";            // in lexer?
-    error_level_i_ = 0;
-    last_duration_mode_b_ = true;
-    fatal_error_i_ = 0;
+  first_b_ = true;
+  source_l_ = source_l;
+  lexer_p_ = 0;
+  default_duration_.durlog_i_ = 2;
+  default_octave_i_ = 0;
+  textstyle_str_="roman";              // in lexer?
+  error_level_i_ = 0;
+  last_duration_mode_b_ = true;
+  fatal_error_i_ = 0;
 }
 
 void
 My_lily_parser::add_requests (Chord*v)
 {
-    for (int i = 0; i < pre_reqs.size(); i++) {
+  for (int i = 0; i < pre_reqs.size(); i++) 
+    {
        v->add (pre_reqs[i]);
     }
-    pre_reqs.clear();
-    for (int i = 0; i <post_reqs.size(); i++) {
+  pre_reqs.clear();
+  for (int i = 0; i <post_reqs.size(); i++) 
+    {
        v->add (post_reqs[i]);
     }
-    post_reqs.clear();
+  post_reqs.clear();
 }
 
 Input
 My_lily_parser::pop_spot()
 {
-    return define_spot_array_.pop();
+  return define_spot_array_.pop();
 }
 
 Input
 My_lily_parser::here_input()const
 {
-    Source_file * f_l= lexer_p_->source_file_l();
-    return Input (f_l, here_ch_C());
+  Source_file * f_l= lexer_p_->source_file_l();
+  return Input (f_l, here_ch_C());
 }
 
 void
 My_lily_parser::add_notename (String s, Melodic_req * m_p)
 {
-    lexer_p_->add_notename (s, m_p);
+  lexer_p_->add_notename (s, m_p);
 }
index d9811ef3704c64370c63b61ddeeb2e48a1eb9b5c..34e12316d014578c0bd4014eb581434428aa0781 100644 (file)
 bool
 Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C)const
 {
-    char const*nC = elem_C->name();
-    return (nC == Script::static_name() || nC == Note_head::static_name () 
+  char const*nC = elem_C->name();
+  return (nC == Script::static_name() || nC == Note_head::static_name () 
            || nC == Stem::static_name());
 }
 Note_column*
 Note_column_engraver::note_col_l()
 {
-    if (!ncol_p_){
+  if (!ncol_p_)
+    {
        ncol_p_ = new Note_column;
        announce_element (Score_elem_info (ncol_p_, 0));
     }
-    return ncol_p_;
+  return ncol_p_;
 }
 
 Rest_column *
 Note_column_engraver::rest_col_l()
 {
-    if (!restcol_p_) {
+  if (!restcol_p_) 
+    {
        restcol_p_  = new Rest_column;
        announce_element (Score_elem_info (restcol_p_,0));
     }
-    return restcol_p_;
+  return restcol_p_;
 }
 
 void
 Note_column_engraver::acknowledge_element (Score_elem_info i)
 {
-    if (!acceptable_elem_b (i.elem_l_))
+  if (!acceptable_elem_b (i.elem_l_))
        return;
 
 
-    char const*nC = i.elem_l_->name();
+  char const*nC = i.elem_l_->name();
 
-    if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical ()) {
+  if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical ()) 
+    {
        script_l_arr_.push ((Script*)i.elem_l_->item());
-    } else if (nC == Note_head::static_name()) {
+    }
+  else if (nC == Note_head::static_name()) 
+    {
        Note_head * h_l = (Note_head*)i.elem_l_->item();
        if (h_l->rest_b_)
            rest_col_l()->add (h_l);
        else
            note_col_l()->add (h_l);
 
-    } else if (nC == Stem::static_name()){ 
+    }
+  else if (nC == Stem::static_name())
+    {
        stem_l_ = (Stem*)i.elem_l_->item();
     }
 
-    if ( ncol_p_ || restcol_p_) {
-       if ( stem_l_) {
+  if ( ncol_p_ || restcol_p_) 
+    {
+       if ( stem_l_) 
+         {
            if (restcol_p_&& !restcol_p_->stem_l_)
                restcol_p_->set (stem_l_);
            if (ncol_p_ && !ncol_p_->stem_l_)
                ncol_p_->set (stem_l_);
-       }
-    
-    
-       for (int i=0; i < script_l_arr_.size(); i++) {
+         }
+  
+  
+       for (int i=0; i < script_l_arr_.size(); i++) 
+         {
            if (restcol_p_)
                restcol_p_->add (script_l_arr_[i]);
            if ( ncol_p_)
                ncol_p_->add (script_l_arr_[i]);
-       }
-    
+         }
+  
        script_l_arr_.clear();
     }
 
@@ -86,7 +96,8 @@ Note_column_engraver::acknowledge_element (Score_elem_info i)
 void
 Note_column_engraver::do_pre_move_processing()
 {
-    if (ncol_p_) {
+  if (ncol_p_) 
+    {
        if (! ncol_p_->h_shift_b_)
            ncol_p_->h_shift_b_ = h_shift_b_;
        if (! ncol_p_->dir_i_)
@@ -95,7 +106,8 @@ Note_column_engraver::do_pre_move_processing()
        typeset_element (ncol_p_);
        ncol_p_ =0;
     }
-    if (restcol_p_) {
+  if (restcol_p_) 
+    {
        if (! restcol_p_->dir_i_)
            restcol_p_->dir_i_ = dir_i_;
 
@@ -107,27 +119,27 @@ Note_column_engraver::do_pre_move_processing()
 void
 Note_column_engraver::do_post_move_processing()
 {
-    script_l_arr_.clear();
-    stem_l_ =0;
+  script_l_arr_.clear();
+  stem_l_ =0;
 }
 
 void
 Note_column_engraver::set_feature (Feature i)
 {
-     if (i.type_ == "vdir")    
+   if (i.type_ == "vdir")      
        dir_i_ = i.value_;
-     if (i.type_ == "hshift")
+   if (i.type_ == "hshift")
         h_shift_b_ = (bool)(int)i.value_;
 }
 
 Note_column_engraver::Note_column_engraver()
 {
-    dir_i_ =0;
-    h_shift_b_ = false;
-    
-    ncol_p_=0;
-    restcol_p_ =0;
-    do_post_move_processing();
+  dir_i_ =0;
+  h_shift_b_ = false;
+  
+  ncol_p_=0;
+  restcol_p_ =0;
+  do_post_move_processing();
 }
 
 
index 343414c03591feb53d185828943708156b09f79e..19cf429928ccd33c9aded260de7c238bf5a24851 100644 (file)
@@ -17,26 +17,26 @@ IMPLEMENT_IS_TYPE_B1(Note_column,Head_column);
 void
 Note_column::set (Stem*s)
 {
-    stem_l_ = s;
-    add_support (s);
+  stem_l_ = s;
+  add_support (s);
 }
 
 Note_column::Note_column()
 {
-    h_shift_b_ =false;
+  h_shift_b_ =false;
 }
 
 void
 Note_column::sort()
 {
-    head_l_arr_.sort (Note_head::compare);
+  head_l_arr_.sort (Note_head::compare);
 }
-    
+  
 Interval_t<int>
 Note_column::head_positions_interval()const
 {
-    ((Note_column*)this)->sort();
-    return Interval_t<int> ( head_l_arr_[0]->position_i_, 
+  ((Note_column*)this)->sort();
+  return Interval_t<int> ( head_l_arr_[0]->position_i_, 
                             head_l_arr_.top()->position_i_);
 
 }
@@ -45,10 +45,11 @@ Note_column::head_positions_interval()const
 void
 Note_column::do_pre_processing()
 {
-    if (!dir_i_&& !stem_l_){
+  if (!dir_i_&& !stem_l_)
+    {
        dir_i_ = (head_positions_interval().center () >=  5) ? -1 : 1;
     }
-    Head_column::do_pre_processing();
+  Head_column::do_pre_processing();
 }
 
-    
+  
index e9e5dd5ca77f1d53e22aa879a6e540b634f46147..dd2ac9da14b8d063210cf06fc7975565e4265a33 100644 (file)
@@ -19,15 +19,16 @@ ADD_THIS_PERFORMER(Note_performer);
 
 Note_performer::Note_performer()
 {
-    note_req_l_ = 0;
+  note_req_l_ = 0;
 }
 
 void 
 Note_performer::do_print() const
 {
 #ifndef NPRINT
-    if ( note_req_l_) {
-       note_req_l_->print();
+  if ( note_req_l_) 
+    {
+       note_req_l_->print();
     }
 #endif
 }
@@ -35,23 +36,23 @@ Note_performer::do_print() const
 void 
 Note_performer::process_requests() 
 {
-    // this is _really_ braindead, but it generates some output
-    if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
+  // this is _really_ braindead, but it generates some output
+  if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic ())
        return;
 
-    play (new Audio_note (note_req_l_) );
-    note_req_l_ = 0;
+  play (new Audio_note (note_req_l_) );
+  note_req_l_ = 0;
 }
 
 bool 
 Note_performer::do_try_request (Request* req_l)
 {
-    if ( note_req_l_)
+  if ( note_req_l_)
        return false;
-    
-    if ( !req_l->musical() || !req_l->musical ()->note ())
+  
+  if ( !req_l->musical() || !req_l->musical ()->note ())
        return false;
 
-    note_req_l_ = req_l->musical()->melodic ();
-    return true;
+  note_req_l_ = req_l->musical()->melodic ();
+  return true;
 }
index 2b1a8c447b3b69faedc4b86086054a4cd38c8277..ec84dbba52762626257c223bc5a9935d77c0bd60 100644 (file)
 String *
 get_scriptdef (char c)
 {
-    String s;
-    switch (c) {
-    case '^' : s = "marcato";
+  String s;
+  switch (c) 
+    {
+  case '^' : s = "marcato";
        break;
-    case  '+' : s = "stopped";
+  case  '+' : s = "stopped";
        break;
-    case '-' : s = "tenuto";
+  case '-' : s = "tenuto";
        break;
-    case  '|':  s = "staccatissimo";
+  case  '|':  s = "staccatissimo";
        break;
-    case  'o' : s = "";
+  case  'o' : s = "";
        break;
-    case '>' : s = "accent";
+  case '>' : s = "accent";
        break;
-    case  'v' : s = ""; 
+  case  'v' : s = ""; 
        break;
-    case  '.' : s = "staccato";
+  case  '.' : s = "staccato";
        break;
-    default:
+  default:
        assert (false);
     }
-    return new String (s);
+  return new String (s);
 }
 
 Request*
 get_script_req (int d , General_script_def*def)
 {
-    Musical_script_req* script_req_p = new Musical_script_req;
-    script_req_p->dir_i_ =d;
-    script_req_p->scriptdef_p_=def;
-    return script_req_p;
+  Musical_script_req* script_req_p = new Musical_script_req;
+  script_req_p->dir_i_ =d;
+  script_req_p->scriptdef_p_=def;
+  return script_req_p;
 }
 
 
@@ -58,28 +59,29 @@ get_script_req (int d , General_script_def*def)
 Request*
 get_stemdir_req (int d)
 {
-    d = sign (long (d));
-    Group_feature_req * gfreq_p = new Group_feature_req;
-    gfreq_p->type_str_ = "vdir";
-    gfreq_p->value_str_ = String (d);
-    return gfreq_p;
+  d = sign (long (d));
+  Group_feature_req * gfreq_p = new Group_feature_req;
+  gfreq_p->type_str_ = "vdir";
+  gfreq_p->value_str_ = String (d);
+  return gfreq_p;
 }
 Request*
 get_hshift_req (int i)
 {
    Group_feature_req * gfreq_p = new Group_feature_req;
-    gfreq_p->type_str_ = "hshift";
-    gfreq_p->value_str_ = String (i);
-    return gfreq_p;
+  gfreq_p->type_str_ = "hshift";
+  gfreq_p->value_str_ = String (i);
+  return gfreq_p;
 }
-    
+  
 Request*
 get_grouping_req (Array<int> i_arr)
 {
-    Measure_grouping_req * mr_p = new Measure_grouping_req;
-    for (int i=0; i <i_arr.size();) {
+  Measure_grouping_req * mr_p = new Measure_grouping_req;
+  for (int i=0; i <i_arr.size();) 
+    {
        mr_p->elt_length_arr_.push (Moment (1, i_arr[i++]));
        mr_p->beat_i_arr_.push (i_arr[i++]);
     }
-    return mr_p;
+  return mr_p;
 }
index 860fee7258dbfb0f66232ae9ec5fb8b43f9c959b..6871240ff97166c38112074f1dab9763dd664cde 100644 (file)
   Separate notehead into 
 
 
-     Rhythmic_head
-       Note_head
-       Rest
+   Rhythmic_head
+     Note_head
+     Rest
 
-     and Stem takes Rhythmic_heads 
+   and Stem takes Rhythmic_heads 
  */
 
 
 Note_head::Note_head (int ss)
 {
-    x_dir_i_ = 0;
-    staff_size_i_=ss;
-    position_i_ = 0;
-    balltype_i_ = 0;
-    dots_i_ = 0;
-    dot_delta_y_i_ = 0;
-    extremal_i_ = 0;
-    rest_b_ = false;
+  x_dir_i_ = 0;
+  staff_size_i_=ss;
+  position_i_ = 0;
+  balltype_i_ = 0;
+  dots_i_ = 0;
+  dot_delta_y_i_ = 0;
+  extremal_i_ = 0;
+  rest_b_ = false;
 }
 
 void
 Note_head::do_pre_processing()
 {
-    // 8 ball looks the same as 4 ball:
-    if (balltype_i_ > 4 && !rest_b_)
-       balltype_i_ = 4;
-       
-    if (rest_b_) { 
-       if (balltype_i_ == 1)
+  // 8 ball looks the same as 4 ball:
+  if (balltype_i_ > 2 && !rest_b_)
+       balltype_i_ = 2;
+       
+  if (rest_b_) 
+    {
+       if (balltype_i_ == 0)
            position_i_ += 6;
-       else if (balltype_i_ == 2)
+       else if (balltype_i_ == 0)
            position_i_ += 4;
     }
 }
@@ -59,10 +60,10 @@ Note_head::do_pre_processing()
 void
 Note_head::set_rhythmic (Rhythmic_req*r_req_l)
 {
-    balltype_i_ = r_req_l->duration_.type_i_;
-    dots_i_ = r_req_l->duration_.dots_i_;
+  balltype_i_ = r_req_l->duration_.durlog_i_;
+  dots_i_ = r_req_l->duration_.dots_i_;
 }
-    
+  
 
 IMPLEMENT_IS_TYPE_B1(Note_head,Item);
 
@@ -70,9 +71,9 @@ void
 Note_head::do_print()const
 {
 #ifndef NPRINT
-    if (rest_b_)
+  if (rest_b_)
        DOUT << "REST! ";
-    DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
+  DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
         << "dots_i_ " << dots_i_;
 #endif
 }
@@ -81,15 +82,15 @@ Note_head::do_print()const
 int
 Note_head::compare (Note_head *const  &a, Note_head * const &b)
 {
-    return a->position_i_ - b->position_i_;
+  return a->position_i_ - b->position_i_;
 }
 
 void
 Note_head::set_dots()
 {
-    if (!(position_i_ %2) && rest_b_ && balltype_i_ == 1)
+  if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0)
        dot_delta_y_i_ = -1;
-    else if (!(position_i_ %2))
+  else if (!(position_i_ %2))
        dot_delta_y_i_ = 1;
 }
 
@@ -99,23 +100,25 @@ Note_head::set_dots()
 Molecule*
 Note_head::brew_molecule_p() const 
 {
-    ((Note_head*)this)->set_dots(); // UGH GUH
-    Molecule*out = 0;
-    Paper_def *p = paper();
-    Real inter_f = p->internote_f();
-    Symbol s;
-
-    // ugh
-    bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
-    
-    if (!rest_b_)
+  ((Note_head*)this)->set_dots(); // UGH GUH
+  Molecule*out = 0;
+  Paper_def *p = paper();
+  Real inter_f = p->internote_f();
+  Symbol s;
+
+  // ugh
+  bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
+  
+  if (!rest_b_)
        s = p->lookup_l()->ball (balltype_i_);
-    else {
+  else 
+    {
        s = p->lookup_l()->rest (balltype_i_, streepjes_b);
     }
-    out = new Molecule (Atom (s));
-    out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
-    if (dots_i_) {
+  out = new Molecule (Atom (s));
+  out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
+  if (dots_i_) 
+    {
        Symbol d = p->lookup_l()->dots (dots_i_);
        Molecule dm;
        dm.add (Atom (d));
@@ -123,12 +126,14 @@ Note_head::brew_molecule_p() const
        out->add_right (dm);
     }
 
-    
-    if (rest_b_) {
+  
+  if (rest_b_) 
+    {
        streepjes_b = false;
     }
-    
-    if (streepjes_b) {
+  
+  if (streepjes_b) 
+    {
        int dir = sign (position_i_);
        int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
        
@@ -139,8 +144,8 @@ Note_head::brew_molecule_p() const
            sm.translate (-inter_f* dir, Y_AXIS);
        out->add (sm);      
     }
-    
-    out->translate (inter_f*position_i_, Y_AXIS);
-    return out;
+  
+  out->translate (inter_f*position_i_, Y_AXIS);
+  return out;
 }
 
index 325d91e5f8d00fe19bd434b2a64beb98b6cab20c..049f0cdfcb1ecbb495e67b71c8190a45d51dc8ef 100644 (file)
@@ -15,14 +15,14 @@ template class P<Melodic_req>;
 void
 Notename_table::add (String s, Melodic_req *m_p)
 {
-    elem (s).set_p (m_p);
+  elem (s).set_p (m_p);
 }
 
 Melodic_req*
 Notename_table::get_l (String s)
 {
-    if (! elt_b (s))
+  if (! elt_b (s))
        return 0;
-    return elem (s);
+  return elem (s);
 }
-    
+  
index 69813e8a7e5557acd011f73674a3e1248af85b7d..9e5be116646cac5dc2ba974513f8778e1d1f5c95 100644 (file)
 Interval
 PCol::width() const
 {
-    Interval w;
+  Interval w;
 
-    for (iter_top (its,i); i.ok(); i++)
+  for (iter_top (its,i); i.ok(); i++)
        w.unite (i->width());
-    if (w.empty_b())
+  if (w.empty_b())
        w.unite (Interval (0,0));
-    return w;
+  return w;
 }
 
 void
 PCol::clean_breakable_items()
 {
-    if (!line_l_) {
+  if (!line_l_) 
+    {
        its.junk_links();
     }
-    if (prebreak_p_) 
+  if (prebreak_p_) 
        prebreak_p_->clean_breakable_items();
-    if (postbreak_p_) 
+  if (postbreak_p_) 
        postbreak_p_->clean_breakable_items();
 }
 
 int
 PCol::rank_i() const
 {
-    return rank_i_;
+  return rank_i_;
 }
 
 void
 PCol::set_rank (int i)
 {
-    rank_i_ = i;
-    if (prebreak_p_)
+  rank_i_ = i;
+  if (prebreak_p_)
        prebreak_p_->rank_i_ = i;
-    if (postbreak_p_)
+  if (postbreak_p_)
        postbreak_p_->rank_i_ = i;
 }
 
@@ -55,36 +56,42 @@ void
 PCol::print() const
 {
 #ifndef NPRINT
-    DOUT << "PCol {";
+  DOUT << "PCol {";
 
-    DOUT << "rank: " << rank_i_ << '\n';
+  DOUT << "rank: " << rank_i_ << '\n';
 
-    DOUT << "# symbols: " << its.size() ;
-    if (breakable_b()){
-       DOUT << "\npre,post: ";
-       prebreak_p_->print();
-       postbreak_p_->print();
-    } else if (daddy_l_) {
+  DOUT << "# symbols: " << its.size() ;
+     if (prebreak_p_){
+        DOUT << "\npre: ";
+        prebreak_p_->print();
+    }
+    if (postbreak_p_) {
+      DOUT << "post: ";
+      postbreak_p_->print();
+    } 
+  else if (daddy_l_) 
+    {
        DOUT <<'\n' << ((this == daddy_l_->prebreak_p_) ?
                       "prebreak" : "postbreak");
        DOUT << '\n';
     }
-    DOUT << "extent: " << width().str () << "\n";
-    DOUT << "}\n";
+  DOUT << "extent: " << width().str () << "\n";
+  DOUT << "}\n";
 #endif 
 }
 
 int
 PCol::compare (PCol const &c1, PCol const &c2)
 {
-    return c1.rank_i() - c2.rank_i ();
+  return c1.rank_i() - c2.rank_i ();
 }
 
 void
 PCol::OK() const
 {
 #ifndef NDEBUG
-    if (prebreak_p_ || postbreak_p_) {
+  if (prebreak_p_ || postbreak_p_) 
+    {
        assert (prebreak_p_&&postbreak_p_);
        assert (prebreak_p_->daddy_l_ == this);
        assert (postbreak_p_->daddy_l_ == this);
@@ -95,63 +102,63 @@ PCol::OK() const
 void
 PCol::set_breakable()
 {
-    if (breakable_b())
+  if (breakable_b())
        return;
 
-    do_set_breakable();
-    prebreak_p_->pscore_l_ = pscore_l_;
-    postbreak_p_->pscore_l_ = pscore_l_;
+  do_set_breakable();
+  prebreak_p_->pscore_l_ = pscore_l_;
+  postbreak_p_->pscore_l_ = pscore_l_;
 
-    prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this;
+  prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this;
 }
 void
 PCol::do_set_breakable()
 {
-     prebreak_p_ = new PCol;
-    postbreak_p_ = new PCol;
+   prebreak_p_ = new PCol;
+  postbreak_p_ = new PCol;
 }
   
 
 bool
 PCol::breakpoint_b() const
 {
-    return !line_l_;
+  return !line_l_;
 }
 
 bool
 PCol::breakable_b() const
 {
-    return prebreak_p_||postbreak_p_;
+  return prebreak_p_||postbreak_p_||daddy_l_;
 }
 
 PCol::PCol()
 {
-    used_b_ = false;
-    error_mark_b_ = false;
-    daddy_l_ = 0;
-    prebreak_p_=0;
-    postbreak_p_=0;
-    line_l_=0;
-    hpos_f_ = -1.0;
-    pscore_l_ = 0;
-    rank_i_ = -1;
+  used_b_ = false;
+  error_mark_b_ = false;
+  daddy_l_ = 0;
+  prebreak_p_=0;
+  postbreak_p_=0;
+  line_l_=0;
+  hpos_f_ = -1.0;
+  pscore_l_ = 0;
+  rank_i_ = -1;
 }
 
 PCol::~PCol()
 {
-    delete prebreak_p_;
-    delete postbreak_p_;
+  delete prebreak_p_;
+  delete postbreak_p_;
 }
 
 void
 PCol::add (Item *i)
 {
-    its.bottom().add (i);
-    i->pcol_l_ = this; 
+  its.bottom().add (i);
+  i->pcol_l_ = this; 
 }
 
 bool
 PCol::used_b()const
 {
-    return daddy_l_ || breakable_b() || its.size ()|| used_b_;
+  return daddy_l_ || breakable_b() || its.size ()|| used_b_;
 }
index 73ab917422975fa1500bb3c35bc7399c186ffd6e..dbf5d84525803e33ad8b3fed93e88620eccb250d 100644 (file)
 
 Paper_score::Paper_score (Paper_def*p)
 {
-    paper_l_ = p;
-    super_elem_l_   = new Super_elem;
-    typeset_element (super_elem_l_);
+  paper_l_ = p;
+  super_elem_l_   = new Super_elem;
+  typeset_element (super_elem_l_);
 }
 
 Paper_score::~Paper_score()
 {
-    super_elem_l_->unlink_all();
+  super_elem_l_->unlink_all();
 }
 
 void
 Paper_score::typeset_element (Score_elem * elem_p)
 {
-    elem_p_list_.bottom().add (elem_p);
-    elem_p->pscore_l_ = this;
+  elem_p_list_.bottom().add (elem_p);
+  elem_p->pscore_l_ = this;
 
-    elem_p->add_processing();
+  elem_p->add_processing();
 }
 
 void
 Paper_score::typeset_item (Item *i, PCol *c)
 {
-    assert (c && i);
-    int breakstat = i->break_status_i_;
+  assert (c && i);
+  int breakstat = i->break_status_i_;
 
-    if (breakstat == -1) {
+  if (breakstat == -1) 
+    {
        c = c->prebreak_p_;
-    }else if (breakstat == 1) {
+  }else if (breakstat == 1) 
+    {
        c = c->postbreak_p_;
     }
 
-    c->add (i);
-    typeset_element (i);
+  c->add (i);
+  typeset_element (i);
 }
 
 void
 Paper_score::typeset_broken_spanner (Spanner*span_p)
 {
-    span_p->left_col_l_->starters.bottom().add (span_p);
-    assert (span_p->left_col_l_->line_l_ == span_p->right_col_l_->line_l_);
+  span_p->left_col_l_->starters.bottom().add (span_p);
+  assert (span_p->left_col_l_->line_l_ == span_p->right_col_l_->line_l_);
 
-    typeset_element (span_p);
+  typeset_element (span_p);
 }
 
 
 void
 Paper_score::typeset_unbroken_spanner (Spanner*span_p)
 {
-    span_p_list_.bottom().add (span_p);
-    span_p->pscore_l_=this;
+  span_p_list_.bottom().add (span_p);
+  span_p->pscore_l_=this;
 
-    if (span_p->left_col_l_) 
+  if (span_p->left_col_l_) 
        span_p->left_col_l_->used_b_ = true;
-    if ( span_p->right_col_l_)
+  if ( span_p->right_col_l_)
        span_p->right_col_l_->used_b_ = true;
-    
-    // do not init start/stop fields. These are for broken spans only.
-    span_p->add_processing();
+  
+  // do not init start/stop fields. These are for broken spans only.
+  span_p->add_processing();
 }
 
 
 void
 Paper_score::clean_cols()
 {
-    int rank_i = 0;
-    for (iter_top (col_p_list_,c); c.ok();)
-       if (!c->used_b()) {
+  int rank_i = 0;
+  for (iter_top (col_p_list_,c); c.ok();)
+       if (!c->used_b()) 
+         {
            delete c.remove_p();
-       } else {
+         }
+       else 
+         {
            c->set_rank (rank_i++);
            c++;
-       }
+         }
 }
 
 void
 Paper_score::add (PCol *p)
 {
-    p->pscore_l_ = this;
-    if (p->breakable_b()){
+  p->pscore_l_ = this;
+  if (p->breakable_b())
+    {
        p->prebreak_p_->pscore_l_ = this;
        p->postbreak_p_->pscore_l_ = this;
     }
-    col_p_list_.bottom().add (p);
+  col_p_list_.bottom().add (p);
 }
 
 void
 Paper_score::output (Tex_stream &ts)
 {
-    ts << "\n "<<  paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
-    ts<< super_elem_l_->TeX_string();
-    ts << "\n\\EndLilyPondOutput";
+  ts << "\n "<<  paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
+  ts<< super_elem_l_->TeX_string();
+  ts << "\n\\EndLilyPondOutput";
 }
 
 
@@ -119,9 +125,9 @@ void
 Paper_score::OK()const
 {
 #ifndef NDEBUG
-    for (iter_top (col_p_list_,cc); cc.ok(); cc++)
+  for (iter_top (col_p_list_,cc); cc.ok(); cc++)
        cc->OK();
-    for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++) 
+  for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++) 
        i->OK();
 #endif
 }
@@ -130,118 +136,127 @@ void
 Paper_score::print() const
 {    
 #ifndef NPRINT
-    if ( !check_debug)
+  if ( !check_debug)
        return ;
-    DOUT << "Paper_score { ";
-    paper_l_->print();
-    DOUT << "\n elements: ";
-    for (iter_top (elem_p_list_,cc); cc.ok(); cc++)    
+  DOUT << "Paper_score { ";
+  paper_l_->print();
+  DOUT << "\n elements: ";
+  for (iter_top (elem_p_list_,cc); cc.ok(); cc++)      
        cc->print();
-    DOUT << "\n unbroken spanners: ";
-    for (iter (span_p_list_.top(), i); i.ok (); i++)
+  DOUT << "\n unbroken spanners: ";
+  for (iter (span_p_list_.top(), i); i.ok (); i++)
        i->print();
-    DOUT << "\ncolumns: ";
-     for (iter_top (col_p_list_,cc); cc.ok(); cc++)
+  DOUT << "\ncolumns: ";
+   for (iter_top (col_p_list_,cc); cc.ok(); cc++)
        cc->print();
-    
-    DOUT << "}\n";
+  
+  DOUT << "}\n";
 #endif 
 }
 
 void
 Paper_score::preprocess()
 {
-    super_elem_l_->breakable_col_processing();
-    super_elem_l_->pre_processing();
+  super_elem_l_->breakable_col_processing();
+  super_elem_l_->pre_processing();
 }
 
 void
 Paper_score::postprocess()
 {
-    super_elem_l_->post_processing();
-    super_elem_l_->molecule_processing();
+  super_elem_l_->post_processing();
+  super_elem_l_->molecule_processing();
 }
 
 PCursor<PCol *>
 Paper_score::find_col (PCol const *c)const
 {
-    PCol const *what = c;
-    if (what->daddy_l_)
+  PCol const *what = c;
+  if (what->daddy_l_)
        what = what->daddy_l_;
-    
-    return col_p_list_.find ((PCol*)what);
+  
+  return col_p_list_.find ((PCol*)what);
 }
 
 
 void
 Paper_score::set_breaking (Array<Col_hpositions> const &breaking)
 {
-    super_elem_l_->line_of_score_l_->set_breaking (breaking);
-    super_elem_l_->break_processing();
+  super_elem_l_->line_of_score_l_->set_breaking (breaking);
+  super_elem_l_->break_processing();
 
 
-    for (iter (span_p_list_.top(),i); i.ok ();) {
+  for (iter (span_p_list_.top(),i); i.ok ();) 
+    {
        Spanner *span_p = i.remove_p();
-       if (span_p->broken_b()) {
+       if (span_p->broken_b()) 
+         {
            span_p->unlink();
            delete span_p;
-       }else{
+       }else
+         {
            typeset_broken_spanner (span_p);
-       }
+         }
     }
-    for (iter (elem_p_list_.top(),i); i.ok () ;) {
+  for (iter (elem_p_list_.top(),i); i.ok () ;) 
+    {
        Item *i_l =i->item();
-       if ( i_l && !i_l->pcol_l_->line_l_) {
+       if ( i_l && !i_l->pcol_l_->line_l_) 
+         {
            i_l->unlink();
            delete i.remove_p();
-       } else
+         }
+       else
            i++;
     }
 
-    for (iter_top (col_p_list_, i); i.ok(); i++)
+  for (iter_top (col_p_list_, i); i.ok(); i++)
        i->clean_breakable_items();
 }
 
 void
 Paper_score::calc_breaking()
 {
-    Break_algorithm *algorithm_p;
-    Array<Col_hpositions> sol;
-    bool try_wrap = ! paper_l_->get_var ("castingalgorithm");
+  Break_algorithm *algorithm_p;
+  Array<Col_hpositions> sol;
+  bool try_wrap = ! paper_l_->get_var ("castingalgorithm");
 
-    if (!try_wrap) {
+  if (!try_wrap) 
+    {
        algorithm_p = new Gourlay_breaking ;
        algorithm_p->set_pscore (this);
        sol = algorithm_p->solve();
        delete algorithm_p;
-       if ( ! sol.size()) { 
+       if ( ! sol.size()) 
+         {
             warning ("Can not solve this casting problem exactly; revert to Word_wrap");
            try_wrap = true;
-       } 
+         }
     }
-    if  (try_wrap) {
+  if  (try_wrap) 
+    {
        algorithm_p = new Word_wrap;    
        algorithm_p->set_pscore (this);
        sol = algorithm_p->solve();
        delete algorithm_p;
     }
-    set_breaking (sol);
+  set_breaking (sol);
 }
 
 void
 Paper_score::process()
 {
-    clean_cols();
-    print();
-    *mlog << "Preprocessing elements... " <<flush;
-    preprocess();
-    *mlog << "\nCalculating column positions ... " <<flush;
-    calc_breaking();
-    *mlog << "\nPostprocessing elements..." << endl;
-    postprocess();
-    
+  clean_cols();
+  print();
+  *mlog << "Preprocessing elements... " <<flush;
+  preprocess();
+  *mlog << "\nCalculating column positions ... " <<flush;
+  calc_breaking();
+  *mlog << "\nPostprocessing elements..." << endl;
+  postprocess();
+  
 #ifndef NDEBUGA
-    for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++) 
+  for (PCursor<Score_elem*> i (elem_p_list_.top()); i.ok (); i++) 
        assert (i->status() >= 9);
 #endif
 }
@@ -250,56 +265,58 @@ Paper_score::process()
 Link_array<PCol>
 Paper_score::breakable_col_range (PCol*l,PCol*r)const
 {
-    Link_array<PCol> ret;
+  Link_array<PCol> ret;
 
-    PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
-    PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+  PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
+  PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
 
-    /*
-      ugh! windows-suck-suck-suck.
-     */
-    while ( PCursor<PCol*>::compare (start,stop) < 0) {
+  /*
+    ugh! windows-suck-suck-suck.
+   */
+  while ( PCursor<PCol*>::compare (start,stop) < 0) 
+    {
        if (start->breakable_b())
            ret.push (start);
        start++;
     }
 
-    return ret;
+  return ret;
 }
 Link_array<PCol>
 Paper_score::col_range (PCol*l,PCol*r)const
 {
-    Link_array<PCol> ret;
-    
-    PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
-    PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
-    ret.push (l);
-    
-    /*
-      ugh! windows-suck-suck-suck.
-     */
-    while ( PCursor<PCol*>::compare (start,stop) < 0)
+  Link_array<PCol> ret;
+  
+  PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
+  PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+  ret.push (l);
+  
+  /*
+    ugh! windows-suck-suck-suck.
+   */
+  while ( PCursor<PCol*>::compare (start,stop) < 0)
        ret.push (start++);
-    ret.push (r);
-    return ret;
+  ret.push (r);
+  return ret;
 }
 
 Link_array<PCol>
 Paper_score::broken_col_range (PCol*l,PCol*r)const
 {
-    Link_array<PCol> ret;
+  Link_array<PCol> ret;
 
-    PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
-    PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
+  PCursor<PCol*> start (l ? find_col (l)+1 : col_p_list_.top());
+  PCursor<PCol*> stop (r ? find_col (r) : col_p_list_.bottom());
   
-    /*
-      ugh! windows-suck-suck-suck.
-      */
-    while ( PCursor<PCol*>::compare (start,stop) < 0) {
+  /*
+    ugh! windows-suck-suck-suck.
+    */
+  while ( PCursor<PCol*>::compare (start,stop) < 0) 
+    {
        if (start->breakable_b() && !start->line_l_)
            ret.push (start);
        start++;
     }
 
-    return ret;
+  return ret;
 }
index 78f053d20ed072c0639b28a86373d4392a515ac3..8950d987232b80b2bd4c9a5aa94549ce08bf7403 100644 (file)
@@ -23,122 +23,152 @@ Paper_def::set_var (String s, Real r)
 {
    real_vars_p_->elem (s) = r;
 }
-
 Real
 Paper_def::get_var (String s)const
 {
-    if (! real_vars_p_->elt_b (s))
-       error ( "unknown paper variable `"  + s+"'");
-    return real_vars_p_->elem (s);
+  if (! real_vars_p_->elt_b (s))
+    error ( "unknown paper variable `"  + s+"'");
+  return real_vars_p_->elem (s);
 }
 
 Real
 Paper_def::linewidth_f() const
 {
-    return get_var ("linewidth");
+  return get_var ("linewidth");
+}
+
+Real
+Paper_def::duration_to_dist (Moment d,Real k)const
+{
+  if (get_var("geometric"))
+    return geometric_spacing(d);
+  return arithmetic_spacing(d,k);
 }
 
+
+/**
+  Get the measure wide constant for arithmetic.
+
+  @see   
+  John S. Gourlay. ``Spacing a Line of Music,'' Technical Report
+  OSU-CISRC-10/87-TR35, Department of Computer and Information Science,
+  The Ohio State University, 1987.
+
+  */
 Real
-Paper_def::duration_to_dist (Moment d)
+Paper_def::arithmetic_constant(Moment d) const
 {
-    Real dur_f = (d) ?pow (get_var ("geometric"), log_2(d)) : 0;
-    return get_var ("basicspace") + get_var ("unitspace")  * dur_f;
+  return get_var("arithmetic_basicspace") - log_2(Moment(1,8) <? d);
 }
 
+Real
+Paper_def::arithmetic_spacing(Moment d ,Real k)const
+{
+  return (log_2(d) + k)* get_var( "arithmetic_multiplier");
+}
+
+Real
+Paper_def::geometric_spacing(Moment d) const
+{
+  Real dur_f = (d) ?pow (get_var ("geometric"), log_2(d)) : 0;
+  return get_var ("basicspace") + get_var ("unitspace")  * dur_f;
+}
 
 Paper_def::Paper_def()
 {
-    itrans_p_ = 0;
-    lookup_p_ = 0;
-    real_vars_p_ = new Assoc<String,Real>;
+  itrans_p_ = 0;
+  lookup_p_ = 0;
+  real_vars_p_ = new Assoc<String,Real>;
 }
 
 Paper_def::~Paper_def()
 {
-    delete itrans_p_;
-    delete real_vars_p_;
-    delete lookup_p_;
+  delete itrans_p_;
+  delete real_vars_p_;
+  delete lookup_p_;
 }
 
 Paper_def::Paper_def (Paper_def const&s)
 {
-    itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_):0;
-    lookup_p_ = s.lookup_p_? new Lookup (*s.lookup_p_) : 0;
-    lookup_p_->paper_l_ = this;
-    real_vars_p_ = new Assoc<String,Real> (*s.real_vars_p_);
-    outfile_str_ = s.outfile_str_;
+  itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_):0;
+  lookup_p_ = s.lookup_p_? new Lookup (*s.lookup_p_) : 0;
+  lookup_p_->paper_l_ = this;
+  real_vars_p_ = new Assoc<String,Real> (*s.real_vars_p_);
+  outfile_str_ = s.outfile_str_;
 }
 
 void
 Paper_def::set (Input_translator * itrans_p)
 {
-    delete itrans_p_;
-    itrans_p_  = itrans_p;
+  delete itrans_p_;
+  itrans_p_  = itrans_p;
 }
 
 void
 Paper_def::set (Lookup*l)
 {
-    assert (l != lookup_p_);
-    delete lookup_p_;
-    lookup_p_ = l;
-    lookup_p_->paper_l_ = this;
+  assert (l != lookup_p_);
+  delete lookup_p_;
+  lookup_p_ = l;
+  lookup_p_->paper_l_ = this;
 }
 
 Real
 Paper_def::interline_f() const
 {
-    return get_var ("interline");
+  return get_var ("interline");
 }
 
 
 Real
 Paper_def::rule_thickness()const
 {
-    return get_var ("rule_thickness");
+  return get_var ("rule_thickness");
 }
 
 Real
 Paper_def::interbeam_f() const
 {
-    return get_var ("interbeam");
+  return get_var ("interbeam");
 }
 Real
 Paper_def::internote_f() const
 {
-    return interline_f() / 2; 
+  return interline_f() / 2; 
 }
 
 Real
 Paper_def::note_width()const
 {
-    return get_var ("notewidth");
+  return get_var ("notewidth");
 }
 
 void
 Paper_def::print() const
 {
 #ifndef NPRINT
-    DOUT << "Paper {";
-    DOUT << "out: " <<outfile_str_;
-    lookup_p_->print();
-    itrans_p_->print();
-    for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++) {
+  DOUT << "Paper {";
+  DOUT << "out: " <<outfile_str_;
+  lookup_p_->print();
+  itrans_p_->print();
+  for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++) 
+    {
        DOUT << i.key() << "= " << i.val () << "\n";
     }
-    DOUT << "}\n";
+  DOUT << "}\n";
 #endif
 }
 
 Lookup const *
 Paper_def::lookup_l()
 {
-    assert (lookup_p_);
-    return lookup_p_;
+  assert (lookup_p_);
+  return lookup_p_;
 }
 
 Global_translator*
 Paper_def::get_global_translator_p() const
 {
-    return  itrans_p_->get_group_engraver_p()->global_l ();
+  return  itrans_p_->get_group_engraver_p()->global_l ();
 }
index 8722ffb133c0bed1d6b8e1e3aea7fdbba97b18dd..b72857d0d2e10d183a02d1c3ea3f923f212bd44f 100644 (file)
@@ -1,7 +1,7 @@
 %{ // -*-Fundamental-*-
 
 /*
-  parser.y -- lily parser
+  parser.y -- YACC parser for mudela
 
   source file of the GNU LilyPond music typesetter
 
@@ -34,6 +34,8 @@
 #include "input-translator.hh"
 #include "score.hh"
 #include "music-list.hh"
+#include "header.hh"
+#include "duration-convert.hh"
 
 #ifndef NDEBUG
 #define YYDEBUG 1
@@ -62,6 +64,7 @@
     Music *music;
     Music_list *musiclist;
     Score *score;
+    Header *header;
     Interval *interval;
     Lookup*lookup;
     Melodic_req * melreq;
@@ -111,13 +114,14 @@ yylex(YYSTYPE *s,  void * v_l)
 %token CONSISTS
 %token ACCEPTS
 %token CM_T
-%token DURATIONCOMMAND
+%token DURATION
 %token ABSDYNAMIC
 %token END
 %token GROUPING
 %token GROUP
 %token REQUESTTRANSLATOR
 %token HSHIFT
+%token HEADER
 %token IN_T
 %token ID
 %token LYRIC
@@ -129,7 +133,7 @@ yylex(YYSTYPE *s,  void * v_l)
 %token MM_T
 %token MULTI
 %token NOTENAMES
-%token OCTAVECOMMAND
+%token OCTAVE
 %token OUTPUT
 %token PAPER
 %token PARTIAL
@@ -157,6 +161,7 @@ yylex(YYSTYPE *s,  void * v_l)
 %type <i>      dots
 %token <i>     INT
 %token <melreq>        NOTENAME_ID
+%token <id>    DURATION_IDENTIFIER
 %token <id>    IDENTIFIER
 %token <id>    MELODIC_REQUEST_IDENTIFIER 
 %token <id>    MUSIC_IDENTIFIER
@@ -173,11 +178,13 @@ yylex(YYSTYPE *s,  void * v_l)
 %token <id>    REQUEST_IDENTIFIER
 %token <real>  REAL 
 %token <string>        DURATION RESTNAME
-%token <string>        STRING
+%token <string>        STRING 
+%token <string> FIELDNAME RECORDLINE
 %token <i>     POST_QUOTES 
 %token <i>     PRE_QUOTES
 
 
+%type <header>         mudela_header mudela_header_body
 %type <box>    box
 %type <c>      open_request_parens close_request_parens
 %type <c>      open_plet_parens close_plet_parens
@@ -185,7 +192,8 @@ yylex(YYSTYPE *s,  void * v_l)
 %type <i>      int
 %type <i>      script_dir
 %type <id>     identifier_init
-%type <duration>       explicit_duration notemode_duration entered_notemode_duration
+%type <duration> explicit_steno_duration notemode_duration 
+%type <duration> entered_notemode_duration explicit_duration
 %type <interval>       dinterval
 %type <intvec> intastint_list
 %type <lookup> symtables symtables_body
@@ -201,7 +209,8 @@ yylex(YYSTYPE *s,  void * v_l)
 %type <paper>  paper_block paper_body
 %type <real>   dim real
 %type <real>   unit
-%type <request>        post_request pre_request command_req verbose_command_req abbrev_command_req
+%type <request>        post_request pre_request command_req verbose_command_req 
+%type <request> abbrev_command_req
 %type <request>        script_req  dynamic_req 
 %type <score>  score_block score_body
 %type <script> script_definition script_body mudela_script gen_script_def
@@ -211,12 +220,15 @@ yylex(YYSTYPE *s,  void * v_l)
 %type <symtable>       symtable symtable_body
 %type <itrans> input_translator_spec input_translator_spec_body
 %type <tempo>  tempo_request
+%type <string> header_record
 
 %left PRIORITY
 
 %%
 
 mudela:        /* empty */
+       | mudela mudela_header {
+       }
        | mudela score_block {
                add_score($2);          
        }
@@ -253,6 +265,40 @@ notenames_body:
                delete $2;
        }
        ;
+
+mudela_header_body:
+               {
+               $$ = new Header;
+       }
+       | mudela_header_body FIELDNAME header_record {
+               (*$$)[*$2] = *$3;
+               delete $2;
+               delete $3;
+       }
+       ;
+
+mudela_header:
+       HEADER  {
+               THIS->lexer_p_->push_header_state();
+       }
+       
+       '{' mudela_header_body '}'      {
+               $$ = $4;
+               THIS->lexer_p_->pop_state();
+       }
+       ;
+
+
+header_record:
+               {
+               $$ = new String;
+       }
+       | header_record RECORDLINE      {
+               *$$ += *$2;
+               delete $2;
+       }
+       ;
+
 /*
        DECLARATIONS
 */
@@ -311,6 +357,9 @@ identifier_init:
        | input_translator_spec {
                $$ = new Input_translator_id ( $1, INPUT_TRANS_IDENTIFIER);
        }
+       | explicit_duration {
+               $$ = new Duration_id( $1, DURATION_IDENTIFIER);
+       }
        ;
 
 
@@ -354,7 +403,9 @@ input_translator_spec_body:
        SCORE
 */
 score_block:
-       SCORE { THIS->remember_spot(); }
+       SCORE { THIS->remember_spot();
+               THIS->error_level_i_ =0;
+       }
        /*cont*/ '{' score_body '}'     {
                $$ = $4;
                $$->set_spot(THIS->pop_spot());
@@ -373,6 +424,9 @@ score_body:         {
        | SCORE_IDENTIFIER {
                $$ = $1->score();
        }
+       | score_body mudela_header      {
+               $$->header_p_ = $2;
+       }
        | score_body Music      {
                $$->music_p_ = $2;
        }
@@ -695,6 +749,14 @@ melodic_request:
        }
        ;
 
+explicit_duration:
+       DURATION '{' int int '}'        {
+               $$ = new Duration;
+               $$-> durlog_i_ = $3;
+               $$-> dots_i_ = $4;
+       }
+       ;
+
 dynamic_req:
        ABSDYNAMIC '{' int '}'  {
                Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
@@ -847,15 +909,15 @@ voice_command:
        PLET     INT '/' INT {
                THIS->default_duration_.set_plet($2,$4);
        }
-       | DURATIONCOMMAND STRING {
+       | DURATION STRING {
                THIS->set_duration_mode(*$2);
                delete $2;
        }
-       | DURATIONCOMMAND entered_notemode_duration {
+       | DURATION entered_notemode_duration {
                THIS->set_default_duration($2);
                delete $2;
        }
-       | OCTAVECOMMAND { 
+       | OCTAVE { 
                /*
                        This is weird, but default_octave_i_
                        is used in steno_note_req too
@@ -879,7 +941,7 @@ duration_length:
        {
                $$ = new Moment(0,1);
        }
-       | duration_length explicit_duration             {       
+       | duration_length explicit_steno_duration               {       
                *$$ += $2->length();
        }
        ;
@@ -897,7 +959,7 @@ entered_notemode_duration:
                $$ = new Duration(THIS->default_duration_);             
                $$->dots_i_  = $1;
        }
-       | explicit_duration     {
+       | explicit_steno_duration       {
                THIS->set_last_duration($1);
                $$ = $1;
        }
@@ -911,22 +973,25 @@ notemode_duration:
        }
        ;
 
-explicit_duration:
+explicit_steno_duration:
        int             {
                $$ = new Duration;
                if ( !Duration::duration_type_b($1) )
                        THIS->parser_error("Not a duration");
                else {
-                       $$->type_i_ = $1;
+                       $$->durlog_i_ = Duration_convert::i2_type($1);
                     }
        }
-       | explicit_duration '.'         {
+       | DURATION_IDENTIFIER   {
+               $$ = $1->duration();
+       }
+       | explicit_steno_duration '.'   {
                $$->dots_i_ ++;
        }
-       | explicit_duration '*' int  {
+       | explicit_steno_duration '*' int  {
                $$->plet_.iso_i_ *= $3; 
        }
-       | explicit_duration '/' int {
+       | explicit_steno_duration '/' int {
                $$->plet_.type_i_ *= $3; 
        }
        ;
index 266912313336a07ae012412d1883a10335a62fa4..ea11129e2543602e1d9ea9deb98dd8b4b6765ff8 100644 (file)
@@ -4,7 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-                 Jan Nieuwenhuizen <jan@digicash.com>
+               Jan Nieuwenhuizen <jan@digicash.com>
  */
 
 #include "performer-group-performer.hh"
@@ -22,12 +22,15 @@ Performer_group_performer::~Performer_group_performer()
 void
 Performer_group_performer::add (Performer *perf_p)
 {
-    perf_p_list_.bottom().add (perf_p);
-    perf_p->daddy_perf_l_ = this;
+  perf_p_list_.bottom().add (perf_p);
+  perf_p->daddy_perf_l_ = this;
 
-    if (perf_p->is_type_b (Performer_group_performer::static_name())) {
+  if (perf_p->is_type_b (Performer_group_performer::static_name())) 
+    {
        group_l_arr_.push ((Performer_group_performer*)perf_p);
-    } else {
+    }
+  else 
+    {
        nongroup_l_arr_ .push (perf_p);
     }
 }
@@ -35,22 +38,22 @@ Performer_group_performer::add (Performer *perf_p)
 Translator*
 Performer_group_performer::ancestor_l (int l)
 {
-    if (!l || !daddy_perf_l_)
+  if (!l || !daddy_perf_l_)
        return this;
-    
-    return daddy_perf_l_->ancestor_l (l - 1);
+  
+  return daddy_perf_l_->ancestor_l (l - 1);
 }
 
 int
 Performer_group_performer::depth_i() const
 {
-    return daddy_perf_l_->depth_i() + 1;
+  return daddy_perf_l_->depth_i() + 1;
 }
 
 void
 Performer_group_performer::do_creation_processing()
 {
-    for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
        i->creation_processing();
 }
 
@@ -58,9 +61,9 @@ void
 Performer_group_performer::do_print()const
 {
 #ifndef NPRINT
-    if ( !check_debug)
+  if ( !check_debug)
        return ;
-    for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
        i->print();
 #endif
 }
@@ -68,29 +71,31 @@ Performer_group_performer::do_print()const
 void
 Performer_group_performer::do_removal_processing()
 {
-    for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
        i->do_removal_processing();
 }
 
 bool
 Performer_group_performer::do_try_request (Request* req_l)
 {
-    bool hebbes_b =false;
-    for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
+  bool hebbes_b =false;
+  for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
        hebbes_b =nongroup_l_arr_[i]->try_request (req_l);
-    if ( !hebbes_b && daddy_perf_l_)
+  if ( !hebbes_b && daddy_perf_l_)
        hebbes_b = daddy_perf_l_->try_request (req_l);
-    return hebbes_b ;
+  return hebbes_b ;
 }
 
 Translator*
 Performer_group_performer::find_get_translator_l (String n,String id)
 {
-    Translator * ret=0;
-    Input_translator* itrans_l= itrans_l_-> recursive_find ( n);
-    if (itrans_l) {
+  Translator * ret=0;
+  Input_translator* itrans_l= itrans_l_-> recursive_find ( n);
+  if (itrans_l) 
+    {
        ret = find_performer_l (n,id);
-       if (!ret) {
+       if (!ret) 
+         {
            Performer_group_performer * group = 
                itrans_l-> get_group_performer_p();
            
@@ -102,66 +107,69 @@ Performer_group_performer::find_get_translator_l (String n,String id)
            else
                return ret->find_get_translator_l (n,id);
 
-       }
-    } else if (daddy_perf_l_)
+         }
+    }
+  else if (daddy_perf_l_)
        ret =daddy_perf_l_->find_get_translator_l (n,id);
-    else {
+  else 
+    {
        warning ("Can't find or create `" + n + "' called `" + id + "'\n");
        ret =0;
     }
-    return ret;
+  return ret;
 }
 
 Performer_group_performer*
 Performer_group_performer::find_performer_l (String n, String id)
 {
-    if (name() == n && id_str_ == id)
+  if (name() == n && id_str_ == id)
        return this;
-    Performer_group_performer * r = 0;
-    for (int i =0; !r && i<  group_l_arr_.size(); i++) {
+  Performer_group_performer * r = 0;
+  for (int i =0; !r && i<  group_l_arr_.size(); i++) 
+    {
        r = group_l_arr_[i]->find_performer_l (n,id);
     }
-    
-    return r;
+  
+  return r;
 }
 
 Translator*
 Performer_group_performer::get_default_interpreter()
 {
-    // ? 
-    if ( is_bottom_performer_b())
+  // ? 
+  if ( is_bottom_performer_b())
        return daddy_perf_l_->get_default_interpreter();
 
-    Performer_group_performer *perf_p= itrans_l_->
+  Performer_group_performer *perf_p= itrans_l_->
        get_default_itrans_l()->get_group_performer_p ();
-    add (perf_p);
-    if (perf_p->is_bottom_performer_b())
+  add (perf_p);
+  if (perf_p->is_bottom_performer_b())
        return perf_p;
-    else
+  else
        return perf_p->get_default_interpreter();
 }
 
 bool
 Performer_group_performer::is_bottom_performer_b() const
 {
-    return !itrans_l_->get_default_itrans_l();
+  return !itrans_l_->get_default_itrans_l();
 }
 
 void
 Performer_group_performer::print() const 
 { 
-    Performer::print();
+  Performer::print();
 }
 
 void
 Performer_group_performer::process_requests()
 {
-    for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
+  for ( PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++ )
        i->process_requests();
 }
 
 bool 
 Performer_group_performer::try_request (Request* r)
 {
-    return Performer::try_request (r); 
+  return Performer::try_request (r); 
 }
index 5e6fc2d9533d35a696c05285db748ba8ff202bce..ad2f9805ed00e7057ba77f7d6df497e0c3f3eb17 100644 (file)
@@ -4,7 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-                 Jan Nieuwenhuizen <jan@digicash.com>
+               Jan Nieuwenhuizen <jan@digicash.com>
  */
 
 
@@ -16,8 +16,8 @@ IMPLEMENT_IS_TYPE_B(Performer);
 
 Performer::Performer()
 {
-    daddy_perf_l_ = 0;
-    init_b_ =false;
+  daddy_perf_l_ = 0;
+  init_b_ =false;
 }
 
 Performer::~Performer()
@@ -32,22 +32,22 @@ Performer::do_print() const
 void 
 Performer::play (Audio_element* p) 
 { 
-    daddy_perf_l_->play (p); 
+  daddy_perf_l_->play (p); 
 }
 
 int
 Performer::get_tempo_i()const
 {
-    return daddy_perf_l_->get_tempo_i();
+  return daddy_perf_l_->get_tempo_i();
 }
 
 void
 Performer::print() const
 {
 #ifndef NPRINT
-    DOUT << "\n" << name() << " {";
-    do_print();
-    DOUT << "}";
+  DOUT << "\n" << name() << " {";
+  do_print();
+  DOUT << "}";
 #endif
 }
 
@@ -59,22 +59,24 @@ Performer::process_requests()
 bool 
 Performer::do_try_request (Request* req_l)
 {
-    return false;
+  return false;
 }
 
 bool
 Performer::try_request (Request*r)
 {
-    if (!init_b_) { 
+  if (!init_b_) 
+    {
        creation_processing();
     }
-    return do_try_request (r);
+  return do_try_request (r);
 }
 
 void
 Performer::creation_processing()
 {
-    if (!init_b_) { 
+  if (!init_b_) 
+    {
        do_creation_processing();
        init_b_ = true;
     }
index 6625b68babdf7140258b8f8f851c524e5016aa89..b7f9eee739c0cd195b4fc40645174e301ccd8e56 100644 (file)
 void
 Mixed_qp::add_equality_cons (Vector , double)
 {
-    assert (false);
+  assert (false);
 }
 
 void
 Mixed_qp::add_fixed_var (int i, Real r)
 {
-    eq_cons.push (i);
-    eq_consrhs.push (r);
+  eq_cons.push (i);
+  eq_consrhs.push (r);
 }
 
 
 /**
-    eliminate appropriate variables, until we have a Ineq_constrained_qp
-    then solve that.
+  eliminate appropriate variables, until we have a Ineq_constrained_qp
+  then solve that.
 
-    PRE
-    cons should be ascending
-    */
+  PRE
+  cons should be ascending
+  */
 Vector
 Mixed_qp::solve (Vector start) const 
 {
-    if (!dim())
+  if (!dim())
        return Vector (0);
-    
-    print();
-    Ineq_constrained_qp pure (*this);
-    
-    for  (int i= eq_cons.size()-1; i>=0; i--) {
+  
+  print();
+  Ineq_constrained_qp pure (*this);
+  
+  for  (int i= eq_cons.size()-1; i>=0; i--) 
+    {
        pure.eliminate_var (eq_cons[i], eq_consrhs[i]);
        start.del (eq_cons[i]);
     }
-    Vector sol = pure.solve (start);
-    for (int i= 0; i < eq_cons.size(); i++) {
+  Vector sol = pure.solve (start);
+  for (int i= 0; i < eq_cons.size(); i++) 
+    {
        sol.insert (eq_consrhs[i],eq_cons[i]);
     }
-    return sol;
+  return sol;
 }
 
 
 void
 Ineq_constrained_qp::assert_solution (Vector sol) const
 {
-    Array<int> binding;
-    for (int i=0; i < cons.size(); i++) {
+  Array<int> binding;
+  for (int i=0; i < cons.size(); i++) 
+    {
        Real R=cons[i] * sol- consrhs[i];
        assert (R> -EPS);
        if (R < EPS)
            binding.push (i);
     }
-    // KKT check...
-    // todo
+  // KKT check...
+  // todo
 }
 
 void
 Ineq_constrained_qp::print() const
 {
 #ifndef NPRINT
-    DOUT << "Quad " << quad;
-    DOUT << "lin " << lin <<"\n"
+  DOUT << "Quad " << quad;
+  DOUT << "lin " << lin <<"\n"
        << "const " << const_term<<"\n";
-    for (int i=0; i < cons.size(); i++) {
+  for (int i=0; i < cons.size(); i++) 
+    {
        DOUT << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i];
        DOUT << "\n";
     }
@@ -80,7 +84,7 @@ Ineq_constrained_qp::print() const
 }
 
 Mixed_qp::Mixed_qp (int n)
-    : Ineq_constrained_qp (n)
+  : Ineq_constrained_qp (n)
 {
 }
 
@@ -88,8 +92,8 @@ void
 Mixed_qp::OK() const
 {
 #ifndef NDEBUG
-    Ineq_constrained_qp::OK();
-    assert (eq_consrhs.size() == eq_cons.size ());
+  Ineq_constrained_qp::OK();
+  assert (eq_consrhs.size() == eq_cons.size ());
 #endif    
 }
 
@@ -97,8 +101,9 @@ void
 Mixed_qp::print() const
 {
 #ifndef NPRINT
-    Ineq_constrained_qp::print();
-    for (int i=0; i < eq_cons.size(); i++) {
+  Ineq_constrained_qp::print();
+  for (int i=0; i < eq_cons.size(); i++) 
+    {
        DOUT << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n";
     }
 #endif
index a7f438b77044e905bad83ea694e0baf28c2cabe4..d2ffad85d43115d539fdd57dd7b96905bb360e84 100644 (file)
@@ -19,42 +19,46 @@ const Real TOL=1e-1;                // roughly 1/30 mm
 String
 Active_constraints::status() const
 {
-    String s ("Active|Inactive [");
-    for (int i=0; i< active.size(); i++) {
+  String s ("Active|Inactive [");
+  for (int i=0; i< active.size(); i++) 
+    {
        s += String (active[i]) + " ";
     }
 
-    s+="| ";
-    for (int i=0; i< inactive.size(); i++) {
+  s+="| ";
+  for (int i=0; i< inactive.size(); i++) 
+    {
        s += String (inactive[i]) + " ";
     }
-    s+="]";
+  s+="]";
 
-    return s;
+  return s;
 }
 
 void
 Active_constraints::OK()
 {
 #ifndef NDEBUG
-    H.OK();
-    A.OK();
-    assert (active.size() +inactive.size () == opt->cons.size ());
-    assert (H.dim() == opt->dim ());
-    assert (active.size() == A.rows ());
-    Array<int> allcons;
-
-    for (int i=0; i < opt->cons.size(); i++)
+  H.OK();
+  A.OK();
+  assert (active.size() +inactive.size () == opt->cons.size ());
+  assert (H.dim() == opt->dim ());
+  assert (active.size() == A.rows ());
+  Array<int> allcons;
+
+  for (int i=0; i < opt->cons.size(); i++)
        allcons.push (0);
-    for (int i=0; i < active.size(); i++) {
+  for (int i=0; i < active.size(); i++) 
+    {
        int j = active[i];
        allcons[j]++;
     }
-    for (int i=0; i < inactive.size(); i++) {
+  for (int i=0; i < inactive.size(); i++) 
+    {
        int j = inactive[i];
        allcons[j]++;
     }
-    for (int i=0; i < allcons.size(); i++)
+  for (int i=0; i < allcons.size(); i++)
        assert (allcons[i] == 1);
 #endif
 }
@@ -62,25 +66,26 @@ Active_constraints::OK()
 Vector
 Active_constraints::get_lagrange (Vector gradient)
 {
-    return (A*gradient);
+  return (A*gradient);
 }
 
 void
 Active_constraints::add (int k)
 {
-    // add indices
-    int cidx=inactive[k];
-    active.push (cidx);
-
-    inactive.swap (k,inactive.size()-1);
-    inactive.pop();
-
-    Vector a (opt->cons[cidx]);
-    // update of matrices
-    Vector Ha = H*a;
-    Real aHa = a*Ha;
-    Vector addrow (Ha.dim());
-    if (abs (aHa) > EPS) {
+  // add indices
+  int cidx=inactive[k];
+  active.push (cidx);
+
+  inactive.swap (k,inactive.size()-1);
+  inactive.pop();
+
+  Vector a (opt->cons[cidx]);
+  // update of matrices
+  Vector Ha = H*a;
+  Real aHa = a*Ha;
+  Vector addrow (Ha.dim());
+  if (abs (aHa) > EPS) 
+    {
        /*
          a != 0, so if Ha = O(EPS), then
          Ha * aH / aHa = O(EPS^2/EPS)
@@ -88,72 +93,73 @@ Active_constraints::add (int k)
          if H*a == 0, the constraints are dependent.
          */
        H -= Matrix (Ha/aHa , Ha);
-    
+  
 
        /*
          sorry, don't know how to justify this. ..
          */
        addrow=Ha;
-        addrow/= aHa;
+      addrow/= aHa;
        A -= Matrix (A*a, addrow);
        A.insert_row (addrow,A.rows());
-    }else
+  }else
        WARN << "degenerate constraints";
 }
 
 void
 Active_constraints::drop (int k)
 {
-    int q=active.size()-1;
+  int q=active.size()-1;
 
-        // drop indices
-    inactive.push (active[k]);
-    active.swap (k,q);
-    A.swap_rows (k,q);
-    active.pop();
+      // drop indices
+  inactive.push (active[k]);
+  active.swap (k,q);
+  A.swap_rows (k,q);
+  active.pop();
 
-    Vector a (A.row (q));
-    if (a.norm() > EPS) {
+  Vector a (A.row (q));
+  if (a.norm() > EPS) 
+    {
        /*
         
         */
-        Real q = a*opt->quad*a;
+      Real q = a*opt->quad*a;
        Matrix aaq (a,a/q);
        H += aaq;
        A -= A*opt->quad*aaq;
-    }else
+  }else
        WARN << "degenerate constraints";
 #ifndef NDEBUG
-    Vector rem_row (A.row (q));
-    assert (rem_row.norm() < EPS);
+  Vector rem_row (A.row (q));
+  assert (rem_row.norm() < EPS);
 #endif
-     
-    A.delete_row (q);
+   
+  A.delete_row (q);
 }
 
 
 Active_constraints::Active_constraints (Ineq_constrained_qp const *op)
-    :       A(0,op->dim()),
+  :       A(0,op->dim()),
            H(op->dim()),
            opt (op)
 {
-    for (int i=0; i < op->cons.size(); i++)
+  for (int i=0; i < op->cons.size(); i++)
        inactive.push (i);
-    Choleski_decomposition chol (op->quad);
+  Choleski_decomposition chol (op->quad);
 
-    /*
-      ugh.
-     */
-    H=chol.inverse();
-    OK();
+  /*
+    ugh.
+   */
+  H=chol.inverse();
+  OK();
 }
 
 /** Find the optimum which is in the planes generated by the active
-    constraints.        
-    */
+  constraints.        
+  */
 Vector
 Active_constraints::find_active_optimum (Vector g)
 {
-    return H*g;
+  return H*g;
 }
 
index 0b177e39ac7697381ab17633f082dcf56ea712a9..1b431d2f2d270e51efdbb1d3e2384b1c3769131c 100644 (file)
@@ -20,24 +20,24 @@ Request::do_print() const
 MInterval
 Request::time_int() const
 {
-    return MInterval (0, duration());
+  return MInterval (0, duration());
 }
 
 
 bool
 Request::equal_b (Request *r)const
 {
-    if ( is_type_b ( r->name()) )
+  if ( is_type_b ( r->name()) )
        return r->do_equal_b ((Request*)this);
-    if ( r->is_type_b (name()))
+  if ( r->is_type_b (name()))
        return do_equal_b (r);
         
-    return false;
+  return false;
 }
 
 bool
 Request::do_equal_b (Request*)const
 {
-    return false;
+  return false;
 }
-    
+  
index 7f3dc025072fb0034f2872a15e3611b92cf3b6c8..86a4030bdfcd5ffdcca1d5d8d7ebfb32462903ba 100644 (file)
@@ -19,13 +19,14 @@ ADD_THIS_ENGRAVER(Rest_collision_engraver);
 
 Rest_collision_engraver::Rest_collision_engraver()
 {
-    rest_collision_p_ =0;
+  rest_collision_p_ =0;
 }
 
 void
 Rest_collision_engraver::make_collision()
 {
-    if (!rest_collision_p_) {
+  if (!rest_collision_p_) 
+    {
            rest_collision_p_ = new Rest_collision;
            announce_element (Score_elem_info (rest_collision_p_, 0));
     }
@@ -33,12 +34,15 @@ Rest_collision_engraver::make_collision()
 void
 Rest_collision_engraver::acknowledge_element (Score_elem_info i)
 {
-    char const * nC = i.elem_l_->name();
-    if (nC == Note_column::static_name()) {
+  char const * nC = i.elem_l_->name();
+  if (nC == Note_column::static_name()) 
+    {
        // what should i do, what should _engraver do?
        make_collision();
        rest_collision_p_->add ((Note_column*)i.elem_l_->item());
-    } else if (nC == Rest_column::static_name()) {
+    }
+  else if (nC == Rest_column::static_name()) 
+    {
        make_collision();
        rest_collision_p_->add ((Rest_column*)i.elem_l_->item());
     }
@@ -47,7 +51,8 @@ Rest_collision_engraver::acknowledge_element (Score_elem_info i)
 void
 Rest_collision_engraver::do_pre_move_processing()
 {
-    if (rest_collision_p_) {
+  if (rest_collision_p_) 
+    {
        typeset_element (rest_collision_p_);
        rest_collision_p_ = 0;
     }
@@ -57,7 +62,7 @@ void
 Rest_collision_engraver::do_print() const
 {
 #ifndef NPRINT
-    if ( rest_collision_p_)
+  if ( rest_collision_p_)
        rest_collision_p_->print();
 #endif
 }
index 10fb35ec70d05a4fdf020eaeeac0ee6d87360369..d5b4217f7eceabfc2ac45061fcb9bed79deb1fb0 100644 (file)
@@ -21,82 +21,84 @@ IMPLEMENT_IS_TYPE_B1(Rest_collision,Item);
 void
 Rest_collision::add (Note_column *nc_l)
 {
-    add_dependency (nc_l);
-    ncol_l_arr_.push (nc_l);
+  add_dependency (nc_l);
+  ncol_l_arr_.push (nc_l);
 }
 
 void
 Rest_collision::add (Rest_column *rc_l)
 {
-    add_dependency (rc_l);
-    rest_l_arr_.push (rc_l);
+  add_dependency (rc_l);
+  rest_l_arr_.push (rc_l);
 }
 
 void
 Rest_collision::do_post_processing()
 {
-    /*
-      handle rest under beam (do_post: beams are calculated now)
-
-      [todo]
-      i-d like to have access to the beam itself, 
-      iso only the (half-initialised?) stem
-
-      what about combination of collisions and rest under beam
-     */
-
-    // no rests to collide
-    if (!rest_l_arr_.size())
-       return;
-    // can this happen?
-    Stem* stem_l = rest_l_arr_[0]->stem_l_;
-    if (!stem_l)
-       return;
-    // no beam
-    if (!(stem_l->beams_left_i_ || stem_l->beams_right_i_))
-       return;
-
-    int dir_i = rest_l_arr_[0]->dir_i_;
-    int midpos = 4;
+  /*
+    handle rest under beam (do_post: beams are calculated now)
+
+    [todo]
+    i-d like to have access to the beam itself, 
+    iso only the (half-initialised?) stem
+
+    what about combination of collisions and rest under beam
+   */
+
+  // no rests to collide
+  if (!rest_l_arr_.size())
+       return;
+  // can this happen?
+  Stem* stem_l = rest_l_arr_[0]->stem_l_;
+  if (!stem_l)
+       return;
+  // no beam
+  if (!(stem_l->beams_left_i_ || stem_l->beams_right_i_))
+       return;
+
+  int dir_i = rest_l_arr_[0]->dir_i_;
+  int midpos = 4;
 #if 1
-    // ugh
-    int stem_length_i = 7 - 2;
-    // ugh, Stem::stem_start vs Stem::stem_end
-    int pos = (stem_l->stem_end_f() - midpos) - dir_i * stem_length_i;
+  // ugh
+  int stem_length_i = 7 - 2;
+  // ugh, Stem::stem_start vs Stem::stem_end
+  int pos = (stem_l->stem_end_f() - midpos) - dir_i * stem_length_i;
 #else // nogo: stem_start not set for rests?
-    int pos = (stem_l->stem_start_f() - midpos) + dir_i * 2;
+  int pos = (stem_l->stem_start_f() - midpos) + dir_i * 2;
 #endif
-    rest_l_arr_[0]->translate_heads (pos);     
+  rest_l_arr_[0]->translate_heads (pos);       
 }
 
 void
 Rest_collision::do_pre_processing()
 {
-    /* 
-      handle rest-rest and rest-note collisions
+  /* 
+    handle rest-rest and rest-note collisions
 
-      [todo]
-      decide not to print rest if too crowded?
-     */
+    [todo]
+    decide not to print rest if too crowded?
+   */
 
-    // no rests to collide
-    if (!rest_l_arr_.size())
-       return;
+  // no rests to collide
+  if (!rest_l_arr_.size())
+       return;
 
-    // no partners to collide with
-    if (rest_l_arr_.size() + ncol_l_arr_.size () < 2)
+  // no partners to collide with
+  if (rest_l_arr_.size() + ncol_l_arr_.size () < 2)
        return;
 
-    // meisjes met meisjes
-    if (!ncol_l_arr_.size()) {
+  // meisjes met meisjes
+  if (!ncol_l_arr_.size()) 
+    {
        int dy = rest_l_arr_.size() > 2 ? 6 : 4;
        
        rest_l_arr_[0]->translate_heads (rest_l_arr_[0]->dir_i_ *dy);   
        // top is last element...
        rest_l_arr_.top()->translate_heads (rest_l_arr_.top ()->dir_i_* dy);    
     }
-    // meisjes met jongetjes
-    else {
+  // meisjes met jongetjes
+  else 
+    {
 #if 0 // breendet: rests go always under
        // geen gemug, trug op je rug
        int dir_i = -1;
@@ -107,7 +109,7 @@ Rest_collision::do_pre_processing()
        // hope it's 4: if it works->doco
        int midpos = 4;
        
-        // minimum move
+      // minimum move
        int minpos = 4;
        
        // quart rest height
@@ -115,13 +117,14 @@ Rest_collision::do_pre_processing()
        int size_i = 6;
        
        int sep_i = 3 + size_i / 2;
-       for (int i = 0; i < ncol_l_arr_.size(); i++) {
+       for (int i = 0; i < ncol_l_arr_.size(); i++) 
+         {
            // how to know whether to sort?
            ncol_l_arr_[i]->sort();
            for ( int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++)
                minpos = minpos >? dir_i * 
                    (ncol_l_arr_[i]->head_l_arr_[j]->position_i_ -midpos) + sep_i;
-       }
+         }
        rest_l_arr_[0]->translate_heads (dir_i * minpos);       
 #endif
     }
@@ -131,23 +134,23 @@ void
 Rest_collision::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "rests: " << rest_l_arr_.size() << ", ";
-    DOUT << "cols: " << ncol_l_arr_.size();
+  DOUT << "rests: " << rest_l_arr_.size() << ", ";
+  DOUT << "cols: " << ncol_l_arr_.size();
 #endif
 }
 
 void
 Rest_collision::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    Item*o_l = o->item();
-    Item*n_l = n?n->item():0;
-    
-    rest_l_arr_.substitute ((Rest_column*)o_l,(Rest_column*)n_l);
-    ncol_l_arr_.substitute ((Note_column*)o_l,(Note_column*)n_l);
+  Item*o_l = o->item();
+  Item*n_l = n?n->item():0;
+  
+  rest_l_arr_.substitute ((Rest_column*)o_l,(Rest_column*)n_l);
+  ncol_l_arr_.substitute ((Note_column*)o_l,(Note_column*)n_l);
 }
 
 Rest_collision::Rest_collision()
 {
-    transparent_b_ = true;
-    empty_b_ = true;
+  transparent_b_ = true;
+  empty_b_ = true;
 }
index 3b17ca9ac7cd8dc8e04576b0d74699245cc82703..0c7260ee623106519362fe7a134083fbdbbc2f51 100644 (file)
@@ -22,7 +22,7 @@ IMPLEMENT_IS_TYPE_B1(Rest_column,Head_column);
 void
 Rest_column::translate_heads (int dy_i)
 {
-    for (int i=0; i < head_l_arr_.size(); i++)
+  for (int i=0; i < head_l_arr_.size(); i++)
        head_l_arr_[i]->position_i_ += dy_i;
 }
 
index c66cdebd48a5ab16242a3c05975532a57c57e233..d86903eb7bddd907ad5c19e7e842a792f0789647 100644 (file)
 
 Score_align_engraver::Score_align_engraver()
 {
-    type_ch_C_ = 0;
-    priority_i_ =0;
-    align_p_=0;
+  type_ch_C_ = 0;
+  priority_i_ =0;
+  align_p_=0;
 }
 
 void
 Score_align_engraver::do_pre_move_processing()
 {
-    if (align_p_) {
+  if (align_p_) 
+    {
        typeset_element (align_p_);
        align_p_ =0;
     }
@@ -30,19 +31,21 @@ Score_align_engraver::do_pre_move_processing()
 void
 Score_align_engraver::acknowledge_element (Score_elem_info inf)
 {
-    if (inf.elem_l_->is_type_b (type_ch_C_)) {
-    
-       if (!align_p_) {
+  if (inf.elem_l_->is_type_b (type_ch_C_)) 
+    {
+  
+       if (!align_p_) 
+         {
            align_p_ = new Horizontal_group_item;
            align_p_->breakable_b_ = true;
            announce_element (Score_elem_info (align_p_,0));
-       }
+         }
        Score_elem * unbound_elem = inf.elem_l_;
        while ( unbound_elem->axis_group_l_a_[X_AXIS])
            unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS];
        align_p_->add_element (unbound_elem);
     }
-    
+  
 }
 
 IMPLEMENT_IS_TYPE_B1(Score_align_engraver,Engraver);
index 995c6fbdd697b0c1ec53350bffc042d6ba3b5e5c..32127d18867ead08bf93d9964f7f42ac8dfbd615 100644 (file)
 class C ## _align_engraver : public Score_align_engraver               \
 {                                                                      \
 public:                                                                        \
-    DECLARE_MY_RUNTIME_TYPEINFO;                                       \
-    C ## _align_engraver() : Score_align_engraver () \
-    { type_ch_C_ = T::static_name();\
-    priority_i_ = p;}  \
+  DECLARE_MY_RUNTIME_TYPEINFO;                                 \
+  C ## _align_engraver() : Score_align_engraver () \
+  { type_ch_C_ = T::static_name();\
+  priority_i_ = p;}    \
 };                                                                     \
 ADD_THIS_ENGRAVER(C ## _align_engraver);                               \
 IMPLEMENT_IS_TYPE_B1(C ## _align_engraver, Score_align_engraver)       ;
index 9accf652a91627ca76c088eb38f510092d909102..d6f4e739a5da518cbf77194882aba931e78121fb 100644 (file)
 
 Score_column::Score_column (Moment w)
 {
-    when_ = w;
-    musical_b_ = false;
+  when_ = w;
+  musical_b_ = false;
 }
 
 void
 Score_column::print() const
 {
 #ifndef NPRINT
-    DOUT << "Score_column { mus "<< musical_b_ <<" at " <<  when_<<'\n';
-    DOUT << "durations: [";
-    for (int i=0; i < durations.size(); i++)
+  DOUT << "Score_column { mus "<< musical_b_ <<" at " <<  when_<<'\n';
+  DOUT << "durations: [";
+  for (int i=0; i < durations.size(); i++)
        DOUT << durations[i] << " ";
-    DOUT << "]\n";
-    PCol::print();
-    DOUT << "}\n";
+  DOUT << "]\n";
+  PCol::print();
+  DOUT << "}\n";
 #endif
 }
 
 int
 Moment_compare (Moment const &m1, Moment const &m2)
 {
-    return sign (m1-m2);
+  return sign (m1-m2);
 }
 
 void
 Score_column::preprocess()
 {
-    durations.sort (Moment_compare);
+  durations.sort (Moment_compare);
 }
 
 void
 Score_column::add_duration (Moment d)
 {
-    assert (d);
-    for (int i = 0; i< durations.size(); i++) {
+  assert (d);
+  for (int i = 0; i< durations.size(); i++) 
+    {
        if (d == durations[i])
            return ;
     }
-    durations.push (d);
+  durations.push (d);
 }
 
 void
 Score_column::do_set_breakable()
 {
-    Score_column *c1 = new Score_column (when_);
-    Score_column *c2 = new Score_column (when_);
-    prebreak_p_ =c1;
-    postbreak_p_ = c2;
-    c1->durations = durations;
-    c2->durations = durations;
-    c1->musical_b_ 
+  Score_column *c1 = new Score_column (when_);
+  Score_column *c2 = new Score_column (when_);
+  prebreak_p_ =c1;
+  postbreak_p_ = c2;
+  c1->durations = durations;
+  c2->durations = durations;
+  c1->musical_b_ 
        = c2->musical_b_ = musical_b_;
 }
index 07e7a100b64850dae2881c2fc03d9c3305673ba6..4bfd4c2a16405b718d56a814cf3798f0cd952f61 100644 (file)
 
 Score_elem_info::Score_elem_info (Score_elem*s_l, Request*r_l)
 {
-    elem_l_ = s_l;
-    req_l_ = r_l;
+  elem_l_ = s_l;
+  req_l_ = r_l;
 }
 
 Score_elem_info::Score_elem_info()
 {
-    elem_l_ = 0;
-    req_l_ = 0;
+  elem_l_ = 0;
+  req_l_ = 0;
 }
 
 
index a471ddf5bb0be9b85fa514b9bdaf5770255cf452..5569e5bf8354685112d3a6ab789d008b2216ea18 100644 (file)
 Score_elem*
 Score_elem::dependency (int i)const
 {
-    return (Score_elem*) get_out_edge_arr()[i];
+  return (Score_elem*) get_out_edge_arr()[i];
 }
 
 int
 Score_elem::dependency_size() const
 {
-    return get_out_edge_arr().size ();
+  return get_out_edge_arr().size ();
 }
 
 Score_elem*
 Score_elem::dependent (int i) const
 {
-    return (Score_elem*) get_in_edge_arr()[i];
+  return (Score_elem*) get_in_edge_arr()[i];
 }
 
 int
 Score_elem::dependent_size() const
 {
-    return get_in_edge_arr().size ();
+  return get_in_edge_arr().size ();
 }
 
 
@@ -50,60 +50,60 @@ Score_elem::dependent_size() const
 String
 Score_elem::TeX_string_without_offset (Offset o)const
 {
-    if (transparent_b_)
+  if (transparent_b_)
        return "";
-    String s ("\\placebox{%}{%}{%}");
-    Array<String> a;
-    a.push (print_dimen (o.y()));
-    a.push (print_dimen (o.x()));
-    String t = output->TeX_string();
-    if (t == "")
+  String s ("\\placebox{%}{%}{%}");
+  Array<String> a;
+  a.push (print_dimen (o.y()));
+  a.push (print_dimen (o.x()));
+  String t = output->TeX_string();
+  if (t == "")
        return t;
 
-    a.push (t);
-    String r;
-    if (check_debug)
+  a.push (t);
+  String r;
+  if (check_debug)
        r = String ("\n%start: ") + name() + "\n";
-    r += substitute_args (s, a);;
-    return r;
+  r += substitute_args (s, a);;
+  return r;
 }
 
 String
 Score_elem::TeX_string() const
 {
-    assert (status_ > POSTCALCED);
-    return TeX_string_without_offset (offset_);
+  assert (status_ > POSTCALCED);
+  return TeX_string_without_offset (offset_);
 }
 
 void
 Score_elem::copy_dependencies (Score_elem const &s)
 {
-    /* called from derived ctor, so most info points to the same deps
-      as (Directed_graph_node&)s. Nobody points to us, so don't copy
-      dependents.      
-     */
-    copy_edges_out (s);
+  /* called from derived ctor, so most info points to the same deps
+    as (Directed_graph_node&)s. Nobody points to us, so don't copy
+    dependents.      
+   */
+  copy_edges_out (s);
 }
 
 Score_elem::Score_elem (Score_elem const&s)
 {
-    transparent_b_ = s.transparent_b_;
-    empty_b_ = s.empty_b_;
-    axis_group_l_a_[0] = axis_group_l_a_[1] =0;
-    status_ = s.status_;
-    assert (!s.output);
-    output = 0;
-    pscore_l_ = s.pscore_l_;
-    offset_ = Offset (0,0);
+  transparent_b_ = s.transparent_b_;
+  empty_b_ = s.empty_b_;
+  axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+  status_ = s.status_;
+  assert (!s.output);
+  output = 0;
+  pscore_l_ = s.pscore_l_;
+  offset_ = Offset (0,0);
 }
 
 Score_elem::~Score_elem()
 {
-    // some paranoia to prevent weird segv's
-    assert (status_ < DELETED);
-    delete output;
-    status_ = DELETED;
-    output = 0;
+  // some paranoia to prevent weird segv's
+  assert (status_ < DELETED);
+  delete output;
+  status_ = DELETED;
+  output = 0;
 
 }
 
@@ -113,55 +113,55 @@ Score_elem::~Score_elem()
 Real
 Score_elem::absolute_coordinate (Axis a)const
 {
-    Real r = offset_[a];
-    for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
+  Real r = offset_[a];
+  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
          axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a])
        
        r += axis_group_l->offset_[a];
-    return r;
+  return r;
 }
  
 
 Offset
 Score_elem::absolute_offset() const
 {
-    return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
+  return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS));
 }
 
  void
 Score_elem::translate (Real y, Axis a)
 {
-    offset_[a] += y;
+  offset_[a] += y;
 }
 
 Real
 Score_elem::relative_coordinate (Axis_group_element*e, Axis a)const
 {
-    Real r =0.0;
-    for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
+  Real r =0.0;
+  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
          axis_group_l != e;
          axis_group_l = axis_group_l->axis_group_l_a_[a])
        r +=  axis_group_l->offset_[a];
 
-    return r;
+  return r;
 }
 
 Axis_group_element* 
 Score_elem::common_group (Score_elem const* s, Axis a)const
 {
-    Link_array<Axis_group_element> my_groups;
-    for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
+  Link_array<Axis_group_element> my_groups;
+  for ( Axis_group_element * axis_group_l = axis_group_l_a_[a];
          axis_group_l;
          axis_group_l = axis_group_l->axis_group_l_a_[a])
        my_groups.push (axis_group_l);
 
-    Axis_group_element* common_l=0;
-    for ( Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
+  Axis_group_element* common_l=0;
+  for ( Axis_group_element * axis_group_l = s->axis_group_l_a_[a];
          !common_l && axis_group_l;
          axis_group_l = axis_group_l->axis_group_l_a_[a])
        common_l = my_groups.find_l (axis_group_l);
 
-    return common_l;
+  return common_l;
 }
 
 
@@ -169,61 +169,66 @@ Score_elem::common_group (Score_elem const* s, Axis a)const
 void
 Score_elem::translate (Offset O)
 {
-    offset_ += O;
+  offset_ += O;
 }
 
 Interval
 Score_elem::do_width() const 
 {
-    Interval r;
+  Interval r;
 
-    if (!output){
+  if (!output)
+    {
        Molecule*m = brew_molecule_p();
        r = m->extent().x ();
        delete m;
-    } else
+    }
+  else
        r = output->extent().x ();
-    return r;
+  return r;
 }
 
 Interval
 Score_elem::width() const
 {
-    return extent (X_AXIS);
+  return extent (X_AXIS);
 }
 
 Interval
 Score_elem::extent (Axis a)const
 {
-    Interval r;
-    if ( !empty_b_) {
+  Interval r;
+  if ( !empty_b_) 
+    {
        
        r = (a == X_AXIS)? do_width(): do_height ();
     }
-    
-    if (!r.empty_b()) // float exception on DEC Alpha
+  
+  if (!r.empty_b()) // float exception on DEC Alpha
        r+=offset_[a];
 
-    return r;
+  return r;
 }
 
 Interval
 Score_elem::do_height() const 
 {
-    Interval r;
-    if (!output){
+  Interval r;
+  if (!output)
+    {
        Molecule*m = brew_molecule_p();
        r = m->extent().y ();
        delete m;
-    } else
+    }
+  else
        r = output->extent().y ();
-    return r;
+  return r;
 }
 
 Interval
 Score_elem::height() const
 {
-    return extent (Y_AXIS);
+  return extent (Y_AXIS);
 }
 
 /*
@@ -233,170 +238,172 @@ void
 Score_elem::print()const
 {
 #ifndef NPRINT
-    DOUT << name() << "{\n";
-    DOUT << "dets: " << dependent_size() << "dependencies: " << 
+  DOUT << name() << "{\n";
+  DOUT << "dets: " << dependent_size() << "dependencies: " << 
        dependency_size();
-    if (offset_.x() || offset_.y ())
+  if (offset_.x() || offset_.y ())
        DOUT << "offset (" << offset_.x() << ", " << offset_.y () <<")";
-    DOUT << "\n";
+  DOUT << "\n";
 
-    do_print();
-    if (output)
+  do_print();
+  if (output)
        output->print();
-    
-    DOUT <<  "}\n";
+  
+  DOUT <<  "}\n";
 #endif
 }
 
 Score_elem::Score_elem()
 {
-    transparent_b_ = empty_b_ = false;
-    axis_group_l_a_[0] = axis_group_l_a_[1] =0;
-    pscore_l_=0;
-    offset_ = Offset (0,0);
-    output = 0;
-    status_ = ORPHAN;
+  transparent_b_ = empty_b_ = false;
+  axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+  pscore_l_=0;
+  offset_ = Offset (0,0);
+  output = 0;
+  status_ = ORPHAN;
 }
 
 
 Paper_def*
 Score_elem::paper()  const
 {
-    assert (pscore_l_);
-    return pscore_l_->paper_l_;
+  assert (pscore_l_);
+  return pscore_l_->paper_l_;
 }
 
 void
 Score_elem::add_processing()
 {
-    if (status_ >= VIRGIN)
+  if (status_ >= VIRGIN)
        return;
-    status_ = VIRGIN;
-    do_add_processing();
+  status_ = VIRGIN;
+  do_add_processing();
 }
 
 void
 Score_elem::pre_processing()
 {
-    if (status_ >= PRECALCED)
+  if (status_ >= PRECALCED)
        return;
 
-    assert (status_ != PRECALCING); // cyclic dependency
-    status_ = PRECALCING;
+  assert (status_ != PRECALCING); // cyclic dependency
+  status_ = PRECALCING;
 
-    for (int i=0; i < dependency_size(); i++)
+  for (int i=0; i < dependency_size(); i++)
        dependency (i)->pre_processing();
 
-    Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->pre_processing();
-    
-    do_pre_processing();
-    status_ = PRECALCED;
+  
+  do_pre_processing();
+  status_ = PRECALCED;
 }
 
 void
 Score_elem::breakable_col_processing()
 {
-    if (status_ >= PREBROKEN)
+  if (status_ >= PREBROKEN)
        return;
 
-    if (status_== PREBREAKING) {
+  if (status_== PREBREAKING) 
+    {
        status_ = PREBROKEN;
        return ;
     }
-    status_ = PREBREAKING;
+  status_ = PREBREAKING;
 
-    for (int i=0; i < dependency_size(); i++)
+  for (int i=0; i < dependency_size(); i++)
        dependency (i)->breakable_col_processing();
 
-      Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+    Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->breakable_col_processing();
-    
   
-    do_breakable_col_processing();
-    status_ = PREBROKEN;
+  
+  do_breakable_col_processing();
+  status_ = PREBROKEN;
 }
 
 void
 Score_elem::break_processing()
 {
-    if (status_ >= BROKEN)
+  if (status_ >= BROKEN)
        return;
 
-    if (status_ == BREAKING) {
+  if (status_ == BREAKING) 
+    {
        status_ = BROKEN;
        return;
     }
-    status_ = BREAKING;
+  status_ = BREAKING;
 
-    for (int i=0; i < dependency_size(); i++)
+  for (int i=0; i < dependency_size(); i++)
        dependency (i)->break_processing();
 
-    Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->break_processing();
-    
+  
 
-    
-    do_break_processing();
-    status_ = BROKEN;
+  
+  do_break_processing();
+  status_ = BROKEN;
 
 }
 
 void
 Score_elem::do_break_processing()
 {
-    handle_broken_dependencies();
+  handle_broken_dependencies();
 }
 
 
 void
 Score_elem::post_processing()
 {
-    if (status_ >= POSTCALCED)
+  if (status_ >= POSTCALCED)
        return;
-    assert (status_ != POSTCALCING);// cyclic dependency
-    status_=POSTCALCING;       
+  assert (status_ != POSTCALCING);// cyclic dependency
+  status_=POSTCALCING; 
 
   
-    for (int i=0; i < dependency_size(); i++)
+  for (int i=0; i < dependency_size(); i++)
        dependency (i)->post_processing();
 
-    Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->post_processing();
-    
+  
 
-    do_post_processing();
-    status_=POSTCALCED;
+  do_post_processing();
+  status_=POSTCALCED;
 }
 
 Score_elem::Status
 Score_elem::status()const
 {
-    return status_;
+  return status_;
 }
 
 void 
 Score_elem::molecule_processing()
 {
-    if (status_ >= OUTPUT)
+  if (status_ >= OUTPUT)
        return;
-    status_ = OUTPUT;          // do it only once.
+  status_ = OUTPUT;            // do it only once.
   
-    for (int i=0; i < dependency_size(); i++)
+  for (int i=0; i < dependency_size(); i++)
        dependency (i)->molecule_processing();
 
-    Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->molecule_processing();
-    
+  
 
-    if (transparent_b_)
+  if (transparent_b_)
        return ;
-    output= brew_molecule_p();
+  output= brew_molecule_p();
 }
 
 /*
@@ -412,7 +419,7 @@ Score_elem::do_post_processing()
 void
 Score_elem::do_breakable_col_processing()
 {
-    handle_prebroken_dependencies();
+  handle_prebroken_dependencies();
 }
 
 void
@@ -443,15 +450,15 @@ IMPLEMENT_IS_TYPE_B(Score_elem);
 Molecule*
 Score_elem::brew_molecule_p()const
 {
-    Atom a (paper()->lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
-    return new Molecule (a);
+  Atom a (paper()->lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
+  return new Molecule (a);
 }
 
 
 Line_of_score *
 Score_elem::line_l()const
 {
-    return 0;
+  return 0;
 }
 
 /*
@@ -463,26 +470,27 @@ Score_elem::line_l()const
 void
 Score_elem::remove_dependency (Score_elem*e)
 {
-    remove_edge_out (e);
-    substitute_dependency (e, 0);
+  remove_edge_out (e);
+  substitute_dependency (e, 0);
 }
 
 void
 Score_elem::add_dependency (Score_elem*e)
 {
-    Directed_graph_node::add (e);
+  Directed_graph_node::add (e);
 }
 void
 Score_elem::substitute_dependency (Score_elem* old, Score_elem* new_l)
 {
-    do_substitute_dependency (old,new_l);
-    old->do_substitute_dependent (this, 0);
+  do_substitute_dependency (old,new_l);
+  old->do_substitute_dependent (this, 0);
 }
 
 void
 Score_elem::junk_dependencies()
 {
-    while ( dependency_size()) {
+  while ( dependency_size()) 
+    {
        remove_edge_out (dependency (0));
     }
 }
@@ -490,37 +498,42 @@ Score_elem::junk_dependencies()
 void
 Score_elem::handle_broken_dependencies()
 {
-    Line_of_score *line  = line_l();
-    if (!line)
+  Line_of_score *line  = line_l();
+  if (!line)
        return;
 
-    Link_array<Score_elem> remove_us_arr;
-    for (int i=0; i < dependency_size(); i++) {
+  Link_array<Score_elem> remove_us_arr;
+  for (int i=0; i < dependency_size(); i++) 
+    {
        Score_elem * elt = dependency (i);
-       if (elt->line_l() != line){ 
-           if (elt->spanner()) {
+       if (elt->line_l() != line)
+         {
+           if (elt->spanner()) 
+             {
                Spanner * sp = elt->spanner();
                Spanner * broken = sp->find_broken_piece (line);
                substitute_dependency (sp, broken);
 
                add_dependency (broken);
-           } else if (elt->item() && elt->item ()->pcol_l_->breakpoint_b ()
-                      && elt->item()->break_status_i () == 0) {
+             }
+           else if (elt->item() && elt->item ()->pcol_l_->breakpoint_b ()
+                      && elt->item()->break_status_i () == 0) 
+                        {
                Item * my_item = elt->item()->find_prebroken_piece (line);
                substitute_dependency (elt, my_item);
                if (my_item)
                    add_dependency (my_item);
-           }
+             }
            remove_us_arr.push (elt);
-       } 
+         }
     }
 
-    remove_us_arr.default_sort();
-    remove_us_arr.uniq();
-    for (int i=0;  i <remove_us_arr.size(); i++)
+  remove_us_arr.default_sort();
+  remove_us_arr.uniq();
+  for (int i=0;  i <remove_us_arr.size(); i++)
        remove_dependency (remove_us_arr[i]);
 
-    status_ = BROKEN;
+  status_ = BROKEN;
 }
 
 /*
@@ -539,32 +552,36 @@ Score_elem::handle_broken_dependencies()
 void
 Score_elem::handle_prebroken_dependencies()
 {
-    Link_array<Score_elem> old_arr, new_arr;
-    
-    for (int i=0; i < dependency_size(); i++) {
+  Link_array<Score_elem> old_arr, new_arr;
+  
+  for (int i=0; i < dependency_size(); i++) 
+    {
        Score_elem * elt = dependency (i);
        Item *it_l = elt->item();
        if (it_l && it_l->breakable_b_)
-           if (item()) {
+           if (item()) 
+             {
                Score_elem *new_l = it_l->find_prebroken_piece (item()->pcol_l_);
-               if (new_l != elt) {
+               if (new_l != elt) 
+                 {
                    new_arr.push (new_l);
                    old_arr.push (elt);
-               } 
-           }else {
+                 }
+           }else 
+             {
                new_arr.push (it_l->broken_to_a_[0]);
                old_arr.push (0);
                old_arr.push (0);               
                new_arr.push (it_l->broken_to_a_[1]);           
-           }
+             }
     }
-    
-    for (int i=0;  i < old_arr.size(); i++)
+  
+  for (int i=0;  i < old_arr.size(); i++)
        if (old_arr[i])
            substitute_dependency (old_arr[i], new_arr[i]);
        
        
-    status_ = PREBROKEN;
+  status_ = PREBROKEN;
 }
 
 
@@ -572,28 +589,30 @@ Score_elem::handle_prebroken_dependencies()
 void
 Score_elem::unlink_all()
 {
-    for (int i=0; i < dependency_size(); i++) 
+  for (int i=0; i < dependency_size(); i++) 
        dependency (i)->unlink_all();
-    Link_array<Score_elem> extra (get_extra_dependencies());
-    for (int i=0; i < extra.size(); i++)
+  Link_array<Score_elem> extra (get_extra_dependencies());
+  for (int i=0; i < extra.size(); i++)
        extra[i]->unlink_all();
-    
-    junk_links();
-    axis_group_l_a_[0] = axis_group_l_a_[1] =0;
+  
+  junk_links();
+  axis_group_l_a_[0] = axis_group_l_a_[1] =0;
 }
 
 void
 Score_elem::unlink()
 {
-    do_unlink();
-    while ( dependency_size()) {
+  do_unlink();
+  while ( dependency_size()) 
+    {
        do_substitute_dependency (dependency (0),0);
        remove_edge_out_idx (0);
     }
-    while  ( dependent_size()) {
+  while  ( dependent_size()) 
+    {
        dependent (0)->remove_dependency (this);
     }
-    for (int j=0; j < 2; j++)
+  for (int j=0; j < 2; j++)
        if ( axis_group_l_a_[j])
            axis_group_l_a_[j]->remove_element (this);
 
@@ -603,7 +622,8 @@ void
 Score_elem::OK()const
 {
 #ifndef NDEBUG
-    for (int i=0; i < dependency_size(); i++) {
+  for (int i=0; i < dependency_size(); i++) 
+    {
        dependency (i)->OK();
     }
 #endif
@@ -612,6 +632,6 @@ Score_elem::OK()const
 Link_array<Score_elem>
 Score_elem::get_extra_dependencies()const
 {
-    Link_array<Score_elem> empty;
-    return empty;
+  Link_array<Score_elem> empty;
+  return empty;
 }
index acfa137c1dc42c76937117e5aa716a3a21820cbb..96192d66f99a5d51772b8d8ebc52225fc6c875f9 100644 (file)
 void
 Score_engraver::set_score (Score *s)
 {
-    Global_translator::set_score (s);
-    scoreline_l_ = s->pscore_p_->super_elem_l_->line_of_score_l_;
+  Global_translator::set_score (s);
+  scoreline_l_ = s->pscore_p_->super_elem_l_->line_of_score_l_;
 }
 
 Score_engraver::Score_engraver()
 {
-    disallow_break_b_ = false;
-    scoreline_l_ =0;
-    command_column_l_ =0;
-    musical_column_l_ =0;
-    breaks_i_ =0;
+  disallow_break_b_ = false;
+  scoreline_l_ =0;
+  command_column_l_ =0;
+  musical_column_l_ =0;
+  breaks_i_ =0;
 }
 
  
 void
 Score_engraver::prepare (Moment w)
 {
-    set_columns (new Score_column (w),  new Score_column (w));
-    
-    
-    disallow_break_b_ = false;
-    post_move_processing();
+  set_columns (new Score_column (w),  new Score_column (w));
+  
+  
+  disallow_break_b_ = false;
+  post_move_processing();
 }
 
 void
 Score_engraver::finish()
 {
-    if ( (breaks_i_%8))
+  if ( (breaks_i_%8))
            *mlog << "[" << breaks_i_ << "]" << flush;
    
-    check_removal();
-    removal_processing();
+  check_removal();
+  removal_processing();
 }
 
 void
 Score_engraver::do_creation_processing()
 {
-    scoreline_l_->left_col_l_ = get_staff_info().command_pcol_l ();
-    scoreline_l_->left_col_l_ ->set_breakable();
-    Engraver_group_engraver::do_creation_processing();
+  scoreline_l_->left_col_l_ = get_staff_info().command_pcol_l ();
+  scoreline_l_->left_col_l_ ->set_breakable();
+  Engraver_group_engraver::do_creation_processing();
 }
 
 void
 Score_engraver::do_removal_processing()
 {
-    Engraver_group_engraver::do_removal_processing();
-    scoreline_l_->right_col_l_ = get_staff_info().command_pcol_l ();
-    scoreline_l_->right_col_l_ ->set_breakable();
-    typeset_all();
-    set_columns (0,0);
+  Engraver_group_engraver::do_removal_processing();
+  scoreline_l_->right_col_l_ = get_staff_info().command_pcol_l ();
+  scoreline_l_->right_col_l_ ->set_breakable();
+  typeset_all();
+  set_columns (0,0);
 }
 
 void
 Score_engraver::process()
 {
-       process_requests();
+       process_requests();
        do_announces();
        pre_move_processing();
        check_removal();
@@ -87,32 +87,35 @@ Score_engraver::process()
 void
 Score_engraver::announce_element (Score_elem_info info)
 {
-    announce_info_arr_.push (info);
-    info.origin_grav_l_arr_.push (this);
-        
+  announce_info_arr_.push (info);
+  info.origin_grav_l_arr_.push (this);
+      
 }
 void
 Score_engraver::do_announces()
 {
-    /* All elements are propagated to the top upon announcement. If
-      something was created during one run of
-      Engraver_group_engraver::do_announces, then
-      announce_info_arr_.size() will be nonzero again
+  /* All elements are propagated to the top upon announcement. If
+    something was created during one run of
+    Engraver_group_engraver::do_announces, then
+    announce_info_arr_.size() will be nonzero again
 
-      */
-    while (announce_info_arr_.size()) {
+    */
+  while (announce_info_arr_.size()) 
+    {
        for (int i=0; i <announce_info_arr_.size(); i++)
            /*
              TODO
 
              More subtle spacing
             */
-           if (announce_info_arr_[i].req_l_) {
+           if (announce_info_arr_[i].req_l_) 
+             {
                Musical_req *m = announce_info_arr_[i].req_l_->musical();
-               if (m && m->rhythmic()) {
+               if (m && m->rhythmic()) 
+                 {
                    musical_column_l_->add_duration (m->duration());
-               }
-           }
+                 }
+             }
        Engraver_group_engraver::do_announces();
     }
 }
@@ -121,79 +124,92 @@ Score_engraver::do_announces()
 void
 Score_engraver::typeset_element (Score_elem *elem_p)
 {
-    if  ( elem_p->item() && elem_p->item ()->breakable_b_) {
+  if  ( elem_p->item() && elem_p->item ()->breakable_b_) 
+    {
        nobreak_item_p_arr_.push (elem_p->item());
-    } else
+    }
+  else
        musical_item_p_arr_.push (elem_p);
 }
 
 void
 Score_engraver::typeset_all()
 {
-    PCol * c= get_staff_info().command_pcol_l ();
-    Paper_score *ps_l = score_l_->pscore_p_;
+  PCol * c= get_staff_info().command_pcol_l ();
+  Paper_score *ps_l = score_l_->pscore_p_;
 
-    for  (int i =0; i < nobreak_item_p_arr_.size(); i++) {
+  for  (int i =0; i < nobreak_item_p_arr_.size(); i++) 
+    {
        ps_l->typeset_item (nobreak_item_p_arr_[i], c);
 
        // should get rid of this.. .
        scoreline_l_->add_dependency (nobreak_item_p_arr_[i]);
     }
-    nobreak_item_p_arr_.clear();
-    
-    for (int i=0; i < musical_item_p_arr_.size(); i++) {
+  nobreak_item_p_arr_.clear();
+  
+  for (int i=0; i < musical_item_p_arr_.size(); i++) 
+    {
        PCol* m = get_staff_info().musical_pcol_l ();
        Score_elem *elem_p = musical_item_p_arr_[i];
 
        scoreline_l_->add (elem_p);
-       if (elem_p->spanner()) {
+       if (elem_p->spanner()) 
+         {
            ps_l->typeset_unbroken_spanner (elem_p->spanner());
-       } else if (elem_p->item()) {
+         }
+       else if (elem_p->item()) 
+         {
            ps_l->typeset_item (elem_p->item(), m);
-       } else
+         }
+       else
            assert (false);
     }
-    musical_item_p_arr_.clear();
+  musical_item_p_arr_.clear();
 }
 
 
 void
 Score_engraver::do_pre_move_processing()
 {
-    if ( !disallow_break_b_){ 
+  if ( !disallow_break_b_)
+    {
        get_staff_info().command_pcol_l ()->set_breakable ();
        breaks_i_ ++;
        if ( ! (breaks_i_%8))
            *mlog << "[" << breaks_i_ << "]" << flush;
     }
-    // this generates all items.
-    Engraver_group_engraver::do_pre_move_processing();
-    
-    typeset_all();
+  // this generates all items.
+  Engraver_group_engraver::do_pre_move_processing();
+  
+  typeset_all();
 }
 
 void
 Score_engraver::set_columns (Score_column *new_command_l, 
                            Score_column *new_musical_l)
 {
-    if ( command_column_l_ && command_column_l_->used_b())
+  if ( command_column_l_ && command_column_l_->used_b())
        score_l_->pscore_p_->add (command_column_l_);
-    else {
+  else 
+    {
        delete command_column_l_ ;
        command_column_l_ =0;
     }
-    if (new_command_l) {
+  if (new_command_l) 
+    {
        command_column_l_ = new_command_l;
        command_column_l_->musical_b_ = false;
     }
-    if ( musical_column_l_ && musical_column_l_->used_b())
+  if ( musical_column_l_ && musical_column_l_->used_b())
        score_l_->pscore_p_->add (musical_column_l_);
-    else {
+  else 
+    {
        delete musical_column_l_;
        musical_column_l_ = 0;
     }
-    
-    if (new_musical_l) {
+  
+  if (new_musical_l) 
+    {
        musical_column_l_ = new_musical_l;
        musical_column_l_->musical_b_ = true;
     }
@@ -203,17 +219,17 @@ Score_engraver::set_columns (Score_column *new_command_l,
 Staff_info
 Score_engraver::get_staff_info()const
 {
-    Staff_info inf;
+  Staff_info inf;
 
-    inf.command_l_ = command_column_l_;
-    inf.musical_l_ = musical_column_l_;
-    return inf;
+  inf.command_l_ = command_column_l_;
+  inf.musical_l_ = musical_column_l_;
+  return inf;
 }
 
 Paper_def*
 Score_engraver::paper()const
 {
-    return score_l_->paper_p_;
+  return score_l_->paper_p_;
 }
 
 
@@ -221,10 +237,10 @@ Score_engraver::paper()const
 bool
 Score_engraver::do_try_request (Request*r)
 {
-    bool gotcha = Engraver_group_engraver::do_try_request (r);  
-    if ( !gotcha && r->command() && r->command ()->disallowbreak ())
+  bool gotcha = Engraver_group_engraver::do_try_request (r);  
+  if ( !gotcha && r->command() && r->command ()->disallowbreak ())
            disallow_break_b_ = true;
-    return gotcha;
+  return gotcha;
 }
 
 IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver);
index 08f194171c17656442e93fac63405f40ca7467fe..c694c50ee235571064672540e15a1e9e561d91ad 100644 (file)
 
 Score_horizontal_align_engraver::Score_horizontal_align_engraver()
 {
-    halign_p_ =0;
+  halign_p_ =0;
 }
 
 void
 Score_horizontal_align_engraver::do_pre_move_processing()
 {
-    if (halign_p_) {
+  if (halign_p_) 
+    {
        typeset_element (halign_p_);
        halign_p_ =0;
     }
@@ -29,16 +30,17 @@ Score_horizontal_align_engraver::do_pre_move_processing()
 void
 Score_horizontal_align_engraver::acknowledge_element (Score_elem_info i)
 {
-    Engraver* reg = i.origin_grav_l_arr_[0];
-    if (reg->is_type_b (
+  Engraver* reg = i.origin_grav_l_arr_[0];
+  if (reg->is_type_b (
        Score_align_engraver::static_name()))
-    {
+  {
        Score_align_engraver * align_grav_l = (Score_align_engraver*) reg;
-       if (!halign_p_) {
+       if (!halign_p_) 
+         {
            halign_p_ = new Break_align_item;
            halign_p_->breakable_b_ = true;
            announce_element (Score_elem_info (halign_p_,0));
-       }
+         }
        Item * it = i.elem_l_->item();
        if (align_grav_l->type_ch_C_ == Bar::static_name())
            halign_p_->center_l_ = it;
index 53c2a283f7ed38f0a8b053c0db6338d90713989d..eabe40192609e0ff3a7576b0808d7782258fd9dd 100644 (file)
@@ -38,56 +38,59 @@ Score_performer::~Score_performer()
 Translator* 
 Score_performer::ancestor_l (int l) 
 { 
-    return Global_translator::ancestor_l (l);
+  return Global_translator::ancestor_l (l);
 }
 
 
 int 
 Score_performer::depth_i() const 
 { 
-    return Global_translator::depth_i();
+  return Global_translator::depth_i();
 }
 
 
 void
 Score_performer::finish()
 {
-    Performer_group_performer::do_removal_processing();
+  Performer_group_performer::do_removal_processing();
 }
 
 
 void
 Score_performer::play (Audio_element * p)
 {
-    if  (p->is_type_b (Audio_item::static_name())) {
+  if  (p->is_type_b (Audio_item::static_name())) 
+    {
        audio_column_l_->add ((Audio_item*)p);
-    } else if (p->is_type_b (Audio_staff::static_name())) {
+    }
+  else if (p->is_type_b (Audio_staff::static_name())) 
+    {
        score_l_->audio_score_p_->add_staff ((Audio_staff*)p);
     }
-    score_l_->audio_score_p_->add (p);
+  score_l_->audio_score_p_->add (p);
 }
 
 
 void 
 Score_performer::prepare (Moment m)
 {
-    now_mom_ = m;
-    audio_column_l_ = new Audio_column (m);
-    score_l_->audio_score_p_->add (audio_column_l_);
+  now_mom_ = m;
+  audio_column_l_ = new Audio_column (m);
+  score_l_->audio_score_p_->add (audio_column_l_);
 }
 
 
 void 
 Score_performer::process()
 {
-    process_requests();
+  process_requests();
 }
 
 
 void
 Score_performer::set_score (Score* score_l)
 {
-    Global_translator::set_score (score_l);
+  Global_translator::set_score (score_l);
 }
 
 
@@ -100,5 +103,5 @@ Score_performer::start()
 int
 Score_performer::get_tempo_i()const
 {
-    return score_l_->midi_p_->get_tempo_i (Moment (1, 4));
+  return score_l_->midi_p_->get_tempo_i (Moment (1, 4));
 }
index 8a8a473a818a51f4ac62a214ab1350b384bc5d22..fd11b56542a483f23861e67cb84eb77a1d1685cd 100644 (file)
 #include "music-iterator.hh"
 #include "music.hh"
 #include "global-translator.hh"
+#include "header.hh"
 
 extern String default_out_fn;
 
 Score::Score()
 {
-    pscore_p_=0;
-    audio_score_p_ = 0;
-    paper_p_ = 0;
-    midi_p_ = 0;
-    errorlevel_i_ = 0;
+  header_p_ =0;
+  pscore_p_=0;
+  audio_score_p_ = 0;
+  paper_p_ = 0;
+  midi_p_ = 0;
+  errorlevel_i_ = 0;
 }
 
 Score::Score (Score const &s)
 {
-    assert (!pscore_p_);
-    music_p_ = s.music_p_->clone();
-    midi_p_ = new Midi_def (*s.midi_p_);
-    paper_p_ = new Paper_def (*s.paper_p_);
+  assert (!pscore_p_);
+  music_p_ = s.music_p_->clone();
+  midi_p_ = new Midi_def (*s.midi_p_);
+  paper_p_ = new Paper_def (*s.paper_p_);
+  header_p_ = new Header(*s.header_p_);
 }
 
 Score::~Score()
 {
-    delete music_p_;
-    delete pscore_p_;
-    delete audio_score_p_;
-    delete paper_p_;
-    delete midi_p_;
+  delete header_p_;
+  delete music_p_;
+  delete pscore_p_;
+  delete audio_score_p_;
+  delete paper_p_;
+  delete midi_p_;
 }
 
 void
 Score::run_translator (Global_translator * trans_l)
 {
-    trans_l->set_score (this);
-    Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, 
+  trans_l->set_score (this);
+  Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, 
                                                                  trans_l);
-    iter->construct_children();
+  iter->construct_children();
 
-    if ( ! iter->ok()) {
+  if ( ! iter->ok()) 
+    {
        delete iter;
        warning ("Need music in a score");
        errorlevel_i_ =1;
        return ;
     }
-    
-    trans_l->start();
-    
-    while ( iter->ok() || trans_l->moments_left_i ()) {
+  
+  trans_l->start();
+  
+  while ( iter->ok() || trans_l->moments_left_i ()) 
+    {
        Moment w = infinity_mom;
-       if (iter->ok()) {
+       if (iter->ok()) 
+         {
            w = iter->next_moment();
            DOUT << w;
            iter->print();
-       }
+         }
        trans_l->modify_next (w);
        trans_l->prepare (w);
        trans_l->print();
@@ -82,125 +89,128 @@ Score::run_translator (Global_translator * trans_l)
        iter->process_and_next (w);
        trans_l->process();
     }
-    delete iter;
-    trans_l->finish();
+  delete iter;
+  trans_l->finish();
 }
 
 void
 Score::process()
 {
-    print();
-    paper();
-    midi();
+  print();
+  paper();
+  midi();
 }
 
 void
 Score::midi()
 {
-    if ( !midi_p_)
+  if ( !midi_p_)
        return;
-    
-    *mlog << "\nCreating MIDI elements ..." << flush;
-    audio_score_p_ = new Audio_score (this);
-    
-    Global_translator* score_trans=  midi_p_->get_global_translator_p();
-    run_translator (score_trans);
-    delete score_trans;
-    
-    if (errorlevel_i_){
+  
+  *mlog << "\nCreating MIDI elements ..." << flush;
+  audio_score_p_ = new Audio_score (this);
+  
+  Global_translator* score_trans=  midi_p_->get_global_translator_p();
+  run_translator (score_trans);
+  delete score_trans;
+  
+  if (errorlevel_i_)
+    {
        // should we? hampers debugging. 
        warning ("Errors found, /*not processing score*/");
 //     return;
     }
-    *mlog << endl;
+  *mlog << endl;
 
-    midi_output();
+  midi_output();
 }
-    
+  
 void
 Score::paper()
 {
-    if (!paper_p_)
+  if (!paper_p_)
        return;
-    
-    *mlog << "\nCreating elements ..." << flush;
-    pscore_p_ = new Paper_score (paper_p_);
-    
-    Global_translator * score_trans=  paper_p_->get_global_translator_p();
-    run_translator (score_trans);
-    delete score_trans;
-    
-    if (errorlevel_i_) {
+  
+  *mlog << "\nCreating elements ..." << flush;
+  pscore_p_ = new Paper_score (paper_p_);
+  
+  Global_translator * score_trans=  paper_p_->get_global_translator_p();
+  run_translator (score_trans);
+  delete score_trans;
+  
+  if (errorlevel_i_) 
+    {
        // should we? hampers debugging. 
        warning ("Errors found, /*not processing score*/");
 //     return;
     }
-    
-    *mlog << endl;
-    pscore_p_->process();
+  
+  *mlog << endl;
+  pscore_p_->process();
 
-    // output
-    paper_output();
+  // output
+  paper_output();
 }
 
 void
 Score::midi_output()
 {
-    if ( midi_p_->outfile_str_ == "")
+  if ( midi_p_->outfile_str_ == "")
        midi_p_->outfile_str_ = default_out_fn + ".midi";
 
-    Midi_stream midi_stream (midi_p_->outfile_str_);    
-    *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;    
+  Midi_stream midi_stream (midi_p_->outfile_str_);    
+  *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;    
 
-    audio_score_p_->output (midi_stream);
-    *mlog << endl;
+  audio_score_p_->output (midi_stream);
+  *mlog << endl;
 }
 
 void
 Score::paper_output()
 {
-    if (paper_p_->outfile_str_=="")
+  if (paper_p_->outfile_str_=="")
        paper_p_->outfile_str_ = default_out_fn + ".tex";
 
-    if ( errorlevel_i_) { 
+  if ( errorlevel_i_) 
+    {
        *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_ 
        << " (errorlevel=" << errorlevel_i_ << ")" << endl;
-        return;
+      return;
     }
 
-    *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
-    
-    Tex_stream the_output (paper_p_->outfile_str_);
-    
-    the_output << "% outputting Score, defined at: " <<
+  *mlog << "TeX output to " << paper_p_->outfile_str_ << " ...\n";
+  
+  Tex_stream the_output (paper_p_->outfile_str_);
+  
+  the_output << "% outputting Score, defined at: " <<
        location_str() << "\n";
-    pscore_p_->output (the_output);
+  pscore_p_->output (the_output);
 }
 
 void
 Score::print() const
 {
 #ifndef NPRINT
-    DOUT << "score {\n"; 
-    music_p_->print();
-    if (midi_p_)
+  DOUT << "score {\n"; 
+  music_p_->print();
+  if (midi_p_)
        midi_p_->print();
-    
-    DOUT << "}\n";
+  
+  DOUT << "}\n";
 #endif
 }
 
 void
 Score::set (Paper_def *pap_p)
 {
-    delete paper_p_;
-    paper_p_ = pap_p;
+  delete paper_p_;
+  paper_p_ = pap_p;
 }
 
 void
 Score::set (Midi_def* midi_p)
 {    
-    delete midi_p_;
-    midi_p_ = midi_p;
+  delete midi_p_;
+  midi_p_ = midi_p;
 }
 
index fc64123533a0956f99690c16ead9cdec6ccbf370..7bb391211a21ac9f7ec6cd8b249fe28a440ec50b 100644 (file)
 String
 Line_of_score::TeX_string() const
 {
-     String s ("\\hbox{%<- line of score\n");
-     if (error_mark_b_)
+   String s ("\\hbox{%<- line of score\n");
+   if (error_mark_b_)
         s+= "\\scorelineerrormark";
-     
-     
-     Real lastpos = cols[0]->hpos_f_;
-     for (int i=0; i < cols.size();  i++){
+   
+   
+   Real lastpos = cols[0]->hpos_f_;
+   for (int i=0; i < cols.size();  i++)
+     {
         PCol* col_l= cols[i];
         // all items in the current line & staff.
         String chunk_str;
@@ -36,35 +37,39 @@ Line_of_score::TeX_string() const
            
         Link_array<Score_elem> elems;
            
-        if (col_l->error_mark_b_) {
+        if (col_l->error_mark_b_) 
+          {
             chunk_str += String ("\\columnerrormark");
-        }
+          }
         
         // now output the items.
-        for (iter_top (col_l->its,j); j.ok(); j++) {
+        for (iter_top (col_l->its,j); j.ok(); j++) 
+          {
             elems.push (j);
-        }
+          }
 
         // spanners.
-        for (iter_top (col_l->starters,j); j.ok(); j++) {
+        for (iter_top (col_l->starters,j); j.ok(); j++) 
+          {
             if (j->name() != name ())
                elems.push (j);
-        }
+          }
         
-        for (int j =0; j< elems.size(); j++) {
+        for (int j =0; j< elems.size(); j++) 
+          {
             Offset o = elems[j]->absolute_offset();
             o[X_AXIS] += cols[i]->hpos_f_;
             s += elems[j]->TeX_string_without_offset (o);
-        }
+          }
      }
-     s += "}";
-     return s;
+   s += "}";
+   return s;
 }
 
 
 Line_of_score::Line_of_score()
 {
-    error_mark_b_ = 0;
+  error_mark_b_ = 0;
 }
 
 
@@ -76,21 +81,22 @@ IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
 void
 Line_of_score::add (Score_elem*e)
 {
-    // avoid excess dependencies.
-    if (!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
+  // avoid excess dependencies.
+  if (!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
        add_dependency (e);
 }
 
 bool
 Line_of_score::contains_b (PCol const* c)const
 {
-    return cols.find_l ((PCol*)c);
+  return cols.find_l ((PCol*)c);
 }
 
 void
 Line_of_score::set_breaking (Array<Col_hpositions> const &breaking)
 {
-    for (int j=0; j < breaking.size(); j++) {
+  for (int j=0; j < breaking.size(); j++) 
+    {
        const Array<PCol*> &curline (breaking[j].cols);
        const Array<PCol*> &errors (breaking[j].error_col_l_arr_);
        const Array<Real> &config (breaking[j].config);
@@ -101,26 +107,30 @@ Line_of_score::set_breaking (Array<Col_hpositions> const &breaking)
        Line_of_score *line_l=0;
        Line_of_score *line_p =0;
        
-       if (breaking.size() >1) {
+       if (breaking.size() >1) 
+         {
            line_p = (Line_of_score*)clone()->spanner ();
            line_p->copy_dependencies (*this);
            line_l = line_p;
-       } else 
+         }
+       else 
            line_l =  this;
        
        ((Array<PCol*> &)line_l->cols) = curline;
        line_l->left_col_l_ =  curline[0];
        line_l->right_col_l_= curline.top();
        
-       if (line_p) {  
+       if (line_p) 
+         {
            pscore_l_->typeset_broken_spanner (line_p);
            broken_into_l_arr_.push (line_p);
-       }
+         }
        
-       for (int i=0; i < curline.size(); i++){
+       for (int i=0; i < curline.size(); i++)
+         {
            curline[i]->hpos_f_ = config[i];
            curline[i]->line_l_ = (Line_of_score*)line_l;
-       }
+         }
     }
 }
 
@@ -132,26 +142,27 @@ Line_of_score::break_into_pieces (bool)
 Link_array<Line_of_score>
 Line_of_score::get_lines()const
 {
-    Link_array<Line_of_score> ret;
+  Link_array<Line_of_score> ret;
 
-    if (broken_into_l_arr_.size())
-       for (int i=0; i < broken_into_l_arr_.size(); i++) {
+  if (broken_into_l_arr_.size())
+       for (int i=0; i < broken_into_l_arr_.size(); i++) 
+         {
            ret.push ((Line_of_score*)broken_into_l_arr_[i]);
-       }
-    else 
+         }
+  else 
        ret.push ((Line_of_score*)this);        // ugh
-    
-    return ret;
+  
+  return ret;
 }
 
 void
 Line_of_score::do_print()const
 {
-    Spanner::do_print();
+  Spanner::do_print();
 }
 
 Interval
 Line_of_score::do_width()const
 { 
-    return Spanner::do_width();
+  return Spanner::do_width();
 }
index fbd646b7a21c42f9828b88e613993d98d78645ef..446e419a3da25b783eb0c13a233b0287148d0ed2 100644 (file)
@@ -18,37 +18,42 @@ String default_out_fn = "lelie";
 void
 do_scores()
 {
-    for (int i=0; i < score_array_global.size(); i++) {
+  for (int i=0; i < score_array_global.size(); i++) 
+    {
        Score *&is_p = score_array_global[i];
        
-       if (only_midi) {
+       if (only_midi) 
+         {
            delete is_p->paper_p_;
            is_p->paper_p_ = 0;
-       }
+         }
        
-       if (is_p->errorlevel_i_) {
+       if (is_p->errorlevel_i_) 
+         {
            is_p->warning ("Score contains errors. Will not process it. ");
            exit_status_i_ |= 1;
-       } else { 
+         }
+       else 
+         {
            is_p->print();
            is_p->process();
-       }
+         }
        delete is_p;
        is_p =0;
 
     }
-    score_array_global.clear();
+  score_array_global.clear();
 }
 
 void
 add_score (Score * s)
 {
-    score_array_global.push (s);
+  score_array_global.push (s);
 }
 
 void
 set_default_output (String s)
 {
-    default_out_fn = s;
+  default_out_fn = s;
 }
 
index 9d9231e549d107b193e3fa5097f90fce897a51f4..836541ce16c9726950321c21b589abad779a66be 100644 (file)
@@ -19,9 +19,9 @@ IMPLEMENT_IS_TYPE_B1(Script_column,Horizontal_vertical_group_item);
 void
 Script_column::add (Script*s_l)
 {
-    script_l_arr_.push (s_l);
-    add_dependency (s_l);
-    add_element (s_l);
+  script_l_arr_.push (s_l);
+  add_dependency (s_l);
+  add_element (s_l);
 }
 
 
@@ -29,59 +29,66 @@ void
 Script_column::do_print()const
 {
 #ifndef NPRINT
-    DOUT << "scripts: " << script_l_arr_.size() << '\n'; 
+  DOUT << "scripts: " << script_l_arr_.size() << '\n'; 
 #endif
 }
 
 static int
 idx (bool inside, int dir)
 {
-    int j = (dir+1);
-    if ( !inside)
+  int j = (dir+1);
+  if ( !inside)
        j ++;
-    return j;
+  return j;
 }
 
 void
 Script_column::do_pre_processing()
 {
-    if (!script_l_arr_.size()) 
+  if (!script_l_arr_.size()) 
        return;
-    
-    /* up+inside, up+outside, down+inside, down+outside */
-    Array<Script*> placed_l_arr_a[4];
-    for (int i=0; i < script_l_arr_.size(); i++) {
+  
+  /* up+inside, up+outside, down+inside, down+outside */
+  Array<Script*> placed_l_arr_a[4];
+  for (int i=0; i < script_l_arr_.size(); i++) 
+    {
        Script*s_l = script_l_arr_[i];
        placed_l_arr_a[idx (s_l->inside_staff_b_ , s_l->dir_i_) ].push (s_l);
     }
-    
-    for (int j =0; j <4; j++) {
+  
+  for (int j =0; j <4; j++) 
+    {
        placed_l_arr_a[j].sort (Script::compare);
     }
 
 
-    for (int j =0; j < 4; j++) {
+  for (int j =0; j < 4; j++) 
+    {
        if (placed_l_arr_a[j].size())
            for (int i=0; i  < support_l_arr_.size(); i++)
                placed_l_arr_a[j][0]->add_support (support_l_arr_[i]);
     }
-    
-    Item * support_l=0;
-    int j = 0;
-    for (; j < 2; j++) {
-       for (int i=0; i < placed_l_arr_a[j].size(); i++) {
+  
+  Item * support_l=0;
+  int j = 0;
+  for (; j < 2; j++) 
+    {
+       for (int i=0; i < placed_l_arr_a[j].size(); i++) 
+         {
            if (support_l)
                placed_l_arr_a[j][i]->add_support (support_l);
            support_l = placed_l_arr_a[j][i];
-       }
+         }
     }
-    support_l = 0;
-    for (; j < 4; j++) {
-       for (int i=0; i < placed_l_arr_a[j].size(); i++) {
+  support_l = 0;
+  for (; j < 4; j++) 
+    {
+       for (int i=0; i < placed_l_arr_a[j].size(); i++) 
+         {
            if (support_l)
                placed_l_arr_a[j][i]->add_support (support_l);
            support_l = placed_l_arr_a[j][i];
-       }
+         }
     }
 }
 
@@ -89,15 +96,16 @@ Script_column::do_pre_processing()
 void
 Script_column::add_support (Item*i_l)
 {
-    support_l_arr_.push (i_l);
-    add_dependency (i_l);
-    add_element (i_l);
+  support_l_arr_.push (i_l);
+  add_dependency (i_l);
+  add_element (i_l);
 }
 
 void
 Script_column::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    if (o->item()) {
+  if (o->item()) 
+    {
        script_l_arr_.substitute ((Script*)o->item(),(Script*) (n?n->item ():0));
        support_l_arr_.substitute (o->item(), (n?n->item ():0));
     }
index a1970dc8d22641fe2ba4753ea185c239e01892cd..6a53aba9827bb4f781b8779f9d83927dfe036823 100644 (file)
 
 Script_def::Script_def()
 {
-    inside_staff_b_ = false;
-    symidx_str_ = "unknown" ;
-    rel_stem_dir_i_ =0;
-    staff_dir_i_ = -1;
-    invertsym_b_ = 0;
-    priority_i_ =0;
+  inside_staff_b_ = false;
+  symidx_str_ = "unknown" ;
+  rel_stem_dir_i_ =0;
+  staff_dir_i_ = -1;
+  invertsym_b_ = 0;
+  priority_i_ =0;
 }
 
 void
 Script_def::set_from_input (String idx,  bool follow, int stem, int staff ,bool invert, int priority_i)
 {
-    inside_staff_b_ = follow;
-    symidx_str_ = idx ;
-    rel_stem_dir_i_ =stem;
-    staff_dir_i_ = staff;
-    invertsym_b_ = invert;
-    priority_i_ =priority_i;
+  inside_staff_b_ = follow;
+  symidx_str_ = idx ;
+  rel_stem_dir_i_ =stem;
+  staff_dir_i_ = staff;
+  invertsym_b_ = invert;
+  priority_i_ =priority_i;
 }
 
 
@@ -38,7 +38,7 @@ void
 Script_def::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "Script_def{ idx: " << symidx_str_ 
+  DOUT << "Script_def{ idx: " << symidx_str_ 
         << " direction, stem: " << rel_stem_dir_i_ << " staff : " << staff_dir_i_ << "}\n";
 #endif
 }
@@ -46,8 +46,8 @@ Script_def::do_print() const
 bool
 Script_def::do_equal_b (General_script_def const *g)const 
 {
-    Script_def const * c = (Script_def const*) g;
-    return (symidx_str_ == c->symidx_str_ &&
+  Script_def const * c = (Script_def const*) g;
+  return (symidx_str_ == c->symidx_str_ &&
             rel_stem_dir_i_ == c->rel_stem_dir_i_&&
             staff_dir_i_ == c->staff_dir_i_&&
             invertsym_b_ == c->invertsym_b_);
@@ -56,29 +56,29 @@ Script_def::do_equal_b (General_script_def const *g)const
 int
 Script_def::staff_dir_i() const
 {
-    return staff_dir_i_; 
+  return staff_dir_i_; 
 }
 
 int
 Script_def::rel_stem_dir_i() const
 {
-    return rel_stem_dir_i_; 
+  return rel_stem_dir_i_; 
 }
 
 bool
 Script_def::inside_b() const
 {
-    return inside_staff_b_; 
+  return inside_staff_b_; 
 }
 
 Atom
 Script_def::get_atom (Paper_def *p , int d)const
 {
-    String preidx_str ="";
-    if (invertsym_b_&& d < 0) 
+  String preidx_str ="";
+  if (invertsym_b_&& d < 0) 
        preidx_str = "-";
 
-    return p->lookup_l()->script (preidx_str + symidx_str_);
+  return p->lookup_l()->script (preidx_str + symidx_str_);
 }
 
 
@@ -87,8 +87,8 @@ IMPLEMENT_IS_TYPE_B1(Script_def,General_script_def);
 int
 Script_def::priority_i()const
 {
-    return priority_i_;
+  return priority_i_;
 }
        
-    
-    
+  
+  
index 6c01af322a7c3c4a83ff56a403173ca2e74a1b86..f66b2eb3b168e55e606bb7644639020405eb44bb 100644 (file)
 
 Script_engraver::Script_engraver()
 {
-    do_post_move_processing();
+  do_post_move_processing();
 }
 
 bool
 Script_engraver::do_try_request (Request *r_l)
 {
-    if (!r_l->musical() || ! r_l->musical ()->musicalscript ())
+  if (!r_l->musical() || ! r_l->musical ()->musicalscript ())
        return false ;
-    
-    for (int i=0; i < script_req_l_arr_.size(); i++) {
+  
+  for (int i=0; i < script_req_l_arr_.size(); i++) 
+    {
        if ( r_l->equal_b (script_req_l_arr_[i]))
            return true;
        
     }
-    script_req_l_arr_.push (r_l->script());
-    
-    return true;
+  script_req_l_arr_.push (r_l->script());
+  
+  return true;
 }
 
 void
 Script_engraver::do_process_requests()
 {
-    for (int i=0; i < script_req_l_arr_.size(); i++){
+  for (int i=0; i < script_req_l_arr_.size(); i++)
+    {
        Script_req* l=script_req_l_arr_[i];
        Script *p =new Script;
        p->dir_i_ = l->dir_i_;
@@ -47,19 +49,20 @@ Script_engraver::do_process_requests()
 void
 Script_engraver::do_pre_move_processing()
 {
-    Staff_symbol* s_l = get_staff_info().staff_sym_l_;
-    for (int i=0; i < script_p_arr_.size(); i++) {
+  Staff_symbol* s_l = get_staff_info().staff_sym_l_;
+  for (int i=0; i < script_p_arr_.size(); i++) 
+    {
        Script*script_p = script_p_arr_[i];
        script_p->set_staffsym (s_l);
        typeset_element (script_p);
     }
-    script_p_arr_.clear();
+  script_p_arr_.clear();
 }
 
 void
 Script_engraver::do_post_move_processing()
 {
-    script_req_l_arr_.clear();
+  script_req_l_arr_.clear();
 }
 
 
index dbbda19724442812cedb9b79779f8759d509d8d8..e27086c40d5702679572037b5892c81815beafc4 100644 (file)
@@ -17,15 +17,16 @@ void
 Script::do_print() const
 {
 #ifndef NPRINT
-    specs_l_->print();
+  specs_l_->print();
 #endif
 }
 
 void
 Script::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    Staff_side::do_substitute_dependency (o,n);
-    if (o == stem_l_) {
+  Staff_side::do_substitute_dependency (o,n);
+  if (o == stem_l_) 
+    {
        stem_l_ = n ? (Stem*)n->item() : 0;
     }
 }
@@ -33,69 +34,74 @@ Script::do_substitute_dependency (Score_elem*o,Score_elem*n)
 void
 Script::set_stem (Stem*st_l)
 {
-    stem_l_ = st_l;
-    add_support (st_l);
+  stem_l_ = st_l;
+  add_support (st_l);
 }
 
 
 Script::Script()
 {    
-    specs_l_ = 0;
-    inside_staff_b_ = false;
-    stem_l_ = 0;
-    dir_i_ =  0;
+  specs_l_ = 0;
+  inside_staff_b_ = false;
+  stem_l_ = 0;
+  dir_i_ =  0;
 }
 
 void
 Script::set_default_dir()
 {
-    int s_i=specs_l_->rel_stem_dir_i();
-    if (s_i) { 
+  int s_i=specs_l_->rel_stem_dir_i();
+  if (s_i) 
+    {
        if (stem_l_)
            dir_i_ = stem_l_->dir_i_ * s_i;
-       else{ 
+       else
+         {
            specs_l_->warning ("Script needs stem direction");
            dir_i_ = -1;
-       }
-    } else {
+         }
+    }
+  else 
+    {
        dir_i_ =specs_l_->staff_dir_i();
     }
-    assert (dir_i_);
+  assert (dir_i_);
 }
 
 
 Interval
 Script::do_width() const
 {
-    return specs_l_->get_atom (paper(), dir_i_).extent ().x ();
+  return specs_l_->get_atom (paper(), dir_i_).extent ().x ();
 }
 
 void
 Script::do_pre_processing()
 {
-    if  (breakable_b_ && break_status_i() != 1) {
+  if  (breakable_b_ && break_status_i() != 1) 
+    {
        transparent_b_ = empty_b_ = true;
     }
-    
-    if (!dir_i_)
+  
+  if (!dir_i_)
        set_default_dir();
-    inside_staff_b_ = specs_l_->inside_b();
+  inside_staff_b_ = specs_l_->inside_b();
 }
 
 Interval
 Script::symbol_height()const
 {
-    return specs_l_->get_atom (paper(), dir_i_).extent ().y ();
+  return specs_l_->get_atom (paper(), dir_i_).extent ().y ();
 }
 
 Molecule*
 Script::brew_molecule_p() const
 {
-    Real dy = paper()->internote_f ();
-    
-    Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_i_));
-    out->translate (dy * pos_i_, Y_AXIS);
-    return out;
+  Real dy = paper()->internote_f ();
+  
+  Molecule*out = new Molecule (specs_l_->get_atom (paper(), dir_i_));
+  out->translate (dy * pos_i_, Y_AXIS);
+  return out;
 }
 
 
@@ -104,6 +110,6 @@ IMPLEMENT_IS_TYPE_B2(Script,Item,Staff_side);
 int 
 Script::compare (Script  *const&l1, Script *const&l2) 
 {
-    return l1->specs_l_->priority_i() - l2->specs_l_->priority_i ();
+  return l1->specs_l_->priority_i() - l2->specs_l_->priority_i ();
 }
-    
+  
index 3c4b1814e700d79651bb19f1ca1db5dc85d7dcff..1657e2e12a5bbad2021757b5fae6398b4a01a5d5 100644 (file)
 bool
 Slur_engraver::do_try_request (Request *req_l)
 {
-    Musical_req *mus_l = req_l->musical();
-    if (!mus_l || !mus_l->slur())
+  Musical_req *mus_l = req_l->musical();
+  if (!mus_l || !mus_l->slur())
        return false;
 
-    new_slur_req_l_arr_.push (mus_l->slur());
-    return true;
+  new_slur_req_l_arr_.push (mus_l->slur());
+  return true;
 }
 
 void
 Slur_engraver::acknowledge_element (Score_elem_info info)
 {
-    if (info.elem_l_->name() == Note_column::static_name ()) { 
+  if (info.elem_l_->name() == Note_column::static_name ()) 
+    {
        Note_column *col_l =(Note_column*) info.elem_l_->item() ;// ugh
        for (int i = 0; i < slur_l_stack_.size(); i++)
            slur_l_stack_[i]->add (col_l);
@@ -38,7 +39,7 @@ Slur_engraver::acknowledge_element (Score_elem_info info)
 void
 Slur_engraver::set_feature (Feature f)
 {
-    if (f.type_ == "vdir")
+  if (f.type_ == "vdir")
        dir_i_ = f.value_ ;
 }
 
@@ -47,55 +48,62 @@ Slur_engraver::set_feature (Feature f)
   */
 Slur_engraver::Slur_engraver()
 {
-    dir_i_ =0;
+  dir_i_ =0;
 }
 void
 Slur_engraver::do_process_requests()
 {
-    Array<Slur*> start_slur_l_arr_;
-    for (int i=0; i< new_slur_req_l_arr_.size(); i++) {
+  Array<Slur*> start_slur_l_arr_;
+  for (int i=0; i< new_slur_req_l_arr_.size(); i++) 
+    {
        Slur_req* slur_req_l = new_slur_req_l_arr_[i];
        // end slur: move the slur to other array
-       if (slur_req_l->spantype == Span_req::STOP) {
+       if (slur_req_l->spantype == Span_req::STOP) 
+         {
            if (slur_l_stack_.empty())
                
                      slur_req_l->warning ("can't find slur to end");
-           else {
+           else 
+             {
                end_slur_l_arr_.push (slur_l_stack_.pop());
                requests_arr_.pop();
-           }
-       } else  if (slur_req_l->spantype == Span_req::START) {
+             }
+         }
+       else  if (slur_req_l->spantype == Span_req::START) 
+         {
            // push a new slur onto stack.
            //(use temp. array to wait for all slur STOPs)
            Slur * s_p =new Slur;
            requests_arr_.push (slur_req_l);
            start_slur_l_arr_.push (s_p);
            announce_element (Score_elem_info (s_p, slur_req_l));
-       }
+         }
     }
-    for (int i=0; i < start_slur_l_arr_.size(); i++)
+  for (int i=0; i < start_slur_l_arr_.size(); i++)
        slur_l_stack_.push (start_slur_l_arr_[i]);
 }
 
 void
 Slur_engraver::do_pre_move_processing()
 {
-    for (int i = 0; i < end_slur_l_arr_.size(); i++) {
+  for (int i = 0; i < end_slur_l_arr_.size(); i++) 
+    {
        if (dir_i_)
            end_slur_l_arr_[i]->dir_i_ = dir_i_;
        typeset_element (end_slur_l_arr_[i]);
     }
-    end_slur_l_arr_.clear();
+  end_slur_l_arr_.clear();
 }
 
 void
 Slur_engraver::do_post_move_processing()
 {
-    new_slur_req_l_arr_.clear();
+  new_slur_req_l_arr_.clear();
 }
 Slur_engraver::~Slur_engraver()
 {
-    for (int i=0; i < requests_arr_.size(); i++) {
+  for (int i=0; i < requests_arr_.size(); i++) 
+    {
        requests_arr_[i]->warning ("unterminated slur");
     }
 }
index bb494731295303923921155bd2bc74d3887952c6..54c5b5009dd16cbd1dc35671890815619158e5c5 100644 (file)
 void
 Slur::add (Note_column*n)
 {
-    encompass_arr_.push (n);
-    add_dependency (n);
+  encompass_arr_.push (n);
+  add_dependency (n);
 }
 
 void
 Slur::set_default_dir()
 {
-    dir_i_ = -1;
-    for (int i=0; i < encompass_arr_.size(); i ++) {
-       if (encompass_arr_[i]->dir_i_ < 0) {
+  dir_i_ = -1;
+  for (int i=0; i < encompass_arr_.size(); i ++) 
+    {
+       if (encompass_arr_[i]->dir_i_ < 0) 
+         {
            dir_i_ =1;
            break;
-       }
+         }
     }
 }
 
 void
 Slur::do_pre_processing()
 {
-    right_col_l_  = encompass_arr_.top()->pcol_l_;
-    left_col_l_ = encompass_arr_[0]->pcol_l_;    
+  right_col_l_  = encompass_arr_.top()->pcol_l_;
+  left_col_l_ = encompass_arr_[0]->pcol_l_;    
 }
 
 
 void
 Slur::do_substitute_dependency (Score_elem*o, Score_elem*n)
 {
-    int i;
-    while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0) {
+  int i;
+  while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0) 
+    {
        if (n)
            encompass_arr_[i] = (Note_column*)n->item();
        else
@@ -70,29 +73,29 @@ Slur::do_substitute_dependency (Score_elem*o, Score_elem*n)
 static int 
 Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
 {
-    return n1->pcol_l_->rank_i() - n2->pcol_l_->rank_i ();
+  return n1->pcol_l_->rank_i() - n2->pcol_l_->rank_i ();
 }
 
 void
 Slur::do_post_processing()
 {
-    encompass_arr_.sort (Note_column_compare);
-    if (!dir_i_)
+  encompass_arr_.sort (Note_column_compare);
+  if (!dir_i_)
        set_default_dir();
-    Real inter_f = paper()->internote_f ();
-    
-    if (encompass_arr_[0]->stem_l_) 
-        left_pos_i_ = rint (encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f);
-    else 
-        left_pos_i_ = rint ( encompass_arr_[0]->head_positions_interval()[dir_i_]);
-    
-    if (encompass_arr_.top()->stem_l_)
-        right_pos_i_ = rint (encompass_arr_.top()->stem_l_->height ()[dir_i_]/inter_f);
-    else 
-        right_pos_i_ = rint (encompass_arr_.top()->head_positions_interval ()[dir_i_]);
-
-    left_pos_i_ += dir_i_;
-    right_pos_i_ += dir_i_;
+  Real inter_f = paper()->internote_f ();
+  
+  if (encompass_arr_[0]->stem_l_) 
+      left_pos_i_ = rint (encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f);
+  else 
+      left_pos_i_ = rint ( encompass_arr_[0]->head_positions_interval()[dir_i_]);
+  
+  if (encompass_arr_.top()->stem_l_)
+      right_pos_i_ = rint (encompass_arr_.top()->stem_l_->height ()[dir_i_]/inter_f);
+  else 
+      right_pos_i_ = rint (encompass_arr_.top()->head_positions_interval ()[dir_i_]);
+
+  left_pos_i_ += dir_i_;
+  right_pos_i_ += dir_i_;
 }
 
 IMPLEMENT_IS_TYPE_B1(Slur,Spanner);
index 737a4b92b9ecd8623feb6d5795ff74110bf8b0f4..cb7a592cf328187a9876501d4fcde8cb9102c9db 100644 (file)
 
 Span_bar_engraver::Span_bar_engraver()
 {
-    spanbar_p_ =0;
-    valign_l_ =0;
+  spanbar_p_ =0;
+  valign_l_ =0;
 }
 
 Span_bar*
 Span_bar_engraver::get_span_bar_p()const
 {
-    return  new Span_bar;
+  return  new Span_bar;
 }
 
 void
 Span_bar_engraver::acknowledge_element (Score_elem_info i)
 {
-    int depth = i.origin_grav_l_arr_.size();
-    if ( depth > 1
+  int depth = i.origin_grav_l_arr_.size();
+  if ( depth > 1
         && i.elem_l_->is_type_b (Bar::static_name()) ) 
-    {
+  {
        bar_l_arr_.push ((Bar*)i.elem_l_->item());
        
-       if (bar_l_arr_.size() >= 2 && !spanbar_p_) {
+       if (bar_l_arr_.size() >= 2 && !spanbar_p_) 
+         {
            spanbar_p_ = get_span_bar_p();
            announce_element (Score_elem_info (spanbar_p_,0));
-       }
-    } else if  (i.elem_l_->is_type_b (Vertical_align_spanner::static_name()) 
-               && i.origin_grav_l_arr_.size() <= 2) {
+         }
+    }
+  else if  (i.elem_l_->is_type_b (Vertical_align_spanner::static_name()) 
+               && i.origin_grav_l_arr_.size() <= 2) 
+                 {
        valign_l_ = (Vertical_align_spanner*)i.elem_l_->spanner();
     }
 }
@@ -44,14 +47,15 @@ Span_bar_engraver::acknowledge_element (Score_elem_info i)
 void
 Span_bar_engraver::do_pre_move_processing()
 {
-    if (spanbar_p_) {
+  if (spanbar_p_) 
+    {
        for (int i=0; i < bar_l_arr_.size() ; i++)
            spanbar_p_->add (bar_l_arr_[i]);
        spanbar_p_->set (valign_l_);
        typeset_element (spanbar_p_);
        spanbar_p_ =0;
     }
-    bar_l_arr_.set_size (0);
+  bar_l_arr_.set_size (0);
        
 }
 
index 08340ce390b2a212b214497c0010bf73d7736ef9..152e9a7cd8f3d961f79804ebf36184d14ccc01de 100644 (file)
@@ -17,9 +17,9 @@
 void
 Span_bar::add (Bar*b)
 {
-    b->spanned_i_ ++;
-    spanning_l_arr_.push (b);
-    add_dependency (b);
+  b->spanned_i_ ++;
+  spanning_l_arr_.push (b);
+  add_dependency (b);
 }
 
 
@@ -27,67 +27,77 @@ Span_bar::add (Bar*b)
 void
 Span_bar::do_substitute_dependency (Score_elem*o, Score_elem*n)
 {
-    Bar * bold = 0;
-    if  (o->is_type_b (Bar::static_name())) 
+  Bar * bold = 0;
+  if  (o->is_type_b (Bar::static_name())) 
        bold = (Bar*)o->item();
-    else
+  else
        return;
 
-    bold->spanned_i_ --;
-    Bar * b =0;
-    if (n && n->is_type_b (Bar::static_name())) {
+  bold->spanned_i_ --;
+  Bar * b =0;
+  if (n && n->is_type_b (Bar::static_name())) 
+    {
        b = (Bar*)n->item();
        b->spanned_i_ ++;
     }
-    
-    spanning_l_arr_.substitute (bold , b);
+  
+  spanning_l_arr_.substitute (bold , b);
 }
 
 
 void
 Span_bar::set (Vertical_align_element *a)
 {
-    add_dependency (a);
+  add_dependency (a);
 }
-    
+  
 
 Interval
 Span_bar::do_width() const
 {
-    return paper()->lookup_l ()->bar (type_str_, 40 PT).dim.x (); // ugh
+  return paper()->lookup_l ()->bar (type_str_, 40 PT).dim.x (); // ugh
 }
 void
 Span_bar::do_pre_processing()
 {
-    if ( spanning_l_arr_.size() < 1) {
+  if ( spanning_l_arr_.size() < 1) 
+    {
        transparent_b_ = true;
        empty_b_ =true;
-    } else {
+    }
+  else 
+    {
        if (type_str_ == "")
            type_str_ = spanning_l_arr_[0]->type_str_;
-       if (type_str_ =="") {
+       if (type_str_ =="") 
+         {
            transparent_b_=true;
            empty_b_ = true;
-       } else if ( type_str_ == "|:") {
+         }
+       else if ( type_str_ == "|:") 
+         {
            type_str_ = ".|";
-       } else if ( type_str_ == ":|"){
+         }
+       else if ( type_str_ == ":|")
+         {
            type_str_ = "|.";
-       }
+         }
     }
 }
 
 Symbol
 Span_bar::get_bar_sym (Real dy) const
 {
-    return paper()->lookup_l ()->bar (type_str_, dy);
+  return paper()->lookup_l ()->bar (type_str_, dy);
 }
 
 
 Molecule*
 Span_bar::brew_molecule_p()const
 {
-    Interval y_int;
-    for (int i=0; i < spanning_l_arr_.size(); i++) {
+  Interval y_int;
+  for (int i=0; i < spanning_l_arr_.size(); i++) 
+    {
        Axis_group_element *common = 
            common_group (spanning_l_arr_[i], Y_AXIS);
        
@@ -97,10 +107,10 @@ Span_bar::brew_molecule_p()const
        y_int.unite (y + spanning_l_arr_[i]->height());
     }
 
-    Symbol s = get_bar_sym (y_int.length());
-    Molecule*output = new Molecule (Atom (s));
-    output->translate (  y_int[-1], Y_AXIS);
-    return output;
+  Symbol s = get_bar_sym (y_int.length());
+  Molecule*output = new Molecule (Atom (s));
+  output->translate (  y_int[-1], Y_AXIS);
+  return output;
 }
 
 
@@ -108,5 +118,5 @@ IMPLEMENT_IS_TYPE_B1(Span_bar,Bar);
 
 Span_bar::Span_bar()
 {
-    type_str_ = "";
+  type_str_ = "";
 }
index 4afd1358d78b2502424a4a104a8091a71fd426ed..b09322c3297f2e053dbcd3dd585fdc3c9e4a97a8 100644 (file)
@@ -12,7 +12,7 @@
 Span_bar*
 Span_score_bar_engraver::get_span_bar_p() const
 {
-    return new Span_score_bar;
+  return new Span_score_bar;
 }
 
 
@@ -22,7 +22,7 @@ IMPLEMENT_IS_TYPE_B1(Piano_bar_engraver, Span_score_bar_engraver);
 Span_bar*
 Piano_bar_engraver::get_span_bar_p() const
 {
-    return new Piano_brace;
+  return new Piano_brace;
 }
 
 ADD_THIS_ENGRAVER(Piano_bar_engraver);
index 35e34fe601fdf4f602f02bd9cfba1709c8e2fc21..a7592d532056ce3711d9d7d0f347a134359e7f6c 100644 (file)
 
 Span_score_bar::Span_score_bar()
 {
-    type_str_ = "|";
+  type_str_ = "|";
 }
 
 void
 Span_score_bar::do_pre_processing()
 {
-    Span_bar::do_pre_processing();
-    
-    if ( break_status_i() != 1) {
+  Span_bar::do_pre_processing();
+  
+  if ( break_status_i() != 1) 
+    {
        empty_b_ = transparent_b_ = true;
     }
 }
@@ -30,16 +31,16 @@ Span_score_bar::do_pre_processing()
 Symbol
 Piano_brace::get_bar_sym (Real dy)const
 {
-    return paper()->lookup_l ()->vbrace (dy);
+  return paper()->lookup_l ()->vbrace (dy);
 }
 Interval
 Piano_brace::do_width()const
 {
-    return Interval (0,0);
+  return Interval (0,0);
 }
 
 
 IMPLEMENT_IS_TYPE_B1(Span_score_bar, Span_bar);
 IMPLEMENT_IS_TYPE_B1(Piano_brace, Span_score_bar);
 
-    
+  
index d463c2889d6700310d86b02156f44404a677a2e5..3eb1f94f773821433b2a31c4938c8b2a0a28cc52 100644 (file)
@@ -16,15 +16,15 @@ IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_elemen
 Interval
 Spanner_elem_group::do_width() const
 {
-    return Spanner::do_width();
+  return Spanner::do_width();
 }
 
 void
 Spanner_elem_group::do_print() const
 {
 #ifndef NPRINT
-    Spanner::do_print();
-    Horizontal_vertical_group_element::do_print();
+  Spanner::do_print();
+  Horizontal_vertical_group_element::do_print();
 #endif
 }
 
index 09ab9d73c0771fcbeb922cb6da73ae4342e6343a..eac107ba8dc113e7c4d51a2c529cc9feb2edd5c4 100644 (file)
@@ -18,17 +18,17 @@ void
 Spanner::do_print()const
 {
 #ifndef NPRINT
-    DOUT << "Between col ";
-    if ( left_col_l_)
-       DOUT << left_col_l_->rank_i();
-    else 
+  DOUT << "Between col ";
+  if ( left_col_l_)
+       DOUT << left_col_l_->rank_i();
+  else 
        DOUT << "nop";
-    DOUT << ", ";
-    if ( right_col_l_)
-       DOUT << right_col_l_->rank_i();
-    else 
+  DOUT << ", ";
+  if ( right_col_l_)
+       DOUT << right_col_l_->rank_i();
+  else 
        DOUT << "nop";
-    if (broken_into_l_arr_.size())
+  if (broken_into_l_arr_.size())
        DOUT << "with broken pieces\n";
 #endif
 }
@@ -36,22 +36,23 @@ Spanner::do_print()const
 void
 Spanner::break_into_pieces (bool copy_deps_b)
 {
-    if (  broken_into_l_arr_.size())
+  if (  broken_into_l_arr_.size())
        return; 
         
-    PCol * left = left_col_l_;
-    PCol * right = right_col_l_;
-    if (left->daddy_l_) left = left->daddy_l_;
-    if (right->daddy_l_) right = right->daddy_l_;
-    
-    
-    Link_array<PCol> break_cols = pscore_l_->broken_col_range (left,right);
-    Link_array<Spanner> broken_into_l_arr;
-
-    break_cols.insert (left,0);
-    break_cols.push (right);
-
-    for (int i=1; i < break_cols.size(); i++) {
+  PCol * left = left_col_l_;
+  PCol * right = right_col_l_;
+  if (left->daddy_l_) left = left->daddy_l_;
+  if (right->daddy_l_) right = right->daddy_l_;
+  
+  
+  Link_array<PCol> break_cols = pscore_l_->broken_col_range (left,right);
+  Link_array<Spanner> broken_into_l_arr;
+
+  break_cols.insert (left,0);
+  break_cols.push (right);
+
+  for (int i=1; i < break_cols.size(); i++) 
+    {
        Spanner* span_p = clone()->spanner ();
        if (copy_deps_b)
            span_p->copy_dependencies (*this);
@@ -70,8 +71,8 @@ Spanner::break_into_pieces (bool copy_deps_b)
        pscore_l_->typeset_broken_spanner (span_p);
        broken_into_l_arr.push (span_p);
     }
-     
-    broken_into_l_arr_ = broken_into_l_arr;
+   
+  broken_into_l_arr_ = broken_into_l_arr;
 }
 
 void
@@ -79,20 +80,23 @@ Spanner::set_my_columns()
 {
   if (!left_col_l_->line_l_)
        left_col_l_ = left_col_l_->postbreak_p_;
-    if (!right_col_l_->line_l_)
+  if (!right_col_l_->line_l_)
        right_col_l_ = right_col_l_->prebreak_p_;
 }       
 
 void
 Spanner::do_break_processing()
 {
-    set_my_columns();
-    
-    if (!line_l()) {
+  set_my_columns();
+  
+  if (!line_l()) 
+    {
        break_into_pieces (true);
        for (int i=0; i < broken_into_l_arr_.size(); i++)
            broken_into_l_arr_[i]->handle_broken_dependencies();
-    } else { 
+    }
+  else 
+    {
        handle_broken_dependencies();
     }
 }
@@ -100,42 +104,42 @@ Spanner::do_break_processing()
 
 Spanner::Spanner()
 {
-    left_col_l_ = right_col_l_ = 0;
+  left_col_l_ = right_col_l_ = 0;
 }
 
 
 Interval
 Spanner::do_width()const
 {
-    Real r = right_col_l_->hpos_f_;
-    Real l = left_col_l_->hpos_f_;
-    assert (*left_col_l_ < *right_col_l_);
-    assert (r>=l);
+  Real r = right_col_l_->hpos_f_;
+  Real l = left_col_l_->hpos_f_;
+  assert (*left_col_l_ < *right_col_l_);
+  assert (r>=l);
        
-    return Interval (0, r-l);
+  return Interval (0, r-l);
 }
 
 Line_of_score *
 Spanner::line_l()const
 {
-    if ( left_col_l_->line_l_ != right_col_l_->line_l_)
+  if ( left_col_l_->line_l_ != right_col_l_->line_l_)
        return 0;
-    return left_col_l_->line_l_;
+  return left_col_l_->line_l_;
 }
 
 
 Spanner*
 Spanner::find_broken_piece (Line_of_score*l)const
 {
-    for (int i=0; i < broken_into_l_arr_.size(); i++)
+  for (int i=0; i < broken_into_l_arr_.size(); i++)
        if (broken_into_l_arr_[i]->line_l() == l)
            return broken_into_l_arr_[i];
-    return 0;                             
+  return 0;                               
          
 }
 
 bool
 Spanner::broken_b()const
 {
-    return broken_into_l_arr_.size();
+  return broken_into_l_arr_.size();
 }
index d060529d6335b9b7390f90993c5c50f5862db85b..64059065dd6c7166800b798684eb377699c7fc18 100644 (file)
 Vector
 Spring_spacer::default_solution()const
 {
-       return try_initial_solution() ; 
+       return try_initial_solution() ; 
 }
 
 Score_column*
 Spring_spacer::scol_l (int i) 
 {
-    return (Score_column*)cols[i].pcol_l_;
+  return (Score_column*)cols[i].pcol_l_;
 }
 
 const Real COLFUDGE=1e-3;
@@ -40,10 +40,10 @@ template class P<Real>;             // ugh.
 bool
 Spring_spacer::contains (PCol const *w)
 {
-    for (int i=0; i< cols.size(); i++)
+  for (int i=0; i< cols.size(); i++)
        if (cols[i].pcol_l_ == w)
            return true;
-    return false;
+  return false;
 }
 
 
@@ -51,9 +51,9 @@ void
 Spring_spacer::OK() const
 {
 #ifndef NDEBUG
-    for (int i = 1; i < cols.size(); i++)
+  for (int i = 1; i < cols.size(); i++)
        assert (cols[i].rank_i_ > cols[i-1].rank_i_);
-    for (int i = 1; i < loose_col_arr_.size(); i++)
+  for (int i = 1; i < loose_col_arr_.size(); i++)
        assert (loose_col_arr_[i].rank_i_ > loose_col_arr_[i-1].rank_i_);
 #endif 
 }
@@ -64,24 +64,27 @@ Spring_spacer::OK() const
 void
 Spring_spacer::handle_loose_cols() 
 {
-    Union_find connected (cols.size());
-    Array<int> fixed;
-    for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++){
+  Union_find connected (cols.size());
+  Array<int> fixed;
+  for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
+    {
        connected.connect (i->left_i_,i->right_i_);             
     }
-    for (int i = 0; i < cols.size(); i++)
+  for (int i = 0; i < cols.size(); i++)
        if (cols[i].fixed())
            fixed.push (i);
-    for (int i=1; i < fixed.size(); i++)
+  for (int i=1; i < fixed.size(); i++)
        connected.connect (fixed[i-1], fixed[i]);
 
-    for (int i = cols.size(); i--;) {
-       if (! connected.equiv (fixed[0], i)) {
+  for (int i = cols.size(); i--;) 
+    {
+       if (! connected.equiv (fixed[0], i)) 
+         {
            warning ("unconnected column: " + String (i));
            loosen_column (i);
-       }
+         }
     }
-    OK();
+  OK();
 }
 
 
@@ -92,30 +95,36 @@ Spring_spacer::handle_loose_cols()
 void
 Spring_spacer::position_loose_cols (Vector &sol_vec)const
 {
-    if (!loose_col_arr_.size())
+  if (!loose_col_arr_.size())
        return ; 
-    assert (sol_vec.dim());
-    Array<bool> fix_b_arr;
-    fix_b_arr.set_size (cols.size() + loose_col_arr_.size ());
-    Real utter_right_f=-infinity_f;
-    Real utter_left_f =infinity_f;
-    for (int i=0; i < loose_col_arr_.size(); i++) {
+  assert (sol_vec.dim());
+  Array<bool> fix_b_arr;
+  fix_b_arr.set_size (cols.size() + loose_col_arr_.size ());
+  Real utter_right_f=-infinity_f;
+  Real utter_left_f =infinity_f;
+  for (int i=0; i < loose_col_arr_.size(); i++) 
+    {
        fix_b_arr[loose_col_arr_[i].rank_i_] = false;
     }
-    for (int i=0; i < cols.size(); i++) {
+  for (int i=0; i < cols.size(); i++) 
+    {
        int r= cols[i].rank_i_;
        fix_b_arr[r] = true;
        utter_right_f = utter_right_f >? sol_vec (i);
        utter_left_f = utter_left_f <? sol_vec (i);
     }
-    Vector v (fix_b_arr.size());
-    int j =0;
-    int k =0;
-    for (int i=0; i < v.dim(); i++) {
-       if (fix_b_arr[i]) {
+  Vector v (fix_b_arr.size());
+  int j =0;
+  int k =0;
+  for (int i=0; i < v.dim(); i++) 
+    {
+       if (fix_b_arr[i]) 
+         {
            assert (cols[j].rank_i_ == i);
            v (i) = sol_vec (j++);
-       } else {
+         }
+       else 
+         {
            Real left_pos_f = 
                (j>0) ?sol_vec (j-1) : utter_left_f;
            Real right_pos_f = 
@@ -130,18 +139,19 @@ Spring_spacer::position_loose_cols (Vector &sol_vec)const
 
            v (i) =  (r - left_rank)*left_pos_f/ d_r + 
                (right_rank - r) *right_pos_f /d_r;
-       }
+         }
     }
-    sol_vec = v;
+  sol_vec = v;
 }
  
 bool
 Spring_spacer::check_constraints (Vector v) const 
 {
-    int dim=v.dim();
-    assert (dim == cols.size());
-    
-    for (int i=0; i < dim; i++) {
+  int dim=v.dim();
+  assert (dim == cols.size());
+  
+  for (int i=0; i < dim; i++) 
+    {
 
        if (cols[i].fixed()&&
            abs (cols[i].fixed_position() - v (i)) > COLFUDGE) 
@@ -162,35 +172,41 @@ Spring_spacer::check_constraints (Vector v) const
            return false;
 
     }
-    return true;
+  return true;
 }
 
 bool
 Spring_spacer::check_feasible() const
 {
-    Vector sol (try_initial_solution());
-    return check_constraints (sol);     
+  Vector sol (try_initial_solution());
+  return check_constraints (sol);     
 }
 
 /// generate a solution which obeys the min distances and fixed positions
 Vector
 Spring_spacer::try_initial_solution() const
 {
-    int dim=cols.size();
-    Vector initsol (dim);
-    for (int i=0; i < dim; i++) {
-       if (cols[i].fixed()) {
+  int dim=cols.size();
+  Vector initsol (dim);
+  for (int i=0; i < dim; i++) 
+    {
+       if (cols[i].fixed()) 
+         {
            initsol (i)=cols[i].fixed_position();       
 
-           if (i > 0) {
+           if (i > 0) 
+             {
                Real r =initsol (i-1)  + cols[i-1].minright();
-               if (initsol (i) < r) {
+               if (initsol (i) < r) 
+                 {
                    warning ("overriding fixed position");
                    initsol (i) =r;
-               } 
-           }
+                 }
+             }
                
-       } else {
+         }
+       else 
+         {
            Real mindist=cols[i-1].minright()
                +cols[i].minleft();
            if (mindist < 0.0)
@@ -199,7 +215,7 @@ Spring_spacer::try_initial_solution() const
        }       
     }
 
-    return initsol;
+  return initsol;
 }
 
 
@@ -207,20 +223,21 @@ Spring_spacer::try_initial_solution() const
 Vector
 Spring_spacer::find_initial_solution() const
 {
-    Vector v (try_initial_solution());     
-    assert (check_constraints (v));
-    return v;
+  Vector v (try_initial_solution());     
+  assert (check_constraints (v));
+  return v;
 }
 
 // generate the matrices
 void
 Spring_spacer::make_matrices (Matrix &quad, Vector &lin, Real &c) const
 {
-    quad.fill (0);
-    lin.fill (0);
-    c = 0;
-    
-    for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++) {
+  quad.fill (0);
+  lin.fill (0);
+  c = 0;
+  
+  for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++) 
+    {
        int l = i->left_i_;
        int r = i->right_i_;
 
@@ -239,116 +256,122 @@ Spring_spacer::make_matrices (Matrix &quad, Vector &lin, Real &c) const
 void
 Spring_spacer::set_fixed_cols (Mixed_qp &qp)const
 {
-    for (int j=0; j < cols.size(); j++) 
+  for (int j=0; j < cols.size(); j++) 
        if (cols[j].fixed()) 
            qp.add_fixed_var (j,cols[j].fixed_position());          
        
-    
+  
 }
 
 // put the constraints into the LP problem
 void
 Spring_spacer::make_constraints (Mixed_qp& lp) const
 {    
-    int dim=cols.size();
-    for (int j=0; j < dim; j++) {
+  int dim=cols.size();
+  for (int j=0; j < dim; j++) 
+    {
        Colinfo c=cols[j];
-       if (j > 0){
+       if (j > 0)
+         {
            Vector c1(dim);
            
            c1(j)=1.0 ;
            c1(j-1)=-1.0 ;
            lp.add_inequality_cons (c1, cols[j-1].minright() +
                                   cols[j].minleft());
-       }
+         }
     }
 }
 
 void
 Spring_spacer::lower_bound_solution (Col_hpositions*positions)const
 {
-    Mixed_qp lp (cols.size());
-    make_matrices (lp.quad,lp.lin, lp.const_term);
-    set_fixed_cols (lp);
+  Mixed_qp lp (cols.size());
+  make_matrices (lp.quad,lp.lin, lp.const_term);
+  set_fixed_cols (lp);
 
-    Vector start (cols.size());
-    start.fill (0.0);
-    Vector solution_vec (lp.solve (start));
+  Vector start (cols.size());
+  start.fill (0.0);
+  Vector solution_vec (lp.solve (start));
 
-    positions->energy_f_ = lp.eval (solution_vec);
-    positions->config = solution_vec;
-    positions->satisfies_constraints_b_ = check_constraints (solution_vec);
+  positions->energy_f_ = lp.eval (solution_vec);
+  positions->config = solution_vec;
+  positions->satisfies_constraints_b_ = check_constraints (solution_vec);
 }
 
 void
 Spring_spacer::solve (Col_hpositions*positions) const
 {
-    assert (check_feasible());
+  assert (check_feasible());
 
-    Mixed_qp lp (cols.size());
-    make_matrices (lp.quad,lp.lin, lp.const_term);
-    make_constraints (lp);    
-    set_fixed_cols (lp);
-    Vector start=find_initial_solution();    
-    Vector solution_vec (lp.solve (start));
+  Mixed_qp lp (cols.size());
+  make_matrices (lp.quad,lp.lin, lp.const_term);
+  make_constraints (lp);    
+  set_fixed_cols (lp);
+  Vector start=find_initial_solution();    
+  Vector solution_vec (lp.solve (start));
 
 
-    positions->satisfies_constraints_b_ = check_constraints (solution_vec);
-    if (!positions->satisfies_constraints_b_) {
+  positions->satisfies_constraints_b_ = check_constraints (solution_vec);
+  if (!positions->satisfies_constraints_b_) 
+    {
        WARN << "solution doesn't satisfy constraints.\n" ;
     }
-    position_loose_cols (solution_vec); 
-    positions->energy_f_ = lp.eval (solution_vec);
-    positions->config = solution_vec;
-    positions->error_col_l_arr_ = error_pcol_l_arr();
-    
+  position_loose_cols (solution_vec); 
+  positions->energy_f_ = lp.eval (solution_vec);
+  positions->config = solution_vec;
+  positions->error_col_l_arr_ = error_pcol_l_arr();
+  
 }
 
 /**
-    add one column to the problem.
+  add one column to the problem.
 */    
 void
 Spring_spacer::add_column (PCol  *col, bool fixed, Real fixpos)
 {
-    Colinfo c (col,(fixed)? &fixpos :  0);
-    if (cols.size())
+  Colinfo c (col,(fixed)? &fixpos :  0);
+  if (cols.size())
        c.rank_i_ = cols.top().rank_i_+1;
-    else
+  else
        c.rank_i_ = 0;
-    cols.push (c);
+  cols.push (c);
 }
 
 Line_of_cols
 Spring_spacer::error_pcol_l_arr()const
 {
-    Array<PCol*> retval;
-    for (int i=0; i< cols.size(); i++)
+  Array<PCol*> retval;
+  for (int i=0; i< cols.size(); i++)
        if (cols[i].ugh_b_)
            retval.push (cols[i].pcol_l_);
-    for (int i=0;  i < loose_col_arr_.size(); i++) {
+  for (int i=0;  i < loose_col_arr_.size(); i++) 
+    {
        retval.push (loose_col_arr_[i].pcol_l_);
     }
-    return retval;
+  return retval;
 }
 
 void
 Spring_spacer::loosen_column (int i)
 {
-    Colinfo c=cols.get (i);
-    for (PCursor<Idealspacing*> j (ideal_p_list_.top()); j.ok (); j++){
+  Colinfo c=cols.get (i);
+  for (PCursor<Idealspacing*> j (ideal_p_list_.top()); j.ok (); j++)
+    {
        if (j->left_i_ == i|| j->right_i_ == i)
            j.del();
        else
            j++;
     }
-    c.ugh_b_ = true;
-    
-    int j=0;
-    for (; j < loose_col_arr_.size(); j++) {
+  c.ugh_b_ = true;
+  
+  int j=0;
+  for (; j < loose_col_arr_.size(); j++) 
+    {
        if (loose_col_arr_[j].rank_i_ > c.rank_i_)
            break;
     }
-    loose_col_arr_.insert (c,j);
+  loose_col_arr_.insert (c,j);
 }
 
 
@@ -356,11 +379,13 @@ void
 Spring_spacer::print() const
 {
 #ifndef NPRINT
-    for (int i=0; i < cols.size(); i++) {
+  for (int i=0; i < cols.size(); i++) 
+    {
        DOUT << "col " << i<<' ';
        cols[i].print();
     }
-    for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++){
+  for (PCursor<Idealspacing*> i (ideal_p_list_.top()); i.ok (); i++)
+    {
        i->print();
     }
 #endif
@@ -370,13 +395,92 @@ Spring_spacer::print() const
 void
 Spring_spacer::connect (int i, int j, Real d, Real h)
 {
-    Idealspacing * s = new Idealspacing;
-    s->left_i_ = i;
-    s->right_i_ = j;
-    s->space_f_ = d;
-    s->hooke_f_ = h;
+  assert( d >= 0 && d <= 100 CM);
+  assert( h >=0);
+  
+  Idealspacing * s = new Idealspacing;
+  s->left_i_ = i;
+  s->right_i_ = j;
+  s->space_f_ = d;
+  s->hooke_f_ = h;
+  
+  ideal_p_list_.bottom().add (s);
+}
+
+
+
+
+void
+Spring_spacer::prepare()
+{
+  calc_idealspacing();
+  handle_loose_cols();
+  print();
+}
+
+Line_spacer*
+Spring_spacer::constructor() 
+{
+  return new Spring_spacer;
+}
+
+
+/**
+  get the shortest_playing running note at a time. */
+void
+Spring_spacer::get_ruling_durations(Array<Moment> &shortest_playing_arr,
+                                   Array<Moment> &context_shortest_arr)
+{
+  for (int i=0; i < cols.size(); i++) 
+    scol_l (i)->preprocess();
+
+  int start_context_i=0;
+  Moment context_shortest = infinity_mom;
+  context_shortest_arr.set_size(cols.size());
+
+  for (int i=0; i < cols.size(); i++)
+    {
+      Moment now = scol_l (i)->when();
+      Moment shortest_playing = infinity_mom;
+
+      if (scol_l(i)->breakable_b())
+       {
+         for (int ji=i; ji >= start_context_i; ji--) 
+           context_shortest_arr[ji] = context_shortest;
+         start_context_i = i;
+         context_shortest = infinity_mom;
+       }
+      if (scol_l(i)->durations.size())
+       {
+         context_shortest = context_shortest <? scol_l(i)->durations[0];
+       }
+      // ji was j, but triggered ICE
+      for (int ji=i+1; ji --; )
+       {
+         if (scol_l(ji)->durations.size() &&
+             now - scol_l(ji)->when() >= shortest_playing)
+           break;
+                   
+         for (int k =  scol_l (ji)->durations.size(); 
+              k-- && scol_l(ji)->durations[k] + scol_l(ji)->when() > now;  
+              ) 
+           {
+             shortest_playing = shortest_playing <? scol_l(ji)->durations[k];
+           }
+       }
+      shortest_playing_arr.push(shortest_playing);
+    }
     
-    ideal_p_list_.bottom().add (s);
+#ifndef NPRINT
+  DOUT << "shortest_playing/:[ ";
+  for (int i=0; i < shortest_playing_arr.size(); i++)
+    {
+      DOUT << shortest_playing_arr[i] << " "; 
+      DOUT << context_shortest_arr[i] << ", ";
+    }
+  DOUT << "]\n";
+#endif
 }
 
 /**
@@ -397,109 +501,86 @@ Spring_spacer::connect (int i, int j, Real d, Real h)
 void
 Spring_spacer::calc_idealspacing()
 {
-    for (int i=0; i < cols.size(); i++) 
-       scol_l (i)->preprocess();
-    
-    /* get the shortest running note at a time. */
-    Array<Moment> shortest_arr;
-    for (int i=0; i < cols.size(); i++) {
-       Moment now = scol_l (i)->when();
-       Moment shortest = infinity_mom;
-       // ji was j, but triggered ICE
-       for (int ji=i+1; ji --; ) {
-           if (scol_l(ji)->durations.size() &&
-                now - scol_l(ji)->when() >= shortest)
-               break;
-                   
-           for (int k =  scol_l (ji)->durations.size(); 
-                k-- && scol_l(ji)->durations[k] + scol_l(ji)->when() > now;  
-               ) 
-           {
-               shortest = shortest <? scol_l(ji)->durations[k];
-           }
-       }
-       shortest_arr.push(shortest);
-    }
-    
-#ifndef NPRINT
-    DOUT << "shortest:[ ";
-    for (int i=0; i < shortest_arr.size(); i++)
-       DOUT << shortest_arr[i] << " ";
-    DOUT << "]\n";
-#endif
+  Array<Moment> shortest_playing_arr;
+  Array<Moment> context_shortest_arr;
+  get_ruling_durations(shortest_playing_arr, context_shortest_arr);
+
   
-    Array<Real> ideal_arr_;
-    Array<Real> hooke_arr_;    
-    for (int i=0; i < cols.size(); i++){
-       ideal_arr_.push (-1.0);
-       hooke_arr_.push (1.0);
-    }
+  Array<Real> ideal_arr_;
+  Array<Real> hooke_arr_;    
+  for (int i=0; i < cols.size(); i++){
+    ideal_arr_.push (-1.0);
+    hooke_arr_.push (1.0);
+  }
     
-    for (int i=0; i < cols.size(); i++) {
-       if ( !scol_l (i)->musical_b()) {
-           Real symbol_distance =cols[i].minright() + 2 PT;
-           Real durational_distance = 0;
-
-           if (i+1 < cols.size()) {
-               Moment delta_t =  scol_l (i+1)->when() - scol_l (i)->when () ;
-               /*
-                 ugh should use shortest distance
-                */
-               if (delta_t)
-                   durational_distance =  paper_l()->duration_to_dist (delta_t) ;
-               symbol_distance += cols[i+1].minleft();
+  for (int i=0; i < cols.size(); i++)
+    {
+      if ( !scol_l (i)->musical_b())
+       {
+         Real symbol_distance =cols[i].minright() + 2 PT;
+         Real durational_distance = 0;
+
+         if (i+1 < cols.size())
+           {
+             Moment delta_t =  scol_l (i+1)->when() - scol_l (i)->when () ;
+
+             Real k=  paper_l()->arithmetic_constant(context_shortest_arr[i]);
+             /*
+               ugh should use shortest_playing distance
+               */
+             if (delta_t)
+               durational_distance =  paper_l()->duration_to_dist (delta_t,k);
+             symbol_distance += cols[i+1].minleft();
            }
            
-           ideal_arr_[i] = symbol_distance >? durational_distance;
-           hooke_arr_[i] = 2.0;
+         ideal_arr_[i] = symbol_distance >? durational_distance;
+         hooke_arr_[i] = 2.0;
        }
     }
-    for (int i=0; i < cols.size(); i++) {
-       if (scol_l (i)->musical_b()) {
-           Moment shortest_len = shortest_arr[i];
-           if ( ! shortest_len) {
-               warning ("Can't find a ruling note at " 
-                        +String (scol_l (i)->when()));
-               shortest_len = 1;
+  for (int i=0; i < cols.size(); i++)
+    {
+      if (scol_l (i)->musical_b())
+       {
+         Moment shortest_playing_len = shortest_playing_arr[i];
+         Moment context_shortest = context_shortest_arr[i];
+         if ( ! shortest_playing_len)
+           {
+             warning ("Can't find a ruling note at " 
+                      +String (scol_l (i)->when()));
+             shortest_playing_len = 1;
+           }
+         if ( ! context_shortest )
+           {
+             warning("No minimum in measure at "
+                     + String (scol_l (i)->when()));
+             context_shortest = 1;
            }
-           Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when ();
-           Real dist = paper_l()->duration_to_dist (shortest_len);
-           dist *= delta_t / shortest_len;
-           if (!scol_l (i+1)->musical_b()) {
-
-               Real minimum_dist =   cols[i+1].minleft() + 2 PT + cols[i].minright () ;
-               if (ideal_arr_[i+1] + minimum_dist < dist) {
-                   ideal_arr_[i] = dist - ideal_arr_[i+1];
-                   // hooke_arr_[i+1] =1.0;
+         Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when ();
+         Real k=  paper_l()->arithmetic_constant(context_shortest);
+         Real dist = paper_l()->duration_to_dist (shortest_playing_len, k);
+         dist *= delta_t / shortest_playing_len;
+       
+         /* all sorts of ugliness to avoid running into bars/clefs, but not taking
+            extra space if this is not needed */
+         if (!scol_l (i+1)->musical_b())
+           {
+             Real minimum_dist =   cols[i+1].minleft() + 2 PT + cols[i].minright () ;
+             if (ideal_arr_[i+1] + minimum_dist < dist)
+               {
+                 ideal_arr_[i] = dist - ideal_arr_[i+1];
+                 // hooke_arr_[i+1] =1.0;
                } else {
-                   ideal_arr_[i] = minimum_dist;
+                 ideal_arr_[i] = minimum_dist;
                }
-                                     
+
            } else
-               ideal_arr_[i] = dist;
+             ideal_arr_[i] = dist;
        }
     }
 
-    for (int i=0; i < ideal_arr_.size()-1; i++) {
-       assert (ideal_arr_[i] >=0 && hooke_arr_[i] >=0);
-       connect (i, i+1, ideal_arr_[i], hooke_arr_[i]);
+  for (int i=0; i < ideal_arr_.size()-1; i++)
+    {
+      assert (ideal_arr_[i] >=0 && hooke_arr_[i] >=0);
+      connect (i, i+1, ideal_arr_[i], hooke_arr_[i]);
     }
 }
-
-
-
-void
-Spring_spacer::prepare()
-{
-    calc_idealspacing();
-    handle_loose_cols();
-    print();
-}
-
-Line_spacer*
-Spring_spacer::constructor() 
-{
-    return new Spring_spacer;
-}
index f1c4a9ab7f5fc3622b5ed0ec7c82527830100fbd..0857fb9b55742f87610232700313de51cbef7f5f 100644 (file)
 Score*
 Staff_info::score_l()
 {
-    return score_l_;
+  return score_l_;
 }
 
 Staff_info::Staff_info()
 {
-    score_l_ =0;
-    c0_position_i_l_ = 0;
-    time_C_ = 0;
-    rhythmic_C_ =0;
-    break_allowed_b_ = 0;
+  score_l_ =0;
+  c0_position_i_l_ = 0;
+  time_C_ = 0;
+  rhythmic_C_ =0;
+  break_allowed_b_ = 0;
 }
 
 Score_column*
 Staff_info::musical_l()
 {
-    return musical_l_;
+  return musical_l_;
 }
 
 Score_column*
 Staff_info::command_l()
 {
-    return command_l_;
+  return command_l_;
 }
 
 PCol*
 Staff_info::command_pcol_l()
 {
-    return command_l();
+  return command_l();
 }
 
 PCol*
 Staff_info::musical_pcol_l()
 {
-    return musical_l();
+  return musical_l();
 }
 
 Moment
 Staff_info::when()
 {
-    return command_l()->when ();
+  return command_l()->when ();
 }
 
index 34098b04dab16c5602719b41434ecbf3848a295d..80bbf00a30fb5052ea154df654f0be79f90712ab 100644 (file)
@@ -19,30 +19,31 @@ ADD_THIS_PERFORMER(Staff_performer);
 
 Staff_performer::Staff_performer()
 {
-    audio_staff_p_ = 0;
+  audio_staff_p_ = 0;
 }
 
 Staff_performer::~Staff_performer()
 {
-    delete audio_staff_p_;
+  delete audio_staff_p_;
 }
 
 void
 Staff_performer::do_creation_processing()
 {
-    audio_staff_p_ = new Audio_staff;
+  audio_staff_p_ = new Audio_staff;
 
-    if (instrument_str().length_i()) {
+  if (instrument_str().length_i()) 
+    {
        // staff name
        play (new Audio_text ( Audio_text::TRACK_NAME, instrument_str ()));
        // instrument description
        play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
     }
 
-    // tempo
-    play(new Audio_tempo(get_tempo_i()));
+  // tempo
+  play(new Audio_tempo(get_tempo_i()));
 
-    if (instrument_str ().length_i ())
+  if (instrument_str ().length_i ())
        // instrument
        play (new Audio_instrument (instrument_str ()));
 }
@@ -50,22 +51,23 @@ Staff_performer::do_creation_processing()
 void
 Staff_performer::do_removal_processing()
 {
-    Performer::play (audio_staff_p_);
-    audio_staff_p_ = 0;
+  Performer::play (audio_staff_p_);
+  audio_staff_p_ = 0;
 }
 
 String 
 Staff_performer::instrument_str() 
 { 
-    return Translator::id_str_; 
+  return Translator::id_str_; 
 }
 
 void 
 Staff_performer::play (Audio_element* p)
 {
-    if (p->is_type_b (Audio_item::static_name())) {
+  if (p->is_type_b (Audio_item::static_name())) 
+    {
        audio_staff_p_->add ((Audio_item*)p);
     }
-    Performer::play (p);
+  Performer::play (p);
 }
 
index 704dc21ede07d9d59670f6123c0ae86c03412a81..5d9bd748ab3e2a1276e4975694e127a698185503 100644 (file)
 void
 Staff_side::set_staffsym (Staff_symbol* s_l)
 {
-    staff_sym_l_ = s_l;
-    add_dependency (s_l);
+  staff_sym_l_ = s_l;
+  add_dependency (s_l);
 }
 
 Staff_side::Staff_side()
 {
-    pos_i_ =0;
-    sym_int_ = Interval (0,0);
-    staff_size_i_ = 0;
-    staff_sym_l_=0;
-    dir_i_ =0;
-    inside_staff_b_ =false;
+  pos_i_ =0;
+  sym_int_ = Interval (0,0);
+  staff_size_i_ = 0;
+  staff_sym_l_=0;
+  dir_i_ =0;
+  inside_staff_b_ =false;
 }
 
 void
 Staff_side::read_staff_sym()
 {
-    if (! staff_sym_l_)
+  if (! staff_sym_l_)
        return ;
-    staff_size_i_ = staff_sym_l_->steps_i();
+  staff_size_i_ = staff_sym_l_->steps_i();
 }
 
 
 Interval
 Staff_side::support_height() const
 {
-    Interval r;
-    
-    for (int i=0; i < support_l_arr_.size(); i++)
+  Interval r;
+  
+  for (int i=0; i < support_l_arr_.size(); i++)
        r.unite (support_l_arr_[i]->height());
-    if (r.empty_b()) {
+  if (r.empty_b()) 
+    {
        r = Interval (0,0);
     }
-    return r;
+  return r;
 }
 
 void
 Staff_side::add_support (Score_elem*i)
 {
-    support_l_arr_.push (i);
-    add_dependency (i);
+  support_l_arr_.push (i);
+  add_dependency (i);
 }
 
 int
 Staff_side::get_position_i()const
 {
-    if (!dir_i_) {
+  if (!dir_i_) 
+    {
        warning ("Staff_side::get_position_i(): " 
                "somebody forgot to set my vertical direction, returning -20");
        return -20;
     }
-    
+  
 
-    Real y=0;
-    Real inter_f = paper()-> internote_f ();
-    if (!inside_staff_b_) {
+  Real y=0;
+  Real inter_f = paper()-> internote_f ();
+  if (!inside_staff_b_) 
+    {
        y  = (dir_i_ > 0 && staff_sym_l_) ? staff_sym_l_->steps_i() + 2: -2; 
        y *=inter_f;
        Interval v= support_height();
 
-       if (dir_i_ > 0) {
+       if (dir_i_ > 0) 
+         {
            y = y >? (v.max() + 2*inter_f);
-       } else if (dir_i_ < 0) {
+         }
+       else if (dir_i_ < 0) 
+         {
            y = y <? (v.min() - 2*inter_f);
-       }
-    } else {
+         }
+    }
+  else 
+    {
        Interval v= support_height();
        y = v[dir_i_]  + 2*dir_i_*inter_f;      // ugh
     }
-    return int (rint (Real (y)/inter_f)); // should ret a float?
+  return int (rint (Real (y)/inter_f)); // should ret a float?
 }
 
 Interval
 Staff_side::symbol_height() const
 {
-    return Interval (0,0);
+  return Interval (0,0);
 }
 
 void
 Staff_side::do_post_processing()
 {
-    sym_int_ = symbol_height();
-    pos_i_ = get_position_i();
-    if (dir_i_)
+  sym_int_ = symbol_height();
+  pos_i_ = get_position_i();
+  if (dir_i_)
        pos_i_ += int (rint (- sym_int_[-dir_i_] / paper()->internote_f ()));
 }
 
 void
 Staff_side::do_substitute_dependency (Score_elem*o, Score_elem*n)
 { 
-    support_l_arr_.unordered_substitute (o,n);
-    if (staff_sym_l_ == o)
+  support_l_arr_.unordered_substitute (o,n);
+  if (staff_sym_l_ == o)
        staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
 }
 
index 5aff3e35361da0db1b190a882a4b403fb5800eb6..6adfae18269039cca7e76e48be5c0480518cba73 100644 (file)
@@ -15,12 +15,12 @@ const NO_LINES = 5;
 void
 Staff_sym_engraver::fill_staff_info (Staff_info&i)
 {
-    i.staff_sym_l_ = span_p_;
+  i.staff_sym_l_ = span_p_;
 }
 
 Staff_sym_engraver::~Staff_sym_engraver()
 {
-    assert (!span_p_);
+  assert (!span_p_);
 }
 
 Staff_sym_engraver::Staff_sym_engraver()
@@ -31,17 +31,17 @@ Staff_sym_engraver::Staff_sym_engraver()
 void
 Staff_sym_engraver::do_creation_processing()
 {
-    span_p_ = new Staff_symbol (NO_LINES);
-    span_p_->left_col_l_ = get_staff_info().command_pcol_l (); // ugh
-    announce_element (Score_elem_info (span_p_, 0));
+  span_p_ = new Staff_symbol (NO_LINES);
+  span_p_->left_col_l_ = get_staff_info().command_pcol_l (); // ugh
+  announce_element (Score_elem_info (span_p_, 0));
 }
 
 void
 Staff_sym_engraver::do_removal_processing()
 {
-    span_p_->right_col_l_ = get_staff_info().command_pcol_l ();
-    typeset_element (span_p_);
-    span_p_ =0;
+  span_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  typeset_element (span_p_);
+  span_p_ =0;
 }
 
 
index 4e1a81d955dc6d36690dc68623bb952e98f648b1..4542d2e3dcfc0acb8aceb5ce7f2546b79786e412 100644 (file)
@@ -15,7 +15,7 @@
 
 Staff_symbol::Staff_symbol (int l)
 {
-    no_lines_i_ = l;
+  no_lines_i_ = l;
 }
 
 
@@ -25,34 +25,34 @@ void
 Staff_symbol::do_print()const
 {
 #ifndef NPRINT
-    Spanner::do_print();
-    DOUT << "lines: " << no_lines_i_;
+  Spanner::do_print();
+  DOUT << "lines: " << no_lines_i_;
 #endif
 }
 
 Molecule*
 Staff_symbol::brew_molecule_p() const
 {
-    Atom a  = paper()->lookup_l ()->linestaff (no_lines_i_, width ().length ());
-    return new Molecule (a);
+  Atom a  = paper()->lookup_l ()->linestaff (no_lines_i_, width ().length ());
+  return new Molecule (a);
 }
 
 void
 Staff_symbol::set_extent (PCol*p1, PCol*p2)
 {
-    assert (p1&&p2);
-    left_col_l_ = p1;
-    right_col_l_ = p2;
+  assert (p1&&p2);
+  left_col_l_ = p1;
+  right_col_l_ = p2;
 }
 
 Real
 Staff_symbol::inter_note_f()const
 {
-    return paper()->internote_f ();
+  return paper()->internote_f ();
 }
 
 int
 Staff_symbol::steps_i() const
 {
-    return no_lines_i_*2;
+  return no_lines_i_*2;
 }
index 1872d89868d174c3e9758bcbb1689bb763b15b5c..01564cd929c14c14b685e711cb6a5d8c3ee5ec6e 100644 (file)
 #include "grouping.hh"
 #include "note-head.hh"
 #include "time-description.hh"
+#include "duration-convert.hh"
 
 Stem_beam_engraver::Stem_beam_engraver()
 {
-    do_post_move_processing();
+  do_post_move_processing();
 
-    current_grouping = 0;
-    beam_p_ = 0;
-    default_dir_i_ =0;
-    start_req_l_ = 0;
+  current_grouping = 0;
+  beam_p_ = 0;
+  default_dir_i_ =0;
+  start_req_l_ = 0;
 }
 
 bool
 Stem_beam_engraver::do_try_request (Request*req_l)
 {
-    
-    Musical_req* mus_l = req_l->musical();
-    /* Debiele puntkomma's. Laat je er eentje per ongeluk achter een
-      if (..) staan, lijkt het net op een luis in gcc.
-
-      (ofwel Python rules)
-      */
-    if (!mus_l)
-       return false;
+  
+  Musical_req* mus_l = req_l->musical();
+  /* Debiele puntkomma's. Laat je er eentje per ongeluk achter een
+   if (..) staan, lijkt het net op een luis in gcc.
+
+   (ofwel Python rules)
+   */
+  if (!mus_l)
+  return false;
 
 
-    if ( mus_l->beam()) {
-       if (bool (beam_p_) == bool (mus_l->beam()->spantype == Span_req::START))
-           return false;
+  if ( mus_l->beam()) 
+  {
+    if (bool (beam_p_) == bool (mus_l->beam()->spantype == Span_req::START))
+       return false;
        
-       if (beam_req_l_ && beam_req_l_ ->equal_b (mus_l))
-           return false;
+    if (beam_req_l_ && beam_req_l_ ->equal_b (mus_l))
+       return false;
        
-       beam_req_l_ = mus_l->beam();
-       return true;
-    }
-    
-    if ( mus_l->stem()) {
-       if (current_grouping && !current_grouping->child_fit_b (
-           get_staff_info().time_C_->whole_in_measure_))
-           return false;
-
-       if (stem_req_l_ && !stem_req_l_->equal_b (mus_l) )
-           return false;
-
-       stem_req_l_ = mus_l->stem();
-       return true;
-    }
-    return false;
+    beam_req_l_ = mus_l->beam();
+    return true;
+  }
+  
+  if ( mus_l->stem()) 
+  {
+    if (current_grouping && !current_grouping->child_fit_b (
+                                                             get_staff_info().time_C_->whole_in_measure_))
+       return false;
+
+    if (stem_req_l_ && !stem_req_l_->equal_b (mus_l) )
+       return false;
+
+    stem_req_l_ = mus_l->stem();
+    return true;
+  }
+  return false;
 }
 
 void
 Stem_beam_engraver::do_process_requests()
 {
-    if (beam_req_l_) {
-       if (beam_req_l_->spantype == Span_req::STOP) {
-           end_beam_b_ = true;
-           start_req_l_ = 0;
-       } else {
-           beam_p_ = new Beam;
-           start_req_l_ = beam_req_l_;
-           beam_p_->left_col_l_ = get_staff_info().musical_pcol_l ();
-           current_grouping = new Rhythmic_grouping;
-           if (beam_req_l_->nplet) {
-               Text_spanner* t = new Text_spanner();
-               Text_def *defp = new Text_def;
-               t->set_support (beam_p_);
-               defp->align_i_ = 0;
-               defp->text_str_ = beam_req_l_->nplet;
-               defp->style_str_="italic";
-               t->spec_p_  = defp;
-               announce_element (Score_elem_info (t,0));
-               typeset_element (t);
+  if (beam_req_l_) 
+  {
+    if (beam_req_l_->spantype == Span_req::STOP) 
+       {
+         end_beam_b_ = true;
+         start_req_l_ = 0;
+       }
+    else 
+       {
+         beam_p_ = new Beam;
+         start_req_l_ = beam_req_l_;
+         beam_p_->left_col_l_ = get_staff_info().musical_pcol_l ();
+         current_grouping = new Rhythmic_grouping;
+         if (beam_req_l_->nplet) 
+           {
+             Text_spanner* t = new Text_spanner();
+             Text_def *defp = new Text_def;
+             t->set_support (beam_p_);
+             defp->align_i_ = 0;
+             defp->text_str_ = beam_req_l_->nplet;
+             defp->style_str_="italic";
+             t->spec_p_  = defp;
+             announce_element (Score_elem_info (t,0));
+             typeset_element (t);
            }
-           announce_element ( Score_elem_info (beam_p_, 0));
+         announce_element ( Score_elem_info (beam_p_, 0));
             
        }
-    }
-
-    if (stem_req_l_) {
-       stem_p_ = new Stem (8);
-       if (current_grouping)
-           current_grouping->add_child (
-               get_staff_info().time_C_->whole_in_measure_,
-               stem_req_l_->duration());
-
-       stem_p_->flag_i_ = stem_req_l_->duration_.type_i_;
-
-       if (beam_p_) {
-           if (stem_req_l_->duration_.type_i_<= 4)
-               stem_req_l_->warning ("stem doesn't fit in Beam");
-           else
-               beam_p_->add (stem_p_);
-           stem_p_->print_flag_b_ = false;
-       } else {
-           stem_p_->print_flag_b_ = true;
+  }
+
+  if (stem_req_l_) 
+  {
+    stem_p_ = new Stem (8);
+    if (current_grouping)
+       current_grouping->add_child (
+                                    get_staff_info().time_C_->whole_in_measure_,
+                                    stem_req_l_->duration());
+
+    stem_p_->flag_i_ = Duration_convert::type2_i
+      (stem_req_l_->duration_.durlog_i_);      // should change rep. of flags too.
+
+    if (beam_p_) 
+       {
+         if (stem_req_l_->duration_.durlog_i_<= 2)
+           stem_req_l_->warning ("stem doesn't fit in Beam");
+         else
+           beam_p_->add (stem_p_);
+         stem_p_->print_flag_b_ = false;
+       }
+    else 
+       {
+         stem_p_->print_flag_b_ = true;
        }
        
-       announce_element (Score_elem_info (stem_p_, stem_req_l_));
-    }
+    announce_element (Score_elem_info (stem_p_, stem_req_l_));
+  }
 }
 
 void
 Stem_beam_engraver::acknowledge_element (Score_elem_info info)
 {
-    if (!stem_p_)
-       return;
-
-    if (info.elem_l_->name() == Note_head::static_name () &&
-       stem_req_l_->duration() 
-       == info.req_l_->musical()->rhythmic ()->duration ()){
-       Note_head * n_l= (Note_head*)info.elem_l_->item();
-       stem_p_->add (n_l);
-    }
+  if (!stem_p_)
+  return;
+
+  if (info.elem_l_->name() == Note_head::static_name () &&
+    stem_req_l_->duration() 
+    == info.req_l_->musical()->rhythmic ()->duration ())
+  {
+    Note_head * n_l= (Note_head*)info.elem_l_->item();
+    stem_p_->add (n_l);
+  }
 }
 void
 Stem_beam_engraver::do_pre_move_processing()
 {
-    if (stem_p_) {
-       if (default_dir_i_)
-           stem_p_->dir_i_ = default_dir_i_;
+  if (stem_p_) 
+  {
+    if (default_dir_i_)
+       stem_p_->dir_i_ = default_dir_i_;
        
-       typeset_element (stem_p_);
-       stem_p_ = 0;
-    }
-    if (beam_p_ && end_beam_b_) {
-       Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
-       rg_C->extend (current_grouping->interval());
-       beam_p_->set_grouping (*rg_C, *current_grouping);
-       beam_p_->right_col_l_ = get_staff_info().musical_pcol_l ();
-       typeset_element (beam_p_);
-       delete current_grouping;
-       current_grouping = 0;
-       beam_p_ = 0;
-    }
-    end_beam_b_ = false;
+    typeset_element (stem_p_);
+    stem_p_ = 0;
+  }
+  if (beam_p_ && end_beam_b_) 
+  {
+    Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
+    rg_C->extend (current_grouping->interval());
+    beam_p_->set_grouping (*rg_C, *current_grouping);
+    beam_p_->right_col_l_ = get_staff_info().musical_pcol_l ();
+    typeset_element (beam_p_);
+    delete current_grouping;
+    current_grouping = 0;
+    beam_p_ = 0;
+  }
+  end_beam_b_ = false;
 }
 void
 Stem_beam_engraver::do_post_move_processing()
 {
-    stem_p_ = 0;
-    beam_req_l_ = 0;
-    stem_req_l_ = 0;
-    end_beam_b_ = false;
+  stem_p_ = 0;
+  beam_req_l_ = 0;
+  stem_req_l_ = 0;
+  end_beam_b_ = false;
 }
 
 Stem_beam_engraver::~Stem_beam_engraver()
 {
-    if (beam_p_)
-       start_req_l_->warning ("unterminated beam");
+  if (beam_p_)
+  start_req_l_->warning ("unterminated beam");
 }
 
 void
 Stem_beam_engraver::set_feature (Feature i)
 {
-    if (i.type_ == "vdir")     
-       default_dir_i_ = i.value_;
+  if (i.type_ == "vdir")       
+  default_dir_i_ = i.value_;
 }
 
 
index 5a6fec0c778281b554057e00dc7ed148787ea357..633a0e3252dba8426f08e1354410ea0bb8f8d2b9 100644 (file)
@@ -21,34 +21,34 @@ const int STEMLEN=7;
 int
 Stem::min_head_i()const
 {
-    int m = 1000;
-    for (int i =0; i < head_l_arr_.size(); i++)
+  int m = 1000;
+  for (int i =0; i < head_l_arr_.size(); i++)
        m = m <? head_l_arr_[i]->position_i_;
-    return m;
+  return m;
 }
 
 int
 Stem::max_head_i() const
 {
-    int m = -1000;
-    for (int i =0; i < head_l_arr_.size(); i++)
+  int m = -1000;
+  for (int i =0; i < head_l_arr_.size(); i++)
        m = m >? head_l_arr_[i]->position_i_;
-    return m;
-    
+  return m;
+  
 }
 
 Stem::Stem (int c) 
 {
-    beams_left_i_ = 0;
-    beams_right_i_ = 0;
+  beams_left_i_ = 0;
+  beams_right_i_ = 0;
 
-    stem_bottom_f_ = stem_top_f_ = 0;
-    flag_i_ = 4;
-    dir_i_ =0;
-    staff_size_i_ = c;
+  stem_bottom_f_ = stem_top_f_ = 0;
+  flag_i_ = 4;
+  dir_i_ =0;
+  staff_size_i_ = c;
 
-    print_flag_b_=true;
-    stem_xoffset_f_ =0;
+  print_flag_b_=true;
+  stem_xoffset_f_ =0;
 }
 
 
@@ -58,51 +58,56 @@ void
 Stem::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "flag "<< flag_i_ << " print_flag_b_ " << print_flag_b_;
+  DOUT << "flag "<< flag_i_ << " print_flag_b_ " << print_flag_b_;
 #endif
 }
 
 Real 
 Stem::stem_length_f()const
 {
-    return stem_top_f_-stem_bottom_f_ ;
+  return stem_top_f_-stem_bottom_f_ ;
 }
 
 Real
 Stem::stem_start_f()const
 {
-    return (dir_i_ < 0)? stem_top_f_ : stem_bottom_f_;
+  return (dir_i_ < 0)? stem_top_f_ : stem_bottom_f_;
 }
 
 Real
 Stem::stem_end_f() const
 {
-    return (dir_i_ < 0)? stem_bottom_f_ : stem_top_f_;
+  return (dir_i_ < 0)? stem_bottom_f_ : stem_top_f_;
 }
 
 
 void
 Stem::set_stemend (Real se)
 {
-    // todo: margins
-    if (!  ((dir_i_ > 0 && se >= max_head_i()) || 
+  // todo: margins
+  if (!  ((dir_i_ > 0 && se >= max_head_i()) || 
            (se <= min_head_i() && dir_i_ <0)) )        
        warning ("Weird stem size; check for narrow beams");
 
-    stem_top_f_  = (dir_i_ < 0) ? max_head_i()           : se;
-    stem_bottom_f_  = (dir_i_ < 0) ? se  : min_head_i();
+  stem_top_f_  = (dir_i_ < 0) ? max_head_i()           : se;
+  stem_bottom_f_  = (dir_i_ < 0) ? se  : min_head_i();
 }
 
 void
 Stem::add (Note_head *n)
 {
-    n->add_dependency (this);
-    if (n->rest_b_) {
+  n->add_dependency (this);
+  if (n->rest_b_) 
+    {
        rest_l_arr_.push (n);
-    } else if (n->balltype_i_ == 1) {
+    }
+  else if (n->balltype_i_ == 0) 
+    {
        whole_l_arr_.push (n);
        return;
-    } else{
+    }
+  else
+    {
        head_l_arr_.push (n);
     }
 }
@@ -110,7 +115,7 @@ Stem::add (Note_head *n)
 bool
 Stem::invisible_b()const
 {
-    return !head_l_arr_.size();
+  return !head_l_arr_.size();
 }
 
 // if dir_i_ is set we return fake values.
@@ -118,32 +123,32 @@ Stem::invisible_b()const
 int
 Stem::get_center_distance_from_top()
 {
-    if (dir_i_)
+  if (dir_i_)
        return (dir_i_ > 0) ? 0 : 1;
 
-    int staff_center = staff_size_i_ / 2;
-    int max = max_head_i() - staff_center;
-    return max >? 0;
+  int staff_center = staff_size_i_ / 2;
+  int max = max_head_i() - staff_center;
+  return max >? 0;
 }
 
 // if dir_i_ is set we return fake values.
 int
 Stem::get_center_distance_from_bottom()
 {
-    if (dir_i_)
+  if (dir_i_)
        return (dir_i_ > 0) ? 1 : 0;
 
-    int staff_center = staff_size_i_ / 2;
-    int min = staff_center - min_head_i();
-    return min >? 0;
+  int staff_center = staff_size_i_ / 2;
+  int min = staff_center - min_head_i();
+  return min >? 0;
 }
 
 int
 Stem::get_default_dir()
 {
-    if (dir_i_)
+  if (dir_i_)
        return dir_i_;
-    return (get_center_distance_from_top() >=
+  return (get_center_distance_from_top() >=
        get_center_distance_from_bottom()) ? -1 : 1;
 }
 
@@ -151,21 +156,24 @@ Stem::get_default_dir()
 void
 Stem::set_default_dir()
 {
-    dir_i_ = get_default_dir();
+  dir_i_ = get_default_dir();
 }
 
 void
 Stem::set_default_stemlen()
 {
-    if (!dir_i_)
+  if (!dir_i_)
        set_default_dir();
 
-    
-    // ugh... how about non 5-line staffs?
-    if ((max_head_i() < -2 && dir_i_ == 1)
-       ||(min_head_i() > staff_size_i_ && dir_i_ == -1)){
+  
+  // ugh... how about non 5-line staffs?
+  if ((max_head_i() < -2 && dir_i_ == 1)
+       ||(min_head_i() > staff_size_i_ && dir_i_ == -1))
+         {
        set_stemend (staff_size_i_ /2 -1);
-    } else {
+    }
+  else 
+    {
        set_stemend ((dir_i_ > 0) ? max_head_i() + STEMLEN : 
                                     min_head_i() - STEMLEN);
 
@@ -176,14 +184,15 @@ Stem::set_default_stemlen()
 void
 Stem::set_default_extents()
 {
-    if (!stem_length_f())
+  if (!stem_length_f())
        set_default_stemlen();
 
-    set_stemend ((dir_i_< 0) ? 
+  set_stemend ((dir_i_< 0) ? 
                max_head_i()-stem_length_f (): min_head_i () +stem_length_f ());
-    if (dir_i_ > 0){   
+  if (dir_i_ > 0){     
        stem_xoffset_f_ = paper()->note_width ()-paper ()->rule_thickness ();
-    } else
+    }
+  else
        stem_xoffset_f_ = 0;
 }
 
@@ -196,24 +205,27 @@ Stem::set_default_extents()
 void
 Stem::set_noteheads()
 {
-    if (!head_l_arr_.size())
+  if (!head_l_arr_.size())
        return;
-    head_l_arr_.sort (Note_head::compare);
-    if (dir_i_ < 0) 
+  head_l_arr_.sort (Note_head::compare);
+  if (dir_i_ < 0) 
        head_l_arr_.reverse();
-    
-    head_l_arr_[0]->extremal_i_ = -1;
-    head_l_arr_.top()->extremal_i_ = 1;
-    int parity=1;
-    int lastpos = head_l_arr_[0]->position_i_;
-    for (int i=1; i < head_l_arr_.size(); i ++) {
+  
+  head_l_arr_[0]->extremal_i_ = -1;
+  head_l_arr_.top()->extremal_i_ = 1;
+  int parity=1;
+  int lastpos = head_l_arr_[0]->position_i_;
+  for (int i=1; i < head_l_arr_.size(); i ++) 
+    {
        int dy =abs (lastpos- head_l_arr_[i]->position_i_);
        
-       if (dy <= 1) {
+       if (dy <= 1) 
+         {
            if (parity)
                head_l_arr_[i]->x_dir_i_ = (stem_xoffset_f_>0) ? 1:-1;
            parity = !parity;
-       } else
+         }
+       else
            parity = 0;
        lastpos = head_l_arr_[i]->position_i_;
     }
@@ -222,71 +234,75 @@ Stem::set_noteheads()
 void
 Stem::do_pre_processing()
 {
-    if (stem_bottom_f_== stem_top_f_)
+  if (stem_bottom_f_== stem_top_f_)
        set_default_extents();
-    set_noteheads();
-    flag_i_ = dir_i_*abs (flag_i_);
-    transparent_b_ = invisible_b();
-    empty_b_ = invisible_b();
+  set_noteheads();
+  flag_i_ = dir_i_*abs (flag_i_);
+  transparent_b_ = invisible_b();
+  empty_b_ = invisible_b();
 }
 
 
 Interval
 Stem::do_width()const
 {
-    if (!print_flag_b_ || abs (flag_i_) <= 4)
+  if (!print_flag_b_ || abs (flag_i_) <= 4)
        return Interval (0,0);  // TODO!
-    Paper_def*p= paper();
-    Interval r (p->lookup_l()->flag (flag_i_).dim.x ());
-    r+= stem_xoffset_f_;
-    return r;
+  Paper_def*p= paper();
+  Interval r (p->lookup_l()->flag (flag_i_).dim.x ());
+  r+= stem_xoffset_f_;
+  return r;
 }
 
 Molecule*
 Stem::brew_molecule_p()const 
 {
-    Molecule *out =0;
-        
-    Real bot  = stem_bottom_f_;
-    Real top = stem_top_f_;
-    
-    assert (bot!=top);
+  Molecule *out =0;
+      
+  Real bot  = stem_bottom_f_;
+  Real top = stem_top_f_;
+  
+  assert (bot!=top);
  
-    Paper_def *p =paper();
+  Paper_def *p =paper();
 
-    Real dy = p->internote_f();
-    Symbol ss =p->lookup_l()->stem (bot*dy,top*dy);
+  Real dy = p->internote_f();
+  Symbol ss =p->lookup_l()->stem (bot*dy,top*dy);
 
-    out = new Molecule (Atom (ss));
+  out = new Molecule (Atom (ss));
 
-    if (print_flag_b_&&abs (flag_i_) > 4){
+  if (print_flag_b_&&abs (flag_i_) > 4)
+    {
        Symbol fl = p->lookup_l()->flag (flag_i_);
        Molecule m (fl);
        if (flag_i_ < -4){              
            out->add_bottom (m);
-       } else if (flag_i_ > 4) {
+         }
+       else if (flag_i_ > 4) 
+         {
            out->add_top (m);
-       } else
+         }
+       else
            assert (false); 
     }
 
-    out->translate (stem_xoffset_f_, X_AXIS);
-    return out;
+  out->translate (stem_xoffset_f_, X_AXIS);
+  return out;
 }
 
 Real
 Stem::hpos_f()const
 {
-    return Item::hpos_f() + stem_xoffset_f_;
+  return Item::hpos_f() + stem_xoffset_f_;
 }
 
 
 void
 Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    Item * o_l = o->item();
-    Item * n_l = n? n->item():0;
-    whole_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
-    head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
-    rest_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
+  Item * o_l = o->item();
+  Item * n_l = n? n->item():0;
+  whole_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
+  head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
+  rest_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
 }
index 5ca4a6c9c3af2484e8e5794a33380ba4b75299ba..7ee2db3b9af5dc8c1761801dda60f28cb21aa52d 100644 (file)
 String
 Super_elem::TeX_string()const
 {
-    String s;
-    for (int i=0; i < lines_arr_.size(); i++){
+  String s;
+  for (int i=0; i < lines_arr_.size(); i++)
+    {
        s += lines_arr_[i]->TeX_string();
        if (i + 1<lines_arr_.size())
            s += "\\interscoreline"; // TODO
     }
-    return s;
+  return s;
 }
 
 void
 Super_elem::handle_broken_dependencies()
 {
-    lines_arr_ = line_of_score_l_->get_lines();
-    for (int i =0; i < lines_arr_.size(); i++) 
+  lines_arr_ = line_of_score_l_->get_lines();
+  for (int i =0; i < lines_arr_.size(); i++) 
        add_dependency (lines_arr_[i]);
 }
-    
+  
 
 void
 Super_elem::do_substitute_dependency (Score_elem*o,Score_elem* n)
 {
-    if (line_of_score_l_ == o->spanner())
+  if (line_of_score_l_ == o->spanner())
        line_of_score_l_ = n?(Line_of_score*)n->spanner():0;
 }
 
 Super_elem::Super_elem()
 {
-    line_of_score_l_ = new Line_of_score ;
+  line_of_score_l_ = new Line_of_score ;
 }
 
 void
 Super_elem::do_add_processing()
 {
-    pscore_l_->typeset_unbroken_spanner (line_of_score_l_);
-    add_dependency (line_of_score_l_);
+  pscore_l_->typeset_unbroken_spanner (line_of_score_l_);
+  add_dependency (line_of_score_l_);
 }
 
 
index 385cd55c449a246d3f50b84abdadbe8930a4fcce..84de4871b50a1e965d99fe3b6aaf751a842ecb9a 100644 (file)
@@ -15,5 +15,5 @@ ADD_THIS_ENGRAVER(Swallow_engraver);
 bool
 Swallow_engraver::do_try_request (Request*) 
 {
-    return true;
+  return true;
 }
index a4c95b304ee500a2673a23944652e1a33c8c1908..2f7834b89cef24a205073c9074a25496d26d088d 100644 (file)
@@ -3,19 +3,19 @@
 
 
 Symbol::Symbol()
-    :    dim (Interval (0,0),Interval (0,0))
+  :    dim (Interval (0,0),Interval (0,0))
 {
-    tex = "\\unknown";
+  tex = "\\unknown";
 }
 Symbol::Symbol (String s, Box b)
-    :  dim (b)
+  :  dim (b)
 {
-    tex = s;
+  tex = s;
 }
 
 
 String
 Symbol::str()const 
 {
-    return  "symbol (\'"+tex+"\', (" + dim.x().str () + ", " + dim.y ().str () + "))";
+  return  "symbol (\'"+tex+"\', (" + dim.x().str () + ", " + dim.y ().str () + "))";
 }
index 35f4c4166e7d950fa486c595a84ff26f6a374064..92ef19852f66496c41bc5f7ede37991dfbe5cb98 100644 (file)
@@ -21,14 +21,16 @@ Symtables::Symtables()
 
 Symtables::Symtables (Symtables const &s)
 {
-    for (Assoc_iter<String, Symtable*>  i (s); i.ok(); i++) {
+  for (Assoc_iter<String, Symtable*>  i (s); i.ok(); i++) 
+    {
        add (i.key(), new Symtable (*i.val ()));
     }
 }
 
 Symtables::~Symtables()
 {
-    for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++) {
+  for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++) 
+    {
        delete i.val();
     }
 }
@@ -36,9 +38,10 @@ Symtables::~Symtables()
 Symbol 
 Symtable::lookup (String s) const
 {
-    if (elt_b (s))
+  if (elt_b (s))
        return (*this)[s];
-    else {
+  else 
+    {
        warning ("Symtable `" + id_str+ "\': unknown symbol `" +s+"'\n");
        Symbol sy;      
        return sy;
@@ -48,12 +51,13 @@ Symtable::lookup (String s) const
 Symtable* 
 Symtables::operator()(String s) 
 {
-    return Assoc<String, Symtable*>::operator[](s);
+  return Assoc<String, Symtable*>::operator[](s);
 } 
 void
 Symtables::print() const
 {
-    for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++) {
+  for (Assoc_iter<String, Symtable*>  i (*this); i.ok(); i++) 
+    {
        DOUT << "table \'" << i.key() << "\' {\n";
        i.val()->print ();
        DOUT << "}\n";
@@ -62,7 +66,8 @@ Symtables::print() const
 void
 Symtable::print() const
 {
-    for (Assoc_iter<String, Symbol>  i (*this); i.ok(); i++) {
+  for (Assoc_iter<String, Symbol>  i (*this); i.ok(); i++) 
+    {
        DOUT << "\'" << i.key() << "\'->" << i.val ().str () << "\n";
     }
 }
@@ -70,6 +75,6 @@ Symtable::print() const
 void
 Symtables::add (String s, Symtable*p)
 {
-    p-> id_str = s;
-    Assoc<String, Symtable*>::add (s,p);
+  p-> id_str = s;
+  Assoc<String, Symtable*>::add (s,p);
 }
index bf7523d7d85b690aeed66ffd7c3fe0a8f6e8730e..d038d3d31c719206c0a6cbb16603fe96acaeeb69 100644 (file)
@@ -20,11 +20,11 @@ template INTERVAL__INSTANTIATE(int);
 Rational
 Interval_t<Rational>::infinity()
 {
-    return Rational (INT_MAX);
+  return Rational (INT_MAX);
 }
 
 int
 Interval_t<int>::infinity()
 {
-    return INT_MAX;
+  return INT_MAX;
 }
index 6f835e204a56db5fdd5c13afb929820469094290..f20ded05e4c4b27fe30fd781c2d0001cc488a499 100644 (file)
 Symbol
 Lookup::beam_element (int sidx, int widx, Real slope) const
 {
-    Symbol bs=(*symtables_)("beamslopes")->lookup ("slope");
-    
-    Array<String> args;
-    args.push (sidx);
-    args.push (widx);
-    bs.tex = substitute_args (bs.tex,args);
-    int w = 2 << widx;
-    Real width = w PT;
-    bs.dim.x() = Interval (0,width);
-    bs.dim.y() = Interval (0,width*slope);
-    return bs;
+  Symbol bs=(*symtables_)("beamslopes")->lookup ("slope");
+  
+  Array<String> args;
+  args.push (sidx);
+  args.push (widx);
+  bs.tex = substitute_args (bs.tex,args);
+  int w = 2 << widx;
+  Real width = w PT;
+  bs.dim.x() = Interval (0,width);
+  bs.dim.y() = Interval (0,width*slope);
+  return bs;
 }
 
 // ugh.. hard wired tex-code.
 static int
 slope_index (Real &s)
 {
-    if (abs (s) > 0.5) {
+  if (abs (s) > 0.5) 
+    {
        WARN << "beam steeper than 0.5 (" << s << ")\n";
        s = sign (s) * 0.5;
     }
 
-    int i = int (rint (s *  20.0));
+  int i = int (rint (s *  20.0));
 
-    s = i/20.0;
-    if (s>0)
+  s = i/20.0;
+  if (s>0)
        return 6*i +122;
-    else
+  else
        return -6 * i+ 186;
 }
 
 Symbol
 Lookup::rule_symbol (Real height, Real width) const
 {
-    Symbol bs=(*symtables_)("beamslopes")->lookup ("horizontal");    
-    Array<String> args;
-    args.push (print_dimen (height));
-    args.push (print_dimen (width));
-    bs.tex = substitute_args (bs.tex,args);
-    bs.dim.x() = Interval (0,width);
-    bs.dim.y() = Interval (0,height);
-    return bs;
+  Symbol bs=(*symtables_)("beamslopes")->lookup ("horizontal");    
+  Array<String> args;
+  args.push (print_dimen (height));
+  args.push (print_dimen (width));
+  bs.tex = substitute_args (bs.tex,args);
+  bs.dim.x() = Interval (0,width);
+  bs.dim.y() = Interval (0,height);
+  return bs;
 }
 
 Symbol
 Lookup::beam (Real &slope, Real width) const
 {        
-    int sidx = slope_index (slope);
-    if (!slope)
+  int sidx = slope_index (slope);
+  if (!slope)
        return rule_symbol (2 PT, width);
-    if (width < 2 PT) {
+  if (width < 2 PT) 
+    {
        WARN<<"Beam too narrow. (" << print_dimen (width) <<")\n";
        width = 2 PT;
     }
-    Real elemwidth = 64 PT;
-    int widx = 5;
+  Real elemwidth = 64 PT;
+  int widx = 5;
 
-    Molecule m;
-    
-    while (elemwidth > width) {
+  Molecule m;
+  
+  while (elemwidth > width) 
+    {
        widx --;
        elemwidth /= 2.0;
     }
-    Real overlap = elemwidth/4;
-    Real last_x = width - elemwidth;
-    Real x = overlap;
-    Atom elem (beam_element (sidx, widx, slope));
-    Atom a (elem);
-    m.add (a);
-    while (x < last_x) {
+  Real overlap = elemwidth/4;
+  Real last_x = width - elemwidth;
+  Real x = overlap;
+  Atom elem (beam_element (sidx, widx, slope));
+  Atom a (elem);
+  m.add (a);
+  while (x < last_x) 
+    {
        a=elem;
        a.translate (Offset (x-overlap, (x-overlap)*slope));
        m.add (a);
        x += elemwidth - overlap;
     }
-    a=elem;
-    a.translate (Offset (last_x, (last_x) * slope));
-    m.add (a);
-    
-    Symbol ret;
-    ret.tex = m.TeX_string();
-    ret.dim.y() = Interval (0,width*slope);
-    ret.dim.x() = Interval (0,width);
-    
-    return ret;
+  a=elem;
+  a.translate (Offset (last_x, (last_x) * slope));
+  m.add (a);
+  
+  Symbol ret;
+  ret.tex = m.TeX_string();
+  ret.dim.y() = Interval (0,width*slope);
+  ret.dim.x() = Interval (0,width);
+  
+  return ret;
 }
 
 
index a8d30583c7b2b73a2824fcac4e7a8e39acdd4af1..b494ec5c1a813601b20f34cfe149da86723b30ae 100644 (file)
 static
 char direction_char (int y_sign)
 {
-    char c='#';
-    switch (y_sign){
-    case -1:
+  char c='#';
+  switch (y_sign)
+    {
+  case -1:
        c = 'd';
        break;
-    case 0:
+  case 0:
        c = 'h';
        break;
-    case 1:
+  case 1:
        c = 'u';
        break;
-    default:
+  default:
        assert (false);
     }
-    return c;
+  return c;
 }
 
 Symbol
 Lookup::half_slur_middlepart (Real &dx, int dir) const
 {
-    if (dx >= 400 PT) {// todo
+  if (dx >= 400 PT) {// todo
        WARN<<"halfslur too large" <<print_dimen (dx)<< "shrinking (ugh)\n";
        dx = 400 PT;
     }
-    int widx = int (floor (dx / 4.0));
-    dx = widx * 4.0;
-    if (widx) widx --;
-    else {
+  int widx = int (floor (dx / 4.0));
+  dx = widx * 4.0;
+  if (widx) widx --;
+  else 
+    {
        WARN <<  "slur too narrow\n";
     }
 
-    Symbol s;
-    
-    s.dim.y() = Interval (min (0,0), max (0,0)); // todo
-    s.dim.x() = Interval (0,dx);
+  Symbol s;
+  
+  s.dim.y() = Interval (min (0,0), max (0,0)); // todo
+  s.dim.x() = Interval (0,dx);
 
-    String f =  String ("\\hslurchar");
-    f += direction_char (0);
+  String f =  String ("\\hslurchar");
+  f += direction_char (0);
 
-    int idx = widx;
-    if (dir < 0)
+  int idx = widx;
+  if (dir < 0)
        idx += 128;
 
-    assert (idx < 256);
+  assert (idx < 256);
 
-    f+=String ("{") + String (idx ) + "}";
-    s.tex = f;
-    Atom a (s);
-    a.translate (dx/2, X_AXIS);
-    s.tex = a.TeX_string();
+  f+=String ("{") + String (idx ) + "}";
+  s.tex = f;
+  Atom a (s);
+  a.translate (dx/2, X_AXIS);
+  s.tex = a.TeX_string();
 
-    return s;
+  return s;
 }
 Symbol
 Lookup::half_slur (int dy, Real &dx, int dir, int xpart) const
 {
-    Real orig_dx = dx;
-    if (!xpart)
+  Real orig_dx = dx;
+  if (!xpart)
        return half_slur_middlepart (dx, dir);
 
-    int widx;
-               
-    if (dx >= 96 PT) {
+  int widx;
+               
+  if (dx >= 96 PT) 
+    {
        WARN << "Slur half too wide." << print_dimen (orig_dx) << " shrinking (ugh)\n";
        dx =  96 PT;
     }
 
-    widx = int (rint (dx/12.0));
-    dx = widx*12.0;
-    if (widx)
+  widx = int (rint (dx/12.0));
+  dx = widx*12.0;
+  if (widx)
        widx --;
-    else {
+  else 
+    {
        WARN <<  "slur too narrow " << print_dimen (orig_dx)<<"\n";
     }
        
-    Symbol s;
-    s.dim.x() = Interval (0,dx);
-    s.dim.y() = Interval (min (0,dy), max (0,dy));
+  Symbol s;
+  s.dim.x() = Interval (0,dx);
+  s.dim.y() = Interval (min (0,dy), max (0,dy));
 
 
-    String f = String ("\\hslurchar");
+  String f = String ("\\hslurchar");
 
-    f+= direction_char (dir);
+  f+= direction_char (dir);
 
-    int hidx = dy;
-    if (hidx <0)
+  int hidx = dy;
+  if (hidx <0)
        hidx = -hidx;
-    hidx --;
-    int idx =-1;
+  hidx --;
+  int idx =-1;
 
-    idx = widx * 16 + hidx;
-    if (xpart < 0)
+  idx = widx * 16 + hidx;
+  if (xpart < 0)
        idx += 128;
-    
-    assert (idx < 256);
-    f+=String ("{") + String (idx ) + "}";
+  
+  assert (idx < 256);
+  f+=String ("{") + String (idx ) + "}";
 
-    
-    s.tex = f;
+  
+  s.tex = f;
  
-    return s;
+  return s;
 }
 
 Symbol
 Lookup::slur (int dy , Real &dx, int dir) const
 {
-    assert (dx >=0 && abs (dir) <= 1);
-    int y_sign = sign (dy);
+  assert (dx >=0 && abs (dir) <= 1);
+  int y_sign = sign (dy);
 
-    bool large = abs (dy) > 8;
+  bool large = abs (dy) > 8;
 
-    if (y_sign) {
+  if (y_sign) 
+    {
        large |= dx>= 4*16 PT;
-    } else
+    }
+  else
        large |= dx>= 4*54 PT;
-    
-    if (large) {
+  
+  if (large) 
+    {
        return big_slur (dy, dx, dir);
     }
-    Real orig_dx = dx;
-    int widx = int (floor (dx/4.0)); // slurs better too small..
-    dx = 4.0 * widx;
-    if (widx)
+  Real orig_dx = dx;
+  int widx = int (floor (dx/4.0)); // slurs better too small..
+  dx = 4.0 * widx;
+  if (widx)
        widx --;
-    else {
+  else 
+    {
        WARN <<  "slur too narrow: " << print_dimen (orig_dx) << "\n";
     }
 
-    int hidx = dy;
-    if (hidx <0)
+  int hidx = dy;
+  if (hidx <0)
        hidx = -hidx;
-    hidx --; 
-    if (hidx > 8) {
+  hidx --; 
+  if (hidx > 8) 
+    {
        WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
     }
-    
-    Symbol s;
-    s.dim.x() = Interval (0,dx);
-    s.dim.y() = Interval (min (0,dy), max (0,dy));
+  
+  Symbol s;
+  s.dim.x() = Interval (0,dx);
+  s.dim.y() = Interval (min (0,dy), max (0,dy));
 
-    String f = String ("\\slurchar") + String (direction_char (y_sign));
+  String f = String ("\\slurchar") + String (direction_char (y_sign));
 
-    int idx=-1;
-    if (y_sign) {      
+  int idx=-1;
+  if (y_sign) {        
        idx = hidx * 16 + widx;
        if (dir < 0)
            idx += 128;
-    } else {
-       if (dx >= 4*54 PT) {
+    }
+  else 
+    {
+       if (dx >= 4*54 PT) 
+         {
            WARN << "slur too wide: " << print_dimen (dx) <<
                " shrinking (ugh)\n";
            dx = 4*54 PT;
-       }
+         }
        idx = widx;
        if (dir < 0)
            idx += 54;          
     }
-    
-    assert (idx < 256);
-    f+=String ("{") + String (idx ) + "}";
-    s.tex = f;
-
-    Atom a (s);
-    a.translate (dx/2, X_AXIS);
-    s.dim = a.extent();
-    s.tex = a.TeX_string();
-    return s;    
+  
+  assert (idx < 256);
+  f+=String ("{") + String (idx ) + "}";
+  s.tex = f;
+
+  Atom a (s);
+  a.translate (dx/2, X_AXIS);
+  s.dim = a.extent();
+  s.tex = a.TeX_string();
+  return s;    
 }
 
 Symbol
 Lookup::big_slur (int dy , Real &dx, int dir) const
 {
-    assert (dx >= 24 PT);
-    Real slur_extra =abs (dy)  /2.0 + 2; 
-    int l_dy = int (Real (dy)/2 + slur_extra*dir);
-    int r_dy =  dy - l_dy;
-
-    Real internote_f = paper_l_->internote_f();
-    Real left_wid = dx/4.0;
-    Real right_wid = left_wid;
-
-    Atom l = half_slur (l_dy, left_wid, dir, -1);
-    Atom r = half_slur (r_dy, right_wid, dir, 1);
-    Real mid_wid = dx - left_wid - right_wid;
-
-    Atom m = half_slur (0, mid_wid, dir, 0);
-
-    Molecule mol;
-    mol.add (l);
-    Atom a (m);
-    a.translate (slur_extra * internote_f, Y_AXIS);
-    mol.add_right (m);
-    mol.add_right (r);
-    mol.translate (l_dy * internote_f, Y_AXIS);
-    Symbol s;
-    s.tex = mol.TeX_string();
-    s.dim = mol.extent();
-    return s;
+  assert (dx >= 24 PT);
+  Real slur_extra =abs (dy)  /2.0 + 2; 
+  int l_dy = int (Real (dy)/2 + slur_extra*dir);
+  int r_dy =  dy - l_dy;
+
+  Real internote_f = paper_l_->internote_f();
+  Real left_wid = dx/4.0;
+  Real right_wid = left_wid;
+
+  Atom l = half_slur (l_dy, left_wid, dir, -1);
+  Atom r = half_slur (r_dy, right_wid, dir, 1);
+  Real mid_wid = dx - left_wid - right_wid;
+
+  Atom m = half_slur (0, mid_wid, dir, 0);
+
+  Molecule mol;
+  mol.add (l);
+  Atom a (m);
+  a.translate (slur_extra * internote_f, Y_AXIS);
+  mol.add_right (m);
+  mol.add_right (r);
+  mol.translate (l_dy * internote_f, Y_AXIS);
+  Symbol s;
+  s.tex = mol.TeX_string();
+  s.dim = mol.extent();
+  return s;
 }
 
 
index ee08205c10c5d3252c6f03831f5846b66c0a6f60..a9d826c3c77b522e91793dc7e95037a67c551b9b 100644 (file)
@@ -24,42 +24,45 @@ const int MAXLINELEN = 200;
 
 Tex_stream::Tex_stream (String filename) 
 {
-    os = new ofstream (filename);
-    if (!*os)
+  os = new ofstream (filename);
+  if (!*os)
        error ("can't open `" + filename+"\'");
-    nest_level = 0;
-    line_len_i_ = 0;
-    outputting_comment=false;
-    header();
+  nest_level = 0;
+  line_len_i_ = 0;
+  outputting_comment=false;
+  header();
 }
 void
 Tex_stream::header()
 {
-    *os << "% Creator: " << get_version_str() << "\n";
-    *os << "% Automatically generated, at ";
-    time_t t (time (0));
-    *os << ctime (&t)<<"\n";
+  *os << "% Creator: " << get_version_str() << "\n";
+  *os << "% Automatically generated, at ";
+  time_t t (time (0));
+  *os << ctime (&t)<<"\n";
 }
 Tex_stream::~Tex_stream()
 {
-    delete os;
-    assert (nest_level == 0);
+  delete os;
+  assert (nest_level == 0);
 }
 
 // print string. don't forget indent.
 Tex_stream &
 Tex_stream::operator<<(String s)
 {
-    
-    for (char const *cp = s; *cp; cp++) {
-       if (outputting_comment) {
+  
+  for (char const *cp = s; *cp; cp++) 
+    {
+       if (outputting_comment) 
+         {
            *os << *cp;
-           if (*cp == '\n') {
+           if (*cp == '\n') 
+             {
                outputting_comment=false;
 
-           }
+             }
            continue;
-       }
+         }
        line_len_i_ ++;
        switch (*cp) 
            {
@@ -75,10 +78,11 @@ Tex_stream::operator<<(String s)
                nest_level--;           
                *os << *cp;
                
-               if (nest_level < 0) {
+               if (nest_level < 0) 
+                 {
                    delete os;  // we want to see the remains.
                    assert (nest_level>=0);
-               }
+                 }
                /* FALLTHROUGH */
                
            case '\n':
@@ -93,17 +97,17 @@ Tex_stream::operator<<(String s)
            default:
                *os << *cp;
                break;
-           }
+             }
     }
-    return *this;
+  return *this;
 }
 
 void
 Tex_stream::break_line()
 {
-    *os << "%\n";
-    *os << String (' ', nest_level);
-    line_len_i_ = 0;
+  *os << "%\n";
+  *os << String (' ', nest_level);
+  line_len_i_ = 0;
 }
 
 /* *************************************************************** */
index 6e5e987f5daa5f9d3a98c42472ba6337c2a66bc4..fb0348a05127d3dbd118462d53de17b9dfad6d4f 100644 (file)
 String
 vstrut (Real h)
 {
-    return String ("\\vrule height ") + print_dimen (h) + "depth 0pt width 0pt";
+  return String ("\\vrule height ") + print_dimen (h) + "depth 0pt width 0pt";
 }
 
 
 static void
 substitute_arg (String& r, String arg)
 {
-    int p = r.index_i ('%');
-    if (p < 0)
+  int p = r.index_i ('%');
+  if (p < 0)
        return ;
 
-    r = r.left_str (p) + arg + r.right_str (r.length_i() - p -1);
+  r = r.left_str (p) + arg + r.right_str (r.length_i() - p -1);
 }
 
 
 String
 substitute_args (String source, Array<String> args)    
 {
-    String retval (source);
-    for (int i = 0 ; i < args.size(); i++)
-        substitute_arg (retval, args[i]);
-    /*
-    while (retval.index_i ('%') >= 0)
-        substitute_arg (retval, "");
+  String retval (source);
+  for (int i = 0 ; i < args.size(); i++)
+      substitute_arg (retval, args[i]);
+  /*
+  while (retval.index_i ('%') >= 0)
+      substitute_arg (retval, "");
        */
-    return retval;
+  return retval;
 }
 
 String
 substitute_args (String source, Array<Scalar> args)    
 {
-    Array<String> sv;
-    for (int i = 0 ; i < args.size(); i++)
+  Array<String> sv;
+  for (int i = 0 ; i < args.size(); i++)
        sv.push (args[i]);
-    
-    return substitute_args (source, sv);
+  
+  return substitute_args (source, sv);
 }
index e0de0eb79bb25ca334eb3c4a3d6b6dcd8bfcc97f..a2ce8730cfcc34fe19622133413892cb05ad65d0 100644 (file)
 Interval
 Text_def::width (Paper_def * p) const
 {
-    Atom a = get_atom (p,0);
+  Atom a = get_atom (p,0);
 
-    Real guess_width_f = text_str_.length_i() * a.sym_.dim.x ().length (); // ugh
-    Interval i (0, guess_width_f);
-    i += - (align_i_ + 1)* i.center();
-    return i;
+  Real guess_width_f = text_str_.length_i() * a.sym_.dim.x ().length (); // ugh
+  Interval i (0, guess_width_f);
+  i += - (align_i_ + 1)* i.center();
+  return i;
 }
 
 void
 Text_def::do_print() const
 {
 #ifndef NPRINT
-    DOUT << "align " <<align_i_ << " `" << text_str_ << "'";
+  DOUT << "align " <<align_i_ << " `" << text_str_ << "'";
 #endif
 }
 
 Text_def::Text_def()
 {   
-    align_i_ = 1;                      // right
-    style_str_ = "roman";
+  align_i_ = 1;                        // right
+  style_str_ = "roman";
 }
 
 bool
 Text_def::do_equal_b (General_script_def const *gdef) const
 {
-    Text_def const *def= (Text_def*)gdef;
-    return align_i_ == def->align_i_ && text_str_ == def->text_str_
+  Text_def const *def= (Text_def*)gdef;
+  return align_i_ == def->align_i_ && text_str_ == def->text_str_
        && style_str_ == def->style_str_;
 }
 
 Atom
 Text_def::get_atom (Paper_def *p, int) const
 {
-    return p->lookup_l()->text (style_str_, text_str_, -align_i_);
+  return p->lookup_l()->text (style_str_, text_str_, -align_i_);
 }
 
 void
 Text_def::print() const
 {
-    DOUT << "Text `" << text_str_ << "\', style " <<
+  DOUT << "Text `" << text_str_ << "\', style " <<
        style_str_ << "align " << align_i_ << '\n';
 }
 
index 3165fc87a9f59f227fe88adf8ce5274e24ad73ef..4abff4f444709795bb68acea100190593e2fbb3d 100644 (file)
 
 Text_engraver::Text_engraver()
 {
-    text_p_ = 0;
-    dir_i_ =0;
-    do_post_move_processing();
+  text_p_ = 0;
+  dir_i_ =0;
+  do_post_move_processing();
 }
 
 bool
 Text_engraver::do_try_request (Request*req_l)
 {
-    Musical_req *m = req_l->musical();
-    if (!m || ! m->text())
+  Musical_req *m = req_l->musical();
+  if (!m || ! m->text())
        return false;
-    if (text_req_l_ && text_req_l_->equal_b (m))
+  if (text_req_l_ && text_req_l_->equal_b (m))
        return false;
 
-    text_req_l_ = m->text();
-    return true;
+  text_req_l_ = m->text();
+  return true;
 }
 void
 Text_engraver::acknowledge_element (Score_elem_info i)
 {
-    if (text_p_ && i.elem_l_->name() == Note_column::static_name ()) {
+  if (text_p_ && i.elem_l_->name() == Note_column::static_name ()) 
+    {
        text_p_->add_support (i.elem_l_);
     }
 }
 void
 Text_engraver::do_process_requests()
 {
-    if (text_req_l_) {
+  if (text_req_l_) 
+    {
        text_p_ = new Text_item (text_req_l_->tdef_p_, text_req_l_->dir_i_); // ugh
        announce_element (Score_elem_info (text_p_, text_req_l_));
     }
@@ -47,7 +49,8 @@ Text_engraver::do_process_requests()
 void
 Text_engraver::do_pre_move_processing()
 {
-    if (text_p_) {
+  if (text_p_) 
+    {
        if (dir_i_ && !text_p_->dir_i_)
            text_p_->dir_i_ = dir_i_;
        Staff_symbol* s_l = get_staff_info().staff_sym_l_;
@@ -60,13 +63,13 @@ Text_engraver::do_pre_move_processing()
 void
 Text_engraver::set_feature (Feature i)
 {
-    if (i.type_ == "vdir")     
+  if (i.type_ == "vdir")       
        dir_i_ = i.value_;
 }
 void
 Text_engraver::do_post_move_processing()
 {
-    text_req_l_ = 0;
+  text_req_l_ = 0;
 }
 
 IMPLEMENT_IS_TYPE_B1(Text_engraver,Engraver);
index 951976a16af7b8282823b301e014066a7bc5ec94..db87a8d152c7fc6e6365df5382ab9fa8ee4ff03d 100644 (file)
 
 Text_item::Text_item (General_script_def*tdef_l, int d)
 {
-    dir_i_ = d;
-    fat_b_ = false;
-    tdef_p_ = tdef_l->clone();
+  dir_i_ = d;
+  fat_b_ = false;
+  tdef_p_ = tdef_l->clone();
 }
 
 Text_item::~Text_item()
 {
-    delete tdef_p_;
+  delete tdef_p_;
 }
 
 void
 Text_item::do_pre_processing()
 {
-    if (!dir_i_)
+  if (!dir_i_)
        dir_i_ = -1;
 }
 
 Interval
 Text_item::symbol_height()const
 {
-    return tdef_p_->get_atom (paper(), dir_i_).sym_.dim.y ();
+  return tdef_p_->get_atom (paper(), dir_i_).sym_.dim.y ();
 }
-    
+  
 Molecule*
 Text_item::brew_molecule_p() const
 {
-    Atom a (tdef_p_->get_atom (paper(), dir_i_));
+  Atom a (tdef_p_->get_atom (paper(), dir_i_));
 
 /*
   if ( fat_b_)
        a.sym.dim.x = tdef_p_->width (paper());
        */
-    Molecule* mol_p = new Molecule (a);
+  Molecule* mol_p = new Molecule (a);
 
-    if (dir_i_<0)              // should do something better anyway.
+  if (dir_i_<0)                // should do something better anyway.
        mol_p->translate (-mol_p->extent().y ().left , Y_AXIS);
-    mol_p->translate (pos_i_ * paper()->internote_f (), Y_AXIS);
-    
-    return mol_p;
+  mol_p->translate (pos_i_ * paper()->internote_f (), Y_AXIS);
+  
+  return mol_p;
 }
 
 
index 0e6226bf1f318ca37406b45d43a6ba7ec5e51ac2..1ab46bbb62936350febad8e53f16cf1b31d872e8 100644 (file)
 void
 Text_spanner::set_support (Directional_spanner*d)
 {
-    if (support_span_l_)
+  if (support_span_l_)
        remove_dependency (support_span_l_);
-    
-    support_span_l_ =d;
-    add_dependency (d);
+  
+  support_span_l_ =d;
+  add_dependency (d);
 }
 
 Text_spanner::Text_spanner()
 {
-    spec_p_ = 0;
-    support_span_l_ = 0;
+  spec_p_ = 0;
+  support_span_l_ = 0;
 }
 
 
@@ -37,58 +37,58 @@ IMPLEMENT_IS_TYPE_B1(Text_spanner,Spanner);
 void
 Text_spanner::do_print() const
 {
-    spec_p_->print();
+  spec_p_->print();
 }
 
 void
 Text_spanner::do_post_processing()
 {
-    text_off_ = support_span_l_->center() +
+  text_off_ = support_span_l_->center() +
        Offset (0,support_span_l_->dir_i_ * paper()->internote_f () * 4); // todo
 }
 
 Molecule*
 Text_spanner::brew_molecule_p() const
 {
-    Atom tsym (spec_p_->get_atom (paper(),0));
-    tsym.translate (text_off_);
+  Atom tsym (spec_p_->get_atom (paper(),0));
+  tsym.translate (text_off_);
 
-    Molecule*output = new Molecule;
-    output->add (tsym);
-    return output;
+  Molecule*output = new Molecule;
+  output->add (tsym);
+  return output;
 }
 
 void
 Text_spanner::do_pre_processing()
 {
-    right_col_l_ = support_span_l_->right_col_l_;
-    left_col_l_ = support_span_l_->left_col_l_;
-    assert (left_col_l_ && right_col_l_);
+  right_col_l_ = support_span_l_->right_col_l_;
+  left_col_l_ = support_span_l_->left_col_l_;
+  assert (left_col_l_ && right_col_l_);
 }
 
 Interval
 Text_spanner::height()const
 {
-    return brew_molecule_p()->extent ().y ();
+  return brew_molecule_p()->extent ().y ();
 }
 
 void
 Text_spanner::do_substitute_dependency (Score_elem* o, Score_elem*n)
 {
-    if (support_span_l_ == o) 
+  if (support_span_l_ == o) 
        support_span_l_ = (Directional_spanner*) (n?n->spanner():0);
 }
 
 
 Text_spanner::~Text_spanner()
 {
-    delete spec_p_;
+  delete spec_p_;
 }
 
 Text_spanner::Text_spanner (Text_spanner const&s)
-    : Spanner (s)
+  : Spanner (s)
 {
-    support_span_l_ = s.support_span_l_;
-    spec_p_ = s.spec_p_? s.spec_p_->clone() : 0;
-    text_off_ = s.text_off_;
+  support_span_l_ = s.support_span_l_;
+  spec_p_ = s.spec_p_? s.spec_p_->clone() : 0;
+  text_off_ = s.text_off_;
 }
index cbe5f35f7be216a155702364845f0cd4f54fae6b..660d1da9488fa05a8ec8c518e956e4e5c5876587 100644 (file)
 
 Tie_engraver::Tie_engraver()
 {
-    end_tie_p_ = 0;
-    tie_p_ = 0;
-    req_l_ =0;
-    end_req_l_ =0;
-    end_mom_ = -1;
-    melodic_req_l_ = 0;
-    end_melodic_req_l_ =0;
-    dir_i_ = 0;
+  end_tie_p_ = 0;
+  tie_p_ = 0;
+  req_l_ =0;
+  end_req_l_ =0;
+  end_mom_ = -1;
+  melodic_req_l_ = 0;
+  end_melodic_req_l_ =0;
+  dir_i_ = 0;
 }
 
 void
 Tie_engraver::sync_features()
 {
-    dir_i_ = get_feature ("vdir");
+  dir_i_ = get_feature ("vdir");
 }
-    
+  
 
 void
 Tie_engraver::do_post_move_processing()
 {
-    if (tie_p_ && get_staff_info().when () == end_mom_) {
+  if (tie_p_ && get_staff_info().when () == end_mom_) 
+    {
        end_tie_p_ = tie_p_;
        end_req_l_ = req_l_;
        end_melodic_req_l_ = melodic_req_l_;
@@ -47,27 +48,29 @@ Tie_engraver::do_post_move_processing()
 bool
 Tie_engraver::acceptable_request_b (Request*r)
 {
-    return r->musical() && r->musical ()->tie ();
+  return r->musical() && r->musical ()->tie ();
 }
 
 bool
 Tie_engraver::do_try_request (Request*r)
 {
-    if (!acceptable_request_b (r))
+  if (!acceptable_request_b (r))
        return false;
-    if (req_l_) {
+  if (req_l_) 
+    {
        return false;
     }
-    req_l_ = r->musical()->tie ();
-    end_mom_ = r->parent_music_l_->time_int().length ()
+  req_l_ = r->musical()->tie ();
+  end_mom_ = r->parent_music_l_->time_int().length ()
        + get_staff_info().when ();
-    return true;
+  return true;
 }
 
 void
 Tie_engraver::do_process_requests()
 {
-    if (req_l_ && ! tie_p_) {
+  if (req_l_ && ! tie_p_) 
+    {
        tie_p_ = new Tie;
     }
 }
@@ -75,25 +78,29 @@ Tie_engraver::do_process_requests()
 void
 Tie_engraver::acknowledge_element (Score_elem_info i)
 {
-    if (i.elem_l_->name() == Note_head::static_name ()) {
-       if (tie_p_) {
+  if (i.elem_l_->name() == Note_head::static_name ()) 
+    {
+       if (tie_p_) 
+         {
            tie_p_->set_head (-1, (Note_head*)i.elem_l_->item());
            melodic_req_l_ = i.req_l_->musical()->melodic ();
-       }
+         }
 
-       if (end_tie_p_) {
+       if (end_tie_p_) 
+         {
            end_tie_p_->set_head (1, (Note_head*)i.elem_l_->item());
            if (!Melodic_req::compare ( *end_melodic_req_l_, *melodic_req_l_))
                end_tie_p_->same_pitch_b_ = true;
            announce_element (Score_elem_info (end_tie_p_,end_req_l_));
-       }
+         }
     }
 }
 
 void
 Tie_engraver::do_pre_move_processing()
 {
-    if (end_tie_p_) {
+  if (end_tie_p_) 
+    {
        if (dir_i_)
            end_tie_p_->dir_i_ =  dir_i_;
        
@@ -106,7 +113,8 @@ Tie_engraver::do_pre_move_processing()
 
 Tie_engraver::~Tie_engraver()
 {
-    if (tie_p_) {
+  if (tie_p_) 
+    {
        req_l_->warning ("unended Tie");
        delete tie_p_;
     }
@@ -115,7 +123,7 @@ Tie_engraver::~Tie_engraver()
 void
 Tie_engraver::set_feature (Feature f)
 {
-    if (f.type_ == "vdir")
+  if (f.type_ == "vdir")
        dir_i_ = f.value_;
 }
 
index 5daf0614d7d70fb477c344a3b71d9152d541325b..ba7d75a3b8fcc523428a61eec775e122f1152bff 100644 (file)
 void
 Tie::set_head (int x_pos, Note_head * head_l)
 {
-    if (x_pos >0) {
+  if (x_pos >0) 
+    {
        assert (!right_head_l_);
        right_head_l_ = head_l;
-    } else {
+    }
+  else 
+    {
        assert (!left_head_l_);
        left_head_l_ = head_l;
     }
-    add_dependency (head_l);
+  add_dependency (head_l);
 }
 
 Tie::Tie()
 {
-    right_head_l_ =0;
-    left_head_l_ =0;
-    same_pitch_b_ =false;
+  right_head_l_ =0;
+  left_head_l_ =0;
+  same_pitch_b_ =false;
 }
 
 void
 Tie::set_default_dir()
 {
-    int m= (left_head_l_->position_i_ + right_head_l_->position_i_) /2 ;
-    dir_i_ =  (m < 5)? -1:1;                   // ugh
+  int m= (left_head_l_->position_i_ + right_head_l_->position_i_) /2 ;
+  dir_i_ =  (m < 5)? -1:1;                     // ugh
 }
-    
+  
 
 void
 Tie::do_add_processing()
 {
-    assert (left_head_l_ && right_head_l_);
-    left_col_l_ = left_head_l_ -> pcol_l_;
-    right_col_l_ = right_head_l_ -> pcol_l_;
+  assert (left_head_l_ && right_head_l_);
+  left_col_l_ = left_head_l_ -> pcol_l_;
+  right_col_l_ = right_head_l_ -> pcol_l_;
 }
 
 /**
@@ -54,27 +57,31 @@ Tie::do_add_processing()
 void
 Tie::do_post_processing()
 {
-    assert (left_head_l_ || right_head_l_);
-    left_pos_i_ =  (left_head_l_)? 
+  assert (left_head_l_ || right_head_l_);
+  left_pos_i_ =  (left_head_l_)? 
        left_head_l_->position_i_ : right_head_l_->position_i_;
-    right_pos_i_ = (right_head_l_) ? 
+  right_pos_i_ = (right_head_l_) ? 
        right_head_l_->position_i_ : left_head_l_->position_i_;
  
-    if ( right_head_l_ && right_head_l_->extremal_i_) {
+  if ( right_head_l_ && right_head_l_->extremal_i_) 
+    {
        right_pos_i_ += 2*dir_i_;
        right_dx_f_ -= 0.25;
-    } else
+    }
+  else
        right_dx_f_ -= 0.5;
 
-    if (left_head_l_ && left_head_l_->extremal_i_) {
+  if (left_head_l_ && left_head_l_->extremal_i_) 
+    {
        left_pos_i_ += 2*dir_i_;
        left_dx_f_ += 0.25;
-    } else
+    }
+  else
        left_dx_f_ += 0.5;
-    
-    if (!right_head_l_)
+  
+  if (!right_head_l_)
        right_pos_i_ = left_pos_i_;
-    if (! left_head_l_)
+  if (! left_head_l_)
        left_pos_i_ = right_pos_i_;
 }
 
@@ -83,10 +90,10 @@ Tie::do_post_processing()
 void
 Tie::do_substitute_dependency (Score_elem*o, Score_elem*n)
 {
-    Note_head *new_l =n?(Note_head*)n->item():0;
-    if (o->item() == left_head_l_)
+  Note_head *new_l =n?(Note_head*)n->item():0;
+  if (o->item() == left_head_l_)
        left_head_l_ = new_l;
-    else if (o->item() == right_head_l_)
+  else if (o->item() == right_head_l_)
        right_head_l_ = new_l;
 }
 
index dd8c5616d9c795d88ead91a2dd0300d46b87f734..b60d007ede28e403b3b1bdcf33e6ca4155b85591 100644 (file)
 String
 Time_description::str()const
 {
-    String s ("Time_description { ");
-    if (cadenza_b_)
+  String s ("Time_description { ");
+  if (cadenza_b_)
        s+=String (" (cadenza) ");
-    s+= "at ";
-    s+=when_;
-    s+="\nmeter " + String (whole_per_measure_/one_beat_) +":" +
+  s+= "at ";
+  s+=when_;
+  s+="\nmeter " + String (whole_per_measure_/one_beat_) +":" +
        String (Rational (Rational (1)/one_beat_));
-    s+= "\nposition "+String (bars_i_) + ":"+ whole_in_measure_ +"\n}\n";
-    return s;
+  s+= "\nposition "+String (bars_i_) + ":"+ whole_in_measure_ +"\n}\n";
+  return s;
 }
 
 void
 Time_description::print() const
 {
 #ifndef NPRINT
-    DOUT << str();
+  DOUT << str();
 #endif
 }
 void
 Time_description::OK() const
 {
 #ifndef NDEBUG
-    if (!cadenza_b_)
+  if (!cadenza_b_)
        assert (whole_in_measure_ < whole_per_measure_);
-    assert (Moment (0) <= whole_in_measure_);
-    assert (one_beat_);
+  assert (Moment (0) <= whole_in_measure_);
+  assert (one_beat_);
 #endif
 }
 
 void
 Time_description::set_cadenza (bool b)
 {
-    if (cadenza_b_ && !b) {
-       if (whole_in_measure_) {
+  if (cadenza_b_ && !b) 
+    {
+       if (whole_in_measure_) 
+         {
            bars_i_ ++;         // should do?
            whole_in_measure_ = 0;
-       }
+         }
     }
-    cadenza_b_ = b ;
+  cadenza_b_ = b ;
 }
 
 Time_description::Time_description()
 {
-    error_b_ =  false;
-    whole_per_measure_ = 1;
-    whole_in_measure_ =0;
-    one_beat_ = Moment (1,4);
-    when_ = 0;
-    bars_i_ = 0;
-    cadenza_b_ = false;
+  error_b_ =  false;
+  whole_per_measure_ = 1;
+  whole_in_measure_ =0;
+  one_beat_ = Moment (1,4);
+  when_ = 0;
+  bars_i_ = 0;
+  cadenza_b_ = false;
 }
 
 void
 Time_description::add (Moment dt)
 {
-    assert (dt >= Rational (0));
-    when_ +=  dt;
-    whole_in_measure_ += dt;
+  assert (dt >= Rational (0));
+  when_ +=  dt;
+  whole_in_measure_ += dt;
        
-    while ( !cadenza_b_ && whole_in_measure_ >= whole_per_measure_) {
+  while ( !cadenza_b_ && whole_in_measure_ >= whole_per_measure_) 
+    {
        whole_in_measure_ -= whole_per_measure_;
        bars_i_ ++;
     }
@@ -80,15 +83,15 @@ Time_description::add (Moment dt)
 void
 Time_description::set_meter (int l, int o)
 {
-    assert (o);
-    one_beat_ = Rational (1)/Moment (o);
-    whole_per_measure_ = Moment (l) * one_beat_;
+  assert (o);
+  one_beat_ = Rational (1)/Moment (o);
+  whole_per_measure_ = Moment (l) * one_beat_;
 }
 
 bool
 Time_description::allow_meter_change_b()
 {
-    return!(whole_in_measure_);
+  return!(whole_in_measure_);
 }
 
 /**
@@ -99,44 +102,45 @@ Time_description::allow_meter_change_b()
 String
 Time_description::try_set_partial_str (Moment p)const
 {
-    if (p<Rational (0))
+  if (p<Rational (0))
        return ("Partial must be non-negative");
-    if (p > whole_per_measure_)
+  if (p > whole_per_measure_)
        return ("Partial measure too large");
-    return "";
+  return "";
 }
 
 void
 Time_description::setpartial (Moment p)
 {
-    whole_in_measure_ = whole_per_measure_ - p;
+  whole_in_measure_ = whole_per_measure_ - p;
 }
 
 Moment
 Time_description::barleft()const
 {
-    assert (!cadenza_b_);
-    return whole_per_measure_-whole_in_measure_;
+  assert (!cadenza_b_);
+  return whole_per_measure_-whole_in_measure_;
 }
 
 int
 Time_description::compare (Time_description const &t1,  Time_description const&t2)
 {
-    int i = sign (t1.when_-t2.when_);
+  int i = sign (t1.when_-t2.when_);
 
-    if (!i) {
+  if (!i) 
+    {
        assert (t1.bars_i_==t2.bars_i_);
        assert (t1.one_beat_ == t2.one_beat_);
        assert (t1.whole_in_measure_ == t2.whole_in_measure_);
        assert (t1.whole_per_measure_ == t2.whole_per_measure_);
     }
 
-    return i;
+  return i;
 }
 
 Moment
 Time_description::next_bar_moment() const
 {
-    return when_ + barleft();
+  return when_ + barleft();
 }
 
index d86cf2c9bbb85c9b5128f9345ed52fefe9da6743..251c8065364562b16242cd7a87db3aa15a1ba1f5 100644 (file)
 
 Timing_engraver::Timing_engraver()
 {
-    default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh
+  default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh
 }
 
 void
 Timing_engraver::fill_staff_info (Staff_info &inf)
 {
-    inf.time_C_ = &time_;
-    inf.rhythmic_C_ = &default_grouping_;
+  inf.time_C_ = &time_;
+  inf.rhythmic_C_ = &default_grouping_;
 }
 
 
index eda6e50e0c0aa4e530fac718fc730d99ca84ba69..b902387529c5c0bd43db60d284304f3a3e580967 100644 (file)
@@ -10,7 +10,7 @@
 
 Translator::Translator()
 {
-    iterator_count_  = 0;
+  iterator_count_  = 0;
 }
 
 
@@ -19,7 +19,7 @@ IMPLEMENT_IS_TYPE_B(Translator);
 bool
 Translator::try_request (Request*)
 {
-    return false;
+  return false;
 }
 
 
index eed3e39ca8e7dcf751f356bd2cf95c94ec349f77..c219dfcd616d33b6d0a5197c92beda6a6d113cd9 100644 (file)
@@ -7,8 +7,8 @@ extern char const * lily_version_sz();
 String 
 get_version_str()
 {
-    String s = lily_version_sz();
-    s+="/";
-    s+=flower_version_sz();
+  String s = lily_version_sz();
+  s+="/";
+  s+=flower_version_sz();
    return s;
 }
index 33d191f901109b14a81a4dd647885254768e0eef..2ddc1a29c6961a59b7ec43ad604010202af227fc 100644 (file)
 void
 Vertical_align_element::add (Score_elem*el_l)
 {
-    assert (! contains_b (el_l));
-    elem_l_arr_.push (el_l);
-    add_dependency (el_l);
+  assert (! contains_b (el_l));
+  elem_l_arr_.push (el_l);
+  add_dependency (el_l);
 }
 
 void
 Vertical_align_element::do_substitute_dependency (Score_elem*o,Score_elem*n)
 {
-    int i;
-    while ((i = elem_l_arr_.find_i (o))>=0) 
+  int i;
+  while ((i = elem_l_arr_.find_i (o))>=0) 
        if (n) 
            elem_l_arr_[i] = n;
        else
@@ -37,8 +37,9 @@ Vertical_align_element::do_substitute_dependency (Score_elem*o,Score_elem*n)
 void
 Vertical_align_element::do_post_processing()
 {
-    Array<Interval> dims;
-    for (int i=0; i < elem_l_arr_.size(); i++) {
+  Array<Interval> dims;
+  for (int i=0; i < elem_l_arr_.size(); i++) 
+    {
        Interval y = elem_l_arr_[i]->height() ;
        if (y.empty_b())
            y = Interval (0,0);
@@ -46,8 +47,9 @@ Vertical_align_element::do_post_processing()
        dims.push (y);
     }
 
-    Real where_f=0;
-    for ( int i=0 ;  i < elem_l_arr_.size(); i++) {
+  Real where_f=0;
+  for ( int i=0 ;  i < elem_l_arr_.size(); i++) 
+    {
        elem_l_arr_[i]->translate (- dims[i][1] - where_f, Y_AXIS);
        where_f += dims[i].length();
     }
@@ -56,13 +58,13 @@ Vertical_align_element::do_post_processing()
 bool
 Vertical_align_element::contains_b (Score_elem const *e)const
 {
-    return elem_l_arr_.find_l (e);
+  return elem_l_arr_.find_l (e);
 }
 
 Vertical_align_element::Vertical_align_element()
 {
-    transparent_b_ = true;
-    empty_b_ =true;
+  transparent_b_ = true;
+  empty_b_ =true;
 }
 
 
index b2f3218ee09a45d727403101faf42df9fcd2437d..dcaaf028bd7a677c1f934143afdf739a7afaf151 100644 (file)
 
 Vertical_align_engraver::Vertical_align_engraver()
 {
-    valign_p_ =0;
+  valign_p_ =0;
 }
 
 void
 Vertical_align_engraver::do_creation_processing()
 {
-    valign_p_ =new Vertical_align_spanner;
-    valign_p_->left_col_l_ = get_staff_info().command_pcol_l () ;
-    announce_element (Score_elem_info (valign_p_ , 0));
+  valign_p_ =new Vertical_align_spanner;
+  valign_p_->left_col_l_ = get_staff_info().command_pcol_l () ;
+  announce_element (Score_elem_info (valign_p_ , 0));
 }
 
 void
 Vertical_align_engraver::do_removal_processing()
 {
-    valign_p_->right_col_l_ = get_staff_info().command_pcol_l ();
-    typeset_element (valign_p_);
-    valign_p_ =0;
+  valign_p_->right_col_l_ = get_staff_info().command_pcol_l ();
+  typeset_element (valign_p_);
+  valign_p_ =0;
 }
 
 void
 Vertical_align_engraver::acknowledge_element (Score_elem_info i)
 {
-    if ( i.origin_grav_l_arr_.size() == 2 && 
+  if ( i.origin_grav_l_arr_.size() == 2 && 
         i.elem_l_->is_type_b (Vertical_group_element::static_name()) &&
-        !i.elem_l_->axis_group_l_a_[Y_AXIS]  ) {
+        !i.elem_l_->axis_group_l_a_[Y_AXIS]  ) 
+          {
        assert (!valign_p_->contains_b (i.elem_l_));
 
        valign_p_->add ( i.elem_l_);
index 24e448582de727260cce24e296e959e0d938a9bd..66235afb14c13dcaf43796fc4d610cf9faef2981 100644 (file)
 
 Voice_group_engravers::Voice_group_engravers()
 {
-    dir_i_ =0;
+  dir_i_ =0;
 }
 
 bool
 Voice_group_engravers::do_try_request (Request*r_l)
 {
-    Command_req* c_l = r_l->command();
-    if (c_l&& c_l->groupfeature()) {
+  Command_req* c_l = r_l->command();
+  if (c_l&& c_l->groupfeature()) 
+    {
        Feature f;
        f.type_ = c_l->groupfeature()->type_str_;
        f.value_ = c_l->groupfeature()->value_str_;
        set_feature (f);
        return true;
     }
-    return Engraver_group_engraver::do_try_request (r_l);
+  return Engraver_group_engraver::do_try_request (r_l);
 }
 
 
@@ -41,7 +42,7 @@ void
 Voice_group_engravers::do_print() const
 {
 #ifndef NPRINT
-    Engraver_group_engraver::do_print();
+  Engraver_group_engraver::do_print();
 #endif
 }
 
@@ -50,9 +51,9 @@ Voice_group_engravers::do_print() const
 Scalar
 Voice_group_engravers::get_feature (String f)
 {
-    if (f == "vdir")
+  if (f == "vdir")
        return dir_i_;
-    Engraver_group_engraver::get_feature (f);
+  Engraver_group_engraver::get_feature (f);
 }
 
 ADD_THIS_ENGRAVER(Voice_group_engravers);
index 02707c67c7ad64c49f94e53173c8fc70f5f967e7..0dcee118abee2a66f48a6505ca8f5c21a7d7ab36 100644 (file)
@@ -25,14 +25,14 @@ ostream *mlog (&cerr);
 void
 error_t (String const & s, Moment const & r)
 {
-    String t_mom = String (trunc (r)) + String (r - Moment (trunc (r)));
-    String e=s+ " (t = " +  t_mom + ")";
-    error (e);
+  String t_mom = String (trunc (r)) + String (r - Moment (trunc (r)));
+  String e=s+ " (t = " +  t_mom + ")";
+  error (e);
 }
 
 void
 error_t (String const & s, Time_description const &t_tdes)
 {
-    String e=s+ " (at t=" + String (t_tdes.bars_i_) + ": " + String (t_tdes.whole_in_measure_) + ")\n";
-    error (e);
+  String e=s+ " (at t=" + String (t_tdes.bars_i_) + ": " + String (t_tdes.whole_in_measure_) + ")\n";
+  error (e);
 }
index 4a0f9ffff7147a9407c94fde790c6e10aa7b51c3..beddf0d7531b1b3a658b8b6bcb143933f6172525 100644 (file)
 Array<Col_hpositions>
 Word_wrap::do_solve()const
 {
-    problem_OK();
-    
-    PCursor<PCol*> curcol (pscore_l_->col_p_list_.top());
-    Array<Col_hpositions> breaking;
-    Line_of_cols breakpoints (find_breaks());
-    assert (breakpoints.size()>=2);
-
-    int break_idx_i=0;                 
-    while ( break_idx_i < breakpoints.size() -1) {
+  problem_OK();
+  
+  PCursor<PCol*> curcol (pscore_l_->col_p_list_.top());
+  Array<Col_hpositions> breaking;
+  Line_of_cols breakpoints (find_breaks());
+  assert (breakpoints.size()>=2);
+
+  int break_idx_i=0;                   
+  while ( break_idx_i < breakpoints.size() -1) 
+    {
        Col_hpositions minimum;
        Col_hpositions current;
 
-        // do  another line
+      // do  another line
        PCol *post = breakpoints[break_idx_i]->postbreak_p_;
        current.add (post);
        curcol++;               // skip the breakable.
        break_idx_i++;
 
-       while (break_idx_i < breakpoints.size()) {
+       while (break_idx_i < breakpoints.size()) 
+         {
        
            // add another measure.
-           while (breakpoints[break_idx_i] != curcol.ptr()){
+           while (breakpoints[break_idx_i] != curcol.ptr())
+             {
                current.add (curcol);
                curcol++;
-           }
+             }
            current.add (breakpoints[break_idx_i]->prebreak_p_);
 
            current.spacer_l_ = generate_spacing_problem (current.cols);
 
            // try to solve
-           if (!feasible (current.cols)) {
-               if (!minimum.cols.size()) {
+           if (!feasible (current.cols)) 
+             {
+               if (!minimum.cols.size()) 
+                 {
                    warning ("Ugh, this measure is too long, breakpoint: "
                          + String (break_idx_i) +
                        " (generating stupido solution)");
                    current.stupid_solution();
                    current.energy_f_ = - 1; // make sure we break out.
-               } else
+                 }
+               else
                    current.energy_f_ = infinity_f;     // make sure we go back
-           } else {
+             }
+           else 
+             {
                
                current.solve_line();
                current.print();
-           }
+             }
 
            delete current.spacer_l_;
            current.spacer_l_ =0;
 
            // update minimum, or backup.
-           if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0) {
+           if (current.energy_f_ < minimum.energy_f_ || current.energy_f_ < 0) 
+             {
                minimum = current;
-           } else {            // we're one col too far.
+             }
+           else {              // we're one col too far.
                break_idx_i--;
                while (curcol.ptr() != breakpoints[break_idx_i])
                    curcol --;
                break;          // do the next line.
-           }
+             }
 
 
            // add nobreak version of breakable column
            current.cols.top()=breakpoints[break_idx_i];
            curcol ++;
            break_idx_i++;
-       }
+         }
 
        *mlog << "[" <<break_idx_i<<"]"<<flush;
        breaking.push (minimum);
     }
-    print_stats();
-    return breaking;
+  print_stats();
+  return breaking;
 }
 
 Word_wrap::Word_wrap()
 {
-    get_line_spacer = Spring_spacer::constructor;
+  get_line_spacer = Spring_spacer::constructor;
 }
index aa1d9c0ee0d7bcb39c88ee7df21ebc8762372752..e8ca4a48fc73c4f7528255576ec7c0d426298ed8 100644 (file)
@@ -1,7 +1,7 @@
 Begin3
 Title: LilyPond
-Version: 0.1.8
-Entered-date: 15AUG97
+Version: 0.1.9
+Entered-date: 17AUG97
 Description:   GNU LilyPond is a program which converts music
                definition files into visual or auditive output: it can
                typeset formatted sheet music to a TeX file and and
@@ -14,8 +14,8 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys)
        jan@digicash.com (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps
-       340k lilypond-0.1.8.tar.gz 
+       340k lilypond-0.1.9.tar.gz 
 Original-site: pcnov095.win.tue.nl /pub/lilypond/
-       340k lilypond-0.1.8.tar.gz 
+       340k lilypond-0.1.9.tar.gz 
 Copying-policy: GPL
 End
index d4b78128146c6741cbef57e8de92cdd7f66fcac2..170ab05067e7dead6d507f8091678da983b2d96e 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 0.1.8
+Version: 0.1.9
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.8.tar.gz
+Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.9.tar.gz
 Summary: A preprocessor to make TeX typeset music.
 URL: http://www.stack.nl/~hanwen/lilypond
 Packager: Han-Wen Nienhuys <hanwen@stack.nl>
@@ -28,7 +28,7 @@ strip lily/out/lilypond mi2mu/out/mi2mu
 make prefix="$RPM_BUILD_ROOT/usr" install
 %files
 %doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/internals.text Documentation/out/language.text Documentation/out/lilypond.text Documentation/out/links.text Documentation/out/literature.text Documentation/out/mi2mu.text Documentation/out/mudela-book.text Documentation/out/mutopia.text Documentation/out/other-packages.text BUGS TODO NEWS DEDICATION ANNOUNCE README 
-%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/gallina.ly input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/s.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc 
+%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/gallina.ly input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc 
 %doc Documentation/lelie_logo.gif
 /usr/bin/convert-mudela
 /usr/bin/mudela-book
index 26d92bcafb1d1cd4ef0348fae4ea6e73b734a3d8..c138322590561659d39ed54018392462f5f199c1 100644 (file)
@@ -28,63 +28,64 @@ static void (*rat_printer)(Moment const&);
 void
 usage()
 {
-    LOGOUT(NORMAL_ver) <<
+  LOGOUT(NORMAL_ver) <<
        "Usage: mi2mu [options] midi-file\n"
-    "Translate midi-file to mudela\n"
-    "\n"
-    "Options:\n"
-    "  -b, --no-quantify      write exact durations, e.g.: a4*385/384\n"
-    "  -d, --debug            print lots of debugging stuff\n"
-    "  -h, --help             this help\n"
-    "  -I, --include=DIR      add DIR to search path\n"
-    "  -n, --no-silly         assume no plets or double dots, smallest is 32\n"
-    "  -o, --output=FILE      set FILE as default output\n"
-    "  -p, --no-plets         assume no plets\n"
-    "  -q, --quiet            be quiet\n"
-    "  -s, --smallest=N       assume no shorter (reciprocal) durations than N\n"
-    "  -v, --verbose          be verbose\n"
-    "  -w, --warranty         show warranty and copyright\n"
-    "  -x, --no-double-dots   assume no double dotted notes\n"
-    ;
+  "Translate midi-file to mudela\n"
+  "\n"
+  "Options:\n"
+  "  -b, --no-quantify      write exact durations, e.g.: a4*385/384\n"
+  "  -d, --debug            print lots of debugging stuff\n"
+  "  -h, --help             this help\n"
+  "  -I, --include=DIR      add DIR to search path\n"
+  "  -n, --no-silly         assume no plets or double dots, smallest is 32\n"
+  "  -o, --output=FILE      set FILE as default output\n"
+  "  -p, --no-plets         assume no plets\n"
+  "  -q, --quiet            be quiet\n"
+  "  -s, --smallest=N       assume no shorter (reciprocal) durations than N\n"
+  "  -v, --verbose          be verbose\n"
+  "  -w, --warranty         show warranty and copyright\n"
+  "  -x, --no-double-dots   assume no double dotted notes\n"
+  ;
 }
 
 void
 identify()
 {
-    LOGOUT(NORMAL_ver) << mi2mu_version_str() << endl;
+  LOGOUT(NORMAL_ver) << mi2mu_version_str() << endl;
 }
-    
+  
 void 
 notice()
 {
-    LOGOUT(NORMAL_ver) <<
-    "\n"
-    "Mi2mu, translate midi to mudela.\n"
-    "Copyright (C) 1997 by\n"
-    "  Jan Nieuwenhuizen <jan@digicash.com>\n"
-    "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
-    "\n"
-    "    This program is free software; you can redistribute it and/or\n"
-    "modify it under the terms of the GNU General Public License version 2\n"
-    "as published by the Free Software Foundation.\n"
-    "\n"
-    "    This program is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
-    "General Public License for more details.\n"
-    "\n"
-    "    You should have received a copy (refer to the file COPYING) of the\n"
-    "GNU General Public License along with this program; if not, write to\n"
-    "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
-    "USA.\n";
+  LOGOUT(NORMAL_ver) <<
+  "\n"
+  "Mi2mu, translate midi to mudela.\n"
+  "Copyright (C) 1997 by\n"
+  "  Jan Nieuwenhuizen <jan@digicash.com>\n"
+  "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
+  "\n"
+  "    This program is free software; you can redistribute it and/or\n"
+  "modify it under the terms of the GNU General Public License version 2\n"
+  "as published by the Free Software Foundation.\n"
+  "\n"
+  "    This program is distributed in the hope that it will be useful,\n"
+  "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
+  "General Public License for more details.\n"
+  "\n"
+  "    You should have received a copy (refer to the file COPYING) of the\n"
+  "GNU General Public License along with this program; if not, write to\n"
+  "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
+  "USA.\n";
 }
 
 int
 main (int argc_i, char* argv_sz_a[])
 {
-    rat_printer = print_rat;   
+  rat_printer = print_rat;     
 
-    Long_option_init long_option_init_a[] = {
+  Long_option_init long_option_init_a[] = 
+    {
        {0, "no-quantify", 'b'},
        {0, "debug", 'd'},
        {0, "help", 'h'},
@@ -97,12 +98,13 @@ main (int argc_i, char* argv_sz_a[])
        {0, "warranty", 'w'},
        {0, "no-double-dots", 'x'},
        {0,0,0}
-    };
-    Getopt_long getopt_long (argc_i, argv_sz_a, long_option_init_a);
+  };
+  Getopt_long getopt_long (argc_i, argv_sz_a, long_option_init_a);
 
-    String output_str;
-    while  (Long_option_init const* long_option_init_p = getopt_long())
-       switch  (long_option_init_p->shortname) {
+  String output_str;
+  while  (Long_option_init const* long_option_init_p = getopt_long())
+       switch  (long_option_init_p->shortname) 
+         {
        case 'b':
            Duration_convert::no_quantify_b_s = true;
            break;
@@ -120,7 +122,7 @@ main (int argc_i, char* argv_sz_a[])
        case 'n':
            Duration_convert::no_double_dots_b_s = true;
            Duration_convert::no_triplets_b_s = true;
-           Duration_convert::no_smaller_than_i_s = 32;
+           Duration_convert::no_smaller_than_i_s = 5;
            break;
        case 'o':
            output_str = getopt_long.optional_argument_ch_C_;
@@ -131,15 +133,18 @@ main (int argc_i, char* argv_sz_a[])
        case 'q':
            level_ver = QUIET_ver;
            break;
-       case 's': {
+       case 's': 
+         {
                int i = String_convert::dec2_i (getopt_long.optional_argument_ch_C_);
-               if  (!i) {
+               if  (!i) 
+                 {
                    identify();
                    usage();
                    exit (2); //usage
-               }
-               Duration_convert::no_smaller_than_i_s = i;
-           }
+                 }
+               Duration_convert::no_smaller_than_i_s = 
+                 Duration_convert::i2_type(i);
+             }
            break;
        case 'v':
            level_ver = VERBOSE_ver;
@@ -155,16 +160,17 @@ main (int argc_i, char* argv_sz_a[])
        default:
            assert (0);
            break;
-         }
+           }
   
-    // flag -q must be checked first
-    identify();
+  // flag -q must be checked first
+  identify();
 
-    path.add ("");
-    source_l_g->set_path (&path);
+  path.add ("");
+  source_l_g->set_path (&path);
 
-    char const* arg_sz = 0;
-    while  ( (arg_sz = getopt_long.get_next_arg())) {
+  char const* arg_sz = 0;
+  while  ( (arg_sz = getopt_long.get_next_arg())) 
+    {
        My_midi_parser midi_parser (arg_sz, & source);
        midi_parser_l_g = &midi_parser;
 
@@ -172,13 +178,14 @@ main (int argc_i, char* argv_sz_a[])
        if  (error_i)
            return error_i;
 
-       if  (!output_str.length_i()) {
+       if  (!output_str.length_i()) 
+         {
            String d, dir, base, ext;
 
            split_path (arg_sz, d, dir, base, ext);
            
            output_str = base + ext + ".ly";
-       }
+         }
 
        assert (midi_parser.mudela_score_p_);
        midi_parser.mudela_score_p_->process();
@@ -186,5 +193,5 @@ main (int argc_i, char* argv_sz_a[])
 
        midi_parser_l_g = 0;
     }
-    return 0;
+  return 0;
 }
index a2bdd3f6cff4c6f9665af8fa655931e5c3c99241..9b3532e4492c48110c1507231eaddad6ab98094f 100644 (file)
@@ -16,8 +16,8 @@ static const int build=
 const char * 
 mi2mu_version_sz()
 {
-    static char v[1024];
-    sprintf(v, s, build);
-    return v;
+  static char v[1024];
+  sprintf(v, s, build);
+  return v;
 }
 
index 871be0cc612867641dd10287be352507f1acf1ed..a197fb8f15d9234c97af9a71e70cd968e57c3b69 100644 (file)
@@ -7,18 +7,18 @@
 
 Mudela_column::Mudela_column (Mudela_score* mudela_score_l, Moment mom)
 {
-    mudela_score_l_ = mudela_score_l;
-    at_mom_ = mom;
+  mudela_score_l_ = mudela_score_l;
+  at_mom_ = mom;
 }
 
 void 
 Mudela_column::add_item (Mudela_item* mudela_item_l)
 {
-    mudela_item_l_list_.bottom().add (mudela_item_l);
+  mudela_item_l_list_.bottom().add (mudela_item_l);
 }
 
 Moment
 Mudela_column::at_mom()
 {
-    return at_mom_;
+  return at_mom_;
 }
index 4e8f7ccf98e796b996d90cce39121efa8095d3a5..3179662b726e40e565a1994ef1550f8135022cc7 100644 (file)
 
 Mudela_item::Mudela_item (Mudela_column* mudela_column_l)
 {
-    mudela_column_l_ = mudela_column_l;
+  mudela_column_l_ = mudela_column_l;
 }
 
 Moment
 Mudela_item::at_mom()
 {
-    return mudela_column_l_->at_mom();
+  return mudela_column_l_->at_mom();
 }
 
 Moment
 Mudela_item::duration_mom()
 {
-    return Moment (0);
+  return Moment (0);
 }
 
 void
 Mudela_item::output (Mudela_stream& mudela_stream_r)
 {
-    mudela_stream_r << str() << String (" ");
+  mudela_stream_r << str() << String (" ");
 }
 
 Mudela_key::Mudela_key (int accidentals_i, int minor_i)
-    : Mudela_item (0)
+  : Mudela_item (0)
 {
-    accidentals_i_ = accidentals_i;
-    minor_i_ = minor_i;
-    if  (accidentals_i >= 0)
+  accidentals_i_ = accidentals_i;
+  minor_i_ = minor_i;
+  if  (accidentals_i >= 0)
        key_i_ =   ((accidentals_i % 7)[ "cgdaebf" ] - 'a' - 2) % 7;
-    else
+  else
        key_i_ =   ((-accidentals_i % 7)[ "cfbeadg" ] - 'a' - 2) % 7;
 }
 
 String
 Mudela_key::str()
 {
-    String str = "\\key ";
-    if  (!minor_i_) 
+  String str = "\\key ";
+  if  (!minor_i_) 
        str += String ((char)  ((key_i_ + 2) % 7 + 'A'));
-    else // heu, -2: should be - 1 1/2: A -> fis
+  else // heu, -2: should be - 1 1/2: A -> fis
        str += String ((char)  ((key_i_ + 2 - 2) % 7 + 'a'));
-    str = String ("% \"") + str
+  str = String ("% \"") + str
        + String('"') + "; % not supported yet\n"; 
-    return str;
+  return str;
 }
 
 String
 Mudela_key::notename_str (int pitch_i)
 {
-    // this may seem very smart,
-    // but it-s only an excuse not to read a notename table
-
-    // major scale: do-do
-    // minor scale: la-la  (= + 5)
-    static int notename_i_a[ 12 ] = { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6 };
-    int notename_i = notename_i_a[  (minor_i_ * 5 + pitch_i) % 12 ];
-    
-    static int accidentals_i_a[ 12 ] = { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 };
-    int accidental_i = accidentals_i_a[ minor_i_ * 5 + pitch_i % 12 ];
-    if  (accidental_i &&  (accidentals_i_ < 0)) {
+  // this may seem very smart,
+  // but it-s only an excuse not to read a notename table
+
+  // major scale: do-do
+  // minor scale: la-la  (= + 5)
+  static int notename_i_a[ 12 ] = { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6 };
+  int notename_i = notename_i_a[  (minor_i_ * 5 + pitch_i) % 12 ];
+  
+  static int accidentals_i_a[ 12 ] = { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 };
+  int accidental_i = accidentals_i_a[ minor_i_ * 5 + pitch_i % 12 ];
+  if  (accidental_i &&  (accidentals_i_ < 0)) 
+    {
        accidental_i = - accidental_i;
        notename_i =  (notename_i + 1) % 7;
     }
 
-    String notename_str = (char)  ( ((notename_i + 2) % 7) + 'a');
-    while  (accidental_i-- > 0)
+  String notename_str = (char)  ( ((notename_i + 2) % 7) + 'a');
+  while  (accidental_i-- > 0)
        notename_str += "is";
-    accidental_i++;
-    while  (accidental_i++ < 0)
+  accidental_i++;
+  while  (accidental_i++ < 0)
        if   ((notename_str == "a") ||  (notename_str == "e"))
            notename_str += "s";
        else
            notename_str += "es";
-    accidental_i--;
+  accidental_i--;
 
-    String de_octavate_str = String ('\'',  (Mudela_note::c0_pitch_i_c_ + 11 - pitch_i) / 12);
-    String octavate_str = String ('\'',  (pitch_i - Mudela_note::c0_pitch_i_c_) / 12);
-    return de_octavate_str + notename_str + octavate_str;
+  String de_octavate_str = String ('\'',  (Mudela_note::c0_pitch_i_c_ + 11 - pitch_i) / 12);
+  String octavate_str = String ('\'',  (pitch_i - Mudela_note::c0_pitch_i_c_) / 12);
+  return de_octavate_str + notename_str + octavate_str;
 }
 
 Mudela_meter::Mudela_meter (int num_i, int den_i, int clocks_4_i, int count_32_i)
    : Mudela_item (0)
 {
-    sync_dur_.type_i_ = 8 ;
-    sync_f_ = 1.0;
-    if  (count_32_i != 8)
+  sync_dur_.durlog_i_ = 3 ;
+  sync_f_ = 1.0;
+  if  (count_32_i != 8)
        warning (String ("#32 in quarter: ") + String (count_32_i));
-    num_i_ = num_i;
-    den_i_ = den_i;
-    clocks_1_i_ = clocks_4_i * 4; 
+  num_i_ = num_i;
+  den_i_ = den_i;
+  clocks_1_i_ = clocks_4_i * 4; 
 }
 
 Moment
 Mudela_meter::bar_mom()
 {
-    Duration d;
-    d.type_i_ =  (1 << den_i_);
-    return Moment (num_i_) * Duration_convert::dur2_mom (d);
+  Duration d;
+  d.durlog_i_ =   den_i_;
+  return Moment (num_i_) * Duration_convert::dur2_mom (d);
 }
 
 int
 Mudela_meter::clocks_1_i()
 {
-    return clocks_1_i_;
+  return clocks_1_i_;
 }
 
 int
 Mudela_meter::den_i()
 {
-    return den_i_;
+  return den_i_;
 }
 
 int
 Mudela_meter::num_i()
 {
-    return num_i_;
+  return num_i_;
 }
 
 String
 Mudela_meter::str()
 {
-    String str = "\\meter "
+  String str = "\\meter "
        + String (num_i_) + "/" + String (1 << den_i_) 
        + ";\n";
-    return str;
+  return str;
 }
 
 
 // statics Mudela_note
 /*
  this switch can be used to write simple plets like 
-     c4*2/3 
+   c4*2/3 
  as  
-     \plet 2/3; c4 \plet 1/1;
+   \plet 2/3; c4 \plet 1/1;
  */
 bool const Mudela_note::simple_plet_b_s = true;
 
 Mudela_note::Mudela_note (Mudela_column* mudela_column_l, int channel_i, int pitch_i, int dyn_i)
-    : Mudela_item (mudela_column_l)
+  : Mudela_item (mudela_column_l)
 {
-    // junk dynamics
-    (void)dyn_i;
-    channel_i_ = channel_i;
-    pitch_i_ = pitch_i;        
-    end_column_l_ = 0;
+  // junk dynamics
+  (void)dyn_i;
+  channel_i_ = channel_i;
+  pitch_i_ = pitch_i;  
+  end_column_l_ = 0;
 }
 
 String
 Mudela_note::str()
 {
-    Duration dur = duration();
-    if  (!dur.type_i_)
+  Duration dur = duration();
+  if  (dur.durlog_i_ < -10)
        return "";
 
-    String name_str = mudela_column_l_->mudela_score_l_->mudela_key_l_->notename_str (pitch_i_);
+  String name_str 
+    = mudela_column_l_->mudela_score_l_->mudela_key_l_->notename_str (pitch_i_);
 
-    if  (simple_plet_b_s)
+  if  (simple_plet_b_s)
        return name_str + Duration_convert::dur2_str (dur) + " ";
 
-    //ugh
-    String str;
-    if  (dur.plet_b())
+  //ugh
+  String str;
+  if  (dur.plet_b())
        str += String ("\\plet ")
            + String_convert::i2dec_str (dur.plet_.iso_i_, 0, 0)
            + "/"
            + String_convert::i2dec_str (dur.plet_.type_i_, 0, 0)
            + "; ";
 
-    str += name_str;
+  str += name_str;
 
-    Duration tmp = dur;
-    tmp.set_plet (1,1);
-    str += Duration_convert::dur2_str (tmp);
+  Duration tmp = dur;
+  tmp.set_plet (1,1);
+  str += Duration_convert::dur2_str (tmp);
 
-    if  (dur.plet_b())
+  if  (dur.plet_b())
        str += String (" \\plet 1/1;");
 
-    return str + " ";
+  return str + " ";
 }
 
 Duration
 Mudela_note::duration()
 {
-    assert (end_column_l_);
-    Moment mom = end_column_l_->at_mom() - at_mom();
-    if  (Duration_convert::no_quantify_b_s)
-       return Duration_convert::mom2_dur (mom);
-
-    return Duration_convert::mom2standardised_dur (mom);
+  assert (end_column_l_);
+  Moment mom = end_column_l_->at_mom() - at_mom();
+  return Duration_convert::mom2_dur (mom);
 }
 
 Moment
@@ -208,88 +207,85 @@ Mudela_note::duration_mom()
 {
 // ugh
 //    return Duration_convert::dur2_mom (duration());
-    return end_column_l_->at_mom() - at_mom();
+  return end_column_l_->at_mom() - at_mom();
 }
 
 Mudela_skip::Mudela_skip (Mudela_column* mudela_column_l, Moment skip_mom)
-    : Mudela_item (mudela_column_l)
+  : Mudela_item (mudela_column_l)
 {
-    mom_ = skip_mom;
+  mom_ = skip_mom;
 }
 
 Duration
 Mudela_skip::duration()
 {
-    if  (Duration_convert::no_quantify_b_s)
        return Duration_convert::mom2_dur (mom_);
-
-    return Duration_convert::mom2standardised_dur (mom_);
 }
 
 Moment
 Mudela_skip::duration_mom()
 {
-    return Duration_convert::dur2_mom (duration());
+  return Duration_convert::dur2_mom (duration());
 }
 
 String
 Mudela_skip::str()
 {
-    if  (!mom_)
+  if  (!mom_)
        return String ("");
 
-    Duration dur = duration();
-    if  (!dur.type_i_)
+  Duration dur = duration();
+  if  (dur.durlog_i_<-10)
        return "";
 
-    String str = "\\skip ";
-    str += Duration_convert::dur2_str (dur) + "; ";
+  String str = "\\skip ";
+  str += Duration_convert::dur2_str (dur) + "; ";
 
-    return str;
+  return str;
 }
 
 Mudela_tempo::Mudela_tempo (int useconds_per_4_i)
    : Mudela_item (0)
 {
-    useconds_per_4_i_ = useconds_per_4_i;
-    seconds_per_1_f_ = (Real)useconds_per_4_i_ * 4 / 1e6;
+  useconds_per_4_i_ = useconds_per_4_i;
+  seconds_per_1_f_ = (Real)useconds_per_4_i_ * 4 / 1e6;
 }
 
 String
 Mudela_tempo::str()
 {
-    String str = "\\tempo 4=";
-    str += String (get_tempo_i (Moment (1, 4)));
-    str += ";\n";
-    return str;
+  String str = "\\tempo 4=";
+  str += String (get_tempo_i (Moment (1, 4)));
+  str += ";\n";
+  return str;
 }
 
 int 
 Mudela_tempo::useconds_per_4_i()
 {
-    return useconds_per_4_i_;
+  return useconds_per_4_i_;
 }
 
 int
 Mudela_tempo::get_tempo_i (Moment moment)
 {
-    return Moment (60) / moment / Moment (seconds_per_1_f_);
+  return Moment (60) / moment / Moment (seconds_per_1_f_);
 }
 
 Mudela_text::Mudela_text (Mudela_text::Type type, String text_str)
    : Mudela_item (0)
 {
-    type_ = type;
-    text_str_ = text_str;
+  type_ = type;
+  text_str_ = text_str;
 }
 
 String
 Mudela_text::str()
 {
-    if  (!text_str_.length_i() 
+  if  (!text_str_.length_i() 
        ||  (text_str_.length_i() != (int)strlen (text_str_.ch_C())))
        return "";
 
-    return "% " + text_str_ + "\n";
+  return "% " + text_str_ + "\n";
 }
 
index 2a82a630c1720061eb7eabd3db58887d053e3e59..843bab56c77b51bdfa3e4ba453910c9e5e398ef0 100644 (file)
 
 Mudela_score::Mudela_score (int format_i, int tracks_i, int tempo_i)
 {
-    format_i_ = format_i;
-    tracks_i_ = tracks_i;
-    tempo_i_ = tempo_i;
-    mudela_column_p_list_.bottom().add (new Mudela_column (this, Moment (0)));
+  format_i_ = format_i;
+  tracks_i_ = tracks_i;
+  tempo_i_ = tempo_i;
+  mudela_column_p_list_.bottom().add (new Mudela_column (this, Moment (0)));
 }
 
 Mudela_score::~Mudela_score()
@@ -28,55 +28,59 @@ Mudela_score::~Mudela_score()
 void 
 Mudela_score::add_item (Mudela_item* mudela_item_p)
 {
-    mudela_staff_p_list_.bottom()->add_item (mudela_item_p);
+  mudela_staff_p_list_.bottom()->add_item (mudela_item_p);
 }
 
 void
 Mudela_score::add_staff (Mudela_staff* mudela_staff_p)
 {
-    mudela_staff_p_list_.bottom().add (mudela_staff_p);
+  mudela_staff_p_list_.bottom().add (mudela_staff_p);
 }
 
 Mudela_column*
 Mudela_score::mudela_column_l (Moment mom)
 {
-    for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++) {
-       if  (i->at_mom() > mom) {
+  for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++) 
+    {
+       if  (i->at_mom() > mom) 
+         {
            Mudela_column* p = new Mudela_column (this, mom);
            i.insert (p);
            return p;
-       }
+         }
        if  (i->at_mom() == mom)
            return *i;
     }
 
-    Mudela_column* p = new Mudela_column (this, mom);
-    mudela_column_p_list_.bottom().add (p);
-    return p;
+  Mudela_column* p = new Mudela_column (this, mom);
+  mudela_column_p_list_.bottom().add (p);
+  return p;
 }
 
 void
 Mudela_score::output (String filename_str)
 {
-    LOGOUT(NORMAL_ver) << "Lily output to " << filename_str << " ..." << endl;
-    
-    // ugh, ugly midi type 1 fix
-    if  ( (mudela_staff_p_list_.size() == 1) && !mudela_staff_p_list_.top()->number_i_)
+  LOGOUT(NORMAL_ver) << "Lily output to " << filename_str << " ..." << endl;
+  
+  // ugh, ugly midi type 1 fix
+  if  ( (mudela_staff_p_list_.size() == 1) && !mudela_staff_p_list_.top()->number_i_)
        mudela_staff_p_list_.top()->number_i_ = 1;
 
-    int track_i = 0;
-    Mudela_stream mudela_stream (filename_str);
-    for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++) {
+  int track_i = 0;
+  Mudela_stream mudela_stream (filename_str);
+  for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++) 
+    {
        LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
        i->output (mudela_stream);
        mudela_stream << "\n";
        LOGOUT(NORMAL_ver) << endl;
     }
 
-    mudela_stream << "\\score{\n";
-    if  (mudela_staff_p_list_.size() > 1)
+  mudela_stream << "\\score{\n";
+  if  (mudela_staff_p_list_.size() > 1)
        mudela_stream << "<\n\\multi 3;\n";
-    for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++) {
+  for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++) 
+    {
        if  ( (mudela_staff_p_list_.size() != 1) 
            &&  (i == mudela_staff_p_list_.top()))
            continue;
@@ -84,36 +88,37 @@ Mudela_score::output (String filename_str)
        mudela_stream << "\\$" << i->id_str();
        mudela_stream << " }\n";
     }
-    if  (mudela_staff_p_list_.size() > 1)
+  if  (mudela_staff_p_list_.size() > 1)
        mudela_stream << ">\n";
 
-    mudela_stream << "\\paper{}\n";
+  mudela_stream << "\\paper{}\n";
 
-    mudela_stream << "\\midi{ ";
+  mudela_stream << "\\midi{ ";
        // let's not use silly 0 track
        mudela_staff_p_list_.bottom()->mudela_tempo_p_->output (mudela_stream);
-    mudela_stream << "}\n";
+  mudela_stream << "}\n";
 
-    mudela_stream << "}\n";
+  mudela_stream << "}\n";
 }
 
 void
 Mudela_score::process()
 {
-    LOGOUT(NORMAL_ver) << "\nProcessing..." << endl;
+  LOGOUT(NORMAL_ver) << "\nProcessing..." << endl;
        
-    LOGOUT(DEBUG_ver) << "columns\n";
-    for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
+  LOGOUT(DEBUG_ver) << "columns\n";
+  for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
        LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "\n";
 
-    settle_columns();
-    filter_tempo();
-    quantify_columns();
-    quantify_durations();
+  settle_columns();
+  filter_tempo();
+  quantify_columns();
+  quantify_durations();
 
-    LOGOUT(NORMAL_ver) << "\nCreating voices..." << endl;
-    int track_i = 0;
-    for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)  {
+  LOGOUT(NORMAL_ver) << "\nCreating voices..." << endl;
+  int track_i = 0;
+  for  (PCursor<Mudela_staff*> i (mudela_staff_p_list_); i.ok(); i++)  
+    {
        LOGOUT(NORMAL_ver) << "track " << track_i++ << ": " << flush;
        i->process();
        LOGOUT(NORMAL_ver) << endl;
@@ -123,32 +128,34 @@ Mudela_score::process()
 void
 Mudela_score::filter_tempo()
 {
-    LOGOUT(NORMAL_ver) << "\nNOT Filtering tempo..." << endl;
+  LOGOUT(NORMAL_ver) << "\nNOT Filtering tempo..." << endl;
 }
 
 void
 Mudela_score::quantify_columns()
 {
-    // ugh
-    if  (Duration_convert::no_quantify_b_s) {
+  // ugh
+  if  (Duration_convert::no_quantify_b_s) 
+    {
        LOGOUT(NORMAL_ver) << "\nNOT Quantifying columns..." << endl;
        return;
     }
 
-    LOGOUT(NORMAL_ver) << "\nQuantifying columns..." << endl;
+  LOGOUT(NORMAL_ver) << "\nQuantifying columns..." << endl;
 
-    int n = 32 >? Duration_convert::no_smaller_than_i_s;
-    Moment s = Moment (1, n);
-    Moment sh = Moment (1, 2 * n);
-    for  (int i = 0; i < column_l_array_.size(); i++) {
+  int n = 5 >? Duration_convert::no_smaller_than_i_s;
+  Moment s = Moment (1, n);
+  Moment sh = Moment (1, 2 * n);
+  for  (int i = 0; i < column_l_array_.size(); i++) 
+    {
 //     Moment mom = column_l_array_[ i ]->at_mom();
 //     column_l_array_[ i ]->at_mom_ = Duration_convert::dur2_mom (dur);
        column_l_array_[ i ]->at_mom_ =
 //         s * (int) ( (sh + column_l_array_[ i ]->at_mom()) / s);
            s * (int) ( (column_l_array_[ i ]->at_mom()) / s);
        LOGOUT(NORMAL_ver) << '.';
-    } 
-    LOGOUT(NORMAL_ver) << endl;
+    }
+  LOGOUT(NORMAL_ver) << endl;
 }
 
 void
@@ -162,28 +169,30 @@ Mudela_score::settle_columns()
 {
 //    LOGOUT(NORMAL_ver) << "\nNOT Settling columns..." << endl;
 //    return;
-    LOGOUT(NORMAL_ver) << "\nSettling columns..." << endl;
+  LOGOUT(NORMAL_ver) << "\nSettling columns..." << endl;
 
-    assert (!column_l_array_.size());
-    int n = mudela_column_p_list_.size();
+  assert (!column_l_array_.size());
+  int n = mudela_column_p_list_.size();
 // huh?
 //    column_l_array_.set_size (n);
-    for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
+  for  (PCursor<Mudela_column*> i (mudela_column_p_list_); i.ok(); i++)
        column_l_array_.push (*i);
 
-    int start_i = 0;
-    int end_i = 0;
-    Moment start_mom = 0;
-    Duration smallest_dur;
-    smallest_dur.type_i_ =  64;
-    Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
+  int start_i = 0;
+  int end_i = 0;
+  Moment start_mom = 0;
+  Duration smallest_dur;
+  smallest_dur.durlog_i_ =  6;
+  Moment const noise_mom = Duration_convert::dur2_mom (smallest_dur)
        / Moment (2);
-    for  (int i = 0; i < n; i++) {
-       if  (!start_i) {
+  for  (int i = 0; i < n; i++) 
+    {
+       if  (!start_i) 
+         {
            start_i = end_i = i;
            start_mom = column_l_array_[ i ]->at_mom();
            continue;
-       }
+         }
 
        // find all columns within noise's distance
        while  ( (i < n)
index 0c13ec4aac8cc143600bfabcbdf86ff402f2811a..3f1373a4acfecf3bc7cb605f57c6f28fc4c3d0ea 100644 (file)
 #include "mudela-staff.hh"
 #include "mudela-stream.hh"
 #include "mudela-voice.hh"
+#include "my-midi-parser.hh"
+#include "mudela-score.hh"
+
 
 Mudela_staff::Mudela_staff (int number_i, String copyright_str, String track_name_str, String instrument_str)
 {
-    number_i_ = number_i;
-    copyright_str_ = copyright_str;
-    instrument_str_ = instrument_str;
-    name_str_ = track_name_str;
-    mudela_meter_p_ = new Mudela_meter (4, 2, 24, 8);
-    mudela_tempo_p_ = new Mudela_tempo (1000000);
+  number_i_ = number_i;
+  copyright_str_ = copyright_str;
+  instrument_str_ = instrument_str;
+  name_str_ = track_name_str;
+  mudela_meter_p_ = new Mudela_meter (4, 2, 24, 8);
+  mudela_tempo_p_ = new Mudela_tempo (1000000);
 }
 
 Mudela_staff::~Mudela_staff()
 {
-    delete mudela_meter_p_;
-    delete mudela_tempo_p_;
+  delete mudela_meter_p_;
+  delete mudela_tempo_p_;
 }
 
 void
 Mudela_staff::add_item (Mudela_item* mudela_item_p)
 {
-    mudela_item_p_list_.bottom().add (mudela_item_p);
-    if  (mudela_item_p->mudela_column_l_)
-       mudela_item_p->mudela_column_l_->add_item (mudela_item_p);
+  mudela_item_p_list_.bottom().add (mudela_item_p);
+  if  (mudela_item_p->mudela_column_l_)
+    mudela_item_p->mudela_column_l_->add_item (mudela_item_p);
 }
 
 void
 Mudela_staff::eat_voice (Link_list<Mudela_item*>& items)
 {
-    Mudela_voice* voice_p = new Mudela_voice (this);
-    mudela_voice_p_list_.bottom().add (voice_p);
-
-//    Moment mom = items.top()->at_mom();
-    Moment mom = 0;
-
-    for  (PCursor<Mudela_item*> i (items); i.ok();) {
-       LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "; ";
-       LOGOUT(DEBUG_ver) << "dur: " << i->duration_mom() << "; ";
-       LOGOUT(DEBUG_ver) << "mom: " << mom << " -> ";
-       if  (i->at_mom() > mom) {
-           // ugh, liek
-           voice_p->add_item (new Mudela_skip (i->mudela_column_l_, i->at_mom() - mom));
-           mom = i->at_mom();
+  Mudela_voice* voice_p = new Mudela_voice (this);
+  mudela_voice_p_list_.bottom().add (voice_p);
+
+  //    Moment mom = items.top()->at_mom();
+  Moment mom = 0;
+
+  for  (PCursor<Mudela_item*> i (items); i.ok();) 
+    {
+      LOGOUT(DEBUG_ver) << "At: " << i->at_mom() << "; ";
+      LOGOUT(DEBUG_ver) << "dur: " << i->duration_mom() << "; ";
+      LOGOUT(DEBUG_ver) << "mom: " << mom << " -> ";
+      if  (i->at_mom() > mom) 
+       {
+         Moment dur = i->at_mom() - mom;
+         // ugh, need score
+         Mudela_column* start = midi_parser_l_g->mudela_score_p_->mudela_column_l (mom);
+         voice_p->add_item (new Mudela_skip (start, dur));
+         mom = i->at_mom();
        }
-       if  (i->at_mom() == mom) {
-           mom = i->at_mom() + i->duration_mom();
-           voice_p->add_item (i.remove_p());
-           // ugh
+      if  (i->at_mom() == mom) 
+       {
+         mom = i->at_mom() + i->duration_mom();
+         voice_p->add_item (i.remove_p());
+         // ugh
        }
-       else if  (i.ok())
-           i++;
-       LOGOUT(DEBUG_ver) << "mom: " << mom << "\n";
+      else if  (i.ok())
+       i++;
+      LOGOUT(DEBUG_ver) << "mom: " << mom << "\n";
     }
 }
 
 String
 Mudela_staff::id_str()
 {
-    String str = name_str();
-    for  (int i = 0; i < str.length_i(); i++)
-       if  ( (!i && !isalpha (str[ i ]))
-           || !isalnum (str[ i ]))
-           * (str.ch_l() + i) = '_';
-    return str;
+  String str = name_str();
+  for  (int i = 0; i < str.length_i(); i++)
+    if  ( (!i && !isalpha (str[ i ]))
+         || !isalnum (str[ i ]))
+      * (str.ch_l() + i) = '_';
+  return str;
 }
 
 String
 Mudela_staff::name_str()
 {
-    if  (name_str_.length_i())
-       return name_str_;
-    return String ("track") + String (number_i_);
+  if  (name_str_.length_i())
+    return name_str_;
+  return String ("track") + String (number_i_);
 }
 
 void
 Mudela_staff::output (Mudela_stream& mudela_stream_r)
 {
-    mudela_stream_r << "$" << id_str() << " = \\melodic";
-    mudela_stream_r <<  (mudela_voice_p_list_.size() > 1 ? "<" : "{");
-    mudela_stream_r << "\n";
-    mudela_stream_r << "% midi copyright:" << copyright_str_ << "\n";
-    mudela_stream_r << "% instrument:" << instrument_str_ << "\n";
-
-    if  (mudela_voice_p_list_.size() == 1)
-       mudela_voice_p_list_.top()->output (mudela_stream_r);
-    else
-       for  (PCursor<Mudela_voice*> i (mudela_voice_p_list_); i.ok(); i++) {
-           mudela_stream_r << "{ ";
-           i->output (mudela_stream_r);
-           mudela_stream_r << "} ";
-       }
-
-    mudela_stream_r <<  (mudela_voice_p_list_.size() > 1 ? "\n>" : "\n}");
-    mudela_stream_r << " % " << name_str() << "\n";
+  mudela_stream_r << "$" << id_str() << " = \\melodic";
+  mudela_stream_r <<  (mudela_voice_p_list_.size() > 1 ? "<" : "{");
+  mudela_stream_r << "\n";
+  mudela_stream_r << "% midi copyright:" << copyright_str_ << "\n";
+  mudela_stream_r << "% instrument:" << instrument_str_ << "\n";
+
+  if  (mudela_voice_p_list_.size() == 1)
+    mudela_voice_p_list_.top()->output (mudela_stream_r);
+  else
+    for  (PCursor<Mudela_voice*> i (mudela_voice_p_list_); i.ok(); i++) 
+      {
+       mudela_stream_r << "{ ";
+       i->output (mudela_stream_r);
+       mudela_stream_r << "} ";
+      }
+
+  mudela_stream_r <<  (mudela_voice_p_list_.size() > 1 ? "\n>" : "\n}");
+  mudela_stream_r << " % " << name_str() << "\n";
 }
 
 void
 Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment now_mom, int bar_i)
 {
-    Moment bar_mom = mudela_meter_p_->bar_mom();
-    Moment into_bar_mom = now_mom - Moment (bar_i - 1) * bar_mom;
-    if  (bar_i > 1) {
-       if  (!into_bar_mom)
-           mudela_stream_r << "|\n";
+  Moment bar_mom = mudela_meter_p_->bar_mom();
+  Moment into_bar_mom = now_mom - Moment (bar_i - 1) * bar_mom;
+  if  (bar_i > 1) 
+    {
+      if  (!into_bar_mom)
+       mudela_stream_r << "|\n";
     }
-    mudela_stream_r << "% " << String_convert::i2dec_str (bar_i, 0, ' ');
-    if  (into_bar_mom)
-       mudela_stream_r << ":" << Duration_convert::dur2_str (Duration_convert::mom2_dur (into_bar_mom));
-    mudela_stream_r << "\n";
+  mudela_stream_r << "% " << String_convert::i2dec_str (bar_i, 0, ' ');
+  if  (into_bar_mom)
+    mudela_stream_r << ":" << Duration_convert::dur2_str (Duration_convert::mom2_dur (into_bar_mom));
+  mudela_stream_r << "\n";
 }
 
 
@@ -129,79 +139,85 @@ Mudela_staff::output_mudela_begin_bar (Mudela_stream& mudela_stream_r, Moment no
 void 
 Mudela_staff::output_mudela_rest (Mudela_stream& mudela_stream_r, Moment begin_mom, Moment end_mom)
 {
-    Moment bar_mom = mudela_meter_p_->bar_mom();
-    Moment now_mom = begin_mom;
+  Moment bar_mom = mudela_meter_p_->bar_mom();
+  Moment now_mom = begin_mom;
 
-    int begin_bar_i = (int) (now_mom / bar_mom) + 1; 
-    int end_bar_i = (int) (end_mom / bar_mom) + 1;
+  int begin_bar_i = (int) (now_mom / bar_mom) + 1; 
+  int end_bar_i = (int) (end_mom / bar_mom) + 1;
 
-    if  (end_bar_i == begin_bar_i) {
-       output_mudela_rest_remain (mudela_stream_r, end_mom - begin_mom);
-       return;
+  if  (end_bar_i == begin_bar_i) 
+    {
+      output_mudela_rest_remain (mudela_stream_r, end_mom - begin_mom);
+      return;
     }
 
-    // multiple bars involved
-    int bar_i = (int) (now_mom / bar_mom) + 1;
-
-    //fill current bar
-    Moment begin_bar_mom = Moment (begin_bar_i - 1) * bar_mom;
-    if  (now_mom > begin_bar_mom) {
-       int next_bar_i = (int) (now_mom / bar_mom) + 2; 
-       Moment next_bar_mom = Moment (next_bar_i - 1) * bar_mom;
-       assert (next_bar_mom <= end_mom);
-
-       Moment remain_mom = next_bar_mom - now_mom;
-       if  (remain_mom > Moment (0)) {
-           output_mudela_rest_remain (mudela_stream_r, remain_mom);
-           now_mom += remain_mom;
+  // multiple bars involved
+  int bar_i = (int) (now_mom / bar_mom) + 1;
+
+  //fill current bar
+  Moment begin_bar_mom = Moment (begin_bar_i - 1) * bar_mom;
+  if  (now_mom > begin_bar_mom) 
+    {
+      int next_bar_i = (int) (now_mom / bar_mom) + 2; 
+      Moment next_bar_mom = Moment (next_bar_i - 1) * bar_mom;
+      assert (next_bar_mom <= end_mom);
+
+      Moment remain_mom = next_bar_mom - now_mom;
+      if  (remain_mom > Moment (0)) 
+       {
+         output_mudela_rest_remain (mudela_stream_r, remain_mom);
+         now_mom += remain_mom;
        }
 
-       bar_i = check_end_bar_i (now_mom, bar_i);
+      bar_i = check_end_bar_i (now_mom, bar_i);
     }
 
-    // fill whole bars
-    int count_i = end_bar_i - bar_i;
-    for  (int i = 0; i < count_i; i++) {
-       int begin_bar_i = check_begin_bar_i (now_mom, bar_i);
-       if  (begin_bar_i)
-           output_mudela_begin_bar (mudela_stream_r, now_mom, begin_bar_i);
-       mudela_stream_r << "r1 ";
-//     *mudela_stream_r.os_p_ << flush;
-       if  (begin_bar_i)
-           LOGOUT(NORMAL_ver) << begin_bar_i << flush; 
-       bar_i = check_end_bar_i (now_mom, bar_i);
-       now_mom += bar_mom;
+  // fill whole bars
+  int count_i = end_bar_i - bar_i;
+  for  (int i = 0; i < count_i; i++) 
+    {
+      int begin_bar_i = check_begin_bar_i (now_mom, bar_i);
+      if  (begin_bar_i)
+       output_mudela_begin_bar (mudela_stream_r, now_mom, begin_bar_i);
+      mudela_stream_r << "r1 ";
+      //       *mudela_stream_r.os_p_ << flush;
+      if  (begin_bar_i)
+       LOGOUT(NORMAL_ver) << begin_bar_i << flush; 
+      bar_i = check_end_bar_i (now_mom, bar_i);
+      now_mom += bar_mom;
     }
 
-    // use "int i" here, and gcc 2.7.2 hits internal compiler error
-    int ii = check_begin_bar_i (now_mom, bar_i);
-    if  (ii)
-       output_mudela_begin_bar (mudela_stream_r, now_mom, ii);
+  // use "int i" here, and gcc 2.7.2 hits internal compiler error
+  int ii = check_begin_bar_i (now_mom, bar_i);
+  if  (ii)
+    output_mudela_begin_bar (mudela_stream_r, now_mom, ii);
 
-//    bar_i = check_end_bar_i (now_mom, bar_i);
+  //    bar_i = check_end_bar_i (now_mom, bar_i);
 
-    Moment remain_mom = end_mom - Moment (end_bar_i - 1) * bar_mom;
-       if  (remain_mom > Moment (0)) {
-       output_mudela_rest_remain (mudela_stream_r, remain_mom);
-       now_mom += remain_mom;
+  Moment remain_mom = end_mom - Moment (end_bar_i - 1) * bar_mom;
+  if  (remain_mom > Moment (0)) 
+    {
+      output_mudela_rest_remain (mudela_stream_r, remain_mom);
+      now_mom += remain_mom;
     }
-    assert (now_mom == end_mom);
+  assert (now_mom == end_mom);
 }
 
 void
 Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Moment mom)
 {
-    if  (Duration_convert::no_quantify_b_s) {
-       Duration dur = Duration_convert::mom2_dur (mom);
-       mudela_stream_r << "r" << dur.str() << " ";
-//     assert (mom == dur.mom());
-       assert (mom == dur.length());
-       return;
+  if  (Duration_convert::no_quantify_b_s) 
+    {
+      Duration dur = Duration_convert::mom2_dur (mom);
+      mudela_stream_r << "r" << dur.str() << " ";
+      //       assert (mom == dur.mom());
+      assert (mom == dur.length());
+      return;
     }
        
-    Duration dur = Duration_convert::mom2standardised_dur (mom);
-    if  (dur.type_i_)
-       mudela_stream_r << "r" << dur.str() << " ";
+  Duration dur = Duration_convert::mom2standardised_dur (mom);
+  if  (dur.type_i_>-10)
+    mudela_stream_r << "r" << dur.str() << " ";
 }
 #endif
 
@@ -209,29 +225,29 @@ Mudela_staff::output_mudela_rest_remain (Mudela_stream& mudela_stream_r, Moment
 void
 Mudela_staff::process()
 {
-    /* 
-      group items into voices
+  /* 
+     group items into voices
      */
 
-    Link_list<Mudela_item*> items;
-    for  (PCursor<Mudela_item*> i (mudela_item_p_list_); i.ok(); i++)
-       items.bottom().add (*i);
-    
-    while  (items.size())
-       eat_voice (items);
+  Link_list<Mudela_item*> items;
+  for  (PCursor<Mudela_item*> i (mudela_item_p_list_); i.ok(); i++)
+    items.bottom().add (*i);
+  
+  while  (items.size())
+    eat_voice (items);
 }
 
 void
 Mudela_staff::set_tempo (int useconds_per_4_i)
 {
-    delete mudela_tempo_p_;
-    mudela_tempo_p_ = new Mudela_tempo (useconds_per_4_i);
+  delete mudela_tempo_p_;
+  mudela_tempo_p_ = new Mudela_tempo (useconds_per_4_i);
 }
 
 void
 Mudela_staff::set_meter (int num_i, int den_i, int clocks_i, int count_32_i)
 {
-    delete mudela_meter_p_;
-    mudela_meter_p_ = new Mudela_meter (num_i, den_i, clocks_i, count_32_i);
+  delete mudela_meter_p_;
+  mudela_meter_p_ = new Mudela_meter (num_i, den_i, clocks_i, count_32_i);
 }
 
index 7b7dbb8244782e211a8624ca27a0fa03b83146e7..1f171bf8eda95192bb68b9c620fa9730b5498e1a 100644 (file)
@@ -16,28 +16,29 @@ static int const INDENT_i = 8;
 
 Mudela_stream::Mudela_stream (String filename_str)
 {
-    filename_str_ = filename_str;
-    os_p_ = 0;
-    indent_i_ = 0;
-    comment_mode_b_ = false;
-    column_i_ = 0;
-    wrap_column_i_ = 68;
-    open();
-    header();
+  filename_str_ = filename_str;
+  os_p_ = 0;
+  indent_i_ = 0;
+  comment_mode_b_ = false;
+  column_i_ = 0;
+  wrap_column_i_ = 68;
+  open();
+  header();
 }
 
 Mudela_stream::~Mudela_stream()
 {
-    delete os_p_;
-    if  (indent_i_)
+  delete os_p_;
+  if  (indent_i_)
        warning ("lily indent level: " + String (indent_i_));
 }
 
 Mudela_stream&
 Mudela_stream::operator << (String str)
 {
-    static String word_sep_str = "{} \t\n";
-    while  (str.length_i()) {
+  static String word_sep_str = "{} \t\n";
+  while  (str.length_i()) 
+    {
        int i = str.index_any_i (word_sep_str) + 1;
        if  (!i)
            i = str.length_i();
@@ -45,53 +46,55 @@ Mudela_stream::operator << (String str)
        str = str.mid_str (i, str.length_i());
        output_wrapped (word);
     }
-    return *this;
+  return *this;
 }
 
 Mudela_stream&
 Mudela_stream::operator << (Mudela_item& mudela_item_r)
 {
-    mudela_item_r.output (*this);
-    *os_p_ << flush;
-    return *this;
+  mudela_item_r.output (*this);
+  *os_p_ << flush;
+  return *this;
 }
 
 void
 Mudela_stream::handle_pending_indent()
 {
-    *os_p_ << String ('\t', pending_indent_i_);
-    column_i_ += pending_indent_i_ * INDENT_i;
-    pending_indent_i_ = 0;
+  *os_p_ << String ('\t', pending_indent_i_);
+  column_i_ += pending_indent_i_ * INDENT_i;
+  pending_indent_i_ = 0;
 }
 
 void
 Mudela_stream::header()
 {
-    *os_p_ << "% Creator: " << mi2mu_version_str() << "\n";
-    *os_p_ << "% Automatically generated, at ";
-    time_t t (time (0));
-    *os_p_ << ctime (&t);
-    *os_p_ << "% from input file: ";
-    *os_p_ << midi_parser_l_g->filename_str_;
-    *os_p_ << "\n\n";    
-    // ugh
-    *os_p_ << "\\version \"0.1.1\";\n";
+  *os_p_ << "% Creator: " << mi2mu_version_str() << "\n";
+  *os_p_ << "% Automatically generated, at ";
+  time_t t (time (0));
+  *os_p_ << ctime (&t);
+  *os_p_ << "% from input file: ";
+  *os_p_ << midi_parser_l_g->filename_str_;
+  *os_p_ << "\n\n";    
+  // ugh
+  *os_p_ << "\\version \"0.1.1\";\n";
 }
 
 void
 Mudela_stream::open()
 {
-    os_p_ = new ofstream (filename_str_);
-    if  (!*os_p_)
+  os_p_ = new ofstream (filename_str_);
+  if  (!*os_p_)
        error  ("can't open: `" + filename_str_ + "\'");
 }
 
 void
 Mudela_stream::output (String str)
 {
-    for  (int i = 0; i < str.length_i(); i++) {
+  for  (int i = 0; i < str.length_i(); i++) 
+    {
        char c = str[ i ];
-       switch  (c) {
+       switch  (c) 
+         {
            case '{' :
            case '<' :
                handle_pending_indent();
@@ -140,26 +143,28 @@ Mudela_stream::output (String str)
 void
 Mudela_stream::output_wrapped (String str)
 {
-    // enough room left -> doit
-    if  (column_i_ + str.length_i() <= wrap_column_i_) {
+  // enough room left -> doit
+  if  (column_i_ + str.length_i() <= wrap_column_i_) 
+    {
        output (str);
        return;
     }
 
-    // we're at BOL already; this will never fit -> doit
-    if  (column_i_ == indent_i_ * INDENT_i) {
+  // we're at BOL already; this will never fit -> doit
+  if  (column_i_ == indent_i_ * INDENT_i) 
+    {
        output (str);
        return;
     }
-    
-    // ok, let's wrap
-    // preserve comment mode
-    if  (comment_mode_b_)
+  
+  // ok, let's wrap
+  // preserve comment mode
+  if  (comment_mode_b_)
        output (String ("\n%"));
-    else 
+  else 
        output (String ("\n"));
-    
-    output (str);
+  
+  output (str);
 }
 
 
index 5fd2704726cbd3c9fdb447cf18722f37a02a2a2d..a22844b86b73961dfe22f66f7618962be952119f 100644 (file)
 
 Mudela_voice::Mudela_voice (Mudela_staff* mudela_staff_l)
 {
-    mudela_staff_l_ = mudela_staff_l;
+  mudela_staff_l_ = mudela_staff_l;
 }
 
 void
 Mudela_voice::add_item (Mudela_item* mudela_item_l)
 {
-    mudela_item_l_list_.bottom().add (mudela_item_l);
+  mudela_item_l_list_.bottom().add (mudela_item_l);
 }
 
 Moment 
 Mudela_voice::begin_mom()
 {
-    return mudela_item_l_list_.size() ? 
+  return mudela_item_l_list_.size() ? 
        mudela_item_l_list_.top()->at_mom() : Moment (0);
 }
 
 Moment 
 Mudela_voice::end_mom()
 {
-    return mudela_item_l_list_.size() ? 
+  return mudela_item_l_list_.size() ? 
        mudela_item_l_list_.bottom()->at_mom() : Moment (0);
 }
 
@@ -41,34 +41,37 @@ static int const FAIRLY_LONG_VOICE_i = 6;
 void
 Mudela_voice::output (Mudela_stream& mudela_stream_r)
 {
-    if  (!mudela_item_l_list_.size())
+  if  (!mudela_item_l_list_.size())
        return;
-    
-    if  (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
+  
+  if  (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
        mudela_stream_r << "\n";
 
-    int current_bar_i = 0;
-    Moment bar_mom = mudela_staff_l_->mudela_meter_p_->bar_mom();
+  int current_bar_i = 0;
+  Moment bar_mom = mudela_staff_l_->mudela_meter_p_->bar_mom();
 
-    for  (PCursor<Mudela_item*> i (mudela_item_l_list_); i.ok(); i++) {
+  for  (PCursor<Mudela_item*> i (mudela_item_l_list_); i.ok(); i++) 
+    {
        Moment at_mom = i->mudela_column_l_->at_mom();
        int bar_i = (int) (at_mom / bar_mom) + 1;
-       if  (bar_i > current_bar_i) {
-           if  (current_bar_i) {
+       if  (bar_i > current_bar_i) 
+         {
+           if  (current_bar_i) 
+             {
                if  (at_mom == Moment (bar_i - 1) * bar_mom)
                    mudela_stream_r << "|";
                mudela_stream_r << "\n% ";
                mudela_stream_r << String_convert::i2dec_str (bar_i, 0, ' ');
                mudela_stream_r << "\n";
-           }
+             }
            LOGOUT(NORMAL_ver) << '[' << bar_i << ']' << flush; 
            current_bar_i = bar_i;
-       }
+         }
 
-       mudela_stream_r << i->str();
+       mudela_stream_r << **i;
     }
 
-    if  (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
+  if  (mudela_item_l_list_.size() > FAIRLY_LONG_VOICE_i)
        mudela_stream_r << "\n";
 }
 
index 63dfb06d8f42b2991ecf9808006005021f9103ba..483fce69275bb20767fb1191102b0adfda535f8a 100644 (file)
 int
 yylex() 
 {
-    return midi_lexer_l_g->yylex();
+  return midi_lexer_l_g->yylex();
 }
 
 My_midi_lexer* midi_lexer_l_g = 0;
 
 My_midi_lexer::My_midi_lexer (String &filename_str, Sources * sources)
 {
-    source_file_l_ = sources->get_file_l(filename_str);
-    if  (!source_file_l_)
+  source_file_l_ = sources->get_file_l(filename_str);
+  if  (!source_file_l_)
        ::error  ("can't find: `" + filename_str + "'");
-    switch_streams (source_file_l_->istream_l(), 0);
-    errorlevel_i_ = 0;
-    char_count_ = 0;
-    running_status_i_ = 0;
+  switch_streams (source_file_l_->istream_l(), 0);
+  errorlevel_i_ = 0;
+  char_count_ = 0;
+  running_status_i_ = 0;
 }
 
 My_midi_lexer::~My_midi_lexer()
@@ -36,19 +36,23 @@ My_midi_lexer::~My_midi_lexer()
 void
 My_midi_lexer::error (char const* sz_l)
 {
-    if (1|| !source_file_l_) {
+  if (1|| !source_file_l_) 
+    {
        cerr << "error at EOF: `" << sz_l << "'\n";
-    } else {
+    }
+  else 
+    {
        
        // FIXME
        #if 0
        char const* ch_C = here_ch_C();
-       if  (ch_C) {
+       if  (ch_C) 
+         {
            ch_C--;
            while  ( (*ch_C == ' ') ||  (*ch_C == '\t') ||  (*ch_C == '\n'))
                ch_C--;
            ch_C++;
-       }
+         }
        errorlevel_i_ |= 1;
        error (sz_l);
        #endif
@@ -58,29 +62,30 @@ My_midi_lexer::error (char const* sz_l)
 char const*
 My_midi_lexer::here_ch_C()
 {
-    return source_file_l_->ch_C() + char_count_ ;
+  return source_file_l_->ch_C() + char_count_ ;
 }
 
 int
 My_midi_lexer::varint2_i (String str)
 {
-    int var_i = 0;
+  int var_i = 0;
 
-    for  (int i = 0; i < str.length_i(); i++) {
+  for  (int i = 0; i < str.length_i(); i++) 
+    {
        Byte byte = str[ i ];
        var_i <<= 7;
        var_i += byte & 0x7f;
        if  (!  (byte & 0x80))
            return var_i;
     }
-    cout << "\nvarint2_i:" << String_convert::bin2hex_str (str) << endl;
-    assert (0); // illegal varint
-    return 0;
+  cout << "\nvarint2_i:" << String_convert::bin2hex_str (str) << endl;
+  assert (0); // illegal varint
+  return 0;
 }
 
 int
 My_midi_lexer::close_i()
 {
-    return 0;
+  return 0;
 }
 
index d0ecf943ace9b5b110ac617d89becb6c9afed307..2a7e2d77bcf5216738b9d1e03b44925620c87274 100644 (file)
@@ -16,7 +16,7 @@
 void
 yyerror(char const* sz_l)
 {
-    midi_parser_l_g->error (sz_l);
+  midi_parser_l_g->error (sz_l);
 }
 
 
@@ -24,104 +24,105 @@ My_midi_parser* midi_parser_l_g = 0;
 
 My_midi_parser::My_midi_parser (String filename_str, Sources *sources_l)
 {
-    filename_str_ = filename_str;
-    midi_lexer_p_ = new My_midi_lexer (filename_str_,sources_l);
-    midi_lexer_l_g = midi_lexer_p_;    // ugh
+  filename_str_ = filename_str;
+  midi_lexer_p_ = new My_midi_lexer (filename_str_,sources_l);
+  midi_lexer_l_g = midi_lexer_p_;    // ugh
 
-    bar_i_ = 1;
+  bar_i_ = 1;
 
-    defined_ch_C_ = 0;
-    fatal_error_i_ = 0;
-    
-    mudela_column_l_ = 0;
-    mudela_score_p_ = new Mudela_score (1, 1, 1);
+  defined_ch_C_ = 0;
+  fatal_error_i_ = 0;
+  
+  mudela_column_l_ = 0;
+  mudela_score_p_ = new Mudela_score (1, 1, 1);
 
 
-    // ugh, belong to Mudela_{score,staff}
-    track_i_ = 0;
-    mudela_staff_l_ = 0;
-    mudela_key_p_ = 0;
-    mudela_tempo_p_ = 0;
-    mudela_meter_p_ = 0;
+  // ugh, belong to Mudela_{score,staff}
+  track_i_ = 0;
+  mudela_staff_l_ = 0;
+  mudela_key_p_ = 0;
+  mudela_tempo_p_ = 0;
+  mudela_meter_p_ = 0;
 
-    reset();
+  reset();
 }
 
 My_midi_parser::~My_midi_parser()
 {
-    midi_lexer_l_g = 0;    // ugh
+  midi_lexer_l_g = 0;    // ugh
 
-    delete midi_lexer_p_;
-    delete mudela_key_p_;
-    delete mudela_tempo_p_;
-    delete mudela_meter_p_;
-    delete mudela_score_p_;
+  delete midi_lexer_p_;
+  delete mudela_key_p_;
+  delete mudela_tempo_p_;
+  delete mudela_meter_p_;
+  delete mudela_score_p_;
 }
 
 void
 My_midi_parser::reset()
 {
 //    open_mudela_note_l_list_.clear();
-    open_mudela_note_l_list_.junk_links();
+  open_mudela_note_l_list_.junk_links();
 
-    // ugh
-    delete mudela_key_p_;
-    mudela_key_p_ = new Mudela_key (0, 0);
-    // useconds per 4: 250000 === 60 4 per minute
-    delete mudela_tempo_p_;
-    mudela_tempo_p_ = new Mudela_tempo (1000000);
-    delete mudela_meter_p_;
-    mudela_meter_p_ = new Mudela_meter (4, 2, 24, 8);
+  // ugh
+  delete mudela_key_p_;
+  mudela_key_p_ = new Mudela_key (0, 0);
+  // useconds per 4: 250000 === 60 4 per minute
+  delete mudela_tempo_p_;
+  mudela_tempo_p_ = new Mudela_tempo (1000000);
+  delete mudela_meter_p_;
+  mudela_meter_p_ = new Mudela_meter (4, 2, 24, 8);
 
-    bar_i_ = 1;
-    mudela_column_l_ = mudela_score_p_->mudela_column_l (0);
+  bar_i_ = 1;
+  mudela_column_l_ = mudela_score_p_->mudela_column_l (0);
 
-    // ugh
-    copyright_str_ = "";
-    track_name_str_ = "";
-    instrument_str_ = "";
+  // ugh
+  copyright_str_ = "";
+  track_name_str_ = "";
+  instrument_str_ = "";
 }
 
 void
 My_midi_parser::add_score (Mudela_score* mudela_score_p)
 {
-    assert (mudela_score_p_);
+  assert (mudela_score_p_);
 
 #if 0 // ugh, already constructed
-    mudela_score_p_ = mudela_score_p;
-    if  (!mudela_column_l_)
+  mudela_score_p_ = mudela_score_p;
+  if  (!mudela_column_l_)
        mudela_column_l_ = mudela_score_p_->mudela_column_l (0);
 #endif
        
-    mudela_score_p_->mudela_key_l_ = mudela_key_p_;
-    mudela_score_p_->mudela_meter_l_ = mudela_meter_p_;
-    mudela_score_p_->mudela_tempo_l_ = mudela_tempo_p_;
-    bar_i_ = 1;
+  mudela_score_p_->mudela_key_l_ = mudela_key_p_;
+  mudela_score_p_->mudela_meter_l_ = mudela_meter_p_;
+  mudela_score_p_->mudela_tempo_l_ = mudela_tempo_p_;
+  bar_i_ = 1;
 }
 
 void
 My_midi_parser::error (char const* sz_l)
 {
-    midi_lexer_l_g->error (sz_l);
+  midi_lexer_l_g->error (sz_l);
 
-    if  (fatal_error_i_)
+  if  (fatal_error_i_)
        exit (fatal_error_i_);
 }
 
 void
 My_midi_parser::forward (int i)
 {
-    if  (!i)
+  if  (!i)
        return;
 
-    Duration dur;
-    dur.type_i_ = (0);
-    dur.set_ticks (i);
-    Moment mom = at_mom() + Duration_convert::dur2_mom (dur);
+  Duration dur;
+  dur.durlog_i_ = -100;
+  dur.set_ticks (i);
+  Moment mom = at_mom() + Duration_convert::dur2_mom (dur);
 
-    mudela_column_l_ = mudela_score_p_->mudela_column_l (mom);
+  mudela_column_l_ = mudela_score_p_->mudela_column_l (mom);
 
-    if  (i) {
+  if  (i) 
+    {
        int bars_i = (int) (mom / mudela_meter_p_->bar_mom());
        if  (bars_i > bar_i_)
            LOGOUT(NORMAL_ver) << '[' << bar_i_ << ']' << flush; 
@@ -132,42 +133,44 @@ My_midi_parser::forward (int i)
 Moment
 My_midi_parser::at_mom()
 {
-    assert (mudela_column_l_);
+  assert (mudela_column_l_);
 //    return mudela_column_l_ ? mudela_column_l_->at_mom() : 0;
-    return mudela_column_l_->at_mom();
+  return mudela_column_l_->at_mom();
 }
 
 void
 My_midi_parser::note_begin (int channel_i, int pitch_i, int dyn_i)
 {
-    // junk dynamics
-    (void)dyn_i;
+  // junk dynamics
+  (void)dyn_i;
 
-    Mudela_note* p = new Mudela_note (mudela_column_l_, channel_i, pitch_i, dyn_i);
+  Mudela_note* p = new Mudela_note (mudela_column_l_, channel_i, pitch_i, dyn_i);
 //  ugh, score doesn't know about last staff yet...
 //    mudela_score_p_->add_item (p);
-    mudela_staff_l_->add_item (p);
-    open_mudela_note_l_list_.bottom().add (p);
+  mudela_staff_l_->add_item (p);
+  open_mudela_note_l_list_.bottom().add (p);
 }
 
 void
 My_midi_parser::note_end (int channel_i, int pitch_i, int aftertouch_i)
 {
-    // junk dynamics
-    (void)aftertouch_i;
+  // junk dynamics
+  (void)aftertouch_i;
 
-    // find 
-    for  (PCursor<Mudela_note*> i (open_mudela_note_l_list_); i.ok(); i++) {
-       if  ( (i->pitch_i_ == pitch_i) &&  (i->channel_i_ == channel_i)) {
+  // find 
+  for  (PCursor<Mudela_note*> i (open_mudela_note_l_list_); i.ok(); i++) 
+    {
+       if  ( (i->pitch_i_ == pitch_i) &&  (i->channel_i_ == channel_i)) 
+         {
            i->end_column_l_ = mudela_column_l_;
            LOGOUT(DEBUG_ver) << "Note: " << pitch_i;
            LOGOUT(DEBUG_ver) << "; " << i->mudela_column_l_->at_mom_;
            LOGOUT(DEBUG_ver) << ", " << i->end_column_l_->at_mom_ << "\n";
            i.remove_p();
            return;
-       }
+         }
     }
-    warning (String ("junking note-end event: ")
+  warning (String ("junking note-end event: ")
        + " channel = " + String_convert::i2dec_str (channel_i, 0, ' ')
        + ", pitch = " + String_convert::i2dec_str (pitch_i, 0, ' '));
 }
@@ -175,8 +178,9 @@ My_midi_parser::note_end (int channel_i, int pitch_i, int aftertouch_i)
 void
 My_midi_parser::note_end_all()
 {
-    // find 
-    for  (PCursor<Mudela_note*> i (open_mudela_note_l_list_); i.ok(); i++) {
+  // find 
+  for  (PCursor<Mudela_note*> i (open_mudela_note_l_list_); i.ok(); i++) 
+    {
        i->end_column_l_ = mudela_column_l_;
        i.remove_p();
        // ugh
@@ -188,41 +192,41 @@ My_midi_parser::note_end_all()
 int
 My_midi_parser::parse()
 {
-    LOGOUT(NORMAL_ver) << "\nParsing..." << flush;
-    int i = ::yyparse();
-    if  (!i)
+  LOGOUT(NORMAL_ver) << "\nParsing..." << flush;
+  int i = ::yyparse();
+  if  (!i)
        note_end_all();
-    return i;
+  return i;
 }
 
 void
 My_midi_parser::set_division_4 (int division_4_i)
 {
-    division_1_i_ = division_4_i * 4;
-    // ugh
-    Duration::division_1_i_s = division_1_i_;
-    if  (division_4_i < 0)
+  division_1_i_ = division_4_i * 4;
+  // ugh
+  Duration::division_1_i_s = division_1_i_;
+  if  (division_4_i < 0)
        warning ("seconds iso metrical time");
 }
 
 void
 My_midi_parser::set_key (int accidentals_i, int minor_i)
 {
-    delete mudela_key_p_;
-    mudela_key_p_ = new Mudela_key (accidentals_i, minor_i);
+  delete mudela_key_p_;
+  mudela_key_p_ = new Mudela_key (accidentals_i, minor_i);
 }
 
 void
 My_midi_parser::set_meter (int num_i, int den_i, int clocks_i, int count_32_i)
 {
-    delete mudela_meter_p_;
-    mudela_meter_p_ = new Mudela_meter (num_i, den_i, clocks_i, count_32_i);
+  delete mudela_meter_p_;
+  mudela_meter_p_ = new Mudela_meter (num_i, den_i, clocks_i, count_32_i);
 }
 
 void
 My_midi_parser::set_tempo (int useconds_per_4_i)
 {
-    delete mudela_tempo_p_;
-    mudela_tempo_p_ = new Mudela_tempo (useconds_per_4_i);
+  delete mudela_tempo_p_;
+  mudela_tempo_p_ = new Mudela_tempo (useconds_per_4_i);
 }
 
index 1c630664d85b8d7c2ba772c3110bbc48ed86d69e..57299cd3581d1a74b7e78207013246b78c0496f1 100644 (file)
@@ -7,7 +7,7 @@ const char * mi2mu_version_sz();
 String
 mi2mu_version_str()
 {
-    return  String (mi2mu_version_sz())
+  return  String (mi2mu_version_sz())
        + "/" + flower_version_sz()
        + " of " +  __DATE__ + " " + __TIME__;
 }
index e51404f93ee549b9c7c000b7c9f562d7f59ba3c3..d671a2a27a80697c576abe435e0767ec81fcc2c0 100644 (file)
 \mdef\quartball{'007}
 \mdef\halfball{'010}
 \mdef\wholeball{'011}
+\mdef\breveball{'040}
 \mdef\halfrest{'074}
 \mdef\wholerest{'075}
+\mdef\breverest{'072}
 %% hmm
 \mdef\outsidehalfrest{10}
 \mdef\outsidewholerest{11}