From 4bdf5f822b18b10b48f619c116641e6aee1968ac Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 10 Mar 1997 19:01:32 +0100 Subject: [PATCH] release: 0.0.40 --- .dstreamrc | 54 +++++++++++ .version | 6 +- ANNOUNCE | 2 + Documentation/README.pod | 15 ++-- Documentation/faq.pod | 10 +-- Documentation/index.pod | 13 ++- INSTALL | 2 +- Makefile | 9 +- NEWS | 45 +++++++++- README | 4 +- TODO | 16 +++- bin/Makefile | 2 +- bin/configure | 85 ------------------ bin/genheader | 7 +- bin/make_patch | 6 +- bin/make_website | 23 +++-- configure | 60 ++++++++++++- flower/.version | 4 +- flower/Makefile | 3 + flower/NEWS | 3 + flower/TODO | 2 + flower/Variables.make | 2 +- flower/fproto.hh | 2 + flower/lib/Makefile | 31 ++++--- flower/lib/dstream.cc | 5 +- flower/lib/include/flower-config.hh | 0 flower/lib/include/fproto.hh | 11 ++- flower/lib/include/pqueue.hh | 36 ++++++-- flower/lib/include/string-convert.hh | 6 +- flower/lib/string-convert.cc | 37 +++++--- flower/libc-extension.cc | 27 ++++-- flower/libc-extension.hh | 19 ++-- flower/string.cc | 12 ++- flower/test/Makefile | 106 ++++++++++++++++++++++ flower/test/stringtest.cc | 130 +++++++++++++++++++++++++++ init/dynamic.ini | 10 +++ init/symbol.ini | 2 +- init/table_sixteen.ini | 47 ++++++---- input/cadenza.ly | 4 +- input/scsii-menuetto.ly | 2 +- input/standchen.ly | 60 ++++++------- lib/Makefile | 27 +++--- lib/include/config.hh | 1 - lib/include/proto.hh | 19 ++-- lily/Makefile | 25 +++--- lily/bar.cc | 2 +- lily/beam.cc | 10 +-- lily/clef-item.cc | 2 +- lily/dynamic-reg.cc | 79 ++++++++++++++++ lily/identifier.cc | 3 +- lily/include/config.hh | 1 - lily/include/dynamic-reg.hh | 30 +++++++ lily/include/identifier.hh | 5 +- lily/include/identparent.hh | 6 +- lily/include/lookup.hh | 50 +++++------ lily/include/midi-walker.hh | 3 +- lily/include/musicalrequest.hh | 33 ++++++- lily/include/paper-def.hh | 5 +- lily/include/parser.hh | 86 ------------------ lily/include/score-walker.hh | 1 + lily/include/staff-column.hh | 4 +- lily/include/staff-elem-info.hh | 3 +- lily/include/symtable.hh | 4 +- lily/include/text-def.hh | 2 +- lily/include/text-item.hh | 17 ++-- lily/key-item.cc | 4 +- lily/lexer.l | 3 +- lily/local-key-item.cc | 2 +- lily/lookup.cc | 38 ++++---- lily/lyric-item.cc | 4 +- lily/meter.cc | 2 +- lily/midi-item.cc | 10 ++- lily/midi-output.cc | 12 ++- lily/midi-walker.cc | 30 ++++++- lily/mylexer.cc | 5 +- lily/notehead.cc | 6 +- lily/paper-def.cc | 5 ++ lily/parser.y | 63 +++++++++---- lily/pscore.cc | 2 +- lily/request.cc | 44 +++++++++ lily/rest.cc | 4 +- lily/score-walker.cc | 11 ++- lily/script.cc | 2 +- lily/slur.cc | 2 +- lily/staff-column.cc | 17 +++- lily/staff.cc | 56 +++++++++--- lily/staffsym.cc | 2 +- lily/stem.cc | 6 +- lily/symtable.cc | 8 +- lily/tex-beam.cc | 6 +- lily/tex-slur.cc | 8 +- lily/text-def.cc | 2 +- lily/text-item.cc | 29 +++++- lily/voice-elt.cc | 18 ++-- lily/voice-group-regs.cc | 2 + lily/walk-regs.cc | 5 +- m2m/include/midi-main.hh | 12 --- make/ACVariables.make.in | 16 ++++ make/Builtin-rules.make | 41 +++++++++ make/Include.make | 6 +- make/Initial.make | 12 +-- make/Makefile | 2 +- make/Rules.make | 54 +++++++++-- make/Site.make | 0 make/Sources.make | 16 ++-- make/Targets.make | 54 ++++++++--- make/Template.make | 30 ++++--- make/User.make | 2 +- make/Variables.make | 45 ++++++++-- make/configure.in | 70 +++++++++++++++ make/lilypond.spec | 40 +++++++++ {m2m => mi2mu}/.version | 5 +- {m2m => mi2mu}/Makefile | 47 +++++----- {m2m => mi2mu}/include/Makefile | 0 {m2m => mi2mu}/midi-lexer.l | 110 ++++++++++++----------- {m2m => mi2mu}/midi-parser.y | 43 +++++---- tex/lilyponddefs.tex | 18 ++-- 117 files changed, 1688 insertions(+), 681 deletions(-) create mode 100644 .dstreamrc delete mode 100755 bin/configure mode change 120000 => 100755 configure delete mode 100644 flower/lib/include/flower-config.hh create mode 100644 flower/test/Makefile create mode 100644 flower/test/stringtest.cc create mode 100644 init/dynamic.ini delete mode 100644 lib/include/config.hh create mode 100644 lily/dynamic-reg.cc delete mode 100644 lily/include/config.hh create mode 100644 lily/include/dynamic-reg.hh delete mode 100644 lily/include/parser.hh delete mode 100644 m2m/include/midi-main.hh create mode 100644 make/ACVariables.make.in create mode 100644 make/Builtin-rules.make delete mode 100644 make/Site.make create mode 100644 make/configure.in create mode 100644 make/lilypond.spec rename {m2m => mi2mu}/.version (58%) rename {m2m => mi2mu}/Makefile (60%) rename {m2m => mi2mu}/include/Makefile (100%) rename {m2m => mi2mu}/midi-lexer.l (86%) rename {m2m => mi2mu}/midi-parser.y (86%) diff --git a/.dstreamrc b/.dstreamrc new file mode 100644 index 0000000000..2b36f41544 --- /dev/null +++ b/.dstreamrc @@ -0,0 +1,54 @@ +# class name silence? + +My_flex_lexer 1 +yyFlexLexer 1 +PCol 1 +Score_column 1 +Ineq_constrained_qp 1 +Spacing_problem 1 +Colinfo 1 +Mixed_qp 1 +PScore 1 +Idealspacing 1 + +# yydebug +InitParser 1 +Parser 1 +InitDeclarations 1 + +# FlexLexer debug +InitLexer 1 +Lexer 1 + +parse_duration 1 +parse_pitchmod 1 +Col_configuration 1 +Request 1 +Note_req 1 +Rhythmic_req 1 +Rest_req 1 +delete_identifiers 1 +Command 1 +Staff_commands 1 +Stem 1 +Staff 1 +Score 1 +Voice 1 +Voice_element 1 +Input_cursor 1 +Commands_at 1 +Input_command 1 +Time_description 1 +Melodic_req 1 +Midi_walker 1 +Stem_req 1 +Group_change_req 1 +Script_req 1 +Colinfo 1 +Word_wrap 1 +Text_req 1 +Script_def 1 +Text_def 1 +Paperdef 1 +Symtable 1 +Symtables 1 diff --git a/.version b/.version index 22587f334f..60504f1847 100644 --- a/.version +++ b/.version @@ -1,6 +1,8 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 39 +TOPLEVEL_PATCH_LEVEL = 40 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = -1# include separator: "-1" or ".a" +# include separator: ".postfix", "-pl" makes rpm barf + +TOPLEVEL_MY_PATCH_LEVEL = # diff --git a/ANNOUNCE b/ANNOUNCE index 48bbdd0cbd..df31a15ba0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,3 +1,5 @@ +[Draft version] +[Draft version] CALL FOR HACKERS: LilyPond, the Music Typesetter diff --git a/Documentation/README.pod b/Documentation/README.pod index 96c5ea4dd5..90376b754a 100644 --- a/Documentation/README.pod +++ b/Documentation/README.pod @@ -139,11 +139,11 @@ Show the warranty with which LilyPond comes. (It comes with B!) Set the default output file to F. -=item B<-h,--help>, +=item B<-h,--help>, Show a summary of usage -=item B<-i,--init=>F +=item B<-i,--init=>F set init file to F (default: F) @@ -177,18 +177,17 @@ GNU C++ v2.7 or better, with libg++ installed. Version 2.7.2 or better recommended. I doubt if it will compile with AT&T CC. =item * -GNU make. +Bash. Most scripts will continue to work with a stock sh, but they +will generate (harmless) syntax errors =item * -Flex (2.5.1 or better) +GNU make. =item * -Bison. +Flex (2.5.1 or better). =item * -The "Flower" library, which should be available from the same -source you got this from. The version of flower lib should match the -one which is found in the F script. +Bison. =item * Perl. The Makefile uses Perl for trivial operations, and you diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 79e511498e..2c5ceb2cb9 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -23,11 +23,11 @@ A1: Currently (patchlevel 27), LilyPond (and flowerLib) compiles, links and runs on windhoos-nt, using the cygnus gnu port (release b17.1). I (JCN) only had to make a minor workaround for missing library calls. Have a look at http://www.cygnus.com/gnu-win32. To make LilyPond type -make $OS. (I am not promising to maintain this platform, it is just that -when having to use doze, i-m sometimes too lazy to reboot.) +C. (I am not promising to maintain this platform, it is just +that when having to use doze, i-m sometimes too lazy to reboot.) -A2: I haven't had time to find a GCC crosscompiler (*with* g++, mind you) to -DOS/win (in rpm, please :). +A2: I haven't had time to find a GCC crosscompiler (I g++ and +libg++, mind you) to DOS/win (in rpm, please :). Q: Why GPL? @@ -54,7 +54,7 @@ Q: Why do I need g++ >= 2.7? A: By using g++ LilyPond is portable to all platforms which support g++ (there are quite a few). Not having to support other compilers -saves us a *lot* of trouble. LilyPond & FlowerLib uses: +saves us a I of trouble. LilyPond & FlowerLib uses: =over 6 diff --git a/Documentation/index.pod b/Documentation/index.pod index f473d9c456..4e12783de1 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -86,4 +86,15 @@ MIDI output > The DOC++ documentation of the C++ sources. \ No newline at end of file +> + +=item * + +Get it! + + +=head1 AUTHOR + +Han-Wen Nienhuys , for this page diff --git a/INSTALL b/INSTALL index 29161e6fc4..e6fe95267a 100644 --- a/INSTALL +++ b/INSTALL @@ -29,7 +29,7 @@ INSTALL: to make LilyPond under, brr, aargh, well, simply type: - bash bin/configure + bash configure make win32 \end{masochist} diff --git a/Makefile b/Makefile index b8abfd8b66..bbbf5763ce 100644 --- a/Makefile +++ b/Makefile @@ -33,15 +33,16 @@ include ./$(depth)/make/Variables.make # descent order into subdirectories: # -SUBDIRS = flower lib lily m2m \ - Documentation bin init input make tex +SUBDIRS = flower lib lily mi2mu \ + Documentation bin init input tex make # # list of distribution files: # -SYMLINKS = configure +# SYMLINKS = # naah, configure +SCRIPTS = configure README_FILES = ANNOUNCE COPYING INSTALL NEWS README TODO -DISTFILES= Makefile .version $(README_FILES) $(SYMLINKS) +DISTFILES= Makefile .dstreamrc .version $(README_FILES) $(SCRIPTS) $(SYMLINKS) # # generic targets and rules: diff --git a/NEWS b/NEWS index 4441132305..999d01b5a6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,46 @@ +pl 40 + - release + +pl 39-5 + - own versioning for mi2mu + - some file renaming mi2mu +pl 39-4 + - all of the above + +pl 39-hwn2 + - last bar bugfix +Internal + - simple dynamics + - experimental RPM spec. + - doco update. + +pl 39-3 + - all of the above + - m2m renamed to mi2mu + - better line breaking in mi2mu + - (somewhat broken) progress indicator for mi2mu + - mi2mu output === lily input (in names and durations, + always assuming voices > 1 though) + +Bugfix + - midi: note on/off only once per pitch per track + (sending all note-on events introduces cool mi2mu feature) + - make clean removes deps too + - mi2mu notename/accidental/octave, and key fixed + +Internal + - auto create of out-dirs, config headers, using tag file .GENERATE + +Examples + - stanchen.ly debugged + +pl 39-2 + - configure script help and in topdir again, duh. + - auto configure upon virgin make + - configured makefile stuff in make/out/ + + +******** pl 39-1 - doze target (for 16 bit dos xcompiler: gcc-go32) Internal @@ -34,7 +77,7 @@ Bugfix pl 38-5 - all of the below, e.g. new filenames and new makefile structure patches merged - +****** pl 38 Internal diff --git a/README b/README index 5bfa9c21c5..8a04265c35 100644 --- a/README +++ b/README @@ -9,12 +9,14 @@ version, then this is version is *not* meant for producing nice output ==================== -Please refer to the directory Documentation/, Documentation/README.* +Please refer to the directory Documentation/, Documentation/README.*. To generate the pretty-printed docs, do this: make doc +You can also simply read the .pod source. It is ASCII text. + ====================== NOTE: diff --git a/TODO b/TODO index 87d3ef806c..b3d03f91ba 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ before 0.1 - * remove spurious/outdated comments in .ly + * remove spurious/outdated comments in .ly, debug .ly * pushgroup, popgroup. @@ -14,6 +14,8 @@ before 0.1 * caching of Register_group_register hierarchies. + * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) + This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about @@ -24,8 +26,12 @@ STUFF * do platform stuff: configure, header(s), targets, build (out?) + * make install. + BUGS + * barf if no score_wde_music + * plet bugs: scales.ly * key at clef change. @@ -96,12 +102,12 @@ SMALLISH PROJECTS * use (char *) iso. String for communication between lexer and parser. - * configure idealspacing: arithmetic spacing - - * fix linking: `Warning: size of symbol' + * configure idealspacing: arithmetic * collision Request_register. + * make install (gnu dir names) + * LilyPond .rpm and .deb DOC @@ -144,6 +150,8 @@ FUTURE IDEAS + * integrate Register/Midi stuff + * create libmudela, or liblily_frontend * Horizontal_align_item, Vertical_align_item. diff --git a/bin/Makefile b/bin/Makefile index 2549e4255f..e9f5521e5e 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -14,7 +14,7 @@ include ./$(depth)/make/Stuff.make # list of distribution files: # -SCRIPTS = clearlily configure cpgento genheader make_patch make_fversion make_version make_website +SCRIPTS = clearlily cpgento genheader make_patch make_fversion make_version make_website DISTFILES = Makefile $(SCRIPTS) # diff --git a/bin/configure b/bin/configure deleted file mode 100755 index 0c647c284d..0000000000 --- a/bin/configure +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# -# project LilyPond -- the musical typesetter -# title (bash/sh/ksh) script to setup library and auto generated files -# file bin/configure -# -# Copyright (c) 1997 by -# Han-Wen Nienhuys -# Jan Nieuwenhuizen -# - -MAKE=${MAKE:-make} -NEEDFLOWERVER=1.1.6 -PREFIX=${PREFIX:-.} - - -############# -############# - -# without "function" ok for ksh, bash -setversion() { - eval `sed -n 's/^\([A-Z_]*\)[ ]*=[ ]*\([^ \#]*\).*$/\1=\2/p' $1` -# NEWVER=$TOPLEVEL_MAJOR_VERSION.$TOPLEVEL_MINOR_VERSION.$TOPLEVEL_PATCH_LEVEL$TOPLEVEL_MY_PATCH_LEVEL - NEWVER=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL$MY_PATCH_LEVEL - echo - echo "Current version ("`pwd`") is:" - echo " $NEWVER" - echo -} - -do_outdir() { - if [ \! -d $1/out ] - then - mkdir $1/out - echo 0 > $1/.build - fi -} - -echo using PREFIX=$PREFIX -echo I need Flower version $NEEDFLOWERVER - -flowertar=flower-$NEEDFLOWERVER - -#ugh -do_outdir flower/lib -do_outdir Documentation -do_outdir lib -do_outdir lily -do_outdir m2m - -# mmm -if [ -x flower ] -then - echo Found flowerdir -else - if [ -d $flowertar ] - then - ln -fs $flowertar flower - elif [ -d ../$flowertar ] - then - ln -fs ../$flowertar flower - else - echo "can't find $flowertar" - exit 1; - fi -fi - -echo Configuring Flower Library -setversion ./flower/.version -if [ $NEWVER != $NEEDFLOWERVER ]; then - echo "You seem to be having an incorrect version of the Flower library" -else - echo "You got the correct Flower version." -fi - -#ugh -echo '#define LIBDIR "'$PREFIX'/"'> lib/out/config.hh -touch flower/lib/out/flower-config.hh -touch make/Site.make -$MAKE -C make -f Initial.make - -echo "The sources are ready for compiling. " -echo "To make sure that you don't have any stale dependencies: do" -echo " make clean" - diff --git a/bin/genheader b/bin/genheader index 7c36afe0ae..fba3c1559e 100755 --- a/bin/genheader +++ b/bin/genheader @@ -8,10 +8,15 @@ my @pw=(getpwuid($<)); my $username=$pw[6]; my $what="implement "; $what = "declare " if ($hh_q); +my ($PROJECT, $cwd); +$PROJECT = "the LilyPond music typesetter"; +chop($cwd = `pwd`); + +$PROJECT= "the Flower Library" if ($cwd =~ /flower/); my $headstr ="/* $fn -- $what - source file of the LilyPond music typesetter + source file of $PROJECT (c) 1997 $username <$MAILADRESS> */\n"; diff --git a/bin/make_patch b/bin/make_patch index 290e2e33da..f74f1ea0cd 100755 --- a/bin/make_patch +++ b/bin/make_patch @@ -21,7 +21,7 @@ then echo cant find $newarc exit fi - tar zfxv $newarc + tar zfx $newarc fi if [ ! -x $nm$old ] then @@ -29,10 +29,10 @@ then if [ ! -f $oldarc ] then - echo cant find oldarc + echo cant find $oldarc exit fi - tar zfxv $oldarc + tar zfx $oldarc fi #(cd $nm$old; touch depend; make clean) diff --git a/bin/make_website b/bin/make_website index 844e60bbd1..5b360b94fb 100755 --- a/bin/make_website +++ b/bin/make_website @@ -8,20 +8,25 @@ sub } } +sub all_refs +{ + print "resetting refs.\n"; + + foreach $a (<*.html>) + { + rename $a, "$a~"; + open HTMLIN, "$a~"; + open HTMLOUT, ">$a"; + set_hrefs; + } +} + local $base="lilypond/"; local @examples=("wohltemperirt"); system 'pod2html'; -print "resetting refs.\n"; - -foreach $a (<*.html>) -{ - rename $a, "$a~"; - open HTMLIN, "$a~"; - open HTMLOUT, ">$a"; - set_hrefs; -} +print "generating examples"; foreach $a (@examples) { $texfile="test"; diff --git a/configure b/configure deleted file mode 120000 index 58b4a5f592..0000000000 --- a/configure +++ /dev/null @@ -1 +0,0 @@ -bin/configure \ No newline at end of file diff --git a/configure b/configure new file mode 100755 index 0000000000..2e50a3fbf4 --- /dev/null +++ b/configure @@ -0,0 +1,59 @@ +#!/bin/sh +# +# project LilyPond -- the musical typesetter +# title (bash/sh/ksh) script to setup library and auto generated files +# file configure +# +# Copyright (c) 1997 by +# Han-Wen Nienhuys +# Jan Nieuwenhuizen +# + +MAKE=${MAKE:-make} +PREFIX=${PREFIX:-.} + +# this whole script sux, but here we go: +opt="`echo $1 | cut -c 1-3`" +if [ "$opt" = "-h" -o "$opt" = "--h" ] +then + echo "Usage:" + echo " [MAKE=make] configure [options]" + echo + echo "options:" + echo " -h, --help this text" + echo + echo "e.g.: MAKE=gmake configure" + exit +fi + +############# +############# + +do_outdir() { + if [ \! -d $1/out ] + then + mkdir $1/out + echo 0 > $1/.build + fi +} + +echo using PREFIX=$PREFIX + +#ugh # dist ze dan!, nou stiekem wordt "out" later toch "loes" of "doze" +# do_outdir flower/lib +# now all make rules! + +echo Configuring Flower Library + +#ugh, now all make rules +# the _real_ config stuff should be generated here, though. +# echo '#define LIBDIR "'$PREFIX'/"'> lib/out/config.hh +# touch flower/lib/out/flower-config.hh +# touch make/out/Site.make + +$MAKE -C make -f Initial.make + +echo "The sources are ready for compiling. " +echo "To make sure that you don't have any stale dependencies: do" +echo " make clean" + diff --git a/flower/.version b/flower/.version index 5a44cc8816..45d4ace492 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 6 +PATCH_LEVEL = 7 # use to send patches, always empty for released version: -MY_PATCH_LEVEL = -1# include separator: "-1" or ".a" +MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/Makefile b/flower/Makefile index 779f1e5b82..f4ab0e668f 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -5,6 +5,9 @@ $(staticlib): $(obs) fversion.hh include deps/*.dep +flower-config.hh: + touch flower-config.hh + deps/*.dep: touch deps/dummy.dep diff --git a/flower/NEWS b/flower/NEWS index 36c03ddcd4..faa08528d7 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,6 @@ +pl 1.1.5 + - memmem interface, conditional compilation + - snprintf pl 1.1.4 - great file-renaming. diff --git a/flower/TODO b/flower/TODO index 2026c95134..26061b740c 100644 --- a/flower/TODO +++ b/flower/TODO @@ -1,5 +1,7 @@ * shared lib. + * LGPL? + * integrate Make mechanisms of flower & lily * disable this auto conv: const pointer -> bool -> string diff --git a/flower/Variables.make b/flower/Variables.make index 564acd8c63..23a14e903a 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,6 @@ MAJVER=1 MINVER=1 -PATCHLEVEL=4 +PATCHLEVEL=5 PACKAGENAME=flower diff --git a/flower/fproto.hh b/flower/fproto.hh index 57469fead5..8c6fda680e 100644 --- a/flower/fproto.hh +++ b/flower/fproto.hh @@ -7,6 +7,8 @@ #ifndef FPROTO_HH #define FPROTO_HH +#include "flower-config.hh" + template struct Array; template struct sstack; template struct Assoc; diff --git a/flower/lib/Makefile b/flower/lib/Makefile index 0eccc67beb..9bb2cfff69 100644 --- a/flower/lib/Makefile +++ b/flower/lib/Makefile @@ -13,6 +13,11 @@ depth = ../.. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = flower @@ -21,14 +26,9 @@ include ./$(depth)/flower/.version build = ./$(depth)/flower/lib/.build # -# generic variables: -# -include ./$(depth)/make/Variables.make -# - # descent order into subdirectories: # -SUBDIRS = include +SUBDIRS = include # # to be remade each build: @@ -38,17 +38,17 @@ VERSION_DEPENDENCY =# # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES =# $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -75,9 +75,9 @@ MAINTARGET = $(libdir)/$(LIBRARY)# huh? default: $(MAINTARGET) # -# sic. -$(include-flower)/flower-config.hh: - touch $@ +# # sic. +# $(include-flower)/flower-config.hh: +# touch $@ # generic targets and rules: # @@ -85,8 +85,13 @@ include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/flower/lib/dstream.cc b/flower/lib/dstream.cc index e6fdbc0e4d..1197dd79e7 100644 --- a/flower/lib/dstream.cc +++ b/flower/lib/dstream.cc @@ -1,3 +1,5 @@ + + #include #include "assoc.hh" #include "dstream.hh" @@ -53,7 +55,8 @@ Dstream::identify_as(String name) local_silence = (*silent)[idx]; if (classname != idx && !local_silence) { classname=idx; -// *os << "[" << classname << ":]"; // messy. + if (!(*silent)["Dstream"]) + *os << "[" << classname << ":]"; // messy. } return *this; } diff --git a/flower/lib/include/flower-config.hh b/flower/lib/include/flower-config.hh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/flower/lib/include/fproto.hh b/flower/lib/include/fproto.hh index 8c6fda680e..bf8a22211c 100644 --- a/flower/lib/include/fproto.hh +++ b/flower/lib/include/fproto.hh @@ -7,6 +7,13 @@ #ifndef FPROTO_HH #define FPROTO_HH +// what the F*** is "int" ? +// depreciate int, long, etc., use i32, i64, remember: linux-16/linux-64 ? +/// (i32) +typedef int i32; +/// (i64) +typedef long long I64; + #include "flower-config.hh" template struct Array; @@ -19,7 +26,9 @@ template struct Cursor; template struct PCursor; template struct Link; template struct Handle; -templatestruct Interval_t; +template struct Interval_t; +template struct PQueue; + #include "real.hh" typedef Interval_t Interval; diff --git a/flower/lib/include/pqueue.hh b/flower/lib/include/pqueue.hh index 195232317e..c8dfe1bea6 100644 --- a/flower/lib/include/pqueue.hh +++ b/flower/lib/include/pqueue.hh @@ -15,6 +15,8 @@ /** Stupid Prioq. Should use Lists and STL. Smallest is put at the front. + +Actually, this sux. Should use a template struct PQuee_ent */ template @@ -22,23 +24,47 @@ struct PQueue { Array value_arr_; Array indices_arr_; - + void OK() const + { + + assert(value_arr_.size() == indices_arr_.size()); + } + void enter(V v, I idx) { int j=0; for (; j < value_arr_.size(); j++) if (indices_arr_[j] > idx) break; - value_arr_.insert(v, j); - indices_arr_.insert(idx, j); + insert(j,v,idx); + } int size() { return value_arr_.size(); } V front_val() { return value_arr_[0]; } I front_idx() { return indices_arr_[0]; } + void del(int i) + { + value_arr_.del(i); + indices_arr_.del(i); + } + int size() const + { + OK(); + return value_arr_.size(); + } + + + void insert(int j, V v, I idx) + { + value_arr_.insert(v, j); + indices_arr_.insert(idx, j); + } + + + V get() { V retval = front_val(); - value_arr_.del(0); - indices_arr_.del(0); + del(0); return retval; } diff --git a/flower/lib/include/string-convert.hh b/flower/lib/include/string-convert.hh index bcf461f8f3..f6bcfa7fae 100644 --- a/flower/lib/include/string-convert.hh +++ b/flower/lib/include/string-convert.hh @@ -30,14 +30,16 @@ public: static int dec2_i( String dec_str ); static double dec2_f( String dec_str ); static String double_str(double f, char const* fmt=0); - static int hex2int_i( String str ); + static int hex2_i( String str ); + static unsigned hex2_u( String str ); static String hex2bin_str( String str ); static String int_str(int i, char const *fmt=0 ); static String i2hex_str( int i, int length_i, char ch ); + static String u2hex_str( unsigned u, int length_i, char ch ); static String i2dec_str( int i, int length_i, char ch ); static String rational_str(Rational); static String pointer_str(const void *); - static String longlong_str(long long , char const * fmt = 0); + static String i64_str(I64, char const * fmt = 0); }; #endif // __STRING_CONVERT_HH // diff --git a/flower/lib/string-convert.cc b/flower/lib/string-convert.cc index 47649dcc88..0e2566f087 100644 --- a/flower/lib/string-convert.cc +++ b/flower/lib/string-convert.cc @@ -6,6 +6,7 @@ #include +#include #include "libc-extension.hh" #include "string.hh" #include "string-convert.hh" @@ -62,11 +63,11 @@ String_convert::dec2_i( String dec_str ) } String -String_convert::longlong_str(long long ll, char const* fmt) +String_convert::i64_str( I64 i64, char const* fmt) { char buffer[STRING_BUFFER_LEN]; snprintf(buffer, STRING_BUFFER_LEN, - (fmt ? fmt : "%Ld"), ll ); // assume radix 10 + (fmt ? fmt : "%Ld"), i64 ); // assume radix 10 return String(buffer); } @@ -143,20 +144,34 @@ String_convert::i2dec_str( int i, int length_i, char ch ) // stupido. Should use int_str() String -String_convert::i2hex_str( int i, int length_i, char ch ) +String_convert::u2hex_str( unsigned u, int length_i, char fill_ch ) { String str; - if ( !i ) + if ( !u ) str = "0"; - while ( i ) { - str = String( ( i % 16 )["0123456789abcdef"] ) + str; - i /= 16; + +#if 1 // both go... + while ( u ) { + str = String( (char)( ( u % 16 )["0123456789abcdef"] ) ) + str; + u /= 16; } - if ( str.length_i() < length_i ) - str = String( ch, length_i - str.length_i() ) + str; +#else + str += int_str( u, "%x" ); +#endif + + str = String( fill_ch, length_i - str.length_i() ) + str; + while ( ( str.length_i() > length_i ) && ( str[ 0 ] == 'f' ) ) + str = str.mid_str( 2, INT_MAX ); + return str; } +String +String_convert::i2hex_str( int i, int length_i, char fill_ch ) +{ + return u2hex_str( (unsigned)i, length_i, fill_ch ); +} + Byte String_convert::nibble2hex_byte( Byte byte ) { @@ -230,6 +245,6 @@ String_convert::rational_str(Rational r) String String_convert::pointer_str(const void *l) { - long long int ill = (long long int )l; - return String_convert::longlong_str(ill, "0x%0Lx"); + I64 i64 = (I64)l; + return String_convert::i64_str(i64, "0x%0Lx"); } diff --git a/flower/libc-extension.cc b/flower/libc-extension.cc index b663088d76..f9a255683e 100644 --- a/flower/libc-extension.cc +++ b/flower/libc-extension.cc @@ -5,7 +5,7 @@ (c) 1997 Han-Wen Nienhuys */ - +#include #include #include #include "libc-extension.hh" @@ -13,7 +13,7 @@ /* compensate for lacking libc functions. */ - char* +char* strnlwr( char* start_l ,int n) { char * p = start_l + n; @@ -23,7 +23,7 @@ strnlwr( char* start_l ,int n) return start_l; } - char* +char* strnupr( char* start_l, int n) { char * p = start_l + n; @@ -33,13 +33,15 @@ strnupr( char* start_l, int n) return start_l; } +#ifndef HAVE_MEMMEM + /** locate a substring. #memmem# finds the first occurrence of #needle# in #haystack# */ - char * -memmem(const Byte * haystack, const Byte *needle, - int haystack_len, int needle_len) +char * +memmem(const Byte * haystack, int haystack_len, + const Byte *needle,int needle_len) { const Byte * end_haystack = haystack + haystack_len - needle_len; const Byte * end_needle = needle + needle_len ; @@ -61,6 +63,7 @@ memmem(const Byte * haystack, const Byte *needle, } return 0; } +#endif Byte * memrchr(const Byte * p, int n, char c) @@ -96,3 +99,15 @@ strrev( Byte* byte_l, int length_i ) } return byte_l; } + +#ifndef HAVE_SNPRINTF +int snprintf ( char *str, size_t n, + const char *format, ... ) +{ + va_list ap; + va_start(ap, format); + int i = vsprintf(str, format, ap); + va_end(ap); + return i; +} +#endif diff --git a/flower/libc-extension.hh b/flower/libc-extension.hh index e06feb5af4..e71037c41e 100644 --- a/flower/libc-extension.hh +++ b/flower/libc-extension.hh @@ -13,13 +13,20 @@ char* strnlwr( char* start_l ,int n); char* strnupr( char* start_l, int n); -/* - should use void* like in libc - */ -char *memmem(const Byte * haystack, const Byte *needle, - int haystack_len, int needle_len); + +#ifndef HAVE_MEMMEM // GNU extension. +char *memmem(const Byte * haystack, int haystack_len, + const Byte *needle, int needle_len); +#endif HAVE_MEMMEM + +#ifndef HAVE_SNPRINTF // GNU extension. +int snprintf (char *str, size_t n, + const char *format, ... ); +#endif + + Byte *memrchr(const Byte * p, int n, char c); -Byte*strrev( Byte* byte_l, int length_i ); +Byte *strrev( Byte* byte_l, int length_i ); #endif // LIBC_EXTENSION_HH diff --git a/flower/string.cc b/flower/string.cc index b4687c0b7f..60038f6a55 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -152,9 +152,8 @@ String::compare_i(String const& s1, String const& s2 ) int i1 = s1.length_i(); int i2 = s2.length_i(); - int i = i1 = length_i() ) || ( n < 1 ) ) return String(); diff --git a/flower/test/Makefile b/flower/test/Makefile new file mode 100644 index 0000000000..0ec87161b5 --- /dev/null +++ b/flower/test/Makefile @@ -0,0 +1,106 @@ +# +# project LilyPond -- the musical typesetter +# title makefile for flowertest +# file test/Makefile +# +# Copyright (c) 1997 by +# Jan Nieuwenhuizen +# Han-Wen Nienhuys +# + +# subdir level: +# +depth = ../.. +# + +# identify module: +# +NAME =stringtest +# include ./$(depth)/$(NAME)/.version +MODULE_NAME = flower +include ./$(depth)/flower/.version +build = ./$(depth)/flower/lib/.build +# + +# generic variables: +# +include ./$(depth)/make/Variables.make +# + +# descent order into subdirectories: +# +SUBDIRS = +# + +# to be remade each build: +# +VERSION_DEPENDENCY = # +# + +# module compile settings: (not generally needed! +# +EXTRA_CFLAGS = -DSTRING_TEST +EXTRA_CXXFLAGS = +EXTRA_LDFLAGS = +# + +# list of c++ header files: +# +# HHFILES = $(shell ls *.hh $(ERROR_LOG)) +# + +# list of c++ source files: +# +CCFILES = $(shell ls *.cc $(ERROR_LOG)) +# + +# list of other source files: +# +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) +# + +# list of distribution files: +# +DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES) +# + +# list of custom libraries: +# +CUSTOMLIBES = $(LIBFLOWER)\ + +LOADLIBES += +# + + +# main target of this module: +# +# MAINTARGET = $(EXECUTABLE) +# MAINTARGET = $(LIBRARY) +MAINTARGET = $(bindir)/$(EXECUTABLE)# huh? +# MAINTARGET = $(libdir)/$(LIBRARY)# huh? + +#default: $(MAINTARGET) +BUILDSTRINGTEST=$(MAINTARGET) +EXECSTRINGTEST=$(EXECUTABLE) +default: $(BUILDSTRINGTEST) do-stringtest +do-stringtest: + $(EXECSTRINGTEST) # should return error value if test fails + +dummy: + +# generic targets and rules: +# +include ./$(depth)/make/Targets.make +include ./$(depth)/make/Rules.make +# + +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + +# auto dependencies: +# +-include $(DEPFILES) +# + diff --git a/flower/test/stringtest.cc b/flower/test/stringtest.cc new file mode 100644 index 0000000000..5b4ace1b2f --- /dev/null +++ b/flower/test/stringtest.cc @@ -0,0 +1,130 @@ +#ifdef STRING_TEST +/* + stupid test program to verify stringlib + stringtest.cc + */ +#include +#include "string.hh" +#include "varray.hh" +#include "string-convert.hh" + +void +ctors() +{ + cout << "constructors"< a; + a.push("abcd"); + a.push("zxy"); + a.push("abc"); + a.push(""); + a.sort(String::compare_i); + cout << "compares: "< g [ g( f )e ]2/3 | + a4.^> g [ g()f e ]2/3 | %%8 f2 r4 | %%9 @@ -64,15 +64,15 @@ melodie = music { $ \clef\violin %%10 { 'f2. 'd2. } | %%11 - [ a_"\pp"( )bes a ]2/3 'f4. a | + [ a\pp( )bes a ]2/3 'f4. a | %%12 [ g( ) a g ]2/3 'e4. 'd | %%13 'c4. bes [ bes( ) a g ]2/3 | %%14 a2 r -% { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f_"\p"( | )e4._"dolce" bes [ g ]2/3 } } | - { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f_"\p"( | )e4._"dolce" bes \plet{ 2/3 } g \plet{ 1/1 } } } | +% { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f\p( | )e4._"dolce" bes [ g ]2/3 } } | + { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f\p( | )e4._"dolce" bes \plet{ 2/3 } g \plet{ 1/1 } } } | %%16 { a2. f2. } | %%17 @@ -83,7 +83,7 @@ melodie = music { $ \clef\violin [ 'd8. a16 ] f4. d | %%19 %#% 'c\grace\stemup - [ bes_"\pp"( ) a bes ]2/3 'd4. bes | + [ bes\pp( ) a bes ]2/3 'd4. bes | %%20 a2. | %%21 @@ -93,28 +93,28 @@ melodie = music { $ \clef\violin %#% =f2. | f2. | %%23 - [ a8._"\mf" 'cis16 ] 'f4. 'e | + [ a8._\mf 'cis16 ] 'f4. 'e | %%24 [ 'd8. a16 ] fis4. d | %%25 %#% 'cis\grace\stemup - [ b_"\mf"( ) ais b ]2/3 'd4. b | + [ b_\mf( ) ais b ]2/3 'd4. b | %%26 { a2. fis2. } | %#%\tighten\newline %%27 - [ 'e_"\f"( )'dis 'e ]2/3 'g4. 'cis | + [ 'e_\f( )'dis 'e ]2/3 'g4. 'cis | %%28 { 'd2. fis2. } | %#%\volta1 %%29 - { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2_"\mf" [ bes8. bes16 ] } } | + { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2_\mf [ bes8. bes16 ] } } | %%30 - { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ f-.( f-. )f-. ] } } | + { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-. ] } } | %%31 { \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } | %%32 - { a2 fis2_"\pp" } { a4 fis4 } | + { a2 fis2_\pp } { a4 fis4 } | %%33 %#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] | { \music{ b2( [ 'd8.( ) )g16 ] } \music{ g2 [ b8. b16 ] } } | @@ -141,23 +141,23 @@ melodie = music { $ \clef\violin 'cis2 r4 | %%41 %#% { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] | - { 'fis4. 'cis4._"\f" } 'e [ 'e( )'d 'cis ]2/3 | + { 'fis4. 'cis4.\f } 'e [ 'e( )'d 'cis ]2/3 | %%42 [ b8. 'cis16 ] 'd4^> b r | %%43 %#% [^ { b8._{ }_{ }_{ }_{ }_{ }_f g2. } 'cis16 ] 'd4^> b r | - [ b8._"\f" 'cis16 ] 'd4^> b r | + [ b8.\f 'cis16 ] 'd4^> b r | %%44 %#% [^ { > b8. fis2 } 'cis16 ] 'd4^> b >! r | [ b8. 'cis16 ] 'd4^> b r | %%45 %#% 'cis\grace\stemup - [ b_"\p"( )ais b ]2/3 'd4. b | + [ b\p( )ais b ]2/3 'd4. b | %%46 %#% { =a2. fis2. } | { a2. fis2. } | %%47 - [ 'e_"\f"( )'dis 'e ]2/3 'g4.^> 'cis | + [ 'e\f( )'dis 'e ]2/3 'g4.^> 'cis | %%48 %#% { fis2.(v ='d2.\stemup(^ } % { fis2. 'd2. } | @@ -171,7 +171,7 @@ melodie = music { $ \clef\violin %%51 { a2. cis2. } | %%52 - { fis2 d2 } { a4 f4_"\pp" } | + { fis2 d2 } { a4 fis4_\pp } | %%53 %#% { bes2 g2 } [ { 'd8.^>( bes8. } { ) bes16 g16 } ] | { bes2 g2 } { [ 'd8.^> bes8. } { bes16 g16 ] } | @@ -220,7 +220,7 @@ begeleiding = music { $ %%8 { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } | %%9 - [ `a e f e f e ] | + [ `a e g e g e ] | %%10 [ `d `a d `a d `a ] | %%11 @@ -228,7 +228,7 @@ begeleiding = music { $ %%12 == 6 { \multivoice \music{ \stem{ 1 } [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } | %13 - { \multivoice \music{ [ `e `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } | + { \multivoice \music{ [ `e `g `bes `g `bes `g ] } \music { \stem{ -1 } `c2 r4 } } | %%14 { \multivoice \music{ \stem{ 1 } [ `a c f c f c ] } \music { \stem{ -1 } `f2 r4 } } | %%15 @@ -268,7 +268,7 @@ begeleiding = music { $ %%30 [ `d `fis `a `fis `a `fis ] | %%31 - [ `a `e `a `e `a `e ] | + [ ``a `e `a `e `a `e ] | %%32 [ `d `fis `a `fis `a `fis ] | %%33 @@ -276,21 +276,21 @@ begeleiding = music { $ %%34 [ `d `fis `a `fis `a `fis ] | %%35 - [ `a `e `a `e `a `e ] | + [ ``a `e `a `e `a `e ] | %%36 [ `d `fis `a `fis `a `fis ] | %#%\volta2 %#%:| %%37 - [ `a `e `g `e ``bes^> `e ] | + [ ``a `e `g `e ``bes^> `e ] | %%38 - [ `a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } | + [ ``a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } | %%39 - [ `a `e `g `e ``bes^> `e ] | + [ ``a `e `g `e ``bes^> `e ] | %%40 - [ `a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } | + [ ``a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } | %%41 - [ `ais `e `gis `e `gis `e ] | + [ ``ais `e `fis `e `fis `e ] | %%42 { [ `d ``b } `fis `b `fis `b `fis ] | %%43 @@ -311,7 +311,7 @@ begeleiding = music { $ %%50 [ ``g `e `g `e `g `e ] | %%51 - [ `a `e `g `e `g `e ] | + [ ``a `e `g `e `g `e ] | %%52 [ ``d `d `fis `d `fis `d ] | %%53 @@ -319,7 +319,7 @@ begeleiding = music { $ %%54 [ `d `fis `a `fis `a `fis ] | %%55 - [ `a `e `g `e `g `e ] | + [ ``a `e `g `e `g `e ] | %%56 [ ``d ``a `d ``a `d ``a ] | %%57 @@ -487,6 +487,6 @@ score { output "standchen.out" } midi { - tempo 4:60 + tempo 4:54 } } diff --git a/lib/Makefile b/lib/Makefile index 7da9879256..7609ecaa8b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -13,6 +13,11 @@ depth = .. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = lily @@ -21,12 +26,7 @@ MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION) PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL) # use to send patches, always empty for released version: MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL) -build = ./$(depth)/lily/.build -# - -# generic variables: -# -include ./$(depth)/make/Variables.make +build = $(lily-dir)/.build # # descent order into subdirectories: @@ -36,22 +36,22 @@ SUBDIRS = include # to be remade each build: # -VERSION_DEPENDENCY = $(lily-version) +VERSION_DEPENDENCY =# # # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES = # $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = # $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -84,8 +84,13 @@ include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/lib/include/config.hh b/lib/include/config.hh deleted file mode 100644 index ca44f294d7..0000000000 --- a/lib/include/config.hh +++ /dev/null @@ -1 +0,0 @@ -#define LIBDIR "./" diff --git a/lib/include/proto.hh b/lib/include/proto.hh index e9d3e60d38..4b3a8f91c5 100644 --- a/lib/include/proto.hh +++ b/lib/include/proto.hh @@ -10,10 +10,7 @@ #include "fproto.hh" #include "real.hh" -/// (i64) -typedef long long Int64; - -struct Absdynamic_req; +struct Absolute_dynamic_req; struct Accidental; struct Atom; struct Bar; @@ -22,6 +19,7 @@ struct Barcheck_req; struct Bar_req; struct Beam; struct Beam_req; +struct Blank_req; struct Box; struct Bracket_req; struct Cadenza_req; @@ -41,6 +39,7 @@ struct Duration; struct Duration_iterator; struct Durational_req; struct Dynamic; +struct Dynamic_req; struct Group_change_req; struct Group_feature_req; struct Idealspacing; @@ -88,11 +87,11 @@ struct Midi_track; struct Midi_voice; struct Midi_walker; struct Mixed_qp; -class My_midi_lexer; -class My_midi_parser; -class Midi_event; -class Midi_score; -class Midi_track; +struct My_midi_lexer; +struct My_midi_parser; +struct Midi_event; +struct Midi_score; +struct Midi_track; struct Molecule; struct Musical_req; struct Music_general_chord; @@ -137,7 +136,7 @@ struct Source_file; struct Spacing_req ; struct Span_req; struct Spanner; -struct Blank_req; +struct Subtle_req; struct Staff; struct Staff_column; struct Staff_elem; diff --git a/lily/Makefile b/lily/Makefile index f31a93426a..2302cf627c 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -13,6 +13,11 @@ depth = .. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = lilypond @@ -21,12 +26,7 @@ MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION) PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL) # use to send patches, always empty for released version: MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL) -build = ./$(depth)/lily/.build -# - -# generic variables: -# -include ./$(depth)/make/Variables.make +build = $(lily-dir)/.build # # descent order into subdirectories: @@ -41,17 +41,17 @@ VERSION_DEPENDENCY = $(lily-version) # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES = $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -92,8 +92,13 @@ mylexer.cc: $(outdir)/parser.hh # sic lexer.l: $(outdir)/parser.hh # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/lily/bar.cc b/lily/bar.cc index 32a7cd5fe6..8b831d206a 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -21,7 +21,7 @@ Bar::do_print()const Molecule* Bar::brew_molecule_p()const { - Symbol s = paper()->lookup_p_->bar(type); + Symbol s = paper()->lookup_l()->bar(type); Molecule*output = new Molecule(Atom(s)); return output; } diff --git a/lily/beam.cc b/lily/beam.cc index 64f3e3cf77..b9fbd0a28c 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -111,7 +111,7 @@ Beam::solve_slope() // URG Real sl = slope*paper()->internote(); - paper()->lookup_p_->beam(sl, 20 PT); + paper()->lookup_l()->beam(sl, 20 PT); slope = sl /paper()->internote(); } @@ -207,7 +207,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const Real dy=paper()->internote()*2; Real stemdx = paper()->rule_thickness(); Real sl = slope*paper()->internote(); - paper()->lookup_p_->beam(sl, 20 PT); + paper()->lookup_l()->beam(sl, 20 PT); Molecule leftbeams; Molecule rightbeams; @@ -220,7 +220,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const Symbol dummy; Atom a(dummy); if (lhalfs) // generates warnings if not - a = paper()->lookup_p_->beam(sl, w); + a = paper()->lookup_l()->beam(sl, w); a.translate(Offset (-w, -w * sl)); for (int j = 0; j < lhalfs; j++) { Atom b(a); @@ -234,7 +234,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int rwholebeams = here->beams_right beams_left; Real w = next->hindex() - here->hindex(); - Atom a = paper()->lookup_p_->beam(sl, w + stemdx); + Atom a = paper()->lookup_l()->beam(sl, w + stemdx); int j = 0; for (; j < rwholebeams; j++) { @@ -245,7 +245,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const w /= 4; if (rhalfs) - a = paper()->lookup_p_->beam(sl, w); + a = paper()->lookup_l()->beam(sl, w); for (; j < rwholebeams + rhalfs; j++) { Atom b(a); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 528623eed6..72328b0954 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -46,7 +46,7 @@ Clef_item::brew_molecule_p()const String t = type; if (change) t += "_change"; - Symbol s = paper()->lookup_p_->clef(t); + Symbol s = paper()->lookup_l()->clef(t); Molecule*output = new Molecule(Atom(s)); output->translate(Offset(0, paper()->internote() * y_off)); return output; diff --git a/lily/dynamic-reg.cc b/lily/dynamic-reg.cc new file mode 100644 index 0000000000..88f0b502f4 --- /dev/null +++ b/lily/dynamic-reg.cc @@ -0,0 +1,79 @@ +/* + dynamic-reg.cc -- implement Dynamic_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "dynamic-reg.hh" +#include "musicalrequest.hh" +#include "text-item.hh" +#include "lookup.hh" +#include "paper-def.hh" + +Dynamic_register::Dynamic_register() +{ + dir_i_ =0; + post_move_processing(); + dynamic_p_ =0; +} + +void +Dynamic_register::post_move_processing() +{ + dynamic_req_l_ = 0; +} + +bool +Dynamic_register::try_request(Request * r) +{ + Musical_req * m = r->musical(); + if (!m || !m->dynamic()) + return false; + assert(!dynamic_req_l_); + dynamic_req_l_ = m->dynamic(); + return true; +} +void +Dynamic_register::process_requests() +{ + if(dynamic_req_l_){ + if (dynamic_req_l_->absdynamic()) { + Text_def * td_p = new Text_def; + td_p->align_i_ = 0; + String loud =Dynamic_req::loudness_str( + dynamic_req_l_->absdynamic()->loudness_); + + td_p->text_str_ = paper()->lookup_l()->dynamic(loud).tex; + + + td_p->style_str_ = "dynamic"; + + dynamic_p_ = new Text_item(td_p, 10 ); // TODO! + announce_element(Staff_elem_info(dynamic_p_, dynamic_req_l_)); + } + } +} + +void +Dynamic_register::pre_move_processing() +{ + if (dynamic_p_) { + typeset_element(dynamic_p_); + dynamic_p_ = 0; + } +} + +bool +Dynamic_register::acceptable_request_b(Request*r)const +{ + Musical_req * m = r->musical(); + return (m && m->dynamic()); +} + +void +Dynamic_register::set_feature(Features i) +{ + dir_i_ = i.direction_i_; +} diff --git a/lily/identifier.cc b/lily/identifier.cc index 59f1ff5d83..fbf806edf7 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -41,7 +41,7 @@ DEFAULT_PRINT(Symtables_id, Symtables, symtables); DEFAULT_PRINT(Staff_id, Input_staff, staff); DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord); DEFAULT_PRINT(M_voice_id, Music_voice, mvoice); - +DEFAULT_PRINT(Request_id, Request, request); void Real_id::do_print() const { @@ -54,3 +54,4 @@ Notetab_id::do_print() const { mtor << "unknown" << "\n"; } + diff --git a/lily/include/config.hh b/lily/include/config.hh deleted file mode 100644 index ca44f294d7..0000000000 --- a/lily/include/config.hh +++ /dev/null @@ -1 +0,0 @@ -#define LIBDIR "./" diff --git a/lily/include/dynamic-reg.hh b/lily/include/dynamic-reg.hh new file mode 100644 index 0000000000..cd500c1901 --- /dev/null +++ b/lily/include/dynamic-reg.hh @@ -0,0 +1,30 @@ +/* + dynamic-reg.hh -- declare Dynamic_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef DYNAMIC_REG_HH +#define DYNAMIC_REG_HH + +#include "register.hh" + +struct Dynamic_register : Request_register { + int dir_i_; + Text_item * dynamic_p_; + Dynamic_req* dynamic_req_l_; + /* ************** */ + Dynamic_register(); + virtual bool try_request(Request *req_l); + virtual void process_requests(); + virtual void pre_move_processing(); + virtual void post_move_processing(); + virtual bool acceptable_request_b(Request*) const; + virtual void set_feature(Features); + NAME_MEMBERS(Dynamic_register); +}; + +#endif // DYNAMIC_REG_HH diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 1aa7f7d0c4..aa8d110012 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -7,6 +7,7 @@ #ifndef IDENTIFIER_HH #define IDENTIFIER_HH + #include "identparent.hh" #include "symtable.hh" #include "input-staff.hh" @@ -14,11 +15,12 @@ #include "notename.hh" #include "lookup.hh" #include "script-def.hh" +#include "request.hh" #define make_id_class(Idclass, Class, accessor) \ struct Idclass : Identifier {\ virtual const char *classname() { return #Class; }\ - Idclass(String s, Class*st):Identifier(s) { data = st; }\ + Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\ virtual Class* accessor(bool copy) {\ if (copy)\ return new Class(* (Class*) data);\ @@ -37,6 +39,7 @@ make_id_class(Staff_id, Input_staff, staff); make_id_class(M_chord_id, Music_general_chord, mchord); make_id_class(M_voice_id, Music_voice, mvoice); make_id_class(Notetab_id, Notename_tab, notename_tab); +make_id_class(Request_id, Request, request); #endif // IDENTIFIER_HH diff --git a/lily/include/identparent.hh b/lily/include/identparent.hh index 3e6d566ee7..8071dcd4f5 100644 --- a/lily/include/identparent.hh +++ b/lily/include/identparent.hh @@ -14,11 +14,13 @@ #define IDACCESSOR( Input_staff, staff)\ virtual Input_staff * staff(bool) { error(#Input_staff); return 0; } + struct Identifier { void *data; String name; + int token_code_i_; - Identifier(String n) : name(n) { } + Identifier(String n, int code) : name(n) { token_code_i_ = code; } virtual ~Identifier() {} void print()const; @@ -33,6 +35,8 @@ struct Identifier { IDACCESSOR(Lookup,lookup) IDACCESSOR(Real,real) IDACCESSOR(Notename_tab, notename_tab) + IDACCESSOR(Request, request) + protected: virtual void do_print()const=0; private: diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 524cdf1958..e850586626 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -15,40 +15,40 @@ struct Lookup { /* *************** */ void add(String, Symtable*); void print()const; - Real internote(); + Real internote()const; - Symbol linestaff(int n, Real w); - Symbol fill(Box b); - Symbol beam_element(int,int,Real=0); + Symbol linestaff(int n, Real w)const; + Symbol fill(Box b)const; + Symbol beam_element(int,int,Real=0)const; /// round slope to closest TeXslope - Symbol beam(Real&,Real); + Symbol beam(Real&,Real)const; /** pos == 3 : 3 lines above staff (extending below note) pos == -3: below staff */ - Symbol streepjes(int pos); - - Symbol meter(Array); - Symbol stem(Real y1_pos, Real y2_pos); - Symbol rule_symbol(Real height, Real width); - Symbol accidental(int); - Symbol ball(int); - Symbol flag(int); - Symbol rest(int); - Symbol clef(String); - Symbol bar(String); - Symbol dots(int); - Symbol slur(int dy, Real &dx, int dir); - Symbol half_slur(int dy, Real &dx, int dir, int xpart); - Symbol half_slur_middlepart(Real &dx, int dir); - Symbol big_slur(int dy, Real &dx, int dir); - Symbol text(String style, String text, int align = 1); - Symbol script(String idx); - Symbol hairpin(Real & width, bool decresc); - + Symbol streepjes(int pos)const; + + Symbol meter(Array)const; + Symbol stem(Real y1_pos, Real y2_pos)const; + Symbol rule_symbol(Real height, Real width)const; + Symbol accidental(int)const; + Symbol ball(int)const; + Symbol flag(int)const; + Symbol rest(int)const; + Symbol clef(String)const; + Symbol bar(String)const; + Symbol dots(int)const; + Symbol slur(int dy, Real &dx, int dir)const; + Symbol half_slur(int dy, Real &dx, int dir, int xpart)const; + Symbol half_slur_middlepart(Real &dx, int dir)const; + Symbol big_slur(int dy, Real &dx, int dir)const; + Symbol text(String style, String text, int align = 1)const; + Symbol script(String idx)const; + Symbol hairpin(Real & width, bool decresc)const; + Symbol dynamic(String)const; Lookup(); Lookup(Lookup const &); ~Lookup(); diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index e7c26380f4..fcfcb0c6e0 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -21,12 +21,13 @@ */ class Midi_walker : public PCursor { Midi_track *track_l_; + PQueue stop_notes; Moment last_moment_; /* *************** */ void do_stop_notes(Moment); - + void do_start_note(Note_req *note_l); void output_event(Midi_item&, Moment); public: diff --git a/lily/include/musicalrequest.hh b/lily/include/musicalrequest.hh index 240b72afd9..208e3dc295 100644 --- a/lily/include/musicalrequest.hh +++ b/lily/include/musicalrequest.hh @@ -19,6 +19,9 @@ */ struct Musical_req : virtual Request { virtual Skip_req* skip() { return 0; } + virtual Dynamic_req* dynamic() { return 0; } + virtual Absolute_dynamic_req * absdynamic() { return 0; } + virtual Subtle_req * subtle() { return 0; } REQUESTMETHODS(Musical_req, musical); }; @@ -177,9 +180,9 @@ struct Slur_req : Span_req { }; -/**Put a script above or below this ``note''. eg upbow, downbow. Why a -request? These symbols may conflict with slurs and brackets, so this -also a request */ +/** Put a script above or below this ``note''. eg upbow, downbow. Why + a request? These symbols may conflict with slurs and brackets, so + this also a request */ struct Script_req : Musical_req { int dir_i_; Script_def *scriptdef_p_; @@ -192,7 +195,31 @@ struct Script_req : Musical_req { Script_req(Script_req const&); }; +/** A helper in the hierarchy. Each dynamic is bound to one note ( a + crescendo spanning multiple notes is thought to be made of two + "dynamics": a start and a stop). Dynamic changes can occur in a + smaller time than the length of its note, therefore fore each + Dynamic request carries a time, measured from the start of its + note. + */ +struct Subtle_req : virtual Musical_req { + Moment subtime_; + REQUESTMETHODS(Subtle_req, subtle); +}; +struct Dynamic_req : Subtle_req { + /// for absolute dynamics + enum Loudness { + FFF, FF, F, MF, MP, P, PP, PPP + }; + static String loudness_str(Loudness); + REQUESTMETHODS(Dynamic_req, dynamic); +}; +struct Absolute_dynamic_req : Dynamic_req { + Loudness loudness_; + Absolute_dynamic_req(); + REQUESTMETHODS(Absolute_dynamic_req, absdynamic); +}; #endif // MUSICALREQUESTS_HH diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index ae557258b0..fba93580cb 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -21,10 +21,10 @@ constants. Most of them are related to the point-size of the fonts, so therefore, the lookup table for symbols is also in here. - see TODO */ -struct Paper_def { +class Paper_def { Lookup *lookup_p_; +public: String outfile; Real linewidth; @@ -47,6 +47,7 @@ struct Paper_def { Real standard_height()const; Real note_width() const; void print() const; + const Lookup* lookup_l(); // TODO naming Real duration_to_dist(Moment); }; diff --git a/lily/include/parser.hh b/lily/include/parser.hh deleted file mode 100644 index 3a3d4de3ef..0000000000 --- a/lily/include/parser.hh +++ /dev/null @@ -1,86 +0,0 @@ -typedef union { - Request * request; - Real real; - Identifier *id; - Voice *voice; - Voice_element *el; - String *string; - const char *consstr; - Paper_def *paper; - Midi_def* midi; - Input_music *music; - Music_general_chord *chord; - Music_voice *mvoice; - int i; - char c; - int ii[10]; - Moment *moment; - - Array * strvec; - Array *intvec; - Array *melreqvec; - Input_staff *staff; - Input_score *score; - Symtables * symtables; - Symtable * symtable; - Symbol * symbol; - Lookup*lookup; - Interval *interval; - Box *box; - Notename_tab *notename_tab; - Script_def * script; - Text_def * textdef; -} YYSTYPE; -#define VOICE 258 -#define STAFF 259 -#define SCORE 260 -#define TITLE 261 -#define BAR 262 -#define OUTPUT 263 -#define MULTIVOICE 264 -#define CM_T 265 -#define IN_T 266 -#define PT_T 267 -#define MM_T 268 -#define PAPER 269 -#define WIDTH 270 -#define METER 271 -#define UNITSPACE 272 -#define SKIP 273 -#define COMMANDS 274 -#define COMMAND 275 -#define GEOMETRIC 276 -#define START_T 277 -#define DURATIONCOMMAND 278 -#define OCTAVECOMMAND 279 -#define KEY 280 -#define CLEF 281 -#define TABLE 282 -#define VOICES 283 -#define STEM 284 -#define PARTIAL 285 -#define MUSIC 286 -#define GROUPING 287 -#define CADENZA 288 -#define END 289 -#define SYMBOLTABLES 290 -#define TEXID 291 -#define NOTENAMES 292 -#define SCRIPT 293 -#define TEXTSTYLE 294 -#define PLET 295 -#define GOTO 296 -#define MIDI 297 -#define TEMPO 298 -#define IDENTIFIER 299 -#define PITCHMOD 300 -#define DURATION 301 -#define RESTNAME 302 -#define NOTENAME 303 -#define REAL 304 -#define STRING 305 -#define DOTS 306 -#define INT 307 - - -extern YYSTYPE yylval; diff --git a/lily/include/score-walker.hh b/lily/include/score-walker.hh index b3d304256e..5c766150ac 100644 --- a/lily/include/score-walker.hh +++ b/lily/include/score-walker.hh @@ -26,6 +26,7 @@ class Score_walker : public PCursor int disallow_break_count_; void reinit(); public: + bool break_allowed_b(); void allow_break(Staff_walker*w); Score_walker(Score*); ~Score_walker(); diff --git a/lily/include/staff-column.hh b/lily/include/staff-column.hh index dd6303ea8c..2aa4b8166b 100644 --- a/lily/include/staff-column.hh +++ b/lily/include/staff-column.hh @@ -31,15 +31,15 @@ public: Moment when() const; void set_cols(Score_column *c1, Score_column *c2); - void add(Voice_element*ve); + void add(Voice_element*ve, PQueue &subtle_req_pq ); void OK() const; ~Staff_column(); void typeset_breakable_items(Array &pre_p_arr, Array &nobreak_p_arr, Array &post_p_arr); void typeset_musical_item(Item *i); + void setup_one_request(Request*); protected: - void setup_one_request(Request*); }; diff --git a/lily/include/staff-elem-info.hh b/lily/include/staff-elem-info.hh index 9c6264a86b..c07f242e31 100644 --- a/lily/include/staff-elem-info.hh +++ b/lily/include/staff-elem-info.hh @@ -12,6 +12,7 @@ #include "proto.hh" #include "varray.hh" + /// data container. struct Staff_elem_info { Staff_elem * elem_p_; @@ -19,7 +20,6 @@ struct Staff_elem_info { const Voice * voice_l_; Array origin_reg_l_arr_; - /* *** */ Staff_elem_info(Staff_elem*, Request*); Staff_elem_info(); @@ -30,6 +30,7 @@ struct Staff_info { Staff_walker *walk_l_; const Time_description *time_c_l_; const Rhythmic_grouping *rhythmic_c_l_; + bool break_allowed_b_; }; diff --git a/lily/include/symtable.hh b/lily/include/symtable.hh index f96d02c1ec..5f902c4913 100644 --- a/lily/include/symtable.hh +++ b/lily/include/symtable.hh @@ -8,6 +8,8 @@ #include "symbol.hh" struct Symtable : public Assoc { + String id_str; + Symbol lookup(String)const; void print()const; }; @@ -19,7 +21,7 @@ struct Symtables : private Assoc { ~Symtables(); Symtables(); Symtables(Symtables const&); - Assoc::add; + void add(String, Symtable*); void print()const; }; diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index cc9c3c95b3..b59df7f532 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -17,7 +17,7 @@ struct Text_def { char const* defined_ch_c_l_; - /* ****************/ + /* *************** */ virtual ~Text_def() {}; bool compare(const Text_def&); Text_def(); diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index ae0b556308..d5ff7405e1 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -9,19 +9,26 @@ #include "text-def.hh" #include "item.hh" - -struct Text_item : Item { + +/** + print a fixed width text above or below the staff. + */ +class Text_item : public Item { + void init(Text_def* tdef_l,int staffsize_i); + Text_def* tdef_p_; +public: + Text_def * tdef_l(); int pos_i_; int staffsize_i_; int dir_i_; - Text_def* tdef_l_; - + /* ***************/ + NAME_MEMBERS(Text_item); virtual void set_default_index(); Molecule* brew_molecule_p() const; void do_pre_processing(); - + Text_item(Text_def*,int); Text_item(Text_req*,int); }; diff --git a/lily/key-item.cc b/lily/key-item.cc index 963b1bc578..089eab126f 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -56,13 +56,13 @@ Key_item::brew_molecule_p()const Real inter = paper()->internote(); for (int i =0; i < pitch.size(); i++) { - Symbol s= paper()->lookup_p_->accidental(acc[i]); + Symbol s= paper()->lookup_l()->accidental(acc[i]); Atom a(s); a.translate(Offset(0,(c_position + pitch[i]) * inter)); Molecule m(a); output->add_right(m); } - Molecule m(paper()->lookup_p_->fill(Box( + Molecule m(paper()->lookup_l()->fill(Box( Interval(0, paper()->note_width()), Interval(0,0)))); output->add_right(m); diff --git a/lily/lexer.l b/lily/lexer.l index 6f5945a605..10c5ee6b03 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -12,6 +12,7 @@ #include "input-score.hh" #include "parseconstruct.hh" #include "main.hh" +#include "identparent.hh" %} @@ -89,7 +90,7 @@ COMMENT [%#].*\n Identifier * id = lookup_identifier(c); if (id) { yylval.id = id; - return IDENTIFIER; + return id->token_code_i_; } String *sp = new String( c); yylval.string=sp; diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 425982120c..a0152c9f3c 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -60,7 +60,7 @@ Local_key_item::brew_molecule_p()const octmol= new Molecule; } lastoct = accs[i].octave; - Symbol s =paper()->lookup_p_->accidental(accs[i].acc); + Symbol s =paper()->lookup_l()->accidental(accs[i].acc); Atom a(s); Real dy = (accs[i].name + c0_position) * paper()->internote(); a.translate(Offset(0,dy)); diff --git a/lily/lookup.cc b/lily/lookup.cc index ffd668e75d..ede8af0855 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -44,7 +44,7 @@ Lookup::print()const } Symbol -Lookup::text(String style, String text, int dir) +Lookup::text(String style, String text, int dir) const { Array a; @@ -60,13 +60,13 @@ Lookup::text(String style, String text, int dir) Real -Lookup::internote() +Lookup::internote() const { return ball(4).dim.y.length()/2; } Symbol -Lookup::ball(int j) +Lookup::ball(int j) const { if (j > 4) j = 4; @@ -76,13 +76,13 @@ Lookup::ball(int j) } Symbol -Lookup::rest(int j) +Lookup::rest(int j) const { return (*symtables_)("rests")->lookup(String(j)); } Symbol -Lookup::fill(Box b) +Lookup::fill(Box b) const { Symbol s( (*symtables_)("param")->lookup("fill")); s.dim = b; @@ -90,32 +90,38 @@ Lookup::fill(Box b) } Symbol -Lookup::accidental(int j) +Lookup::accidental(int j) const { return (*symtables_)("accidentals")->lookup(String(j)); } Symbol -Lookup::bar(String s) +Lookup::bar(String s) const { return (*symtables_)("bars")->lookup(s); } Symbol -Lookup::script(String s) +Lookup::script(String s) const { return (*symtables_)("scripts")->lookup(s); } Symbol -Lookup::clef(String s) +Lookup::dynamic(String s) const +{ + return (*symtables_)("dynamics")->lookup(s); +} + +Symbol +Lookup::clef(String s) const { return (*symtables_)("clefs")->lookup(s); } Symbol -Lookup::dots(int j) +Lookup::dots(int j) const { if (j>3) error("max 3 dots"); // todo @@ -123,13 +129,13 @@ Lookup::dots(int j) } Symbol -Lookup::flag(int j) +Lookup::flag(int j) const { return (*symtables_)("flags")->lookup(j); } Symbol -Lookup::streepjes(int i) +Lookup::streepjes(int i) const { assert(i); @@ -153,7 +159,7 @@ Lookup::streepjes(int i) } Symbol -Lookup::hairpin(Real &wid, bool decresc) +Lookup::hairpin(Real &wid, bool decresc) const { int idx = int(rint(wid / 6 PT)); if(!idx) idx ++; @@ -169,7 +175,7 @@ Lookup::hairpin(Real &wid, bool decresc) } Symbol -Lookup::linestaff(int lines, Real wid) +Lookup::linestaff(int lines, Real wid) const { Symbol s; s.dim.x = Interval(0,wid); @@ -188,7 +194,7 @@ Lookup::linestaff(int lines, Real wid) Symbol -Lookup::meter(Array a) +Lookup::meter(Array a) const { Symbol s; s.dim.x = Interval( 0 PT, 10 PT); @@ -200,7 +206,7 @@ Lookup::meter(Array a) Symbol -Lookup::stem(Real y1,Real y2) +Lookup::stem(Real y1,Real y2) const { if (y1 > y2) { Real t = y1; diff --git a/lily/lyric-item.cc b/lily/lyric-item.cc index c0adac7b63..cb8c7547e4 100644 --- a/lily/lyric-item.cc +++ b/lily/lyric-item.cc @@ -22,6 +22,6 @@ Lyric_item::do_pre_processing() { // test context-error - if ( tdef_l_->text_str_.index_i( "Gates" ) >=0)// :-) - warning( "foul word", tdef_l_->defined_ch_c_l_ ); + if ( tdef_l()->text_str_.index_i( "Gates" ) >=0)// :-) + warning( "foul word", tdef_l()->defined_ch_c_l_ ); } diff --git a/lily/meter.cc b/lily/meter.cc index 94f6b6c5e9..c16d5d3d3f 100644 --- a/lily/meter.cc +++ b/lily/meter.cc @@ -12,7 +12,7 @@ Meter::Meter(Arraya) Molecule* Meter::brew_molecule_p()const { - Symbol s = paper()->lookup_p_->meter(args); + Symbol s = paper()->lookup_l()->meter(args); return new Molecule(Atom(s)); } diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 51ba40d54c..9a63d93e5a 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -123,10 +123,14 @@ Midi_note::Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo ) assert(melreq_l); pitch_i_ = melreq_l->pitch() + c0_pitch_i_c_; channel_i_ = channel_i; - - // poor man-s staff dynamics: - dynamic_byte_ = (melreq_l)? 0x64 - 0x10 * channel_i_:0; + on_b_ = on_bo; + + dynamic_byte_ = 0x64; + if ( on_b_ ) // poor man-s staff dynamics: + dynamic_byte_ -= 0x10 * channel_i_; + else + dynamic_byte_ += 0x32; // 0x64 is supposed to be neutral, but let-s try } String diff --git a/lily/midi-output.cc b/lily/midi-output.cc index 7714a99fa8..ec3b727400 100644 --- a/lily/midi-output.cc +++ b/lily/midi-output.cc @@ -31,7 +31,10 @@ Midi_output::Midi_output(Score* score_l, Midi_def* midi_l ) midi_l_ = midi_l; score_l_ = score_l; - Midi_stream midi_stream(midi_l->outfile_str_, score_l_->staffs_.size(), 384 ); + Midi_stream midi_stream(midi_l->outfile_str_, + // don-t forget: extra track 0 for tempo/copyright stuff... + score_l_->staffs_.size() + 1, + 384 ); midi_stream_l_ = &midi_stream; header(); @@ -44,7 +47,7 @@ Midi_output::do_staff(Staff*st_l,int track_i) Midi_track midi_track( track_i ); // set track name - Midi_text track_name( Midi_text::TRACK_NAME, "Track " + String_convert::i2dec_str( track_i, 2, 0 ) ); + Midi_text track_name( Midi_text::TRACK_NAME, "Track " + String_convert::i2dec_str( track_i, 0, '0' ) ); midi_track.add( Moment( 0.0 ), &track_name ); // set instrument :-) @@ -55,10 +58,11 @@ Midi_output::do_staff(Staff*st_l,int track_i) int accidentals_i = 0; int minor_i = 0; - // sorry, wanna test this... + // uph, sorry, wanna test this... // menuetto in F if ( ( infile_str_g.index_i( "scsii-menuetto" ) >= 0 ) - || ( infile_str_g.index_i( "standchen" ) >= 0 ) ) + || ( infile_str_g.index_i( "standchen" ) >= 0 ) + || ( infile_str_g.left_str( 1 ) == String( "s" ) ) ) accidentals_i = -1; // standchen in d if ( ( infile_str_g.index_i( "standchen" ) >= 0 ) ) diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index 801ba32e12..4a1674c7f7 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -36,6 +36,32 @@ Midi_walker::do_stop_notes(Moment max_moment) output_event(note, stop_moment); } } +/** + Find out if start_note event is needed, and do it if needed. + */ +void +Midi_walker::do_start_note(Note_req*note_l) +{ + Moment stop=note_l->duration() + ptr()->when(); + for(int i=0; i < stop_notes.size(); i++) + if (stop_notes.value_arr_[i]->melodic()->pitch() == + note_l->pitch()) { + if ( stop_notes.indices_arr_[i] < stop){ + + stop_notes.del(i); + return ; // removing this gives a feature ( ${c2 c4}$ output correctly) + } + else + return; // skip the stop note + break;// do the stop note + } + + stop_notes.enter(note_l, stop); + Midi_note note(note_l, track_l_->number_i_, true); + output_event(note, ptr()->when()); +} + + /** advance the track to #now#, output the item, and adjust current "moment". */ void @@ -58,10 +84,8 @@ Midi_walker::process_requests() Note_req * note_l = n->note(); if (!note_l) continue; + do_start_note(note_l); - Midi_note note(note_l, track_l_->number_i_, true); - stop_notes.enter(note_l, n->duration() + ptr()->when() ); - output_event(note, ptr()->when()); } } diff --git a/lily/mylexer.cc b/lily/mylexer.cc index 7da6dddec8..9c9179c856 100644 --- a/lily/mylexer.cc +++ b/lily/mylexer.cc @@ -5,7 +5,7 @@ #include "assoc-iter.hh" #include "lexer.hh" #include "input-file.hh" -#include "parser.hh" +#include "out/parser.hh" #include "keyword.hh" #include "assoc.hh" #include "lexer.hh" @@ -20,8 +20,9 @@ static Keyword_ent the_key_tab[]={ "clef", CLEF, "cm", CM_T, "command", COMMAND, - "commands", COMMANDS, + "commands", COMMANDS, "duration", DURATIONCOMMAND, + "dynamic", DYNAMIC, "geometric", GEOMETRIC, "goto", GOTO, "in", IN_T, diff --git a/lily/notehead.cc b/lily/notehead.cc index 722b231e68..4d0157abe9 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -48,11 +48,11 @@ Notehead::brew_molecule_p() const return out; Paper_def *p = paper(); Real dy = p->internote(); - Symbol s = p->lookup_p_->ball(balltype); + Symbol s = p->lookup_l()->ball(balltype); out = new Molecule(Atom(s)); if (dots) { - Symbol d = p->lookup_p_->dots(dots); + Symbol d = p->lookup_l()->dots(dots); Molecule dm; dm.add(Atom(d)); if (!(position %2)) @@ -64,7 +64,7 @@ Notehead::brew_molecule_p() const return out; if (streepjes) { int dir = sign(position); int s =(position<-1) ? -((-position)/2): (position-staff_size)/2; - Symbol str = p->lookup_p_->streepjes(s); + Symbol str = p->lookup_l()->streepjes(s); Molecule sm; sm.add(Atom(str)); if (position % 2) diff --git a/lily/paper-def.cc b/lily/paper-def.cc index b49a53fc8e..6063347e88 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -89,3 +89,8 @@ Paper_def::print() const mtor << "}\n"; #endif } +const Lookup* +Paper_def::lookup_l() +{ + return lookup_p_; +} diff --git a/lily/parser.y b/lily/parser.y index ba9703e4b8..ebec63fbef 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -65,7 +65,7 @@ int fatal_error_i = 0; Text_def * textdef; } -%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE +%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE DYNAMIC %token CM_T IN_T PT_T MM_T PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND %token KEY CLEF TABLE VOICES STEM @@ -74,7 +74,7 @@ int fatal_error_i = 0; %token GOTO %token MIDI TEMPO -%token IDENTIFIER +%token IDENTIFIER REAL_IDENTIFIER REQUEST_IDENTIFIER %token PITCHMOD DURATION RESTNAME %token NOTENAME %token REAL @@ -98,7 +98,7 @@ int fatal_error_i = 0; %type staff_block staff_init staff_body %type int %type intastint_list -%type post_request pre_request command_req +%type post_request pre_request command_req %type pitchmod %type music %type music_chord music_chord_body @@ -113,7 +113,7 @@ int fatal_error_i = 0; %type notename_tab notename_tab_body %type script_dir %type