From d17b945a4ae856383278837ce86ceefc3335756a Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:05:17 +0000 Subject: [PATCH] lilypond-0.1.43 --- Documentation/AUTHORS.pod | 11 +- Documentation/INSTALL.pod | 4 +- Documentation/Makefile | 8 +- Documentation/Rules.make | 8 +- Documentation/index.pod | 12 +- Documentation/links.pod | 12 +- NEWS | 23 + TODO | 6 +- VERSION | 2 +- bin/clean-fonts.sh | 4 - bin/conflily.sh | 2 +- bin/make-patch.py | 2 +- bin/make-website.py | 88 +-- configure | 10 +- configure.in | 10 +- flower/NEWS | 4 +- flower/VERSION | 2 +- flower/cpu-timer.cc | 6 + flower/libc-extension.cc | 15 +- init/paper11.ly | 1 + init/paper13.ly | 1 + init/paper16.ly | 1 + init/paper20.ly | 1 + init/paper26.ly | 1 + input/Makefile | 2 +- input/TODO | 5 + input/denneboom.ly | 68 +++ lib/binary-source-file.cc | 42 +- lib/duration-convert.cc | 188 +++---- lib/duration.cc | 30 +- lib/includable-lexer.cc | 52 +- lib/include/binary-source-file.hh | 8 +- lib/include/duration-convert.hh | 54 +- lib/include/duration.hh | 16 +- lib/include/file-storage.hh | 43 +- lib/include/includable-lexer.hh | 20 +- lib/include/input.hh | 16 +- lib/include/mapped-file-storage.hh | 40 ++ lib/include/moment.hh | 2 +- lib/include/plet.hh | 6 +- lib/include/simple-file-storage.hh | 31 ++ lib/include/source-file.hh | 32 +- lib/include/source.hh | 18 +- lib/include/warn.hh | 4 +- ...indhoos-suck-suck-suck-thank-you-cygnus.hh | 6 +- lib/input.cc | 28 +- lib/mapped-file-storage.cc | 80 ++- lib/moment.cc | 4 +- lib/plet.cc | 8 +- lib/simple-file-storage.cc | 28 +- lib/source-file.cc | 72 +-- lib/source.cc | 26 +- lib/template.cc | 4 +- lib/warn.cc | 12 +- ...indhoos-suck-suck-suck-thank-you-cygnus.cc | 28 +- lily/VERSION | 2 +- lily/break.cc | 78 +-- lily/debug.cc | 3 - lily/gourlay-breaking.cc | 50 +- lily/include/break.hh | 8 +- lily/include/main.hh | 1 + lily/include/paper-def.hh | 35 +- lily/include/plet-spanner.hh | 6 +- lily/include/stem.hh | 3 +- lily/include/translator.hh | 13 +- lily/lexer.l | 1 + lily/main.cc | 23 +- lily/my-lily-lexer.cc | 1 + lily/paper-def.cc | 17 +- lily/parser.y | 32 +- lily/plet-engraver.cc | 3 +- lily/plet-spanner.cc | 34 +- lily/rest-collision.cc | 2 +- lily/stem-info.cc | 4 +- lily/stem.cc | 7 +- lily/translator-ctors.cc | 22 + lily/translator.cc | 24 +- lily/word-wrap.cc | 6 +- make/Makefile | 2 +- make/Rules.make | 2 +- make/Toplevel.make.in | 10 +- make/lelievijver.lsm | 8 +- make/lilypond.lsm | 8 +- make/lilypond.spec | 8 +- mudela-mode.el | 2 +- mutopia/J.S.Bach/Makefile | 23 + mutopia/J.S.Bach/scsii-menuetto.ly | 174 ++++++ mutopia/J.S.Bach/scsii-menuetto.tex | 19 + mutopia/J.S.Bach/wtk1-fugue1.ly | 207 +++++++ mutopia/J.S.Bach/wtk1-fugue2.ly | 191 +++++++ mutopia/J.S.Bach/wtk1-prelude1.ly | 184 +++++++ mutopia/J.S.Bach/wtk1-prelude2.ly.m4 | 88 +++ mutopia/Makefile | 21 + mutopia/TODO | 3 + mutopia/gallina.ly | 241 +++++++++ mutopia/gallina.tex | 24 + mutopia/standchen-16.ly | 14 + mutopia/standchen-16.tex | 18 + mutopia/standchen-20.ly | 14 + mutopia/standchen-20.tex | 22 + mutopia/standchen.ly | 508 ++++++++++++++++++ mutopia/standje.ly | 235 ++++++++ tex/lily-ps-defs.tex | 15 +- 103 files changed, 2947 insertions(+), 676 deletions(-) create mode 100644 input/TODO create mode 100644 input/denneboom.ly create mode 100644 lib/include/mapped-file-storage.hh create mode 100644 lib/include/simple-file-storage.hh create mode 100644 mutopia/J.S.Bach/Makefile create mode 100644 mutopia/J.S.Bach/scsii-menuetto.ly create mode 100644 mutopia/J.S.Bach/scsii-menuetto.tex create mode 100644 mutopia/J.S.Bach/wtk1-fugue1.ly create mode 100644 mutopia/J.S.Bach/wtk1-fugue2.ly create mode 100644 mutopia/J.S.Bach/wtk1-prelude1.ly create mode 100644 mutopia/J.S.Bach/wtk1-prelude2.ly.m4 create mode 100644 mutopia/Makefile create mode 100644 mutopia/TODO create mode 100644 mutopia/gallina.ly create mode 100644 mutopia/gallina.tex create mode 100644 mutopia/standchen-16.ly create mode 100644 mutopia/standchen-16.tex create mode 100644 mutopia/standchen-20.ly create mode 100644 mutopia/standchen-20.tex create mode 100644 mutopia/standchen.ly create mode 100644 mutopia/standje.ly diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod index e922f5c3d3..ef6370c88a 100644 --- a/Documentation/AUTHORS.pod +++ b/Documentation/AUTHORS.pod @@ -10,9 +10,7 @@ This file lists authors of GNU LilyPond, and what they wrote. =over 4 -=item * - -Han-Wen Nienhuys , http://www.stack.nl/~hanwen +=item * Han-Wen Nienhuys , http://www.stack.nl/~hanwen Main author. @@ -26,11 +24,10 @@ Main author =over 4 -=item * +=item * Mats Bengtsson , -Mats Bengtsson , parts of clef-reg.cc, clef-item.cc -swedish notenames, testing, general comments, duration -logs/longa/brevis etc +parts of clef-reg.cc, clef-item.cc swedish notenames, testing, general +comments, duration logs/longa/brevis etc =item * Jan Arne Fagertun , diff --git a/Documentation/INSTALL.pod b/Documentation/INSTALL.pod index bca2cc23f9..d724945a9a 100644 --- a/Documentation/INSTALL.pod +++ b/Documentation/INSTALL.pod @@ -24,8 +24,8 @@ For compilation you need. =item * -A GNU system: GNU LilyPond is known to run on these GNU systems: -Linux, FreeBSD, AIX, Digital Unix and Solaris. +A GNU system: GNU LilyPond is known to run on these GNU systems: Linux +(PPC, intel), FreeBSD, AIX, NeXTStep, Digital Unix and Solaris. If you have the Cygnus WINDOWS32 port of the GNU utils, it will even work in Windows NT/95, but we don't promise to support it. diff --git a/Documentation/Makefile b/Documentation/Makefile index 132c161c0b..48df92b09d 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -23,7 +23,7 @@ include ./Rules.make # DOCFILES = $(wildcard *.doc) OUTPODFILES = $(addprefix $(outdir)/,$(PODFILES)) -TEXTFILES = $(OUTPODFILES:.pod=.text) +TEXTFILES = $(OUTPODFILES:.pod=.txt) GROFFFILES = $(OUTPODFILES:.pod=.1) HTMLFILES = $(OUTPODFILES:.pod=.html) DVIFILES = $(addprefix $(outdir)/, $(DOCFILES:.doc=.dvi)) @@ -58,9 +58,9 @@ include $(depth)/make/Rules.make # localclean: - rm -f $(TEXTFILES) $(HTMLFILES) $(GROFFFILES) - rm -f $(outdir)/* # clean the make-website stuff - rm -f $(outdir)/docxx/* # clean the make-website stuff + rm -f `find $(outdir)` + + MAN1FILES = lilypond convert-mudela mi2mu mudela-book MAN1GROFF = $(addprefix $(outdir)/, $(addsuffix .1,$(MAN1FILES))) diff --git a/Documentation/Rules.make b/Documentation/Rules.make index eac8dfc8f2..88ab6fb34a 100644 --- a/Documentation/Rules.make +++ b/Documentation/Rules.make @@ -1,7 +1,7 @@ # special rules for the documentation section. # There are too many to add to the general rules -.SUFFIXES: .pod .text .1 .html +.SUFFIXES: .pod .txt .1 .html $(outdir)/%.gif: %.xpm @@ -18,10 +18,10 @@ $(outdir)/%.dvi: $(outdir)/%.mudtex $(outdir)/%.mudtex: %.doc $(binout)/mudela-book --outdir=$(outdir)/ --outname=$(notdir $@) $< -$(outdir)/%.text: $(outdir)/%.1 - groff -man -Tascii $< > $@ +$(outdir)/%.txt: $(outdir)/%.1 + troff -man -Tascii $< | grotty -b -u -o > $@ -$(depth)/%.text: $(outdir)/%.text +$(depth)/%.txt: $(outdir)/%.txt cp $< $@ do_pod2html=$(pod2html) $< diff --git a/Documentation/index.pod b/Documentation/index.pod index 595170662b..865b5e2dcf 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -29,12 +29,20 @@ and the ftp site. =head2 Examples - -examples of what LilyPond can do: MIDI, PS, .gif and input. +short examples of what LilyPond can do: MIDI, PS, .gif and input. + +examples of what LilyPond can do +with real music: MIDI, PS, .gif and input + + + =head2 NEWS! This is what the latest version brings: diff --git a/Documentation/links.pod b/Documentation/links.pod index 80757ffed3..5caa99294d 100644 --- a/Documentation/links.pod +++ b/Documentation/links.pod @@ -25,6 +25,10 @@ LilyPond sources. An enormous collection of music related URLs +=item http://www.ram.org/ramblings/philosophy/fmp.html + +Musings on free music, plus hints how to record your own (free) music. + =back =head2 Ftp @@ -88,9 +92,11 @@ mailing list have been setup: A moderated list for information on the GNU Music project, to subscribe: send mail with subject "subscribe" to -info-gnu-music-request@gnu.org. As this list is moderated, normal -people should ask to drl@gnu.org or hanwen@stack.nl to forward -announces instead of sending it to info-gnu-music@gnu.org +info-gnu-music-request@gnu.org. + +As this list is moderated, normal people should ask to drl@gnu.org or +hanwen@stack.nl to forward announces instead of sending it to +info-gnu-music@gnu.org =item help-gnu-music@gnu.org diff --git a/NEWS b/NEWS index a9c9c7c770..107512ee2d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,26 @@ +pl 43 + - bf: broken Plet_spanners + - more GNITting + - avoid some more global ctors, for NeXTstep + - some NeXTStep patches from tiggr + - don't do overstrike/bold chars in textfiles + +pl 42.jcn2 + - bit hesitating start of mutopia + - bf: don't try to typeset unterminated plet + - separately sticky plet durations: "c4 c4*2/3 c8 c4*1/1", ok Mats? + - denneboom.ly (half-baked version) + - indent and shape, see ^ + +pl 42.jcn1 + - bf: memmem revisited + - bf: ps: draw_plet vertical endings + - renamed stem_start to stem_begin + - bf: plet bracket placing on differently orientated stems + - more standje.ly and fixes +****** +jan 28 + pl 42 - ly2dvi 0.5 (JAF) - italian.ly (thanks, Paolo) diff --git a/TODO b/TODO index 3219d2897d..8f1ce7fa1d 100644 --- a/TODO +++ b/TODO @@ -31,8 +31,6 @@ grep for TODO and ugh/ugr * fix stdin input - * LILYSOURCEDIR - * documentation - info? - LaTeX? @@ -91,6 +89,8 @@ STUFF * GS: /undefined in draw_beam after XDVI magnification. + * Rational global static var. + PROJECTS * Unicode support? @@ -318,8 +318,6 @@ SMALLISH PROJECTS * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) - * parshape - * Flower types: - A decent scalar type - String hash diff --git a/VERSION b/VERSION index 5617d6b5ef..901ee9191c 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 -TOPLEVEL_PATCH_LEVEL = 42 +TOPLEVEL_PATCH_LEVEL = 43 TOPLEVEL_MY_PATCH_LEVEL = # use the above to send patches, always empty for released version: diff --git a/bin/clean-fonts.sh b/bin/clean-fonts.sh index fc72545334..202a873584 100644 --- a/bin/clean-fonts.sh +++ b/bin/clean-fonts.sh @@ -17,10 +17,6 @@ else TEXDIR=/var/ fi -#if [ -f $LILYPOND_SOURCEDIR/config.status ]; then -#TEXDIR=`awk -F % '/TEXPREFIX/ {print $3}' $LILYPOND_SOURCEDIR/config.status` - - # remove possibly stale .pk/.tfm files echo> /tmp/cleaning-font-dummy FILES=`find $TEXDIR -name "feta*$WHAT*tfm" -or -name "feta*$WHAT*pk"` diff --git a/bin/conflily.sh b/bin/conflily.sh index de2ce672f9..520af8b24c 100644 --- a/bin/conflily.sh +++ b/bin/conflily.sh @@ -27,7 +27,7 @@ ln -sf $lelie/current/mi2mu/out/mi2mu bin/out/mi2mu if [ "x$LILYINCLUDE" = "x" ]; then echo you should make add the following to your login script - echo "export LILYINCLUDE=$lelie/current/init" + echo "export LILYINCLUDE=$lelie/current/init:$lelie/current/input:$lelie/current/mutopia:$lelie/current/mutopia/j.s.bach" echo "export PATH=$PATH:$lelie/current/bin/out/" echo "export MFINPUTS=$MFINPUTS:$lelie/current/mf" fi diff --git a/bin/make-patch.py b/bin/make-patch.py index 360d5d70a4..207066d31a 100644 --- a/bin/make-patch.py +++ b/bin/make-patch.py @@ -99,7 +99,7 @@ def multiple_find(pats, dirnames): l = l + my_find(pats, d) return l -pats = ['*.lsm', 'configure', '*.text', 'lilypond.spec'] +pats = ['*.lsm', 'configure', '*.txt', 'lilypond.spec'] def remove_automatic(dirnames): files = [] files = files + multiple_find(pats, dirnames) diff --git a/bin/make-website.py b/bin/make-website.py index 8effeebe40..8604c5c892 100644 --- a/bin/make-website.py +++ b/bin/make-website.py @@ -41,7 +41,8 @@ lilyversion= '' def set_vars(): __main__.lilyversion = version_tuple_to_str(lilydirs.version_tuple()) os.environ["TEXINPUTS"] = os.environ["TEXINPUTS"] + ":%s/input/:" % depth; - os.environ["LILYINCLUDE"] = "%s/input/" % depth; + os.environ["LILYINCLUDE"] = "%s/input/:%s/mutopia/:%s/mutopia/J.S.Bach" \ + % ((depth, ) *3); os.environ["LILYTOP"] = depth; __main__.mailaddress= os.environ['MAILADDRESS'] pw = pwd.getpwuid (os.getuid()); @@ -52,7 +53,7 @@ backstr = '\n
Please take me back to the index\n\ of LilyPond -- The GNU Project Music typesetter\n\
\n\ This page was built using %s from lilypond-%s by

\n\ -


%s ><%s>
\n\ +

%s <%s>
\n\

' @@ -80,15 +81,8 @@ def my_system(cmds): base="lilypond/"; examples=["twinkle-pop", - "wtk1-fugue2", - "standchen-16", - "standchen-20", - "standje", - "wtk1-prelude1", "toccata-fuga-E", - "scsii-menuetto", "cadenza", - "gallina", "twinkle", "collisions", "font16", @@ -97,44 +91,29 @@ examples=["twinkle-pop", "rhythm", "multi"] +mutopia_examples = [ "wtk1-fugue2", + "standchen-16", + "standchen-20", + "standje", + "wtk1-prelude1", + "gallina", + "scsii-menuetto"] + + def gen_html(): print 'generating HTML' my_system (["make -kC .. html"]); -def gen_examples(): +def gen_examples(inputs): print 'generating examples:\n' - list = map(lambda x: 'out/%s.ps.gz out/%s.gif out/%s.ly.txt' % (x,x,x), examples) + list = map(lambda x: 'out/%s.ps.gz out/%s.gif out/%s.ly.txt' % (x,x,x), inputs) my_system (['make -C .. ' + join(' ', list)]) -texstuff = ["mudela-man", "mudela-course"] - -def gen_manuals(): - print 'generating TeX doco manuals' - list = open('tex_manuals.html', 'w') - list.write( "PostScript Manuals\n" - "

LilyPond manuals (in PostScript)

" - "
    \n") - todo='' - for stuff in texstuff: - todo = todo + ' out/' + stuff + '.ps.gz' - list.write("
  • %s.ps.gz" % (stuff, stuff)) - list.write('
') - list.close () - - my_system (['make -C .. ' + todo]) - -def file_exist_b(name): - try: - f = open(name) - except IOError: - return 0 - f.close () - return 1 -def gen_list(): - print "generating HTML list\n"; - list = open('example_output.html', 'w') +def gen_list(inputs, filename): + print "generating HTML list %s\n" % filename; + list = open(filename, 'w') list.write ('Rendered Examples\n' 'These example files are taken from the LilyPond distribution.\n' 'LilyPond currently only outputs TeX and MIDI. The pictures and\n' @@ -142,7 +121,7 @@ def gen_list(): 'graphics tools. The papersize used for these examples is A4. The GIF\n' 'files have been scaled to eliminate aliasing.\n'); - for ex in examples: + for ex in inputs: header = read_mudela_header(ex + '.ly.txt') def read_dict(s, default, h =header): try: @@ -177,6 +156,30 @@ def gen_list(): list.write( ""); list.close() +texstuff = ["mudela-man", "mudela-course"] + +def gen_manuals(): + print 'generating TeX doco manuals' + list = open('tex_manuals.html', 'w') + list.write( "PostScript Manuals\n" + "

LilyPond manuals (in PostScript)

" + "
    \n") + todo='' + for stuff in texstuff: + todo = todo + ' out/' + stuff + '.ps.gz' + list.write("
  • %s.ps.gz" % (stuff, stuff)) + list.write('
') + list.close () + + my_system (['make -C .. ' + todo]) + +def file_exist_b(name): + try: + f = open(name) + except IOError: + return 0 + f.close () + return 1 def copy_files(): print "copying files\n" @@ -257,8 +260,11 @@ def main(): set_vars(); gen_html(); copy_files(); - gen_examples(); - gen_list(); + gen_examples(examples); + gen_list(examples, 'examples_output.html'); + + gen_examples(mutopia_examples); + gen_list(mutopia_examples, 'mutopiaexamples_output.html'); gen_manuals(); #set_images(); edit_html(); diff --git a/configure b/configure index dc086365e8..eba42b2cda 100755 --- a/configure +++ b/configure @@ -22,15 +22,15 @@ ac_help="$ac_help ac_help="$ac_help enable-profiling compile with gprof support. Default: off" ac_help="$ac_help - mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)" + enable-mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)" ac_help="$ac_help - tex-prefix=DIR set the tex-directory to find TeX subdirectories. (default: PREFIX)" + enable-tex-prefix=DIR set the tex-directory to find TeX subdirectories. (default: PREFIX)" ac_help="$ac_help - tex-dir=DIR set the directory to put LilyPond TeX files in. " + enable-tex-dir=DIR set the directory to put LilyPond TeX files in. " ac_help="$ac_help - mf-dir=DIR set the directory to put LilyPond MetaFont files in. " + enable-mf-dir=DIR set the directory to put LilyPond MetaFont files in. " ac_help="$ac_help - out-dir set the directory for machine generated files. Default out or out-HOST" + enable-out-dir set the directory for machine generated files. Default out or out-HOST" # Initialize some variables set by options. # The variables have the same names as the options, with diff --git a/configure.in b/configure.in index a971abbae7..31fb726411 100644 --- a/configure.in +++ b/configure.in @@ -48,27 +48,27 @@ AC_ARG_ENABLE(profiling, [profile_b=$enableval]) AC_ARG_ENABLE(mingw-prefix, - [ mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)], + [ enable-mingw-prefix=DIR set the mingw32 directory (standalone windows32 exes)], [MINGWPREFIX=$enableval], [MINGWPREFIX=no]) AC_ARG_ENABLE(tex-prefix, - [ tex-prefix=DIR set the tex-directory to find TeX subdirectories. (default: PREFIX)], + [ enable-tex-prefix=DIR set the tex-directory to find TeX subdirectories. (default: PREFIX)], [TEXPREFIX=$enableval], [TEXPREFIX=auto] ) AC_ARG_ENABLE(tex-dir, - [ tex-dir=DIR set the directory to put LilyPond TeX files in. ], + [ enable-tex-dir=DIR set the directory to put LilyPond TeX files in. ], [TEXDIR=$enableval], [TEXDIR=auto] ) AC_ARG_ENABLE(mf-dir, - [ mf-dir=DIR set the directory to put LilyPond MetaFont files in. ], + [ enable-mf-dir=DIR set the directory to put LilyPond MetaFont files in. ], [MFDIR=$enableval], [MFDIR=auto]) AC_ARG_ENABLE(out-dir, - [ out-dir set the directory for machine generated files. Default out or out-HOST], + [ enable-out-dir set the directory for machine generated files. Default out or out-HOST], [OUTDIR_NAME=$enableval] []) diff --git a/flower/NEWS b/flower/NEWS index 0629855834..1e795d59c3 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,5 +1,5 @@ -pl 34.jcn2 - - memmem optimise +pl 36 + - memmem fix: bugfree and *really* conforming to /usr/include/string.h pl 35 - bf: libc-extension: memmem diff --git a/flower/VERSION b/flower/VERSION index fb9bbfb6d6..d31b273055 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 35 +PATCH_LEVEL = 36 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/cpu-timer.cc b/flower/cpu-timer.cc index e10985eee9..c838fe5cc9 100644 --- a/flower/cpu-timer.cc +++ b/flower/cpu-timer.cc @@ -8,6 +8,12 @@ #include "cpu-timer.hh" +// nextstep +#ifndef CLOCKS_PER_SEC +#define CLOCKS_PER_SEC CLK_TCK +#endif + + Cpu_timer::Cpu_timer () { restart (); diff --git a/flower/libc-extension.cc b/flower/libc-extension.cc index d8a9fcd6e4..a18ff61b47 100644 --- a/flower/libc-extension.cc +++ b/flower/libc-extension.cc @@ -43,8 +43,8 @@ strnupr (char* start_l, int n) Manual v1.15, but it is with /usr/include/string.h */ Byte * -memmem (Byte const *needle,int needle_len, - Byte const *haystack, int haystack_len) +memmem (Byte const *haystack, int haystack_len, + Byte const *needle,int needle_len) { Byte const * end_haystack = haystack + haystack_len - needle_len + 1; Byte const * end_needle = needle + needle_len ; @@ -56,16 +56,13 @@ memmem (Byte const *needle,int needle_len, Byte const *subneedle_l = needle; Byte const *subhaystack_l = haystack; while (subneedle_l < end_needle) - { - if (*subneedle_l++ != *subhaystack_l++) - { - haystack ++; - continue; - } - } + if (*subneedle_l++ != *subhaystack_l++) + goto next; // completed the needle. Gotcha. return (Byte *) haystack; + next: + haystack++; } return 0; } diff --git a/init/paper11.ly b/init/paper11.ly index 9eb5614a9f..2d943fd720 100644 --- a/init/paper11.ly +++ b/init/paper11.ly @@ -4,6 +4,7 @@ paper_eleven = \paper { linewidth = 15.0 \cm; + indent = 8.0\mm; rulethickness = 0.25\pt; barsize = 11.0 \pt; interline = 2.75\pt; diff --git a/init/paper13.ly b/init/paper13.ly index e693d20041..892953eb0c 100644 --- a/init/paper13.ly +++ b/init/paper13.ly @@ -4,6 +4,7 @@ paper_thirteen = \paper { linewidth = 15.0 \cm; + indent = 8.0\mm; rulethickness = 0.25\pt; barsize = 13.0 \pt; interline = 3.25\pt; diff --git a/init/paper16.ly b/init/paper16.ly index 06aa523fa2..ecca65ae45 100644 --- a/init/paper16.ly +++ b/init/paper16.ly @@ -13,6 +13,7 @@ paper sizes. %} paper_sixteen = \paper { linewidth = 15.5 \cm; + indent = 5.\mm; rulethickness = 0.4\pt; barsize = 16.0 \pt; interline = 4.\pt; diff --git a/init/paper20.ly b/init/paper20.ly index 8e30c48c1a..62322672de 100644 --- a/init/paper20.ly +++ b/init/paper20.ly @@ -4,6 +4,7 @@ paper_twenty = \paper { linewidth = 15.0 \cm; + indent = 10.\mm; rulethickness = 0.4\pt; barsize = 20.0 \pt; interline = 5.\pt; diff --git a/init/paper26.ly b/init/paper26.ly index 46511883c7..b092ccded2 100644 --- a/init/paper26.ly +++ b/init/paper26.ly @@ -4,6 +4,7 @@ paper_twentysix = \paper { linewidth = 15.0 \cm; + indent = 12.0\mm rulethickness = 0.5\pt; barsize = 26.0 \pt; interline = 6.5\pt; diff --git a/input/Makefile b/input/Makefile index 76a5363cbb..894dba5c00 100644 --- a/input/Makefile +++ b/input/Makefile @@ -16,6 +16,6 @@ include ./$(depth)/make/Include.make # LYFILES = $(wildcard *.ly) TEXFILES = $(wildcard *.tex) -DISTFILES = Makefile $(LYFILES) $(TEXFILES) $(wildcard *.m4) +DISTFILES = Makefile TODO $(LYFILES) $(TEXFILES) $(wildcard *.m4) # diff --git a/input/TODO b/input/TODO new file mode 100644 index 0000000000..94237dfc2d --- /dev/null +++ b/input/TODO @@ -0,0 +1,5 @@ + + - neaten/structure examples + + - rename/split into test/exapmles? + diff --git a/input/denneboom.ly b/input/denneboom.ly new file mode 100644 index 0000000000..1027b2af77 --- /dev/null +++ b/input/denneboom.ly @@ -0,0 +1,68 @@ +\header{ +filename = "denneboom.ly"; +enteredby = "jcn"; +copyright = "public domain"; +TestedFeatures = "This file tests silly line shapes"; +} + +\version "0.1.8"; + +boom = \lyric{ + \meter 1/4; + O4 den- ne- boom, o den- ne- boom. + Wat zijn uw tak- ken won- der- schoon + O den- ne- boom, o den- ne- boom. + Wat zijn uw tak- ken won- der- schoon + Ik heb u laatst in 't bos zien staan + toen zat- en er geen kaarsjes aan. + O, Den- ne- boom, o den- ne- boom. + Wat zijn uw tak- ken wonder- schoon + + O den- ne- boom, o den- ne- boom. + Wat zijn uw tak- ken won- der- schoon + O den- ne- boom, o den- ne- boom. + Wat zijn uw tak- ken won- der- schoon + U gloeit in bar- re winter- tijd, +% ugh +% als sneeuw op aar- de licht ge- spreid. +% O, Den- ne- boom, o den- ne- boom. +% Wat zijn uw tak- ken wonder- schoon +} + +ugh = \melodic{ + \octave c'; + \meter 1/4; + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e f | c d e f | + c d e f | c d e f | c d e +} + +\score{ +% < +% \type Lyrics \boom + \ugh +% > + \paper{ + \indent = 20. \mm; + \shape = 72.5 \mm 15. \mm + 65. \mm 30. \mm + 57.5 \mm 45. \mm + 50. \mm 60. \mm + 42.5 \mm 75. \mm + 35. \mm 90. \mm + 27.5 \mm 105. \mm + 20. \mm 120. \mm + 10. \mm 140. \mm + 0. \mm 160. \mm + 72.5 \mm 15. \mm +% 72.5 \mm 15. \mm + 60. \mm 40. \mm + ; + + gourlay_maxmeasures = 30.; + } +} diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index 111ee743e6..75d7ce24ca 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -17,47 +17,47 @@ #include "binary-source-file.hh" #include "string-convert.hh" -Binary_source_file::Binary_source_file(String& filename_str) - : Source_file(filename_str) +Binary_source_file::Binary_source_file (String& filename_str) + : Source_file (filename_str) { } -Binary_source_file::~Binary_source_file() +Binary_source_file::~Binary_source_file () { } String -Binary_source_file::error_str(char const* pos_ch_c_l) const +Binary_source_file::error_str (char const* pos_ch_c_l) const { - assert(this); - if (!in_b(pos_ch_c_l)) + assert (this); + if (!in_b (pos_ch_c_l)) return ""; - char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C(); - char const* end_ch_c_l = pos_ch_c_l + 7 ? ch_C (); + char const* end_ch_c_l = pos_ch_c_l + 7 Duration_convert::dur_array_s; String -Duration_convert::dur2_str(Duration dur) +Duration_convert::dur2_str (Duration dur) { if (dur.ticks_i_) - return String("[") + String(dur.ticks_i_) + "]"; + return String ("[") + String (dur.ticks_i_) + "]"; String str; if (dur.durlog_i_ >= 0) - str = String( type2_i(dur.durlog_i_) ); + str = String ( type2_i (dur.durlog_i_) ); else if (dur.durlog_i_ == -1) str = "\\breve"; else if (dur.durlog_i_ == -2) str = "\\longa"; - str += String('.', dur.dots_i_); - if (dur.plet_b()) - str += String("*") + String(dur.plet_.iso_i_) - + String("/") + String(dur.plet_.type_i_); + str += String ('.', dur.dots_i_); + if (dur.plet_b ()) + str += String ("*") + String (dur.plet_.iso_i_) + + String ("/") + String (dur.plet_.type_i_); return str; } #if 0 int -Duration_convert::dur2_i(Duration dur, int division_1_i) +Duration_convert::dur2_i (Duration dur, int division_1_i) { - return dur2_mom(dur) * Moment(division_1_i); + return dur2_mom (dur) * Moment (division_1_i); } #endif int -Duration_convert::dur2ticks_i(Duration dur) +Duration_convert::dur2ticks_i (Duration dur) { if (dur.ticks_i_) return dur.ticks_i_; - return dur2_mom(dur) * Moment(Duration::division_1_i_s); + return dur2_mom (dur) * Moment (Duration::division_1_i_s); } int -Duration_convert::i2_type(int i) +Duration_convert::i2_type (int i) { int t=0; while (!(i & 1)) { @@ -67,7 +67,7 @@ Duration_convert::i2_type(int i) } int -Duration_convert::type2_i(int type) +Duration_convert::type2_i (int type) { if (type<0) return 0; @@ -76,19 +76,19 @@ Duration_convert::type2_i(int type) } Moment -Duration_convert::dur2_mom(Duration dur) +Duration_convert::dur2_mom (Duration dur) { if (dur.ticks_i_) - return Moment(dur.ticks_i_, Duration::division_1_i_s); + return Moment (dur.ticks_i_, Duration::division_1_i_s); // or simply assert? if (dur.durlog_i_<-10) - return Moment(0); + return Moment (0); Moment mom; if (dur.durlog_i_<0) - mom = Moment(type2_i(-dur.durlog_i_), 1); + mom = Moment (type2_i (-dur.durlog_i_), 1); else - mom = Moment(1 , type2_i(dur.durlog_i_)); + mom = Moment (1 , type2_i (dur.durlog_i_)); Moment delta = mom; while (dur.dots_i_--) @@ -97,66 +97,66 @@ Duration_convert::dur2_mom(Duration dur) mom += delta; } - return mom * plet_factor_mom(dur); + return mom * plet_factor_mom (dur); } #if 0 Moment -Duration_convert::i2_mom(int time_i, int division_1_i) +Duration_convert::i2_mom (int time_i, int division_1_i) { if (!time_i) - return Moment(0); + return Moment (0); if (division_1_i > 0) - return Moment(time_i, division_1_i); + return Moment (time_i, division_1_i); else - return Moment(-division_1_i, time_i); + return Moment (-division_1_i, time_i); } #endif Duration -Duration_convert::mom2_dur(Moment mom) +Duration_convert::mom2_dur (Moment mom) { if (!mom) { Duration dur; - dur.set_plet(0,1); + dur.set_plet (0,1); return dur; } - Duration dur = mom2standardised_dur(mom); - // if (!dur.mom() || (dur.mom() == mom)) - if (!dur.length() || (dur.length() == mom)) + Duration dur = mom2standardised_dur (mom); + // if (!dur.mom () || (dur.mom () == mom)) + if (!dur.length () || (dur.length () == mom)) return dur; - assert(midi_as_plet_b_s); + assert (midi_as_plet_b_s); - // dur.set_plet(type_mom, Duration::division_1_i_s / 4); + // dur.set_plet (type_mom, Duration::division_1_i_s / 4); - // Moment as_plet_mom = mom / dur.mom(); - Moment as_plet_mom = mom / dur.length(); - as_plet_mom *= dur.plet_.mom(); - long num = as_plet_mom.numerator().as_long(); - long den = as_plet_mom.denominator().as_long(); - dur.set_plet(num, den); + // Moment as_plet_mom = mom / dur.mom (); + Moment as_plet_mom = mom / dur.length (); + as_plet_mom *= dur.plet_.mom (); + long num = as_plet_mom.numerator ().as_long (); + long den = as_plet_mom.denominator ().as_long (); + dur.set_plet (num, den); return dur; } Duration -Duration_convert::mom2standardised_dur(Moment mom) +Duration_convert::mom2standardised_dur (Moment mom) { - // if (!dur_array_s.length_i()) - if (!dur_array_s.size()) - set_array(); - assert(dur_array_s.size()); - for (int i = 0; i < dur_array_s.size() - 1; i++) + // if (!dur_array_s.length_i ()) + if (!dur_array_s.size ()) + set_array (); + assert (dur_array_s.size ()); + for (int i = 0; i < dur_array_s.size () - 1; i++) { - Moment lower_mom = dur2_mom(dur_array_s[ i ]); + Moment lower_mom = dur2_mom (dur_array_s[ i ]); if (mom <= lower_mom) { // all arbitrary, but 3/4 will get rid of the noise... // kinda ok - if (i || (mom / lower_mom > Moment(3, 4))) + if (i || (mom / lower_mom > Moment (3, 4))) return dur_array_s[ i ]; else { @@ -165,107 +165,107 @@ Duration_convert::mom2standardised_dur(Moment mom) return d; } } - Moment upper_mom = dur2_mom(dur_array_s[ i + 1 ]); + Moment upper_mom = dur2_mom (dur_array_s[ i + 1 ]); if ((mom < upper_mom) && ((mom - lower_mom) / lower_mom < (upper_mom - mom) / upper_mom)) return dur_array_s[ i ]; } - return dur_array_s[ dur_array_s.size() - 1 ]; + return dur_array_s[ dur_array_s.size () - 1 ]; } void -Duration_convert::set_array() +Duration_convert::set_array () { - dur_array_s.clear(); + dur_array_s.clear (); Duration_iterator iter_dur; - assert(iter_dur); + assert (iter_dur); while (iter_dur) - dur_array_s.push(iter_dur++); + dur_array_s.push (iter_dur++); } Moment -Duration_convert::plet_factor_mom(Duration dur) +Duration_convert::plet_factor_mom (Duration dur) { - return dur.plet_.mom(); + return dur.plet_.mom (); } Real -Duration_convert::sync_f(Duration dur, Moment mom) +Duration_convert::sync_f (Duration dur, Moment mom) { - return mom / dur2_mom(dur); + return mom / dur2_mom (dur); } Duration -Duration_convert::ticks2_dur(int ticks_i) +Duration_convert::ticks2_dur (int ticks_i) { - // Duration dur(4, 0); - // dur.set_plet(ticks_i, Duration::division_1_i_s / 4); + // Duration dur (4, 0); + // dur.set_plet (ticks_i, Duration::division_1_i_s / 4); - Moment mom(ticks_i, Duration::division_1_i_s); + Moment mom (ticks_i, Duration::division_1_i_s); if (midi_as_plet_b_s) - return mom2_dur(mom); + return mom2_dur (mom); - Duration dur = mom2standardised_dur(mom); + Duration dur = mom2standardised_dur (mom); - // if (dur.mom() == mom) - if (dur.length() == mom) + // if (dur.mom () == mom) + if (dur.length () == mom) return dur; // huh? #if 0 dur.durlog_i_ = -100; dur.dots_i_ = 0; - dur.set_ticks(ticks_i); + dur.set_ticks (ticks_i); return dur; #else - return mom2_dur(mom); + return mom2_dur (mom); #endif } Duration -Duration_convert::ticks2standardised_dur(int ticks_i) +Duration_convert::ticks2standardised_dur (int ticks_i) { - Moment mom(ticks_i, Duration::division_1_i_s); - Duration dur = mom2standardised_dur(mom); + Moment mom (ticks_i, Duration::division_1_i_s); + Duration dur = mom2standardised_dur (mom); return dur; } -Duration_iterator::Duration_iterator() +Duration_iterator::Duration_iterator () { cursor_dur_.durlog_i_ = 7; if (Duration_convert::no_smaller_than_i_s) cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; - // cursor_dur_.set_plet(1, 1); + // cursor_dur_.set_plet (1, 1); } Duration Duration_iterator::operator ++(int) { - return forward_dur(); + return forward_dur (); } Duration Duration_iterator::operator ()() { - return dur(); + return dur (); } -Duration_iterator::operator bool() +Duration_iterator::operator bool () { - return ok(); + return ok (); } Duration -Duration_iterator::dur() +Duration_iterator::dur () { return cursor_dur_; } Duration -Duration_iterator::forward_dur() +Duration_iterator::forward_dur () { /* should do smart table? guessing: duration wholes @@ -279,63 +279,63 @@ Duration_iterator::forward_dur() 8. 0.1875 */ - assert(ok()); + assert (ok ()); Duration dur = cursor_dur_; - if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b()) + if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b ()) { cursor_dur_.durlog_i_ += 1; cursor_dur_.dots_i_ = 2; } else if (cursor_dur_.dots_i_ == 2) { - assert(!cursor_dur_.plet_b()); + assert (!cursor_dur_.plet_b ()); cursor_dur_.dots_i_ = 0; cursor_dur_.durlog_i_ -=2; - cursor_dur_.set_plet(2, 3); + cursor_dur_.set_plet (2, 3); } - else if (cursor_dur_.plet_b() + else if (cursor_dur_.plet_b () && (cursor_dur_.plet_.iso_i_ == 2) && (cursor_dur_.plet_.type_i_ == 3)) { - assert(!cursor_dur_.dots_i_); - cursor_dur_.set_plet(1, 1); + assert (!cursor_dur_.dots_i_); + cursor_dur_.set_plet (1, 1); cursor_dur_.durlog_i_ += 1; cursor_dur_.dots_i_ = 1; } else if (cursor_dur_.dots_i_ == 1) { - assert(!cursor_dur_.plet_b()); + assert (!cursor_dur_.plet_b ()); cursor_dur_.dots_i_ = 0; cursor_dur_.durlog_i_ -= 1; } if (Duration_convert::no_triplets_b_s - && cursor_dur_.plet_b() && ok()) - forward_dur(); + && cursor_dur_.plet_b () && ok ()) + forward_dur (); if (Duration_convert::no_double_dots_b_s - && (cursor_dur_.dots_i_ == 2) && ok()) - forward_dur(); + && (cursor_dur_.dots_i_ == 2) && ok ()) + forward_dur (); if (Duration_convert::no_smaller_than_i_s - && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok()) - forward_dur(); + && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok ()) + forward_dur (); if (Duration_convert::no_smaller_than_i_s && cursor_dur_.dots_i_ && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s) - && ok()) - forward_dur(); + && ok ()) + forward_dur (); if (Duration_convert::no_smaller_than_i_s && (cursor_dur_.dots_i_ == 2) && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2) - && ok()) - forward_dur(); + && ok ()) + forward_dur (); return dur; } bool -Duration_iterator::ok() +Duration_iterator::ok () { return (cursor_dur_.durlog_i_ && !((cursor_dur_.durlog_i_ == 0) && (cursor_dur_.dots_i_ > 2))); diff --git a/lib/duration.cc b/lib/duration.cc index f04c5e42c0..eca46dd12b 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -21,7 +21,7 @@ int Duration::division_1_i_s = 384 * 4; -Duration::Duration() +Duration::Duration () { durlog_i_ = 0; dots_i_ = 0; @@ -29,53 +29,53 @@ Duration::Duration() } bool -Duration::duration_type_b(int t) +Duration::duration_type_b (int t) { /* ugh. Assuming behavior of conversion funcs on broken input. */ - return t == Duration_convert::type2_i(Duration_convert::i2_type(t)); + return t == Duration_convert::type2_i (Duration_convert::i2_type (t)); } // ugh, what's this? -// i should be called "mom()", ... or at least "length_mom()" +// i should be called "mom ()", ... or at least "length_mom ()" Moment -Duration::length() const +Duration::length () const { - return Duration_convert::dur2_mom(*this); + return Duration_convert::dur2_mom (*this); } void -Duration::set_plet(int i, int t) +Duration::set_plet (int i, int t) { plet_.iso_i_ = i; plet_.type_i_ = t; } void -Duration::set_plet(Duration d) +Duration::set_plet (Duration d) { plet_.iso_i_ = d.plet_.iso_i_; plet_.type_i_ = d.plet_.type_i_; } void -Duration::set_ticks(int ticks_i) +Duration::set_ticks (int ticks_i) { - assert(durlog_i_ <10); - assert(!dots_i_); + assert (durlog_i_ <10); + assert (!dots_i_); ticks_i_ = ticks_i; } String -Duration::str() const +Duration::str () const { - return Duration_convert::dur2_str(*this); + return Duration_convert::dur2_str (*this); } bool -Duration::plet_b() +Duration::plet_b () { - return !plet_.unit_b(); + return !plet_.unit_b (); } diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index ca103a9c9e..3728476203 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -13,7 +13,7 @@ #define YY_BUF_SIZE 16384 #endif -Includable_lexer::Includable_lexer() +Includable_lexer::Includable_lexer () { yy_current_buffer = 0; } @@ -21,22 +21,22 @@ Includable_lexer::Includable_lexer() /** set the new input to s, remember old file. */ void -Includable_lexer::new_input(String s, Sources * global_sources) +Includable_lexer::new_input (String s, Sources * global_sources) { - Source_file * sl = global_sources->get_file_l(s); + Source_file * sl = global_sources->get_file_l (s); if (!sl) { - String msg =_("Can't find file `") + s+ "'"; - LexerError(msg.ch_C ()); + String msg =_ ("Can't find file `") + s+ "'"; + LexerError (msg.ch_C ()); return; } - char_count_stack_.push(0); + char_count_stack_.push (0); if (yy_current_buffer) - state_stack_.push(yy_current_buffer); + state_stack_.push (yy_current_buffer); cout << "[" << s<istream_l(), YY_BUF_SIZE)); + yy_switch_to_buffer (yy_create_buffer (sl->istream_l (), YY_BUF_SIZE)); } /** pop the inputstack. conceptually this is a destructor, but it does not destruct the Source_file that Includable_lexer::new_input creates. */ bool -Includable_lexer::close_input() +Includable_lexer::close_input () { - include_stack_.pop(); - char_count_stack_.pop(); + include_stack_.pop (); + char_count_stack_.pop (); cout << "]"<ch_C() + char_count_stack_.top(); + return include_stack_.top ()->ch_C () + char_count_stack_.top (); } -Includable_lexer::~Includable_lexer() +Includable_lexer::~Includable_lexer () { - while (!include_stack_.empty()) + while (!include_stack_.empty ()) { - close_input(); + close_input (); } } /** @@ -89,16 +89,16 @@ Includable_lexer::~Includable_lexer() don't know about the location of the lexer. Add this as a YY_USER_ACTION */ void -Includable_lexer::add_lexed_char(int count) +Includable_lexer::add_lexed_char (int count) { - char_count_stack_.top() += count; + char_count_stack_.top () += count; } Source_file* -Includable_lexer::source_file_l() const +Includable_lexer::source_file_l () const { - if (include_stack_.empty()) + if (include_stack_.empty ()) return 0; else - return include_stack_.top(); + return include_stack_.top (); } diff --git a/lib/include/binary-source-file.hh b/lib/include/binary-source-file.hh index 9733c1b86b..33ee6bd784 100644 --- a/lib/include/binary-source-file.hh +++ b/lib/include/binary-source-file.hh @@ -10,11 +10,11 @@ class Binary_source_file : public Source_file { public: - Binary_source_file(String& filename_str ); - virtual ~Binary_source_file(); + Binary_source_file (String& filename_str ); + virtual ~Binary_source_file (); - virtual String error_str(char const* pos_ch_c_l ) const; - virtual int line_i(char const* pos_ch_c_l ) const; + virtual String error_str (char const* pos_ch_c_l ) const; + virtual int line_i (char const* pos_ch_c_l ) const; }; #endif // BINARY_SOURCE_FILE_HH // diff --git a/lib/include/duration-convert.hh b/lib/include/duration-convert.hh index 3f8bda96a4..e3926f030c 100644 --- a/lib/include/duration-convert.hh +++ b/lib/include/duration-convert.hh @@ -24,11 +24,11 @@ SUGGESTION: currently a moment in time is called moment too; let-s typedef Rational When too, so that we get - When Staff_column::when(), Moment Voice_element::mom(). + When Staff_column::when (), Moment Voice_element::mom (). [todo] move all statics to real members, instantiate Duration_convert - object(s). + object (s). */ struct Duration_convert { @@ -45,77 +45,77 @@ struct Duration_convert { // static int const division_1_c_i = 384; // /// Return (integer, division) representation. -// static int dur2_i(Duration dur, int division_1_i = division_1_c_i ); +// static int dur2_i (Duration dur, int division_1_i = division_1_c_i ); /// Return number of ticks in (ticks, division_1) representation - static int dur2ticks_i(Duration dur ); + static int dur2ticks_i (Duration dur ); /// Return the type_i representation of note length i - static int i2_type(int i); + static int i2_type (int i); /// Return the note length corresponding to the type_i representation /// Return 0 if longer than whole note. - static int type2_i(int type); + static int type2_i (int type); /// Return Moment representation (fraction of whole note). - static Moment dur2_mom(Duration dur ); + static Moment dur2_mom (Duration dur ); /// Return Mudela string representation. - static String dur2_str(Duration dur ); + static String dur2_str (Duration dur ); // /// Return Moment from (integer, division) representation. -// static Moment i2_mom(int i, int division_1_i = division_1_c_i ); +// static Moment i2_mom (int i, int division_1_i = division_1_c_i ); // /// Return Moment (fraction of whole) representation, best guess. -// static Duration mom2_dur(Moment mom ); +// static Duration mom2_dur (Moment mom ); /// Return duration from Moment (fraction of whole) representation. - static Duration mom2_dur(Moment mom ); + static Duration mom2_dur (Moment mom ); /// Return standardised duration, best guess if not exact. - static Duration mom2standardised_dur(Moment mom ); + static Duration mom2standardised_dur (Moment mom ); /// Return plet factor (not a Moment: should use Rational?). - static Moment plet_factor_mom(Duration dur ); + static Moment plet_factor_mom (Duration dur ); - static void set_array(); + static void set_array (); /** Return synchronisation factor for mom, so that - mom2_dur(mom / sync_f ) will return the duration dur. + mom2_dur (mom / sync_f ) will return the duration dur. */ - static Real sync_f(Duration dur, Moment mom ); + static Real sync_f (Duration dur, Moment mom ); /// Return exact duration, in midi-ticks if not-exact. - static Duration ticks2_dur(int ticks_i ); + static Duration ticks2_dur (int ticks_i ); /// Return standardised duration, best guess if not exact. - static Duration ticks2standardised_dur(int ticks_i ); + static Duration ticks2standardised_dur (int ticks_i ); }; /// (iter_dur) struct Duration_iterator { /// start at shortest: 128:2/3 - Duration_iterator(); + Duration_iterator (); // **** what about these three here ? - /// return forward_dur(); + /// return forward_dur (); Duration operator ++(int); - /// return ok() - operator bool(); + /// return ok () + operator bool (); - /// return dur() + /// return dur () Duration operator ()(); // **** /// return current dur - Duration dur(); + Duration dur (); - /// return dur(), step to next - Duration forward_dur(); + /// return dur (), step to next + Duration forward_dur (); /// durations left? - bool ok(); + bool ok (); private: Duration cursor_dur_; diff --git a/lib/include/duration.hh b/lib/include/duration.hh index 49d5819bd9..642701e8d5 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -28,15 +28,15 @@ struct Duration { /** Ctor of Duration. */ - Duration(); + Duration (); /// is the "plet factor" of this note != 1 ? - bool plet_b(); - String str() const; - void set_plet(int,int ); - void set_plet(Duration ); - static bool duration_type_b(int t); - void set_ticks(int ticks_i ); - Moment length() const ; // zo naai mij + bool plet_b (); + String str () const; + void set_plet (int,int ); + void set_plet (Duration ); + static bool duration_type_b (int t); + void set_ticks (int ticks_i ); + Moment length () const ; // zo naai mij static int division_1_i_s; /// Logarithm of the base duration. diff --git a/lib/include/file-storage.hh b/lib/include/file-storage.hh index 23da07e19f..1ac150f592 100644 --- a/lib/include/file-storage.hh +++ b/lib/include/file-storage.hh @@ -12,51 +12,16 @@ #include "proto.hh" + /** store a file in-memory. */ class File_storage { public: - virtual char const* ch_C() const=0; - virtual int length_i() const=0; - virtual ~File_storage(){} -}; - -/** - Use mmap to "copy" a file into memory - */ -class Mapped_file_storage:public File_storage -{ -public: - Mapped_file_storage(String); -protected: - virtual char const* ch_C() const; - virtual int length_i() const; - virtual ~Mapped_file_storage(); -private: - void open(String name); - void close(); - - void map(); - void unmap(); - int fildes_i_; - off_t size_off_; - caddr_t data_caddr_; + virtual char const* ch_C () const=0; + virtual int length_i () const=0; + virtual ~File_storage (){} }; -/** - read file char by char and copy into a malloc array. - */ -class Simple_file_storage : public File_storage -{ - char * data_p_; - int len_i_; -protected: - virtual char const*ch_C() const; - virtual int length_i() const; - virtual ~Simple_file_storage(); -public: - Simple_file_storage(String); -}; #endif // FILE_STORAGE_HH diff --git a/lib/include/includable-lexer.hh b/lib/include/includable-lexer.hh index fb1a96d0bc..f9dce9696d 100644 --- a/lib/include/includable-lexer.hh +++ b/lib/include/includable-lexer.hh @@ -24,19 +24,19 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; an yyFlexLexer child with provisions for inclusion. */ class Includable_lexer : public yyFlexLexer { - Array state_stack_; + Array state_stack_; protected: - bool close_input(); - Array include_stack_; - Array char_count_stack_; + bool close_input (); + Array include_stack_; + Array char_count_stack_; public: - Source_file* source_file_l() const; - void new_input(String s,Sources*); - Includable_lexer(); - ~Includable_lexer(); - void add_lexed_char(int); - char const * here_ch_C(); + Source_file* source_file_l () const; + void new_input (String s,Sources*); + Includable_lexer (); + ~Includable_lexer (); + void add_lexed_char (int); + char const * here_ch_C (); }; diff --git a/lib/include/input.hh b/lib/include/input.hh index 579f829c14..f82ba2d224 100644 --- a/lib/include/input.hh +++ b/lib/include/input.hh @@ -20,15 +20,15 @@ class Input { Source_file * source_file_l_; public: - void warning(String) const; // should use member func? - void error(String) const; - void message(String) const; - void set_spot(Input const &); + void warning (String) const; // should use member func? + void error (String) const; + void message (String) const; + void set_spot (Input const &); - String location_str() const; - Input(Source_file*, char const*); - Input(); - Input(Input const& ); + String location_str () const; + Input (Source_file*, char const*); + Input (); + Input (Input const& ); }; #endif // INPUT_HH diff --git a/lib/include/mapped-file-storage.hh b/lib/include/mapped-file-storage.hh new file mode 100644 index 0000000000..4ca29a3006 --- /dev/null +++ b/lib/include/mapped-file-storage.hh @@ -0,0 +1,40 @@ +/* + mapped-file-storage.hh -- declare Mapped_file_storage + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys + + */ + +#ifndef MAPPED_FILE_STORAGE_HH +#define MAPPED_FILE_STORAGE_HH + + + +#include "file-storage.hh" + +/** + Use mmap to "copy" a file into memory + */ +class Mapped_file_storage:public File_storage +{ +public: + Mapped_file_storage (String); +protected: + virtual char const* ch_C () const; + virtual int length_i () const; + virtual ~Mapped_file_storage (); +private: + void open (String name); + void close (); + + void map (); + void unmap (); + int fildes_i_; + off_t size_off_; + caddr_t data_caddr_; +}; + +#endif /* MAPPED_FILE_STORAGE_HH */ + diff --git a/lib/include/moment.hh b/lib/include/moment.hh index bbd3388e74..f9d234d71f 100644 --- a/lib/include/moment.hh +++ b/lib/include/moment.hh @@ -18,7 +18,7 @@ Can't we name this Saint_jut_mom (Sintjuttemis ?) */ -const infinity_mom = Rational(INT_MAX); +const infinity_mom = Rational (INT_MAX); class String; typedef Rational Moment; diff --git a/lib/include/plet.hh b/lib/include/plet.hh index 2326416716..ecedcc4d43 100644 --- a/lib/include/plet.hh +++ b/lib/include/plet.hh @@ -17,9 +17,9 @@ (plet) */ struct Plet { - Plet(); - Moment mom() const; - bool unit_b() const; + Plet (); + Moment mom () const; + bool unit_b () const; int iso_i_; // 2/3; 2 is not duration, maar of count! int type_i_; }; diff --git a/lib/include/simple-file-storage.hh b/lib/include/simple-file-storage.hh new file mode 100644 index 0000000000..78a00d8651 --- /dev/null +++ b/lib/include/simple-file-storage.hh @@ -0,0 +1,31 @@ +/* + simple-file-storage.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys + + */ + +#ifndef SIMPLE_FILE_STORAGE_HH +#define SIMPLE_FILE_STORAGE_HH + +#include "file-storage.hh" + +/** + read file char by char and copy into a malloc array. + */ +class Simple_file_storage : public File_storage +{ + char * data_p_; + int len_i_; +protected: + virtual char const*ch_C () const; + virtual int length_i () const; + virtual ~Simple_file_storage (); +public: + Simple_file_storage (String); +}; + +#endif /* SIMPLE_FILE_STORAGE_HH */ + diff --git a/lib/include/source-file.hh b/lib/include/source-file.hh index 9b084a3280..d5346be5f7 100644 --- a/lib/include/source-file.hh +++ b/lib/include/source-file.hh @@ -16,24 +16,24 @@ class istream; class Source_file { public: - /** Ugh! filename gets changed! The path to the opened file may - change, since it might be searched in multiple directories. */ - Source_file(String filename_str_r ); - virtual ~Source_file(); - - char const* ch_C() const; - virtual String error_str(char const* pos_ch_c_l ) const; - istream * istream_l(); - bool in_b(char const* pos_ch_c_l ) const; - int length_i() const; - virtual int line_i(char const* pos_ch_c_l ) const; - String name_str() const; - String file_line_no_str(char const* ch_c_l ) const; + /** Ugh! filename gets changed! The path to the opened file may + change, since it might be searched in multiple directories. */ + Source_file (String filename_str_r ); + virtual ~Source_file (); + + char const* ch_C () const; + virtual String error_str (char const* pos_ch_c_l ) const; + istream * istream_l (); + bool in_b (char const* pos_ch_c_l ) const; + int length_i () const; + virtual int line_i (char const* pos_ch_c_l ) const; + String name_str () const; + String file_line_no_str (char const* ch_c_l ) const; private: - String name_str_; - istream* istream_p_; - File_storage * storage_p_; + String name_str_; + istream* istream_p_; + File_storage * storage_p_; }; #endif // SOURCE_FILE_HH // diff --git a/lib/include/source.hh b/lib/include/source.hh index 357647b9a1..f6a824fa70 100644 --- a/lib/include/source.hh +++ b/lib/include/source.hh @@ -12,18 +12,18 @@ class Sources { public: - Sources(); + Sources (); - Source_file * get_file_l(String &filename ); - Source_file* sourcefile_l(char const* ch_C ); - void set_path(File_path*p_C); - void set_binary(bool); + Source_file * get_file_l (String &filename ); + Source_file* sourcefile_l (char const* ch_C ); + void set_path (File_path*p_C); + void set_binary (bool); private: - const File_path * path_C_; - void add(Source_file* sourcefile_p ); - Pointer_list sourcefile_p_list_; - bool binary_b_ ; + const File_path * path_C_; + void add (Source_file* sourcefile_p ); + Pointer_list sourcefile_p_list_; + bool binary_b_ ; }; diff --git a/lib/include/warn.hh b/lib/include/warn.hh index 61ab2e6972..45edc4ba40 100644 --- a/lib/include/warn.hh +++ b/lib/include/warn.hh @@ -12,6 +12,6 @@ #include "string.hh" -void warning(String message_str ); -void error(String message_str); +void warning (String message_str ); +void error (String message_str); #endif // WARN_HH diff --git a/lib/include/windhoos-suck-suck-suck-thank-you-cygnus.hh b/lib/include/windhoos-suck-suck-suck-thank-you-cygnus.hh index cabfd3c5c4..95d60bfc33 100644 --- a/lib/include/windhoos-suck-suck-suck-thank-you-cygnus.hh +++ b/lib/include/windhoos-suck-suck-suck-thank-you-cygnus.hh @@ -1,15 +1,15 @@ // // windhoos-suck-suck-suck-thank-you-cygnus.hh // -// mmap() should work now (cygnus beta 18), but let's keep it here +// mmap () should work now (cygnus beta 18), but let's keep it here // for people using old cygnus releases #if 0 //def _WINDOWS32 #ifndef WINDHOOS_SUCK_SUCK_SUCK_HH #define WINDHOOS_SUCK_SUCK_SUCK_HH -caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset); +caddr_t mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset); -int munmap(caddr_t addr, size_t len); +int munmap (caddr_t addr, size_t len); #endif // WINDHOOS_SUCK_SUCK_SUCK_HH #endif // _WINDOWS32 // diff --git a/lib/input.cc b/lib/input.cc index 7c5fed9720..e9cc3fd007 100644 --- a/lib/input.cc +++ b/lib/input.cc @@ -11,65 +11,65 @@ #include "source.hh" #include "source-file.hh" -Input::Input(Source_file*s, char const *cl) +Input::Input (Source_file*s, char const *cl) { source_file_l_=s; defined_ch_C_=cl; } -Input::Input() +Input::Input () { source_file_l_ = 0; defined_ch_C_ = 0; } -Input::Input(Input const &s) +Input::Input (Input const &s) { source_file_l_ = s.source_file_l_; defined_ch_C_ = s.defined_ch_C_; } void -Input::set_spot(Input const &i) +Input::set_spot (Input const &i) { *this = i; } void -Input::message(String message_str) const +Input::message (String message_str) const { String str = ""; if (source_file_l_) { - str += location_str() + String(": "); + str += location_str () + String (": "); } str += message_str; if (source_file_l_) { str += ":\n"; - str += source_file_l_->error_str(defined_ch_C_); + str += source_file_l_->error_str (defined_ch_C_); } cerr << str << endl; } void -Input::warning(String message_str) const +Input::warning (String message_str) const { - message(_("warning: ") + message_str); + message (_ ("warning: ") + message_str); } void -Input::error(String s) const +Input::error (String s) const { - message(_("error: ")+ s); + message (_ ("error: ")+ s); } String -Input::location_str() const +Input::location_str () const { if (source_file_l_) - return source_file_l_->file_line_no_str(defined_ch_C_); + return source_file_l_->file_line_no_str (defined_ch_C_); else - return _("(location unknown)"); + return _ ("(location unknown)"); } diff --git a/lib/mapped-file-storage.cc b/lib/mapped-file-storage.cc index ad39630b37..c318925b4e 100644 --- a/lib/mapped-file-storage.cc +++ b/lib/mapped-file-storage.cc @@ -1,11 +1,16 @@ +#ifdef HAIRY_STUFF + /* file-storage.cc -- implement Mapped_file_storage source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys - Jan Nieuwenhuizen + Jan Nieuwenhuizen . + + Nextstep fixes by tiggr@ics.ele.tue.nl */ + #include // open, mmap #include // open #include // mmap @@ -18,84 +23,117 @@ +#ifdef __NeXT__ +#include +#include +#include +#endif + #include "string.hh" #include "proto.hh" #include "warn.hh" #include "file-storage.hh" -Mapped_file_storage::Mapped_file_storage(String s) +Mapped_file_storage::Mapped_file_storage (String s) { data_caddr_ = 0; fildes_i_ = 0; size_off_ = 0; - open(s); + open (s); } char const* -Mapped_file_storage::ch_C() const +Mapped_file_storage::ch_C () const { return (char const*)data_caddr_; } void -Mapped_file_storage::map() +Mapped_file_storage::map () { if (fildes_i_ == -1) return; - - data_caddr_ = (caddr_t)mmap((void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0); + +#ifdef __NeXT__ + /* Should be #if !HAVE_MMAP && HAVE_MAP_FD... */ + { + vm_offset_t address; + kern_return_t r; + + r = map_fd (fildes_i_, (vm_offset_t) 0, &address, TRUE, size_off_); + if (r != KERN_SUCCESS) + warning (String (_ ("map_fd: ")) + mach_error_string (r)); + else + data_caddr_ = (char *) address; + } +#else + + data_caddr_ = (caddr_t)mmap ((void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0); if ((int)data_caddr_ == -1) - warning(String(_("can't map: error no: ")) + strerror(errno)); + warning (String (_ ("can't map: error no: ")) + strerror (errno)); + +#endif } void -Mapped_file_storage::open(String name_str) +Mapped_file_storage::open (String name_str) { - fildes_i_ = ::open(name_str.ch_C (), O_RDONLY); + fildes_i_ = ::open (name_str.ch_C (), O_RDONLY); if (fildes_i_ == -1) { - warning(String(_("can't open: ")) + name_str + String(": ") + strerror(errno)); + warning (String (_ ("can't open: ")) + name_str + String (": ") + strerror (errno)); return; } struct stat file_stat; - fstat(fildes_i_, &file_stat); + fstat (fildes_i_, &file_stat); size_off_ = file_stat.st_size; - map(); + map (); } void -Mapped_file_storage::unmap() +Mapped_file_storage::unmap () { if (data_caddr_) { - munmap(data_caddr_, size_off_); +#ifdef __NeXT__ + kern_return_t r; + + r = vm_deallocate (task_self (), (vm_address_t) data_caddr_, +size_off_); + if (r != KERN_SUCCESS) + warning (String (_ ("vm_deallocate: ")) + mach_error_string (r)); +#else + munmap (data_caddr_, size_off_); +#endif + data_caddr_ = 0; size_off_ = 0; } } void -Mapped_file_storage::close() +Mapped_file_storage::close () { - unmap(); + unmap (); if (fildes_i_) { - ::close(fildes_i_); + ::close (fildes_i_); fildes_i_ = 0; } } int -Mapped_file_storage::length_i() const +Mapped_file_storage::length_i () const { return size_off_; } -Mapped_file_storage::~Mapped_file_storage() +Mapped_file_storage::~Mapped_file_storage () { - close(); + close (); } +#endif diff --git a/lib/moment.cc b/lib/moment.cc index 2557acb2a5..d521b233d3 100644 --- a/lib/moment.cc +++ b/lib/moment.cc @@ -11,9 +11,9 @@ #include "moment.hh" void -printm(Moment const &m) +printm (Moment const &m) { - cout << String(m) << flush; + cout << String (m) << flush; } diff --git a/lib/plet.cc b/lib/plet.cc index 686909382a..84579eca71 100644 --- a/lib/plet.cc +++ b/lib/plet.cc @@ -9,20 +9,20 @@ #include "plet.hh" -Plet::Plet() +Plet::Plet () { type_i_ = 1; iso_i_ = 1; } Moment -Plet::mom() const +Plet::mom () const { - return Moment(iso_i_, type_i_); + return Moment (iso_i_, type_i_); } bool -Plet::unit_b() const +Plet::unit_b () const { return type_i_ == 1 && iso_i_ == 1; } diff --git a/lib/simple-file-storage.cc b/lib/simple-file-storage.cc index e09bb1699a..b80724d987 100644 --- a/lib/simple-file-storage.cc +++ b/lib/simple-file-storage.cc @@ -8,7 +8,7 @@ #include -#include "file-storage.hh" +#include "simple-file-storage.hh" #include "varray.hh" #include "string.hh" #include "warn.hh" @@ -26,7 +26,7 @@ [Some versions later] The crashes aren't caused by the mmap code. But no reason to take it out, is there? */ -Simple_file_storage::Simple_file_storage(String s) +Simple_file_storage::Simple_file_storage (String s) { data_p_ =0; @@ -34,44 +34,44 @@ Simple_file_storage::Simple_file_storage(String s) let's hope that "b" opens anything binary, and does not apply CR/LF translation */ - FILE * f = (s.length_i ()) ? fopen (s.ch_C(), "rb") : stdin; + FILE * f = (s.length_i ()) ? fopen (s.ch_C (), "rb") : stdin; if (!f) { - warning(_("can't open file `") + s + "'"); + warning (_ ("can't open file `") + s + "'"); return ; } - int ret = fseek(f, 0, SEEK_END); - len_i_ = ftell(f); - rewind(f); + int ret = fseek (f, 0, SEEK_END); + len_i_ = ftell (f); + rewind (f); data_p_ = new char[len_i_+1]; data_p_[len_i_] = 0; - ret = fread(data_p_, sizeof(char), len_i_, f); + ret = fread (data_p_, sizeof (char), len_i_, f); if (ret!=len_i_) - warning (_("Huh? got ") + String(ret) + _(", expected ") - + String(len_i_) + _(" characters")); + warning (_ ("Huh? got ") + String (ret) + _ (", expected ") + + String (len_i_) + _ (" characters")); if (f != stdin) - fclose(f); + fclose (f); } char const* -Simple_file_storage::ch_C() const +Simple_file_storage::ch_C () const { return data_p_; } int -Simple_file_storage::length_i() const +Simple_file_storage::length_i () const { return len_i_; } -Simple_file_storage::~Simple_file_storage() +Simple_file_storage::~Simple_file_storage () { delete []data_p_; } diff --git a/lib/source-file.cc b/lib/source-file.cc index 66a13de2bb..b6153c984a 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -17,53 +17,53 @@ #include "warn.hh" #include "windhoos-suck-suck-suck-thank-you-cygnus.hh" #include "source-file.hh" -#include "file-storage.hh" +#include "simple-file-storage.hh" -Source_file::Source_file(String filename_str) +Source_file::Source_file (String filename_str) { name_str_ = filename_str; istream_p_ = 0; - storage_p_ = new Simple_file_storage(filename_str); + storage_p_ = new Simple_file_storage (filename_str); } istream* -Source_file::istream_l() +Source_file::istream_l () { /* - if (!name_str_.length_i()) + if (!name_str_.length_i ()) return &cin; */ if (!istream_p_) { - if (length_i()) // can-t this be done without such a hack? - istream_p_ = new istrstream(ch_C(), length_i()); + if (length_i ()) // can-t this be done without such a hack? + istream_p_ = new istrstream (ch_C (), length_i ()); else { - istream_p_ = new istrstream("", 0); - istream_p_->set(ios::eofbit); + istream_p_ = new istrstream ("", 0); + istream_p_->set (ios::eofbit); } } return istream_p_; } String -Source_file::file_line_no_str(char const *context_ch_C) const +Source_file::file_line_no_str (char const *context_ch_C) const { - if (!ch_C()) - return _("(unknown)"); + if (!ch_C ()) + return _ ("(unknown)"); else - return name_str() + ": " - + String(line_i(context_ch_C)); + return name_str () + ": " + + String (line_i (context_ch_C)); } String -Source_file::name_str() const +Source_file::name_str () const { return name_str_; } -Source_file::~Source_file() +Source_file::~Source_file () { delete istream_p_; istream_p_ = 0; @@ -71,12 +71,12 @@ Source_file::~Source_file() } String -Source_file::error_str(char const* pos_ch_C) const +Source_file::error_str (char const* pos_ch_C) const { - char const* data_ch_C = ch_C(); - char const * eof_C_ = data_ch_C + length_i(); - if (!in_b(pos_ch_C)) - return _("(position unknown)"); + char const* data_ch_C = ch_C (); + char const * eof_C_ = data_ch_C + length_i (); + if (!in_b (pos_ch_C)) + return _ ("(position unknown)"); if (pos_ch_C == eof_C_) @@ -97,8 +97,8 @@ Source_file::error_str(char const* pos_ch_C) const break; } - // String(char const* p, int length) is missing!? - String line_str((Byte const*)begin_ch_C, end_ch_C - begin_ch_C); + // String (char const* p, int length) is missing!? + String line_str ((Byte const*)begin_ch_C, end_ch_C - begin_ch_C); int error_col_i = 0; char const* scan_ch_C = begin_ch_C; @@ -108,28 +108,28 @@ Source_file::error_str(char const* pos_ch_C) const else error_col_i++; - String str = line_str.left_str(pos_ch_C - begin_ch_C) - + String('\n') - + String(' ', error_col_i) - + line_str.cut(pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg.. + String str = line_str.left_str (pos_ch_C - begin_ch_C) + + String ('\n') + + String (' ', error_col_i) + + line_str.cut (pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg.. return str; } bool -Source_file::in_b(char const* pos_ch_C) const +Source_file::in_b (char const* pos_ch_C) const { - return (pos_ch_C && (pos_ch_C >= ch_C()) && (pos_ch_C <= ch_C() + length_i())); + return (pos_ch_C && (pos_ch_C >= ch_C ()) && (pos_ch_C <= ch_C () + length_i ())); } int -Source_file::line_i(char const* pos_ch_C) const +Source_file::line_i (char const* pos_ch_C) const { - if (!in_b(pos_ch_C)) + if (!in_b (pos_ch_C)) return 0; int i = 1; - char const* scan_ch_C = ch_C(); + char const* scan_ch_C = ch_C (); if (!scan_ch_C) return 0; @@ -140,13 +140,13 @@ Source_file::line_i(char const* pos_ch_C) const } int -Source_file::length_i() const +Source_file::length_i () const { - return storage_p_->length_i(); + return storage_p_->length_i (); } char const * -Source_file::ch_C() const +Source_file::ch_C () const { - return storage_p_->ch_C(); + return storage_p_->ch_C (); } diff --git a/lib/source.cc b/lib/source.cc index 3f2daf6a23..d350b487ca 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -17,20 +17,20 @@ #include "source.hh" #include "path.hh" -Sources::Sources() +Sources::Sources () { path_C_= 0; binary_b_ = false; } void -Sources::set_binary(bool bo) +Sources::set_binary (bool bo) { binary_b_ = bo; } void -Sources::set_path(File_path *f_C) +Sources::set_path (File_path *f_C) { path_C_ = f_C; } @@ -44,25 +44,25 @@ Sources::set_path(File_path *f_C) @return 0 if no file found */ Source_file* -Sources::get_file_l(String &file_str) //UGH +Sources::get_file_l (String &file_str) //UGH { if (path_C_) { - String file_str_o = path_C_->find(file_str); + String file_str_o = path_C_->find (file_str); if ((file_str_o == "") && (file_str != "")) return 0; file_str = file_str_o; } Source_file * f_p= (!binary_b_) ? - new Source_file(file_str) : new Binary_source_file(file_str); - add(f_p); + new Source_file (file_str) : new Binary_source_file (file_str); + add (f_p); return f_p; } void -Sources::add(Source_file* sourcefile_p) +Sources::add (Source_file* sourcefile_p) { - sourcefile_p_list_.bottom().add(sourcefile_p); + sourcefile_p_list_.bottom ().add (sourcefile_p); } /** @@ -71,11 +71,11 @@ Sources::add(Source_file* sourcefile_p) @return 0 if not found. */ Source_file* -Sources::sourcefile_l(char const* ch_C) +Sources::sourcefile_l (char const* ch_C) { - PCursor sourcefile_l_pcur(sourcefile_p_list_.top()); - for (; sourcefile_l_pcur.ok(); sourcefile_l_pcur++) - if (sourcefile_l_pcur->in_b(ch_C)) + PCursor sourcefile_l_pcur (sourcefile_p_list_.top ()); + for (; sourcefile_l_pcur.ok (); sourcefile_l_pcur++) + if (sourcefile_l_pcur->in_b (ch_C)) return *sourcefile_l_pcur; return 0; } diff --git a/lib/template.cc b/lib/template.cc index 90f9818d85..36cb118232 100644 --- a/lib/template.cc +++ b/lib/template.cc @@ -12,5 +12,5 @@ #include "cursor.tcc" #include "list.tcc" -template LIST_INSTANTIATE(void *); -template POINTERLIST_INSTANTIATE(Source_file); +template LIST_INSTANTIATE (void *); +template POINTERLIST_INSTANTIATE (Source_file); diff --git a/lib/warn.cc b/lib/warn.cc index ade821a64f..743af06d6a 100644 --- a/lib/warn.cc +++ b/lib/warn.cc @@ -2,23 +2,23 @@ #include void -error(String s) +error (String s) { - cerr << _("error: ") << s << "\n"; + cerr << _ ("error: ") << s << "\n"; - exit(1); + exit (1); } void -warning(String m) +warning (String m) { - cerr << _("warning: ") < caddr_t -mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { (void)flags; (void)prot; (void)addr; - HANDLE osf = (HANDLE)_get_osfhandle(fd); - HANDLE file_handle = CreateFileMapping(osf, (void*)0, PAGE_READONLY, + HANDLE osf = (HANDLE)_get_osfhandle (fd); + HANDLE file_handle = CreateFileMapping (osf, (void*)0, PAGE_READONLY, 0, len, 0); - return (caddr_t)MapViewOfFile(file_handle, FILE_MAP_READ, 0, offset, len); + return (caddr_t)MapViewOfFile (file_handle, FILE_MAP_READ, 0, offset, len); } int -munmap(caddr_t addr, size_t len) +munmap (caddr_t addr, size_t len) { (void)len; - return UnmapViewOfFile(addr); + return UnmapViewOfFile (addr); } #else // ! HAVE_GET_OSFHANDLE // caddr_t -mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { (void)flags; (void)prot; @@ -86,13 +86,13 @@ mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) (void)offset; char* ch_p = new char[ len ]; if (ch_p) - read(fd, (void*)ch_p, len); + read (fd, (void*)ch_p, len); return ch_p; } int -munmap(caddr_t addr, size_t len) +munmap (caddr_t addr, size_t len) { (void)len; delete (char*)addr; diff --git a/lily/VERSION b/lily/VERSION index e0d3c8cadf..486f034e1b 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,4 +1,4 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 42 +PATCH_LEVEL = 43 MY_PATCH_LEVEL = diff --git a/lily/break.cc b/lily/break.cc index 8b6241732b..04b623e883 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -17,9 +17,9 @@ #include "cpu-timer.hh" String -Col_stats::str() const { +Col_stats::str () const { String s (count_i_); - s += _(" lines"); + s += _ (" lines"); if (count_i_) s += String (Real (cols_i_)/count_i_, _(", (with an average of %.1f columns)")); @@ -30,11 +30,11 @@ void Col_stats::add (Line_of_cols const& line) { count_i_++; - cols_i_ += line.size(); + cols_i_ += line.size (); } -Col_stats::Col_stats() +Col_stats::Col_stats () { count_i_ =0; cols_i_ =0; @@ -43,11 +43,11 @@ Col_stats::Col_stats() /* **************************************************************** */ Line_of_cols -Break_algorithm::all_cols() const +Break_algorithm::all_cols () const { Line_of_cols retval; - for (PCursor c (pscore_l_->col_p_list_.top()); - c.ok(); c++) + for (PCursor c (pscore_l_->col_p_list_.top ()); + c.ok (); c++) { retval.push (c); @@ -56,17 +56,17 @@ Break_algorithm::all_cols() const } Array -Break_algorithm::find_break_indices() const +Break_algorithm::find_break_indices () const { - Line_of_cols all (all_cols()); + Line_of_cols all (all_cols ()); Array retval; - for (int i=0; i < all.size(); i++) + for (int i=0; i < all.size (); i++) if (all[i]->breakable_b_) retval.push (i); if (linelength <=0) - while (retval.size() >2) + while (retval.size () >2) retval.del (1); return retval; @@ -74,18 +74,18 @@ Break_algorithm::find_break_indices() const /// return all breakable columns Line_of_cols -Break_algorithm::find_breaks() const +Break_algorithm::find_breaks () const { - Line_of_cols all (all_cols()); + Line_of_cols all (all_cols ()); Line_of_cols retval; - for (int i=0; i < all.size(); i++) + for (int i=0; i < all.size (); i++) if (all[i]->breakable_b_) retval.push (all[i]); if (linelength <=0) - while (retval.size() >2) + while (retval.size () >2) retval.del (1); return retval; @@ -96,25 +96,25 @@ Break_algorithm::find_breaks() const Line_spacer* -Break_algorithm::generate_spacing_problem (Line_of_cols curline) const +Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const { - Line_spacer * sp= (*get_line_spacer)(); + Line_spacer * sp= (*get_line_spacer) (); sp->paper_l_ = pscore_l_->paper_l_; - sp->add_column (curline[0], true, 0.0); - for (int i=1; i< curline.size()-1; i++) + sp->add_column (curline[0], true, line.min ()); + for (int i=1; i< curline.size ()-1; i++) sp->add_column (curline[i]); - if (linelength > 0) - sp->add_column (curline.top(), true, linelength); + if (line.length () > 0) + sp->add_column (curline.top (), true, line.max ()); else - sp->add_column (curline.top()); + sp->add_column (curline.top ()); - sp->prepare(); + sp->prepare (); return sp; } -Break_algorithm::Break_algorithm() +Break_algorithm::Break_algorithm () { pscore_l_ = 0; get_line_spacer =0; @@ -125,8 +125,8 @@ void Break_algorithm::set_pscore (Paper_score*s) { pscore_l_ = s; - linelength = s->paper_l_->linewidth_f(); - do_set_pscore(); + linelength = s->paper_l_->linewidth_f (); + do_set_pscore (); } bool @@ -136,25 +136,25 @@ Break_algorithm::feasible (Line_of_cols curline) const return true; Real l =0; - for (int i=0; i < curline.size(); i++) - l +=curline[i]->width().length (); + for (int i=0; i < curline.size (); i++) + l +=curline[i]->width ().length (); return l < linelength; } void -Break_algorithm::problem_OK() const +Break_algorithm::problem_OK () const { - if (!pscore_l_->col_p_list_.size()) + if (!pscore_l_->col_p_list_.size ()) error (_("Score does not have any columns")); - OK(); + OK (); } void -Break_algorithm::OK() const +Break_algorithm::OK () const { #ifndef NDEBUG iter_top (pscore_l_->col_p_list_,start); - PCursor end (pscore_l_->col_p_list_.bottom()); + PCursor end (pscore_l_->col_p_list_.bottom ()); assert (start->breakable_b_); assert (end->breakable_b_); @@ -162,23 +162,23 @@ Break_algorithm::OK() const } Array -Break_algorithm::solve() const +Break_algorithm::solve () const { Cpu_timer timer; - Array h= do_solve(); + Array h= do_solve (); if (approx_stats_.count_i_) - *mlog << _("\nApproximated: ") << approx_stats_.str() << "\n"; + *mlog << _ ("\nApproximated: ") << approx_stats_.str () << "\n"; if (exact_stats_.count_i_) - *mlog << _("Calculated exactly: ") << exact_stats_.str() << "\n"; - *mlog << _("Time: ") << String(timer.read (), "%.2f") << _(" seconds\n"); + *mlog << _ ("Calculated exactly: ") << exact_stats_.str () << "\n"; + *mlog << _ ("Time: ") << String (timer.read (), "%.2f") << _ (" seconds\n"); return h; } void -Break_algorithm::do_set_pscore() +Break_algorithm::do_set_pscore () { } diff --git a/lily/debug.cc b/lily/debug.cc index 39b40c7764..c369f070ee 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -6,7 +6,6 @@ (c) 1996,98 Han-Wen Nienhuys */ -#include #include #include #include @@ -75,8 +74,6 @@ bool check_malloc_b = false; // #define MEMORY_PARANOID #ifdef MEMORY_PARANOID - - void * operator new (size_t size) { diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 3daa4ab12e..05c2a722b3 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -25,11 +25,13 @@ struct Break_node { */ int prev_break_i_; + int line_i_; Real energy_f_; Col_hpositions line_config_; - Break_node() + Break_node () { prev_break_i_ = -1; + line_i_ = 0; } }; @@ -38,23 +40,24 @@ struct Break_node { */ Array -Gourlay_breaking::do_solve() const +Gourlay_breaking::do_solve () const { Array optimal_paths; - Line_of_cols all = all_cols(); - Array breaks = find_break_indices(); + Line_of_cols all = all_cols (); + Array breaks = find_break_indices (); - optimal_paths.set_size (breaks.size()); + optimal_paths.set_size (breaks.size ()); Break_node first_node ; first_node.prev_break_i_ = -1; first_node.line_config_.energy_f_ = 0; + first_node.line_i_ = 0; optimal_paths[0] = first_node; int break_idx=1; - for (; break_idx< breaks.size(); break_idx++) + for (; break_idx< breaks.size (); break_idx++) { Array candidates; Array candidate_lines; @@ -75,9 +78,9 @@ Gourlay_breaking::do_solve() const continue; Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1); - - line[0] = line[0]->postbreak_l(); - line.top() = line.top ()->prebreak_l(); + + line[0] = line[0]->postbreak_l (); + line.top () = line.top ()->prebreak_l (); if (!feasible (line)) break; @@ -85,11 +88,12 @@ Gourlay_breaking::do_solve() const Col_hpositions approx; approx.cols = line; - approx.spacer_l_ = generate_spacing_problem (line); - spacer_p_list.bottom().add (approx.spacer_l_); + approx.spacer_l_ = generate_spacing_problem (line, + pscore_l_->paper_l_->line_dimensions_int (optimal_paths[start_idx].line_i_)); + spacer_p_list.bottom ().add (approx.spacer_l_); - ((Break_algorithm*)this)->approx_stats_.add (approx.cols); - approx.approximate_solve_line(); + ( (Break_algorithm*)this)->approx_stats_.add (approx.cols); + approx.approximate_solve_line (); if (approx.energy_f_ > energy_bound_f_) { @@ -105,7 +109,7 @@ Gourlay_breaking::do_solve() const int minimal_j = -1; Real minimal_energy = infinity_f; - for (int j=0; j < candidates.size(); j++) + for (int j=0; j < candidates.size (); j++) { int start = candidates[j]; if (optimal_paths[start].line_config_.energy_f_ @@ -115,8 +119,8 @@ Gourlay_breaking::do_solve() const if (!candidate_lines[j].satisfies_constraints_b_) { - candidate_lines[j].solve_line(); - ((Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols); + candidate_lines[j].solve_line (); + ( (Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols); } Real this_energy @@ -139,9 +143,11 @@ Gourlay_breaking::do_solve() const { optimal_paths[break_idx].prev_break_i_ = candidates[minimal_j]; optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j]; + optimal_paths[break_idx].line_i_ = + optimal_paths[optimal_paths[break_idx].prev_break_i_].line_i_ + 1; } - if (!(break_idx % HAPPY_DOTS_I)) + if (! (break_idx % HAPPY_DOTS_I)) *mlog << "[" << break_idx << "]"< lines; /* skip 0-th element, since it is a "dummy" elt*/ - for (int i = optimal_paths.size()-1; i> 0;) + for (int i = optimal_paths.size ()-1; i> 0;) { final_breaks.push (i); assert (i > optimal_paths[i].prev_break_i_); // there was no "feasible path" - if (!optimal_paths[i].line_config_.config.size()) { + if (!optimal_paths[i].line_config_.config.size ()) { final_breaks.set_size (0); break; } @@ -167,14 +173,14 @@ Gourlay_breaking::do_solve() const } - for (int i= final_breaks.size(); i--;) + for (int i= final_breaks.size (); i--;) lines.push (optimal_paths[final_breaks[i]].line_config_); return lines; } -Gourlay_breaking::Gourlay_breaking() +Gourlay_breaking::Gourlay_breaking () { get_line_spacer = Spring_spacer::constructor; energy_bound_f_ = infinity_f; @@ -182,7 +188,7 @@ Gourlay_breaking::Gourlay_breaking() } void -Gourlay_breaking::do_set_pscore() +Gourlay_breaking::do_set_pscore () { energy_bound_f_ = pscore_l_->paper_l_->get_var ("gourlay_energybound"); max_measures_i_ =int (rint (pscore_l_->paper_l_->get_var ("gourlay_maxmeasures"))); diff --git a/lily/include/break.hh b/lily/include/break.hh index dcc3f63908..c6c9058e51 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -10,11 +10,10 @@ #ifndef BREAK_HH #define BREAK_HH #include "varray.hh" +#include "interval.hh" #include "lily-proto.hh" #include "colhpos.hh" - - /** Statistics for the number of columns calced. */ @@ -57,10 +56,11 @@ protected: bool feasible (Line_of_cols) const; - Line_spacer* generate_spacing_problem (Line_of_cols) const; + Line_spacer* generate_spacing_problem (Line_of_cols, Interval) const; virtual Array do_solve() const=0; - virtual void do_set_pscore(); + virtual void do_set_pscore(); + public: Col_stats approx_stats_; Col_stats exact_stats_; diff --git a/lily/include/main.hh b/lily/include/main.hh index 1a95d9d203..5ca8f5ad8c 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -18,6 +18,7 @@ void set_default_output (String s); String find_file (String); String get_version_str(); String get_version_number_str(); +void call_constructors (); extern Sources* source_global_l; extern bool no_paper_global_b; extern int exit_status_i_; diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 162bb656e6..4bf3b9589c 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -14,6 +14,8 @@ #include "real.hh" #include "moment.hh" +#include "varray.hh" +#include "interval.hh" #include "music-output-def.hh" /** @@ -39,9 +41,11 @@ class Paper_def : public Music_output_def { protected: VIRTUAL_COPY_CONS(Paper_def,Music_output_def); public: - virtual ~Paper_def(); + virtual ~Paper_def (); DECLARE_MY_RUNTIME_TYPEINFO; + Array shape_int_a_; + /** Set or overwrite a variable */ @@ -50,39 +54,40 @@ public: Read a variable. Crash if it doesn't exist. */ Real get_var (String) const; - void reinit(); - Paper_def(); + void reinit (); + Paper_def (); void set (Lookup*); Paper_def (Paper_def const&); /// The distance between beams - Real interbeam_f() const; + Real interbeam_f () const; /** The distance between lines */ - Real interline_f() const; + Real interline_f () const; /// half the distance between lines - Real internote_f() const; + Real internote_f () const; /// thickness of the standard line - Real rule_thickness() const; - Real linewidth_f() const; + Real rule_thickness () const; + Interval line_dimensions_int (int) const; + Real linewidth_f () const; /// height of the staff - Real standard_height() const; + Real standard_height () const; /// width of a crotchet ball - Real note_width() const; - void print() const; + Real note_width () const; + void print () const; - Lookup const * lookup_l(); // TODO naming + Lookup const * lookup_l (); // TODO naming /** convert a duration to an idealspacing influence using the geometric_ and parameters. */ Real duration_to_dist (Moment, Real) const; - Real geometric_spacing(Moment) const; - Real arithmetic_constant(Moment minimal_mom) const; - Real arithmetic_spacing( Moment mom,Real constant) const; + Real geometric_spacing (Moment) const; + Real arithmetic_constant (Moment minimal_mom) const; + Real arithmetic_spacing (Moment mom,Real constant) const; virtual int get_next_default_count () const; String TeX_output_settings_str () const; }; diff --git a/lily/include/plet-spanner.hh b/lily/include/plet-spanner.hh index cae64729d5..4f2fa66eab 100644 --- a/lily/include/plet-spanner.hh +++ b/lily/include/plet-spanner.hh @@ -26,11 +26,6 @@ public: protected: virtual Molecule* brew_molecule_p () const; -private: - - -protected: - DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Plet_spanner); @@ -38,6 +33,7 @@ protected: virtual void do_post_processing (); virtual void set_default_dir (); virtual void do_substitute_dependency (Score_elem*,Score_elem*); + Plet_spanner (Plet_spanner const&); }; #endif // PLET_SPANNER_HH diff --git a/lily/include/stem.hh b/lily/include/stem.hh index d150eb1e76..8020d14f72 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -86,6 +86,7 @@ public: void do_print() const; void set_stemend (Real); Direction get_default_dir(); + Direction get_dir (); int get_center_distance(Direction); void set_default_dir(); @@ -95,7 +96,7 @@ public: Real stem_length_f() const; Real stem_end_f() const; - Real stem_start_f() const; + Real stem_begin_f() const; Real note_delta_f () const; bool invisible_b() const; diff --git a/lily/include/translator.hh b/lily/include/translator.hh index baa0718366..c2ddcb131a 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -101,15 +101,22 @@ protected: */ #define ADD_THIS_TRANSLATOR(c) \ struct c ## init { \ - c ## init() { \ - Translator *t = new c;\ + static Translator *ctor ()\ + {\ + Translator *t = new c;\ t-> type_str_ = c::static_name ();\ - add_translator (t);\ + return t;\ + }\ + c ## init() { \ + add_constructor (ctor);\ } \ } _ ## c ## init; +typedef Translator *(*Translator_ctor) (); + extern Dictionary *global_translator_dict_p; void add_translator (Translator*trans_p); +void add_constructor (Translator_ctor ctor); Translator*get_translator_l (String s); diff --git a/lily/lexer.l b/lily/lexer.l index 851e21c2e1..ab97828bc1 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -28,6 +28,7 @@ #include "string-convert.hh" #include "my-lily-lexer.hh" #include "varray.hh" +#include "interval.hh" #include "parser.hh" #include "debug.hh" #include "parseconstruct.hh" diff --git a/lily/main.cc b/lily/main.cc index 17d1997dc5..85968ddb14 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -45,7 +45,7 @@ Long_option_init theopts[] = { }; void -usage() +usage () { cout << _("Usage: lilypond [options] [mudela-files]\n" @@ -83,7 +83,7 @@ usage() } void -notice() +notice () { cout << _("\n" @@ -132,7 +132,7 @@ do_one_file (String init_str, String file_str) parser.set_version_check (version_ignore_b); parser.parse_file (init_str, file_str); - if (file_str.length_i() && file_str[0] != '-') + if (file_str.length_i () && file_str[0] != '-') { String a,b,c,d; split_path (file_str, a, b, c, d); @@ -146,7 +146,7 @@ do_one_file (String init_str, String file_str) exit_status_i_ = 1; } else - do_scores(); + do_scores (); clear_scores (); } source_global_l = 0; @@ -155,14 +155,15 @@ do_one_file (String init_str, String file_str) void identify () { - cout << get_version_str() << endl; + cout << get_version_str () << endl; } int main (int argc, char **argv) { identify (); - debug_init(); // should be first + call_constructors (); + debug_init (); // should be first // must override (come before) "/usr/local/share/lilypond"! @@ -178,7 +179,7 @@ main (int argc, char **argv) Getopt_long oparser (argc, argv,theopts); String init_str ("lily-init.ly"); - while (Long_option_init const * opt = oparser()) + while (Long_option_init const * opt = oparser ()) { switch (opt->shortname) { @@ -189,7 +190,7 @@ main (int argc, char **argv) default_outname_base_global = oparser.optional_argument_ch_C_; break; case 'w': - notice(); + notice (); exit (0); break; case 'I': @@ -199,7 +200,7 @@ main (int argc, char **argv) init_str = oparser.optional_argument_ch_C_; break; case 'h': - usage(); + usage (); exit (0); break; case 'V': @@ -222,7 +223,7 @@ main (int argc, char **argv) int p=0; const char *arg ; - while ((arg= oparser.get_next_arg())) + while ((arg= oparser.get_next_arg ())) { String f (arg); destill_inname (f); @@ -241,7 +242,7 @@ main (int argc, char **argv) void destill_inname (String &name_str_r) { - if (name_str_r.length_i()) + if (name_str_r.length_i ()) { if (name_str_r[ 0 ] != '-') { diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 2a8760ee52..1aa7bb77e9 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -52,6 +52,7 @@ static Keyword_ent the_key_tab[]={ {"pt", PT_T}, {"score", SCORE}, {"script", SCRIPT}, + {"shape", SHAPE}, {"skip", SKIP}, {"staff", STAFF}, {"table", TABLE}, diff --git a/lily/paper-def.cc b/lily/paper-def.cc index c3568f1b4d..92b126428c 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -54,8 +54,23 @@ Paper_def::get_var (String s) const return real_vars_p_->elem (s); } +Interval +Paper_def::line_dimensions_int (int n) const +{ + if (!shape_int_a_.size ()) + if (n) + return Interval (0, linewidth_f ()); + else + return Interval (get_var ("indent"), linewidth_f ()); + + if (n >= shape_int_a_.size ()) + n = shape_int_a_.size () -1; + + return shape_int_a_[n]; +} + Real -Paper_def::linewidth_f() const +Paper_def::linewidth_f () const { return get_var ("linewidth"); } diff --git a/lily/parser.y b/lily/parser.y index 8dea7f982a..2480a041e6 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -56,6 +56,7 @@ %union { + Array* intarr; Array *melreqvec;/* should clean up naming */ Array * strvec; Array *intvec; @@ -147,6 +148,7 @@ yylex (YYSTYPE *s, void * v_l) %token PT_T %token SCORE %token SCRIPT +%token SHAPE %token SKIP %token SPANDYNAMIC %token STAFF @@ -223,6 +225,7 @@ yylex (YYSTYPE *s, void * v_l) %type post_request command_req verbose_command_req %type script_req dynamic_req %type score_block score_body +%type shape_array %type