From afa5829cd270e1b0c616b7ba5c5e6cdc0e920e5f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 4 Jan 1999 10:25:45 +0100 Subject: [PATCH] release: 1.1.18 --- BUGS | 6 - Documentation/README-W32.yo | 164 ++--- Documentation/man/out/ly2dvi.1 | 152 +++- Documentation/ntweb/index.yo | 23 +- INSTALL.txt | 66 +- NEWS | 41 +- README.txt | 129 ++-- TODO | 27 +- VERSION | 4 +- aclocal.m4 | 18 +- configure | 94 +-- flower/dictionary.cc | 39 - flower/dstream.cc | 31 +- flower/file-path.cc | 4 +- flower/hash.cc | 10 + flower/include/assoc-iter.hh | 39 - flower/include/assoc.hh | 90 --- flower/include/dictionary-iter.hh | 38 +- flower/include/dictionary.hh | 103 ++- flower/include/dstream.hh | 5 +- flower/include/fproto.hh | 3 + flower/include/parray.hh | 102 +-- init/engraver.ly | 10 +- init/property.ly | 16 +- init/table11.ly | 2 +- init/table13.ly | 2 +- init/table16.ly | 2 +- init/table20.ly | 2 +- init/table26.ly | 2 +- input/test/chords.ly | 2 +- input/test/spacing-2.ly | 36 + lily/abbrev.cc | 2 +- lily/abbreviation-beam.cc | 4 +- lily/afm-list.cc | 49 ++ lily/afm-reader.cc | 19 +- lily/afm.cc | 17 +- lily/atom.cc | 1 + lily/bar-column-engraver.cc | 2 +- lily/bar-engraver.cc | 4 +- lily/bar-number-engraver.cc | 4 +- lily/bar.cc | 2 +- lily/beam-engraver.cc | 223 +++--- lily/beam.cc | 18 +- lily/bow.cc | 6 +- lily/cbeam-engraver.cc | 164 ----- lily/chord-name-engraver.cc | 34 +- lily/clef-engraver.cc | 2 +- lily/clef-item.cc | 2 +- lily/col-info.cc | 2 +- lily/command-request.cc | 3 - lily/crescendo.cc | 4 +- lily/dimension-cache.cc | 151 ++++ lily/directional-spanner.cc | 2 +- lily/dot-column.cc | 4 +- lily/dots.cc | 2 +- lily/dynamic-engraver.cc | 131 ++-- lily/encompass-info.cc | 2 +- lily/extender-spanner.cc | 10 +- lily/font-size-engraver.cc | 2 +- lily/g-staff-side.cc | 78 ++ lily/g-text-item.cc | 26 + lily/graphical-axis-group.cc | 43 +- lily/graphical-element.cc | 153 ++-- lily/horizontal-group-item.cc | 2 +- lily/horizontal-vertical-group-element.cc | 4 +- lily/horizontal-vertical-group-item.cc | 4 +- lily/include/abbrev.hh | 2 +- lily/include/abbreviation-beam.hh | 2 +- lily/include/afm.hh | 9 +- lily/include/all-fonts.hh | 34 + lily/include/bar.hh | 2 +- lily/include/beam-engraver.hh | 50 +- lily/include/beam.hh | 2 +- lily/include/bow.hh | 2 +- lily/include/break-caching.hh | 23 - lily/include/cbeam-engraver.hh | 39 - lily/include/chord-name-engraver.hh | 2 +- lily/include/clef-item.hh | 2 +- lily/include/command-request.hh | 4 - lily/include/crescendo.hh | 2 +- lily/include/dimension-cache.hh | 57 ++ lily/include/dots.hh | 2 +- lily/include/dynamic-engraver.hh | 22 - lily/include/extender-spanner.hh | 2 +- lily/include/g-staff-side.hh | 40 + lily/include/g-text-item.hh | 28 + lily/include/graphical-axis-group.hh | 2 +- lily/include/graphical-element.hh | 30 +- lily/include/ineq-constrained-qp.hh | 19 +- lily/include/key-item.hh | 2 +- lily/include/lily-proto.hh | 5 + lily/include/linear-programming.hh | 47 -- lily/include/local-key-item.hh | 2 +- lily/include/lookup.hh | 7 +- lily/include/lyric-engraver.hh | 15 - lily/include/main.hh | 3 + lily/include/multi-measure-rest.hh | 2 +- lily/include/music-list-iterator.hh | 2 - lily/include/musical-request.hh | 22 +- lily/include/note-column.hh | 2 +- lily/include/note-head.hh | 2 +- lily/include/paper-def.hh | 2 +- lily/include/plet-swallow-engraver.hh | 28 - lily/include/qlpsolve.hh | 4 +- lily/include/request.hh | 13 + lily/include/rest.hh | 2 +- lily/include/score-element.hh | 6 +- lily/include/score-priority-engraver.hh | 3 +- lily/include/script.hh | 2 +- lily/include/sequential-music-iterator.hh | 2 - lily/include/simultaneous-music-iterator.hh | 2 - lily/include/span-bar.hh | 2 +- lily/include/spanner.hh | 2 +- lily/include/staff-sym.hh | 2 +- lily/include/stem-engraver.hh | 1 - lily/include/stem.hh | 2 +- lily/include/symtable.hh | 9 +- lily/include/text-item.hh | 18 +- lily/include/text-spanner.hh | 2 +- .../{ctie-engraver.hh => tie-engraver.hh} | 8 +- lily/include/ties-engraver.hh | 51 -- lily/include/time-signature.hh | 2 +- lily/include/translator.hh | 2 +- lily/include/tuplet-spanner.hh | 2 +- lily/include/volta-spanner.hh | 2 +- lily/ineq-constrained-qp.cc | 10 +- lily/item.cc | 21 +- lily/key-engraver.cc | 4 +- lily/key-item.cc | 2 +- lily/line-group-group-engraver.cc | 2 +- lily/line-of-score.cc | 2 +- lily/linear-programming.cc | 115 --- lily/local-key-item.cc | 10 +- lily/lookup.cc | 108 +-- lily/lyric-engraver.cc | 46 +- lily/main.cc | 10 +- lily/mark-engraver.cc | 10 +- lily/midi-def.cc | 5 +- lily/misc.cc | 2 +- lily/multi-measure-rest.cc | 3 +- lily/music-list-iterator.cc | 6 - lily/musical-request.cc | 8 - lily/my-lily-lexer.cc | 2 - lily/note-column.cc | 23 +- lily/note-head.cc | 2 +- lily/note-performer.cc | 2 +- lily/p-score.cc | 6 +- lily/paper-def.cc | 22 +- lily/paper-outputter.cc | 2 +- lily/parser.yy | 8 +- lily/plet-engraver.cc | 132 ---- lily/plet-swallow-engraver.cc | 19 - lily/repeat-engraver.cc | 2 +- lily/rest.cc | 2 +- lily/rhythmic-column-engraver.cc | 4 +- lily/rhythmic-head.cc | 8 +- lily/score-element.cc | 33 +- lily/score-engraver.cc | 13 +- lily/score-priority-engraver.cc | 25 +- lily/script-engraver.cc | 4 +- lily/script.cc | 2 +- lily/separating-line-group-engraver.cc | 2 +- lily/sequential-music-iterator.cc | 9 +- lily/simultaneous-music-iterator.cc | 12 +- lily/single-malt-grouping-item.cc | 2 +- lily/slur-engraver.cc | 6 +- lily/slur.cc | 14 +- lily/span-bar-engraver.cc | 2 +- lily/span-bar.cc | 10 +- lily/spanner.cc | 7 +- lily/spring-spacer.cc | 46 +- lily/staff-margin-engraver.cc | 6 +- lily/staff-performer.cc | 4 +- lily/staff-side.cc | 9 +- lily/staff-sym-engraver.cc | 2 +- lily/staff-sym.cc | 4 +- lily/stem-engraver.cc | 44 +- lily/stem.cc | 18 +- lily/super-element.cc | 2 +- lily/symtable.cc | 4 +- lily/template4.cc | 4 - lily/template8.cc | 2 +- lily/text-engraver.cc | 112 +++ lily/text-item.cc | 2 +- lily/text-spanner.cc | 4 +- lily/{ctie-engraver.cc => tie-engraver.cc} | 22 +- lily/tie.cc | 4 +- lily/ties-engraver.cc | 154 ---- lily/time-signature-engraver.cc | 2 +- lily/time-signature.cc | 2 +- lily/timing-translator.cc | 2 +- lily/translator.cc | 8 +- lily/tuplet-spanner.cc | 4 +- lily/vertical-align-engraver.cc | 10 +- lily/vertical-group-spanner.cc | 5 +- lily/volta-spanner.cc | 10 +- make/out/lelievijver.lsm | 8 +- make/out/lilypond.lsm | 8 +- make/out/lilypond.spec | 4 +- mf/cmbase.mf | 697 ++++++++++++++++++ mi2mu/mudela-item.cc | 1 + mi2mu/mudela-staff.cc | 2 +- mutopia/D.Scarlatti/GNUmakefile | 10 + mutopia/GNUmakefile | 2 +- mutopia/J.S.Bach/wtk1-fugue1.ly | 57 +- mutopia/J.S.Bach/wtk1-fugue2.ly | 3 +- scm/lily.scm | 9 +- scripts/ly2dvi.py | 26 +- stepmake/aclocal.m4 | 18 +- stepmake/bin/package-zip32.sh | 2 +- stepmake/stepmake/generic-targets.make | 2 +- 211 files changed, 2913 insertions(+), 2256 deletions(-) delete mode 100644 flower/dictionary.cc delete mode 100644 flower/include/assoc-iter.hh delete mode 100644 flower/include/assoc.hh create mode 100644 input/test/spacing-2.ly create mode 100644 lily/afm-list.cc delete mode 100644 lily/cbeam-engraver.cc create mode 100644 lily/dimension-cache.cc create mode 100644 lily/g-staff-side.cc create mode 100644 lily/g-text-item.cc create mode 100644 lily/include/all-fonts.hh delete mode 100644 lily/include/break-caching.hh delete mode 100644 lily/include/cbeam-engraver.hh create mode 100644 lily/include/dimension-cache.hh create mode 100644 lily/include/g-staff-side.hh create mode 100644 lily/include/g-text-item.hh delete mode 100644 lily/include/linear-programming.hh delete mode 100644 lily/include/plet-swallow-engraver.hh rename lily/include/{ctie-engraver.hh => tie-engraver.hh} (89%) delete mode 100644 lily/include/ties-engraver.hh delete mode 100644 lily/linear-programming.cc delete mode 100644 lily/plet-engraver.cc delete mode 100644 lily/plet-swallow-engraver.cc create mode 100644 lily/text-engraver.cc rename lily/{ctie-engraver.cc => tie-engraver.cc} (82%) delete mode 100644 lily/ties-engraver.cc create mode 100644 mf/cmbase.mf create mode 100644 mutopia/D.Scarlatti/GNUmakefile diff --git a/BUGS b/BUGS index 1651e800d6..76d8f8e1a0 100644 --- a/BUGS +++ b/BUGS @@ -3,12 +3,6 @@ This documents serious bugs ******** -[Linux Intel, EGCS-1.1b] - -Compiling with -O2 -finline-functions will cause crashes during -parsing stage. - - [Linux ppc, egcs-1.0.2] All compiling with -O2 is suspect, in particular guile-1.3, and diff --git a/Documentation/README-W32.yo b/Documentation/README-W32.yo index 579642fc23..41b0412403 100644 --- a/Documentation/README-W32.yo +++ b/Documentation/README-W32.yo @@ -145,17 +145,17 @@ lurl(http://www.cygnus.com/misc/gnu-win32/) Please follow the documentation Cygnus has on there web site for downloading and installing. The important part is that you down load -the entire development kit. I believe it is file(cdk.exe). The +the entire development kit. I believe it is file(full.exe). The installation will ask you where you want to install it. I will refer -to Cygnus installation directory as file(/gnuwin32/b19). There should be a -file(README) file that contains installation instructions. After the -installation is complete you should have a em(Cygnus) shortcut in your -em(Program) section of your em(Start Menu). This shortcut is your -door to the tt(UNIX) world and I will refer to the resulting window -as a file(bash) shell. +to Cygnus installation directory as file(/gnuwin32/cygwin-b20). There +should be a file(README) file that contains installation instructions. +After the installation is complete you should have a em(Cygnus) +shortcut in your em(Program) section of your em(Start Menu). This +shortcut is your door to the tt(UNIX) world and I will refer to the +resulting window as a file(bash) shell. -The shortcut points to file(/gnuwin32/b19/cygnus.bat). The following -is my file(cygnus.bat) file. +The shortcut points to file(/gnuwin32/cygwin-b20/cygnus.bat). The +following is my file(cygnus.bat) file. verb( @ECHO OFF @@ -167,26 +167,26 @@ SET CYGREL=B19.1 SET MAKE_MODE=unix SET LOCAL_ROOT=d:\gnuwin32 SET LOCAL_FS=d:/gnuwin32 -SET LOCAL_DIR=/gnuwin32 -SET CYGROOT=%LOCAL_ROOT%\b19 -SET CYGFS=%LOCAL_FS%/b19 -SET GCC_EXEC_PREFIX=%CYGROOT%\H-i386-cygwin32\lib\gcc-lib\ +SET LOCAL_DIR=d:/gnuwin32/cygwin-b20 +SET CYGROOT=%LOCAL_ROOT%\cygwin-b20 +SET CYGFS=%LOCAL_FS%/cygwin-b20 SET TCL_LIBRARY=%CYGROOT%\share\tcl8.0\ -SET GDBTK_LIBRARY=%CYGFS%/share/gdbtcl +rem rem This was not in the original but is needed by lots of packages +rem SET BISON_SIMPLE=%CYGFS%/share/bison.simple +rem rem I place the cygnus stuff in front of /WINNT -SET PATH=d:\bin;%CYGROOT%\H-i386-cygwin32\bin;%PATH% -SET MANPATH=%LOCAL_ROOT%\man;%LOCAL_ROOT%\b19\man;%LOCAL_ROOT%\b19\cdk-man\man;%LOCAL_ROOT%\a2ps-4.10\man -SET INFOPATH=%LOCAL_FS%/b19/cdk-man/info;%LOCAL_FS%/b19/info;%LOCAL_DIR%/info -SET PATH=%PATH%;%LOCAL_ROOT%\bin +rem +SET PATH=d:\bin;%LOCAL_ROOT%\bin;%CYGROOT%\H-i586-cygwin32\bin;%PATH% +SET MANPATH=%LOCAL_ROOT%\man;%LOCAL_ROOT%\cygwin-b20\full-man\man +SET INFOPATH=%LOCAL_FS%/cygwin-b20/full-man/info;%LOCAL_FS%/cygwin-b20/info;%LOCAL_DIR%/info rem General tools not included with Cygnus Development Kit - rem CVS SET PATH=%PATH%;%LOCAL_ROOT%\cvs-1.9.28\bin @@ -238,31 +238,21 @@ that the generic file(cygnus.bat) you will be looking at does not include alot of the packages listed. We will be installing some of these. -There is also some discussion of how you want to em(mount) the Cygnus -development kit. em(mount) is a tt(UNIX) term that refers to the -mechanism used to provide a disk resource to the filesystem. Cygnus -supplies a mechinism for em(mounting) a filesystem as a tt(DOS) like -resource or a tt(UNIX) like resource. Among other things this -attempts to deal with the text file carriage return line feed on -tt(DOS) versus the line feed on tt(UNIX) and the issue that tt(DOS) -has two file types, text and binary. Where tt(UNIX) deals with a -single streams type. I have used the default out of the box -configuration with no problems. We will however later discuss -mounting a directory as a binary resource ref(binary). The installation also suggests that you create a directory file(/bin) -and copy file(/gnuwin32/b19/H-i386-cygwin32/bin/sh.exe) to file(/bin). -The file(sh.exe) shell provided by Cygnus is a descendant of the -file(ash) shell and I have found that some of the tt(GNU) products -configure/installations work better with the file(bash) shell. So -this is my recommendation for post installation steps. From a +and copy file(/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/sh.exe) to +file(/bin). The file(sh.exe) shell provided by Cygnus is a descendant +of the file(ash) shell. The file(sh.exe) shell has improved greatly +and is much faster than the file(bash) shell for script invocations. +So this is my recommendation for post installation steps. From a file(bash) shell: itemize( it()code(cd /) it()code(mkdir bin) it()code(cd /bin) -it()code(cp /gnuwin32/b19/H-i386-cygwin32/bin/bash.exe sh.exe) +it()code(cp /gnuwin32/cygwin-b20/H-i586-cygwin32/bin/sh.exe sh.exe) +it()code(cp /gnuwin32/cygwin-b20/H-i586-cygwin32/bin/bash.exe bash.exe) it()code(cd /) it()code(mkdir /tmp) it()code(chmod a+rwx tmp) @@ -272,42 +262,33 @@ it()code(mkpasswd -l > passwd) it()code(mkgroup -l > group) ) -subsubsect(Ecgs Compiler, assembler, and linker) -lurl(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs.html) - - -Cygnus recommends using the ecgs compiler. I do too. Follow the -instructions from the above site to install ecgs compiler/linker and -the gas assembler. We have attempted to compile lilypond with the -Cygnus default compiler/linker with poor results. So for lilypond -anyway this step is a requirement. +subsubsubsect(Binary Mounts) label(binary) -I took the following steps to download and install the ecgs suite. -Keep in mind that it is better to follow the instructions from the -indicated website. +There is also some discussion of how you want to em(mount) the Cygnus +development kit. em(mount) is a tt(UNIX) term that refers to the +mechanism used to provide a disk resource to the filesystem. Cygnus +supplies a mechinism for em(mounting) a filesystem as a tt(DOS) like +resource or a tt(UNIX) like resource. Among other things this +attempts to deal with the text file carriage return line feed on +tt(DOS) versus the line feed on tt(UNIX) and the issue that tt(DOS) +has two file types, text and binary. Where tt(UNIX) deals with a +single streams type. My opinion on this matter currently is to use +binary mounts only. This can be accomplished by: itemize( -it()download -url(egcs-1.0.2-cygb19.tar.gz)(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin32/b19-releases/egcs-1.0.2-cygb19.tar.gz) -to /tmp -it()download -url(gas-980303-cygb19.tar.gz)(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin32/b19-releases/gas-980303-cygb19.tar.gz) -to /tmp -it() read -url(INSTALL)(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs-cygb19-install.html) +it() From a bash shell, umount / +it() mount -b d: / ) -In a bash shell -itemize( -it() cd $CYGFS/include -it() mv g++ g++-b19 -it() cd $CYGFS -it() tar zxf /tmp/gas-980303-cygb19.tar.gz -it() tar zxf /tmp/egcs-1.0.2-cygb19.tar.gz -) +If you have other disks that you intend to use for data generated by +cygnus tools you will have to mount those devices with the em(-b) +switch. + + +subsubsect(Ecgs Compiler, assembler, and linker) +lurl(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/egcs.html) -You now have a compiler, assembler, linker combination capable of -compiling lilypond. +Cygnus now distributes the ecgs compiler with cygwin-b20. subsubsect(bf(GNU)'s Internationalization Package) lurl(http://www.gnu.org/order/ftp.html) @@ -323,7 +304,7 @@ used to help alleviate this problem. verb( #!/bin/sh -realinstall=/gnuwin32/b19/H-i386-cygwin32/bin/install.exe +realinstall=/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/install.exe args='' while [ $# -ne 0 ] do @@ -355,7 +336,7 @@ it() download the package from one of the ftp sites. it() From a bash shell, cd ~/usr/src. it() tar zxf gettext-0.10.tar.gz it() cd gettext-0.10 -it() ./configure --prefix=$CYGFS/H-i386-cygwin32 +it() ./configure --prefix=$CYGFS/H-i586-cygwin32 it() make it() make install ) @@ -402,12 +383,10 @@ $HOME/usr/src/ description( dit(releases/) Downloaded and generated releases live here. For -example file(yodl-1.30.0.pre12.tar.gz) and -file(lilypond-0.1.81.tar.gz). +example file(yodl-1.31.7.tar.gz) and file(lilypond-1.1.17.tar.gz). dit(patches/) Downloaded and generated patches live here. For -example file(yodl-1.30.0.pre12.diff.gz) and -file(lilypond-0.1.81.diff.gz). +example file(yodl-1.31.7.diff.gz) and file(lilypond-1.1.17.diff.gz). dit(test/) This directory is used to generate releases and patches. @@ -434,17 +413,37 @@ For example: verb(\ rem yodl -SET PATH=%PATH%;%LOCAL_ROOT%\yodl-1.30.0.pre12\bin +SET PATH=%PATH%;%LOCAL_ROOT%\yodl-1.31.7\bin ) ) -subsubsubsect(Yodl build CAVEAT) +subsubsect(guile) + +GUILE, GNU's Ubiquitous Intelligent Language for Extension, is a +library that implements the Scheme language plus various convenient +facilities. It's designed so that you can link it into an application +or utility to make it extensible. GNU's plan is to link this library +into all GNU programs that call for extensibility. + +itemize( +it() download guile-1.3 patch from +lurl(http://www.realtime.net/~daboys/lilypond/guile.patch) and save it +to file(/tmp/guile.patch). +it() download guile-1.3 from one of GNU's ftp sites. +it() From a bash shell, tar zxf guile-1.3.tar.gz +it() cd guile-1.3 +it() patch -p2 < /tmp/guile.patch +it() LD=/gnuwin32/cygwin-b20/H-i586-cygwin32/bin/ld \ nl() + ./configure --prefix=$CYGFS/H-i586-cygwin32 +it() make sure bin_PROGRAMS macro in libguile/Makefile does em(not) have the +.exe extension during the build +it() make +it() make sure bin_PROGRAMS in libguile/Makefile em(does) have the +.exe extension during the install. Yuck. +it() make install +) -em(yodl) uses the em(stepmake) package for it's build methodology. -The build of em(stepmake) documentation will fail due to the fact -that em(yodl) is not yet installed. This is normal and shouldn't be a -problem. subsubsect(LilyPond) label(lilybuild) itemize( @@ -455,10 +454,7 @@ it() From a bash shell, cd file($HOME/usr/src). it() tar zxf releases/lilypond-em().tar.gz it() cd lilypond-em() it() ./configure --prefix=/gnuwin32/lilypond-em() \ nl() - --srcdir=. \ nl() - --enable-tex-prefix=/gnuwin32/lilypond-em()/texmf \ nl() - --enable-tex-dir=/gnuwin32/lilypond-em()/texmf/tex \ nl() - --enable-mf-dir=/gnuwin32/lilypond-em()/texmf/mf nl() + --srcdir=. nl() Since em(lilypond) is under development I choose to install it in a version rooted directory. This allows me to test newly released versions without losing a known working version. @@ -469,7 +465,7 @@ For example: verb(\ rem lilypond -SET PATH=%PATH%;%LOCAL_ROOT%\lilypond-0.1.80\bin +SET PATH=%PATH%;%LOCAL_ROOT%\lilypond-1.1.17\bin ) ) @@ -489,7 +485,7 @@ itemize( it() obtain python source from lurl(http://www.python.org) it() tar zxf /tmp/python-em().tar.gz it() cd python-em() -it() configure --prefix=/gnuwin32/python-em() +it() configure --prefix=/gnuwin32/Python-em() it() edit toplevel file(Makefile) code(EXE) macro so it reads code(EXE=.exe) it() make it() make install diff --git a/Documentation/man/out/ly2dvi.1 b/Documentation/man/out/ly2dvi.1 index 941b15e780..f2f8b0a818 100644 --- a/Documentation/man/out/ly2dvi.1 +++ b/Documentation/man/out/ly2dvi.1 @@ -1,22 +1,25 @@ -.TH "LilyPond" "1" "1998" "The LilyPond package" "Ly2dvi" +.TH "LilyPond" "1" "1998" "The LilyPond package" "Ly2dvi32" .PP .PP .SH "NAME" -Ly2dvi \- convert mudela to DVI +Ly2dvi32 \- Python utility to convert mudela to DVI .PP .SH "DESCRIPTION" -ly2dvi is a shell script which creates input file for LaTeX, -based on information from the output files from lilypond\&. +ly2dvi is a Python script which creates input file for LaTeX, +based on information from the output files from LilyPond\&. The script handles multiple files\&. If a mudela file name is -specified lilypond is run to make an output (TeX) file\&. +specified LilyPond is run to make an output (TeX) file\&. .PP One or more LaTeX files are created, based on information found in the output (TeX) files, and latex is finally run to create one or more DVI files\&. .PP +The majority of this utility came from a bourne script written by Jan +Arne Fagertun name \fBly2dvi\fP\&. +.PP .SH "SYNOPSIS" .PP -ly2dvi [options] inputfile[\&.ly] [\&.\&.\&.\&.] +ly2dvi32 [options] inputfile[\&.ly] [\&.\&.\&.\&.] .PP .SH "OPTIONS" .PP @@ -42,6 +45,8 @@ Set landscape orientation - portrait is the default\&. Switch off page numbering\&. .IP "-O,--orientation=" Set orientation landscape - obsolete, use \fB-L\fP instead\&. +.IP "-P,--postscript" +In addition to the DVI file, also Generate a postsript file\&. .IP "-W,--Width=" Set paper width (points)\&. Used together with heigth and LaTeX name of papersize in case of papersize unknown to ly2dvi\&. @@ -82,6 +87,8 @@ Specify name of papersize\&. .PP .SH "Environment" .PP +.IP "LILYPONDPREFIX" +Sets the root directory of the LilyPond installation .IP "LILYINCLUDE" Additional directories for input files\&. .IP "TMP" @@ -97,37 +104,117 @@ version the following are defined: The title of the music\&. Centered on top of the first page\&. .IP "subtitle" Subtitle, centered below the title\&. +.IP "poet" +Name of the poet, leftflushed below the below subtitle\&. .IP "composer" Name of the composer, rightflushed below the subtitle\&. +.IP "metre" +Meter string, leftflushed below the below poet\&. +.IP "opus" +Name of the opus, rightflushed below the below composer\&. .IP "arranger" -Name of the arranger, rightflushed below the composer\&. +Name of the arranger, rightflushed below the opus\&. .IP "instrument" -Name of the instrument, leftflushed at same level as the composer\&. +Name of the instrument, centered below the arranger +.IP "piece" +Name of the piece, leftflushed below the instrument .PP -\fB/usr/local/share/lilyrc /etc/lilyrc $HOME/\&.lilyrc \&./\&.lilyrc\fP -are files to set up default running conditions/variables, Bourne shell -syntax\&. All files are parsed, in the shown sequence\&. The variables are -overridden by variables in the mudela file, and by command line options\&. -In the current version the following are allowed: +\fB$LILYPONDPREFIX/share/\&.lilyrc $HOME/\&.lilyrc \&./\&.lilyrc\fP are files +to set up default running conditions\&. On Windows OS initialization +files are named \fB_lilyrc\fP\&. The file syntax is as follows: .PP -.IP "LANGUAGE=" -Specify LaTeX language\&. -.IP "LATEXHF=" -Specify additional LaTeX headers file -.IP "LILYINCLUDE=" -Additional directories for input files\&. -.IP "ORIENTATION=" -Set orientation - portrait is the default\&. -.IP "OUTPUTDIR=" -Set output directory\&. -.IP "PAPERSIZE=" -Specify name of papersize\&. -.IP "PHEIGTH=" + +.DS + +VARIABLE-NAME=VALUE +.DE + + +.PP +Where \fBVARIABLE-NAME\fP is the name of the variable documented below +and \fBVALUE\fP is either a string, a 1, or a 0\&. All files are parsed, +in the shown sequence\&. In the current version the following are +allowed: +.PP +.IP "DEBUG=value" +This turns off (default) or on the debug capabilities\&. Possible +values are 0 (off) and 1 (on)\&. +.IP "DEPENDENCIES=value" +This turns off (default) or on the ability to generate a Makefile +dependency list\&. Possible values are 0 (off) and 1 (on)\&. +.IP "KEEPLILYPOND=value" +This turns off (default) or on the ability to keep the log file +associated with the LilyPond job\&. Possible values are 0 (off) and 1 +(on)\&. +.IP "KEEPLY2DVI=value" +This turns off (default) or on the ability to keep the temporary files +that are generated by the ly2dvi job\&. Possible values are 0 (off) and +1 (on) +.IP "LANGUAGE=value" +Specify LaTeX language\&. Possible value is a valid LaTeX language\&. +.IP "LATEXHF=value" +Specify additional LaTeX headers file\&. Possible value is a file +specification\&. +.IP "LILYINCLUDE=value" +Additional directories for input files\&. Possible value is a delimited +directory path list\&. +.IP "LILYPONDPREFIX=value" +This defines the LilyPond root directory\&. Possible value is a valid +directory specification to the LilyPond distribution location\&. +.IP "NONUMBER=value" +This turns off (default) or on the page numbering capability\&. +Possible values are 0 (page numbering enabled) and 1 (page numbering +disabled)\&. +.IP "ORIENTATION=value" +This sets the image orientation\&. Possible values are +portrait (default) and landscape\&. +.IP "OUTPUTDIR=value" +This defines the directory where the resultant files will be +generated\&. Possible value is a valid directory specification\&. +Default is the current working directory\&. +.IP "PAPERSIZE=value" +This defines the papersize the image will be sized to fit\&. Possible +values are a0, a1, a2, a3, a4 (default), a5, a6, a7, a8, a9, a10, b0, +b1, b2, b3, b4, b5, archA, archB, archC, archD, archE, flsa, flse, +halfletter, ledger, legal, letter, or note\&. +.IP "PHEIGHT=value" Specify paperheight (points - an inch is 72\&.27, a cm is 28\&.453 points)\&. -.IP "TMP=" -Temporary directory name\&. -.IP "PWIDTH=" +.IP "POSTSCRIPT=value" +This turns off (default) or on the capability of additionally +generating a postscript file\&. Possible values are 0 (off) and 1 (on)\&. +.IP "PWIDTH=value" Specify paperwidth (points - an inch is 72\&.27, a cm is 28\&.453 points)\&. +.IP "SEPARATE=value" +This turns off (default) or on the capability of generating multiple +dvi and postscript files from multiple source files\&. The default is +to generate a concatenation of the source files\&. Possible values are +0 (single file) and 1 (separate files)\&. +.IP "TMP=value" +This defines the emporary directory\&. Actually this is not used at the +present\&. Possible value is a valid directory specification that is +writable to the user\&. +.PP +.SH "Initialization Sequence" +The initialization process reads inputs for several sources\&. Below is +a list of priorities for lowest to hightest proirity\&. +.PP +.IP o +Program\'s defaults +.IP o +Values found in LilyPond output file +.IP o +Environment variables +.IP o +$LILYPONDPREFIX/share/lilypond/\&.lilyrc +.IP o +$HOME/\&.lilyrc +.IP o +\&./\&.lilyrc +.IP o +command line options +.PP +Note that this differs slightly from the original bourne shell +version\&. .PP .SH "See Also" .PP @@ -162,6 +249,11 @@ archE, b0, b1, b2, b3, b4, b5, flsa, flse, halfletter, ledger, legal, letter, note .PP .SH "AUTHOR" +Python Version author: +Jeffrey B\&. Reed , +http://www\&.realtime\&.net/~daboys/lilypond/ .PP -Jan Arne Fagertun , http://www\&.termo\&.unit\&.no/mtf/people/janaf/ +Original bourne shell version author: +Jan Arne Fagertun , +http://www\&.termo\&.unit\&.no/mtf/people/janaf/ .PP diff --git a/Documentation/ntweb/index.yo b/Documentation/ntweb/index.yo index 1a3a8df1f1..81d5f2bea3 100644 --- a/Documentation/ntweb/index.yo +++ b/Documentation/ntweb/index.yo @@ -16,6 +16,18 @@ includefile(../BLURB.in) link(Back to top)(contents) clearpage() +I'm back from the dead! There have been many changes since my last +update. Please read information on batch files and update as needed. +The fonts have changed so you will also need to remove any cached +fonts. In addition please bring music sources up to date by using +convert-mudela utility. I used: + +verb( +% bf(convert-mudela.py -e angels.ly) +) + +Also please refer to LilyPond documentation for new and changed +features. subsect(NEWS) label(news) This is what the version @TOPLEVEL_VERSION@ brings: @@ -52,6 +64,8 @@ clearpage() subsect(Download) label(download) itemize( + it() pre-guile version lurl(lilypond-1.0.17.jbr1.bin.zip) nl() + NOTE: LILYPONDPREFIX=em(LilyPond-dir) for this version it()lurl(lilypond-@TOPLEVEL_VERSION@.bin.zip) ) @@ -68,10 +82,11 @@ itemize( description( dit(batch file) In a batch file you can add the following entries: nl() - bf(set LILYPONDPREFIX=em(LilyPond-dir)) nl() - bf(set path=%path%;%LILYPONDPREFIX%\bin;em(MiKTeX-dir)\miktex\bin) nl() - bf(set TEXINPUTS=%LILYPONDPREFIX%\share\lilypond\tex;;) nl() - bf(set MFINPUTS=%LILYPONDPREFIX%\share\lilypond\mf;;) nl() + bf(set LILYPONDHOME=em(LilyPond-dir)) nl() + bf(set LILYPONDPREFIX=%LILYPONDHOME%\share\lilypond) nl() + bf(set path=%path%;%LILYPONDHOME%\bin;em(MiKTeX-dir)\miktex\bin) nl() + bf(set TEXINPUTS=%LILYPONDPREFIX%\tex;%LILYPONDPREFIX%\ps;;) nl() + bf(set MFINPUTS=%LILYPONDPREFIX%\mf;;) nl() COMMENT( dit(Windows Environment) In the Windows environment you can select properties menu of the My Computer icon. Click on diff --git a/INSTALL.txt b/INSTALL.txt index 2747f7e0e1..68b87c0215 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -33,10 +33,10 @@ Contents This document explains what you need to install LilyPond, and what you should do. If you are going to compile and -install LilyPond very often you might want to check out the -buildscripts/set-lily.sh script. It sets some environment -variables and symlinks, which comes in handly when you have -to compile LilyPond more often. +install LilyPond often, e.g. when doing development, you +might want to check out the buildscripts/set-lily.sh script. +It sets some environment variables and symlinks, which comes +in handly when you have to compile LilyPond more often. 2: PREREQUISITES @@ -67,7 +67,7 @@ o Python 1.5 (Strictly speaking, you shouldn't need to regenerate the font tables, e.g.). o GUILE 1.3 (no, GUILE 1.2 won't work), check out - http://www.gnu.org/programs/guile.html. + http://www.gnu.org/software/guile/guile.html. 3: RUNNING @@ -153,35 +153,35 @@ o The geometry package for LaTeX is needed to use ly2dvi. mirror site ftp://ftp.dante.de -o A fast computer (a full page of music typically takes 1 +o A fast computer: a full page of music typically takes 1 minute on my 486/133, using the --enable-checking com- - pile. It's lot slower than most MusiXTeX preprocessors) + pile. 5: WEBSITE -If you want to auto-generate Lily's website, you'll need +If you want to auto-generate Lily's website, you'll need some additional conversion tools. o xpmtoppm (from the Portable Bitmap Utilities) (For Red- - Hat Linux users: it is included within the package + Hat Linux users: it is included within the package libgr-progs). o Bib2html http://pertsserver.cs.uiuc.edu/~hull/bib2html. Which, in turn depends on man2html for proper installa- - tion. man2html can be had from http://askdon- + tion. man2html can be had from http://askdon- ald.ask.uni-karlsruhe.de/hppd/hpux/Network- ing/WWW/Man2html-1.05. TeTeX users should not forget to rerun texhash. Building the website requires pnmtopng. The version of pnm- -topng that is distributed with RedHat 5.1 contains a bug -(pnmtopng is dynamically linked to the wrong version of -libpng). Recompile it from source, and make sure that the -pnmtopng binary is linked statically to the libpng that is +topng that is distributed with RedHat 5.1 contains a bug +(pnmtopng is dynamically linked to the wrong version of +libpng). Recompile it from source, and make sure that the +pnmtopng binary is linked statically to the libpng that is included in libgr. @@ -236,9 +236,9 @@ This will install a number of files, something close to: -The above assumes that you are root and have the GNU devel- +The above assumes that you are root and have the GNU devel- opment tools, and your make is GNU make. If this is not the -case, you can adjust your environment variables to your +case, you can adjust your environment variables to your taste: @@ -258,7 +258,7 @@ taste: CPPFLAGS are the preprocessor flags. The configure script is Cygnus configure, and it will accept ---help. If you are not root, you will probably have to make +--help. If you are not root, you will probably have to make it with a different --prefix option. Our favourite location is @@ -273,10 +273,10 @@ is -In this case, you will have to set up MFINPUTS, and TEXIN- +In this case, you will have to set up MFINPUTS, and TEXIN- PUTS accordingly. -Since GNU LilyPond currently is beta, you are advised to +Since GNU LilyPond currently is beta, you are advised to also use @@ -301,18 +301,18 @@ Options to configure include: Enable debugging print routines (lilypond -D option) --enable-optimise - Set maximum optimisation: compile with -O2. This can - be unreliable on some compiler/platform combinations + Set maximum optimisation: compile with -O2. This can + be unreliable on some compiler/platform combinations (eg, DEC Alpha and PPC) --enable-profiling Compile with support for profiling. --enable-config - Output to a different configuration file. Needed for + Output to a different configuration file. Needed for multi-platform builds -All options are documented in the configure help The option +All options are documented in the configure help The option --enable-optimise is recommended for Real Life usage. If you do @@ -328,8 +328,8 @@ If you do -everything will be compiled, but nothing will be installed. -The resulting binaries can be found in the subdirectories +everything will be compiled, but nothing will be installed. +The resulting binaries can be found in the subdirectories out/ (which contain all files generated during compilation). @@ -337,8 +337,8 @@ out/ (which contain all files generated during compilation). If you want to compile LilyPond with different configuration -settings, then, you can use the --enable-config option. -Example: suppose I want to build with and without profil- +settings, then, you can use the --enable-config option. +Example: suppose I want to build with and without profil- ing. Then I'd use the following for the normal build, @@ -386,7 +386,7 @@ If you have done a successful make, then a simple should do the trick. If you are doing an upgrade, please remember to remove obso- -lete .pk and .tfm files of the fonts. A script has been +lete .pk and .tfm files of the fonts. A script has been provided to do the work for you, see bin/clean-fonts.sh. @@ -394,8 +394,8 @@ CAVEATS -o The -O2 option to gcc triggers a gcc bug on DEC Alpha - in dstream.cc. You should turn off this flag for this +o The -O2 option to gcc triggers a gcc bug on DEC Alpha + in dstream.cc. You should turn off this flag for this file. @@ -452,8 +452,8 @@ refer to the man page for more information. 9: REDHAT LINUX -RedHat Linux users can compile an RPM. A spec file is in -make/out/lilypond.spec, it is distributed along with the +RedHat Linux users can compile an RPM. A spec file is in +make/out/lilypond.spec, it is distributed along with the sources. You can make the rpm by issuing @@ -473,7 +473,7 @@ You can make the rpm by issuing 10: DEBIAN GNU/LINUX -A Debian package is also available; contact Anthony Fok +A Debian package is also available; contact Anthony Fok foka@debian.org . The build scripts are in the subdirectory debian/. diff --git a/NEWS b/NEWS index aea1b1fcb3..6b8d0fb119 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,36 @@ -pl 17.mb1 - - center the number of multi-bar rests - - Ugly fix to make \mark work and give better placement of dynamics. +pl 17.jbr2 + - Documentation/README-W32: Brought my stuff up to date + - Documentation/ntweb: updated for realease + - stepmake/bin/package-zip32.sh: cygwin-b20 changes + - scripts/ly2dvi.py: LILYPONDPREFIX fixes +pl 17.jbr1 + - scripts/ly2dvi.py root is now the shared directory path not the + root of the lily installation. Environment variable LILYPONDPREFIX + is also the path to shared directory. + - lily/main.cc WINNT conditional added to avoid a casting of + main_prog + +pl 17.hwn1 + - bfs wtk1-fugue1 + - spacing tweak: very widely and tightly spaced lines look +better. + - allow Beam settings to be overriden: property + stemLeftBeamCount, stemRightBeamCount + - junked Assoc, Assoc_iter + - junked Graphical_element::{width,height} + - junked Plet_swallow_engraver, Plet_engraver + - Command_tie_engraver -> Tie_engraver, Command_beam_engraver -> Beam_engraver + - naming brew_molecule_p / do_brew_molecule -> output_processing, do_brew_molecule_p + - experimental Text_item, Staff_side + - junked old Beam_engraver and old Tie_engraver. + - AFM administration cleanup. + - cache brewed molecules. Speed up ? + - rehacked Graphical_element, introduced Dimension_cache + +******** + +pl 17 pl 16.jcn2 - fix: TEMPO 4., well urg, "TEMPO 4 ." - beginning of violino/violoncello (viola) duet @@ -9,6 +38,12 @@ pl 16.jcn2 pl 16.jcn1 - resurrected po-stuff +******** +pl 16 + +********* +pl 16 + pl 15.uu1 - dynamic fix. - junked abbrev stuff from parser. diff --git a/README.txt b/README.txt index 9a521b0afb..e14181b913 100644 --- a/README.txt +++ b/README.txt @@ -4,73 +4,117 @@ -This is the toplevel README to LilyPond LilyPond is the GNU -Project music typesetter. This program can print beautiful -sheet music from a music definition file. It can also play -mechanical performances to a MIDI file. Features include -multiple staffs, meters, clefs, keys, lyrics, versatile -input language, cadenzas, beams, slurs, triplets, formatting + + + + This is the toplevel README to LilyPond + + +LilyPond is the GNU Project music typesetter. This program +can print beautiful sheet music from a music definition +file. It can also play mechanical performances to a MIDI +file. Features include multiple staffs, meters, clefs, +keys, lyrics, versatile input language, cadenzas, beams, +slurs, triplets, named chords, transposing, formatting scores, part extraction. It includes a nice font of musical symbols. + 1: VERSIONING - if you have downloaded a *.pre* version, then this is -version is *not* meant for producing nice output (but to -keep your patchsets up to date). It might not even compile. -The same goes for a version with a 4th version number, eg -1.2.3.mypatch2 It will be safer if you download 1.2.3 or -wait for 1.2.4. + +LilyPond uses a versioning scheme similar to the Linux ker- +nel. In a version "x.y.z", an even second number 'y' +denotes a stable version. For development versions 'y' is +odd. For using straightforward score production, please use +the latest stable version. Development versions may not +produce good or nice scores. + +If you have downloaded a + +*.pre* + +version, then this is version is *not* meant for producing +nice output (but to keep your patchsets up to date). It +might not even compile. The same goes for a version with a +4th version number, eg + +1.2.3.mypatch2 + +It will be safer if you download 1.2.3 or wait for 1.2.4. + 2: REQUIREMENTS - For the compilation and running of LilyPond you need -some additional packages. Please refer to the installation -instructions. NOTE: If you downloaded a binary (.rpm or a -W95/NT .zip file), then you don't have to compile LilyPond. + +For the compilation and running of LilyPond you need some +additional packages. Please refer to the installation +instructions. + +NOTE: If you downloaded a binary (.rpm or a W95/NT .zip +file), then you don't have to compile LilyPond. + 3: INSTALLATION - For your convenience, a formatted copy of the INSTALL -instructions are in the toplevel directory, as INSTALL.txt -The process is fairly straightforward, but chances are that -you have to specify directories for to configure: this is + +For your convenience, a formatted copy of the INSTALL +instructions are in the toplevel directory, as INSTALL.txt + +The process is fairly straightforward, but chances are that +you have to specify directories for to configure: this is done with the options --enable-tex-dir and --enable-mf-dir + 4: DOCUMENTATION - The real documentation is the directory Documentation/ + +The real documentation is the directory Documentation/ + To generate the pretty-printed docs, you have to run config- -ure first, and then do this: make doc You can also simply -read the .yo sources. They are ASCII text. The complete -documentation is accessible in formatted form at the website -http://www.cs.uu.nl/people/hanwen/lilypond/index.html +ure first, and then do this: + +make doc + +You can also simply read the .yo sources. They are ASCII +text. The complete documentation is accessible in formatted +form at the website http://www.cs.uu.nl/people/hanwen/lily- +pond/index.html + 5: COMMENTS - LilyPond is a long way from finished and polished. We -do appreciate criticism, comments, bugreports, patches, etc. -Please send your e-mail to one of the MAILING LISTS and not -to us personally. See Documentation/links.yo for more info. + +LilyPond is a long way from finished and polished. We do +appreciate criticism, comments, bugreports, patches, etc. + +Please send your e-mail to one of the MAILING LISTS + +and not to us personally. See Documentation/links.yo for +more info. + 6: WINDOWS 32 - If you have received this file as part of a DOS/Win- -dow32 distribution (lilypond-*.zip), then it is advisable to -also download the source package, since it might contain +If you have received this file as part of a DOS/Window32 +distribution (lilypond-*.zip), then it is advisable to also +download the source package, since it might contain more +documentation ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/ -more documentation ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/ If -you decide to build LilyPond from source, please read the -INSTALL.txt document first, especially the Windows NT/95 +If you decide to build LilyPond from source, please read the +INSTALL.txt document first, especially the Windows NT/95 section. + 7: CAVEATS - * Please read the file BUGS for some ugly bugs. This -especially applies Linux-Intel unix users. * If you have -installed a previous version, be sure to remove old font -files, eg + +* Please read the file BUGS for some ugly bugs. This espe- +cially applies Linux-Intel unix users. + +* If you have installed a previous version, be sure to +remove old font files, eg @@ -80,13 +124,14 @@ files, eg -a script to do this for you is in bin/cleanfonts.sh +a script to do this for you is in buildscripts/clean- +fonts.sh 8: CDROM DISTRIBUTIONS -If you have received LilyPond on a cdrom, chances are that -development has moved a some patchlevels up. If possible, +If you have received LilyPond on a cdrom, chances are that +development has moved a some patchlevels up. If possible, please check the latest version of LilyPond before reporting bugs. diff --git a/TODO b/TODO index dc0db2f26e..59f23ce0ca 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ -Features you cannot find in the doco as working, should be mentioned here. +Features you cannot find in the doco as working, should be mentioned +here. This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about @@ -6,7 +7,22 @@ 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/urg + * scm-ify \property values. + + * move class Lookup {} into scm + + * read tfms too. + + * update mi2mu for lilypond 1.1 + BUGS: + + * fix braces + + * ly2dvi barfs on linewidth = -1. + + * fix midi output. + * c4 \! \> c4 * tremolo stuff @@ -27,10 +43,6 @@ BUGS: * \breathmark TeX macro - * configure error if GUILE 1.3 not found - - * configure error if no rtti (gcc 2.8 or egcs-1.1) - * catch GUILE errors? * add new glyphs to font.ly @@ -128,8 +140,6 @@ STUFF * $DEPENDENCIES_OUTPUT support - * fix BUGs - * fix weird behaviour when .AFMs/.SCMs not found. * Xdvi zooming ?! Try to understand GS garbage collection. @@ -545,9 +555,6 @@ SMALLISH PROJECTS * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) - * Flower types: - - A decent scalar type - * stafftypes: voice names/ instrument names. * lily \tempo diff --git a/VERSION b/VERSION index 03e50b5e80..c3e453065e 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=17 -MY_PATCH_LEVEL=mb1 +PATCH_LEVEL=18 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/aclocal.m4 b/aclocal.m4 index 50748a506a..9928822b00 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,9 @@ dnl WARNING WARNING WARNING WARNING dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 +dnl WARNING WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 +dnl WARNING WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 dnl aclocal.m4 -*-shell-script-*- dnl StepMake subroutines for configure.in @@ -145,13 +149,13 @@ AC_DEFUN(AC_STEPMAKE_END, [ AC_DEFUN(AC_STEPMAKE_GXX, [ # ugh autoconf changequote(<<, >>)dnl - if $CXX --version | grep '2\.[78]' > /dev/null || + if $CXX --version | grep '2\.8' > /dev/null || $CXX --version | grep 'egcs' > /dev/null changequote([, ])dnl then true else - AC_STEPMAKE_WARN(can\'t find g++ 2.7, 2.8 or egcs) + AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs) fi ]) @@ -160,17 +164,19 @@ AC_DEFUN(AC_STEPMAKE_GUILE, [ # others need readline, dl (or even more) # urg, must check for different functions in libguile # to force new check iso reading from cache - AC_CHECK_LIB(guile, scm_shell, \ + + # gh_scm2doubles,gh_doubles2scm are new in 1.3 + AC_CHECK_LIB(guile, gh_scm2doubles, \ LIBS="-lguile $LIBS"; AC_DEFINE(HAVE_LIBGUILE), \ AC_CHECK_LIB(readline, readline) \ AC_CHECK_LIB(dl, dlopen) \ AC_CHECK_LIB(socket, socket)\ AC_CHECK_LIB(termcap,tgetent)\ AC_CHECK_LIB(m, fabs)\ - AC_CHECK_LIB(guile, scm_boot_guile)\ + AC_CHECK_LIB(guile, gh_doubles2scm)\ ) - if test "$ac_cv_lib_guile_scm_shell" != yes -a \ - "$ac_cv_lib_guile_scm_boot_guile" != yes ; then + if test "$ac_cv_lib_guile_gh_scm2doubles" != yes -a \ + "$ac_cv_lib_guile_gh_doubles2scm" != yes ; then AC_STEPMAKE_WARN(You should install guile 1.3 or newer) fi ]) diff --git a/configure b/configure index 683d723e9a..da4480ea7b 100755 --- a/configure +++ b/configure @@ -1553,13 +1553,13 @@ fi # ugh autoconf - if $CXX --version | grep '2\.[78]' > /dev/null || + if $CXX --version | grep '2\.8' > /dev/null || $CXX --version | grep 'egcs' > /dev/null then true else - echo "configure: warning: can\'t find g++ 2.7" 1>&2 + echo "configure: warning: can\'t find g++ 2.8 or egcs" 1>&2 warn_b=yes fi @@ -2487,16 +2487,18 @@ test -n "$YODL2TXT" || YODL2TXT="-echo no yodl" # others need readline, dl (or even more) # urg, must check for different functions in libguile # to force new check iso reading from cache - echo $ac_n "checking for scm_shell in -lguile""... $ac_c" 1>&6 -echo "configure:2492: checking for scm_shell in -lguile" >&5 -ac_lib_var=`echo guile'_'scm_shell | sed 'y%./+-%__p_%'` + + # gh_scm2doubles,gh_doubles2scm are new in 1.3 + echo $ac_n "checking for gh_scm2doubles in -lguile""... $ac_c" 1>&6 +echo "configure:2494: checking for gh_scm2doubles in -lguile" >&5 +ac_lib_var=`echo guile'_'gh_scm2doubles | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lguile $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2534,7 +2536,7 @@ else echo "$ac_t""no" 1>&6 \ echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 -echo "configure:2538: checking for readline in -lreadline" >&5 +echo "configure:2540: checking for readline in -lreadline" >&5 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2542,7 +2544,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2584,7 +2586,7 @@ else fi \ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2588: checking for dlopen in -ldl" >&5 +echo "configure:2590: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2592,7 +2594,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2634,7 +2636,7 @@ else fi \ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:2638: checking for socket in -lsocket" >&5 +echo "configure:2640: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2642,7 +2644,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2684,7 +2686,7 @@ else fi \ echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:2688: checking for tgetent in -ltermcap" >&5 +echo "configure:2690: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2692,7 +2694,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2734,7 +2736,7 @@ else fi \ echo $ac_n "checking for fabs in -lm""... $ac_c" 1>&6 -echo "configure:2738: checking for fabs in -lm" >&5 +echo "configure:2740: checking for fabs in -lm" >&5 ac_lib_var=`echo m'_'fabs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2742,7 +2744,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2783,16 +2785,16 @@ else echo "$ac_t""no" 1>&6 fi \ - echo $ac_n "checking for scm_boot_guile in -lguile""... $ac_c" 1>&6 -echo "configure:2788: checking for scm_boot_guile in -lguile" >&5 -ac_lib_var=`echo guile'_'scm_boot_guile | sed 'y%./+-%__p_%'` + echo $ac_n "checking for gh_doubles2scm in -lguile""... $ac_c" 1>&6 +echo "configure:2790: checking for gh_doubles2scm in -lguile" >&5 +ac_lib_var=`echo guile'_'gh_doubles2scm | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lguile $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2836,8 +2838,8 @@ fi fi - if test "$ac_cv_lib_guile_scm_shell" != yes -a \ - "$ac_cv_lib_guile_scm_boot_guile" != yes ; then + if test "$ac_cv_lib_guile_gh_scm2doubles" != yes -a \ + "$ac_cv_lib_guile_gh_doubles2scm" != yes ; then echo "configure: warning: You should install guile 1.3 or newer" 1>&2 warn_b=yes @@ -2849,7 +2851,7 @@ CXXFLAGS="$CXXFLAGS -fhandle-signatures" echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2853: checking for 8-bit clean memcmp" >&5 +echo "configure:2855: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2857,7 +2859,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2888,12 +2890,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2892: checking for vprintf" >&5 +echo "configure:2894: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -2943,12 +2945,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2947: checking for _doprnt" >&5 +echo "configure:2949: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -3001,12 +3003,12 @@ fi for ac_func in memmem snprintf vsnprintf gettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3005: checking for $ac_func" >&5 +echo "configure:3007: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3071,7 +3073,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3075: checking for $ac_word" >&5 +echo "configure:3077: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/flower/dictionary.cc b/flower/dictionary.cc deleted file mode 100644 index 2d200f2e5a..0000000000 --- a/flower/dictionary.cc +++ /dev/null @@ -1,39 +0,0 @@ - -#if 0 - - -/** - Dictionary implementation. Please fix me. - - (neuk. hsearch_* is te dom.) - */ -template -class Dictionary -{ - hsearch_data * hash_p_; - -public: - Dictionary (); - ~Dictionary (); - Dictionary (Dictionary const&); - T &elem (String s); - T const &elem (String s) const; - bool elem_b (String s) const; - void add (String, T); - void clear (); -} - -Dictionary::Dictionary () -{ - hash_p_ = new hsearch_data; - hash_p_->table = 0; - - int start_size = 51; - int retval = hcreate_r (start_size, hash_p_); - - assert (retval); -} - - - -#endif diff --git a/flower/dstream.cc b/flower/dstream.cc index 10542ee06a..de0e793e08 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -7,12 +7,11 @@ */ #include -#include "assoc.hh" +#include "dictionary-iter.hh" #include "dstream.hh" #include "scalar.hh" #include "text-db.hh" #include "string-convert.hh" -#include "assoc-iter.hh" #include "rational.hh" /// indent of each level @@ -53,19 +52,19 @@ Dstream::identify_as (String name) String cl (strip_member (mem)); String idx = cl; - if (silent_assoc_p_->elem_b (mem)) + if (silent_dict_p_->elem_b (mem)) idx = mem; - else if (silent_assoc_p_->elem_b (cl)) + else if (silent_dict_p_->elem_b (cl)) idx = cl; else { - (*silent_assoc_p_)[idx] = default_silence_b_; + (*silent_dict_p_)[idx] = default_silence_b_; } - local_silence_b_ = (*silent_assoc_p_)[idx]; + local_silence_b_ = (*silent_dict_p_)[idx]; if (current_classname_str_ != idx && !local_silence_b_) { current_classname_str_=idx; - if (!(*silent_assoc_p_)["Dstream"]) + if (!(*silent_dict_p_)["Dstream"]) *os_l_ << "[" << current_classname_str_ << ":]"; // messy. } return *this; @@ -74,9 +73,9 @@ Dstream::identify_as (String name) bool Dstream::silent_b (String s) const { - if (!silent_assoc_p_->elem_b (s)) + if (!silent_dict_p_->elem_b (s)) return false; - return (*silent_assoc_p_)[s]; + return (*silent_dict_p_)[s]; } Dstream & @@ -138,7 +137,7 @@ Dstream::output (String s) Dstream::Dstream (ostream *r, char const * cfg_nm) { os_l_ = r; - silent_assoc_p_ = new Assoc; + silent_dict_p_ = new Dictionary; default_silence_b_ = false; indent_level_i_ = 0; if (!os_l_) @@ -159,26 +158,26 @@ Dstream::Dstream (ostream *r, char const * cfg_nm) r.message (_ ("Not enough fields in Dstream init.")); continue; } - (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1])); + (*silent_dict_p_)[r[0]] = (bool)(int)(Scalar (r[1])); } - if ((*silent_assoc_p_).elem_b ("Dstream_default_silence")) - default_silence_b_ = (*silent_assoc_p_)["Dstream_default_silence"]; + if ((*silent_dict_p_).elem_b ("Dstream_default_silence")) + default_silence_b_ = (*silent_dict_p_)["Dstream_default_silence"]; } Dstream::~Dstream() { - delete silent_assoc_p_; + delete silent_dict_p_; assert (!indent_level_i_) ; } void Dstream::clear_silence() { - for (Assoc_iter i (*silent_assoc_p_); i.ok(); i++) + for (Dictionary_iter i (*silent_dict_p_); i.ok(); i++) { - i.val() = false; + i.val_ref() = false; } } diff --git a/flower/file-path.cc b/flower/file-path.cc index 61dbd64e9b..e6408a1d15 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -1,7 +1,9 @@ /* path.cc - manipulation of paths and filenames. */ + #include + #include "config.hh" #include "file-path.hh" #include "flower-debug.hh" @@ -72,7 +74,7 @@ File_path::parse_path (String p) -/** find a file. +/** Find a file. It will search in the current dir, in the construction-arg, and in any other added path, in this order. diff --git a/flower/hash.cc b/flower/hash.cc index 1e2debd13b..b541681e87 100644 --- a/flower/hash.cc +++ b/flower/hash.cc @@ -31,3 +31,13 @@ unsigned int hash (String s) return result; } + +unsigned int hash (unsigned int i) +{ + return i; +} + +unsigned int hash (int i) +{ + return (unsigned) i; +} diff --git a/flower/include/assoc-iter.hh b/flower/include/assoc-iter.hh deleted file mode 100644 index f1ba2f89b2..0000000000 --- a/flower/include/assoc-iter.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - associter.hh -- part of flowerlib - - (c) 1996 Han-Wen Nienhuys -*/ - -#ifndef ASSOCITER_HH -#define ASSOCITER_HH - -#include "assoc.hh" - -/// an iterator for the #Assoc# class -template -struct Assoc_iter { - int i; - Assoc &assoc_; - /// we don't want to be bothered by const correctness - Assoc_iter (const Assoc &a) : - assoc_((Assoc &)a) - { - i= next (0); - } - int next (int j) { - while (j < assoc_.arr.size() && assoc_.arr[j].free) - j++; - return j; - } - bool ok() const { - return i < assoc_.arr.size(); - } - void OK() const { - assert (!ok() || !assoc_.arr[i].free); - } - void operator++(int) { i++; i = next (i); } - K key() { return assoc_.arr[i].key; } - V &val() { return assoc_.arr[i].val; } -}; - -#endif diff --git a/flower/include/assoc.hh b/flower/include/assoc.hh deleted file mode 100644 index c0b3f5fa01..0000000000 --- a/flower/include/assoc.hh +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef ASSOC_HH -#define ASSOC_HH - -#include "array.hh" -#include - -/** - A helper for Assoc - */ -template -struct Assoc_ent_ { - bool free; - K key; - V val; -}; - - -/** mindblowingly stupid Associative array implementation. - Hungarian: map - - TODO: a decent hash for strings. - */ -template -struct Assoc { - Array< Assoc_ent_ > arr; - - /* ************** */ - - int find (K key) const { - for (int i = 0; i < arr.size(); i++) { - if (!arr[i].free && key == arr[i].key) - return i; - } - return -1; - } - int find_creat (K key) { - int free = -1; - for (int i = 0; i < arr.size(); i++) { - if (!arr[i].free && key == arr[i].key) { - return i; - } else if (arr[i].free) { - free = i; - } - } - if (free >= 0){ - arr[free].free = false; - arr[free].key = key; - return free; - } - - Assoc_ent_ ae; - ae.free = false; - ae.key = key; - arr.push (ae); - return arr.size() -1; - } -public: - bool elem_b (K key) const { - return find (key) >= 0; - } - void del (K key) { - assert (elem_b (key)); - int i= find (key); - arr[i].free = true; - } - void add (K key, V val) { - int i = find_creat (key); - arr[i].val = val; - } - V& elem (K key) { - return arr[find_creat (key)].val; - } - V& operator[](K key) { - return elem (key); - } - V const & operator[](K key) const { - return elem (key); - } - V const & elem (K key) const { - assert (elem_b (key)); - return arr[find (key)].val; - } - void clear () - { - for (int i=0 ; i < arr.size (); i++) - arr[i].free = true; - } -}; - -#endif diff --git a/flower/include/dictionary-iter.hh b/flower/include/dictionary-iter.hh index da6e64b391..33531e584c 100644 --- a/flower/include/dictionary-iter.hh +++ b/flower/include/dictionary-iter.hh @@ -12,20 +12,16 @@ #include "dictionary.hh" - - -#include "dictionary.hh" - -template -class Dictionary_iter +template +class Hash_table_iter { - Dictionary *dict_l_; + Hash_table *dict_l_; int i; public: - Dictionary_iter(Dictionary const &dict) + Hash_table_iter(Hash_table const &dict) { i =0; - dict_l_ =(Dictionary *) & dict; + dict_l_ =(Hash_table *) & dict; next_used (); } @@ -47,14 +43,30 @@ public: next_used (); } - String key () + K key () + { + return dict_l_->fixed_p_->dict_arr_[i].key_; + } + V val () { - return dict_l_->fixed_p_->dict_arr_[i].name_; + return dict_l_->fixed_p_->dict_arr_[i].value_; } - V val () + V &val_ref () { return dict_l_->fixed_p_->dict_arr_[i].value_; } }; -#endif // DICTIONARY_ITER_HH +template +class Dictionary_iter : public Hash_table_iter +{ +public: + Dictionary_iter (Dictionary const &d) + : Hash_table_iter (d) + { + + } + + +}; +#endif // Hash_table_ITER_HH diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index e9caa46d64..c9b5775f1b 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -14,38 +14,46 @@ #include "array.hh" unsigned long prime_list (int idx); -template -struct Dict_entry +template +struct Hash_table_entry { - String name_; + K key_; V value_; bool free_b_; - Dict_entry() { + Hash_table_entry() { free_b_ = true; } - Dict_entry (String s, V v) + Hash_table_entry (K s, V v) { - name_ = s; + key_ = s; value_ = v; free_b_ = false; } }; unsigned int hash (String); +unsigned int hash (int); + +template +struct Dict_initialiser +{ + char *key_; + V value_; +}; /** A hash table of prime size. We use quadratic probing. */ -template -class Fixed_size_dictionary +template +class Fixed_size_hash_table { public: - Array > dict_arr_; + Array > dict_arr_; int size_idx_; - Fixed_size_dictionary (int size_idx) + Fixed_size_hash_table (int size_idx) { size_idx_ = size_idx; int sz = prime_list(size_idx_); @@ -53,7 +61,7 @@ public: } /// find #s#, or find first empty entry corresponding to #s# - int lookup (String s) + int lookup (K s) { int sz =dict_arr_.size (); int i = hash (s) % sz; @@ -62,7 +70,7 @@ public: if (dict_arr_[i].free_b_) return i; - if (dict_arr_[i].name_ == s) + if (dict_arr_[i].key_ == s) return i; j++; @@ -73,14 +81,14 @@ public: } /// remove #s# from the hash table. - V remove (String s) + V remove (K s) { assert (false); // Untested routine. int sz =dict_arr_.size (); int i = hash (s) % sz; int j = 0; V retval; - while (j <= sz/2 && dict_arr_[i].name_ != s) + while (j <= sz/2 && dict_arr_[i].key_ != s) { assert (!dict_arr_[i].free_b_); @@ -107,50 +115,57 @@ public: /** Hash table with sliding sizes. */ -template -class Dictionary +template +class Hash_table { - Fixed_size_dictionary * fixed_p_; + Fixed_size_hash_table * fixed_p_; /// set size to next prime, and copy contents void enlarge () { - Fixed_size_dictionary *f = new Fixed_size_dictionary (fixed_p_->size_idx_ +1); + Fixed_size_hash_table *f = new Fixed_size_hash_table (fixed_p_->size_idx_ +1); for (int i=0; i < fixed_p_->dict_arr_.size(); i++) { if (fixed_p_->dict_arr_[i].free_b_) continue; - String nm (fixed_p_->dict_arr_[i].name_); + K nm (fixed_p_->dict_arr_[i].key_); int nl = f->lookup (nm); - f->dict_arr_[nl] = Dict_entry (nm, fixed_p_->dict_arr_[i].value_); + f->dict_arr_[nl] = Hash_table_entry (nm, fixed_p_->dict_arr_[i].value_); } delete fixed_p_; fixed_p_ = f; } public: - Dictionary () + Hash_table () { - fixed_p_ = new Fixed_size_dictionary (0); + fixed_p_ = new Fixed_size_hash_table (0); } - ~Dictionary () + ~Hash_table () { delete fixed_p_; } - void operator = (Dictionary const &src) + void operator = (Hash_table const &src) { if (&src == this) return; delete fixed_p_; - fixed_p_ = new Fixed_size_dictionary (*src.fixed_p_); + fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); } - Dictionary (Dictionary const &src) + Hash_table (Hash_table const &src) { - fixed_p_ = new Fixed_size_dictionary (*src.fixed_p_); + fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); } - bool elem_b (String s) const + + void clear () + { + int i= fixed_p_->size_idx_; + delete fixed_p_; + fixed_p_ = new Fixed_size_hash_table (i); + } + bool elem_b (K s) const { int l = fixed_p_->lookup (s); @@ -160,7 +175,7 @@ public: /** Find and return element. If #s# is not in the table, create an entry in the table, and init */ - V& elem (String s) + V& elem (K s) { int l; while ((l= fixed_p_->lookup (s)) <0) @@ -170,34 +185,50 @@ public: fixed_p_->dict_arr_[l].free_b_ = false; - fixed_p_->dict_arr_[l].name_ = s; + fixed_p_->dict_arr_[l].key_ = s; return fixed_p_->dict_arr_[l].value_; } - V elem (String s) const + V elem (K s) const { return const_elem (s); } - V const_elem (String k) const + V const_elem (K k) const { V retval; if (elem_b (k)) - retval = ((Dictionary*)this)->elem (k); + retval = ((Hash_table*)this)->elem (k); return retval; } - V& operator [] (String k) + V& operator [] (K k) { return elem (k); } - V operator [] (String k) const + V operator [] (K k) const { return const_elem (k); } - V remove (String s) + V remove (K s) { return fixed_p_->remove (s); } + friend class Hash_table_iter; +}; + +template +class Dictionary : public Hash_table +{ +public: + Dictionary () + {} + Dictionary (Dict_initialiser *p) + { + for (Dict_initialiser *q = p; q->key_; q++) + elem (q->key_) = q->value_; + + } + friend class Dictionary_iter; }; diff --git a/flower/include/dstream.hh b/flower/include/dstream.hh index a7379268eb..0217450b9f 100644 --- a/flower/include/dstream.hh +++ b/flower/include/dstream.hh @@ -14,9 +14,6 @@ const char eol= '\n'; -template -struct Assoc; - /** Debug stream. a class for providing debug output of nested structures, with indents according to \{\}()[]. @@ -41,7 +38,7 @@ class Dstream bool default_silence_b_; String current_classname_str_; void output (String s); - Assoc *silent_assoc_p_; + Dictionary *silent_dict_p_; public: void clear_silence(); diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh index 96cbfc5db6..d149d5f022 100644 --- a/flower/include/fproto.hh +++ b/flower/include/fproto.hh @@ -21,6 +21,9 @@ template struct Link_array; template struct Array; template struct sstack; template struct Assoc; +template struct Hash_table; +template struct Hash_table_iter; +template struct Dictionary_iter; template struct Dictionary; template struct Dictionary_iter; template struct List; diff --git a/flower/include/parray.hh b/flower/include/parray.hh index b737d7bb47..77a69b519a 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -21,60 +21,72 @@ template class Link_array : public Array { - static default_compare (T *const& p1, T *const&p2) { - /* can't do p1 -p2, since T might be an incomplete type */ - if (p1 < p2) - return -1 ; - if (p2 < p1) - return 1; - return 0; - } + static default_compare (T *const& p1, T *const&p2) { + /* can't do p1 -p2, since T might be an incomplete type */ + if (p1 < p2) + return -1 ; + if (p2 < p1) + return 1; + return 0; + } public: - void substitute (T *old, T*new_l) + void substitute (T *old, T*new_l) { - int i; - while ((i = find_i (old)) >=0) - if (new_l) - elem (i) =new_l; - else - del (i); + int i; + while ((i = find_i (old)) >=0) + if (new_l) + elem (i) =new_l; + else + del (i); } - void unordered_substitute (T* old, T * new_l) + void unordered_substitute (T* old, T * new_l) { - int i; - while ((i = find_i (old)) >=0) - if (new_l) - elem (i) =new_l; - else { - unordered_del (i); - } + int i; + while ((i = find_i (old)) >=0) + if (new_l) + elem (i) =new_l; + else { + unordered_del (i); + } } - void default_sort() { - sort (default_compare); - } - void uniq() { - Link_array l_arr; - for (int i=0; i < size(); i++) - if (!i || elem (i-1) != elem (i)) - l_arr.push (elem (i)); - *this = l_arr; - } + void default_sort() { + sort (default_compare); + } + void uniq() { + Link_array l_arr; + for (int i=0; i < size(); i++) + if (!i || elem (i-1) != elem (i)) + l_arr.push (elem (i)); + *this = l_arr; + } - int find_i (T const * t) const { - for (int i=0; i < size(); i++) - if (elem (i) == t) - return i; - return -1; - } - T *find_l (T const *t) const + int find_i (T const * t) const { + for (int i=0; i < size(); i++) + if (elem (i) == t) + return i; + return -1; + } + T *find_l (T const *t) const { - int i = find_i (t); - if (i >= 0) - return elem (i); - else - return 0; + int i = find_i (t); + if (i >= 0) + return elem (i); + else + return 0; } }; +template +Link_array +typecast_array (Link_array const &a, T * /* dummy */ ) +{ + Link_array ret; + for (int i=a.size (); i-- ; ) + ret.push (dynamic_cast (a[i])); // ugh? + return ret; +} + + #endif // PARRAY_HH + diff --git a/init/engraver.ly b/init/engraver.ly index c15b6ae476..11f0884081 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -56,6 +56,7 @@ StaffContext=\translator { \consists "Separating_line_group_engraver"; \accepts "Voice"; + dynamicStyle = "dynamic"; }; \translator{\StaffContext } @@ -94,15 +95,17 @@ VoiceContext = \translator { \consists "Rest_engraver"; \consists "Dot_column_engraver"; \consists "Stem_engraver"; -% \consists "Plet_engraver"; - \consists "Command_beam_engraver"; + \consists "Beam_engraver"; \consists "Abbreviation_beam_engraver"; \consists "Multi_measure_rest_engraver"; + + % ugh. Order matters here. + \consists "Text_engraver"; \consists "Script_engraver"; \consists "Rhythmic_column_engraver"; \consists "Font_size_engraver"; \consists "Slur_engraver"; - \consists "Command_tie_engraver"; + \consists "Tie_engraver"; \consists "Tuplet_engraver"; \consists "Note_heads_engraver" ; \consists "Skip_req_swallow_translator"; @@ -144,7 +147,6 @@ GrandStaffContext=\translator{ \consists "Lyric_engraver"; \consists "Extender_engraver"; \consists "Beam_req_swallow_translator"; - \consists "Plet_swallow_engraver"; } \translator { diff --git a/init/property.ly b/init/property.ly index 0c8cbb637b..0a06045445 100644 --- a/init/property.ly +++ b/init/property.ly @@ -80,19 +80,11 @@ chordInversion 0/1 Find and display chord with inversion? %hmm, (these) abbrevs suck, imo % i guess they're meant as some form of doco % that's what i use them for... -stemup = \notes { - s1*0 - % Stupid hack to make < { \stemup } > work +stemup = \property Voice.ydirection = \up - } -stemboth= \notes { - s1*0 - \property Voice.ydirection = \center -} -stemdown = \notes { - s1*0 - \property Voice.ydirection = \down -} +stemboth= \property Voice.ydirection = \center +stemdown = \property Voice.ydirection = \down + slurup = \notes { s1*0 \property Voice.slurydirection = \up diff --git a/init/table11.ly b/init/table11.ly index b28e661056..257395ea6d 100644 --- a/init/table11.ly +++ b/init/table11.ly @@ -6,7 +6,7 @@ table_eleven = \symboltables { - \font "feta11.afm" + \font "feta11" % index symbol #parameters xmin xmax ymin ymax diff --git a/init/table13.ly b/init/table13.ly index 78ae676aa5..20cb23c70b 100644 --- a/init/table13.ly +++ b/init/table13.ly @@ -6,7 +6,7 @@ table_thirteen = \symboltables { - \font "feta13.afm" + \font "feta13" % index symbol #parameters xmin xmax ymin ymax diff --git a/init/table16.ly b/init/table16.ly index b2a6813d9f..a3460fa9bf 100644 --- a/init/table16.ly +++ b/init/table16.ly @@ -7,7 +7,7 @@ table_sixteen= \symboltables { - \font "feta16.afm" + \font "feta16" % index symbol #parameters xmin xmax ymin ymax diff --git a/init/table20.ly b/init/table20.ly index ccb9bcbef4..b9b1deec9c 100644 --- a/init/table20.ly +++ b/init/table20.ly @@ -7,7 +7,7 @@ table_twenty = \symboltables { - \font "feta20.afm" + \font "feta20" % index symbol #parameters xmin xmax ymin ymax diff --git a/init/table26.ly b/init/table26.ly index 76925b35bb..2b95f42698 100644 --- a/init/table26.ly +++ b/init/table26.ly @@ -6,7 +6,7 @@ table_twentysix = \symboltables { - \font "feta26.afm" + \font "feta26" % index symbol #parameters xmin xmax ymin ymax diff --git a/input/test/chords.ly b/input/test/chords.ly index 2295120799..84f1511fa1 100644 --- a/input/test/chords.ly +++ b/input/test/chords.ly @@ -15,7 +15,7 @@ Would this be acceptable/good enough/convenient for entry? Csus; Csus4 c-4; c-sus %} -scales = \notes\transpose c''\chords{ +scales = \notes \transpose c'' \chords{ % c1-m c-min c4-dim c-aug c-sus c-maj c1-6 c4-7 c-9 c-11 c-13 diff --git a/input/test/spacing-2.ly b/input/test/spacing-2.ly new file mode 100644 index 0000000000..8e1becef07 --- /dev/null +++ b/input/test/spacing-2.ly @@ -0,0 +1,36 @@ +\header { +opus = "BWV 937 (prelude)"; +composer = "J. S. Bach"; +source = "Petits Preludes et Fugues. Urtext. Editions Henry Lemoine, Paris."; +} + +%{ +1. upon stretching: every note should stretch according to duration + +2. 8th notes should be spaced equidistantly. +%} + +\score { + \notes \relative c'' + \type GrandStaff < + \type Staff = SA < + \type Voice = VA { \property Voice.ydirection= 1 + e4 dis4 e2 } + \type Voice = VB { \property Voice.ydirection= -1 + [cis8 a] [fis b] gis2 } + {\key e; } + > + \type Staff = SB { \clef "bass"; \key e; + [a,,16 e dis e] [b'8 b,] [e16 e, gis b] e4 + } +> + +\paper +{ +} +\paper +{ +% linewidth = 5.0 \cm; % ly2dvi barfs on -1 + linewidth = 8.0 \cm; +} +} diff --git a/lily/abbrev.cc b/lily/abbrev.cc index f9f8b89dff..04eb7dec72 100644 --- a/lily/abbrev.cc +++ b/lily/abbrev.cc @@ -27,7 +27,7 @@ Abbreviation::do_print () const } Molecule* -Abbreviation::brew_molecule_p () const +Abbreviation::do_brew_molecule_p () const { Real interbeam_f = paper ()->interbeam_f (stem_l_->mult_i_); Real w = 1.5 * lookup_l ()->ball (2).dim_.x ().length (); diff --git a/lily/abbreviation-beam.cc b/lily/abbreviation-beam.cc index 341a0e8d82..94aa9f4d08 100644 --- a/lily/abbreviation-beam.cc +++ b/lily/abbreviation-beam.cc @@ -30,12 +30,12 @@ Abbreviation_beam::Abbreviation_beam () } Molecule* -Abbreviation_beam::brew_molecule_p () const +Abbreviation_beam::do_brew_molecule_p () const { /* todo */ - return Beam::brew_molecule_p (); + return Beam::do_brew_molecule_p (); #if 0 Molecule *mol_p = new Molecule; // huh? inter-what diff --git a/lily/afm-list.cc b/lily/afm-list.cc new file mode 100644 index 0000000000..d22ff0baf7 --- /dev/null +++ b/lily/afm-list.cc @@ -0,0 +1,49 @@ +#include "pointer.hh" +#include "main.hh" +#include "all-fonts.hh" +#include "debug.hh" +#include "warn.hh" +#include "afm.hh" + +const char * default_font_sz_ = "cmr10"; + + + +All_font_metrics::All_font_metrics (String path) +{ + search_path_.parse_path (path); + + String f = default_font_sz_ + String (".afm"); + f = search_path_.find (f); + if (f.empty_b ()) + error (_f("Can't find default font (PATH = %s)", path)); + + + afm_p_dict_[default_font_sz_] = new Adobe_font_metric (read_afm_file (f)); +} + +Adobe_font_metric * +All_font_metrics::find_font (String name) +{ + if (!afm_p_dict_.elem_b (name)) + { + String path = name + ".afm"; + path = search_path_.find (path); + if (path.empty_b ()) + { + warning (_f ("Can't find `%s'", name)); + return afm_p_dict_[default_font_sz_]; + } + + *mlog << "[" << path; + Adobe_font_metric + * afm_p = new Adobe_font_metric (read_afm_file (path)); + *mlog << "]" << flush ; + + afm_p_dict_[name] = afm_p; + } + + return afm_p_dict_[name]; +} + + diff --git a/lily/afm-reader.cc b/lily/afm-reader.cc index ba3adae70f..3b186d3558 100644 --- a/lily/afm-reader.cc +++ b/lily/afm-reader.cc @@ -58,7 +58,7 @@ read_char_metric (String s) } void -read_char_metrics (Array &mets, Data_file &input) +Adobe_font_metric::read_char_metrics (Data_file &input) { while (!input.eof_b ()) { @@ -66,7 +66,11 @@ read_char_metrics (Array &mets, Data_file &input) String s= input.get_line (); if (s == "EndCharMetrics") return ; - mets.push (read_char_metric (s)); + Adobe_font_char_metric afm_char =read_char_metric (s); + char_metrics_.push (afm_char); + int i = char_metrics_.size ()-1; + ascii_to_metric_idx_ [afm_char.C_] = i; + name_to_metric_dict_ [afm_char.N_] = i; } } @@ -98,14 +102,19 @@ read_box ( Data_file &d) } Adobe_font_metric -read_afm (String fn) +read_afm_file (String fn) { Data_file input (fn); assert (!input.eof_b ()); Adobe_font_metric afm; - + + for (int i=0; i < 256; i++) + { + afm.ascii_to_metric_idx_.push (-1); + } + while (!input.eof_b ()) { input.gobble_leading_white (); @@ -136,7 +145,7 @@ read_afm (String fn) if (key == "StartCharMetrics") { input.get_line (); - read_char_metrics (afm.char_metrics_, input); + afm.read_char_metrics (input); } if (key == "EndFontMetrics") break; diff --git a/lily/afm.cc b/lily/afm.cc index ac38313de7..e81bf3ad10 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -107,12 +107,13 @@ Adobe_font_metric::str () const Adobe_font_char_metric Adobe_font_metric::find_char (String nm, bool warn) const { - for (int i=0; i < char_metrics_.size (); i++) - if (char_metrics_[i].N_ == nm) - return char_metrics_[i]; - if (warn) - warning (_f ("can't find character called `%s'", nm.ch_C())); - - Adobe_font_char_metric a; - return a; + if (warn && !name_to_metric_dict_.elem_b (nm)) + { + Adobe_font_char_metric m; + warning (_f ("can't find character called `%s'", nm.ch_C())); + return m; + } + + return char_metrics_[name_to_metric_dict_ [nm]]; } + diff --git a/lily/atom.cc b/lily/atom.cc index be15086037..efe4bf30f1 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -91,6 +91,7 @@ Atom::str () const Offset Atom::offset () const { + check_infinity_b (); return off_; } diff --git a/lily/bar-column-engraver.cc b/lily/bar-column-engraver.cc index 96dee1b25c..d3c0a1af56 100644 --- a/lily/bar-column-engraver.cc +++ b/lily/bar-column-engraver.cc @@ -30,7 +30,7 @@ Bar_column_engraver::do_creation_processing () void Bar_column_engraver::do_process_requests () { - Scalar pri = get_property ("barColumnPriority"); + Scalar pri = get_property ("barColumnPriority", 0); if (pri.length_i() && pri.isnum_b ()) { break_priority_i_ = int(pri); diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 91c23feb2c..2f1e8ee051 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -45,7 +45,7 @@ Bar_engraver::create_bar () { bar_p_ = new Bar; bar_p_->break_priority_i_ = 0; - String default_type = get_property ("defaultBarType"); + String default_type = get_property ("defaultBarType", 0); if (default_type.length_i ()) { bar_p_->type_str_ = default_type; @@ -85,7 +85,7 @@ Bar_engraver::do_process_requests() else { Time_description const *time = get_staff_info().time_C_; - String always = get_property ("barAlways"); + String always = get_property ("barAlways", 0); if ((time && !time->whole_in_measure_) || always.length_i ()) create_bar (); } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 67e4dc2fc4..2d0412f427 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -50,7 +50,7 @@ Bar_number_engraver::acknowledge_element (Score_element_info i) script_p_->specs_p_ = td_p->clone (); script_p_->breakable_b_ = true; - Scalar pri = get_property ("barNumberBreakPriority"); + Scalar pri = get_property ("barNumberBreakPriority", 0); if (pri.length_i () && pri.isnum_b ()) { script_p_->break_priority_i_ = int (pri); @@ -58,7 +58,7 @@ Bar_number_engraver::acknowledge_element (Score_element_info i) else script_p_->break_priority_i_ = b->break_priority_i_; - Scalar padding = get_property ("barScriptPadding"); + Scalar padding = get_property ("barScriptPadding", 0); if (padding.length_i() && padding.isnum_b ()) { script_p_->padding_f_ = Real(padding); diff --git a/lily/bar.cc b/lily/bar.cc index 7e49b7088f..58e4ab9ed6 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -30,7 +30,7 @@ Bar::do_print () const } Molecule* -Bar::brew_molecule_p () const +Bar::do_brew_molecule_p () const { Paper_def *p = paper (); Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize")); diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index c8357fa388..7353da47f8 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -1,135 +1,164 @@ -/* - beam-grav.cc -- implement Beam_engraver - +/* + beam-engraver.cc -- implement Beam_engraver + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ - (c) 1997--1998 Han-Wen Nienhuys -*/ -#include "duration-convert.hh" -#include "time-description.hh" #include "beam-engraver.hh" -#include "stem.hh" -#include "beam.hh" #include "musical-request.hh" +#include "beam.hh" #include "grouping.hh" -#include "p-col.hh" +#include "stem.hh" #include "warn.hh" +#include "time-description.hh" -Beam_engraver::Beam_engraver() +Beam_engraver::Beam_engraver () { - span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] =0; - beam_p_ =0; - current_grouping_p_ =0; + beam_p_ = 0; + finished_beam_p_ =0; + finished_grouping_p_ = 0; + grouping_p_ =0; + reqs_drul_[LEFT] = reqs_drul_[RIGHT] =0; } bool -Beam_engraver::do_try_music (Music*r) +Beam_engraver::do_try_music (Music *m) { - Beam_req* b = dynamic_cast (r); - if (!b) - return false; - - if (bool (beam_p_) == bool (b->spantype_ == START)) - return false; - - Direction d = (!beam_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b)) - return false; - - span_reqs_drul_[d] = b; - return true; + if (Beam_req * c = dynamic_cast(m)) + { + reqs_drul_[c->spantype_] = c; + return true; + } + return false; } + void -Beam_engraver::do_process_requests() +Beam_engraver::do_process_requests () { - if (beam_p_ || !span_reqs_drul_[LEFT]) - return; + if (reqs_drul_[STOP]) + { + if (!beam_p_) + reqs_drul_[STOP]->warning (_("No beam to stop")); + finished_beam_p_ = beam_p_; + finished_grouping_p_ = grouping_p_; - current_grouping_p_ = new Rhythmic_grouping; - beam_p_ = new Beam; + beam_p_ = 0; + grouping_p_ = 0; + } + + if (reqs_drul_[START]) + { + beam_p_ = new Beam; + grouping_p_ = new Rhythmic_grouping; - Scalar prop = get_property ("beamslopedamping"); - if (prop.isnum_b ()) - beam_p_->damping_i_ = prop; + Scalar prop = get_property ("beamslopedamping", 0); + if (prop.isnum_b ()) + beam_p_->damping_i_ = prop; - prop = get_property ("beamquantisation"); - if (prop.isnum_b ()) - beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; + prop = get_property ("beamquantisation", 0); + if (prop.isnum_b ()) + beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; - announce_element (Score_element_info (beam_p_, span_reqs_drul_[LEFT])); + announce_element (Score_element_info (beam_p_, reqs_drul_[START])); + } } void -Beam_engraver::do_pre_move_processing() +Beam_engraver::typeset_beam () { - if (!beam_p_ || !span_reqs_drul_[RIGHT]) - return; - - Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; - rg_C->extend (current_grouping_p_->interval()); - beam_p_->set_grouping (*rg_C, *current_grouping_p_); - typeset_element (beam_p_); - beam_p_ = 0; - - delete current_grouping_p_; - current_grouping_p_ = 0; - - span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0; + if (finished_beam_p_) + { + Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; + rg_C->extend (finished_grouping_p_->interval()); + finished_beam_p_->set_grouping (*rg_C, *finished_grouping_p_); + typeset_element (finished_beam_p_); + finished_beam_p_ = 0; + + delete finished_grouping_p_; + finished_grouping_p_= 0; + + reqs_drul_[STOP] = 0; + } } void -Beam_engraver::do_removal_processing() +Beam_engraver::do_post_move_processing () { - if (beam_p_) - { - span_reqs_drul_[LEFT]->warning (_("unterminated beam")); - typeset_element (beam_p_); - beam_p_ =0; - } + reqs_drul_ [START] =0; } - void -Beam_engraver::acknowledge_element (Score_element_info i) +Beam_engraver::do_pre_move_processing () { - Stem* s = dynamic_cast (i.elem_l_); - if (!beam_p_ || !s) - return; + typeset_beam (); +} - if (!dynamic_cast (i.req_l_)) - { - ::warning ( _("Stem must have Rhythmic structure.")); - return; - } +void +Beam_engraver::do_removal_processing () +{ + typeset_beam (); + finished_beam_p_ = beam_p_; + finished_grouping_p_ = grouping_p_; + typeset_beam (); +} - Rhythmic_req *rhythmic_req = dynamic_cast (i.req_l_); - if (rhythmic_req->duration_.durlog_i_<= 2) - { - rhythmic_req->warning (_ ("stem doesn't fit in beam")); - return; - } +void +Beam_engraver::acknowledge_element (Score_element_info info) +{ + if (beam_p_) + { + Stem* stem_l = dynamic_cast (info.elem_l_); + if (!stem_l) + return; + + + Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); + if (!rhythmic_req) + { + String s=_("Stem must have Rhythmic structure."); + if (info.req_l_) + info.req_l_->warning(s); + else + ::warning (s); + + return; + } + + + if (rhythmic_req->duration_.durlog_i_<= 2) + { + rhythmic_req->warning (_ ("stem doesn't fit in beam")); + return; + } + + /* + TODO: do something sensible if it doesn't fit in the beam. + */ + Moment start = get_staff_info().time_C_->whole_in_measure_; + + if (!grouping_p_->child_fit_b (start)) + { + String s (_("please fix me") + ": " + + _f ("stem at %s doesn't fit in beam", now_moment ().str ())); + + if (info.req_l_) + info.req_l_->warning(s); + else + warning (s); + } + else + { + grouping_p_->add_child (start, rhythmic_req->duration ()); + stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; + beam_p_->add_stem (stem_l); + } + } +} - /* - TODO: do something sensible if it doesn't fit in the beam. - */ - Moment start = get_staff_info().time_C_->whole_in_measure_; - if (!current_grouping_p_->child_fit_b (start)) - { - String s (_("please fix me") + ": " - + _f ("stem at %s doesn't fit in beam", now_moment ().str ())); - if (i.req_l_) - i.req_l_->warning(s); - else - warning (s); - } - else - { - current_grouping_p_->add_child (start, rhythmic_req->duration ()); - s->flag_i_ = rhythmic_req->duration_.durlog_i_; - beam_p_->add_stem (s); - } -} ADD_THIS_TRANSLATOR(Beam_engraver); diff --git a/lily/beam.cc b/lily/beam.cc index 6e50bbf30b..ec41c7a964 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -62,10 +62,9 @@ Beam::add_stem (Stem*s) } Molecule* -Beam::brew_molecule_p () const +Beam::do_brew_molecule_p () const { Molecule *mol_p = new Molecule; - Real internote_f = paper ()->internote_f (); Real x0 = stems_[0]->hpos_f (); @@ -89,7 +88,7 @@ Beam::brew_molecule_p () const Offset Beam::center () const { - Real w= (paper ()->note_width () + width ().length ())/2.0; + Real w= (paper ()->note_width () + extent (X_AXIS).length ())/2.0; return Offset (w, (left_y_ + w* slope_f_)*paper ()->internote_f ()); } @@ -610,12 +609,17 @@ 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 beams_i_drul_[LEFT] = b[i]; - s->beams_i_drul_[RIGHT] = b[i+1]; - multiple_i_ = multiple_i_ >? (b[i] >? b[i+1]); + Direction d = LEFT; + do { + if (s->beams_i_drul_[d] < 0) + s->beams_i_drul_[d] = b[i]; + + multiple_i_ = multiple_i_ >? s->beams_i_drul_[d]; + i++; + } while ((flip (&d)) != LEFT); } } diff --git a/lily/bow.cc b/lily/bow.cc index 016308a233..935eae60b3 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -25,7 +25,7 @@ Bow::Bow () } Molecule* -Bow::brew_molecule_p () const +Bow::do_brew_molecule_p () const { Real thick = paper ()->get_var ("slur_thickness"); Array c = get_controls (); @@ -63,7 +63,7 @@ Bow::center () const { Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; - Real dx = width ().length (); + Real dx = extent(X_AXIS).length (); return Offset (dx / 2, dy); } @@ -115,7 +115,7 @@ Bow::get_encompass_offset_arr () const { Offset d (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT], dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]); - d.x() += width (). length (); + d.x() += extent (X_AXIS). length (); Array notes; notes.push (Offset (0, 0)); diff --git a/lily/cbeam-engraver.cc b/lily/cbeam-engraver.cc deleted file mode 100644 index 1b6589279d..0000000000 --- a/lily/cbeam-engraver.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - cbeam-engraver.cc -- implement Command_beam_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1998 Han-Wen Nienhuys - - */ - -#include "cbeam-engraver.hh" -#include "musical-request.hh" -#include "beam.hh" -#include "grouping.hh" -#include "stem.hh" -#include "warn.hh" -#include "time-description.hh" - -Command_beam_engraver::Command_beam_engraver () -{ - beam_p_ = 0; - finished_beam_p_ =0; - finished_grouping_p_ = 0; - grouping_p_ =0; - reqs_drul_[LEFT] = reqs_drul_[RIGHT] =0; -} - -bool -Command_beam_engraver::do_try_music (Music *m) -{ - if (Beam_req * c = dynamic_cast(m)) - { - reqs_drul_[c->spantype_] = c; - return true; - } - return false; -} - - -void -Command_beam_engraver::do_process_requests () -{ - if (reqs_drul_[STOP]) - { - if (!beam_p_) - reqs_drul_[STOP]->warning (_("No beam to stop")); - finished_beam_p_ = beam_p_; - finished_grouping_p_ = grouping_p_; - - beam_p_ = 0; - grouping_p_ = 0; - } - - if (reqs_drul_[START]) - { - beam_p_ = new Beam; - grouping_p_ = new Rhythmic_grouping; - - Scalar prop = get_property ("beamslopedamping"); - if (prop.isnum_b ()) - beam_p_->damping_i_ = prop; - - prop = get_property ("beamquantisation"); - if (prop.isnum_b ()) - beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; - - announce_element (Score_element_info (beam_p_, reqs_drul_[START])); - } -} - -void -Command_beam_engraver::typeset_beam () -{ - if (finished_beam_p_) - { - Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; - rg_C->extend (finished_grouping_p_->interval()); - finished_beam_p_->set_grouping (*rg_C, *finished_grouping_p_); - typeset_element (finished_beam_p_); - finished_beam_p_ = 0; - - delete finished_grouping_p_; - finished_grouping_p_= 0; - - reqs_drul_[STOP] = 0; - } -} - -void -Command_beam_engraver::do_post_move_processing () -{ - reqs_drul_ [START] =0; -} - -void -Command_beam_engraver::do_pre_move_processing () -{ - typeset_beam (); -} - -void -Command_beam_engraver::do_removal_processing () -{ - typeset_beam (); - finished_beam_p_ = beam_p_; - finished_grouping_p_ = grouping_p_; - typeset_beam (); -} - -void -Command_beam_engraver::acknowledge_element (Score_element_info info) -{ - if (beam_p_) - { - Stem* stem_l = dynamic_cast (info.elem_l_); - if (!stem_l) - return; - - - Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); - if (!rhythmic_req) - { - String s=_("Stem must have Rhythmic structure."); - if (info.req_l_) - info.req_l_->warning(s); - else - ::warning (s); - - return; - } - - - if (rhythmic_req->duration_.durlog_i_<= 2) - { - rhythmic_req->warning (_ ("stem doesn't fit in beam")); - return; - } - - /* - TODO: do something sensible if it doesn't fit in the beam. - */ - Moment start = get_staff_info().time_C_->whole_in_measure_; - - if (!grouping_p_->child_fit_b (start)) - { - String s (_("please fix me") + ": " - + _f ("stem at %s doesn't fit in beam", now_moment ().str ())); - - if (info.req_l_) - info.req_l_->warning(s); - else - warning (s); - } - else - { - grouping_p_->add_child (start, rhythmic_req->duration ()); - stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; - beam_p_->add_stem (stem_l); - } - } -} - - - -ADD_THIS_TRANSLATOR(Command_beam_engraver); diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index b9d87032e1..79190f393b 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -14,6 +14,7 @@ #include "paper-def.hh" #include "main.hh" #include "dimensions.hh" +#include "g-text-item.hh" ADD_THIS_TRANSLATOR (Chord_name_engraver); @@ -39,6 +40,11 @@ Chord_name_engraver::do_try_music (Music* m) return false; } +/* + UGH. + + Split this routine into neat packets + */ void Chord_name_engraver::do_process_requests () { @@ -53,28 +59,19 @@ Chord_name_engraver::do_process_requests () - move this stuff to new Item class Chord_name - switch on property, add american (?) chordNameStyle - Scalar chordNameStyle = get_property ("chordNameStyle"); + Scalar chordNameStyle = get_property ("chordNameStyle", 0); if (chordNameStyle == "Banter") chord = pitches_to_banter (pitch_arr_)); */ - Scalar style = get_property ("textstyle"); - Scalar alignment = get_property ("textalignment"); - Text_def* text_p = new Text_def; - text_p->align_dir_ = LEFT; - if (style.length_i ()) - text_p->style_str_ = style; - if (alignment.isnum_b()) - text_p->align_dir_= (Direction)(int)alignment; - - + /* find tonic: after longest line of triads */ int tonic_i = 0; - Scalar chord_inversions = get_property ("chordInversion"); + Scalar chord_inversions = get_property ("chordInversion", 0); if (chord_inversions.to_bool ()) { int longest_i = 0; @@ -190,10 +187,15 @@ Chord_name_engraver::do_process_requests () + acc[tonic.accidental_i_ + 2]; } - text_p->text_str_ = tonic_str + "$^{" + add_str + "}$" + inversion_str; - Text_item* item_p = new Text_item (text_p); - item_p->dir_ = DOWN; - item_p->fat_b_ = true; + + G_text_item* item_p = new G_text_item; + + + item_p->text_str_ = tonic_str + "$^{" + add_str + "}$" + inversion_str; + Scalar style = get_property ("textstyle", 0); + if (style.length_i ()) + item_p->style_str_ = style; + text_p_arr_.push (item_p); announce_element (Score_element_info (item_p, 0)); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 775a1885f3..ca50b0dab2 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -166,7 +166,7 @@ Clef_engraver::acknowledge_element (Score_element_info info) void Clef_engraver::do_creation_processing() { - Scalar def = get_property ("defaultClef"); + Scalar def = get_property ("defaultClef", 0); if (def.to_bool ()) // egcs: Scalar to bool is ambiguous set_type (def); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index d860b494f2..e65cd80676 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -50,7 +50,7 @@ Clef_item::Clef_item() Molecule* -Clef_item::brew_molecule_p() const +Clef_item::do_brew_molecule_p() const { String t = symbol_; if (change_b_) diff --git a/lily/col-info.cc b/lily/col-info.cc index 581a9491b7..fcacaf53ec 100644 --- a/lily/col-info.cc +++ b/lily/col-info.cc @@ -35,7 +35,7 @@ Column_info::Column_info (Paper_column *col_l, Real const *fixed_C) fixpos_p_.set_l (fixed_C); ugh_b_ = false; pcol_l_ = col_l; - width_ = pcol_l_->width(); + width_ = pcol_l_->extent(X_AXIS); if (width_.empty_b()) width_ = Interval(0,0); } diff --git a/lily/command-request.cc b/lily/command-request.cc index 0ce2b67d6c..1ab0353bc5 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -50,9 +50,6 @@ Bar_req::do_equal_b (Request*r) const return b && type_str_ == b->type_str_; } -void -Command_tie_req::do_print () const -{} diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 1e9b804a1f..47eff97b90 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -32,7 +32,7 @@ static Real absdyn_dim = 10 PT; // ugh Atom Crescendo::get_symbol() const { - Real w_dim = width().length (); + Real w_dim = extent(X_AXIS).length (); if (dyn_b_drul_[LEFT]) { w_dim -= absdyn_dim; @@ -61,7 +61,7 @@ Crescendo::get_symbol() const } Molecule* -Crescendo::brew_molecule_p() const +Crescendo::do_brew_molecule_p() const { Molecule* m_p =0; Real x_off_dim=0.0; diff --git a/lily/dimension-cache.cc b/lily/dimension-cache.cc new file mode 100644 index 0000000000..8746337cca --- /dev/null +++ b/lily/dimension-cache.cc @@ -0,0 +1,151 @@ +/* + dimension-cache.cc -- implement Dimension_cache + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + */ + +#include "dimension-cache.hh" +#include "parray.hh" + +Dimension_cache::Dimension_cache (Dimension_cache const &d) +{ + init(); + empty_b_ = d.empty_b_; +} + +Dimension_cache::Dimension_cache () +{ + init(); +} + +void +Dimension_cache::init() +{ + offset_ =0.0; + elt_l_ = 0; + dim_.set_empty (); + parent_l_ =0; + valid_b_ = false; + empty_b_ = false; +} + + +void +Dimension_cache::invalidate () +{ + valid_b_ = false; + invalidate_dependencies (); +} + +void +Dimension_cache::invalidate_dependencies () +{ + for (int i=0; i < dependencies_l_arr_.size (); i++) + { + Dimension_cache * g = dependencies_l_arr_[i]; + if (g->valid_b_) + { + g->invalidate (); + } + } +} + +void +Dimension_cache::set_offset (Real x) +{ + invalidate_dependencies (); + offset_ = x; +} + +void +Dimension_cache::translate (Real x) +{ + invalidate_dependencies (); + offset_ += x; +} + + +Real +Dimension_cache::absolute_coordinate () const +{ + Real r = offset_; + for (Dimension_cache * c = parent_l_; + c; c = c->parent_l_) + r += c->offset_; + return r; +} + +Real +Dimension_cache::relative_coordinate (Dimension_cache *d) const +{ + Real r =0.0; + + for (Dimension_cache* c = parent_l_; + c != d; + c = c->parent_l_) + r += c->offset_; + return r; +} + +Dimension_cache * +Dimension_cache::common_group (Dimension_cache const* s) const +{ + Link_array my_groups; + for (Dimension_cache const *c = this; + c ; c = c->parent_l_) + my_groups.push (c); + + + Dimension_cache const *common=0; + + for (Dimension_cache const * d = s; + !common && d; + d = d->parent_l_) + common = my_groups.find_l (d); + + return (Dimension_cache*)common; +} + + + +void +Dimension_cache::set_empty (bool b) +{ + if (empty_b_ != b) + { + empty_b_ = b; + if (!empty_b_) + invalidate (); + } +} + +void +Dimension_cache::set_dim (Interval v) +{ + dim_ = v; + valid_b_ = true; +} + + +Interval +Dimension_cache::get_dim () const +{ + Interval r; + if (empty_b_) + { + r.set_empty (); + return r; + } + + assert (valid_b_); + + r=dim_; + if (!r.empty_b()) // float exception on DEC Alpha + r += offset_; + + return r; +} + + diff --git a/lily/directional-spanner.cc b/lily/directional-spanner.cc index bd4954920b..2be0a8c774 100644 --- a/lily/directional-spanner.cc +++ b/lily/directional-spanner.cc @@ -21,7 +21,7 @@ Directional_spanner::Directional_spanner() Offset Directional_spanner::center () const { - Real w= width ().length (); + Real w= extent (X_AXIS).length (); Offset o (w/2, 0); return o; } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 97afd43bf2..a802c5cfa2 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -47,10 +47,10 @@ Dot_column::do_pre_processing () { Interval w; for (int i=0; i < head_l_arr_.size (); i++) - w.unite (head_l_arr_[i]->width ()); + w.unite (head_l_arr_[i]->extent (X_AXIS)); if (!w.empty_b ()) - translate_axis (w[RIGHT] - width() [LEFT],X_AXIS); + translate_axis (w[RIGHT] - extent(X_AXIS) [LEFT],X_AXIS); } diff --git a/lily/dots.cc b/lily/dots.cc index 8b39c3e566..1a40a51570 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -30,7 +30,7 @@ Dots::do_post_processing () } Molecule* -Dots::brew_molecule_p () const +Dots::do_brew_molecule_p () const { Molecule *out = new Molecule; Atom fill = lookup_l ()->fill (Box (Interval (0,0), diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index bf4b890c70..dd36db400b 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -15,12 +15,45 @@ #include "score-column.hh" #include "staff-sym.hh" #include "note-column.hh" +#include "g-text-item.hh" +#include "g-staff-side.hh" +#include "engraver.hh" +#include "stem.hh" +#include "note-head.hh" + +/** + print text & hairpin dynamics. + */ +class Dynamic_engraver : public Engraver +{ + G_text_item * text_p_; + G_staff_side_item * staff_side_p_; + + Crescendo * to_end_cresc_p_; + Crescendo * cresc_p_; + Span_dynamic_req * cresc_req_l_; + Array dynamic_req_l_arr_; + void typeset_all (); +public: + VIRTUAL_COPY_CONS(Translator); + Dynamic_engraver(); + +protected: + virtual void do_removal_processing (); + virtual void acknowledge_element (Score_element_info); + virtual bool do_try_music (Music *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +}; + + Dynamic_engraver::Dynamic_engraver() { do_post_move_processing(); - dir_ = CENTER; - dynamic_p_ =0; + text_p_ =0; + staff_side_p_ =0; to_end_cresc_p_ = cresc_p_ = 0; cresc_req_l_ = 0; } @@ -54,24 +87,33 @@ Dynamic_engraver::do_process_requests() Dynamic_req *dreq_l = dynamic_req_l_arr_[i]; if (Absolute_dynamic_req *absd = dynamic_cast (dreq_l)) { - - if (dynamic_p_) + if (text_p_) { dynamic_req_l_arr_[i]->warning (_("Got a dynamic already. Continuing dazed and confused")); continue; } - Text_def * td_p = new Text_def; String loud = absd->loudness_str (); - td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh - td_p->style_str_ = "dynamic"; - td_p->align_dir_ = RIGHT; // Ugh, Doesn't give any effect? - Real nw_f = paper ()->note_width () * 0.8; - dynamic_p_ = new Text_item (td_p); - // dynamic_p_->translate (Offset (nw_f, 0)); // Removed, Mats B + text_p_ = new G_text_item; + text_p_->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; + Scalar prop = get_property ("dynamicStyle", 0); + + text_p_->style_str_ = prop.length_i () ? prop : "dynamic"; + + staff_side_p_ = new G_staff_side_item; + staff_side_p_->set_victim (text_p_); + - announce_element (Score_element_info (dynamic_p_, dreq_l)); + prop = get_property ("dynamicDir", 0); + if (prop.isnum_b ()) + { + staff_side_p_->dir_ = (Direction) (int) prop; + } + + + announce_element (Score_element_info (text_p_, dreq_l)); + announce_element (Score_element_info (staff_side_p_, dreq_l)); } else if (Span_dynamic_req *span_l = dynamic_cast (dreq_l)) { @@ -86,6 +128,12 @@ Dynamic_engraver::do_process_requests() assert (!to_end_cresc_p_); to_end_cresc_p_ =cresc_p_; cresc_p_ = 0; + Scalar prop = get_property ("dynamicDir", 0); + if (prop.isnum_b ()) + { + to_end_cresc_p_->dir_ = (Direction) (int) prop; + } + } } else if (span_l->spantype_ == START) @@ -110,9 +158,11 @@ Dynamic_engraver::do_process_requests() cresc_p_ = new_cresc_p; cresc_p_->set_bounds(LEFT,get_staff_info().musical_l ()); - if (dynamic_p_) + if (text_p_) { cresc_p_->dyn_b_drul_[LEFT] = true; + if (to_end_cresc_p_) + to_end_cresc_p_->dyn_b_drul_[RIGHT] = true; } } } @@ -122,33 +172,12 @@ Dynamic_engraver::do_pre_move_processing() { Staff_symbol* s_l = get_staff_info().staff_sym_l_; if (to_end_cresc_p_) - { - if (dynamic_p_) - to_end_cresc_p_->dyn_b_drul_[RIGHT]=true; + to_end_cresc_p_->add_support (s_l); + if (staff_side_p_) + staff_side_p_->add_support (s_l); - Scalar prop = get_property ("dynamicdir"); - if (prop.isnum_b ()) - { - to_end_cresc_p_->dir_ = (Direction) (int) prop; - } - to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ()); - to_end_cresc_p_->add_support (s_l); - typeset_element (to_end_cresc_p_); - to_end_cresc_p_ = 0; - } - if (dynamic_p_) - { - Scalar prop = get_property ("dynamicdir"); - if (prop.isnum_b ()) - { - dynamic_p_->dir_ = (Direction) (int) prop; - } - - dynamic_p_->add_support (s_l); - typeset_element (dynamic_p_); - dynamic_p_ = 0; - } + typeset_all (); } @@ -161,29 +190,41 @@ Dynamic_engraver::do_removal_processing () if (cresc_p_) { typeset_element (cresc_p_ ); - cresc_req_l_->warning (_ ("unended crescendo")); cresc_p_ =0; } + typeset_all (); +} + + +void +Dynamic_engraver::typeset_all () +{ if (to_end_cresc_p_) { + to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ()); typeset_element (to_end_cresc_p_); to_end_cresc_p_ =0; } - if (dynamic_p_) + if (text_p_) { - typeset_element (dynamic_p_); - dynamic_p_ =0; + typeset_element (text_p_); + typeset_element (staff_side_p_); + text_p_ =0; + staff_side_p_ =0; } } + void Dynamic_engraver::acknowledge_element (Score_element_info i) { - if (dynamic_cast (i.elem_l_)) + if (dynamic_cast (i.elem_l_) + || dynamic_cast (i.elem_l_) + ) { - if (dynamic_p_) - dynamic_p_->add_support (i.elem_l_); + if (staff_side_p_) + staff_side_p_->add_support (i.elem_l_); if (to_end_cresc_p_) to_end_cresc_p_->add_support (i.elem_l_); diff --git a/lily/encompass-info.cc b/lily/encompass-info.cc index 163287b655..1a352c49a7 100644 --- a/lily/encompass-info.cc +++ b/lily/encompass-info.cc @@ -45,7 +45,7 @@ Encompass_info::Encompass_info (Note_column const* note, Direction dir) if (stem->dir_ != dir) o_.x () -= 0.5 * notewidth * stem->dir_; - o_.y () = stem->height ()[dir]; + o_.y () = stem->extent (Y_AXIS)[dir]; /* leave a gap: slur mustn't touch head/stem */ diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc index 98190d6748..1ba1f66f79 100644 --- a/lily/extender-spanner.cc +++ b/lily/extender-spanner.cc @@ -40,17 +40,17 @@ Extender_spanner::~Extender_spanner () Offset Extender_spanner::center () const { - Real dx = width ().length (); + Real dx = extent (X_AXIS).length (); return Offset (dx / 2, 0); } Molecule* -Extender_spanner::brew_molecule_p () const +Extender_spanner::do_brew_molecule_p () const { Molecule* mol_p = new Molecule; - Real w = width ().length (); + Real w = extent (X_AXIS).length (); w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); @@ -94,9 +94,9 @@ Extender_spanner::do_post_processing () { Text_item* t = textitem_l_drul_[d] ? textitem_l_drul_[d] : textitem_l_drul_[(Direction)-d]; - dy_f_drul_[d] += t->height ().length () / 2; + dy_f_drul_[d] += t->extent (Y_AXIS).length () / 2; if (d == LEFT) - dx_f_drul_[d] += t->width ().length (); + dx_f_drul_[d] += t->extent (X_AXIS).length (); else dx_f_drul_[d] -= d * nw_f / 2; diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index e67c90a287..d71b5fddb6 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -18,7 +18,7 @@ Font_size_engraver::Font_size_engraver () void Font_size_engraver::do_process_requests () { - Scalar s (get_property ("fontsize")); + Scalar s (get_property ("fontsize", 0)); if (s.length_i () && s.isnum_b ()) { diff --git a/lily/g-staff-side.cc b/lily/g-staff-side.cc new file mode 100644 index 0000000000..357f5854a3 --- /dev/null +++ b/lily/g-staff-side.cc @@ -0,0 +1,78 @@ +/* + g-staff-side.cc -- implement G_staff_side_item + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#include "g-staff-side.hh" + +void +G_staff_side_item::do_pre_processing () +{ + if (!dir_) + set_default_direction (); +} + +void +G_staff_side_item::set_default_direction () +{ + dir_ = DOWN; +} + +G_staff_side_item::G_staff_side_item () +{ + dir_ = CENTER; + to_position_l_ = 0; + transparent_b_ = true; +} + +void +G_staff_side_item::set_victim (Score_element *e) +{ + add_dependency (e); + to_position_l_ = e; + to_position_l_->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS]; +} + +void +G_staff_side_item::add_support (Score_element*e) +{ + add_dependency (e); + support_l_arr_.push (e); +} + + +void +G_staff_side_item::do_substitute_dependency (Score_element*o, Score_element*n) +{ + if (o == to_position_l_) + to_position_l_ = n; + else + support_l_arr_.unordered_substitute (o,n); +} + + +void +G_staff_side_item::do_post_processing () +{ + Dimension_cache *common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0), + Y_AXIS); + + Interval dim; + for (int i=0; i < support_l_arr_.size (); i++) + { + Score_element * e = support_l_arr_ [i]; + Real coord = e->relative_coordinate (common, Y_AXIS); + dim.unite (coord + e->extent (Y_AXIS)); + } + if (!support_l_arr_.size ()) + dim = Interval (0,0); + + Interval sym_dim = to_position_l_->extent (Y_AXIS); + Real off = dim_cache_[Y_AXIS].relative_coordinate (common); + + dim_cache_[Y_AXIS].set_offset (dim[dir_] - sym_dim[-dir_] - off); +} diff --git a/lily/g-text-item.cc b/lily/g-text-item.cc new file mode 100644 index 0000000000..26751aecb9 --- /dev/null +++ b/lily/g-text-item.cc @@ -0,0 +1,26 @@ +/* + g-text-item.cc -- implement G_text_item + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#include "g-text-item.hh" +#include "atom.hh" +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" + +Molecule* +G_text_item::do_brew_molecule_p () const +{ + Atom a= paper ()->lookup_l(0)->text (style_str_,text_str_); + return new Molecule (a); +} + +G_text_item::G_text_item () +{ + style_str_ = "roman"; +} diff --git a/lily/graphical-axis-group.cc b/lily/graphical-axis-group.cc index 0912244897..2f38a8be7f 100644 --- a/lily/graphical-axis-group.cc +++ b/lily/graphical-axis-group.cc @@ -15,8 +15,8 @@ Graphical_axis_group at one time. */ Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s) { - axis1_ = s.axis1_; - axis2_ = s.axis2_; + axes_[0] = s.axes_[0]; + axes_[1] = s.axes_[1]; } bool @@ -37,13 +37,15 @@ Graphical_axis_group::extent (Axis axis) const void Graphical_axis_group::add_element (Graphical_element*e) { - Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_]; - Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_]; - - assert (!g1 || g1 == this); - assert (!g2 || g2 == this); - g1 = this; - g2 = this; + for (int i = 0; i < 2; i++) + { + Axis a = axes_[i]; + Dimension_cache * &d = e->dim_cache_[a].parent_l_; + assert (!d || d == &dim_cache_[a]); + d = &dim_cache_[a]; + d->dependencies_l_arr_.push (&dim_cache_[a]); + } + elem_l_arr_.push (e); } @@ -55,8 +57,13 @@ Graphical_axis_group::remove_element (Graphical_element*e) assert (contains_b (e)); elem_l_arr_.unordered_substitute (e,0); - e->axis_group_l_a_[axis1_] = 0; - e->axis_group_l_a_[axis2_] = 0; + for (int i=0; i< 2; i++) + { + Axis a=axes_[i]; + Dimension_cache * d = &e->dim_cache_[a]; + d->parent_l_ = 0; + d->dependencies_l_arr_.unordered_substitute (&dim_cache_[a], 0); + } } void @@ -65,8 +72,14 @@ Graphical_axis_group::remove_all () for (int i=0; i < elem_l_arr_.size(); i++) { Graphical_element*e=elem_l_arr_[i]; - e->axis_group_l_a_[axis1_] = 0; - e->axis_group_l_a_[axis2_] = 0; + for (int i=0; i< 2; i++) + { + Axis a=axes_[i]; + Dimension_cache * d = &e->dim_cache_[a]; + d->parent_l_ = 0; + d->dependencies_l_arr_.clear (); + } + } elem_l_arr_.clear (); } @@ -83,8 +96,8 @@ Graphical_axis_group::do_print() const Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2) { - axis1_ =a1; - axis2_ = a2; + axes_[0] = a1; + axes_[1] = a2; } diff --git a/lily/graphical-element.cc b/lily/graphical-element.cc index de60a0b584..921608e9ae 100644 --- a/lily/graphical-element.cc +++ b/lily/graphical-element.cc @@ -13,7 +13,7 @@ bool Graphical_element::empty_b () const { - return empty_b_; + return dim_cache_[X_AXIS].empty_b () && dim_cache_[Y_AXIS].empty_b (); } Graphical_element::Graphical_element () @@ -22,42 +22,21 @@ Graphical_element::Graphical_element () } Graphical_element::Graphical_element (Graphical_element const &s) + : dim_cache_ (s.dim_cache_) { init (); - empty_b_ = s.empty_b_; - axis_group_l_a_[0] = axis_group_l_a_[1] =0; - offset_ = Offset (0,0); // Hmmmm.... Should copy? } void Graphical_element::init () { - empty_b_ = false; - axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0; - offset_ = Offset (0,0); - cached_valid_b_a_ [X_AXIS] = cached_valid_b_a_[Y_AXIS] = false; -} - -void -Graphical_element::invalidate_cache (Axis a) -{ - Graphical_element * g = this; - while (g && g->cached_valid_b_a_[a]) - { - g->cached_valid_b_a_ [a] = false; - g = g->axis_group_l_a_[a]; - } + dim_cache_[X_AXIS].elt_l_ = dim_cache_[Y_AXIS].elt_l_ = this; } Real Graphical_element::absolute_coordinate (Axis a) const { - Real r = offset_[a]; - for (Graphical_axis_group * 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 dim_cache_[a].absolute_coordinate (); } @@ -67,46 +46,26 @@ Graphical_element::absolute_offset() const return Offset (absolute_coordinate (X_AXIS), absolute_coordinate (Y_AXIS)); } + + void Graphical_element::translate_axis (Real y, Axis a) { - if (axis_group_l_a_[a]) - axis_group_l_a_[a]->invalidate_cache (a); - offset_[a] += y; -} + dim_cache_[a].translate (y); +} Real -Graphical_element::relative_coordinate (Graphical_axis_group*e, Axis a) const +Graphical_element::relative_coordinate (Dimension_cache*e, Axis a) const { - Real r =0.0; - for (Graphical_axis_group * 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 dim_cache_[a].relative_coordinate (e); } -Graphical_axis_group* +Dimension_cache * Graphical_element::common_group (Graphical_element const* s, Axis a) const { - Link_array my_groups; - for (Graphical_axis_group * 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); - - Graphical_axis_group* common_l=0; - for (Graphical_axis_group * 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 dim_cache_[a].common_group (&s->dim_cache_[a]); } - - void Graphical_element::translate (Offset offset) { @@ -114,76 +73,88 @@ Graphical_element::translate (Offset offset) translate_axis (offset[X_AXIS], X_AXIS); } -Interval -Graphical_element::width() const -{ - return extent (X_AXIS); -} void Graphical_element::set_empty (bool b) { - if (empty_b_ != b) - { - empty_b_ = b; - if (!empty_b_) - { - invalidate_cache (X_AXIS); - invalidate_cache (Y_AXIS); - } - } - + dim_cache_[X_AXIS].set_empty (b); + dim_cache_[Y_AXIS].set_empty (b); } Interval Graphical_element::extent (Axis a) const { - if (empty_b_) + Dimension_cache const * d = //(Dimension_cache*) + &dim_cache_[a]; + + if (d->empty_b ()) return Interval (); - if (!cached_valid_b_a_[a]) - { - Graphical_element *self = (Graphical_element*)this; - self->cached_dimension_a_[a] = (a == X_AXIS)? do_width(): do_height (); - self->cached_valid_b_a_[a] = true; - } + if (!d->valid_b ()) + ((Dimension_cache*)d)->set_dim ((a == X_AXIS)? do_width(): do_height ()); - Interval r(cached_dimension_a_[a]); - if (!r.empty_b()) // float exception on DEC Alpha - r+=offset_[a]; - return r; -} - -Interval -Graphical_element::height() const -{ - return extent (Y_AXIS); + return d->get_dim (); } void Graphical_element::unlink () { - for (int j=0; j < 2; j++) - if (axis_group_l_a_[j]) - axis_group_l_a_[j]->remove_element (this); + for (int a=X_AXIS; a < NO_AXES; a++) + if (Dimension_cache * d = dim_cache_[a].parent_l_) + { + if (Graphical_axis_group * eg + = dynamic_cast (d->elt_l_)) + eg->remove_element (this); + } } void Graphical_element::junk_links () { - axis_group_l_a_[X_AXIS] = axis_group_l_a_[Y_AXIS] =0; } void Graphical_element::do_print () const { #ifndef NPRINT - if (offset_.x() || offset_.y ()) - DOUT << "offset: " << offset_.str() ; DOUT << '\n'; #endif } +void +Graphical_element::invalidate_cache (Axis a) +{ + dim_cache_[a].invalidate (); +} + +Graphical_element* +Graphical_element::parent_l (Axis a) const +{ + Dimension_cache*d= dim_cache_[a].parent_l_; + return d ? d->elt_l_ : 0; +} + +Graphical_element::~Graphical_element () +{ +} + +Dimension_cache * +Graphical_element::common_group (Link_array gs, Axis a) const +{ + Dimension_cache * common = &dim_cache_[a]; + for (int i=0; i < gs.size (); i++) + { + common = common->common_group (&gs[i]->dim_cache_[a]); + } + + return common; +} + +char const * +Graphical_element::name () const +{ + return classname (this); +} diff --git a/lily/horizontal-group-item.cc b/lily/horizontal-group-item.cc index 46b06131e3..796ab7c945 100644 --- a/lily/horizontal-group-item.cc +++ b/lily/horizontal-group-item.cc @@ -19,5 +19,5 @@ Horizontal_group_item::do_print() const Horizontal_group_item::Horizontal_group_item () { - axis1_ = axis2_ = X_AXIS; + axes_[0] = axes_[1] = X_AXIS; } diff --git a/lily/horizontal-vertical-group-element.cc b/lily/horizontal-vertical-group-element.cc index 6a47d82966..b8b09b7bda 100644 --- a/lily/horizontal-vertical-group-element.cc +++ b/lily/horizontal-vertical-group-element.cc @@ -6,8 +6,8 @@ Horizontal_vertical_group_element::Horizontal_vertical_group_element() { - axis1_ = X_AXIS; - axis2_ = Y_AXIS; + axes_[0] = X_AXIS; + axes_[1] = Y_AXIS; } diff --git a/lily/horizontal-vertical-group-item.cc b/lily/horizontal-vertical-group-item.cc index c3f4c03d9e..0c267e5651 100644 --- a/lily/horizontal-vertical-group-item.cc +++ b/lily/horizontal-vertical-group-item.cc @@ -20,6 +20,6 @@ Horizontal_vertical_group_item::do_print() const Horizontal_vertical_group_item::Horizontal_vertical_group_item () { - axis1_ = X_AXIS; - axis2_ = Y_AXIS; + axes_[0] = X_AXIS; + axes_[1] = Y_AXIS; } diff --git a/lily/include/abbrev.hh b/lily/include/abbrev.hh index f0df714af2..edc2b3b68d 100644 --- a/lily/include/abbrev.hh +++ b/lily/include/abbrev.hh @@ -15,7 +15,7 @@ class Abbreviation : public Item { Stem * stem_l_; protected: virtual void do_print () const; - virtual Molecule *brew_molecule_p () const; + virtual Molecule *do_brew_molecule_p () const; virtual void do_substitute_dependent (Score_element*, Score_element*); public: int abbrev_flags_i_; diff --git a/lily/include/abbreviation-beam.hh b/lily/include/abbreviation-beam.hh index cdb7b1d96c..9f8b998a24 100644 --- a/lily/include/abbreviation-beam.hh +++ b/lily/include/abbreviation-beam.hh @@ -26,7 +26,7 @@ public: protected: virtual void do_print() const; virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const; - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; }; #endif // ABBREVIATION_BEAM_HH diff --git a/lily/include/afm.hh b/lily/include/afm.hh index 4f5d85c8d5..3be52df478 100644 --- a/lily/include/afm.hh +++ b/lily/include/afm.hh @@ -13,6 +13,7 @@ #include "string.hh" #include "box.hh" #include "array.hh" +#include "dictionary.hh" struct Adobe_font_char_metric { int C_; @@ -42,13 +43,17 @@ struct Adobe_font_metric { String Notice_; String EncodingScheme_; Array char_metrics_; - + Array ascii_to_metric_idx_; + Dictionary name_to_metric_dict_; + Adobe_font_char_metric find_char (String name, bool warn=true) const; + Adobe_font_char_metric find_ascii (int ascii) const; String str () const; Adobe_font_metric (); + void read_char_metrics (Data_file &input); }; -Adobe_font_metric read_afm (String fn); +Adobe_font_metric read_afm_file (String fn); diff --git a/lily/include/all-fonts.hh b/lily/include/all-fonts.hh new file mode 100644 index 0000000000..da9f91e48c --- /dev/null +++ b/lily/include/all-fonts.hh @@ -0,0 +1,34 @@ +/* + all-fonts.hh -- declare All_font_metrics + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef ALL_FONTS_HH +#define ALL_FONTS_HH + +#include "dictionary.hh" +#include "file-path.hh" +#include "lily-proto.hh" + +/** + Interface to all .afm files living in the filesystem. + */ +class All_font_metrics +{ + Dictionary afm_p_dict_; + File_path search_path_; +public: + + Adobe_font_metric *find_font (String name); + All_font_metrics (String search_path); +}; + + + + +#endif /* ALL_FONTS_HH */ + diff --git a/lily/include/bar.hh b/lily/include/bar.hh index a221be0fd5..1bd1d6d8e6 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -22,7 +22,7 @@ public: protected: virtual void do_pre_processing (); - Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; private: void do_print () const; diff --git a/lily/include/beam-engraver.hh b/lily/include/beam-engraver.hh index bab1e82f8a..834467858f 100644 --- a/lily/include/beam-engraver.hh +++ b/lily/include/beam-engraver.hh @@ -1,37 +1,39 @@ -/* - beam-engraver.hh -- declare Beam_engraver - +/* + cbeam-engraver.hh -- declare Beam_engraver + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ - (c) 1997--1998 Han-Wen Nienhuys -*/ - - -#ifndef BEAM_GRAV_HH -#define BEAM_GRAV_HH +#ifndef CBEAM_ENGRAVER_HH +#define CBEAM_ENGRAVER_HH #include "engraver.hh" #include "drul-array.hh" -/** - Generate a beam. Eats stems. - */ -class Beam_engraver : public Engraver -{ - Drul_array span_reqs_drul_; +class Beam_engraver : public Engraver { + Drul_array reqs_drul_; + + Beam *finished_beam_p_; Beam *beam_p_; - Rhythmic_grouping *current_grouping_p_; -public: - VIRTUAL_COPY_CONS(Translator); + Rhythmic_grouping*grouping_p_; + Rhythmic_grouping*finished_grouping_p_; - Beam_engraver(); + void typeset_beam (); protected: - virtual void do_removal_processing(); - virtual void do_process_requests(); - virtual bool do_try_music (Music*); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void do_removal_processing (); virtual void acknowledge_element (Score_element_info); - virtual void do_pre_move_processing(); + virtual bool do_try_music (Music*); + virtual void do_process_requests (); +public: + Beam_engraver (); + VIRTUAL_COPY_CONS (Translator); }; -#endif // BEAM_GRAV_HH +#endif /* CBEAM_ENGRAVER_HH */ + diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 1e69dd7398..29fa7049b4 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -61,7 +61,7 @@ protected: virtual Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const; virtual void solve_slope (); virtual void quantise_dy (); - virtual Molecule*brew_molecule_p () const; + virtual Molecule*do_brew_molecule_p () const; }; #endif // BEAM_HH diff --git a/lily/include/bow.hh b/lily/include/bow.hh index 6398942b98..e8e8d54dc9 100644 --- a/lily/include/bow.hh +++ b/lily/include/bow.hh @@ -28,7 +28,7 @@ public: int dash_i_; protected: - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; virtual Interval do_width () const; Array get_controls () const; virtual Array get_encompass_offset_arr () const; diff --git a/lily/include/break-caching.hh b/lily/include/break-caching.hh deleted file mode 100644 index 706c5c3dfc..0000000000 --- a/lily/include/break-caching.hh +++ /dev/null @@ -1,23 +0,0 @@ -/* - break-caching.hh -- declare Break_caching - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - - -#ifndef BREAK_CACHING_HH -#define BREAK_CACHING_HH - -/** - TODO : store breakpoints on the disk. - */ -struct Break_caching : Break_algorithm -{ - void do_set_pscore(); - Array do_solve() const; -}; - - -#endif // BREAK_CACHING_HH diff --git a/lily/include/cbeam-engraver.hh b/lily/include/cbeam-engraver.hh deleted file mode 100644 index d041f41ef0..0000000000 --- a/lily/include/cbeam-engraver.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - cbeam-engraver.hh -- declare Command_beam_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1998 Han-Wen Nienhuys - - */ - -#ifndef CBEAM_ENGRAVER_HH -#define CBEAM_ENGRAVER_HH - -#include "engraver.hh" -#include "drul-array.hh" - -class Command_beam_engraver : public Engraver { - Drul_array reqs_drul_; - - Beam *finished_beam_p_; - Beam *beam_p_; - - Rhythmic_grouping*grouping_p_; - Rhythmic_grouping*finished_grouping_p_; - - void typeset_beam (); -protected: - virtual void do_pre_move_processing (); - virtual void do_post_move_processing (); - virtual void do_removal_processing (); - virtual void acknowledge_element (Score_element_info); - virtual bool do_try_music (Music*); - virtual void do_process_requests (); -public: - Command_beam_engraver (); - VIRTUAL_COPY_CONS (Translator); -}; - -#endif /* CBEAM_ENGRAVER_HH */ - diff --git a/lily/include/chord-name-engraver.hh b/lily/include/chord-name-engraver.hh index f7b44b588f..fb45ae53d2 100644 --- a/lily/include/chord-name-engraver.hh +++ b/lily/include/chord-name-engraver.hh @@ -29,7 +29,7 @@ public: private: Array pitch_arr_; - Link_array text_p_arr_; + Link_array text_p_arr_; }; #endif // CHORD_NAME_ENGRAVER_HH diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index d9fa6fbdf8..c634382a80 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -17,7 +17,7 @@ class Clef_item : public Item { protected: virtual void do_pre_processing(); - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; public: String symbol_; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 81990b4f3f..7d539fb666 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -47,10 +47,6 @@ public: REQUESTMETHODS(Command_script_req); }; -class Command_tie_req : public Command_req { -public: - REQUESTMETHODS(Command_tie_req); -}; /** Baseclass for time_signature/partial req. It has to be handled by Staff_{walker,column} baseclass. */ diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 28f42dbb61..f39f1dbaf7 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -25,7 +25,7 @@ public: Crescendo(); protected: VIRTUAL_COPY_CONS(Score_element); - virtual Molecule*brew_molecule_p() const; + virtual Molecule*do_brew_molecule_p() const; virtual Interval symbol_height() const; diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh new file mode 100644 index 0000000000..9962cc2a7a --- /dev/null +++ b/lily/include/dimension-cache.hh @@ -0,0 +1,57 @@ +/* + dimension-cache.hh -- declare Dimension_cache + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef DIMENSION_CACHE_HH +#define DIMENSION_CACHE_HH +#include "interval.hh" +#include "real.hh" +#include "lily-proto.hh" +#include "parray.hh" + + + +class Dimension_cache +{ + bool valid_b_; + /** Is this element dimensionless?. + This is private to guarantee correctness of the cache + */ + bool empty_b_; + Interval dim_; + Real offset_; + Graphical_element *elt_l_; + friend class Graphical_element; + + void init (); +public: + Dimension_cache * parent_l_; + Link_array dependencies_l_arr_; + + Real absolute_coordinate () const; + void invalidate (); + void invalidate_dependencies (); + + Dimension_cache(Dimension_cache const&); + Dimension_cache (); + void set_group_l (Graphical_axis_group*); + Real relative_coordinate (Dimension_cache *d) const; + Dimension_cache*common_group (Dimension_cache const* s) const; + Dimension_cache*common_group (Link_array caches) const; + void set_empty (bool); + void translate (Real); + void set_offset (Real); + bool valid_b () const { return valid_b_; } + bool empty_b() const { return empty_b_; } + void set_dim (Interval); + Interval get_dim () const; +}; + + +#endif /* DIMENSION_CACHE_HH */ + diff --git a/lily/include/dots.hh b/lily/include/dots.hh index bb7ab8489f..6456dcfe0c 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -19,7 +19,7 @@ class Dots : public Item { protected: - virtual Molecule * brew_molecule_p () const; + virtual Molecule * do_brew_molecule_p () const; virtual void do_post_processing (); public: int no_dots_i_; diff --git a/lily/include/dynamic-engraver.hh b/lily/include/dynamic-engraver.hh index c23020436b..7bea37c49e 100644 --- a/lily/include/dynamic-engraver.hh +++ b/lily/include/dynamic-engraver.hh @@ -10,26 +10,4 @@ #ifndef DYNAMIC_GRAV_HH #define DYNAMIC_GRAV_HH -#include "engraver.hh" - -class Dynamic_engraver : public Engraver { - Direction dir_; - Text_item * dynamic_p_; - Crescendo * to_end_cresc_p_; - Crescendo * cresc_p_; - Span_dynamic_req * cresc_req_l_; - Array dynamic_req_l_arr_; -public: - VIRTUAL_COPY_CONS(Translator); - Dynamic_engraver(); - -protected: - virtual void do_removal_processing (); - virtual void acknowledge_element (Score_element_info); - virtual bool do_try_music (Music *req_l); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); -}; - #endif // DYNAMIC_GRAV_HH diff --git a/lily/include/extender-spanner.hh b/lily/include/extender-spanner.hh index 19947342be..8e0f657fb5 100644 --- a/lily/include/extender-spanner.hh +++ b/lily/include/extender-spanner.hh @@ -40,7 +40,7 @@ public: Drul_array textitem_l_drul_; protected: - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; void do_add_processing (); Interval do_height () const; void do_substitute_dependency (Score_element* o, Score_element* n); diff --git a/lily/include/g-staff-side.hh b/lily/include/g-staff-side.hh new file mode 100644 index 0000000000..c39dcd9f3f --- /dev/null +++ b/lily/include/g-staff-side.hh @@ -0,0 +1,40 @@ +/* + g-staff-side.hh -- declare G_staff_side_item + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef G_STAFF_SIDE_HH +#define G_STAFF_SIDE_HH + +#include "item.hh" + +/* + DO NOT USE AS BREAKABLE ITEM! + + (-> core dump!) + */ +class G_staff_side_item : public Item +{ +public: + Score_element * to_position_l_; + Direction dir_; + Link_array support_l_arr_; + + G_staff_side_item (); + void set_victim (Score_element*); + void add_support (Score_element*); + + virtual void set_default_direction (); + VIRTUAL_COPY_CONS(Score_element); +protected: + virtual void do_substitute_dependency (Score_element*,Score_element*); + virtual void do_pre_processing (); + virtual void do_post_processing (); +}; + +#endif /* G_STAFF_SIDE_HH */ + diff --git a/lily/include/g-text-item.hh b/lily/include/g-text-item.hh new file mode 100644 index 0000000000..5f6af591d6 --- /dev/null +++ b/lily/include/g-text-item.hh @@ -0,0 +1,28 @@ +/* + g-text-item.hh -- declare G_text_item + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef G_TEXT_ITEM_HH +#define G_TEXT_ITEM_HH + +#include "item.hh" + +class G_text_item : public Item +{ +public: + String text_str_; + String style_str_; + + G_text_item (); + VIRTUAL_COPY_CONS (Score_element); +protected: + virtual Molecule *do_brew_molecule_p () const; +}; + +#endif /* G_TEXT_ITEM_HH */ + diff --git a/lily/include/graphical-axis-group.hh b/lily/include/graphical-axis-group.hh index f9df7df3e8..90f0799b4b 100644 --- a/lily/include/graphical-axis-group.hh +++ b/lily/include/graphical-axis-group.hh @@ -23,7 +23,7 @@ class Graphical_axis_group : public virtual Graphical_element { public: Link_array elem_l_arr_; - Axis axis1_, axis2_; + Axis axes_[2]; Interval extent (Axis) const; virtual void do_print() const; diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh index b74fe14535..465fe35700 100644 --- a/lily/include/graphical-element.hh +++ b/lily/include/graphical-element.hh @@ -14,39 +14,29 @@ #include "lily-proto.hh" #include "interval.hh" #include "virtual-methods.hh" +#include "dimension-cache.hh" + + /** The 2d geometric aspects of a score-element. It was put in a separate class, because Score_element got quite big. - */ class Graphical_element { void init (); - /** Is this element dimensionless?. - This is private to guarantee correctness of the cache - */ - bool empty_b_; - - Offset offset_; - Interval cached_dimension_a_[NO_AXES]; - bool cached_valid_b_a_[NO_AXES]; public: + Dimension_cache dim_cache_[NO_AXES]; + char const * name () const; void set_empty (bool); - bool empty_b () const; - - - Graphical_axis_group * axis_group_l_a_[NO_AXES]; - Graphical_element (); Graphical_element (Graphical_element const&); + virtual ~Graphical_element (); void invalidate_cache (Axis); Interval extent (Axis) const; - Interval width() const; - Interval height() const; /** translate the symbol. The symbol does not have to be created yet. @@ -58,13 +48,17 @@ public: void translate_axis (Real, Axis); - Real relative_coordinate (Graphical_axis_group*group, Axis) const; + Real relative_coordinate (Dimension_cache*group, Axis) const; Offset absolute_offset() const; Real absolute_coordinate (Axis) const; /** Find the group-element which has both #this# and #s# */ - Graphical_axis_group*common_group (Graphical_element const* s, Axis a) const; + Dimension_cache*common_group (Graphical_element const* s, Axis a) const; + Dimension_cache*common_group (Link_array elems, Axis a) const; + + Graphical_element *parent_l (Axis a) const; + void unlink (); void junk_links (); virtual void do_print () const; diff --git a/lily/include/ineq-constrained-qp.hh b/lily/include/ineq-constrained-qp.hh index 5686d9e361..7097cf4c8f 100644 --- a/lily/include/ineq-constrained-qp.hh +++ b/lily/include/ineq-constrained-qp.hh @@ -14,7 +14,24 @@ #include "matrix.hh" -/// inequality constrained quadratic program +/** inequality constrained quadratic program + + It takes the form of + + optimise for x : x*quad_ *x + lin_* x + const_term_ + + subject to for all i: cons_[i] * x >= consrhs_[i] + + + @usage: + instantiate Ineq_constrained_qp. + + Modify quad_, lin_ and const_term_ directly. Use + add_inequality_cons () to add constraints. Call solve () with a + feasible solution + + + */ class Ineq_constrained_qp { friend class Active_constraints; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index b6d72f83b1..2984d56320 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -36,7 +36,7 @@ struct Key_item : Item { protected: virtual void do_pre_processing(); - Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; }; #endif // KEYITEM_HH diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 7ae5f935f7..b44dab4223 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -15,7 +15,12 @@ struct Abbreviation; struct Abbreviation_beam; struct Abbreviation_beam_req; struct Abbreviation_beam_engraver; +struct G_staff_side_item; +struct G_text_item; struct Abbreviation_req; +struct Adobe_font_metric; +struct Adobe_font_char_metric; +struct All_font_metrics; struct Atom; struct Audio_element; struct Audio_column; diff --git a/lily/include/linear-programming.hh b/lily/include/linear-programming.hh deleted file mode 100644 index 6ba38eaa55..0000000000 --- a/lily/include/linear-programming.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - linear-programming.hh -- declare Linear_programming - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys - - */ - -#ifndef LINEAR_PROGRAMMING_HH -#define LINEAR_PROGRAMMING_HH - -#include "linear-programming.hh" - -/** - - Solve the following problem: - - min c* x - - constraints_[i] * x = constraint_rhss_ [i] - - x[j] >= 0 -*/ - -class Linear_programming -{ - Array constraints_; - Array constraint_rhss_; - Vector cost_vec_; - int dim_; -public: - Vector constraint_solve (Vector initial_basic_solution) const; - - int dim () const; - Vector solve (Vector) const; - void add_constraint (Vector c, double r); - - - Linear_programming (int n); - void set_cost (Vector); - void print () const; - void OK () const; -} - -#endif /* LINEAR_PROGRAMMING_HH */ - diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 5d79466feb..3e8b531e0e 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -33,7 +33,7 @@ public: protected: virtual void do_pre_processing(); virtual void do_substitute_dependency (Score_element*,Score_element*); - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; }; #endif // LOCALKEYITEM_HH diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index e236e56f66..9526c07cc4 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -16,7 +16,6 @@ #include "scalar.hh" #include "direction.hh" #include "curve.hh" -#include "afm.hh" #include "symtable.hh" #include "box.hh" @@ -61,9 +60,9 @@ public: Paper_def * paper_l_; Symtables *symtables_p_; - String font_; - String font_path_; - Adobe_font_metric * afm_p_; + + String font_name_; + Adobe_font_metric * afm_l_; }; #endif // LOOKUP_HH diff --git a/lily/include/lyric-engraver.hh b/lily/include/lyric-engraver.hh index 0087e21e5e..99a1aa1462 100644 --- a/lily/include/lyric-engraver.hh +++ b/lily/include/lyric-engraver.hh @@ -14,20 +14,5 @@ #include "lily-proto.hh" -class Lyric_engraver : public Engraver -{ -protected: - virtual void do_pre_move_processing(); - virtual bool do_try_music (Music*); - virtual void do_process_requests(); - -public: - Lyric_engraver(); - VIRTUAL_COPY_CONS(Translator); - -private: - Link_array lyric_req_l_arr_; - Link_array text_p_arr_; -}; #endif // LYRIC_ENGRAVER_HH diff --git a/lily/include/main.hh b/lily/include/main.hh index 0b7340bb75..2b63cb1604 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -40,4 +40,7 @@ extern File_path global_path; extern String default_outname_base_global; extern String default_outname_suffix_global; extern int default_count_global; +extern All_font_metrics *all_fonts_global_p; + + #endif diff --git a/lily/include/multi-measure-rest.hh b/lily/include/multi-measure-rest.hh index 01b1c09e23..8be84d3002 100644 --- a/lily/include/multi-measure-rest.hh +++ b/lily/include/multi-measure-rest.hh @@ -22,7 +22,7 @@ public: protected: virtual void do_print () const; - virtual Molecule *brew_molecule_p () const; + virtual Molecule *do_brew_molecule_p () const; }; #endif /* MULTI_MEASURE_REST_HH */ diff --git a/lily/include/music-list-iterator.hh b/lily/include/music-list-iterator.hh index 6cc15b5763..c1e889b9de 100644 --- a/lily/include/music-list-iterator.hh +++ b/lily/include/music-list-iterator.hh @@ -25,8 +25,6 @@ public: virtual bool ok () const; protected: - Music_list* music_list_l () const; - virtual void do_print () const; virtual void do_process_and_next (Moment); }; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index c88ef382c4..b3b5b2959b 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -141,11 +141,6 @@ public: }; -/** Start / stop a beam at this note */ -class Beam_req : public Musical_span_req { -public: - REQUESTMETHODS(Beam_req); -}; /** Start / stop an abbreviation beam at this note. @@ -159,13 +154,7 @@ public: int type_i_; }; -/** - Start a tie at this note, end it at the next - */ -class Tie_req : public Musical_req { -public: - REQUESTMETHODS(Tie_req); -}; + /// a slur class Slur_req : public Musical_span_req { @@ -174,15 +163,6 @@ public: }; -/// a tuplet (bracket with) number -class Plet_req : public Musical_span_req { -public: - int plet_i_; - - REQUESTMETHODS(Plet_req); - Plet_req (); -}; - /// an extender line class Extender_req : public Musical_span_req { public: diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 23aff88156..b9fc8952bd 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -34,7 +34,7 @@ public: Link_array rest_l_arr_; Interval_t head_positions_interval() const; - Interval width () const; + // Interval width () const; void translate_rests(int dy); diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 173cf33ea6..1a34c99f23 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -37,7 +37,7 @@ public: protected: virtual Interval do_width () const; virtual void do_pre_processing(); - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; }; #endif // NOTEHEAD_HH diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 67436644c4..898c2b6082 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -36,7 +36,7 @@ */ class Paper_def : public Music_output_def { - Assoc *lookup_p_assoc_p_; + Hash_table *lookup_p_tab_p_; static int default_count_i_; protected: diff --git a/lily/include/plet-swallow-engraver.hh b/lily/include/plet-swallow-engraver.hh deleted file mode 100644 index 1458589090..0000000000 --- a/lily/include/plet-swallow-engraver.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - plet-swallow-engraver.hh -- declare Swallow_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - - -#ifndef PLET_SWALLOW_ENGRAVER_HH -#define PLET_SWALLOW_ENGRAVER_HH - -#include "swallow-engraver.hh" - -/** - This engraver swallows plets silently. - */ -class Plet_swallow_engraver : public Swallow_engraver -{ -public: - VIRTUAL_COPY_CONS(Translator); - - -protected: - virtual bool do_try_music (Music*); -}; - -#endif // PLET_SWALLOW_ENGRAVER_HH diff --git a/lily/include/qlpsolve.hh b/lily/include/qlpsolve.hh index bf04b55d84..1d61c5faf1 100644 --- a/lily/include/qlpsolve.hh +++ b/lily/include/qlpsolve.hh @@ -35,7 +35,9 @@ class Active_constraints { Ineq_constrained_qp const *opt; public: - + + /** This counts the number of errors the algorithms makes. The + optimum search should be abandoned if it becomes too high. */ int degenerate_count_i_; String status() const; diff --git a/lily/include/request.hh b/lily/include/request.hh index 4d0a5f2a0a..23c2ce4145 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -79,5 +79,18 @@ public: Span_req(); }; +/** + Start a tie at this note, end it at the next + */ +class Tie_req : public Request { +public: + REQUESTMETHODS(Tie_req); +}; + +/** Start / stop a beam at this note */ +class Beam_req : public Span_req { +public: + REQUESTMETHODS(Beam_req); +}; #endif diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 2e0b3938c1..aa33701c9a 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -22,6 +22,6 @@ public: void add_dots (Dots*); protected: virtual void do_add_processing (); - virtual Molecule * brew_molecule_p () const; + virtual Molecule * do_brew_molecule_p () const; }; #endif // REST_HH diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 2828e00fae..c36e446816 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -27,7 +27,7 @@ typedef void (Score_element::*Score_element_method_pointer) (void); class Score_element : private Directed_graph_node, public virtual Graphical_element { public: Paper_score *pscore_l_; - + Molecule * output_p_; Score_element (); Score_element (Score_element const&); virtual void print () const; @@ -80,7 +80,7 @@ protected: int dependent_size () const; int dependency_size () const; - virtual void do_brew_molecule (); + virtual void output_processing (); void junk_links (); virtual Interval do_height () const; virtual Interval do_width () const; @@ -88,7 +88,7 @@ protected: /// do printing of derived info. virtual void do_print () const {} /// generate the molecule - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; ///executed directly after the item is added to the Paper_score virtual void do_add_processing (); /// do calculations before determining horizontal spacing diff --git a/lily/include/score-priority-engraver.hh b/lily/include/score-priority-engraver.hh index d9d87a127e..4b857c7662 100644 --- a/lily/include/score-priority-engraver.hh +++ b/lily/include/score-priority-engraver.hh @@ -11,14 +11,13 @@ #define SCOREF_ALIGN_GRAV_HH #include "engraver.hh" -#include "assoc.hh" /** Group a number of items across staffs */ class Score_priority_engraver : public Engraver { - Assoc align_p_assoc_; + Hash_table align_p_tab_; public: VIRTUAL_COPY_CONS(Translator); Score_priority_engraver (); diff --git a/lily/include/script.hh b/lily/include/script.hh index 51b74a29f5..f13a6a1840 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -17,7 +17,7 @@ class Script : public Item, public Staff_side { Stem *stem_l_; protected: - Molecule *brew_molecule_p() const; + Molecule *do_brew_molecule_p() const; virtual void do_substitute_dependency (Score_element*,Score_element*); virtual void do_print() const; virtual Interval symbol_height() const; diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh index 8cf39854c8..a7e9c9323e 100644 --- a/lily/include/sequential-music-iterator.hh +++ b/lily/include/sequential-music-iterator.hh @@ -26,8 +26,6 @@ public: virtual bool ok () const; protected: - Sequential_music* sequential_music_l () const; - virtual void do_print() const; virtual void do_process_and_next (Moment); diff --git a/lily/include/simultaneous-music-iterator.hh b/lily/include/simultaneous-music-iterator.hh index e2c1eb4ee6..c2213b5195 100644 --- a/lily/include/simultaneous-music-iterator.hh +++ b/lily/include/simultaneous-music-iterator.hh @@ -23,8 +23,6 @@ public: virtual bool ok () const; protected: - Simultaneous_music* simultaneous_music_l () const; - virtual void do_print () const; virtual void do_process_and_next (Moment); diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 3a4f017320..22a710d7f5 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -30,7 +30,7 @@ protected: virtual void do_post_processing(); virtual void do_substitute_dependency (Score_element*,Score_element*); - virtual Molecule * brew_molecule_p() const; + virtual Molecule * do_brew_molecule_p() const; virtual Atom get_bar_sym (Real dy) const; }; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index a43eff9855..09e37a8962 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -57,7 +57,7 @@ protected: virtual void do_unlink (); virtual void do_junk_links (); - virtual void do_brew_molecule (); + virtual void output_processing (); virtual void do_space_processing (); virtual void do_break_processing (); virtual Interval do_width () const; diff --git a/lily/include/staff-sym.hh b/lily/include/staff-sym.hh index a98d1b1d44..b4e9191065 100644 --- a/lily/include/staff-sym.hh +++ b/lily/include/staff-sym.hh @@ -29,7 +29,7 @@ public: protected: VIRTUAL_COPY_CONS(Score_element); virtual Interval do_height () const; - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; virtual void do_print() const; }; #endif // STAFFSYM_HH diff --git a/lily/include/stem-engraver.hh b/lily/include/stem-engraver.hh index f039fce319..1213936ab2 100644 --- a/lily/include/stem-engraver.hh +++ b/lily/include/stem-engraver.hh @@ -17,7 +17,6 @@ */ class Stem_engraver : public Engraver { - Direction dir_; int default_abbrev_i_; Stem *stem_p_; Abbreviation *abbrev_p_; diff --git a/lily/include/stem.hh b/lily/include/stem.hh index f33038822b..267be4f67a 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -114,6 +114,6 @@ protected: virtual void do_substitute_dependency (Score_element*,Score_element*); virtual void do_pre_processing(); virtual Interval do_width() const; - Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; }; #endif diff --git a/lily/include/symtable.hh b/lily/include/symtable.hh index 2c19d3e9b0..b0f8a77bf6 100644 --- a/lily/include/symtable.hh +++ b/lily/include/symtable.hh @@ -15,10 +15,10 @@ #include "atom.hh" struct Symtable : public Dictionary { - String id_str; + String id_str; - Atom lookup (String) const; - void print() const; + Atom lookup (String) const; + void print() const; }; @@ -32,8 +32,7 @@ struct Symtables : private Dictionary void add (String, Symtable*); void print() const; - String font_; - String font_path_; + String font_name_; }; diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index ca8600fac4..536fbd86ef 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -17,28 +17,18 @@ class Text_item : public Item ,public Staff_side { public: - /// do I have width? bool fat_b_; - - - Text_item (General_script_def* ,Direction dir=CENTER); - virtual ~Text_item (); - -//protected: - // ugh: so, are we a text-def, or can this vary? + Text_item (General_script_def* ,Direction dir=CENTER); General_script_def* tdef_p_; -protected: +protected: + virtual ~Text_item (); virtual Interval symbol_height () const; - - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; virtual void do_pre_processing (); virtual Real get_position_f () const; - -private: -// void init (Text_def* tdef_l); }; diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh index 42dc01483f..ce68ae17a2 100644 --- a/lily/include/text-spanner.hh +++ b/lily/include/text-spanner.hh @@ -31,7 +31,7 @@ protected: virtual void do_pre_processing(); virtual void do_post_processing(); virtual Interval height() const ; - virtual Molecule* brew_molecule_p() const; + virtual Molecule* do_brew_molecule_p() const; virtual void do_print() const; }; #endif // TEXTSPANNER_HH diff --git a/lily/include/ctie-engraver.hh b/lily/include/tie-engraver.hh similarity index 89% rename from lily/include/ctie-engraver.hh rename to lily/include/tie-engraver.hh index 0242fd09fa..b58101532c 100644 --- a/lily/include/ctie-engraver.hh +++ b/lily/include/tie-engraver.hh @@ -1,5 +1,5 @@ /* - ctie-engraver.hh -- declare Command_tie_engraver + ctie-engraver.hh -- declare Tie_engraver source file of the GNU LilyPond music typesetter @@ -29,10 +29,10 @@ inline int compare (CHead_melodic_tuple const &a, CHead_melodic_tuple const &b) } -class Command_tie_engraver : public Engraver +class Tie_engraver : public Engraver { PQueue past_notes_pq_; - Command_tie_req *req_l_; + Tie_req *req_l_; Array now_heads_; Array stopped_heads_; Link_array tie_p_arr_; @@ -46,7 +46,7 @@ protected: virtual void process_acknowledged (); public: VIRTUAL_COPY_CONS(Translator); - Command_tie_engraver(); + Tie_engraver(); }; diff --git a/lily/include/ties-engraver.hh b/lily/include/ties-engraver.hh deleted file mode 100644 index 900c7db5e0..0000000000 --- a/lily/include/ties-engraver.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - tie-engraver.hh -- declare Ties_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - - -#ifndef Ties_GRAV_HH -#define Ties_GRAV_HH - -#include "engraver.hh" - -struct Head_melodic_tuple { - Melodic_req *mel_l_ ; - Note_head *head_l_; - - Head_melodic_tuple (); - Head_melodic_tuple (Note_head*, Melodic_req*); - static int compare (Head_melodic_tuple const &, Head_melodic_tuple const &); -}; - -class Ties_engraver : public Engraver { - Link_array end_tie_p_arr_; - Link_array tie_p_arr_; - - Tie_req *req_l_; - Tie_req *end_req_l_; - Array head_mel_tuple_arr_; - Array left_head_mel_tuple_arr_; - int processed_ack_pass_i_; - - Link_array end_melodic_req_l_arr_; - Link_array melodic_req_l_arr_; - -protected: - virtual void do_removal_processing (); - virtual void acknowledge_element (Score_element_info); - virtual bool do_try_music (Music*); - virtual void do_process_requests(); - virtual void process_acknowledged (); - virtual void do_post_move_processing(); - virtual void do_pre_move_processing(); -public: - VIRTUAL_COPY_CONS(Translator); - Ties_engraver(); - -}; - -#endif // Ties_GRAV_HH diff --git a/lily/include/time-signature.hh b/lily/include/time-signature.hh index 1fd90719c5..093ba3c700 100644 --- a/lily/include/time-signature.hh +++ b/lily/include/time-signature.hh @@ -23,7 +23,7 @@ class Time_signature: public Item { protected: - virtual Molecule*brew_molecule_p() const; + virtual Molecule*do_brew_molecule_p() const; public: Time_signature () ; Array args_; diff --git a/lily/include/translator.hh b/lily/include/translator.hh index f3a96da1ab..7671f96aa5 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -60,7 +60,7 @@ public: /** ask daddy for a feature */ - Scalar get_property (String type_str); + Scalar get_property (String type_str, Translator const **where_found_l) const; void set_property (String var_name, Scalar value); Music_output_def *output_def_l () const; diff --git a/lily/include/tuplet-spanner.hh b/lily/include/tuplet-spanner.hh index 2d97897d5c..356e4a51e0 100644 --- a/lily/include/tuplet-spanner.hh +++ b/lily/include/tuplet-spanner.hh @@ -27,7 +27,7 @@ protected: Beam *beam_l_; Link_array column_arr_; - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; VIRTUAL_COPY_CONS(Score_element); virtual void do_add_processing (); diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index 1a9a2803c4..92dc770812 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -28,7 +28,7 @@ public: bool last_b_; protected: - virtual Molecule* brew_molecule_p () const; + virtual Molecule* do_brew_molecule_p () const; VIRTUAL_COPY_CONS(Score_element); virtual void do_add_processing (); diff --git a/lily/ineq-constrained-qp.cc b/lily/ineq-constrained-qp.cc index f0e66c0793..450edad0e8 100644 --- a/lily/ineq-constrained-qp.cc +++ b/lily/ineq-constrained-qp.cc @@ -128,10 +128,8 @@ Ineq_constrained_qp::constraint_solve (Vector start) const while (iterations++ < MAXITER && act.degenerate_count_i_ < MAXDEGEN) { - //#ifdef PARANOID if (experimental_features_global_b) assert_solution (x); - //#endif Vector direction= - act.find_active_optimum (gradient); @@ -155,9 +153,13 @@ Ineq_constrained_qp::constraint_solve (Vector start) const for (Inactive_iter ia (act); ia.ok(); ia++) { Real dot = ia.vec() * direction; - if (dot >= 0) + Real mindot = (experimental_features_global_b) + ? -EPS + : 0; + + if (dot >= mindot) continue; - + Real numerator = ia.rhs () - ia.vec()*x; if (numerator >= 0) diff --git a/lily/item.cc b/lily/item.cc index 2428f6655a..7ae4f06b53 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -10,7 +10,6 @@ #include "debug.hh" #include "item.hh" #include "p-col.hh" -// #include "elem-group.hh" #include "spanner.hh" Item::Item () @@ -43,13 +42,10 @@ Item::hpos_f() const Line_of_score * Item::line_l() const { - Graphical_axis_group *ga = axis_group_l_a_[X_AXIS]; - - if (!ga) + Graphical_element *g =parent_l (X_AXIS); + if (!g) return 0; - - assert (dynamic_cast (ga)); - return dynamic_cast (ga)-> line_l (); + return dynamic_cast (g)-> line_l (); } Direction @@ -129,13 +125,8 @@ Item::handle_prebroken_dependencies() int Item::left_right_compare(Item const *l, Item const *r) { - while (!(dynamic_cast (l))) - l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); - while (!(dynamic_cast (r))) - r = dynamic_cast (r->axis_group_l_a_[X_AXIS]); - - Paper_column *p1 = (Paper_column*)l; - Paper_column* p2 = (Paper_column*)r; + Paper_column *p1 = l->column_l (); + Paper_column* p2 = r->column_l (); return p1->rank_i () - p2->rank_i (); } @@ -176,7 +167,7 @@ Item::do_unlink() Paper_column * Item::column_l () const { - return dynamic_cast (axis_group_l_a_[X_AXIS]) ->column_l (); + return dynamic_cast (parent_l (X_AXIS))->column_l (); } Item::Item (Item const &s) diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 4ac49a3032..cbe73efe95 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -74,7 +74,7 @@ Key_engraver::acknowledge_element (Score_element_info info) { if (dynamic_cast (info.req_l_)) { - int i= get_property ("createKeyOnClefChange").length_i (); + int i= get_property ("createKeyOnClefChange", 0).length_i (); if (i) create_key (); } @@ -117,7 +117,7 @@ Key_engraver::read_req (Key_change_req const * r) { old_accidental_idx_arr_ = accidental_idx_arr_; key_.clear (); - Scalar prop = get_property ("keyoctaviation"); + Scalar prop = get_property ("keyoctaviation", 0); if (prop.length_i () > 0) { key_.multi_octave_b_ = ! prop.to_bool (); diff --git a/lily/key-item.cc b/lily/key-item.cc index d6e9aecb86..268d847686 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -76,7 +76,7 @@ Key_item::calculate_position(int p, int a) const TODO space the `natural' signs wider */ Molecule* -Key_item::brew_molecule_p() const +Key_item::do_brew_molecule_p() const { Molecule*output = new Molecule; Real inter = paper()->internote_f (); diff --git a/lily/line-group-group-engraver.cc b/lily/line-group-group-engraver.cc index 0fd424aa92..ca487f8380 100644 --- a/lily/line-group-group-engraver.cc +++ b/lily/line-group-group-engraver.cc @@ -23,7 +23,7 @@ Line_group_engraver_group::Line_group_engraver_group() void Line_group_engraver_group::typeset_element (Score_element *elem) { - if (!elem->axis_group_l_a_[Y_AXIS]) + if (!elem->parent_l (Y_AXIS)) staffline_p_->add_element (elem); Engraver_group_engraver::typeset_element (elem); } diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index c91627ffb0..ba549cb99d 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -26,7 +26,7 @@ void Line_of_score::add_element (Score_element*e) { // avoid excess dependencies. - if (!(e->axis_group_l_a_[0] || e->axis_group_l_a_[1])) + if (! (e->parent_l (X_AXIS) || e->parent_l (Y_AXIS)) ) add_dependency (e); } diff --git a/lily/linear-programming.cc b/lily/linear-programming.cc deleted file mode 100644 index 727d3fc46d..0000000000 --- a/lily/linear-programming.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - linear-programming.cc -- implement - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys - - */ - -#if 0 -#include "linear-programming.hh" - -Linear_programming::Linear_programming (int n) - : cost_vec_ (n) -{ - dim_ = n; -} -int -Linear_programming::dim () const -{ - return dim_; -} - - -void -Linear_programming::add_constraint (Vector c, double r) -{ - assert (c.dim () == cost_vec_); - constraints_.push (c); - constraint_rhss_.push (r); -} - -void -Linear_programming::set_cost (Vector c) -{ - assert (dim_ == c.dim ()); - cost_vec_ = c; -} - -void -Linear_programming::print () const -{ - DOUT << "cost: " << cost_vec_; - for (int i=0; constraints_.size (); i++) - { - DOUT << constraints_[i] << ". x = " << constraint_rhss_[i]; - } -} - -void -Linear_programming::OK () const -{ - assert (constraint_rhss_.size () == constraints_.size ()); - for (int i=0; constraints_.size (); i++) - constraints_[i].dim () == cost_vec_.dim (); -} - - -bool -Linear_programming::check_constraints (Vector v) const -{ - bool is_cool = true; - assert (v.dim () == dim_); - - for (int i=0; is_cool && i < v.dim (); i++) - is_cool = is_cool && v[i] >= 0; - for (int i=0; is_cool && i < constraints_.size (); i++) - is_cool = is_cool && (constraints_[i] * v <= constraint_rhss_[i]); - - - - return is_cool; -} - -Vector -Linear_programming::solve (Vector initial_basic_solution) const -{ - assert (check_constraints (initial_basic_solution)); - - Array basis; - for (int i=0; i < dim_; i++) - basis.push (bool(initial_basic_solution[i])); - - Vector x = initial_basic_solution; - Real current_cost = x * cost_vec_; - while (iter < MAXITER) - { - // select pivot - - - iter ++; - } - - - - - - Array binding, nonbinding; - - assert (check_constraints (initial)); - OK (); - - Vector x (initial); - Real value (x * cost_vec_): - - for (int i=0; i < constraints_.size ()) - nonbinding.push (i); - - while () - { - get_negative_index ( - } - -} -#endif diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 3e0a90e890..43177a7322 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -45,7 +45,7 @@ Local_key_item::do_pre_processing() } Molecule* -Local_key_item::brew_molecule_p() const +Local_key_item::do_brew_molecule_p() const { Molecule*output = new Molecule; @@ -95,13 +95,13 @@ Local_key_item::brew_molecule_p() const Interval x_int; for (int i=0; i < support_items_.size(); i++) { - Graphical_axis_group *common = + Dimension_cache *common = common_group (support_items_[i], X_AXIS); - Real x = support_items_[i]->relative_coordinate (common, X_AXIS) - -relative_coordinate (common, X_AXIS); + Real x = support_items_[i]->relative_coordinate (common, X_AXIS) + - relative_coordinate (common, X_AXIS); - x_int.unite (x + support_items_[i]->width()); + x_int.unite (x + support_items_[i]->extent (X_AXIS)); } if (x_int.empty_b ()) x_int = Interval(0,0); diff --git a/lily/lookup.cc b/lily/lookup.cc index c512fcfb7b..35367f5e0e 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -8,7 +8,6 @@ Jan Nieuwenhuizen TODO - Read spacing info from AFMs Glissando */ @@ -23,6 +22,8 @@ #include "file-path.hh" #include "main.hh" #include "lily-guile.hh" +#include "all-fonts.hh" +#include "afm.hh" SCM array_to_list (SCM *a , int l) @@ -40,30 +41,27 @@ Lookup::Lookup () { paper_l_ = 0; symtables_p_ = new Symtables; - afm_p_ =0; + afm_l_ = 0; } Lookup::Lookup (Lookup const& s) { - font_ = s.font_; - font_path_ = s.font_path_; + font_name_ = s.font_name_; paper_l_ = s.paper_l_; symtables_p_ = new Symtables (*s.symtables_p_); - afm_p_ = 0; + afm_l_ = 0; } Lookup::Lookup (Symtables const& s) { - font_ = s.font_; - font_path_ = s.font_path_; + font_name_ = s.font_name_; paper_l_ = 0; symtables_p_ = new Symtables (s); - afm_p_ = 0; + afm_l_ = 0; } Lookup::~Lookup () { - delete afm_p_; delete symtables_p_; } @@ -89,17 +87,14 @@ Lookup::add (String s, Symtable*p) symtables_p_->add (s, p); } + Atom Lookup::afm_find (String s, bool warn) const { - if (!afm_p_) - { - *mlog << "[" << font_path_; - ( (Lookup*)this)->afm_p_ = new Adobe_font_metric (read_afm (font_path_)); - *mlog << "]" << flush ; - DOUT << this->afm_p_->str (); - } - Adobe_font_char_metric m = afm_p_->find_char (s, warn); + if (!afm_l_) + ((Lookup*)this)->afm_l_ = all_fonts_global_p->find_font (font_name_); + + Adobe_font_char_metric m = afm_l_->find_char (s, warn); Atom a; if (m.code () < 0) @@ -114,7 +109,7 @@ Lookup::afm_find (String s, bool warn) const gh_int2scm (m.code ()), SCM_UNDEFINED); a.str_ = "afm_find: " + s; - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -140,7 +135,7 @@ Lookup::bar (String str, Real h) const a.dim_.y () = Interval (-h/2, h/2); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -186,7 +181,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const Real dy = d[Y_AXIS]; Atom a; - a.font_ = font_; + a.font_ = font_name_; a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); @@ -227,7 +222,7 @@ Lookup::extender (Real width) const gh_double2scm (width), SCM_UNDEFINED); a.str_ = "extender"; - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -326,7 +321,7 @@ Lookup::stem (Real y1, Real y2) const gh_double2scm(-y1), SCM_UNDEFINED); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -339,8 +334,16 @@ Lookup::streepje (int type) const return afm_find ("balls" + String ("-") +to_str (type) + "l"); } -Dictionary cmr_dict; -Dictionary afm_p_dict; +static Dict_initialiser cmr_init[] = { + {"bold", "cmbx"}, + {"dynamic", "feta-din"}, + {"finger", "feta-nummer"}, + {"italic", "cmti"}, + {"roman", "cmr"}, + {0,0} +}; + +static Dictionary cmr_dict (cmr_init); Atom Lookup::text (String style, String text) const @@ -354,38 +357,14 @@ Lookup::text (String style, String text) const Real font_w = a.dim_.x ().length (); Real font_h = a.dim_.y ().length (); - if (!cmr_dict.elem_b ("roman")) - { - //brrrr - cmr_dict.elem ("bold") = "cmbx"; - cmr_dict.elem ("dynamic") = "feta-din"; - cmr_dict.elem ("finger") = "feta-nummer"; - cmr_dict.elem ("italic") = "cmti"; - cmr_dict.elem ("roman") = "cmr"; - } - - if (!afm_p_dict.elem_b (style)) + if (cmr_dict.elem_b (style)) { - Adobe_font_metric* afm_p = 0; - String cmr_str = cmr_dict.elem (style) + to_str ((int) font_h) + ".afm"; - String font_path = global_path.find (cmr_str); - if (!font_path.length_i ()) - { - warning (_f("can't open file: `%s'", cmr_str.ch_C ())); - warning (_f("guessing dimensions for font style: `%s'", style.ch_C ())); - } - else - { - *mlog << "[" << font_path; - afm_p = new Adobe_font_metric (read_afm (font_path)); - DOUT << afm_p->str (); - *mlog << "]" << flush ; - } - afm_p_dict.elem (style) = afm_p; + style = String (cmr_dict [style]) + to_str ((int)font_h); // ugh } Real w = 0; - Adobe_font_metric* afm_p = afm_p_dict.elem (style); + Adobe_font_metric* afm_l = all_fonts_global_p->find_font (style); DOUT << "\nChars: "; + for (int i = 0; i < text.length_i (); i++) { if (text[i]=='\\') @@ -394,19 +373,18 @@ Lookup::text (String style, String text) const else { int c = text[i]; - if (afm_p && ((c >= 0) && (c < afm_p->char_metrics_.size ()))) + int code = afm_l->ascii_to_metric_idx_[c]; + if (code >=0) { - Adobe_font_char_metric m = afm_p->char_metrics_[c]; + Adobe_font_char_metric m = afm_l->char_metrics_[code]; w += m.B_.x ().length (); DOUT << to_str (m.B_.x ().length ()) << " "; } - else - w += font_w; } } DOUT << "\n" << to_str (w) << "\n"; a.dim_.x () = Interval (0, w); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -431,7 +409,7 @@ Lookup::vbrace (Real &y) const SCM_UNDEFINED ); a.dim_[Y_AXIS] = Interval (-y/2,y/2); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -449,7 +427,7 @@ Lookup::hairpin (Real width, bool decresc, bool continued) const SCM_UNDEFINED); a.dim_.x () = Interval (0, width); a.dim_.y () = Interval (-2*height, 2*height); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -486,7 +464,7 @@ Lookup::slur (Array controls) const a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); - a.font_ = font_; + a.font_ = font_name_; return a; } @@ -494,14 +472,6 @@ Atom Lookup::vbracket (Real &y) const { Atom a; - Real min_y = paper_l_->staffheight_f (); - if (y < min_y) - { - warning (_ ("bracket") - + " " + _ ("too small") + " (" + print_dimen (y) + ")"); - // y = min_y; - } - a.lambda_ = gh_list (ly_symbol ("bracket"), gh_double2scm (y), SCM_UNDEFINED); @@ -521,7 +491,7 @@ Lookup::volta (Real w, bool last_b) const SCM_UNDEFINED); a.str_ = "volta"; Real interline_f = paper_l_->interline_f (); -// a.dim_[Y_AXIS] = Interval (0, 2 * interline_f); + a.dim_[Y_AXIS] = Interval (-interline_f, interline_f); a.dim_[X_AXIS] = Interval (0, w); return a; diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 9fb403f2da..c5447ad97e 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -7,7 +7,6 @@ Jan Nieuwenhuizen */ -#include "lyric-engraver.hh" #include "musical-request.hh" #include "text-item.hh" #include "paper-def.hh" @@ -15,9 +14,33 @@ #include "paper-def.hh" #include "main.hh" #include "dimensions.hh" +#include "g-text-item.hh" + + +#include "engraver.hh" +#include "array.hh" +#include "lily-proto.hh" + +class Lyric_engraver : public Engraver +{ +protected: + virtual void do_pre_move_processing(); + virtual bool do_try_music (Music*); + virtual void do_process_requests(); + +public: + Lyric_engraver(); + VIRTUAL_COPY_CONS(Translator); + +private: + Link_array lyric_req_l_arr_; + Link_array text_p_arr_; +}; + ADD_THIS_TRANSLATOR(Lyric_engraver); + Lyric_engraver::Lyric_engraver() { } @@ -39,27 +62,16 @@ Lyric_engraver::do_process_requests() if (text_p_arr_.size ()) return; - Scalar style = get_property ("textstyle"); - Scalar alignment = get_property ("textalignment"); for (int i=0; i < lyric_req_l_arr_.size (); i++) { Lyric_req* request_l = lyric_req_l_arr_[i]; - Text_def* text_p = new Text_def; - text_p->text_str_ = request_l->text_str_; - text_p->align_dir_ = LEFT; + G_text_item* item_p = new G_text_item; + item_p->text_str_ = request_l->text_str_; + + Scalar style = get_property ("textstyle", 0); if (style.length_i ()) - text_p->style_str_ = style; - if (alignment.isnum_b()) - text_p->align_dir_= (Direction)(int)alignment; + item_p->style_str_ = style; - Text_item* item_p = new Text_item (text_p); - item_p->dir_ = DOWN; - item_p->fat_b_ = true; - // urg - // item_p->translate (Offset (0, (i - 1) * item_p->height ().length_i ())); -// if (i && ((Text_def*)text_p_arr_[i - 1]->tdef_p_)->text_str_.length_i ()) - // urg, when/how can one get the heigt of this thing? - item_p->translate (Offset (0, - i * 12 PT)); text_p_arr_.push (item_p); announce_element (Score_element_info (item_p, request_l)); } diff --git a/lily/main.cc b/lily/main.cc index 38dc2cb173..b5ca928061 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -12,6 +12,7 @@ #include #include "lily-guile.hh" +#include "all-fonts.hh" #include "proto.hh" #include "dimensions.hh" #include "plist.hh" @@ -38,6 +39,7 @@ bool no_timestamps_global_b = false; bool find_old_relative_b = false; char const* output_global_ch = "tex"; +All_font_metrics *all_fonts_global_p; String default_outname_base_global = "lelie"; String outname_str_global; @@ -246,7 +248,8 @@ void main_prog (int argc, char **argv) { default_outname_base_global = "lelie"; - + all_fonts_global_p = new All_font_metrics (global_path.str ()); + int p=0; const char *arg ; while ((arg= oparser_global_p->get_next_arg ())) @@ -361,7 +364,12 @@ main (int argc, char **argv) } } +#ifdef WINNT + gh_enter (argc, argv, main_prog); +#else gh_enter (argc, argv, (void(*)())main_prog); +#endif + return 0; // unreachable } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index b3f9bf9f0c..d3c736e96b 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -41,7 +41,7 @@ Mark_engraver::do_process_requests () return; script_p_ = new Script; - // script_p_->breakable_b_ = true; + script_p_->breakable_b_ = true; Text_def *td_p = new Text_def; @@ -51,16 +51,16 @@ Mark_engraver::do_process_requests () td_p->style_str_ = td_p->text_str_.index_any_i ("0123456789") >= 0 ? "mark" : "Large"; - script_p_->dir_ = UP; + script_p_->dir_ = LEFT; script_p_->specs_p_ = td_p->clone (); - // script_p_->postbreak_only_b_ = false; + script_p_->postbreak_only_b_ = true; - Scalar padding = get_property ("markScriptPadding"); + Scalar padding = get_property ("markScriptPadding", 0); if (padding.length_i() && padding.isnum_b ()) { script_p_->padding_f_ = Real(padding); } - Scalar break_priority = get_property ("markBreakPriority"); + Scalar break_priority = get_property ("markBreakPriority", 0); if (break_priority.length_i() && break_priority.isnum_b ()) { script_p_->break_priority_i_ = int(break_priority); diff --git a/lily/midi-def.cc b/lily/midi-def.cc index 88ccea73a7..e121621593 100644 --- a/lily/midi-def.cc +++ b/lily/midi-def.cc @@ -11,7 +11,6 @@ #include "midi-def.hh" #include "translator.hh" #include "performance.hh" -#include "assoc-iter.hh" #include "score-performer.hh" #include "debug.hh" @@ -67,10 +66,8 @@ Midi_def::print() const #endif } - - - int Midi_def::default_count_i_=0; + int Midi_def::get_next_default_count () const { diff --git a/lily/misc.cc b/lily/misc.cc index 381635b46d..5ba96e3272 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -41,7 +41,7 @@ itemlist_width (const Array &its) for (int j =0; j < its.size(); j++) { - iv.unite (its[j]->width()); + iv.unite (its[j]->extent (X_AXIS)); } return iv; diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index b6c8b5d5b3..a6144ffc0d 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -30,7 +30,7 @@ Multi_measure_rest::do_print () const } Molecule* -Multi_measure_rest::brew_molecule_p () const +Multi_measure_rest::do_brew_molecule_p () const { /* [TODO] 3 @@ -48,7 +48,6 @@ Multi_measure_rest::brew_molecule_p () const Text_def text; text.text_str_ = to_str (measures_i_); text.style_str_ = "number"; - text.align_dir_ = CENTER; Atom s = text.get_atom (paper (), UP); s.translate_axis (3.0 * interline_f, Y_AXIS); mol_p->add_atom (s); diff --git a/lily/music-list-iterator.cc b/lily/music-list-iterator.cc index d243aed3f1..6ebb409db8 100644 --- a/lily/music-list-iterator.cc +++ b/lily/music-list-iterator.cc @@ -32,12 +32,6 @@ Music_list_iterator::do_process_and_next (Moment) { } -Music_list* -Music_list_iterator::music_list_l () const -{ - return (Music_list *) music_l_; -} - Moment Music_list_iterator::next_moment () const { diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 34d4fdaf73..1e531211eb 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -234,15 +234,7 @@ Slur_req::do_print () const -Plet_req::Plet_req () -{ - plet_i_ = 0; -} -void -Plet_req::do_print () const -{ -} Extender_req::Extender_req () { diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 6446083926..059ab68ddd 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -11,10 +11,8 @@ #include "notename-table.hh" #include "interval.hh" #include "identifier.hh" -#include "assoc-iter.hh" #include "parser.hh" #include "keyword.hh" -#include "assoc.hh" #include "my-lily-lexer.hh" #include "debug.hh" #include "source-file.hh" diff --git a/lily/note-column.cc b/lily/note-column.cc index 3894bd6e2b..826b18a113 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -38,37 +38,38 @@ Interval_t Note_column::head_positions_interval() const { ((Note_column*)this)->sort(); - Interval_t iv; + Interval_t iv; - iv.set_empty (); + iv.set_empty (); - if (head_l_arr_.size ()) - iv = Interval_t(head_l_arr_[0]->position_i_, - head_l_arr_.top()->position_i_); + if (head_l_arr_.size ()) + iv = Interval_t(head_l_arr_[0]->position_i_, + head_l_arr_.top()->position_i_); return iv; } +/* Interval -Note_column::width () const +Note_column::do_width () const { if (head_l_arr_.size ()) - return head_l_arr_[0]->width (); + return head_l_arr_[0]->extent (X_AXIS); else return Interval (0,0); } - +*/ void Note_column::do_pre_processing() { - if (!dir_) { if (stem_l_) dir_ = stem_l_->dir_; else if (head_l_arr_.size ()) { - dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP; + assert (false); // looks obsolete? + dir_ = sign (head_positions_interval().center ()); } } Script_column::do_pre_processing(); @@ -83,7 +84,7 @@ Note_column::set_stem (Stem * stem_l) stem_l_ = stem_l; /* don't add stem to support; mostly invisible for rest-columns (and possibly taken . .) - */ + */ Score_element::add_dependency (stem_l); for (int i=0; i < script_l_arr_.size(); i++) script_l_arr_[i]->set_stem (stem_l); diff --git a/lily/note-head.cc b/lily/note-head.cc index b8c5668bd0..cbd0c69839 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -53,7 +53,7 @@ Note_head::do_width () const } Molecule* -Note_head::brew_molecule_p() const +Note_head::do_brew_molecule_p() const { Molecule*out = 0; Paper_def *p = paper(); diff --git a/lily/note-performer.cc b/lily/note-performer.cc index bda50b6188..f537469850 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -35,7 +35,7 @@ Note_performer::do_process_requests () { int transposing_i = 0; //urg - Scalar prop = get_property ("transposing"); + Scalar prop = get_property ("transposing", 0); if (!prop.empty_b () && prop.isnum_b ()) transposing_i = prop; diff --git a/lily/p-score.cc b/lily/p-score.cc index 2afdbc129c..aed825ed87 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -313,12 +313,16 @@ Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const Item const*r=r_item_l; // huh? see Item::left_right_compare () + /* while (! (dynamic_cast (l))) l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); while (! (dynamic_cast (r))) r = dynamic_cast(r->axis_group_l_a_[X_AXIS]); - + */ + l = l->column_l (); + r = r->column_l (); + PCursor start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ()); PCursor stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ()); diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 93193f1508..e347d9d964 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -8,12 +8,10 @@ #include #include "string.hh" -#include "assoc.hh" #include "misc.hh" #include "paper-def.hh" #include "debug.hh" #include "lookup.hh" -#include "assoc-iter.hh" #include "score-engraver.hh" #include "p-score.hh" #include "identifier.hh" @@ -26,25 +24,25 @@ Paper_def::Paper_def () { - lookup_p_assoc_p_ = new Assoc; + lookup_p_tab_p_ = new Hash_table; } Paper_def::~Paper_def () { - for (Assoc_iter ai(*lookup_p_assoc_p_); ai.ok (); ai++) + for (Hash_table_iter ai(*lookup_p_tab_p_); ai.ok (); ai++) { delete ai.val (); } - delete lookup_p_assoc_p_; + delete lookup_p_tab_p_; } Paper_def::Paper_def (Paper_def const&s) : Music_output_def (s) { - lookup_p_assoc_p_ = new Assoc; - for (Assoc_iter ai(*s.lookup_p_assoc_p_); ai.ok (); ai++) + lookup_p_tab_p_ = new Hash_table; + for (Hash_table_iter ai(*s.lookup_p_tab_p_); ai.ok (); ai++) { Lookup * l = new Lookup (*ai.val ()); l->paper_l_ = this; @@ -125,12 +123,12 @@ Paper_def::arithmetic_spacing (Moment d ,Real k) const void Paper_def::set_lookup (int i, Lookup*l) { - if (lookup_p_assoc_p_->elem_b (i)) + if (lookup_p_tab_p_->elem_b (i)) { - delete lookup_p_assoc_p_->elem (i); + delete lookup_p_tab_p_->elem (i); } l ->paper_l_ = this; - (*lookup_p_assoc_p_)[i] = l; + (*lookup_p_tab_p_)[i] = l; } Real @@ -185,7 +183,7 @@ Paper_def::print () const Music_output_def::print (); DOUT << "Paper {"; - for (Assoc_iter ai(*lookup_p_assoc_p_); ai.ok (); ai++) + for (Hash_table_iter ai(*lookup_p_tab_p_); ai.ok (); ai++) { DOUT << "Lookup: " << ai.key () ; ai.val ()->print (); @@ -198,7 +196,7 @@ Paper_def::print () const Lookup const * Paper_def::lookup_l (int i) const { - return (*lookup_p_assoc_p_)[i]; + return (*lookup_p_tab_p_)[i]; } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index b7074ad295..b023ea14ea 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -43,7 +43,7 @@ Paper_outputter::output_header () if (safe_global_b) { ly_set_scm ("security-paranoia", SCM_BOOL_T); - gh_eval_str ("(set! security-paranoia #t)"); + // gh_eval_str ("(set! security-paranoia #t)"); } String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))"; gh_eval_str (s.ch_C()); diff --git a/lily/parser.yy b/lily/parser.yy index 7898b1c676..405d9c1e30 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -906,7 +906,7 @@ abbrev_command_req: $$ = $1->access_content_Request (true); } | '~' { - $$ = new Command_tie_req; + $$ = new Tie_req; } | '[' { Beam_req*b= new Beam_req; @@ -1555,11 +1555,7 @@ symtables_body: $$ = $1->access_content_Symtables (true); } | symtables_body FONT STRING { - $$->font_ = *$3; - $$->font_path_ = global_path.find (*$3); - if (!$$->font_path_.length_i ()) - THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C())); - + $$->font_name_ = *$3; delete $3; } | symtables_body STRING '=' symtable { diff --git a/lily/plet-engraver.cc b/lily/plet-engraver.cc deleted file mode 100644 index ff855674b5..0000000000 --- a/lily/plet-engraver.cc +++ /dev/null @@ -1,132 +0,0 @@ -#if 0 -/* - plet-engraver.cc -- implement Plet_engraver - - (c) 1997--1998 Jan Nieuwenhuizen -*/ - -#include "proto.hh" -#include "musical-request.hh" -#include "plet-engraver.hh" -#include "plet-spanner.hh" -#include "text-def.hh" -#include "beam.hh" -#include "score-column.hh" -#include "stem.hh" - - -ADD_THIS_TRANSLATOR (Plet_engraver); - -Plet_engraver::Plet_engraver () -{ - beam_mom_drul_[LEFT] = span_mom_drul_[LEFT] = INT_MAX; - beam_mom_drul_[RIGHT] = span_mom_drul_[LEFT] = -INT_MAX; - plet_spanner_p_ = 0; - span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0; -} - -void -Plet_engraver::acknowledge_element (Score_element_info i) -{ - - Stem * st = (dynamic_cast (i.elem_l_)); - if (!st) - return; - if (!plet_spanner_p_) - return; - if (!span_reqs_drul_[LEFT]) - return; - - if (!plet_spanner_p_->stem_l_drul_[LEFT]) - plet_spanner_p_->set_stem (LEFT, st); - else - if (span_reqs_drul_[RIGHT] && !plet_spanner_p_->stem_l_drul_[RIGHT]) - plet_spanner_p_->set_stem (RIGHT, st); -} - -bool -Plet_engraver::do_try_music (Music* req_l) -{ - /* - UGH! This is incorrect! - Beam_req might not reach the Plet_engraver if ordering is wrong! - */ - Beam_req* b = dynamic_cast (req_l); - if (b) - { - if (b->spantype_) - { - Direction d = (Direction)(((int)(b->spantype_ - 1)) * 2 - 1); - beam_mom_drul_[d] = get_staff_info ().musical_l ()->when (); - } - return false; - } - - Plet_req* p = dynamic_cast (req_l); - if (!p) - return false; - - if (bool (plet_spanner_p_) == bool (p->spantype_ == START)) - return false; - - Direction d = (!plet_spanner_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (p)) - return false; - - span_reqs_drul_[d] = p; - span_mom_drul_[d] = get_staff_info ().musical_l ()->when (); - return true; -} - -void -Plet_engraver::do_removal_processing () -{ - if (plet_spanner_p_) - { - span_reqs_drul_[LEFT]->warning (_ ("unterminated plet")); - plet_spanner_p_->unlink (); - delete plet_spanner_p_; - plet_spanner_p_ = 0; - span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0; - } -} - -void -Plet_engraver::do_process_requests () -{ - if (plet_spanner_p_ || !span_reqs_drul_[LEFT]) - return; - - plet_spanner_p_ = new Plet_spanner; - plet_spanner_p_->tdef_p_->text_str_ = to_str (span_reqs_drul_[LEFT]->plet_i_); - - announce_element (Score_element_info (plet_spanner_p_, span_reqs_drul_[LEFT])); -} - -void -Plet_engraver::do_pre_move_processing () -{ - if (!plet_spanner_p_ || !span_reqs_drul_[RIGHT]) - return; - - Scalar prop = get_property ("pletvisibility"); - if (prop.isnum_b ()) - plet_spanner_p_->visibility_i_ = prop; - - if ((beam_mom_drul_[LEFT] <= span_mom_drul_[LEFT]) - && (beam_mom_drul_[RIGHT] >= span_mom_drul_[RIGHT])) - plet_spanner_p_->visibility_i_ &= ~2; - - if (plet_spanner_p_->visibility_i_) - typeset_element (plet_spanner_p_); - else - { - plet_spanner_p_->unlink (); - delete plet_spanner_p_; - } - - plet_spanner_p_ = 0; - span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0; -} - -#endif diff --git a/lily/plet-swallow-engraver.cc b/lily/plet-swallow-engraver.cc deleted file mode 100644 index 3144ebc37d..0000000000 --- a/lily/plet-swallow-engraver.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* - plet-swallow-engraver.cc -- implement Plet_swallow_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - -#include "musical-request.hh" -#include "plet-swallow-engraver.hh" - - -ADD_THIS_TRANSLATOR(Plet_swallow_engraver); - -bool -Plet_swallow_engraver::do_try_music (Music* req_l) -{ - return dynamic_cast (req_l); -} diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc index a28a3caedc..e365ba503c 100644 --- a/lily/repeat-engraver.cc +++ b/lily/repeat-engraver.cc @@ -29,7 +29,7 @@ Repeat_engraver::do_try_music (Music* m) { if (Repeated_music* r = dynamic_cast (m)) { - r->unfold_b_ = get_property ("unfoldRepeats").to_bool (); + r->unfold_b_ = get_property ("unfoldRepeats", 0).to_bool (); if (r->unfold_b_) return true; diff --git a/lily/rest.cc b/lily/rest.cc index d9d2b765d0..0c527bd9ba 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -35,7 +35,7 @@ Rest::Rest () } Molecule * -Rest::brew_molecule_p () const +Rest::do_brew_molecule_p () const { int staff_size_i_ = 8; bool streepjes_b = abs(position_i_) > staff_size_i_ /2 && diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 388e54cab6..28e3cf89c4 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -97,9 +97,9 @@ Rhythmic_column_engraver::do_pre_move_processing() { if (! ncol_p_->h_shift_b_) // egcs - ncol_p_->h_shift_b_ = get_property ("hshift").operator bool (); + ncol_p_->h_shift_b_ = get_property ("hshift", 0).operator bool (); if (! ncol_p_->dir_) - ncol_p_->dir_ =(Direction) int(get_property ("ydirection")); + ncol_p_->dir_ =(Direction) int(get_property ("ydirection", 0)); typeset_element (ncol_p_); ncol_p_ =0; diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index b2c72a65dd..2b2064c067 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -21,11 +21,15 @@ Rhythmic_head::do_add_processing () { if (dots_i_ && !dots_l_) { - Dots *d = new Dots; + assert (false); + /* Dots *d = new Dots; add_dots (d); pscore_l_->typeset_element (d); + + + axis_group_l_a_[Y_AXIS]->add_element (d); - axis_group_l_a_[X_AXIS]->add_element (d); + axis_group_l_a_[X_AXIS]->add_element (d);*/ } if (dots_l_) { diff --git a/lily/score-element.cc b/lily/score-element.cc index 6bdc9d9902..c5e5fed03c 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -23,10 +23,9 @@ #include "misc.hh" #include "paper-outputter.hh" -#define PARANOID - Score_element::Score_element() { + output_p_ =0; transparent_b_ = false; size_i_ = 0; pscore_l_=0; @@ -41,6 +40,7 @@ Score_element::Score_element (Score_element const&s) dependents. */ copy_edges_out (s); + output_p_ =0; transparent_b_ = s.transparent_b_; status_i_ = s.status_i_; pscore_l_ = s.pscore_l_; @@ -52,6 +52,7 @@ Score_element::Score_element (Score_element const&s) Score_element::~Score_element() { + delete output_p_; assert (status_i_ >=0); } @@ -86,9 +87,11 @@ Score_element::do_width() const { Interval r; - Molecule*m = brew_molecule_p(); + Molecule*m = output_p_ ? output_p_ : do_brew_molecule_p(); r = m->extent().x (); - delete m; + + if (!output_p_) + delete m; return r; } @@ -97,9 +100,11 @@ Interval Score_element::do_height() const { Interval r; - Molecule*m = brew_molecule_p(); + Molecule*m = output_p_ ? output_p_ : do_brew_molecule_p(); r = m->extent().y (); - delete m; + if (!output_p_) + delete m; + return r; } @@ -171,18 +176,22 @@ Score_element::calculate_dependencies (int final, int busy, } void -Score_element::do_brew_molecule () +Score_element::output_processing () { if (transparent_b_) return; - Molecule *output= brew_molecule_p (); - for (PCursor i(output->atoms_); i.ok(); i++) + if (output_p_) + delete output_p_; + + output_p_ = do_brew_molecule_p (); + for (PCursor i(output_p_->atoms_); i.ok(); i++) { i->origin_l_ = this; } - pscore_l_->outputter_l_->output_molecule (output, absolute_offset (), classname(this)); - delete output; + pscore_l_->outputter_l_->output_molecule (output_p_, + absolute_offset (), + classname(this)); } /* @@ -245,7 +254,7 @@ Score_element::do_junk_links() Molecule* -Score_element::brew_molecule_p() const +Score_element::do_brew_molecule_p() const { Atom a (lookup_l ()->fill (Box (Interval (0,0), Interval (0,0)))); return new Molecule (a); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 296a129465..e1ab3ab2fb 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -148,12 +148,13 @@ Score_engraver::typeset_all() { Item *item_p = dynamic_cast (elem_p); pscore_p_->typeset_element (item_p); - if (!item_p->axis_group_l_a_[X_AXIS]) { - if (item_p->breakable_b_) - command_column_l_->add_element(item_p); - else - musical_column_l_->add_element(item_p); - } + if (!item_p->parent_l (X_AXIS)) + { + if (item_p->breakable_b_) + command_column_l_->add_element(item_p); + else + musical_column_l_->add_element(item_p); + } } scoreline_l_->add_element (elem_p); } diff --git a/lily/score-priority-engraver.cc b/lily/score-priority-engraver.cc index fb0f0784d8..264ed283a5 100644 --- a/lily/score-priority-engraver.cc +++ b/lily/score-priority-engraver.cc @@ -10,7 +10,7 @@ #include "horizontal-group-item.hh" #include "score-priority-engraver.hh" #include "item.hh" -#include "assoc-iter.hh" +#include "dictionary-iter.hh" #include "break-align-item.hh" @@ -21,15 +21,16 @@ Score_priority_engraver::Score_priority_engraver() void Score_priority_engraver::do_pre_move_processing() { - for (Assoc_iter i(align_p_assoc_); i.ok() ; i++) + for (Hash_table_iter i(align_p_tab_); + i.ok() ; i++) { if (i.val ()) { typeset_element (i.val ()); - i.val () = 0; + i.val_ref () = 0; } } - align_p_assoc_.clear (); + align_p_tab_.clear (); } void @@ -48,27 +49,31 @@ Score_priority_engraver::acknowledge_element (Score_element_info inf) int priority =item_l->break_priority_i_; Horizontal_group_item * hg =0; - if (!align_p_assoc_.elem_b(priority)) + if (!align_p_tab_.elem_b(priority)) { hg = new Horizontal_group_item; announce_element (Score_element_info (hg,0)); - align_p_assoc_[priority] = hg; + align_p_tab_[priority] = hg; hg->break_priority_i_ = priority; hg->breakable_b_ = true; } else - hg = align_p_assoc_[priority]; + hg = align_p_tab_[priority]; Score_element * unbound_elem = inf.elem_l_; - while (unbound_elem->axis_group_l_a_[X_AXIS]) + /* + ugh + */ + while (unbound_elem->parent_l (X_AXIS)) { /* We might have added inf.elem_l_ earlier because we added one of its children. We don't want to add ourselves to ourself */ - if (unbound_elem->axis_group_l_a_[X_AXIS] == hg) + Graphical_element * e = unbound_elem->parent_l (X_AXIS); + if (e == hg) return; - unbound_elem = dynamic_cast (unbound_elem->axis_group_l_a_[X_AXIS]); + unbound_elem = dynamic_cast (e); } hg->add_element (unbound_elem); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 3cc7914dc3..2012f053ba 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -66,12 +66,12 @@ Script_engraver::do_pre_move_processing() Text_def * td_l = (Text_def*)script_p->specs_p_; if (!td_l->style_str_.length_i ()) { - Scalar style = get_property ("textstyle"); + Scalar style = get_property ("textstyle", 0); if (style.to_bool ()) td_l->style_str_= style; } // urg, what if this is already set? in-band signaling... - Scalar alignment = get_property ("textalignment"); + Scalar alignment = get_property ("textalignment", 0); if (alignment.isnum_b()) { td_l->align_dir_= (Direction)(int)alignment; diff --git a/lily/script.cc b/lily/script.cc index 26900c5c2e..73c731190e 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -103,7 +103,7 @@ Script::symbol_width () const } Molecule* -Script::brew_molecule_p () const +Script::do_brew_molecule_p () const { Real dx =0.; diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 4545618efe..43b83ff33e 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -39,7 +39,7 @@ void Separating_line_group_engraver::acknowledge_element (Score_element_info i) { Item * it = dynamic_cast (i.elem_l_); - if (it && !it->axis_group_l_a_[X_AXIS]) + if (it && !it->parent_l (X_AXIS)) { Single_malt_grouping_item *&p_ref_ (it->breakable_b_ ? break_malt_p_ : nobreak_malt_p_); diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index 69c1eed124..5ec0a76cd9 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -11,7 +11,6 @@ #include "sequential-music-iterator.hh" #include "music-list.hh" - void Sequential_music_iterator::do_print() const { @@ -26,16 +25,10 @@ Sequential_music_iterator::Sequential_music_iterator () iter_p_ =0; } -Sequential_music* -Sequential_music_iterator::sequential_music_l () const -{ - return (Sequential_music *)music_l_; -} - void Sequential_music_iterator::construct_children() { - cursor_p_ = new PCursor (sequential_music_l ()->music_p_list_p_->top ()); + cursor_p_ = new PCursor (dynamic_cast (music_l_)->music_p_list_p_->top ()); while (cursor_p_->ok()) { diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 764bcdfe8b..2f28eb32af 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -24,14 +24,15 @@ void Simultaneous_music_iterator::construct_children() { int j = 0; - for (PCursor i (simultaneous_music_l ()->music_p_list_p_->top()); + Simultaneous_music const *sim = dynamic_cast (music_l_); + for (PCursor i (sim->music_p_list_p_->top()); i.ok(); j++, i++) { Music_iterator * mi = get_iterator_p (i.ptr()); if (mi->ok()) { - if (simultaneous_music_l ()->translator_type_str_.empty_b ()) - set_translator (mi->report_to_l()->ancestor_l (0)); + if (sim->translator_type_str_.empty_b ()) + set_translator (mi->report_to_l()->ancestor_l (0)); // huh? children_p_list_.bottom().add (mi); } else @@ -89,8 +90,3 @@ Simultaneous_music_iterator::ok() const return children_p_list_.size(); } -Simultaneous_music* -Simultaneous_music_iterator::simultaneous_music_l ()const -{ - return ( Simultaneous_music *) music_l_; -} diff --git a/lily/single-malt-grouping-item.cc b/lily/single-malt-grouping-item.cc index c030ffafe6..bd5101039a 100644 --- a/lily/single-malt-grouping-item.cc +++ b/lily/single-malt-grouping-item.cc @@ -34,7 +34,7 @@ Single_malt_grouping_item::my_width () const { Item *il = item_l_arr_[i]; assert (pc == il->column_l ()); - w.unite (il->width () + il->relative_coordinate (pc, X_AXIS)); + w.unite (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS)); } return w; diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 308cc41935..e0e4253f86 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -75,7 +75,7 @@ Slur_engraver::do_process_requests() // push a new slur onto stack. //(use temp. array to wait for all slur STOPs) Slur * s_p =new Slur; - Scalar prop = get_property ("slurdash"); + Scalar prop = get_property ("slurdash", 0); if (prop.isnum_b ()) s_p->dash_i_ = prop; requests_arr_.push (slur_req_l); @@ -90,8 +90,8 @@ Slur_engraver::do_process_requests() void Slur_engraver::do_pre_move_processing() { - Scalar dir (get_property ("slurydirection")); - Scalar dir2 (get_property ("ydirection")); + Scalar dir (get_property ("slurydirection", 0)); + Scalar dir2 (get_property ("ydirection", 0)); Direction slurdir = CENTER; if (dir.length_i () && dir.isnum_b ()) diff --git a/lily/slur.cc b/lily/slur.cc index f02f5826d4..465102e6af 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -132,12 +132,12 @@ Slur::do_post_processing () { // ugh -- check if needed dx_f_drul_[d] = -d - *(spanned_drul_[d]->width ().length () - 0.5 * notewidth_f); + *(spanned_drul_[d]->extent (X_AXIS).length () - 0.5 * notewidth_f); // prebreak if (d == RIGHT) { - dx_f_drul_[LEFT] = spanned_drul_[LEFT]->width ().length (); + dx_f_drul_[LEFT] = spanned_drul_[LEFT]->extent (X_AXIS).length (); // urg -- check if needed if (encompass_arr_.size () > 1) @@ -150,8 +150,8 @@ Slur::do_post_processing () else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_ && extrema[d]->head_l_arr_.size ()) { - Real notewidth_f = extrema[d]->width ().length (); - dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height ()[dir_]); + Real notewidth_f = extrema[d]->extent (X_AXIS).length (); + dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_-> extent (Y_AXIS)[dir_]); dx_f_drul_[d] += 0.5 * notewidth_f - d * gap_f; if (dir_ == extrema[d]->stem_l_->dir_) { @@ -163,7 +163,7 @@ Slur::do_post_processing () } else { - Real notewidth_f = extrema[d]->width ().length (); + Real notewidth_f = extrema[d]->extent (X_AXIS).length (); dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval () [dir_]) * internote_f; dx_f_drul_[d] += 0.5 * notewidth_f - d * gap_f; @@ -209,7 +209,7 @@ Slur::do_post_processing () Real damp_f = paper ()->get_var ("slur_slope_damping"); Offset d_off = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT], dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]); - d_off.x () += width ().length (); + d_off.x () += extent (X_AXIS).length (); Real ratio_f = abs (d_off.y () / d_off.x ()); if (ratio_f > damp_f) @@ -252,7 +252,7 @@ Slur::get_encompass_offset_arr () const Offset d = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT], dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]); - d.x () += width ().length (); + d.x () += extent (X_AXIS).length (); int first = 1; int last = encompass_arr_.size () - 1; diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc index ff7bdd65dc..0e1e00841f 100644 --- a/lily/span-bar-engraver.cc +++ b/lily/span-bar-engraver.cc @@ -52,7 +52,7 @@ Span_bar_engraver::acknowledge_element (Score_element_info i) /* - use a property? get_property ("singleStaffBracket") ? + use a property? get_property ("singleStaffBracket", 0) ? --hwn */ diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 47813dc1ea..4b37e846ee 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -90,18 +90,18 @@ Span_bar::get_bar_sym (Real dy) const } Molecule* -Span_bar::brew_molecule_p () const +Span_bar::do_brew_molecule_p () const { Interval y_int; for (int i=0; i < spanning_l_arr_.size (); i++) { - Graphical_axis_group *common = + Dimension_cache*common = common_group (spanning_l_arr_[i], Y_AXIS); - Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS) - -relative_coordinate (common,Y_AXIS); + Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common) + -dim_cache_[Y_AXIS].relative_coordinate (common); - y_int.unite (y + spanning_l_arr_[i]->height ()); + y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS)); } Atom s = get_bar_sym (y_int.length ()); diff --git a/lily/spanner.cc b/lily/spanner.cc index 28f49f22af..2248bf046f 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -133,15 +133,14 @@ Spanner::Spanner (Spanner const &s) } void -Spanner::do_brew_molecule () +Spanner::output_processing () { if (transparent_b_) return ; - Molecule *output= brew_molecule_p (); + output_p_ = do_brew_molecule_p (); Offset left_off (spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), 0); Offset o = absolute_offset() + left_off; - pscore_l_->outputter_l_->output_molecule (output, o, classname (this)); - delete output; + pscore_l_->outputter_l_->output_molecule (output_p_, o, classname (this)); } Interval diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc index 65a7c1336d..167940a687 100644 --- a/lily/spring-spacer.cc +++ b/lily/spring-spacer.cc @@ -546,11 +546,12 @@ Spring_spacer::get_ruling_durations(Array &shortest_playing_arr, /* TODO: take out the refs to width + */ /** generate springs between columns. - TODO: This needs rethinking. + TODO: This needs rethinking....... * Spacing should take optical effects into account @@ -574,11 +575,11 @@ Spring_spacer::calc_idealspacing() Real interline_f = paper_l ()->interline_f (); - Array ideal_arr_; - Array hooke_arr_; + Array ideal_arr; + Array hooke_arr; for (int i=0; i < cols_.size() - 1; i++){ - ideal_arr_.push (-1.0); - hooke_arr_.push (1.0); + ideal_arr.push (-1.0); + hooke_arr.push (1.0); } /* @@ -590,11 +591,8 @@ Spring_spacer::calc_idealspacing() { Real symbol_distance =cols_[i].width_[RIGHT] + 2 PT; Real durational_distance = 0; - - Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when () ; - /* ugh should use shortest_playing distance */ @@ -606,8 +604,8 @@ Spring_spacer::calc_idealspacing() symbol_distance += -cols_[i+1].width_[LEFT]; - ideal_arr_[i] = symbol_distance >? durational_distance; - hooke_arr_[i] = 1; //2.0; + ideal_arr[i] = symbol_distance >? durational_distance; + hooke_arr[i] = 1; //2.0; } } @@ -642,6 +640,7 @@ Spring_spacer::calc_idealspacing() * whitespace at the begin of the bar should be fixed at (about) one interline. + [Ross]: when spacing gets real tight, a smaller fixed value may be used, so that there are two discrete amounts of whitespace @@ -651,13 +650,16 @@ Spring_spacer::calc_idealspacing() * whitespace at the end of the bar is the normal amount of "hinterfleish" that would have been used, had there been yet another note in the bar. + [Ross]: some editors argue that the bar line should not take any space, not to hinder the flow of music spaced around a bar line. + [Ross] and [Wanske] do not suggest this, however. Further, - it introduces some spacing problems and think that it is ugly + it introduces some spacing problems and I think that it is ugly too. + [jcn] */ @@ -669,7 +671,7 @@ Spring_spacer::calc_idealspacing() // fixed: probably should set minimum (rod/spring)? cols_[i-1].width_[RIGHT] += interline_f; // should adjust dist too? - ideal_arr_[i-1] = ideal_arr_[i-1] >? (2 * interline_f); + ideal_arr[i-1] = ideal_arr[i-1] >? (2 * interline_f); } /* @@ -697,13 +699,25 @@ Spring_spacer::calc_idealspacing() + interline_f / 2; dist = dist >? minimum; } - ideal_arr_[i] = dist; + ideal_arr[i] = dist; } } - for (int i=0; i < ideal_arr_.size(); i++) + /* + shorter distances should stretch less. + + (and how bout + + hooke[i] = 2 * max_ideal_space - ideal[i] + + ?) + */ + for (int i=0; i < ideal_arr.size(); i++) + hooke_arr[i] = 1/ideal_arr[i]; + + for (int i=0; i < ideal_arr.size(); i++) { - assert (ideal_arr_[i] >=0 && hooke_arr_[i] >=0); - connect (i, i+1, ideal_arr_[i], hooke_arr_[i]); + assert (ideal_arr[i] >=0 && hooke_arr[i] >=0); + connect (i, i+1, ideal_arr[i], hooke_arr[i]); } } diff --git a/lily/staff-margin-engraver.cc b/lily/staff-margin-engraver.cc index 9b51b97c7c..f1f8aa10da 100644 --- a/lily/staff-margin-engraver.cc +++ b/lily/staff-margin-engraver.cc @@ -48,8 +48,8 @@ Staff_margin_engraver::acknowledge_element (Score_element_info i) || (i.origin_grav_l_arr_.size() != 1)) return; - String string = get_property ("instrument"); - String str = get_property ("instr"); + String string = get_property ("instrument", 0); + String str = get_property ("instr", 0); if (now_moment () > Moment (0)) string = str; @@ -68,7 +68,7 @@ Staff_margin_engraver::acknowledge_element (Score_element_info i) script_p_->breakable_b_ = true; - Scalar pri = get_property ("marginBreakPriority"); + Scalar pri = get_property ("marginBreakPriority", 0); if (pri.length_i () && pri.isnum_b ()) { script_p_->break_priority_i_ = int (pri); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 801912bd89..4c8cc8d6f7 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -77,9 +77,9 @@ String Staff_performer::new_instrument_str () { // mustn't ask Score for instrument: it will return piano! - String str = get_property ("midi_instrument"); + String str = get_property ("midi_instrument", 0); if (!str.length_i ()) - str = get_property ("instrument"); + str = get_property ("instrument", 0); if (str == instrument_str_) return ""; diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 5133465bee..31180f0f6e 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -30,7 +30,7 @@ Staff_side::support_extent() const Interval y_int; for (int i=0; i < support_l_arr_.size(); i++) { - Graphical_axis_group *common = + Dimension_cache *common = common_group (support_l_arr_[i], axis_); Real y = support_l_arr_[i]->relative_coordinate (common, axis_) @@ -76,11 +76,8 @@ Staff_side::get_position_f () const // ugh: 5 -> staff_lines if (axis_ == Y_AXIS && abs (coordinate_offset_f_i) < 5) { - /* I don't understand how this is supposed to work, - simple patch below. Mats B - if (!(abs (coordinate_offset_f_i) % 2)) - y += (Real)dir_ * inter_f; */ - y = (Real)dir_ * 6 * inter_f; + if (!(abs (coordinate_offset_f_i) % 2)) + y += (Real)dir_ * inter_f; } // else // y = v[dir_] + 1 * dir_ * inter_f; diff --git a/lily/staff-sym-engraver.cc b/lily/staff-sym-engraver.cc index d18374277b..d95569ab8e 100644 --- a/lily/staff-sym-engraver.cc +++ b/lily/staff-sym-engraver.cc @@ -39,7 +39,7 @@ Staff_symbol_engraver::do_creation_processing() void Staff_symbol_engraver::do_removal_processing() { - Scalar l (get_property ("numberOfStaffLines")); + Scalar l (get_property ("numberOfStaffLines", 0)); if (l.isnum_b ()) { span_p_->no_lines_i_ = l; diff --git a/lily/staff-sym.cc b/lily/staff-sym.cc index b640d3f54b..45bc674b8d 100644 --- a/lily/staff-sym.cc +++ b/lily/staff-sym.cc @@ -41,9 +41,9 @@ Staff_symbol::do_height() const } Molecule* -Staff_symbol::brew_molecule_p() const +Staff_symbol::do_brew_molecule_p() const { - Real w = width ().length (); + Real w = extent (X_AXIS).length (); Real left_dx = -spanned_drul_[LEFT]->extent (X_AXIS)[LEFT]; Real right_dx = spanned_drul_[RIGHT]->extent (X_AXIS)[RIGHT]; // w += right_dx+ left_dx; diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index b8f3984c5b..ae32b12ba1 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -20,13 +20,12 @@ Stem_engraver::Stem_engraver() stem_p_ = 0; abbrev_p_ = 0; default_abbrev_i_ = 16; - dir_ = CENTER; } void Stem_engraver::do_creation_processing () { - Scalar prop = get_property ("abbrev"); + Scalar prop = get_property ("abbrev", 0); if (prop.isnum_b ()) { default_abbrev_i_ = prop; @@ -84,16 +83,32 @@ Stem_engraver::do_pre_move_processing() typeset_element (abbrev_p_); abbrev_p_ = 0; } + if (stem_p_) { - Scalar prop = get_property ("ydirection"); - dir_ = prop.isnum_b () ? (Direction)int(prop) : CENTER; - if (dir_) + Scalar prop = get_property ("ydirection", 0); + Direction dir = prop.isnum_b () ? (Direction)int(prop) : CENTER; + if (dir) { - stem_p_->dir_ = dir_; + stem_p_->dir_ = dir; stem_p_->dir_forced_b_ = true; } + Translator const *which; + prop = get_property ("stemLeftBeamCount", &which); + if (prop.isnum_b ()) + { + stem_p_->beams_i_drul_[LEFT] = prop; + ((Translator*)which)->set_property ("stemLeftBeamCount", ""); + } + prop = get_property ("stemRightBeamCount", &which); + if (prop.isnum_b ()) + { + stem_p_->beams_i_drul_[RIGHT] = prop; + ((Translator*)which)->set_property ("stemRightBeamCount", ""); + } + + typeset_element(stem_p_); stem_p_ = 0; } @@ -103,17 +118,12 @@ Stem_engraver::do_pre_move_processing() bool Stem_engraver::do_try_music (Music* r) { - Musical_req* mus_l = dynamic_cast (r); - if (!mus_l) - return false; - - Abbreviation_req* a = dynamic_cast (mus_l); - if (!a) - return false; - - abbrev_req_l_ = a; - - return true; + if (Abbreviation_req* a = dynamic_cast (r)) + { + abbrev_req_l_ = a; + return true; + } + return false; } diff --git a/lily/stem.cc b/lily/stem.cc index 69dbd33776..90a12ae555 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -31,7 +31,7 @@ Stem::Stem () /* TODO: staff-size */ - beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = 0; + beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1; mult_i_ = 0; yextent_drul_[DOWN] = yextent_drul_[UP] = 0; @@ -280,7 +280,7 @@ Stem::do_width () const const Real ANGLE = 20* (2.0*M_PI/360.0); // ugh! Molecule* -Stem::brew_molecule_p () const +Stem::do_brew_molecule_p () const { Molecule *mol_p =new Molecule; Drul_array stem_y = yextent_drul_; @@ -288,7 +288,7 @@ Stem::brew_molecule_p () const Real head_wid = 0; if (head_l_arr_.size ()) - head_wid = head_l_arr_[0]->width ().length (); + head_wid = head_l_arr_[0]->extent (X_AXIS).length (); stem_y[Direction(-dir_)] += dir_ * head_wid * tan(ANGLE)/(2*dy); if (!invisible_b ()) @@ -318,7 +318,7 @@ Stem::note_delta_f () const Real r=0; if (head_l_arr_.size()) { - Interval head_wid(0, head_l_arr_[0]->width ().length ()); + Interval head_wid(0, head_l_arr_[0]->extent (X_AXIS).length ()); Real rule_thick(paper ()->rule_thickness ()); Interval stem_wid(-rule_thick/2, rule_thick/2); if (stem_xdir_ == CENTER) @@ -339,10 +339,10 @@ Stem::hpos_f () const TODO: head_l_arr_/rest_l_arr_ in do_substitute_dependent () */ void - Stem::do_substitute_dependency (Score_element*o,Score_element*n) +Stem::do_substitute_dependency (Score_element*o,Score_element*n) { - Item * o_l = dynamic_cast (o); - Item * n_l = n? dynamic_cast (n) : 0; - head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l); - rest_l_arr_.substitute ((Rest*)o_l, (Rest*)n_l); + if (Note_head*h=dynamic_cast (o)) + head_l_arr_.substitute (h, dynamic_cast(n)); + if (Rest *r=dynamic_cast (o)) + rest_l_arr_.substitute (r, dynamic_cast(n)); } diff --git a/lily/super-element.cc b/lily/super-element.cc index 5c4a9de881..095ee454be 100644 --- a/lily/super-element.cc +++ b/lily/super-element.cc @@ -77,7 +77,7 @@ void Super_element::output_all () { pscore_l_->outputter_l_->start_line (); - calculate_dependencies (BREWING, BREWED, &Score_element::do_brew_molecule); + calculate_dependencies (BREWING, BREWED, &Score_element::output_processing); pscore_l_->outputter_l_->stop_line (); } diff --git a/lily/symtable.cc b/lily/symtable.cc index dd9cb2f732..ccf1eb1610 100644 --- a/lily/symtable.cc +++ b/lily/symtable.cc @@ -21,8 +21,8 @@ Symtables::Symtables() Symtables::Symtables (Symtables const &s) : Dictionary (s) { - font_ = s.font_; - font_path_ = s.font_path_; + font_name_ = s.font_name_; + for (Dictionary_iter< Symtable*> i (s); i.ok(); i++) { add (i.key(), new Symtable (*i.val ())); diff --git a/lily/template4.cc b/lily/template4.cc index 65f9617165..d33baffddc 100644 --- a/lily/template4.cc +++ b/lily/template4.cc @@ -21,8 +21,4 @@ #include "pcursor.tcc" #include "plist.tcc" -POINTERLIST_INSTANTIATE(Audio_item); -POINTERLIST_INSTANTIATE(Audio_staff); -POINTERLIST_INSTANTIATE(Paper_column); -POINTERLIST_INSTANTIATE(Paper_score); #endif diff --git a/lily/template8.cc b/lily/template8.cc index 9433757adc..79d9554512 100644 --- a/lily/template8.cc +++ b/lily/template8.cc @@ -8,7 +8,7 @@ #include "proto.hh" #include "plist.hh" -#include "audio-item.hh" +#include "audio-element.hh" #include "audio-column.hh" #include "midi-item.hh" #include "cursor.tcc" diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc new file mode 100644 index 0000000000..792c3aa02f --- /dev/null +++ b/lily/text-engraver.cc @@ -0,0 +1,112 @@ +/* + text-engraver.cc -- implement Text_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#include "engraver.hh" +#include "g-staff-side.hh" +#include "g-text-item.hh" +#include "text-def.hh" +#include "note-head.hh" +#include "stem.hh" + +class Text_engraver : public Engraver +{ + Link_array reqs_; + Link_array positionings_; + Link_array texts_; +public: + Text_engraver(); + VIRTUAL_COPY_CONS(Translator); +protected: + virtual bool do_try_music (Music* m); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void do_process_requests (); + virtual void acknowledge_element (Score_element_info); +}; + +Text_engraver::Text_engraver () +{ + +} + +bool +Text_engraver::do_try_music (Music *m) +{ + if (Script_req *r = dynamic_cast (m)) + { + Text_def * t = dynamic_cast (r->scriptdef_p_); + if (!t) + return false; + reqs_.push (r); + return true; + } + return false; +} + + +void +Text_engraver::acknowledge_element (Score_element_info i) +{ + if (Note_head *n = dynamic_cast (i.elem_l_)) + { + for (int i=0; i < positionings_.size (); i++) + { + positionings_[i]->add_support (n); + } + } + if (Stem *n = dynamic_cast (i.elem_l_)) + { + for (int i=0; i < positionings_.size (); i++) + { + positionings_[i]->add_support (n); + } + } +} + +void +Text_engraver::do_process_requests () +{ + for (int i=0; i < reqs_.size (); i++) + { + Script_req * r = reqs_[i]; + Text_def * t= dynamic_cast (r->scriptdef_p_); + + G_text_item *text = new G_text_item; + G_staff_side_item *ss = new G_staff_side_item; + ss->set_victim (text); + + text->text_str_ = t->text_str_; + + announce_element (Score_element_info (text, r)); + announce_element (Score_element_info (ss, r)); + + texts_.push (text); + positionings_.push (ss); + } +} + +void +Text_engraver::do_pre_move_processing () +{ + for (int i=0; i < texts_.size (); i++) + { + typeset_element (texts_[i]); + typeset_element (positionings_[i]); + } + texts_.clear (); + positionings_.clear (); +} + +void +Text_engraver::do_post_move_processing () +{ + reqs_.clear (); +} + +ADD_THIS_TRANSLATOR(Text_engraver); diff --git a/lily/text-item.cc b/lily/text-item.cc index 04f6ec6997..ba8e2911bb 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -63,7 +63,7 @@ Text_item::symbol_height () const } Molecule* -Text_item::brew_molecule_p () const +Text_item::do_brew_molecule_p () const { Atom a (tdef_p_->get_atom (paper (), dir_)); diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index e8d2f612bc..4768d9f96e 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -55,7 +55,7 @@ Text_spanner::do_post_processing() } Molecule* -Text_spanner::brew_molecule_p() const +Text_spanner::do_brew_molecule_p() const { Atom tsym (spec_p_->get_atom (paper(),CENTER)); tsym.translate (text_off_); @@ -74,7 +74,7 @@ Text_spanner::do_pre_processing() Interval Text_spanner::height() const { - return brew_molecule_p()->extent ().y (); + return do_brew_molecule_p()->extent ().y (); } void diff --git a/lily/ctie-engraver.cc b/lily/tie-engraver.cc similarity index 82% rename from lily/ctie-engraver.cc rename to lily/tie-engraver.cc index 662a554844..cf9dd50f7c 100644 --- a/lily/ctie-engraver.cc +++ b/lily/tie-engraver.cc @@ -1,5 +1,5 @@ /* - ctie-engraver.cc -- implement Command_tie_engraver + ctie-engraver.cc -- implement Tie_engraver source file of the GNU LilyPond music typesetter @@ -7,22 +7,22 @@ */ -#include "ctie-engraver.hh" +#include "tie-engraver.hh" #include "command-request.hh" #include "note-head.hh" #include "musical-request.hh" #include "tie.hh" -Command_tie_engraver::Command_tie_engraver() +Tie_engraver::Tie_engraver() { req_l_ = 0; } bool -Command_tie_engraver::do_try_music (Music *m) +Tie_engraver::do_try_music (Music *m) { - if (Command_tie_req * c = dynamic_cast (m)) + if (Tie_req * c = dynamic_cast (m)) { req_l_ = c; return true; @@ -31,7 +31,7 @@ Command_tie_engraver::do_try_music (Music *m) } void -Command_tie_engraver::acknowledge_element (Score_element_info i) +Tie_engraver::acknowledge_element (Score_element_info i) { if (Note_head *nh = dynamic_cast (i.elem_l_)) { @@ -41,7 +41,7 @@ Command_tie_engraver::acknowledge_element (Score_element_info i) } void -Command_tie_engraver::do_process_requests () +Tie_engraver::do_process_requests () { if (req_l_) { @@ -57,7 +57,7 @@ Command_tie_engraver::do_process_requests () } void -Command_tie_engraver::process_acknowledged () +Tie_engraver::process_acknowledged () { if (req_l_) { @@ -87,7 +87,7 @@ Command_tie_engraver::process_acknowledged () } void -Command_tie_engraver::do_pre_move_processing () +Tie_engraver::do_pre_move_processing () { for (int i=0; i < now_heads_.size (); i++) { @@ -103,7 +103,7 @@ Command_tie_engraver::do_pre_move_processing () } void -Command_tie_engraver::do_post_move_processing () +Tie_engraver::do_post_move_processing () { req_l_ =0; Moment now = now_moment (); @@ -113,7 +113,7 @@ Command_tie_engraver::do_post_move_processing () -ADD_THIS_TRANSLATOR(Command_tie_engraver); +ADD_THIS_TRANSLATOR(Tie_engraver); CHead_melodic_tuple::CHead_melodic_tuple () diff --git a/lily/tie.cc b/lily/tie.cc index 0aead69536..1483196b2e 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -109,7 +109,7 @@ Tie::do_post_processing() // uhm? loose end of tie // tie attached to stem else { - dx_f_drul_[d] = -d * (spanned_drul_[d]->width ().length () + dx_f_drul_[d] = -d * (spanned_drul_[d]->extent (X_AXIS).length () -0.5 * notewidth); } } @@ -140,7 +140,7 @@ Tie::do_post_processing() Real damp_f = paper ()->get_var ("tie_slope_damping"); Offset d_off = Offset (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT], dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]); - d_off.x () += width ().length (); + d_off.x () += extent (X_AXIS).length (); Real ratio_f = abs (d_off.y () / d_off.x ()); if (ratio_f > damp_f) diff --git a/lily/ties-engraver.cc b/lily/ties-engraver.cc deleted file mode 100644 index 63a0390e5f..0000000000 --- a/lily/ties-engraver.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - tie-reg.cc -- implement Ties_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - -#include "ties-engraver.hh" -#include "tie.hh" -#include "note-head.hh" -#include "musical-request.hh" -#include "music-list.hh" - -Ties_engraver::Ties_engraver() -{ - req_l_ = end_req_l_ =0; - processed_ack_pass_i_ = 0; - -} - -void -Ties_engraver::do_post_move_processing() -{ - processed_ack_pass_i_ =0; -} - -bool -Ties_engraver::do_try_music (Music*req) -{ - if (Tie_req * r = dynamic_cast (req)) - { - req_l_ = r; - return true; - } - return false; -} - - -void -Ties_engraver::acknowledge_element (Score_element_info i) -{ - if (!req_l_ && ! end_req_l_) - return; - if (Note_head * h = dynamic_cast (i.elem_l_)) - { - Melodic_req *m = dynamic_cast (i.req_l_); - - head_mel_tuple_arr_.push (Head_melodic_tuple (h, m)); - } -} - -void -Ties_engraver::process_acknowledged () -{ - if (!head_mel_tuple_arr_.size () || processed_ack_pass_i_ ++) - return; - - head_mel_tuple_arr_.sort (Head_melodic_tuple::compare); - if (req_l_ && !tie_p_arr_.size ()) - { - for (int i=0; i < head_mel_tuple_arr_.size (); i++) - { - Tie* p = new Tie; - p->set_head (LEFT,head_mel_tuple_arr_[i].head_l_); - // announce_element (Score_element_info (p, req_l_)); - tie_p_arr_.push (p); - } - } - - if (end_req_l_) - { - for (int i=0; i < end_tie_p_arr_.size (); i++) - { - int j = i; - if (j >= head_mel_tuple_arr_.size ()) - { - left_head_mel_tuple_arr_[i].mel_l_->warning (_( "Can't find a note head at the right to attach Tie")); - j = head_mel_tuple_arr_.size () -1; - } - - Tie*p=end_tie_p_arr_[i]; - p->set_head (RIGHT, head_mel_tuple_arr_[j].head_l_); - if (!Melodic_req::compare (*head_mel_tuple_arr_[j].mel_l_, - *left_head_mel_tuple_arr_[j].mel_l_)) - p->same_pitch_b_ = true; - announce_element ( Score_element_info (p, end_req_l_)); - } - } -} - - -void -Ties_engraver::do_pre_move_processing() -{ - if (!head_mel_tuple_arr_.size ()) - return; - - - for (int i =0; i < end_tie_p_arr_.size (); i++) - { - Scalar tie_dir (get_property ("tieYDirection")); - Scalar y_dir (get_property ("ydirection")); - Direction dir = CENTER; - if (tie_dir.length_i () && tie_dir.isnum_b ()) - dir = (Direction) sign (int (tie_dir)); - else if (y_dir.length_i () && y_dir.isnum_b ()) - dir = (Direction) sign (int (y_dir)); - - end_tie_p_arr_[i]->dir_ = dir; - typeset_element (end_tie_p_arr_[i]); - } - - end_tie_p_arr_ = tie_p_arr_; - left_head_mel_tuple_arr_ = head_mel_tuple_arr_; - end_req_l_ = req_l_; - - req_l_ =0; - head_mel_tuple_arr_.clear (); - tie_p_arr_.clear (); -} - -void -Ties_engraver::do_removal_processing () -{ -} - -void -Ties_engraver::do_process_requests () -{} - - - -ADD_THIS_TRANSLATOR(Ties_engraver); - - -Head_melodic_tuple::Head_melodic_tuple () -{ - head_l_ =0; - mel_l_ =0; -} - -Head_melodic_tuple::Head_melodic_tuple (Note_head *h, Melodic_req*m) -{ - head_l_ = h; - mel_l_ = m; -} - -int -Head_melodic_tuple::compare (Head_melodic_tuple const&h1, - Head_melodic_tuple const &h2) -{ - return Melodic_req::compare (*h1.mel_l_, *h2.mel_l_); -} diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 2045dcb4b0..abf70356e2 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -54,7 +54,7 @@ Time_signature_engraver::do_pre_move_processing() { if (time_signature_p_) { - Scalar sigstyle = get_property ("timeSignatureStyle"); + Scalar sigstyle = get_property ("timeSignatureStyle", 0); if (sigstyle.length_i ()) { time_signature_p_->time_sig_type_str_ = sigstyle; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 58adb32966..de236c0c6e 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -19,7 +19,7 @@ Time_signature::Time_signature () } Molecule* -Time_signature::brew_molecule_p () const +Time_signature::do_brew_molecule_p () const { Atom s; if (time_sig_type_str_.length_i ()) diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index d5da1d6402..71c3eb09e1 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -119,7 +119,7 @@ Timing_translator::do_pre_move_processing() /* allbars == ! skipbars */ - bool allbars = ! get_property ("SkipBars").to_bool (); + bool allbars = ! get_property ("SkipBars", 0).to_bool (); if (!time_.cadenza_b_ && allbars) diff --git a/lily/translator.cc b/lily/translator.cc index 35ef5a7abe..1629bf5e56 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -155,16 +155,20 @@ Translator::pre_move_processing () } Scalar -Translator::get_property (String id) +Translator::get_property (String id, Translator const **where_l) const { if (properties_dict_.elem_b (id)) { + if (where_l) + *where_l = this; return properties_dict_[id]; } if (daddy_trans_l_) - return daddy_trans_l_->get_property (id); + return daddy_trans_l_->get_property (id, where_l); + if (where_l) + *where_l = 0; return ""; } diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index 96590d3140..e6d43c2b33 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -33,7 +33,7 @@ Plet_spanner::Plet_spanner () } Molecule* -Plet_spanner::brew_molecule_p () const +Plet_spanner::do_brew_molecule_p () const { Molecule* mol_p = new Molecule; @@ -51,7 +51,7 @@ Plet_spanner::brew_molecule_p () const { Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] - column_arr_[0]->extent (Y_AXIS) [dir_]; - Real w = width ().length () + ncw; + Real w = extent (X_AXIS).length () + ncw; num.translate (Offset (w/2, dy/2)); mol_p->add_atom (lookup_l ()->plet (dy, w, dir_)); diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index 6fa9794f88..f94bfe5efd 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -27,13 +27,13 @@ Vertical_align_engraver::do_creation_processing() void Vertical_align_engraver::do_removal_processing() { - Scalar dist (get_property ("maxVerticalAlign")); + Scalar dist (get_property ("maxVerticalAlign", 0)); if (dist.length_i () && dist.isnum_b ()) { valign_p_->threshold_interval_[BIGGER] = Real (dist); } - dist = get_property ("minVerticalAlign"); + dist = get_property ("minVerticalAlign", 0); if (dist.length_i () && dist.isnum_b ()) { valign_p_->threshold_interval_[SMALLER] = Real (dist); @@ -47,9 +47,9 @@ Vertical_align_engraver::do_removal_processing() void Vertical_align_engraver::acknowledge_element (Score_element_info i) { - if (i.origin_grav_l_arr_.size() == 1 && - dynamic_cast (i.elem_l_) && - !i.elem_l_->axis_group_l_a_[Y_AXIS]) + if (i.origin_grav_l_arr_.size() == 1 + && dynamic_cast (i.elem_l_) + && !i.elem_l_->parent_l (Y_AXIS)) { assert (!valign_p_->contains_b (i.elem_l_)); diff --git a/lily/vertical-group-spanner.cc b/lily/vertical-group-spanner.cc index 638afa364d..1178a44bb0 100644 --- a/lily/vertical-group-spanner.cc +++ b/lily/vertical-group-spanner.cc @@ -10,10 +10,7 @@ #include "item.hh" #include "p-col.hh" - - - Vertical_group_spanner::Vertical_group_spanner () { - axis1_ = axis2_ = Y_AXIS; + axes_[0] = axes_[1] = Y_AXIS; } diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index d40848a56e..a5b6f629a0 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -36,7 +36,7 @@ Volta_spanner::Volta_spanner () } Molecule* -Volta_spanner::brew_molecule_p () const +Volta_spanner::do_brew_molecule_p () const { Molecule* mol_p = new Molecule; @@ -44,7 +44,7 @@ Volta_spanner::brew_molecule_p () const { Real internote_f = paper ()->internote_f (); Real dx = internote_f; - Real w = width ().length () - 2 * dx; + Real w = extent (X_AXIS).length () - 2 * dx; Atom volta (lookup_l ()->volta (w, last_b_)); Real h = volta.dim_.y ().length (); Atom num (number_p_->get_atom (paper (), LEFT)); @@ -52,8 +52,12 @@ Volta_spanner::brew_molecule_p () const Real dy = column_arr_.top ()->extent (Y_AXIS) [dir_] > column_arr_[0]->extent (Y_AXIS) [dir_]; dy += 2 * h; + + /* + UGH. Must use extent ()[dir_] + */ for (int i = 0; i < note_column_arr_.size (); i++) - dy = dy >? note_column_arr_[i]->height ().max (); + dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max (); dy -= h; Real gap = num.dim_.x ().length () / 2; diff --git a/make/out/lelievijver.lsm b/make/out/lelievijver.lsm index b2536253c1..b948faf809 100644 --- a/make/out/lelievijver.lsm +++ b/make/out/lelievijver.lsm @@ -1,15 +1,15 @@ Begin3 Titel: LilyPond -Versie: 1.1.17 -Inschrijf datum: 24DEC98 +Versie: 1.1.18 +Inschrijf datum: 04JAN99 Beschrijving: @FLAPTEKST@ Trefwoorden: muziek typezetten midi notatie Auteur: hanwen@stack.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Onderhouden door: hanwen@cs.ruu.nl (Han-Wen Nienhuys) Voornaamste plek: sunsite.unc.edu /pub/Linux/apps - 770k lilypond-1.1.17.tar.gz + 770k lilypond-1.1.18.tar.gz Oorspronkelijke plek: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.17.tar.gz + 770k lilypond-1.1.18.tar.gz Copi-eer voorwaarden: GPL End diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 7c75763323..9dccfd5744 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 1.1.17 -Entered-date: 24DEC98 +Version: 1.1.18 +Entered-date: 04JAN99 Description: LilyPond is the GNU Project music typesetter. This program can print beautiful sheet music from a music definition file. It can also play @@ -14,8 +14,8 @@ Author: hanwen@cs.ruu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 770k lilypond-1.1.17.tar.gz + 770k lilypond-1.1.18.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.17.tar.gz + 770k lilypond-1.1.18.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 2124ea5c2e..8a8e9f9877 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.1.17 +Version: 1.1.18 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.17.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.18.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys diff --git a/mf/cmbase.mf b/mf/cmbase.mf new file mode 100644 index 0000000000..22c4a27c04 --- /dev/null +++ b/mf/cmbase.mf @@ -0,0 +1,697 @@ +% The base file for Computer Modern (a supplement to {\tt plain.mf}) + +cmbase:=1; % when |cmbase| is known, this file has been input + +let cmchar=\; % `|cmchar|' should precede each character +let generate=input; % `|generate|' should follow the parameters + +autorounding:=0; smoothing:=0; % we do our own rounding +def autorounded = interim autorounding:=2 enddef; + +newinternal slant,fudge,math_spread,superness,superpull,beak_darkness,ligs; +boolean square_dots,hefty,serifs, + monospace,variant_g,low_asterisk,math_fitting; + +boolean dark,dark.dark,skewed,skewed.skewed; % for fast option testing +dark=skewed=false; dark.dark=skewed.skewed=true; + +vardef Vround primary y = y_:=vround y; + if y_y@2: y@2:=y@1; fi + else: y@2=max(y$-bracket_height,y$$); + bot y@1+slab=top y@0-eps=tiny.top y$; downward=z$$-z$; + if y@1x@2-eps: x@3:=x@2-eps; fi fi + pair corner; ypart corner=y@1; corner=z@2+whatever*downward; + filldraw z@2{z$-z$$} + ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2} + ...{jut,0}z@1--z@0--(x$,y@0)--z@3--cycle; % the serif + labels (@1,@2); enddef; + +def dish_serif(suffix $,$$,@)(expr left_darkness,left_jut) + (suffix @@)(expr right_darkness,right_jut) suffix modifier = + serif($,$$,@,left_darkness,-left_jut) modifier; + serif($,$$,@@,right_darkness,right_jut) modifier; + if dish>0: pickup tiny.nib; numeric dish_out,dish_in; + if y$0: erase fill z@1--top z@1 + --(x@2r,top y@1)--z@2r--cycle; fi % erase excess at top + filldraw z@1--z@2r--z@2l{right} + ...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l} + ...{down}z@0--(x@1,y@0)--cycle; % sloped serif + labels(@0,@1,@2); enddef; + +vardef sloped_serif.r(suffix $,$$,@)(expr darkness,jut,drop) = + pickup crisp.nib; pos@2(slab,-90); + rt x@0=tiny.rt x$r; lft x@1=tiny.lft x$l; bot y@1=tiny.bot y$l; + rt x@2=rt x@0+jut; y@2r=y@1+drop; + y@0=min(y@2l+bracket,y$$)+eps; +if drop>0: erase fill z@1--bot z@1 + --(x@2r,bot y@1)--z@2r--cycle; fi % erase excess at bottom + filldraw z@1--z@2r--z@2l{left} + ...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l} + ...{up}z@0--(x@1,y@0)--cycle; % sloped serif + labels(@0,@1,@2); enddef; + +vardef term.l(suffix $,$$)(expr d,t,s)= % ``robust'' sans-serif terminal + path p_; p_=z$l{d}..tension t..z$$l; + pair d_; d_=(x$$l-x$l,s*(y$$l-y$l)); + if (abs angle direction 1 of p_ < abs angle d_)<>(x$l(x$ry$: bot else: top fi\\ y_=y$; + (from_x,y_)=whatever[z.from,z$]; + sharpness[z$,(from_x,y_)]{z$-z.from} + ...{z$$-z$}z$+sharpness*length(z$-(from_x,y_))*unitvector(z$$-z$) enddef; + +vardef diag_out(suffix $)(expr sharpness)(suffix $$,to) = + pickup tiny.nib; save to_x,y_; + if y.to>y$: bot else: top fi\\ y_=y$; + (to_x,y_)=whatever[z$$,z.to]; + z$$-sharpness*length(z$$-(to_x,y_))*unitvector(z$$-z$){z$$-z$} + ...{z.to-z$$}sharpness[z$$,(to_x,y_)] enddef; + +vardef diag_end(suffix from,$)(expr sharpness_in,sharpness_out)(suffix $$,to)= + save from_x,to_x,y_,x_,xx_; + if y.from>y$: tiny.bot else: tiny.top fi\\ y_=y$; % we assume that |y$=y$$| + (from_x,y_)=whatever[z.from,z$]; (to_x,y_)=whatever[z$$,z.to]; + if x$$>x$: x_=x$+sharpness_in*length(z$-(from_x,y_)); + xx_=x$$-sharpness_out*length(z$$-(to_x,y_)); + if xx_x_: xx_:=x_:=.5[xx_,x_]; fi fi + sharpness_in[z$,(from_x,y_)]{z$-z.from} + ...{z$$-z$}(x_,y$)..(xx_,y$){z$$-z$} + ...{z.to-z$$}sharpness_out[z$$,(to_x,y_)] enddef; +%%% at from to %%%% restore normal formatting + +vardef special_diag_end(suffix $$,$,@,@@) = % for top middle of w's + if x@r<=x$r: diag_end($$r,$r,1,1,@l,@@l) + else: z0=whatever[z$$l,z$l]=whatever[z@l,z@@l]; + diag_end($$r,$r,1,1,$l,0)--z0 fi enddef; + +def prime_points_inside(suffix $,$$) = + theta_:=angle(z$r-z$l); + penpos$'(whatever,theta_); + if y$$>y$: z$'=(0,pen_top) rotated theta_ + whatever[z$l,z$r]; + theta_:=angle(z$$-z$)-90; + else: z$'=(0,pen_bot) rotated theta_ + whatever[z$l,z$r]; + theta_:=angle(z$$-z$)+90; fi + z$'l+(pen_lft,0) rotated theta_=z$l+whatever*(z$-z$$); + z$'r+(pen_rt,0) rotated theta_=z$r+whatever*(z$-z$$); + enddef; + +def ellipse_set(suffix $,@,@@,$$) = % given |z$,x@,z$$|, find |y@| and |z@@| +% such that the path |z${x@-x$,0}..z@{0,y@-y$}..{z$$-z@@}z@@| +% is consistent with an ellipse +% and such that the line |z@@--z$$| has a given |slope| + alpha_:=slope*(x@-x$); beta_:=y$$-y$-slope*(x$$-x$); + gamma_:=alpha_/beta_; + y@-y$=.5(beta_-alpha_*gamma_); + x@@-x$=-2gamma_*(x@-x$)/(1+gamma_*gamma_); + y@@-y$$=slope*(x@@-x$$) enddef; + +vardef diag_ratio(expr a,b,y,c) = % assuming that $a>\vert b/y\vert$, +% compute the value $\alpha=(x\6{++}y)/y$ such that $ax+b\alpha=c$ + numeric a_,b_,c_; b_=b/y; c_=c/y; a_=a*a-b_*b_; + (a*(c_++sqrt a_)-b_*c_)/a_ enddef; + +def f_stroke(suffix $,$$,@,left_serif,right_serif)(expr left_jut,right_jut)= + pickup tiny.nib; bot y$=0; + penpos@0(x$r-x$l,0); x@0l=x$l; top y@0=x_height; + filldraw stroke z$e--z@0e; % stem + pickup fine.nib; pos@0'(x$r-x$l-(hround stem_corr)+tiny,180); + y@0'=y@0; lft x@0'r=tiny.lft x$l; + penpos@1(x@0'l-x@0'r,180); x@1=x@0'; y@1+.5vair=.5[x_height,h]; + pos@2(vair,90); top y@2r=h+oo; + if serifs: x@2=.6[x@1,x$$r]; (x@,y@2r)=whatever[z@2l,z@1l]; + x@2r:=min(x@,.5[x@2,x$$r]); pos@3(hair,0); bulb(@2,@3,$$); % bulb + filldraw stroke z@0'e--z@1e & super_arc.e(@1,@2); % arc + dish_serif($,@0,left_serif,1/3,left_jut,right_serif,1/3,right_jut); % serif + else: x@2=.6[x@1,x$$]; y@1l:=1/3[y@1l,y@2l]; + filldraw stroke z@0'e--z@1e & super_arc.e(@1,@2) + & term.e(@2,$$,right,.9,4); fi % arc and terminal + penlabels(@0,@1,@2); enddef; + +def h_stroke(suffix $,@,@@,$$) = + penpos$$(x@@r-x@@l,0); x$$=x@@; bot y$$=0; + y@@=1/3[bar_height,x_height]; + penpos$''(x$r-x$l,0); x$''=x$; y$''=1/8[bar_height,x_height]; + filldraw stroke z$''e--z$e; % thicken the lower left stem + penpos@0(min(rt x$r-lft x$l,thin_join)-fine,180); pickup fine.nib; + rt x@0l=tiny.rt x$r; y@0=y$''; + pos@1(vair,90); pos@@'(x@@r-x@@l+tiny,0); z@@'=z@@; + x@1=.5[rt x@0l,rt x@@'r]; top y@1r=x_height+oo; + (x@,y@1l)=whatever[z@1r,z@0l]; x@1l:=x@; + filldraw stroke z@0e{up}...{right}z@1e + &{{interim superness:=hein_super; super_arc.e(@1,@@')}}; % arch + pickup tiny.nib; filldraw stroke z@@e--z$$e; % right stem + labels(@0); penlabels(@1); enddef; + +def hook_out(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known + pos$(stem,0); pos$$(vair,90); + x$$$:=hround(x$$$+.5hair-eps)-.5hair; pos$$$(hair,180); + y$=1/4x_height; bot y$$l=-oo; y$$$=1/3x_height; + if skewed.modifier: x$$=x$+1.25u; + filldraw stroke z$e{-u,-x_height}...z$$e{right}...{up}z$$$e; % hook + else: x$$=x$+1.5u; + filldraw stroke z$e{down}...z$$e{right} + ...{x$$$-(x$+2.5u),x_height}z$$$e; fi enddef; % hook + +def hook_in(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known + x$:=hround(x$-.5hair)+.5hair; pos$(hair,180); + pos$$(vair,90); pos$$$(stem,0); + y$=2/3x_height; top y$$r=x_height+oo; y$$$=3/4x_height; + if skewed.modifier: x$$=x$$$-1.25u; + filldraw stroke z$e{up}...z$$e{right}...{-u,-x_height}z$$$e; % hook + else: x$$=x$$$-1.5u; + filldraw stroke z$e{x$$$-2.5u-x$,x_height} + ...z$$e{right}...{down}z$$$e; fi enddef; % hook + +def ital_arch(suffix $,$$,$$$) = % |z$| and |z$$$| (only) are known + pos$'(hair,180); z$'=z$; + pos$$(vair,90); pos$$$(stem,0); + {{interim superness := more_super; x$$=.6[x$,x$$$]; + top y$$r=x_height+oo; y$$$=.65x_height; + filldraw stroke z$'e{up}...super_arc.e($$,$$$);}} enddef; % stroke + +def compute_spread(expr normal_spread,big_spread)= + spread#:=math_spread[normal_spread,big_spread]; + spread:=2ceiling(spread#*hppp/2)+eps; enddef; + +def v_center(expr h_sharp) = + .5h_sharp+math_axis#, .5h_sharp-math_axis# enddef; + +def circle_points = + x4=x8=.5[x2,x6]; x1=x3=superness[x4,x2]; x5=x7=superness[x4,x6]; + y2=y6=.5[y4,y8]; y1=y7=superness[y2,y8]; y3=y5=superness[y2,y4]; + enddef; +def draw_circle = + draw z8{right}...z1{z2-z8}...z2{down}...z3{z4-z2}...z4{left} + ...z5{z6-z4}...z6{up}...z7{z8-z6}...cycle enddef; + +def left_paren(expr min_breadth, max_breadth) = + pickup fine.nib; pos1(hround min_breadth,0); + pos2(hround max_breadth,0); pos3(hround min_breadth,0); + rt x1r=rt x3r=hround(w-1.25u+.5min_breadth); lft x2l=hround 1.25u; + top y1=h; y2=.5[y1,y3]; bot y3=1-d; + filldraw stroke z1e{3(x2e-x1e),y2-y1}...z2e + ...{3(x3e-x2e),y3-y2}z3e; % arc + penlabels(1,2,3); enddef; + +def right_paren(expr min_breadth, max_breadth) = + pickup fine.nib; pos1(hround min_breadth,0); + pos2(hround max_breadth,0); pos3(hround min_breadth,0); + lft x1l=lft x3l=hround(1.25u-.5min_breadth); rt x2r=hround(w-1.25u); + top y1=h; y2=.5[y1,y3]; bot y3=1-d; + filldraw stroke z1e{3(x2e-x1e),y2-y1}...z2e + ...{3(x3e-x2e),y3-y2}z3e; % arc + penlabels(1,2,3); enddef; + +def left_bracket(expr breadth,do_top,do_bot) = + pickup crisp.nib; + numeric thickness; thickness=hround breadth; + pos1(thickness,0); pos2(thickness,0); + top y1=h; bot y2=1-d; lft x1l=lft x2l=hround(2.5u-.5thickness); + filldraw stroke z1e--z2e; % stem + pos3(thickness,90); pos4(thickness,90); + pos5(thickness,90); pos6(thickness,90); + x3=x5=x1l; rt x4=rt x6=hround(w-.75u+.5thickness); + y3r=y4r=y1; y5l=y6l=y2; + if do_top: filldraw stroke z3e--z4e; fi % upper bar + if do_bot: filldraw stroke z5e--z6e; fi % lower bar + penlabels(1,2,3,4,5,6); enddef; + +def right_bracket(expr breadth,do_top,do_bot) = + pickup crisp.nib; + numeric thickness; thickness=hround breadth; + pos1(thickness,0); pos2(thickness,0); + top y1=h; bot y2=1-d; rt x1r=rt x2r=hround(w-2.5u+.5thickness); + filldraw stroke z1e--z2e; % stem + pos3(thickness,90); pos4(thickness,90); + pos5(thickness,90); pos6(thickness,90); + x3=x5=x1r; lft x4=lft x6=hround(.75u-.5thickness); + y3r=y4r=y1; y5l=y6l=y2; + if do_top: filldraw stroke z3e--z4e; fi % upper bar + if do_bot: filldraw stroke z5e--z6e; fi % lower bar + penlabels(1,2,3,4,5,6); enddef; + +def left_curly(expr min_breadth, max_breadth) = + pickup fine.nib; + forsuffixes $=1,1',4,4',7,7': pos$(hround min_breadth,0); endfor + forsuffixes $=2,3,5,6: pos$(hround max_breadth,0); endfor + x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4'; + lft x4l=hround(1.5u-.5min_breadth); lft x2l=hround(.5w-.5max_breadth); + top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5]; + y1-y2=y3-y4=(y1-y4)/4; + y1-y1'=y4-y4'=y7'-y7=vround(min_breadth-fine); + filldraw z1l{3(x2l-x1l),y2-y1}...z2l---z3l...{3(x4l-x3l),y4-y3}z4l + --z4'l{3(x5l-x4l),y5-y4'}...z5l---z6l...{3(x7l-x6l),y7-y6}z7l + --z7r--z7'r{3(x6r-x7r),y6-y7'}...z6r---z5r + ...{3(x4r-x5r),.5[y4,y4']-y5}.5[z4r,z4'r]{3(x3r-x4r),y3-.5[y4,y4']} + ...z3r---z2r...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle; % stroke + penlabels(1,2,3,4,5,6,7); enddef; + +def right_curly(expr min_breadth, max_breadth) = + pickup fine.nib; + forsuffixes $=1,1',4,4',7,7': pos$(hround min_breadth,0); endfor + forsuffixes $=2,3,5,6: pos$(hround max_breadth,0); endfor + x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4'; + lft x1l=hround(1.5u-.5min_breadth); lft x2l=hround(.5w-.5max_breadth); + top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5]; + y1-y2=y3-y4=(y1-y4)/4; + y1-y1'=y4-y4'=y7'-y7=vround(min_breadth-fine); + filldraw z1r{3(x2r-x1r),y2-y1}...z2r---z3r...{3(x4r-x3r),y4-y3}z4r + --z4'r{3(x5r-x4r),y5-y4'}...z5r---z6r...{3(x7r-x6r),y7-y6}z7r + --z7l--z7'l{3(x6l-x7l),y6-y7'}...z6l---z5l + ...{3(x4l-x5l),.5[y4,y4']-y5}.5[z4l,z4'l]{3(x3l-x4l),y3-.5[y4,y4']} + ...z3l---z2l...{3(x1l-x2l),y1'-y2}z1'l--z1l--cycle; % stroke + penlabels(1,2,3,4,5,6,7); enddef; + +def left_angle(expr breadth) = + pickup pencircle scaled breadth; + x1=x3=good.x(w-u)+eps; lft x2=hround u-eps; + top y1=h+eps; .5[y1,y3]=y2=good.y .5[-d+eps,h]; + draw z1--z2--z3; % diagonals + labels(1,2,3); enddef; + +def right_angle(expr breadth) = + pickup pencircle scaled breadth; + x1=x3=good.x u-eps; rt x2=hround(w-u)+eps; + top y1=h+eps; .5[y1,y3]=y2=good.y .5[-d+eps,h]; + draw z1--z2--z3; % diagonals + labels(1,2,3); enddef; + +def big_slash(expr breadth) = + adjust_fit(-letter_fit#,-letter_fit#); pickup pencircle scaled breadth; + rt x1=hround(w-u); lft x2=hround u; top y1=h+eps; bot y2=1-d-eps; + draw z1--z2; % diagonal + labels(1,2); enddef; + +def big_blash(expr breadth) = + adjust_fit(-letter_fit#,-letter_fit#); pickup pencircle scaled breadth; + lft x1=hround u; rt x2=hround(w-u); top y1=h+eps; bot y2=1-d-eps; + draw z1--z2; % diagonal + labels(1,2); enddef; + +def big_sqrt = + adjust_fit(0,-letter_fit#); pickup rule.nib; + x1=good.x 4/9w; x2=good.x(w+.5); bot y1=-d; bot y2=0; + draw z1--z2; % diagonal + pickup crisp.nib; pos3(max(curve,rule_thickness),0); + x3l=1.5[x2,x1]; y3=.5[y1,y2]; + pos4(rule_thickness,0); x4=x1; bot y4=-d; + pos5(vair,-45); x5l=good.x(x3l-u); z5l=whatever[z3r,z2]; + z6=z5r+whatever*(z2-z3r)=whatever[z3l,z4l]; + z7=whatever[z1,z2]=z3r+whatever*(z4l-z3l); + filldraw z5r--z6--z4l--z4--z7--z3r--z5l--cycle; % left diagonal and serif + penlabels(1,2,3,4,5,6,7); enddef; + +def big_hat = + adjust_fit(0,0); + pickup crisp.nib; pos2(.6[vair,curve],90); top y2r=h+o; x2=.5w; + x1=w-x3=good.x -eps; y1=y3=.5[x_height,y2]; + pos1(hair,angle(z2-z1)+90); pos3(hair,angle(z3-z2)+90); + filldraw stroke z1e--z2e--z3e; % diagonals + penlabels(1,2,3); enddef; + +def big_tilde = + adjust_fit(0,0); pickup crisp.nib; + numeric theta; theta=angle(1/6(w-vair),1/4(h-x_height)); + numeric mid_width; mid_width=.4[vair,stem]; + pos1(vair,theta+90); pos2(vair,theta+90); + pos3(vair,theta+90); pos4(vair,theta+90); + z2-z1=z4-z3=(mid_width-crisp)*dir theta; + lft x1r=w-rt x4l=0; top y4r=h; + bot y1l=vround(bot y1l+min(2/3[x_height,h],y3l-.25vair)-top y1r); + pair delta; ypart delta=3(y3l-y1l); delta=whatever*dir theta; + filldraw z1l..controls(z1l+delta)and(z3l-delta)..z3l..z4l + --z4r..controls(z4r-delta)and(z2r+delta)..z2r..z1r--cycle; % stroke + penlabels(1,2,3,4); enddef; + +def beginarithchar(expr c) = % ensure consistent dimensions for $+$, $-$, etc. + if monospace: beginchar(c,14u#,27/7u#+math_axis#,27/7u#-math_axis#); + else: beginchar(c,14u#,6u#+math_axis#,6u#-math_axis#); fi + italcorr math_axis#*slant-.5u#; + adjust_fit(0,0); enddef; + +newinternal l,r,shrink_fit; % adjustments to spacing + +def do_expansion(expr expansion_factor) = + forsuffixes $=u,jut,cap_jut,beak_jut,apex_corr: + $:=$.#*expansion_factor*hppp; endfor +enddef; + +def normal_adjust_fit(expr left_adjustment,right_adjustment) = + numeric charwd_in; charwd_in=charwd; + l:=-hround(left_adjustment*hppp)-letter_fit; + interim xoffset:=-l; + charwd:=charwd+2letter_fit#+left_adjustment+right_adjustment; + r:=l+hround(charwd*hppp)-shrink_fit; + w:=r-hround(right_adjustment*hppp)-letter_fit; + do_expansion(w/(charwd_in*hppp)); + enddef; + +def mono_adjust_fit(expr left_adjustment,right_adjustment) = + numeric charwd_in; charwd_in=charwd; + numeric expansion_factor; + mono_charwd#=2letter_fit# + +expansion_factor*(charwd+left_adjustment+right_adjustment); + l:=-hround(left_adjustment*expansion_factor*hppp)-letter_fit; + interim xoffset:=-l; + r:=l+mono_charwd-shrink_fit; + w:=r-hround(right_adjustment*expansion_factor*hppp)-letter_fit; + charwd:=mono_charwd#; charic:=mono_charic#; + do_expansion(w/(charwd_in*hppp)); + enddef; + +extra_endchar:=extra_endchar&"r:=r+shrink_fit;w:=r-l;"; + +def ignore_math_fit(expr left_adjustment,right_adjustment) = enddef; +def do_math_fit(expr left_adjustment,right_adjustment) = + l:=l-hround(left_adjustment*hppp); interim xoffset:=-l; + charwd:=charwd+left_adjustment+right_adjustment; + r:=l+hround(charwd*hppp)-shrink_fit; + charic:=charic-right_adjustment; + if charic<0: charic:=0; fi enddef; +def zero_width = charwd:=0; r:=l-shrink_fit enddef; +def change_width = if not monospace: % change width by $\pm1$ + if r+shrink_fit-l=floor(charwd*hppp): w:=w+1; r:=r+1; + else: w:=w-1; r:=r-1; fi fi enddef; +def center_on(expr x) = if not monospace: % change width for symmetric fit + r:=r+2x-w; w:=2x; fi enddef; +def padded expr del_sharp = + charht:=charht+del_sharp; chardp:=chardp+del_sharp enddef; + +def font_setup = + if monospace: let adjust_fit=mono_adjust_fit; + def mfudged=fudged enddef; + mono_charic#:=body_height#*slant; + if mono_charic#<0: mono_charic#:=0; fi + mono_charwd#:=9u#; define_whole_pixels(mono_charwd); + else: let adjust_fit=normal_adjust_fit; + def mfudged= enddef; fi + if math_fitting: let math_fit=do_math_fit + else: let math_fit=ignore_math_fit fi; + define_pixels(u,width_adj,serif_fit,cap_serif_fit,jut,cap_jut,beak, + bar_height,dish,bracket,beak_jut,stem_corr,vair_corr,apex_corr); + define_blacker_pixels(notch_cut,cap_notch_cut); + forsuffixes $=notch_cut,cap_notch_cut: if $<3: $:=3; fi endfor + define_whole_pixels(letter_fit,fine,crisp,tiny); + define_whole_vertical_pixels(body_height,asc_height, + cap_height,fig_height,x_height,comma_depth,desc_depth,serif_drop); + define_whole_blacker_pixels(thin_join,hair,stem,curve,flare, + dot_size,cap_hair,cap_stem,cap_curve); + define_whole_vertical_blacker_pixels(vair,bar,slab,cap_bar,cap_band); + define_corrected_pixels(o,apex_o); + forsuffixes $=hair,stem,cap_stem: + fudged$.#:=fudge*$.#; fudged$:=hround(fudged$.#*hppp+blacker); + forever: exitif fudged$>.9fudge*$; fudged$:=fudged$+1; endfor endfor + rule_thickness:=ceiling(rule_thickness#*hppp); + heavy_rule_thickness:=ceiling(3rule_thickness#*hppp); + oo:=vround(.5o#*hppp*o_correction)+eps; + apex_oo:=vround(.5apex_o#*hppp*o_correction)+eps; + lowres_fix(stem,curve,flare) 1.3; + lowres_fix(stem,curve) 1.2; + lowres_fix(cap_stem,cap_curve) 1.2; + lowres_fix(hair,cap_hair) 1.2; + lowres_fix(cap_band,cap_bar,bar,slab) 1.2; + stem':=hround(stem-stem_corr); cap_stem':=hround(cap_stem-stem_corr); + vair':=vround(vair+vair_corr); + vstem:=vround .8[vair,stem]; cap_vstem:=vround .8[vair,cap_stem]; + ess:=(ess#/stem#)*stem; cap_ess:=(cap_ess#/cap_stem#)*cap_stem; + dw:=(curve#-stem#)*hppp; bold:=curve#*hppp+blacker; + dh#:=.6designsize; + stem_shift#:=if serifs: 2stem_corr# else: 0 fi; + more_super:=max(superness,sqrt .77superness); + hein_super:=max(superness,sqrt .81225258superness); % that's $2^{-.3}$ + clear_pen_memory; + if fine=0: fine:=1; fi + forsuffixes $=fine,crisp,tiny: +%%% fine $ %%%% temporary formatting convention for MFT + if $>fudged.hair: $:=fudged.hair; fi + $.breadth:=$; + pickup if $=0: nullpen else: pencircle scaled $; $:=$-eps fi; + $.nib:=savepen; breadth_[$.nib]:=$; + forsuffixes $$=lft,rt,top,bot: shiftdef($.$$,$$ 0); endfor endfor +%%% @ $ %%%% restore ordinary formatting for $ + min_Vround:=max(fine.breadth,crisp.breadth,tiny.breadth); + if min_Vround0: + rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); fi % italic correction + enddef; +def maketicks(text rule) = + for y=0,h.o_,-d.o_: + rule((l,y),(l+10,y)); rule((r-10,y),(r,y)); endfor % horizontals + for x=l,r: + rule((x,10-d.o_),(x,-d.o_)); rule((x,h.o_-10),(x,h.o_)); endfor % verticals + if charic<>0: + rule((r+charic*pt,h.o_-10),(r+charic*pt,h.o_)); fi % italic correction + enddef; +rulepen:=pensquare; + +vardef stroke text t = + forsuffixes e = l,r: path_.e:=t; endfor + if cycle path_.l: + errmessage "Beware: `stroke' isn't intended for cycles"; fi + path_.l -- reverse path_.r -- cycle enddef; + +vardef circ_stroke text t = + forsuffixes e = l,r: path_.e:=t; endfor + if cycle path_.l: + errmessage "Beware: `stroke' isn't intended for cycles"; fi + path_.l -- reverse path_.r .. cycle enddef; + +vardef super_arc.r(suffix $,$$) = % outside of super-ellipse + pair center,corner; + if y$=y$r: center=(x$$r,y$r); corner=(x$r,y$$r); + else: center=(x$r,y$$r); corner=(x$$r,y$r); fi + z$.r{corner-z$.r}...superness[center,corner]{z$$.r-z$.r} + ...{z$$.r-corner}z$$.r enddef; + +vardef super_arc.l(suffix $,$$) = % inside of super-ellipse + pair center,corner; + if y$=y$r: center=(x$$l,y$l); corner=(x$l,y$$l); + else: center=(x$l,y$$l); corner=(x$$l,y$l); fi + z$l{corner-z$l}...superness[center,corner]{z$$l-z$l} + ...{z$$l-corner}z$$l enddef; + +vardef pulled_super_arc.r(suffix $,$$)(expr superpull) = + pair center,corner; + if y$=y$r: center=(x$$r,y$r); corner=(x$r,y$$r); + else: center=(x$r,y$$r); corner=(x$$r,y$r); fi + z$r{corner-z$r}...superness[center,corner]{z$$r-z$r} + ...{z$$r-corner}z$$r enddef; + +vardef pulled_super_arc.l(suffix $,$$)(expr superpull) = + pair center,corner,outer_point; + if y$=y$r: center=(x$$l,y$l); corner=(x$l,y$$l); + outer_point=superness[(x$$r,y$r),(x$r,y$$r)]; + else: center=(x$l,y$$l); corner=(x$$l,y$l); + outer_point=superness[(x$r,y$$r),(x$$r,y$r)]; fi + z$l{corner-z$l} + ...superpull[superness[center,corner],outer_point]{z$$l-z$l} + ...{z$$l-corner}z$$l enddef; + +vardef pulled_arc@#(suffix $,$$) = + pulled_super_arc@#($,$$)(superpull) enddef; + +vardef serif_arc(suffix $,$$) = + z${x$$-x$,0}...(.75[x$,x$$],.25[y$,y$$]){z$$-z$}...{0,y$$-y$}z$$ enddef; + +vardef penpos@#(expr b,d) = + if known b: if b<=0: errmessage "bad penpos"; fi fi + (x@#r-x@#l,y@#r-y@#l)=(b,0) rotated d; + x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef; + +newinternal currentbreadth; +vardef pos@#(expr b,d) = + if known b: if b<=currentbreadth: errmessage "bad pos"; fi fi + (x@#r-x@#l,y@#r-y@#l)=(b-currentbreadth,0) rotated d; + x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef; +def numeric_pickup_ primary q = + currentpen:=pen_[q]; + pen_lft:=pen_lft_[q]; pen_rt:=pen_rt_[q]; + pen_top:=pen_top_[q]; pen_bot:=pen_bot_[q]; + currentpen_path:=pen_path_[q]; + if known breadth_[q]: currentbreadth:=breadth_[q]; fi enddef; + +vardef ic# = charic enddef; +vardef h# = charht enddef; +vardef w# = charwd enddef; +vardef d# = chardp enddef; + +let {{=begingroup; let }}=endgroup; +def .... = .. tension atleast .9 .. enddef; +def less_tense = save ...; let ...=.... enddef; +def ?? = hide(showvariable x,y) enddef; + +let semi_ =;; let colon_ = :; let endchar_ = endchar; +def iff expr b = if b:let next_=use_it else:let next_=lose_it fi; next_ enddef; +def use_it = let : = restore_colon; enddef; +def restore_colon = let : = colon_; enddef; +def lose_it = let endchar=fi; inner cmchar; let ;=fix_ semi_ if false enddef; +def fix_=let ;=semi_; let endchar=endchar_; outer cmchar; enddef; +def always_iff = let : = endgroup; killboolean enddef; +def killboolean text t = use_it enddef; +outer cmchar; diff --git a/mi2mu/mudela-item.cc b/mi2mu/mudela-item.cc index caf499ee43..ff189fec01 100644 --- a/mi2mu/mudela-item.cc +++ b/mi2mu/mudela-item.cc @@ -199,6 +199,7 @@ Mudela_note::str () return name_str + Duration_convert::dur2_str (dur) + " "; String str; + //ugh if (dur.plet_b ()) str += String ("\\[") diff --git a/mi2mu/mudela-staff.cc b/mi2mu/mudela-staff.cc index 5b326d966d..3c92577895 100644 --- a/mi2mu/mudela-staff.cc +++ b/mi2mu/mudela-staff.cc @@ -101,7 +101,7 @@ Mudela_staff::name_str() void Mudela_staff::output (Mudela_stream& mudela_stream_r) { - mudela_stream_r << id_str() << " = \\melodic"; + mudela_stream_r << id_str() << " = \\notes"; mudela_stream_r << (mudela_voice_p_list_.size() > 1 ? "<" : "{"); mudela_stream_r << '\n'; mudela_stream_r << _ ("% midi copyright:") << copyright_str_ << '\n'; diff --git a/mutopia/D.Scarlatti/GNUmakefile b/mutopia/D.Scarlatti/GNUmakefile new file mode 100644 index 0000000000..2d7fc58cf0 --- /dev/null +++ b/mutopia/D.Scarlatti/GNUmakefile @@ -0,0 +1,10 @@ +# + +depth = ../.. + +examples= +LOCALSTEPMAKE_TEMPLATES=mutopia + +include $(depth)/make/stepmake.make + + diff --git a/mutopia/GNUmakefile b/mutopia/GNUmakefile index 6e12e84c64..ef9ffc6a94 100644 --- a/mutopia/GNUmakefile +++ b/mutopia/GNUmakefile @@ -2,7 +2,7 @@ depth = .. -SUBDIRS = J.S.Bach Coriolan W.A.Mozart F.Schubert D.Zipoli Hymns +SUBDIRS = J.S.Bach Coriolan W.A.Mozart F.Schubert D.Zipoli Hymns D.Scarlatti examples= gallina LOCALSTEPMAKE_TEMPLATES=mutopia diff --git a/mutopia/J.S.Bach/wtk1-fugue1.ly b/mutopia/J.S.Bach/wtk1-fugue1.ly index 080cdef021..229e4165cd 100644 --- a/mutopia/J.S.Bach/wtk1-fugue1.ly +++ b/mutopia/J.S.Bach/wtk1-fugue1.ly @@ -18,13 +18,16 @@ global = \notes { \time 4/4; % should be \time C } - + + +beamkludge = \property Voice. stemLeftBeamCount = "1" + tenor = \notes \relative c' { \clef "violin"; \stemdown - r8 [c8 d e] [f. g32 f] [e8 a] | + r8 [c8 d e] [f. \beamkludge g32 f] [e8 a] | [d, g] ~ [g16 a g f] [e f e d] [c d c b ] | [a 8 fis'] g4 ~ [g8 fis16 e] [f8 d] | [g f! e d] c r r g' ~ | @@ -33,20 +36,20 @@ tenor = [c8 f] r16 [g f e] [f8 d] g4 ~ | g4 r4 r2 | r1 | - r8 [g8 a b] [c . d 32 c ] [b8 e ] + r8 [g8 a b] [c . \beamkludge d 32 c ] [b8 e ] %% 10 [a, d ] ~ [d 16 e d c ] b8 r8 r d, | - [e fis] [g. a32 g] [fis8 b e, a] ~ | + [e fis] [g. \beamkludge a32 g] [fis8 b e, a] ~ | [a16 b a gis] [fis8 f!] [e d] ~ [d16 e fis gis] | [a gis a b] [gis fis gis a] b8 r8 r4 | - r8 [c,8 d e] \stemup [f. g32 f] [e8 a] | + r8 [c,8 d e] \stemup [f. \beamkludge g32 f] [e8 a] | %% 15 [d, g] ~ [g16 a g f] e8 \stemdown [e fis g] ~ | [g8 fis] [gis8 a] ~ [a g! a b] | \stemboth - [c . d 32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] | + [c . \beamkludge d32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] | [b8 g' cis, d ] [e cis d e ] | - \stemdown a,8 r8 r e [fis g] \stemboth [a. b32 a] | + \stemdown a,8 r8 r e [fis g] \stemboth [a. \beamkludge b32 a] | %% 20 [g8 c fis, b] ~ [b16 c b a] \stemdown [g fis e d] \stemboth | e4 \stemdown d ~ [d16 a' g f!] [e g f! a] | @@ -54,7 +57,7 @@ tenor = \stemboth g4. f8 ~ [f e] d4 | \stemdown e8 a4 g8 ~ [g8 f g a] | %% 25 - [bes8. c 32 b] [a8 d ] [g, c ] ~ [c 16 d c bes] | + [bes8. \beamkludge c32 b] [a8 d ] [g, c ] ~ [c 16 d c bes] | [a bes a g] [f g f e] d4 ~ [d8. g16] | a4 r16 [f' 16 d 8] e 2 | } @@ -66,12 +69,12 @@ soprane = \stemup r1 | r2 r8 [g'8 a b] | - [c . d 32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] | + [c . \beamkludge d32 c ] [b8 e ] [a, d ] ~ [d 16 e d c ] | [b g a b] [c b c d ] [e d e fis ] [g 8 b,] | %% 5 [c a] [d 16 c b a] [g8. g16] [f e f g] | [a g a b] c 2 b4 | - r8 [c8 d e] [f. g32 f] [e8 a] | + r8 [c8 d e] [f. \beamkludge g32 f] [e8 a] | [d, g] ~ [g16 a g f] [e8 a] ~ [a16 b a g] | f2 [e8. fis16] g4 ~ %% 10 @@ -82,19 +85,19 @@ soprane = a 4 r4 r2 | %% 15 r2 r8 [g 8 a b ] | - [c8. d32 c] [b 8 c] [d e] [f!. g32 f!] | + [c8. \beamkludge d32 c] [b 8 c] [d e] [f!. \beamkludge g32 f!] | [e8 a d, g] ~ [g16 a g f] [e8 a] | - [d,8 bes'] [a g16 f] [g f g e] [f g g f32 g] | + [d,8 bes'] [a g16 f] [g f g e] [f g g \beamkludge f32 g] | [a16 cis, d g] [e8. d16] d8 r8 r4 | %% 20 r2 r4 r8 g, | - [a b ] [c. d32 c] [b 8 e a, d] ~ | + [a b ] [c. \beamkludge d32 c] [b 8 e a, d] ~ | [e16 e d c] [b c d e] [f g a g] [f e d c] | b 4 [c,8 d] g c4 b 8 | c4 [b 8 bes 8] a d4 c8 | %% 25 [d8 e] f4 ~ [f16 a g f] [e f e d] | - c2 r16 [g 32 a b !16 c] [d e f8] ~ | + c2 r16 [g32 a b !16 c] [d e f8] ~ | [f32 c d e f16 g] [a8. b16] | } @@ -107,31 +110,31 @@ alt = r1 | r | r | - r8 [g'8 a b] [c . d 32 c ] [b8 e ] | + r8 [g'8 a b] [c . \beamkludge d32 c ] [b8 e ] | %% 5 [a, d ] ~ [d 16 e d c ] [b8 c ~ c bes8] | [a d g, c ] r16 [a16 b c ] d 4 | - g,4 r8 g8 [a b] [c . d 32 c ] | + g,4 r8 g8 [a b] [c . \beamkludge d32 c ] | [b8 e a, d ] ~ [d 16 e d c !] [b!8 e ] ~ | e 4 d 4 [c 16 b c a] [e' d c b] | %% 10 [c 16 a b c ] [d c b a] g4 r4 | r1 | - r8 [e8 fis gis] [a. b32 a] [gis8 c ] | + r8 [e8 fis gis] [a. \beamkludge b32 a] [gis8 c ] | [fis, b] ~ [b16 c b a] gis8 a4 gis8 | - a4 r8 g8 [a b] c . [d 32 c ] | + a4 r8 g8 [a b] c . [d32 c ] | %% 15 [b8 e a, d ] ~ [d' g,] d 4 | [c 8 a] e' 4 d 8 r8 r4 | - r8 [a8 b cis ] [d . e 32 d ] [c !8 f ] | + r8 [a8 b cis ] [d . \beamkludge e32 d ] [c !8 f ] | [b,8 e ] ~ [e 16 f e d ] cis 8 r8 r4 | - r8 [a8 b cis ] [d . e 32 d ] [c !8 fis ] | + r8 [a8 b cis ] [d . \beamkludge e32 d ] [c !8 fis ] | %% 20 [b, e ] ~ [e 16 fis e d ] c 2 ~ | [c 16 d c b] [a g a fis] [g8 b c d ] | - [e . f 32 e ] [d 8 g ] [c, f ] ~ [f 16 g f e ] | + [e . \beamkludge f32 e ] [d 8 g ] [c, f ] ~ [f 16 g f e ] | d 4 [e 8 d ] ~ [d g,] g4 ~ - [g8 c, d e] [f. g32 f] [e8 a] | + [g8 c, d e] [f. \beamkludge g32 f] [e8 a] | %% 25 [d, g] ~ [g16 a g f] [e d e f] [g a bes g] | [a e f g] [a b c a] b2 | @@ -150,21 +153,21 @@ bass = r | %% 5 r2 r8 [c8 d e] | - [f. g32 f] [e8 a] [d, g] ~ [g16 a g f] | + [f. \beamkludge g32 f] [e8 a] [d, g] ~ [g16 a g f] | [e f e d] [c d c b ] [a' 8 d a fis] | [g16 a bes g] [cis,8 d] a'4 e4 | [a16 b c d ] [c b a g] c 8 r8 r4 | %% 10 r2 r8 [g, 8 a b ] | - [c. d32 c] [b 8 e] [a, d] ~ [d16 e d c] | + [c. \beamkludge d32 c] [b 8 e] [a, d] ~ [d16 e d c] | b 8 e4 d8 c f!4 e8 ~ | e d4 e8 [f! e16 d] e4 | a, 4 r4 r2 | %% 15 - r8 [g 8 a b ] [c. d32 c] [b 8 e] | + r8 [g 8 a b ] [c. \beamkludge d32 c] [b 8 e] | [a, 8 d] ~ [d16 e d c] [b 8 bes a g'' ] | [a,, 8 fis' g e] d4 [e8 f!] | - [g8. a32 g] [f8 bes] [e, a] ~ [a16 bes a g] | + [g8. \beamkludge a32 g] [f8 bes] [e, a] ~ [a16 bes a g] | [f e f d] [g8 a] d,2 ~ | %% 20 [d16 e d c] [b a g fis ] [e' 8 e fis g] ~ | @@ -195,7 +198,7 @@ bass = \paper{ gourlay_maxmeasures =5.; - castingalgorithme = \Wordwrap + castingalgorithme = \Wordwrap; } % \midi { \tempo 4 = 84; } } diff --git a/mutopia/J.S.Bach/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index 00b857b638..3c31452ff7 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -27,7 +27,8 @@ global = \notes { dux = \notes \relative c'' { \clef violin; - \stemdown + \property Voice.ydirection = "-1" + r8 [c16 b] [c8 g] [as c16 b] [c8 d ] | [g, c16 b] [c8 d ] [f,16 g] as4 [g16 f] | [es c' b a] [g f! es d] [c8 es' d c ] | diff --git a/scm/lily.scm b/scm/lily.scm index 2085fe20f9..2b7c61bb46 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -78,9 +78,6 @@ (define (settypewriter s) (text "typewriter" s)) (define (setnumber s) (text "number" s)) (define (setbold s) (text "bold" s)) -(define (setlarge s) (text "large" s)) -(define (setLarge s) (text "Large" s)) -(define (setmark s) (text "mark" s)) (define (setfinger s) (text "finger" s)) (define (setitalic s) (text "italic" s)) (define (setnumber-1 s) (text "numberj" s)) @@ -159,7 +156,9 @@ (define (invoke-dim1 s d) (string-append "\n\\" s "{" (number->dim d) "}")) - + (define (pt->sp x) + (* 65536 x)) + ;; ;; need to do something to make this really safe. ;; @@ -174,7 +173,7 @@ (define (number->dim x) (string-append - (number->string (chop-decimal x)) "pt ")) + (number->string (chop-decimal x)) "pt ")) (define (placebox x y s) (string-append diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index b051fef3d5..7c36e368e6 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -14,7 +14,7 @@ Output: DVI file """ name = 'ly2dvi' -version = '0.0.7' +version = '0.0.9' errorlog = '' import sys @@ -370,7 +370,7 @@ class Properties: # init Initial default values # file The values found in the lilypond generated TeX files # environment Envrionment variables LILYINCLUDE, LILYPONDPREFIX - # rcfile $LILYPONDPREFIX/share/lilypond/.lilyrc + # rcfile $LILYPONDPREFIX/.lilyrc # rcfile $HOME/.lilyrc # rcfile ./.lilyrc # commandline command line arguments @@ -424,7 +424,7 @@ class Properties: p=os.path.split(p[0]) # bit silly. for ly2dvi, overrules compiled-in datadir... # how to do this better (without running lily, of course? - this.setRoot(p[0] + '/share/lilypond', 'init') + this.setRoot(os.path.join(p[0],'share','lilypond'), 'init') if not os.environ.has_key('HOME'): if os.environ.has_key('HOMEDRIVE') and \ @@ -445,15 +445,15 @@ class Properties: t='' if os.environ.has_key ('TEXINPUTS'): - t = os.pathsep + os.environ['TEXINPUTS'] - os.environ['TEXINPUTS'] = os.path.join(this.get('root'), 'share', - 'lilypond', 'tex' ) + t + t = os.environ['TEXINPUTS'] + os.pathsep + os.environ['TEXINPUTS'] = t + \ + os.path.join(this.get('root'), 'tex' ) + \ + os.pathsep + os.path.join(this.get('root'), 'ps' ) t='' if os.environ.has_key ('MFINPUTS'): - t = os.pathsep + os.environ['MFINPUTS'] - os.environ['MFINPUTS'] = os.path.join(this.get('root'), 'share', - 'lilypond', 'mf' ) + t + t = os.environ['MFINPUTS'] + os.pathsep + os.environ['MFINPUTS'] = t + os.path.join(this.get('root'), 'mf' ) if os.environ.has_key('TMP'): this.__set('tmp',os.environ['TMP'],'environment') @@ -507,8 +507,7 @@ class Properties: """ if os.name == 'nt': - path = os.path.join(this.get('root'), 'share', 'lilypond', - 'tex', var) + path = os.path.join(this.get('root'), 'tex', var) else: path ='' cmd =('kpsewhich tex %s %s' % (var,errorlog)) @@ -516,8 +515,7 @@ class Properties: path = pipe.readline ()[:-1] # chop off \n return_status = pipe.close() if return_status and not path: - path = os.path.join(this.get('root'), 'share', 'lilypond', - 'tex', var) + path = os.path.join(this.get('root'), 'tex', var) fd = open(path, 'r') return fd @@ -556,7 +554,7 @@ class Properties: else: # Windows apps like edit choke on .lilyrc dotFilename='_lilyrc' - for d in [os.path.join(this.get('root'),'share','lilypond','ly'), \ + for d in [os.path.join(this.get('root'),'ly'), \ os.environ['HOME'], os.curdir ]: file=os.path.join(d,dotFilename) try: diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 01156c40ec..a828ed9907 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -1,3 +1,7 @@ +dnl WARNING WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 +dnl WARNING WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 dnl aclocal.m4 -*-shell-script-*- dnl StepMake subroutines for configure.in @@ -143,13 +147,13 @@ AC_DEFUN(AC_STEPMAKE_END, [ AC_DEFUN(AC_STEPMAKE_GXX, [ # ugh autoconf changequote(<<, >>)dnl - if $CXX --version | grep '2\.[78]' > /dev/null || + if $CXX --version | grep '2\.8' > /dev/null || $CXX --version | grep 'egcs' > /dev/null changequote([, ])dnl then true else - AC_STEPMAKE_WARN(can\'t find g++ 2.7, 2.8 or egcs) + AC_STEPMAKE_WARN(can\'t find g++ 2.8 or egcs) fi ]) @@ -158,17 +162,19 @@ AC_DEFUN(AC_STEPMAKE_GUILE, [ # others need readline, dl (or even more) # urg, must check for different functions in libguile # to force new check iso reading from cache - AC_CHECK_LIB(guile, scm_shell, \ + + # gh_scm2doubles,gh_doubles2scm are new in 1.3 + AC_CHECK_LIB(guile, gh_scm2doubles, \ LIBS="-lguile $LIBS"; AC_DEFINE(HAVE_LIBGUILE), \ AC_CHECK_LIB(readline, readline) \ AC_CHECK_LIB(dl, dlopen) \ AC_CHECK_LIB(socket, socket)\ AC_CHECK_LIB(termcap,tgetent)\ AC_CHECK_LIB(m, fabs)\ - AC_CHECK_LIB(guile, scm_boot_guile)\ + AC_CHECK_LIB(guile, gh_doubles2scm)\ ) - if test "$ac_cv_lib_guile_scm_shell" != yes -a \ - "$ac_cv_lib_guile_scm_boot_guile" != yes ; then + if test "$ac_cv_lib_guile_gh_scm2doubles" != yes -a \ + "$ac_cv_lib_guile_gh_doubles2scm" != yes ; then AC_STEPMAKE_WARN(You should install guile 1.3 or newer) fi ]) diff --git a/stepmake/bin/package-zip32.sh b/stepmake/bin/package-zip32.sh index 45574a1824..c766cab549 100644 --- a/stepmake/bin/package-zip32.sh +++ b/stepmake/bin/package-zip32.sh @@ -63,7 +63,7 @@ fi # # Post install clean up # -CYGWIN_LIB=$PACKAGE_ROOTDIR/distfiles/winnt/cygwinb19.dll +CYGWIN_LIB=$PACKAGE_ROOTDIR/distfiles/winnt/cygwin1.dll if [ ! -e $CYGWIN_LIB ]; then echo "Unable to locate $CYGWIN_LIB" exit 1 diff --git a/stepmake/stepmake/generic-targets.make b/stepmake/stepmake/generic-targets.make index 193830eee0..c66a7aa4bc 100644 --- a/stepmake/stepmake/generic-targets.make +++ b/stepmake/stepmake/generic-targets.make @@ -135,7 +135,7 @@ $(outdir)/version.hh: $(outdir)/VERSION # should this be in Rules? configure: configure.in aclocal.m4 - autoconf - < $<> $@ + autoconf chmod +x configure localclean: -- 2.39.5