From: Han-Wen Nienhuys Date: Mon, 2 Nov 1998 15:25:15 +0000 (+0100) Subject: release: 1.1.1 X-Git-Tag: release/1.1.1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=31653bf1d61a33ef8bc8c871d60c6b3452d04d28;p=lilypond.git release: 1.1.1 --- diff --git a/Documentation/faq.yo b/Documentation/faq.yo index 327a83eb5c..059cc78381 100644 --- a/Documentation/faq.yo +++ b/Documentation/faq.yo @@ -381,7 +381,7 @@ wrong symbols and dvi-checksum errors!) We obviously mucked with the fonts in the upgrade. Remove em(all) previous fonts, including the file(.pk) and file(.tfm) fonts in file(/var/lib/texmf). A script automating this has been included, see -file(bin/clean-fonts.sh). +file(buildscripts/clean-fonts.sh). question(The beams and slurs are gone if use the XDvi magnifying glass!?) diff --git a/Documentation/ntweb/index.yo b/Documentation/ntweb/index.yo index 4460f700c8..1a3a8df1f1 100644 --- a/Documentation/ntweb/index.yo +++ b/Documentation/ntweb/index.yo @@ -4,11 +4,12 @@ sect(Windows NT Binary Distribution) subsect(Introduction) label(introduction) -This page is dedicated to the distribution of precompiled and preformatted -LilyPond binaries for Windows NT 4.0 . This package is covered under the -GNU General Public License and all of the source and documentation are +This page is dedicated to the distribution of precompiled and +preformatted LilyPond binaries for Windows NT 4.0 . This package is +covered under the GNU General Public License and all of the source is available on the official url(LilyPond Homepage)(http://www.cs.ruu.nl/people/hanwen/lilypond/index.html). +A full set of url(documentation)(http://www.cs.ruu.nl/people/hanwen/lilypond/Documentation/tex/out-www/index.html) in various formats is also available. includefile(../BLURB.in) @@ -69,8 +70,8 @@ itemize( In a batch file you can add the following entries: nl() bf(set LILYPONDPREFIX=em(LilyPond-dir)) nl() bf(set path=%path%;%LILYPONDPREFIX%\bin;em(MiKTeX-dir)\miktex\bin) nl() - bf(set TEXINPUTS=%LILYPONDPREFIX%\texmf\tex\lilypond;;) nl() - bf(set MFINPUTS=%LILYPONDPREFIX%\texmf\mf\public\lilypond;;) nl() + bf(set TEXINPUTS=%LILYPONDPREFIX%\share\lilypond\tex;;) nl() + bf(set MFINPUTS=%LILYPONDPREFIX%\share\lilypond\mf;;) nl() COMMENT( dit(Windows Environment) In the Windows environment you can select properties menu of the My Computer icon. Click on diff --git a/Documentation/tex/GNUmakefile b/Documentation/tex/GNUmakefile index 8b4a15a5d4..6102deb049 100644 --- a/Documentation/tex/GNUmakefile +++ b/Documentation/tex/GNUmakefile @@ -4,6 +4,7 @@ depth=../.. DATA_FILES = $(wildcard *.data) datafiles = $(addprefix $(outdir)/,$(DATA_FILES:.data=.html)) +TEX_FILES = $(wildcard *.tex) DOC_FILES = $(wildcard *.doc) DVI_FILES = $(addprefix $(outdir)/,$(DOC_FILES:.doc=.dvi) $(YO_FILES:.yo=.dvi)) OUT_BIB_FILES = $(addprefix $(outdir)/, $(BIB_FILES)) @@ -11,10 +12,11 @@ OUT_BIB_FILES = $(addprefix $(outdir)/, $(BIB_FILES)) # just include me YO_URG_FILES = $(wildcard *.yo-urg) +OUTTEX_FILES = $(addprefix $(outdir)/, $(TEX_FILES)) OUTDOC_FILES = $(addprefix $(outdir)/, $(DOC_FILES)) EL_FILES = $(wildcard *.el) BIB_FILES= $(wildcard *.bib) -EXTRA_DIST_FILES= $(BIB_FILES) $(DOC_FILES) $(DATA_FILES) $(EL_FILES) $(YO_URG_FILES) +EXTRA_DIST_FILES= $(BIB_FILES) $(DOC_FILES) $(DATA_FILES) $(EL_FILES) $(YO_URG_FILES) $(TEX_FILES) HTML_FILES = $(addprefix $(outdir)/, $(YO_FILES:.yo=.html)) PS_FILES = $(DVI_FILES:.dvi=.ps) @@ -54,9 +56,9 @@ $(outdir)/glossary.dvi: $(outdir)/glossary-table.tex $(outdir)/glossary.html: $(outdir)/glossary-table.html -local-WWW: $(HTML_FILES) $(OUTDOC_FILES:.doc=.ps.gz) $(OUTYO_FILES:.yo=.latex) $(OUTYO_FILES:.yo=.ps.gz) $(addprefix $(outdir)/, $(BIB_FILES:.bib=.html)) $(datafiles) +local-WWW: $(HTML_FILES) $(OUTDOC_FILES:.doc=.ps.gz) $(OUTTEX_FILES:.tex=.ps.gz) $(OUTYO_FILES:.yo=.latex) $(OUTYO_FILES:.yo=.ps.gz) $(addprefix $(outdir)/, $(BIB_FILES:.bib=.html)) $(datafiles) $(PYTHON) $(step-bindir)/ls-latex.py --package=$(topdir) --title 'LaTeX documents about LilyPond' \ - $(YO_FILES) $(OUTYO_FILES:.yo=.latex) $(BIB_FILES) $(DOC_FILES) \ + $(YO_FILES) $(OUTYO_FILES:.yo=.latex) $(BIB_FILES) $(DOC_FILES) $(TEX_FILES)\ | sed "s!$(outdir)/!!g" > $(outdir)/index.html $(PYTHON) $(step-bindir)/add-html-footer.py --package=$(topdir) $(outdir)/index.html diff --git a/Documentation/topdocs/INSTALL.yo b/Documentation/topdocs/INSTALL.yo index 9a72516764..54147f74e1 100644 --- a/Documentation/topdocs/INSTALL.yo +++ b/Documentation/topdocs/INSTALL.yo @@ -4,13 +4,13 @@ sect(ABSTRACT) You do something which looks remotely like verb( - configure # Check out the bin/set-lily.sh script + configure # Check out the buildscripts/set-lily.sh script make make install ) The detailed instructions follow here. The -file(bin/set-lily.sh) script sets some environment variables +file(buildscripts/set-lily.sh) script sets some environment variables and symlinks, which comes in handly when you have to compile LilyPond very often. It is aimed at people who run (or debug) LilyPond without installing. @@ -35,6 +35,8 @@ it() GNU C++ version 2.7 or newer (2.8 and egcs are also fine). it() Python 1.5 (Strictly speaking, you shouldn't need Python for compiling and installing, but you'll need it to regenerate the font tables, e.g.). + +it() GUILE 1.3 (no, GUILE 1.2 won't work) ) sect(RUNNING) @@ -60,8 +62,8 @@ export TEXINPUTS="/usr/local/share/lilypond/tex:" The empty path component represents TeX() and MetaFont's default search paths. Scripts with the proper paths for the bourne and C-shell respectively are generated in -file(bin/out/lilypond-profile) and -file(bin/out/lilypond-login) during compilation. +file(buildscripts/out/lilypond-profile) and +file(buildscripts/out/lilypond-login) during compilation. sect(RECOMMENDED) diff --git a/Documentation/topdocs/index.yo b/Documentation/topdocs/index.yo index fc1675b132..1307c60e3b 100644 --- a/Documentation/topdocs/index.yo +++ b/Documentation/topdocs/index.yo @@ -39,7 +39,6 @@ nsect(Sites) description( dit(lurl(http://www.cs.uu.nl/people/hanwen/lilypond/))Han-Wen's site. -dit(lurl(http://www.xs4all.nl/~jantien/lilypond/))Jan's site. dit(lurl(http://www.realtime.net/~daboys/lilypond/))Jeff's Windows NT Distribution site. ) diff --git a/NEWS b/NEWS index 577495b195..c11ce8fd55 100644 --- a/NEWS +++ b/NEWS @@ -1,27 +1,45 @@ ---- ../lilypond-1.1.0.uu2.jcn1/NEWS Fri Oct 30 17:01:27 1998 -++ b/NEWS Fri Oct 30 18:15:48 1998 -@@ -1,3 +1,8 @@ -pl 0.uu2.jcn2 +pl 0.uu5 + - fixed MIDI output. + +pl 0.jcn3 - dropped stepmake/aclocal.m4 - removed silly -lguile (BLA_LIBS, EXTRA_LIBS ??) - added debugging output format: -fscm - - pl 0.uu2.jcn1 - - ly2dvi.py -I fix - - too annoying buildscripts, scripts -> bin--- ../lilypond-1.1.0.uu2/NEWS Thu Oct 29 00:59:19 1998 -++ b/NEWS Fri Oct 30 17:01:27 1998 -@@ -1,3 +1,8 @@ -pl 0.uu2.jcn1 - ly2dvi.py -I fix - - too annoying buildscripts, scripts -> bin - Documentation/tex/feta.tex - doco fixes: PATCHES.yo, yodl-1.31.7 - - pl 0.uu2 - - undone type_info::before hack. (Ugh. RTFM).pl 0.jcn1 + +pl 0.uu4 + - Protected_scm to fixup GUILE gc + +pl 0.uu3 + - more RTTI cleaning. + +pl 0.uu2 + - undone type_info::before hack. (Ugh. RTFM). + +pl 0.uu1 + - more RTTI stuff: is_type_b -> type_info::before + +pl 0.jcn1 pl 17.jcn7 - added: set*text, timesig, beam - guile-1.3 is fine; my egcs-1.0.2's -O2 is broken +pl 17.jbr1 + - stepmake/stepmake/bin/package-zip32.sh: Updated configure statement + and modified win32 specific distribution file names to match + pl 16.hwn1 changes. + - scripts/ly2dvi.py: Modified search paths to match the new lilypond + installation tree. + - scripts/convert-mudela.py: Remove the an existing backup file + before renaming original. This is a WIN32 Python requirement. + - Documentation/ntweb/index.html: Updated documentation to match + new lilypond installation tree. + - lily/main.cc: Fixed LILYPONDPREFIX search paths. + + + +********** 1.1.0 diff --git a/PATCHES.txt b/PATCHES.txt index 2f32fb9487..f801d8ef5a 100644 --- a/PATCHES.txt +++ b/PATCHES.txt @@ -62,13 +62,17 @@ Then, from the top of Lily's source tree, type + make dist make diff -which leaves your patch as ./lilypond-0.1.73.jcn1.diff. +which rolls the tarball ../releases/lilypond-0.1.73.tar.gz +and leaves your patch as ./lilypond-0.1.73.jcn1.diff. [1] +We assume that there is a tarball lilypond-0.1.73.tar.gz in +the directory ../releases. If you didn't configure Lily using --srcdir, you can do: @@ -102,6 +106,10 @@ o GNU diff o Python (version 1.5 or newer). You can of course make a patch by hand, which would go something like: +----------- +[1] 'Make diff' generates a patch between two tar- +balls. For more info type 'make diff help=='. + make distclean cd .. diff --git a/TODO b/TODO index e22c3f60e8..b22fe9a244 100644 --- a/TODO +++ b/TODO @@ -9,8 +9,12 @@ grep for TODO and ugh/ugr/urg BUGS: + * disallow backslashes + + * \breathmark TeX macro + + * catch GUILE errors? - * add new glyphs to font.ly * formatting of input stuff. @@ -103,8 +107,6 @@ BUGS: * include MIDI list - * make GNU style webpages. - * midi_instrument -> midiInstrument * horizontal centering of dynamics @@ -350,7 +352,6 @@ PROJECTS - indentation - notenames? - fontlock: \melodic \melodic - * use properties for: - plet? @@ -372,9 +373,8 @@ PROJECTS * Spring_spacer: - write a faster Spring_spacer (without matrices if possible) - - use straight LP to find minimal "fitting force" - relate energybound to linelen unitspace fontsize etc. - - used fixed point fp + - used fixed point fp? * \header - output header info to MIDI too. @@ -458,7 +458,7 @@ PROJECTS * Documentation - Doc (C) stuff of sheet music - a better format? SGML? TeX? Info? - - a tutorial + - a better tutorial * more spanners (smallish) - Glissando diff --git a/VERSION b/VERSION index ea9afb6b71..deeabc172b 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=0 -MY_PATCH_LEVEL=uu2.jcn2 +PATCH_LEVEL=1 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/bin/GNUmakefile b/bin/GNUmakefile deleted file mode 100644 index b954530259..0000000000 --- a/bin/GNUmakefile +++ /dev/null @@ -1,12 +0,0 @@ -# bin/Makefile - -depth = .. -SEXECUTABLES=convert-mudela mudela-book ly2dvi -STEPMAKE_TEMPLATES=script - - -include $(depth)/make/stepmake.make - -include $(stepdir)/executable-targets.make - - diff --git a/bin/clean-diaper.sh b/bin/clean-diaper.sh deleted file mode 100644 index 47c2a069db..0000000000 --- a/bin/clean-diaper.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# unclobber current dir. -rm -vf *.aux *.log *.orig *~ *dvi *.dep - -# subdirs -rm -vf `grep -li "^% Creator: GNU LilyPond" *.out *.tex` -rm -vf `grep -li "Creator: mi2mu" *.midi.ly` -rm -vf `grep -li "%Creator: dvipsk" *.ps` -rm -vf `grep -li "Creator: GNU LilyPond" *.midi` -rm -vf `grep -li "Creator: ly2dvi" *.tex` -rm -vf `find -name 'core'` -rm -vf `find -name '*.orig'` -rm -vf `find -name '*.rej'` - - - - - -# docxx mess -rm -vf *.class HIER*.html dxxgifs.tex gifs.db icon?.gif logo.gif down.gif \ - aindex.html index.html diff --git a/bin/clean-fonts.sh b/bin/clean-fonts.sh deleted file mode 100644 index 597efa9032..0000000000 --- a/bin/clean-fonts.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -case $# in -0) - WHAT="" ;; -1) - WHAT=$1;; -esac - -# should use kpsepath - -if [ -d /var/lib/texmf ]; then - TEXDIR=/var/lib/texmf -elif [ -d /var/texfonts ]; then - TEXDIR=/var/texfonts -else - TEXDIR=/var/ -fi - -# remove possibly stale .pk/.tfm files -echo> /tmp/cleaning-font-dummy -FILES=`find . $TEXDIR -name "feta*$WHAT*tfm" -or -name "feta*$WHAT*pk"` - -echo removing $FILES -rm -f $FILES /tmp/cleaning-font-dummy diff --git a/bin/convert-mudela.py b/bin/convert-mudela.py deleted file mode 100644 index ee6d05a229..0000000000 --- a/bin/convert-mudela.py +++ /dev/null @@ -1,362 +0,0 @@ -#!@PYTHON@ - -# convert-mudela.py -- convertor for mudela versions -# -# source file of the GNU LilyPond music typesetter -# -# (c) 1998 - -# TODO -# use -f and -t for -s output - -# NEWS -# 0.2 -# - rewrite in python - -program_name = 'convert-mudela' -version = '0.3' - - -import os -import sys -import __main__ -import getopt -from string import * -import re - -import time -mudela_version_re_str = '\\\\version *\"(.*)\"' -mudela_version_re = re.compile(mudela_version_re_str) - -def program_id (): - return '%s version %s' %(program_name, version); - -def identify (): - sys.stderr.write (program_id () + '\n') - -def gulp_file(f): - try: - i = open(f) - i.seek (0, 2) - n = i.tell () - i.seek (0,0) - except: - print 'can\'t open file: ' + f + '\n' - return '' - s = i.read (n) - if len (s) <= 0: - print 'gulped empty file: ' + f + '\n' - i.close () - return s - - -def str_to_tuple (s): - return tuple (map (atoi, split (s,'.'))) - -def tup_to_str (t): - return join (map (lambda x: '%s' % x, list (t)), '.') - -def version_cmp (t1, t2): - for x in [0,1,2]: - if t1[x] - t2[x]: - return t1[x] - t2[x] - return 0 - - -def guess_mudela_version(filename): - s = gulp_file (filename) - m = mudela_version_re.search (s) - if m: - return m.group(1) - else: - return '' - -def help (): - sys.stdout.write ( - ("Usage: %s [OPTION]... [FILE]...\n" - + "Try to convert to newer mudela-versions\n" - + "Options:\n" - + " -h, --help print this help\n" - + ' -e, --edit in place edit\n' - + ' -f, --from=VERSION start from version\n' - + ' -s, --show-rules print out all rules.\n' - + ' -t, --to=VERSION target version\n') % program_name) - sys.exit (0) - -class FatalConversionError: - pass - -conversions = [] - -def show_rules (file): - for x in conversions: - file.write ('%s: %s\n' % (tup_to_str (x[0]), x[2])) - -############################ - -if 1: # need new a namespace - def conv (lines): - found =0 - for x in lines: - if re.search ('\\\\octave', x): - found = 1 - break - if found: - sys.stderr.write ('\nNot smart enough to convert \\octave') - raise FatalConversionError() - return lines - - - conversions.append ( - ((0,1,19), conv, 'deprecated \\octave; can\'t convert automatically')) - - -if 1: # need new a namespace - def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\textstyle([^;]+);', - '\\\\property Lyrics . textstyle = \\1', x) - x = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', x) - newlines.append (x) - return newlines - - - conversions.append ( - ((0,1,20), conv, 'deprecated \\textstyle, new \key syntax')) - - -if 1: # need new a namespace - def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\musical_pitch', - '\\\\musicalpitch',x) - x = re.sub ('\\\\meter', - '\\\\time',x) - newlines.append (x) - return newlines - - - conversions.append ( - ((0,1,21), conv, '\\musical_pitch -> \\musicalpitch, '+ - '\\meter -> \\time')) - -if 1: # need new a namespace - def conv (lines): - return lines - - conversions.append ( - ((1,0,0), conv, '0.1.21 -> 1.0.0 ')) - - -if 1: # need new a namespace - def conv (lines): - newlines = [] - for x in lines: - x = re.sub ('\\\\accidentals', - '\\\\keysignature',x) - x = re.sub ('specialaccidentals *= *1', - 'keyoctaviation = 0',x) - x = re.sub ('specialaccidentals *= *0', - 'keyoctaviation = 1',x) - newlines.append (x) - return newlines - - - conversions.append ( - ((1,0,1), conv, '\\accidentals -> \\keysignature, ' + - 'specialaccidentals -> keyoctaviation')) - -if 1: - def conv(lines): - found = 0 - for x in lines: - if re.search ('\\\\header', x): - found = 1 - break - if found: - sys.stderr.write ('\nNot smart enough to convert to new \\header format') - return lines - - conversions.append ((1,0,2), conv, '\\header { key = concat + with + operator }') - -if 1: - def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\melodic', '\\\\notes',x) - newlines.append (x) - return newlines - - conversions.append ((1,0,3), conv, '\\melodic -> \\notes') - -if 1: - def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('default_paper *=', '',x) - x = re.sub ('default_midi *=', '',x) - newlines.append (x) - return newlines - - conversions.append ((1,0,4), conv, 'default_{paper,midi}') - -if 1: - def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('ChoireStaff', 'ChoirStaff',x) - x = re.sub ('\\output', 'output = ',x) - newlines.append (x) - return newlines - - conversions.append ((1,0,5), conv, 'ChoireStaff -> ChoirStaff') - -if 1: - def conv(lines): - newlines =[] - found = None - for x in lines: - found = re.search ('[a-zA-Z]+ = *\\translator',x) - newlines.append (x) - if found: break - if found: - sys.stderr.write ('\nNot smart enough to \\translator syntax') - raise FatalConversionError() - return newlines - - conversions.append ((1,0,6), conv, 'foo = \\translator {\\type .. } ->\\translator {\\type ..; foo; }') - - -if 1: - def conv(lines): - newlines =[] - for x in lines: - x = re.sub ('\\\\lyric', '\\\\lyrics',x) - newlines.append (x) - return newlines - - conversions.append ((1,0,7), conv, '\\lyric -> \\lyrics') - - -############################ - - -def get_conversions (from_version, to_version): - def version_b (v, f = from_version, t = to_version): - return version_cmp (v[0], f) > 0 and version_cmp (v[0], t) <= 0 - return filter (version_b, conversions) - - -def latest_version (): - return conversions[-1][0] - -def do_conversion (infile, from_version, outfile, to_version): - - conv_list = get_conversions (from_version, to_version) - - sys.stderr.write ('Applying conversions: ') - lines = infile.readlines(); - last_conversion = () - try: - for x in conv_list: - sys.stderr.write (tup_to_str (x[0]) + ', ') - lines = x[1] (lines) - last_conversion = x[0] - - - except FatalConversionError: - sys.stderr.write ('Error while converting; I won\'t convert any further') - - for x in lines: - if last_conversion: - x = re.sub (mudela_version_re_str, '\\\\version \"%s\"' % tup_to_str (last_conversion), x) - outfile.write(x) - -class UnknownVersion: - pass - -def do_one_file (infile_name): - sys.stderr.write ('Processing `%s\' ... '% infile_name) - outfile_name = '' - if __main__.edit: - outfile_name = infile_name + '.NEW' - elif __main__.outfile_name: - outfile_name = __main__.outfile_name - - if __main__.from_version: - from_version = __main__.from_version - else: - guess = guess_mudela_version (infile_name) - if not guess: - raise UnknownVersion() - from_version = str_to_tuple (guess) - - if __main__.to_version: - to_version = __main__.to_version - else: - to_version = latest_version () - - - if infile_name: - infile = open (infile_name,'r') - else: - infile = sys.stdin - - if outfile_name: - outfile = open (outfile_name, 'w') - else: - outfile = sys.stdout - - - do_conversion (infile, from_version, outfile, to_version) - - if infile_name: - infile.close () - - if outfile_name: - outfile.close () - - if __main__.edit: - os.rename (infile_name, infile_name + '~') - os.rename (infile_name + '.NEW', infile_name) - - sys.stderr.write ('\n') - sys.stderr.flush () - -edit = 0 -to_version = () -from_version = () -outfile_name = '' - -identify () -(options, files) = getopt.getopt ( - sys.argv[1:], 'f:t:seh', ['show-rules', 'help', 'edit', 'from', 'to']) - -for opt in options: - o = opt[0] - a = opt[1] - if o== '--help' or o == '-h': - help () - elif o== '--from' or o=='-f': - from_version = str_to_tuple (a) - elif o== '--to' or o=='-t': - to_version = str_to_tuple (a) - elif o== '--edit' or o == '-e': - edit = 1 - elif o== '--show-rules' or o == '-s': - show_rules (sys.stdout) - sys.exit(0) - else: - print o - raise getopt.error - - -for f in files: - if f == '-': - f = '' - try: - do_one_file (f) - except UnknownVersion: - pass diff --git a/bin/docxx-lily.sh b/bin/docxx-lily.sh deleted file mode 100644 index 82407ed1ff..0000000000 --- a/bin/docxx-lily.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -cwd=`pwd` - -{ cd $LILYPOND_SOURCEDIR; cd ..; -export LILYPOND_ROOTDIR=`pwd` } - -if [ "$1" = "" ]; then - VERSION=`show-current` - TARBALL=$LILYPOND_ROOTDIR/releases/lilypond-$VERSION.tar.gz - cwd=`pwd` -else - TARBALL=$1 -fi - - -tar-docxx $TARBALL diff --git a/bin/find-typenames.pl b/bin/find-typenames.pl deleted file mode 100644 index 890f9cabd0..0000000000 --- a/bin/find-typenames.pl +++ /dev/null @@ -1,20 +0,0 @@ -#!@PERL@ - -open GREP, "egrep -h '^struct|^class' *.hh *.cc|"; -open OUT, "|sort | uniq"; -while () { - - s/^struct/class/; - if (! /; *$/) { - s/:[^{]+{.*$//; - s/ *{.*$/;/; - } - if (! /; *$/) { - chop; - $_ .= ";\n"; - - } - print OUT; -} -close OUT; -close GREP; diff --git a/bin/gen-sitemap.sh b/bin/gen-sitemap.sh deleted file mode 100644 index 7f9bcbc95e..0000000000 --- a/bin/gen-sitemap.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -TMPDIR=/tmp/gen-sitemap -for tarball in $*; do - tar -C $TMPDIR -xfz $tarball '*.html' -done diff --git a/bin/genheader.py b/bin/genheader.py deleted file mode 100644 index 4dbb07f358..0000000000 --- a/bin/genheader.py +++ /dev/null @@ -1,149 +0,0 @@ -#!@PYTHON@ - -# genheader.py -- do headers (like these) -# -# source file of the GNU LilyPond music typesetter -# -# (c) 1997--1998 Han-Wen Nienhuys - -import os -import sys -import pwd -import regex -import regsub -import string -import getopt -import time - -class My_options: - def __init__(self): - self.commentify = None - self.add_hdr_def = 0 - self.classname = '' - -my_options = My_options() - - -def name(): - return os.environ['USERNAME'] - -# field 4 of passwd is also used for finger info (phone no., office etc) -# return pwd.getpwuid(os.getuid())[4] - -def c_commentify(str): - return '/* ' + regsub.gsub('^',' ', str) + '\n */'; - -def sh_commentify(str): - return regsub.gsub('^', '# ', str) - -def tex_commentify(str): - return regsub.gsub('^', '% ', str) - -def project_str(): - cwd = os.getcwd() - if regex.search('flower', cwd) <> -1: - PROJECT = "the Flower Library" - elif regex.search('mf$', cwd) <> -1: - PROJECT = "the Feta (defintively not an abbreviation for Font-En-Tja) music font" - else: - PROJECT = "the GNU LilyPond music typesetter" - return PROJECT - -def head_str(filename): - if my_options.add_hdr_def: - what = "declare " - else: - what=" implement " - - - mailaddres = '' - try: - mailaddres = '<%s>' % os.environ['MAILADDRESS'] - except KeyError: - pass - headstr = '\n%s -- %s\n\nsource file of %s\n\n(c) %d %s %s\n' \ - %(filename, what, project_str(), - time.localtime (time.time ())[0], name(), mailaddres) - return headstr - - -def c_include(filename): - startdef= filename; - trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__') - startdef = string.translate(filename, trans) - - - headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef) - terminatestr = "#endif /* %s */\n" % (startdef); - - return headstr+ '\n\n'+ terminatestr; - - -def help (): - sys.stdout.write ("Usage: genheader [options] FILENAME\n" - + "Generate file with header FILENAME\n\n" - + "Options:\n" - + " -h, --header generate header\n" - + " --help print this help\n" - + " -p, --package=DIR specify package\n" - ) - - sys.exit (0) - - -(options, files) = getopt.getopt(sys.argv[1:], 'tcshp:', ['class', 'package=', 'help']) - -for opt in options: - o = opt[0] - a = opt[1] - if o == '-c': - my_options.commentify = c_commentify - elif o == '-t': - my_options.commentify = tex_commentify - elif o == '-s': - my_options.commentify = sh_commentify - elif o == '-h' or o == '--header': - my_options.add_hdr_def = 1 - elif o == '--class': - my_options.classname = a - elif o == '--help': - help () - -# FIXME: should create xxx.cc and include/xxx.hh, with implement/declare Xxx -# in one run -if my_options.classname: - pass - -def do_file(nm): - s = my_options.commentify(head_str(nm)) - if my_options.add_hdr_def: - s = s + c_include(nm) - return s - - -def extension(ext,nm): - ext = '\\.' + ext - return regex.search(ext, nm) <> -1 - -def c_extension(nm): - return extension('hh',nm) or extension('cc',nm) \ - or extension('icc', nm) or extension('tcc',nm) - -def select_commentification(nm): - if c_extension (nm): - return c_commentify - elif extension('py',nm) or extension('pl',nm) or extension('sh',nm): - return sh_commentify - elif extension('mf',nm) or extension('tex',nm) or extension('ly',nm): - return tex_commentify - else: - sys.stderr.write ('unknown extension for file %s\n' % nm) - raise 'help' - -for nm in files: - if extension('hh', nm) or extension('icc', nm) or extension('tcc', nm): - my_options.add_hdr_def = 1 - if my_options.commentify == None: - my_options.commentify = select_commentification(nm) - print do_file(nm) - diff --git a/bin/html-accents.py b/bin/html-accents.py deleted file mode 100644 index 228ed7485f..0000000000 --- a/bin/html-accents.py +++ /dev/null @@ -1,115 +0,0 @@ -#!@PYTHON@ - -# html-accents.py -- convert (some) latin1 chars to html -# pod2html is so broken... -# -# source file of the GNU LilyPond music typesetter -# -# (c) 1998 Jan Nieuwenhuizen - -name = 'html-accents' -version = '0.1' - -import os -import sys -sys.path.append ('@abs-step-bindir@') -sys.path.append (os.environ['HOME'] + '/usr/src/lilypond/stepmake/bin') - -import getopt -from string import * -import regex -import regsub -import time - -def program_id (): - return name + ' version ' + version; - -def identify (): - sys.stdout.write (program_id () + '\n') - -def help (): - sys.stdout.write ("Usage: " + name + " [options] INFILE OUTFILE\n" - + "Convert (some) latin1 chars to html &xxx;\n\n" - + "Options:\n" - + " -h, --help print this help\n" - + " -p, --package=DIR specify package\n" - ) - sys.exit (0) - -# chars = {'è':'è', } -chars = { -'á':'á', -'â':'â', -'æ':'æ', -'à':'à', -'å':'å', -'ã':'ã', -'ä':'ä', - -'ç':'ç', - -'é':'é', -'ê':'ê', -'è':'è', -'ë':'ë', - -'í':'í', -'î':'î', -'ì':'ì', -'ï':'ï', - -'ñ':'ñ', - -'ó':'ó', -'ô':'ô', -'ò':'ò', -'ø':'ø', -'õ':'õ', -'ö':'ö', - -'ú':'ú', -'û':'û', -'ù':'ù', -'ü':'ü' -} - -def convert_accents (inname, outname): - from flower import * - text = File (inname) - # ugh - html = File (outname, 'w') - - while not text.eof (): - line = text.readline () - for i in chars.keys (): - line = regsub.gsub (i, chars[i], line) - html.write (line) - text.close () - html.close () - -def main (): - identify () - (options, files) = getopt.getopt ( - sys.argv[1:], 'hp:', ['help', 'package=']) - for opt in options: - o = opt[0] - a = opt[1] - if o== '--help' or o == '-h': - help () - elif o == '-p' or o == '--package': - topdir = a - else: - print o - raise getopt.error - - sys.path.append (topdir + '/stepmake/bin') - from packagepython import * - package = Package (topdir) - packager = Packager () - - from flower import * - - convert_accents (files[0], files[1]) - -main () - diff --git a/bin/lilypond-login.sh b/bin/lilypond-login.sh deleted file mode 100644 index d4a482ebe6..0000000000 --- a/bin/lilypond-login.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/csh - -# env. vars for the C-shell. - -# set environment for LilyPond. To be installed in /etc/profile.d/ -setenv GS_LIB "@datadir@/afm" -setenv GS_FONTPATH "@datadir@/ps" -setenv LILYINCLUDE "@datadir@/ly:@datadir@/afm" - -# include an empty path component for the system wide includes. -setenv MFINPUTS "@datadir@/mf:"${MFINPUTS:=":"} -setenv TEXINPUTS "@datadir@/tex:"${TEXINPUTS:=":"} - diff --git a/bin/lilypond-profile.sh b/bin/lilypond-profile.sh deleted file mode 100644 index 176f63629e..0000000000 --- a/bin/lilypond-profile.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - - -# set environment for LilyPond. To be installed in /etc/profile.d/ -GS_LIB="@datadir@/afm" -GS_FONTPATH="@datadir@/ps" -LILYINCLUDE="@datadir@/ly:@datadir@/afm" - -# include an empty path component for the system wide includes. -MFINPUTS="@datadir@/mf:"${MFINPUTS:=":"} -TEXINPUTS="@datadir@/tex:"${TEXINPUTS:=":"} - -export LILYINCLUDE MFINPUTS TEXINPUTS GS_LIB GS_FONTPATH - -# echo $LILYINCLUDE $MFINPUTS $TEXINPUTS $GS_LIB $GS_FONTPATH - - diff --git a/bin/localpackage.py b/bin/localpackage.py deleted file mode 100644 index f37fc8267b..0000000000 --- a/bin/localpackage.py +++ /dev/null @@ -1,16 +0,0 @@ -# localpackage.py -# must be included in package's python bin dir - -def localpackage (n): - p=lower (n) - P=upper (n) - if topdir == '': - try: - topdir = os.environ[P + '_SOURCEDIR'] - except: - topdir = os.environ['HOME'] + '/usr/src/' + p - sys.path.append (topdir + '/stepmake/bin') - from packagepython import * - package = Package (topdir) - packager = Packager () - diff --git a/bin/ltmain.sh b/bin/ltmain.sh deleted file mode 100644 index e9350b3fab..0000000000 --- a/bin/ltmain.sh +++ /dev/null @@ -1,2453 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. -# -# Copyright (C) 1996-1998 Free Software Foundation, Inc. -# Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# The name of this program. -progname=`$echo "$0" | sed 's%^.*/%%'` -modename="$progname" - -# Constants. -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.2 - -default_mode= -help="Try \`$progname --help' for more information." -magic="%%%MAGIC variable%%%" -mkdir="mkdir" -mv="mv -f" -rm="rm -f" - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; fi - -if test "$LTCONFIG_VERSION" != "$VERSION"; then - echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= - -# Parse our command line options once, thoroughly. -while test $# -gt 0 -do - arg="$1" - shift - - case "$arg" in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - execute_dlfiles) - eval "$prev=\"\$$prev \$arg\"" - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case "$arg" in - --help) - show_help=yes - ;; - - --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION" - exit 0 - ;; - - --dry-run | -n) - run=: - ;; - - --features) - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - case "$nonopt" in - *cc | *++ | gcc* | *-gcc*) - mode=link - for arg - do - case "$arg" in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case "$mode" in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - lastarg= - srcfile="$nonopt" - suppress_output= - - for arg - do - # Accept any command-line options. - case "$arg" in - -o) - $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done - - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - - # Recognize several different file suffixes. - xform='[cCFSfms]' - case "$libobj" in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case "$libobj" in - *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;; - *) - $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2 - exit 1 - ;; - esac - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - $run $rm $obj $libobj - trap "$run $rm $obj $libobj; exit 1" 1 2 15 - else - $run $rm $libobj - trap "$run $rm $libobj; exit 1" 1 2 15 - fi - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - # All platforms use -DPIC, to notify preprocessed assembler code. - $show "$base_compile$pic_flag -DPIC $srcfile" - if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then : - else - test -n "$obj" && $run $rm $obj - exit 1 - fi - - # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag"; then - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj - exit $? - fi - - # Just move the object, then go on to compile the next one - $show "$mv $obj $libobj" - $run $mv $obj $libobj || exit 1 - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - # Suppress compiler output if we already did a PIC compilation. - $show "$base_compile $srcfile$suppress_output" - if $run eval "$base_compile \$srcfile$suppress_output"; then : - else - $run $rm $obj $libobj - exit 1 - fi - fi - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - fi - - exit 0 - ;; - - # libtool link mode - link) - modename="$modename: link" - CC="$nonopt" - allow_undefined=yes - compile_command="$CC" - finalize_command="$CC" - - compile_shlibpath= - finalize_shlibpath= - deplibs= - dlfiles= - dlprefiles= - export_dynamic=no - hardcode_libdirs= - libobjs= - link_against_libtool_libs= - ltlibs= - objs= - prev= - prevarg= - release= - rpath= - perm_rpath= - temp_rpath= - vinfo= - - # We need to know -static, to get the right output filenames. - for arg - do - case "$arg" in - -all-static | -static) - if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - for arg - do - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case "$prev" in - dlfiles|dlprefiles) - case "$arg" in - *.la | *.lo) ;; # We handle these cases below. - *) - dlprefiles="$dlprefiles $arg" - test "$prev" = dlfiles && dlfiles="$dlfiles $arg" - prev= - ;; - esac - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath) - rpath="$rpath $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi - - prevarg="$arg" - - case "$arg" in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - if test "$export_dynamic" != yes; then - export_dynamic=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - fi - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` - case "$dir" in - /* | [A-Za-z]:\\*) - # Add the corresponding hardcode_libdir_flag, if it is not identical. - ;; - *) - $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 - exit 1 - ;; - esac - deplibs="$deplibs $arg" - ;; - - -l*) deplibs="$deplibs $arg" ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - - *.o | *.a) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A library object. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes; then - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'` - prev= - fi - libobjs="$libobjs $arg" - ;; - - *.la) - # A libtool-controlled library. - - dlname= - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 - exit 1 - fi - - # If there is no directory component, then add one. - case "$arg" in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$libdir"; then - $echo "$modename: \`$arg' contains no -rpath information" 1>&2 - exit 1 - fi - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 - exit 1 - fi - - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname"; then - # If there is no dlname, we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue - fi - fi - - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" - else - dlprefiles="$dlprefiles $dir/$linklib" - fi - prev= - fi - - if test "$build_libtool_libs" = yes && test -n "$library_names"; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # This is the magic to use -rpath. - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$libdir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" - - compile_command="$compile_command $flag" - finalize_command="$finalize_command $flag" - fi - elif test -n "$runpath_var"; then - # Do the same for the permanent run path. - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - - - case "$hardcode_action" in - immediate) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - elif test "$hardcode_minus_L" = no; then - compile_command="$compile_command -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - compile_shlibpath="$compile_shlibpath$dir:" - compile_command="$compile_command -l$name" - fi - ;; - - relink) - # We need an absolute path. - case "$dir" in - /* | [A-Za-z]:\\*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - compile_command="$compile_command -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - compile_shlibpath="$compile_shlibpath$dir:" - compile_command="$compile_command -l$name" - fi - ;; - - *) - $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2 - exit 1 - ;; - esac - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - finalize_command="$finalize_command -L$libdir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - finalize_shlibpath="$finalize_shlibpath$libdir:" - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - finalize_command="$finalize_command -L$libdir -l$name" - fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 - fi - - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - compile_command="$compile_command -L$dir -l$name" - finalize_command="$finalize_command -L$dir -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - esac - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$vinfo" && test -n "$release"; then - $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - oldlib= - oldobjs= - case "$output" in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - */* | *\\*) - $echo "$modename: output file \`$output' must have no directory components" 1>&2 - exit 1 - ;; - - *.a) - # Now set the variables for building old libraries. - build_libtool_libs=no - build_old_libs=yes - oldlib="$output" - $show "$rm $oldlib" - $run $rm $oldlib - ;; - - *.la) - # Make sure we only generate libraries of the form `libNAME.la'. - case "$output" in - lib*) ;; - *) - $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - current=0 - revision=0 - age=0 - - if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - fi - - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 - exit 1 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2 - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$rpath"; then - $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo - IFS="$save_ifs" - - if test -n "$5"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - test -n "$2" && current="$2" - test -n "$3" && revision="$3" - test -n "$4" && age="$4" - - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test $age -gt $current; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - version_vars="version_type current age revision" - case "$version_type" in - none) ;; - - linux) - version_vars="$version_vars major versuffix" - major=`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - version_vars="$version_vars versuffix verstring" - major=`expr $current - $age` - versuffix="$current.$age.$revision" - verstring="$versuffix" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test $loop != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - version_vars="$version_vars major versuffix" - major="$current" - versuffix="$current.$revision" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Create the output directory, or remove our outputs if we need to. - if test -d $objdir; then - $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*" - $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.* - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - # Add libc to deplibs on all systems. - dependency_libs="$deplibs" - deplibs="$deplibs -lc" - - if test "$build_libtool_libs" = yes; then - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - lib="$objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are PIC. - test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'` - - # Do each of the archive commands. - eval cmds=\"$archive_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Create links to the real library. - for linkname in $linknames; do - $show "(cd $objdir && $LN_S $realname $linkname)" - $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $? - done - - # If -export-dynamic was specified, set the dlname. - if test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - - # Now set the variables for building old libraries. - oldlib="$objdir/$libname.a" - ;; - - *.lo | *.o) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2 - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 - fi - - case "$output" in - *.lo) - if test -n "$objs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Create the old-style object. - reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - test -z "$libobj" && exit 0 - - if test "$build_libtool_libs" != yes; then - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag"; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj || exit 1 - fi - - exit 0 - ;; - - *) - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 - fi - - if test -n "$rpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$libdir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" - - compile_command="$compile_command $flag" - finalize_command="$finalize_command $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - fi - - # Substitute the hardcoded libdirs into the compile commands. - if test -n "$hardcode_libdir_separator"; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - fi - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - fi - - if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${output}S.c" - else - dlsyms= - fi - - if test -n "$dlsyms"; then - # Add our own program objects to the preloaded list. - dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` - - # Discover the nlist of each of the dlfiles. - nlist="$objdir/${output}.nm" - - if test -d $objdir; then - $show "$rm $nlist ${nlist}T" - $run $rm "$nlist" "${nlist}T" - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - # Parse the name list into a source file. - $show "creating $objdir/$dlsyms" - if test -z "$run"; then - # Make sure we at least have an empty file. - test -f "$nlist" || : > "$nlist" - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - wcout=`wc "$nlist" 2>/dev/null` - count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` - (test "$count" -ge 0) 2>/dev/null || count=-1 - else - $rm "$nlist"T - count=-1 - fi - - case "$dlsyms" in - "") ;; - *.c) - $echo > "$objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define dld_preloaded_symbol_count some_other_symbol -#define dld_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test -f "$nlist"; then - sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms" - else - echo '/* NONE */' >> "$objdir/$dlsyms" - fi - - $echo >> "$objdir/$dlsyms" "\ - -#undef dld_preloaded_symbol_count -#undef dld_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define __ptr_t void * -#else -# define __ptr_t char * -#endif - -/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ -int dld_preloaded_symbol_count = $count; - -/* The mapping between symbol names and symbols. */ -struct { - char *name; - __ptr_t address; -} -dld_preloaded_symbols[] = -{\ -" - - if test -f "$nlist"; then - sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms" - fi - - $echo >> "$objdir/$dlsyms" "\ - {0, (__ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif\ -" - ;; - - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - fi - - # Now compile the dynamic symbol file. - $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")" - $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $? - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` - elif test "$export_dynamic" != yes; then - test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 - else - # We keep going just in case the user didn't refer to - # dld_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - - # We have no uninstalled library dependencies, so finalize right now. - $show "$compile_command" - $run eval "$compile_command" - exit $? - fi - - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'` - finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'` - - # Create the binary in the object directory, then wrap it. - if test -d $objdir; then : - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -eq 0 || test -d $objdir; then : - else - exit $status - fi - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case "$dir" in - /* | [A-Za-z]:\\*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - # Delete the old output file. - $run $rm $output - - if test -n "$compile_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" - finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" - fi - - case "$hardcode_action" in - relink) - # AGH! Flame the AIX and HP-UX people for me, will ya? - $echo "$modename: warning: using a buggy system linker" 1>&2 - $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2 - ;; - esac - - $show "$compile_command" - $run eval "$compile_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the finalize command for shipping. - finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"` - - # Quote $echo for shipping. - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! /bin/sh - -# $output - temporary wrapper script for $objdir/$output -# Generated by ltmain.sh - GNU $PACKAGE $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of \``pwd`'. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - link_against_libtool_libs='$link_against_libtool_libs' - finalize_command=\"$finalize_command\" -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" = \"$magic\"; then : - else - echo=\"$qecho\" - file=\"\$0\" - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" - - progdir=\"\$thisdir/$objdir\" - program='$output' - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\` - - export $shlibpath_var -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} - - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - if test "$build_old_libs" = "yes"; then - # Transform .lo files to .o files. - oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Now create the libtool archive. - case "$output" in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.a" - - $show "creating $output" - - # Only create the output if not a dry run. - if test -z "$run"; then - $echo > $output "\ -# $output - a libtool library file -# Generated by ltmain.sh - GNU $PACKAGE $VERSION - -# The name that we can dlopen(3). -dlname='$dlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $objdir && $LN_S ../$output $output)" - $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1 - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional /bin/sh argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL"; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir= - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case "$arg" in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test -n "$isdir"; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test $# -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case "$destdir" in - /* | [A-Za-z]:\\*) ;; - *) - for file in $files; do - case "$file" in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case "$file" in - *.a) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? - test "X$dlname" = "X$realname" && dlname= - - if test $# -gt 0; then - # Delete the old symlinks. - rmcmd="$rm" - for linkname - do - rmcmd="$rmcmd $destdir/$linkname" - done - $show "$rmcmd" - $run $rmcmd - - # ... and create new ones. - for linkname - do - test "X$dlname" = "X$linkname" && dlname= - $show "(cd $destdir && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $LN_S $realname $linkname)" - done - fi - - if test -n "$dlname"; then - # Install the dynamically-loadable library. - $show "$install_prog $dir/$dlname $destdir/$dlname" - $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - $show "$install_prog $file $destdir/$name" - $run eval "$install_prog $file $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case "$destfile" in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'` - ;; - *.o) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - link_against_libtool_libs= - finalize_command= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Check the variables that should have been set. - if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $link_against_libtool_libs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" - if test -z "$libdir"; then - $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2 - elif test -f "$libfile"; then : - else - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - if test "$hardcode_action" = relink; then - if test "$finalize" = yes; then - $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 - $show "$finalize_command" - if $run eval "$finalize_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue - fi - file="$objdir/$file"T - else - $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - $show "$install_prog$stripme $file $dest" - $run eval "$install_prog\$stripme \$file \$dest" || exit $? - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 - fi - - exit 0 - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" - fi - done - fi - - echo "------------------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" - done - echo - echo "To link against installed libraries in a given directory, LIBDIR," - echo "you must use the \`-LLIBDIR' flag during linking." - echo - echo " You will also need to do one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - echo " - use the \`$flag' linker flag" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "------------------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test -f "$file"; then : - else - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case "$file" in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case "$file" in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool uninstall mode - uninstall) - modename="$modename: uninstall" - rm="$nonopt" - files= - - for arg - do - case "$arg" in - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - rmfiles="$file" - - case "$name" in - *.la) - # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $dir/$n" - test "X$n" = "X$dlname" && dlname= - done - test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" - test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - # FIXME: should reinstall the best remaining shared library. - fi - ;; - - *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'` - rmfiles="$rmfiles $dir/$oldobj" - fi - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - - *) - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - esac - done - exit 0 - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 -fi # test -z "$show_help" - -# We need to display help for each of the modes. -case "$mode" in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - --n, --dry-run display commands without modifying any files - --features display configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --version print version information - -MODE must be one of the following: - - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only -library objects (\`.lo' files) may be specified, and \`-rpath' is required. - -If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' -and \`ranlib'. - -If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is -created, otherwise an executable program is created." - ;; - -uninstall) - $echo -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/bin/ly2dvi-old.sh b/bin/ly2dvi-old.sh deleted file mode 100644 index b2e0330aaa..0000000000 --- a/bin/ly2dvi-old.sh +++ /dev/null @@ -1,1005 +0,0 @@ -#!/bin/sh -# -# Script to make a LaTeX file for Lilypond -# -# Written by Jan Arne Fagertun -# Sat Nov 22 22:26:43 CET 1997 -# -# $Id: ly2dvi.sh,v 1.16 1998/05/08 21:18:34 janaf Exp $ -# -# Original LaTeX file made by Mats Bengtsson, 17/8 1997 -# - -VERSION="0.12.jcn1" -NAME=ly2dvi.sh -IDENTIFICATION="$NAME $VERSION" -NOW=`date` -echo "$IDENTIFICATION" 1>&2 - -# TODO: -# prevent orphaned "Lily is here" strings - -# NEWS - -# 0.12.jcn1 -# - mudelaDefs really fixed (sorry, PC) - -# 0.12 -# - -S/--sourcedir switch - -# -#0.11.jcn3 -# - mudelaDefs fixes, (thanks PC) -#0.11.jcn2 -# - pass -I, --include to Lily -# - bf: split $LILYINCLUDE and try all dirs -# - bf: geometry left/top -# -#0.11.pc -# - fix backslash gobbling, reduce number of separate processes used -# - require readable rc files, allow rc file in /usr/local/share/lilypond/lilyrc -# - use latex path, not tex path -# - Don't override if kpsepath returns non-NULL -# - Don't clobber x.tex if it wasn't created by ly2dvi -# -# -#0.11.jcn1 -# - find .fly files too -# -#0.11.hwn1 -# - height vs heigth -# - robustification: give \nonstopmode as LaTeX arg; no hanging if no TeX file. -# - robustification: notice failed cp. - -#0.11 -# - more papersizes (thanks Han-Wen) - don't expect LaTeX to accept all... -# - -W,--Width= : set paper width (points) -# - -H,--Height= : set paper height (points) -# - -H and -W is used only when an unknown papersize is to be specified, -# and has to be combined with a papersize option known to LaTeX -#NB! - -F,--headers= : name of additional LaTeX headers input file. -#NB! Changed from -H to -F -# - -d,--dependencies : passed to lilypond - - -#0.10.jcn1 -# - HEIGHT -> HEIGHT -# - vertical margins (for a4), same on both sides -# - textheight from lilypond output file (mudelapapertextheight) -# - piece titling -# - mudelapiece, mudelaopus -# -#0.10 -# - -K,--keeplilypond : Keep lilypond output files (default delete) -# - -k,--keeply2dvi : Keep ly2dvi output files (default delete) -# - -L,--landscape : Set landscape orientation -# - -N,--nonumber : Turn off page numbering (\pagestyle{empty}) -# - Could not reinsert "\usepackage[T1]{fontenc}" because -# "los-toros" won't work with it -# - Ekstra LaTeX headers from input file -#0.9.hwn1 -# - option to remove output of lily -# 0.9 -# - Trap Lilypond abort -# - Replaced "\usepackage[T1]{fontenc}" with -# \usepackage[latin1]{inputenc} (takk, Mats) -# - Removed "()" around "\LilyIdString" (Janne didn't want it) -# 0.8 - Trap Lilypond segmentation fault -# - Function for cleanup -# - Trap line -# - More human-readable variables -# - Some logics concerning rc-files -# 0.7 -# - Improved Lilypond error checking -# - Output orientation (landscape...). Overrides mudela file -# variable orientation="landscape"; -# - Paper width and height put into variables (only A4!) -# - Adjusted top margin to default..... -# -#TODO -# - Include more papersizes. -# - Manual page....... -# 0.6.jaf2 -# - LILYINCLUDE update -# -# 0.6.hwn1 -# - handle LILYINCLUDE -# - --output -# -# 0.6 -# - Source rc-files, if present. Files are: -# /usr/local/share/lilyrc /etc/lilyrc $HOME/.lilyrc ./.lilyrc -# - tee output from Lilypond -# - Handles margins for A4 paper (equal on both sides) -# - new option -s (--separate) for one LaTeX run per file, -# else all files are run together -# -# 0.5 -# - More useful ("two-level") debug. -# - The Q&D hack to find file names and not handling \include -# is replaced by grabbing output file names from Lilypond. -# = Detects multiple output files - adds them when running -# LaTeX. -# - Works with multiple input files - no matter if they are -# (a mix of) input to or output from Lilypond. -# -#TODO -# - Still no margins handling. -# - We have to discuss how to handle multiple output files -# from Lilypond - 'ly2dvi standchen' gives a rather odd -# result.... - -# 0.4.1 -# - Always exit after printing help info -# 0.4 -# - Changes to ensure for more strict grep'ing of parameters -# Thanks to from G.B.Stott@bolton.ac.uk -# - More efficient use of sed -e 's///' -e 's///' -# Thanks to Johan Vromans and GBS -# - Ask tex for location of titledefs.tex (Thanks to JV) -# - Accept only exact match of "\def\mudelacomposer{" -# (or whatever mudela* defined in titledefs.tex) -# - Even more efficient use of sed (Thanks to JV) -# - Default file name for single output file implemented. -# - Moved help into function - finally included from 0.1.jcn1 -# -#TODO -# - Still doesn't handle \include -# - The Q&D for finding output file name from the sequence of -# \paper \output \midi \output really needs to be looked at. -# I have improved it a lot, but it's only capable of finding -# one (the last) file name. -# Well, I have to rewrite this entirely to handle \include, -# then I can fix it. -# - Still no margins handling. -# -#WARNING -# - Some lines of output from lilypond do NOT start -# at first character position, therefore I have removed "^" -# in sed'ing and grep'ing. - -# 0.3.hwn1 -# - add "Creator: " line to output -# -# 0.3 -# - multiple input files to make score from several files -# (extra files assumed to be Lilypond output) -# - cp dvi-file instead of mv, to allow for xdvi reload -# - check for illegal long options -# - put in pt in text width, if not given -# - put in \nonstopmode in LaTeX file -# - restored LaTeX exit value check - -# 0.2.1 -# - temporarily omit LaTeX exit value check -# - remove ALL temporary files - -# 0.2 -# - fix for solaris - included from 0.1.jcn1 -# - long option hack - included from 0.1.jcn1 - modified -# - moved help into function - NOT included from 0.1.jcn1 yet -# - various improvements - included from 0.1.jcn1 -# - find mudela definitions from titledefs.tex -# - find papersize from lilypond output file (mudelapapersize), -# overridden by option '-p size' or '--papersize=size' -# - option -l lang or --language=lang overrides -# lilypond output file definition (mudelalanguage) -# - textwidth from lilypond output file (mudelapaperlinewidth) - -# 0.1.jcn1 -# - fix for solaris -# - long option hack -# - moved help into function - -# -# Clean up -# -cleanup() { - if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ] - then - [ -n "$LatF" -a -f "$LatF" ] && rm -f $LatF - [ -n "$LOGFILE" -a -f "$LOGFILE" ] && rm -f $LOGFILE - [ -n "$FN" ] && rm -f $FN.* - for F in *$$* $TMP/*$$* - do - rm -f $F - done - fi - if [ "$KEEP_LILY_OUTPUT" != "Y" ] - then - for F in $LILY_OUTPUT_FILES - do - [ -f $F ] && rm -f $F - done - fi -} - -# -# print usage -# -help() { - cat << EOF -Generate dvi file from mudela or lilypond output -Usage: $0 [OPTION]... [FILE]... - -Options: - -D,--debug increase verbosity - -F,--headers= name of additional LaTeX headers file - -H,--Height= set paper height (points) (see manual page) - -I,--include=DIR add DIR to search path of LilyPond - -K,--keeplilypond keep lilypond output files - -L,--landscape set landscape orientation - -N,--nonumber switch off page numbering - -O,--orientation= set orientation (obsolete - use -L instead) - -W,--Width= set paper width (points) (see manual page) - -d,--dependencies tell lilypond make a dependencies file - -h,--help this help text - -k,--keeply2dvi keep ly2dvi output files - -l,--language= give LaTeX language (babel) - -o,--output= set output directory - -p,--papersize= give LaTeX papersize (eg. a4) - -s,--separate run all files separately through LaTeX - -S,--sourcedir set sourcedir - - files may be (a mix of) input to or output from lilypond(1) -EOF -} - - -# -# SVr4 echo swallows backslashes, and there's no way to turn it off. -# Therefore use Echo whenever backslashes may be important. -# printf is in the posix.2 standard -- which means it's in -# all modern shells. -# -Echo() { - printf "%s\n" "$@" -} - -# -setPaperZize() { -case "$PAPERSIZE" in - a0*) - PWIDTH=2389 - PHEIGHT=3381 - PAPERSIZE=a0paper - ;; - a1|a1p*) - PWIDTH=1690 - PHEIGHT=2389 - PAPERSIZE=a1paper - ;; - a2*) - PWIDTH=1194 - PHEIGHT=1690 - PAPERSIZE=a2paper - ;; - a3*) - PWIDTH=845 - PHEIGHT=1194 - PAPERSIZE=a3paper - ;; - a4*) - PWIDTH=597 - PHEIGHT=845 - PAPERSIZE=a4paper - ;; - a5*) - PWIDTH=423 - PHEIGHT=597 - PAPERSIZE=a5paper - ;; - a6*) - PWIDTH=298 - PHEIGHT=423 - PAPERSIZE=a6paper - ;; - a7*) - PWIDTH=211 - PHEIGHT=298 - PAPERSIZE=a7paper - ;; - a8*) - PWIDTH=305 - PHEIGHT=211 - PAPERSIZE=a8paper - ;; - a9*) - PWIDTH=105 - PHEIGHT=305 - PAPERSIZE=a9paper - ;; - a10*) - PWIDTH=74 - PHEIGHT=105 - PAPERSIZE=a10paper - ;; - b0*) - PWIDTH=2847 - PHEIGHT=4023 - PAPERSIZE=b0paper - ;; - b1*) - PWIDTH=2012 - PHEIGHT=2847 - PAPERSIZE=b1paper - ;; - b2*) - PWIDTH=1423 - PHEIGHT=2012 - PAPERSIZE=b2paper - ;; - b3*) - PWIDTH=1006 - PHEIGHT=1423 - PAPERSIZE=b3paper - ;; - b4*) - PWIDTH=712 - PHEIGHT=1006 - PAPERSIZE=b4paper - ;; - b5*) - PWIDTH=503 - PHEIGHT=712 - PAPERSIZE=b5paper - ;; - archA) - PWIDTH=650 - PHEIGHT=867 - ;; - archB) - PWIDTH=867 - PHEIGHT=1301 - ;; - archC) - PWIDTH=1301 - PHEIGHT=1734 - ;; - archD) - PWIDTH=1734 - PHEIGHT=2602 - ;; - archE) - PWIDTH=2602 - PHEIGHT=3469 - ;; - flsa|flse) - PWIDTH=614 - PHEIGHT=940 - ;; - halfletter) - PWIDTH=397 - PHEIGHT=614 - ;; - ledger) - PWIDTH=1229 - PHEIGHT=795 - ;; - legal) - PWIDTH=614 - PHEIGHT=1012 - ;; - letter) - PWIDTH=614 - PHEIGHT=795 - ;; - note) - PWIDTH=542 - PHEIGHT=723 - ;; - *) - echo "" - echo $0": unknown papersize -- "$PAPERSIZE - echo "" - ;; -esac -} - -doRcFiles() -{ -# -# RC-files ? -# -for D in /usr/local/share/ /usr/local/share/lilypond/ /etc/ $HOME/. ./. -do - RCfile=$D"lilyrc" - [ -r $RCfile ] && . $RCfile -done -fORI=$ORIENTATION -fLNG=$LANGUAGE -fPSZ=$PAPERSIZE -fLHF=$LATEXHF -unset ORIENTATION LANGUAGE PAPERSIZE LATEXHF -} - - - -# -# Trap function (cleanup) -# - - - -trap cleanup 0 9 15 - - - -# -# Various defaults -# -[ -z "$TMP" ] && TMP=/tmp -if [ ! -d $TMP ] -then - $debug_echo $IDENTIFICATION": temporary directory "$TMP" not found, set to /tmp" - TMP=/tmp -fi -LOGFILE=$TMP/lilylog.$$ # Logfile for lilypond -PAPERSIZE=a4 # Default papersize name -PWIDTH=597 # Default paperwidth -PHEIGHT=845 # Default paperheight -PNUM="%" # Page numbering on -LILYOPTS="" # Options to lilypond -SOURCEDIR="" -LILYPOND_EXECUTABLE=lilypond -doRcFiles - - - -# Keywords defined in titledefs.tex -# -TF="`kpsewhich -n latex tex titledefs.tex`" -MU_DEF="" -if [ -r "${TF:=/usr/local/share/texmf/tex/lilypond/titledefs.tex}" ] -then - MU_DEF=`sed -n -e 's/.*newcommand\*{.\(mudela[^}]*\)}.*$/\1/p' "$TF"` -fi - -: "${MU_DEF:=mudelatitle mudelasubtitle mudelacomposer \ - mudelameter mudelaopus mudelaarranger mudelapiece \ - mudelapoet mudelainstrument \ - }" - -# -# debugging -# -debug_echo=: -# -# All files in one LaTeX run -# -SEPFILE=N -# -# Find command line options and switches -# -# "x:" x takes argument -# -switches="DF:H:I:KLNO:W:dhkl:o:p:S:s\?" -options="" -# -# ugh, "\-" is a hack to support long options -# while getopts \-:$options$switches O -# must be in double quotes for bash-2.0 -while getopts "\-:$options$switches" O -do - $debug_echo "O: \`$O'" - $debug_echo "arg: \`$OPTARG'" - case $O in - D ) - [ $debug_echo = echo ] && set -x - debug_echo=echo - ;; - F ) - LATEXHF=$OPTARG - ;; - H ) - PHEIGHT=$OPTARG - ;; - I ) - LILYOPTS="$LILYOPTS -I $OPTARG" - LILYINCLUDE="$LILYINCLUDE:$OPTARG" - ;; - K ) - KEEP_LILY_OUTPUT=Y - ;; - L ) - ORIENTATION=landscape - ;; - O ) - ORIENTATION=$OPTARG - ;; - N ) - PNUM="\pagestyle{empty}" - ;; - W ) - PWIDTH=$OPTARG - ;; - d ) - LILYOPTS=$LILYOPTS" -d" - ;; - h ) - help; - exit 0 - ;; - k ) - KEEP_LY2DVI_OUTPUT=Y - ;; - l ) - LANGUAGE=$OPTARG - ;; - o ) - OUTPUTDIR=$OPTARG - ;; - p ) - PAPERSIZE=$OPTARG - ;; - s ) - SEPFILE=Y - ;; - S ) - SOURCEDIR=$OPTARG - ;; - \? ) - help; - exit -1 - ;; - # a long option! - -) - $debug_echo "long option: \`$OPTARG'" - case "$OPTARG" in - He*|-He*) - PHEIGHT"`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`"= - ;; - W*|-W*) - PWIDTH="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - dep*|-dep*) - LILYOPTS="$LILYOPTS -d" - ;; - d*|-d*) - [ $debug_echo = echo ] && set -x - debug_echo=echo - ;; - hea*|-hea*) - LATEXHF="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - h*|-h*) - help; - exit 0 - ;; - i*|-i*) - dir="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - LILYOPTS="$LILYOPTS --include=$dir" - LILYINCLUDE="$LILYINCLUDE:$dir" - ;; - keepli*|-keepli*) - KEEP_LILY_OUTPUT=Y - ;; - k*|-k*) - KEEP_LY2DVI_OUTPUT=Y - ;; - land*|-land*) - ORIENTATION=landscape - ;; - lang*|-lang*) - LANGUAGE="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - n*|-n*) - PNUM="\pagestyle{empty}" - ;; - or*|-or*) - ORIENTATION="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - ou*|-ou*) - OUTPUTDIR="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - p*|-p*) - PAPERSIZE="`expr \"$OPTARG\" ':' '[^=]*=\(.*\)'`" - ;; - separa*|-sep*) - SEPFILE=Y - ;; - sourcedir*|-sourcedir*) - SOURCEDIR=$OPTARG - ;; - *|-*) - echo "$0: illegal option -- \"$OPTARG\"" - help; - exit -1 - ;; - esac - esac -done -shift `expr $OPTIND - 1` - -if [ "$SOURCEDIR" != "" ]; then -# apparently MakeTeXTFM can't handle relative dirs - SOURCEDIR=`cd $SOURCEDIR; pwd` - LILYINCLUDE="$SOURCEDIR/init:$SOURCEDIR/mf/out:$LILYINCLUDE" - TEXINPUTS="$SOURCEDIR/tex:$TEXINPUTS:" - MFINPUTS="$SOURCEDIR/mf:$MFINPUTS:" - LILYPOND_EXECUTABLE="$SOURCEDIR/lily/out/lilypond" - export MFINPUTS LILYPOND_EXECUTABLE TEXINPUTS SOURCEDIR -fi - -# -# Input file name -# -if [ "$1" = "" ] -then - help - $debug_echo "$IDENTIFICATION: No input file name given" - exit 1 -fi -# regexp_quote -- quote a string as a regular expression for egrep or sed -regexp_quote(){ - Echo "$@" | sed 's/\([]\[\.*?+^$]\)/\\\1/g' -} -# -# -mudelaDefs(){ -# Include \def\mudela-definitions -# The aim here is to pick up the definition for the -# current file, then any other file. -# -mudelatmp=$TMP/mudelaDefs$$ -# Use `cat' to prevent filenames being prepended -# -cat "$File" $OF | fgrep "$MU_DEF" > $mudelatmp -for L in $MU_DEF -do - # This converts \def\mudelatitle{fred} - # to \mudelatitle{fred} or to - # \def\mudelatitle{fred} - # and stops after the first one found. - sed -n '/\\def\\'"$L"'{\([^}]*\)}.*$/{ - s//'"`regexp_quote \"$1\"`"'\\'"$L"'{\1}%/p - q - }' $mudelatmp >> $LatF -done -rm -f $mudelatmp -} -# -# -startFile(){ -# -# LaTeX file name -# -BN=`basename "$File" .tex` -FN="$BN.$$" -if [ "$KEEP_LY2DVI_OUTPUT" != "Y" ] -then - LatF="$TMP/$FN.tex" -else - LatF="$FN.tex" -fi -# -# Find: -# paper size (PAPERSIZE, overridden by command line option -p) -# paper orientation (ORIENTATION, overridden by option -o) -# language (LANGUAGE, overridden by option -l) -# textwidth -# -eval `sed -n \\ - -e 's/\\\\def\\\\mudelalanguage{\([^}]*\).*$/fLNG=\1;/p' \\ - -e 's/\\\\def\\\\mudelalatexheaders{\([^}]*\).*$/fLHF=\1;/p' \\ - -e 's/\\\\def\\\\mudelaorientation{\([^}]*\).*$/fORI=\1;/p' \\ - -e 's/\\\\def\\\\mudelapaperlinewidth{\([^}]*\).*$/TWN=\1;/p' \\ - -e 's/\\\\def\\\\mudelapapertextheight{\([^}]*\).*$/THN=\1;/p' \\ - -e 's/\\\\def\\\\mudelapapersize{\([^}]*\).*$/fPSZ=\1;/p' \\ - "$File"` -# -if [ -z "$LATEXHF" ] -then - LATEXHF="$fLHF" -fi -LLHF="%" -if [ -n "$LATEXHF" ] -then - [ -f "$LATEXHF" ] && LLHF="\input{$LATEXHF}" -fi -# -if [ -z "$PAPERSIZE" ] -then - PAPERSIZE="$fPSZ" -fi -if [ -n "$PAPERSIZE" ] -then - setPaperZize - PAPEROPT="$PAPERSIZE" -fi -# -if [ -z "$ORIENTATION" ] -then - ORIENTATION="$fORI" -fi -if [ -n "$ORIENTATION" ] -then - if [ -z "$PAPEROPT" ] - then - PAPEROPT="$ORIENTATION" - else - PAPEROPT="$PAPEROPT,$ORIENTATION" - fi -fi -# -if [ -n "$PAPEROPT" ] -then - PAPER="[$PAPEROPT]" -fi -# -if [ -z "$LANGUAGE" ] -then - LANGUAGE="$fLNG" -fi -if [ -n "$LANGUAGE" ] -then - LLNG="\usepackage[$LANGUAGE]{babel}" -else - LLNG="%" -fi - -# -# Find textwidth -# -if [ -n "$TWN" ] -then - TW="$TWN" - case "$TW" in - *mm) - ;; - *cm) - ;; - *pt) - ;; - *) - TW="${TW}pt" - ;; - esac - $debug_echo "Text width = $TW" -fi -TWp=`Echo $TW | sed -e 's/\..*$//'` -PWp="$PWIDTH" -# -# Find textheight -# -if [ -n "$THN" ] -then - TH=$THN - case $TH in - *mm) - ;; - *cm) - ;; - *pt) - ;; - *) - TH="${TH}pt" - ;; - esac - $debug_echo "Text height = $TH" -fi -THp="`echo $TH | sed -e 's/\..*$//'`" -PHp="$PHEIGHT" -if [ "$ORIENTATION" = "landscape" ] -then - PWp="$PHEIGHT" - PHp="$PWIDTH" -fi -HMARG="`expr '(' $PWp - $TWp ')' / 2`"pt -$debug_echo "Text left = $HMARG" -VMARG="`expr '(' $PHp - $THp ')' / 2`"pt -$debug_echo "Text top = $VMARG" -# -# Geometry: /var/lib/texmf/latex/geometry/geometry.dvi -# -# -# Write LaTeX file -# -cat << EOF > $LatF -% Creator: $IDENTIFICATION -% Automatically generated from $IF, $NOW - -\documentclass$PAPER{article} - -$LLNG -\usepackage{geometry} -\usepackage[latin1]{inputenc} -%\usepackage[T1]{fontenc} -$PNUM -%\addtolength{\oddsidemargin}{-1cm} -%\addtolength{\topmargin}{-1cm} -%\setlength{\textwidth}{$TW} -%\setlength{\textheight}{$TH} -\geometry{width=$TW, left=$HMARG, height=$TH, top=$VMARG} -\input lilyponddefs -\input titledefs -$LLHF -\begin{document} -EOF -mudelaDefs -cat << EOF >> $LatF -\cmrtwenty% ugh -\makelilytitle -EOF -} -nextFile(){ -cat << EOF >> $LatF -\def\theopus{}% -\def\thepiece{}% -\def\mudelaopus{}% -\def\mudelapiece{}% -EOF -mudelaDefs "\\def" -cat << EOF >> $LatF -\def\theopus{\mudelaopus}% ugh -\def\thepiece{\mudelapiece}% -\makelilypiecetitle -EOF -} -# -# Conclusion -# -endFile(){ -cat << EOF >> $LatF -\vfill\hfill{\LilyIdString} -\end{document} -EOF -# -# Run LaTeX -# -latex '\nonstopmode \input '$LatF || exit 5 -# -# Rename dvi file -# -if [ -f $FN.dvi ] -then - RESULT="$BN.dvi" - [ -n "$OUTPUTDIR" ] && RESULT="$OUTPUTDIR/$RESULT" - - cp "$FN.dvi" "$RESULT" || exit 5 -fi -# -# Output some info -# -cat << EOF - -$IDENTIFICATION: dvi file name is $RESULT - -EOF -} - -# ugh. GF is side-effect. -findInput() { -# should check for LILYINCLUDE - OIFS="$IFS" - IFS=':' - x=`echo $LILYINCLUDE | sed "s!:! !g"` - IFS="$OIFS" - for lypath in . $x - do - if [ -f "$lypath/$1" ] - then - GF="$lypath/$1" - return - fi - - if [ -f "$lypath/$1.ly" ] - then - GF="$lypath/$1.ly" - return - fi - if [ -f "$lypath/$1.fly" ] - then - GF="$lypath/$1.fly" - return - fi - done - $debug_echo "$IDENTIFICATION: Input file \"$GF\" not found" - echo "$NAME: Input file \"$GF\" not found" 1>&2 - exit 2 -} -# -# Loop through all files -# - -LILY_OUTPUT_FILES= - -for GF -do - findInput $GF - - # - # Check whether the file is input to or output from lilypond - # - L1=`head -1 $GF` - OP=`echo $L1 | grep "^% Creator: GNU LilyPond"` - if [ -n "$OP" ] - then - # - # OK - it's the output from lilypond. - # - # Get lilypond source file name - # - OF=$GF - IFL=`grep mudelafilename $OF` - if [ "$IFL" != "" ] - then - IF=`echo $IFL | sed -e 's/.*{//' -e 's/}*.$//'` - # - # Check if source file exists - # - if [ ! -f $IF ] - then - $debug_echo $IDENTIFICATION": Mudela file not found." - TW=15.5cm - TH=25.0cm - fi - else - $debug_echo $IDENTIFICATION": Mudela file name not found." - TW=15.5cm - TH=25.0cm - fi - else - # - # I have to assume this is the lilypond input file - # Find output file name, if defined - # - IF=$GF - # - # Run lilypond - # Grab output file names - # - $debug_echo "lilypond "$LILYOPTS $IF - - $LILYPOND_EXECUTABLE $LILYOPTS $IF 2>&1 | tee $LOGFILE - OF="`sed -n -e 's/TeX output to \([^\.]*\.tex\)\.\.\.$/\1/p' $LOGFILE`" - $debug_echo "==> $OF" - LILY_OUTPUT_FILES="$LILY_OUTPUT_FILES $OF" - STATUS=`egrep -i "error|segmentation|abort" $LOGFILE` - echo $STATUS - if [ ! -z "$STATUS" ] - then - exit 10 - fi - fi - # - # "Spin through" all the files - # - for File in $OF - do - $debug_echo "--- "$File - # - # Check if output file is generated - # - if [ ! -f "$File" ] - then - $debug_echo "$IDENTIFICATION: hmm, I could not find the output file $File" - exit 4 - fi - # - # Is this the first file? - # - if [ -z "$FFile" ] - then - FFile="$File" - startFile - else - nextFile - fi - cat << EOF >> $LatF -\input{$File} -EOF - if [ $SEPFILE = Y ] - then - FFile="" - endFile - fi - done -done -if [ $SEPFILE = N ] -then - endFile -fi -# -# OK - finished -# diff --git a/bin/ly2dvi.py b/bin/ly2dvi.py deleted file mode 100644 index 943aef7bec..0000000000 --- a/bin/ly2dvi.py +++ /dev/null @@ -1,1118 +0,0 @@ -#!@PYTHON@ - -""" -======================================================================= -LilyPond to dvi converter - -Features include Title information, paper size specification, and image -orientation. - -Usage: ly2dvi.py [OPTION]... [FILE]... -Input: LilyPond source or LilyPond generated TeX files -Output: DVI file -======================================================================= -""" - -name = 'ly2dvi' -version = '0.0.6' -errorlog = '' - -import sys -import os -import getopt -import re -import string -import time -import glob - - -class Input: - """ - This class handles all ly2dvi.py input file methods - - Public methods: - - __init__() Constructor - open(file) Open a .ly file or .tex file using lilyinclude path - close() Close current file - type() Determine file type .ly (input) or .tex (output) - setVars() Set title definitions found in .tex (output) file - """ - - # - # Constructors - # - - def __init__(this): - this.__fd = None - - # - # open - # - def open(this,file): - """ - open file and set private class variable __fd. The search - sequence is: current directory followed by the directories - found in include property list. Each directory is searched - for file, file.ly, and file.fly. - - input: file filename - output: void - error: ExitNotFound Exception - """ - - for i in [''] + Props.get('include')[0:]: - ifile = os.path.join(i,file) - for j in ['','.ly','.fly']: - jfile = ifile+j - try: - this.__fd = open( jfile, 'r' ) - return - except: - pass - sys.exit('ExitNotFound', file) - - - # - # close - # - def close(this): - """ - close file object __fd - - input: void - output: void - error: None - """ - this.__fd.close() - - - # - # type - # - def type(this): - """ - Determine input file type. LilyPond source is 'input' type - and LilyPond generated TeX file is 'output' type - - input: void - output: 'input' | 'output' - error: None - """ - - firstline = this.__fd.readline() - this.__fd.seek(0) - if re.match('% Creator: GNU LilyPond [0-9]+[.0-9]+',firstline ): - return 'output' - else: - return 'source' - - - # - # setVars - # - def setVars(this): - """ - Search for properties in the current input file and set the - appropriate values. The supported properties names are in - local variable varTable along with the property list - titledefs. - - input: void - output: None - error: None - """ - - varTable = [ - # regexp set method - # ------ ---------- - ( 'language', Props.setLanguage ), - ( 'latexheaders', Props.setHeader ), - ( 'orientation', Props.setOrientation ), - ( 'paperpapersize', Props.setPaperZize ), - ( 'papertextheight', Props.setTextHeight ), - ( 'paperlinewidth', Props.setLineWidth ), - ( 'filename', Props.setFilename ), - ] - - titles={} - for line in this.__fd.readlines(): - m=re.match('\\\\def\\\\mudela([\w]+){(.*)}',line) - if m: - for var in varTable: - if m.group(1) == var[0]: - var[1](m.group(2),'file') - break - for var in Props.get('titledefs'): - if m.group(1) == var: - titles[var]=m.group(2) - break - Props.setTitles(titles,'file') - this.__fd.seek(0) - - - -class TeXOutput: - """ - This class handles all ly2dvi.py output file methods - - private methods: - __mudelaDefs(opt) Send title info to output file - - Public methods: - __init__() Constructor - write(str) Write a string to output file - start(file) Start the latex file - next() Process next output file - end() Finish latex file and run latex - """ - - # - # constructor - # - def __init__(this): - this.__fd = None - this.__base = '' - this.__outfile = '' - - # - # __medelaDefs - # - def __mudelaDefs(this,opt): - """ - Write titles to output - - input: opt Supports header and subheader output - output: None - error: None - """ - - titles = Props.get('titles') - for key in titles.keys(): - this.write('%s\\mudela%s{%s}%%\n' % (opt,key,titles[key])) - - # - # write - # - def write(this,str): - """ - Write str to current output file - - input: str String to write - output: None - error: None - """ - - this.__fd.write(str) - - # - # start - # - def start(this,file): - """ - Start LaTeX file. Calculates the horizontal and vertical - margin using pagewidth, pageheight, linewidth, and textheight. - Creates temporary output filename and opens it for write. - Sends the LaTeX header information to output. Lastly sends - the title information to output. - - input: file output file name - output: None - error: None - """ - - now=time.asctime(time.localtime(time.time())) - linewidth = Props.get('linewidth') - textheight = Props.get('textheight') - - if Props.get('orientation') == 'landscape': - pagewidth = Props.get('pageheight') - pageheight = Props.get('pagewidth') - else: - pageheight = Props.get('pageheight') - pagewidth = Props.get('pagewidth') - - horizontalMarginArg = ( (pagewidth - linewidth)/2 ) - verticalMarginArg = ( (pageheight - textheight)/2 ) - - top="""\ -%% Creator: %s -%% Automatically generated from %s, %s - -\\documentclass[%s]{article} - -%s -\\usepackage{geometry} -\\usepackage[latin1]{inputenc} -%%\\usepackage[T1]{fontenc} -%s -%%\\addtolength{\\oddsidemargin}{-1cm} -%%\\addtolength{\\topmargin}{-1cm} -%%\\setlength{\\textwidth}{%s} -%%\\setlength{\\textheight}{%s} -\\geometry{width=%spt, left=%spt, height=%spt, top=%spt} -\\input lilyponddefs -\\input titledefs -%s -\\begin{document} -""" % ( program_id(), Props.get('filename'), now, Props.get('papersize'), - Props.get('language'), Props.get('pagenumber'), linewidth, textheight, - linewidth, horizontalMarginArg, textheight, verticalMarginArg, - Props.get('header') ) - - pathcomp = os.path.splitext(file) - this.__base = pathcomp[0] - this.__outfile = '%s.%d%s' % (pathcomp[0], os.getpid(), pathcomp[1]) - try: - this.__fd = open(this.__outfile,"w") - except: - sys.exit('ExitNoWrite', this.__outfile) - this.write(top) - this.__mudelaDefs('') - this.write("""\ -\\cmrtwenty% ugh -\\makelilytitle -""") - - # - # next - # - def next(this): - """ - Write LaTeX subheader information to support more than one - score in a document. Lastly send current title information to - output. - - input: None - output: None - error: None - """ - - this.write("""\ -\\def\\theopus{}% -\\def\\thepiece{}% -\\def\\mudelaopus{}% -\\def\\mudelapiece{}% -""") - this.__mudelaDefs("\\def") - this.write("""\ -\\def\\theopus{\\mudelaopus}% ugh -\\def\\thepiece{\\mudelapiece}% -\\makelilypiecetitle -""") - - - # - # end - # - def end(this): - """ - Close output file and run latex on it. - - input: None - output: None - error: ExitBadLatex Exception - """ - - outfile=this.__base + '.dvi' - if Props.get('output') != '': - outfile = os.path.join(Props.get('output'), outfile ) - - this.write("""\ -\\vfill\\hfill{\\LilyIdString} -\\end{document} -""") - this.__fd.close() - if ( os.name == 'posix' ): - stat = os.system('latex \'\\nonstopmode \\input %s\'' % - (this.__outfile)) - else: # Windows shells don't eat the single quotes - stat = os.system('latex \\nonstopmode \\input %s' % - (this.__outfile)) - if stat: - sys.exit('ExitBadLatex') - if os.path.isfile(outfile): - os.remove(outfile) - os.rename(this.__base + '.' + str(os.getpid()) + '.dvi', outfile) - sys.stderr.write( '\n' + program_id() + ': dvi file name is %s\n\n' - % (outfile)) - - if Props.get('postscript'): - psoutfile=this.__base + '.ps' - if Props.get('output') != '': - psoutfile = os.path.join(Props.get('output'), psoutfile ) - stat = os.system('dvips -o %s %s 2>&1' % (psoutfile,outfile)) - if stat: - sys.exit('ExitBadPostscript') - - - - -class Properties: - """ - This class handles all ly2dvi.py property manipulation - - Public methods: - - __init__() Constructor - set methods - """ - - def __init__(this): - - # - # Following is the order of priority for property assignment. The - # list is organized from lowest to highest priority. Each - # assignment is overridden by the next requester in the list. - # - # Requester Description - # --------- ----------- - # init Initial default values - # file The values found in the lilypond generated TeX files - # environment Envrionment variables LILYINCLUDE, LILYPONDPREFIX - # rcfile $LILYPONDPREFIX/share/lilypond/.lilyrc - # rcfile $HOME/.lilyrc - # rcfile ./.lilyrc - # commandline command line arguments - # - this.__overrideTable = { - 'init' : 0, - 'file' : 1, - 'environment' : 2, - 'rcfile' : 3, - 'commandline' : 4, - 'program' : 5 - } - - this.__roverrideTable = {} # reverse lookup used for debug - for i in this.__overrideTable.items(): - this.__roverrideTable[i[1]]=i[0] - - this.__data = { - 'pagewidth' : [597, this.__overrideTable['init']], - 'pageheight' : [845, this.__overrideTable['init']], - 'papersize' : ['a4paper', this.__overrideTable['init']], - 'textheight' : [0, this.__overrideTable['init']], - 'linewidth' : [0, this.__overrideTable['init']], - 'orientation' : ['portrait', this.__overrideTable['init']], - 'language' : ['%', this.__overrideTable['init']], - 'include' : [[], this.__overrideTable['init']], - 'debug' : [0, this.__overrideTable['init']], - 'keeplilypond' : [0, this.__overrideTable['init']], - 'keeply2dvi' : [0, this.__overrideTable['init']], - 'pagenumber' : ['%', this.__overrideTable['init']], - 'separate' : [0, this.__overrideTable['init']], - 'output' : ['', this.__overrideTable['init']], - 'header' : ['%', this.__overrideTable['init']], - 'dependencies' : [0, this.__overrideTable['init']], - 'root' : ['', this.__overrideTable['init']], - 'tmp' : ['d:\tmp', this.__overrideTable['init']], - 'filename' : ['', this.__overrideTable['init']], - 'titledefs' : [[], this.__overrideTable['init']], - 'titles' : [{}, this.__overrideTable['init']], - 'lilyOutputFiles' : [[], this.__overrideTable['init']], - 'postscript' : [0, this.__overrideTable['init']], - } - - # - # Try to set root and HOME first before calling rcfile - # - if os.environ.has_key('LILYPONDPREFIX'): - this.setRoot(os.environ['LILYPONDPREFIX'], 'environment') - else: - p=os.path.split(sys.argv[0]) - p=os.path.split(p[0]) - this.setRoot(p[0],'init') - - if not os.environ.has_key('HOME'): - if os.environ.has_key('HOMEDRIVE') and \ - os.environ.has_key('HOMEPATH'): - os.environ['HOME'] = os.environ['HOMEDRIVE'] + \ - os.environ['HOMEPATH'] - else: - os.environ['HOME'] = os.curdir - - this.rcfile() # Read initialization file(s) - - if os.environ.has_key('LILYINCLUDE'): - tmp=this.get('include') - for s in string.split(os.environ['LILYINCLUDE'],os.pathsep): - tmp.append(s) - this.__set('include', tmp, 'environment') - - - t='' - if os.environ.has_key ('TEXINPUTS'): - t = os.pathsep + os.environ['TEXINPUTS'] - os.environ['TEXINPUTS'] = os.path.join(this.get('root'), 'texmf', - 'tex', 'lilypond' ) + t - - t='' - if os.environ.has_key ('MFINPUTS'): - t = os.pathsep + os.environ['MFINPUTS'] - os.environ['MFINPUTS'] = os.path.join(this.get('root'), 'texmf', - 'mf', 'public', 'lilypond' ) + t - - if os.environ.has_key('TMP'): - this.__set('tmp',os.environ['TMP'],'environment') - - - fd=this.get_texfile_path ('titledefs.tex') - mudefs=[] - - for line in fd.readlines(): - m=re.match('\\\\newcommand\*{\\\\mudela([\w]+)}',line) - if m: - mudefs.append(m.group(1)) - fd.close - this.__set('titledefs', mudefs, 'init') - - # - # __set - # - def __set(this,var,value,requester): - """ - All of the set methods call this to set a property. If the value - was last set by a requestor of lesser priority the new value is - assigned, else the old value has priority and is unchanged. - """ - - if this.__overrideTable[requester] < this.__data[var][1]: - return 0 - else: - this.__data[var] = [value, this.__overrideTable[requester]] - - # - # get - # - def get(this,var): - """ - All of the get methods call this to get a property value. List - variable types are return by value to facilitate an append operation. - """ - - if var == 'include' or var == 'lilyOutputFiles': - return this.__data[var][0][0:] # return a copy not a ref - else: - return this.__data[var][0] - - # - # get_texfile_path - # - def get_texfile_path (this, var): - """ - locate and open titledefs.tex file - """ - - if os.name == 'nt': - path = os.path.join(this.get('root'), 'texmf', 'tex', - 'lilypond', var) - else: - path ='' - cmd =('kpsewhich tex %s %s' % (var,errorlog)) - pipe = os.popen (cmd, 'r') - path = pipe.readline ()[:-1] # chop off \n - return_status = pipe.close() - if return_status and not path: - path = os.path.join(this.get('root'), 'texmf', 'tex', - 'lilypond', var) - fd = open(path, 'r') - return fd - - - # - # Read rc file - # - def rcfile(this): - """ - Read initialization file(s) - """ - varTable = [ - # name set method - # ---- ---------- - ( 'DEBUG', this.setDebug ), - ( 'DEPENDENCIES', this.setDependencies ), - ( 'KEEPLILYPOND', this.setKeeplilypond ), - ( 'KEEPLY2DVI', this.setKeeply2dvi ), - ( 'LANGUAGE', this.setLanguage ), - ( 'LATEXHF', this.setHeader ), - ( 'LILYINCLUDE', this.setInclude ), - ( 'LILYPONDPREFIX', this.setRoot ), - ( 'NONUMBER', this.setNonumber ), - ( 'ORIENTATION', this.setOrientation ), - ( 'OUTPUTDIR', this.setOutput ), - ( 'PAPERSIZE', this.setPaperZize ), - ( 'PHEIGHT', this.setTextHeight ), - ( 'POSTSCRIPT', this.setPostscript ), - ( 'PWIDTH', this.setLineWidth ), - ( 'SEPARATE', this.setSeparate ), - ( 'TMP', this.setTmp ), - ] - - if ( os.name == 'posix' ): - dotFilename='.lilyrc' - else: # Windows apps like edit choke on .lilyrc - dotFilename='_lilyrc' - - for d in [os.path.join(this.get('root'),'share','lilypond'), \ - os.environ['HOME'], os.curdir ]: - file=os.path.join(d,dotFilename) - try: - fd = open( file, 'r' ) - except: - continue - - for line in fd.readlines(): - if re.match('#.*',line): - continue - m=re.search('([\w]+)=(.*)',line) - if m: - for var in varTable: - if m.group(1) == var[0]: - var[1](m.group(2),'rcfile') - break - fd.close - - # - # setPaperZize - # - def setPaperZize(this,size,requester): - """ - Set paper size properties - """ - - paperTable = [ - # regex width height name - # ----- ----- ------ ---- - ( 'a0.*', 2389, 3381, 'a0paper' ), - ( 'a1$|a1p.*', 1690, 2389, 'a1paper' ), - ( 'a2.*', 1194, 1690, 'a2paper' ), - ( 'a3.*', 845, 1194, 'a3paper' ), - ( 'a4.*', 597, 845, 'a4paper' ), - ( 'a5.*', 423, 597, 'a5paper' ), - ( 'a6.*', 298, 423, 'a6paper' ), - ( 'a7.*', 211, 298, 'a7paper' ), - ( 'a8.*', 305, 211, 'a8paper' ), - ( 'a9.*', 105, 305, 'a9paper' ), - ( 'a10.*', 74, 105, 'a10paper' ), - ( 'b0.*', 2847, 4023, 'b0paper' ), - ( 'b1.*', 2012, 2847, 'b1paper' ), - ( 'b2.*', 1423, 2012, 'b2paper' ), - ( 'b3.*', 1006, 1423, 'b3paper' ), - ( 'b4.*', 712, 1006, 'b4paper' ), - ( 'b5.*', 503, 712, 'b5paper' ), - ( 'archA$', 650, 867, 'archApaper' ), - ( 'archB$', 867, 1301, 'archBpaper' ), - ( 'archC$', 1301, 1734, 'archCpaper' ), - ( 'archD$', 1734, 2602, 'archDpaper' ), - ( 'archE$', 2602, 3469, 'archEpaper' ), - ( 'flsa$|flse$', 614, 940, 'flsapaper' ), - ( 'halfletter$', 397, 614, 'halfletterpaper' ), - ( 'ledger$', 1229, 795, 'ledgerpaper' ), - ( 'legal$', 614, 1012, 'legalpaper' ), - ( 'letter$', 614, 795, 'letterpaper' ), - ( 'note$', 542, 723, 'notepaper' ) - ] - - found=0 - for paper in paperTable: - if re.match(paper[0],size): - found=1 - this.__set('pagewidth',paper[1],requester) - this.__set('pageheight',paper[2],requester) - this.__set('papersize',paper[3],requester) - break - - if not found: - sys.exit('ExitBadPaper',size) - - # - # setTextHeight - # - def setTextHeight(this,size,requester): - """ - Set textheight property - """ - - m=re.match('([0-9][.0-9]*)(cm|mm|pt|$)',size) - if m: - if m.group(2) == 'cm': - this.__set('textheight',\ - float(m.group(1)) * 72.27/2.54, requester ) - elif m.group(2) == 'mm': - this.__set('textheight',\ - float(m.group(1)) * 72.27/25.4, requester ) - elif m.group(2) == 'pt': - this.__set('textheight', float(m.group(1)), requester ) - elif m.group(2) == '': - this.__set('textheight', float(m.group(1)), requester ) - else: - sys.exit('ExitBadHeight', m.group(2)) - else: - sys.exit('ExitBadHeight', size) - - # - # setLineWidth - # - def setLineWidth(this,size,requester): - """ - Set linewidth propery - """ - - m=re.match('([0-9][.0-9]*)(cm|mm|pt|$)',size) - if m: - if m.group(2) == 'cm': - this.__set('linewidth', \ - float(m.group(1)) * 72.27/2.54, requester ) - elif m.group(2) == 'mm': - this.__set('linewidth', \ - float(m.group(1)) * 72.27/25.4, requester ) - elif m.group(2) == 'pt': - this.__set('linewidth', float(m.group(1)), requester ) - elif m.group(2) == '': - this.__set('linewidth', float(m.group(1)), requester ) - else: - sys.exit('ExitBadWidth', m.group(2)) - else: - sys.exit('ExitBadWidth', size) - - # - # setOrientation - # - def setOrientation(this,orient,requester): - """ - Set orientation property - """ - - if orient == 'landscape' or orient == 'portrait': - this.__set('orientation', orient, requester ) - else: - sys.exit('ExitBadOrient', orient) - - # - # setLanguage - # - def setLanguage(this,lang,requester): - """ - Set language property - """ - - this.__set('language', '\\usepackage[%s]{babel}' % (lang), requester ) - - # - # setInclude - # - def setInclude(this,inc, requester): - """ - Append an include path - """ - - tmp = this.get('include') - tmp.append(inc) - this.__set('include', tmp, requester ) - - # - # setDebug - # - def setDebug(this,value,requester): - """ - Set or Clear debug flag - """ - - if int(value) == 1: - this.__set('debug',1,requester) - else: - this.__set('debug',0,requester) - - # - # setKeeplilypond - # - def setKeeplilypond(this, value, requester): - """ - Set or Clear keeplilypond flag - """ - - if int(value) == 1: - this.__set('keeplilypond',1,requester) - else: - this.__set('keeplilypond',0,requester) - - # - # setKeeply2dvi - # - def setKeeply2dvi(this, value, requester): - """ - Set or Clear keeply2dvi flag - """ - - if int(value) == 1: - this.__set('keeply2dvi',1,requester) - else: - this.__set('keeply2dvi',0,requester) - - # - # setNonumber - # - def setNonumber(this, value, requester): - """ - Set nonumber flag - """ - - if int(value) == 1: - this.__set('pagenumber',1,requester) - else: - this.__set('pagenumber',0,requester) - - # - # setSeparate - # - def setSeparate(this, value, requester): - """ - Set or Clear separate flag - """ - - if int(value) == 1: - this.__set('separate',1,requester) - else: - this.__set('separate',0,requester) - - # - # Set output directory name - # - def setOutput(this,out,requester): - this.__set('output',out,requester) - - # - # Set latex header name - # - def setHeader(this,head, requester): - this.__set('header',head,requester) - - # - # Set or Clear Dependencies flag to generate makefile dependencies - # - def setDependencies(this, requester): - """ - Set or Clear dependencies flag - """ - - if int(value) == 1: - this.__set('dependencies',1,requester) - else: - this.__set('dependencies',0,requester) - - # - # Set tmp directory - # - def setTmp(this,dir, requester): - this.__set('tmp',dir,requester) - - # - # Set mudela source file name - # - def setFilename(this,file, requester): - this.__set('filename',file,requester) - - # - # Set title commands - # - def setTitles(this,titles, requester): - this.__set('titles',titles,requester) - - # - # Set title commands - # - def addLilyOutputFiles(this,filelist,requester): - """ - Add a to the lily output list - """ - - tmp = this.get('lilyOutputFiles') - tmp = tmp + filelist - this.__set('lilyOutputFiles',tmp,requester) - - # - # Set/Clear postscript flag - # - def setPostscript(this,value,requester): - """ - Set postscript flag - """ - - if int(value) == 1: - this.__set('postscript',1,requester) - else: - this.__set('postscript',0,requester) - - # - # Set root - # - def setRoot(this,path, requester): - """ - Set lilypond root directory - """ - - os.environ['LILYPONDPREFIX'] = path - this.__set('root',path,requester) - - # - # printProps - # - def printProps(this): - """ - Print properties - """ - - for key in this.__data.keys(): - print "%s <%s>:<%s>" % (key,this.get(key), - this.__roverrideTable[this.__data[key][1]]) - - - -# -# Misc functions -# - -def getLilyopts(): - inc = '' - if len(Props.get('include')) > 0: - # inc = '-I ' + string.join(Props.get('include'), os.pathsep ()) - inc = '-I ' + string.join(Props.get('include'), " -I ") - else: - - if Props.get('dependencies'): - dep=' -d' - else: - dep='' - return inc + dep - return inc - -def writeLilylog(contents): - if Props.get('keeplilypond'): - file='lilylog.' + str(os.getpid()) - output = Props.get('output') - if output != '': - file = os.path.join( output, file ) - try: - fd = open( file, 'w' ) - except: - sys.exit('ExitNoWrite', file) - fd.write(contents) - fd.close() - -def getTeXFile(contents): - texfiles=[] - for line in string.split(contents,'\n'): - m = re.search('^TeX output to (.+)\.\.\.', line) - if m: - texfiles.append(m.group(1)) - - if texfiles == []: - sys.exit('ExitNoTeXName') - else: - return texfiles - -def program_id (): - return name + ' ' + version; - - -def mailaddress(): - try: - return os.environ['MAILADDRESS'] - except KeyError: - return '(address unknown)' - - -def identify (): - sys.stderr.write (program_id () + '\n') - -def help (): - sys.stderr.write ( - 'Generate dvi file from mudela or lilypond output\n' - 'Usage: ' + name + ' [OPTION]... [FILE]...\n' - '\n' - 'Options:\n' - ' -D,--debug increase verbosity\n' - ' -F,--headers= name of additional LaTeX headers file\n' - ' -H,--Height= set paper height (points) (see manual page)\n' - ' -I,--include=DIR add DIR to LilyPond\'s search path\n' - ' -K,--keeplilypond keep lilypond output files\n' - ' -L,--landscape set landscape orientation\n' - ' -N,--nonumber switch off page numbering\n' - ' -O,--orientation= set orientation (obsolete - use -L instead)\n' - ' -P,--postscript generate postscript file\n' - ' -W,--Width= set paper width (points) (see manual page)\n' - ' -d,--dependencies tell lilypond make a dependencies file\n' - ' -h,--help this help text\n' - ' -k,--keeply2dvi keep ly2dvi output files\n' - ' -l,--language= give LaTeX language (babel)\n' - ' -o,--output= set output directory\n' - ' -p,--papersize= give LaTeX papersize (eg. a4)\n' - ' -s,--separate run all files separately through LaTeX\n' - '\n' - 'files may be (a mix of) input to or output from lilypond(1)\n' - ) - - - -# -# main -# - -def main(): - """Generate dvi files from lilypond source/output""" - - infile = Input() - outfile = TeXOutput() - texInputFiles=[] - - (options, files) = getopt.getopt (sys.argv[1:], - 'DF:H:I:KLNPW:dhkl:o:p:s', - ['debug', 'headers=', 'Height=', - 'include=', 'keeplilypond', 'landscape', - 'nonumber', 'Width=', 'dependencies', - 'help', 'keeply2dvi', 'language=', - 'output=', 'papersize=', 'separate', - 'postscript']) - for opt in options: - o = opt[0] - a = opt[1] - if o == '--debug' or o == '-D': - Props.setDebug(1,'commandline') - elif o == '--headers' or o == '-F': - Props.setHeader(a,'commandline') - elif o == '--include' or o == '-I': - Props.setInclude(a,'commandline') - elif o == '--Height' or o == '-H': - Props.setTextHeight(a,'commandline') - elif o == '--keeplilypond' or o == '-K': - Props.setKeeplilypond(1,'commandline') - elif o == '--landscape' or o == '-L': - Props.setOrientation('landscape','commandline') - elif o == '--nonumber' or o == '-N': - Props.setNonumber('commandline') - elif o == '--Width' or o == '-W': - Props.setLineWidth(a,'commandline') - elif o == '--dependencies' or o == '-d': - Props.setDependencies(1,'commandline') - elif o == '--help' or o == '-h': - help() - return 0 - elif o == '--keeply2dvi' or o == '-k': - Props.setKeeply2dvi(1,'commandline') - elif o == '--language' or o == '-l': - Props.setLanguage(a,'commandline') - elif o == '--output' or o == '-o': - Props.setOutput(a,'commandline') - elif o == '--papersize' or o == '-p': - Props.setPaperZize(a,'commandline') - elif o == '--separate' or o == '-s': - Props.setSeparate(1,'commandline') - elif o == '--postscript' or o == '-P': - Props.setPostscript(1,'commandline') - - if len(files): - for file in files: - infile.open(file) - type = infile.type() - infile.close() - if type == 'source': - cmd = 'lilypond %s %s 2>&1' % (getLilyopts(), file) - fd = os.popen( cmd , 'r' ) - log = '' - line=fd.readline() - while line: - log = log + line - sys.stderr.write( line ) - line=fd.readline() - stat = fd.close() - if stat: - sys.exit('ExitBadLily', cmd ) - texFiles=getTeXFile(log) - writeLilylog(log) - Props.addLilyOutputFiles(texFiles,'program') - texInputFiles = texInputFiles + texFiles - else: - texInputFiles.append(file) - - firstfile=1 - for file in texInputFiles: - infile.open(file) - infile.setVars() # first pass set variables - infile.close() - if Props.get('debug'): - Props.printProps() - if firstfile: - outfile.start(file) - else: - outfile.next() - outfile.write("""\ -\\input{%s} -""" % (file)) - if Props.get('separate'): - outfile.end() - else: - firstfile=0 - if not Props.get('separate'): - outfile.end() - else: - help() - sys.exit('ExitBadArgs','No files specified') - -# -# Exit values -# -ExitTable = { - 'ExitInterupt' : ['Ouch!', 1 ], - 'ExitBadArgs' : ['Wrong number of arguments', 2 ], - 'ExitNotFound' : ['File not found', 3 ], - 'ExitBadPaper' : ['Unknown papersize', 4 ], - 'ExitBadHeight' : ['Invalid Height specification', 5 ], - 'ExitBadWidth' : ['Invalid Width specification', 6 ], - 'ExitBadOrient' : ['Invalid Orientation specification', 7 ], - 'ExitNoWrite' : ['Permission denied', 8 ], - 'ExitNoTeXName' : ['hmm, I could not find an output file name', 9 ], - 'ExitBadLily' : ['Lilypond failed', 10 ], - 'ExitBadLatex' : ['Latex failed', 11 ], - 'ExitBadPostscript' : ['Postscript failed', 12 ], - 'ExitUnknown' : ['Unknown Exit Code', 20 ], - } - -def cleanup(): - lilyfiles = [] - tmpfiles = [] - if not Props.get('keeplilypond'): - lilyfiles = Props.get('lilyOutputFiles') - if not Props.get('keeply2dvi'): - tmpfiles = glob.glob('*.' + str(os.getpid()) + '.*' ) - for file in lilyfiles + tmpfiles: - if os.path.isfile(file): - os.remove(file) - - -identify() -Props = Properties() - -try: - main() - -except KeyboardInterrupt: - print ExitTable['ExitInterupt'][0] - cleanup() - sys.exit(ExitTable['ExitInterupt'][1]) - -except SystemExit, errno: - if ExitTable.has_key(errno.args[0]): - msg = ExitTable[errno.args[0]] - else: - msg = ExitTable['ExitUnknown'] - if len(errno.args) > 1: - sys.stderr.write( '%s: %s: %s\n' % (name, msg[0], errno.args[1])) - else: - sys.stderr.write( '%s %s\n' % (name, msg[0])) - if Props.get('debug'): - Props.printProps() - cleanup() - sys.exit(msg[1]) -else: - cleanup() diff --git a/bin/mail-address.sh b/bin/mail-address.sh deleted file mode 100644 index 37e1141751..0000000000 --- a/bin/mail-address.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# mail-address -if [ "$MAILADDRESS" != "" ]; then - echo $MAILADDRESS -else - echo "mail-address:6: warning: \$MAILADDRESS undefined" > /dev/stderr - echo $USER@`hostname` -fi diff --git a/bin/mf-to-table.py b/bin/mf-to-table.py deleted file mode 100644 index 4d4b505197..0000000000 --- a/bin/mf-to-table.py +++ /dev/null @@ -1,327 +0,0 @@ -#!@PYTHON@ - -# mf-to-table.py -- convert spacing info in MF logs .ly and .tex -# -# source file of the GNU LilyPond music typesetter -# -# (c) 1997 Han-Wen Nienhuys - -import os -import sys -import getopt -from string import * -import regex -import regsub -import time - - -(options, files) = getopt.getopt( - sys.argv[1:], 'a:d:hl:o:p:t:', - ['afm=', 'outdir=', 'dep=', 'ly=', 'tex=', 'debug', 'help', 'package=']) - -for opt in options: - o = opt[0] - a = opt[1] - if o == '-p' or o == '--package': - topdir = a - -sys.path.append (topdir + '/stepmake/bin') -from packagepython import * -package = Package (topdir) -packager = Packager () - -from packagepython import * -from flower import * - -begin_autometric_re = regex.compile('@{') -end_autometric_re = regex.compile('@}') -include_re = regex.compile ('(\([a-zA-Z_0-9-]+\.mf\)') -autometric_re = regex.compile('@{\(.*\)@}') -version = '0.7' -postfixes = ['log', 'dvi', '2602gf', 'tfm'] - -class Feta_file(File): - """Read Feta metrics from a metafont log-file.""" - - def include_scan (self, line): - include_pos = include_re.search (line) - while include_pos <> -1: - self.dependencies.append (include_re.group (1)) - - line = line[include_pos + 1:] - include_pos = include_re.search (line) - - def read_autometricline(self): - line = '' - while end_autometric_re.search(line) == -1 and not self.eof(): - suf = File.readline(self) - self.include_scan (suf) - if begin_autometric_re.search(line) == -1: - line = '' - line = line + regsub.sub('\n','', suf) - line = regsub.sub('\r','', line) - - if self.eof(): - return '' - - return line; - def readline(self): - """return what is enclosed in one @{ @} pair""" - line = ''; - while autometric_re.search(line) == -1 and not self.eof(): - line = self.read_autometricline() - - if self.eof(): - return ''; - - return autometric_re.group(1); - def __init__(self, nm): - File.__init__(self, nm) - self.dependencies = [] - def do_file(infile_nm): - infile = readline(); - -# -# FIXME: should parse output for {} to do indenting. -# -class Indentable_file(File): - """Output file with support for indentation""" - def __init__(self,nm, mode): - File.__init__(self,nm,mode) - self.current_indent_ = 0 - self.delta_indent_ = 4 - def writeline (self, str): - File.write(self, str) - def writeeol(self): - File.write(self, '\n') - File.write(self, ' '* self.current_indent_) - - def indent(self): - self.current_indent_ = self.delta_indent_ + self.current_indent_; - def dedent(self): - self.current_indent_ = self.current_indent_ - self.delta_indent_; - if self.current_indent_ < 0: - raise 'Nesting!' - - def write(self, str): - lines = split(str, '\n') - for l in lines[:-1]: - self.writeline(l) - self.writeeol() - self.writeline (lines[-1]) - -class Afm_file (File): - def print_f_dimen(self, f): - f = f * 1000 - - dimstr = '%.2f' % f - - # try to mask rounding errors - if (dimstr == '-0.00'): - dimstr = '0.00' - self.write( dimstr +' '); - - def neg_print_dimen(self, str): - self.print_f_dimen(-atof(str)) - def print_dimen(self, str): - self.print_f_dimen(atof(str)) - def def_symbol (self, code, lily_id, tex_id, xdim, ydim): - self.write ('C %s; N %s-%s; B ' % (code, self.groupname, lily_id)) - - self.neg_print_dimen(xdim [0]) - self.neg_print_dimen(ydim [0]) - self.print_dimen(xdim [1]) - self.print_dimen(ydim [1]) - - self.write (';\n'); - - def start (self,nm): - self.write ('Start%s\n' % nm) - def end (self,nm): - self.write ('End%s\n' % nm) - -class Ly_file(Indentable_file): - """extra provisions for mozarella quirks""" - def print_lit(self, str): - self.write('\"%s\"\t' % str) - - def print_f_dimen(self, f): - dimstr = '%.2f' % f - - # try to mask rounding errors - if (dimstr == '-0.00'): - dimstr = '0.00' - self.write( dimstr +'\\pt\t'); - - def print_dimen(self, str): - self.print_f_dimen(atof(str)) - - def neg_print_dimen(self, str): - self.print_f_dimen(-atof(str)); - - def def_symbol(self, code, lily_id, tex_id, xdim, ydim): - self.print_lit(lily_id) - self.print_lit('\\\\' + tex_id) - - self.neg_print_dimen(xdim [0]) - self.print_dimen(xdim [1]) - self.neg_print_dimen(ydim [0]) - self.print_dimen(ydim [1]) - self.write('\n') - - -class Log_reader: - """Read logs, destill info, and put into output files""" - def output_label(self, line): - - if not line: - return; - tags = split(line, '@:') - label = tags[0] - name = tags[1] - ly = self.lyfile - afm = self.afmfile - if tags[0] == 'font': - ly.indent() - ly.write("% name=\\symboltables {\n") - self.texfile.write("% name\n") - - afm.write ('FontName %s\n' % name) - afm.start ('FontMetrics') - afm.start ('CharMetrics') - - elif label == "group": - ly.indent() - ly.print_lit(name) - ly.write(' = \\table {\n') - self.texfile.write("% " + name + "\n") - afm.groupname = name - elif label == "puorg": - ly.dedent() - ly.write("}\n") - self.texfile.write("\n") - elif label == "tnof": - ly.dedent() - ly.write("% } % $name\n") - afm.end ('CharMetrics') - afm.end('FontMetrics'); - elif label == "char": - code = tags[2] - id = tags [7] - texstr = tags [8] - xdim = tags[3:5] - ydim = tags[5:7] - ly.def_symbol(code, id, texstr, xdim, ydim) - - self.texfile.write("\\fetdef\\%s{%s}\n" % (texstr, code)) - afm.def_symbol (code, id, texstr, xdim, ydim) - else: - raise 'unknown label: ' + label - - def writedeps (self, deps): - if not len (deps): - sys.stderr.write ('Huh, no main target??') - return - filename = deps[0] - split = os.path.splitext(filename) - basename=split[0]; - - targets = map (lambda x,y = basename, z = self.outdir: z + '/' + y + '.' + x, postfixes) - depstring = reduce(lambda x,y: x + ' ' + y, deps) - dependencies = map (lambda x, y=depstring: x + ': ' + y, targets) - for x in dependencies: - self.depfile.write (x + '\n') - - def do_file(self,filenm): - self.lyfile.write ('\n% input from ' + filenm + '\n') - self.texfile.write ('\n% input from ' + filenm + '\n') - feta = Feta_file(filenm) - while not feta.eof(): - line = feta.readline() - self.output_label(line) - feta.close() - - self.writedeps (feta.dependencies) - - def __init__(self, lyfile_nm, texfile_nm, depfile_nm, afmfile_nm): - self.lyfile = Ly_file(lyfile_nm, 'w') - self.texfile = Indentable_file(texfile_nm, 'w') - self.depfile = File (depfile_nm, 'w') - self.afmfile = Afm_file (afmfile_nm, 'w') - headerstr = '%% Creator: %s\n%% Automatically generated on\n%% Do not edit' % \ - (program_id() ) - - self.lyfile.write(headerstr) - self.texfile.write(headerstr) - self.depfile.write ('# automatically generated by %s\n' % program_id ()) - - def close(self): - self.lyfile.close() - self.texfile.close() - self.depfile.close () - - def __del__(self): - self.close() - -def today_str(): - return time.asctime(time.localtime(time.time())) - -def program_id(): - return 'mf-to-table.py version ' + version; - -def identify(): - sys.stdout.write(program_id() + '\n') - -def help(): - sys.stdout.write("Usage: mf-to-table [options] LOGFILEs\n" - + "Generate mozarella metrics table from preparated feta log\n\n" - + "Options:\n" - + " -a, --afm=FILE .afm file\n" - + " -d, --dep=FILE print dependency info to FILE\n" - + " -h, --help print this help\n" - + " -l, --ly=FILE name output table\n" - + " -o, --outdir=DIR prefix for dependency info\n" - + " -p, --package=DIR specify package\n" - + " -t, --tex=FILE name output tex chardefs\n" - ) - sys.exit (0) - - -def main(): - identify() - - lyfile_nm = texfile_nm = ''; - depfile_nm = '' - afmfile_nm = '' - outdir_prefix = '.' - for opt in options: - o = opt[0] - a = opt[1] - if o == '--dep' or o == '-d': - depfile_nm = a - elif o == '--outdir' or o == '-o': - outdir_prefix = a - elif o == '--ly' or o == '-l': - lyfile_nm = a - elif o == '--tex' or o == '-t': - texfile_nm = a - elif o== '--help' or o == '-h': - help() - elif o=='--afm' or o == '-a': - afmfile_nm = a - elif o == '--debug': - debug_b = 1 - elif o == '-p' or o == '--package': - topdir = a - else: - print o - raise getopt.error - - log_reader = Log_reader(lyfile_nm, texfile_nm, depfile_nm, afmfile_nm) - log_reader.outdir = outdir_prefix - for filenm in files: - log_reader.do_file(filenm) - log_reader.close() - - -main() diff --git a/bin/mf-to-xpms.sh b/bin/mf-to-xpms.sh deleted file mode 100644 index 03729893d9..0000000000 --- a/bin/mf-to-xpms.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!@SHELL@ -# mf-to-xpms.sh - -if [ $# -ne 1 ]; then - echo Usage: mf-to-xpms feta20 - exit 2 -fi - -font=`basename $1 .mf` -mf=$font.mf -afm=out/$font.afm -PKTOPBM=pktopbm -MODE=ibmvga -RESOLUTION=110 -named=yes - -if [ ! -e out/$font.${RESOLUTION}pk ]; then - mf "\\mode=${MODE}; \\input $mf" - mv $font.${RESOLUTION}gf out - rm -f $font.log $font.tfm - gftopk out/$font.${RESOLUTION}gf out/$font.${RESOLUTION}pk -fi - -# num=`grep "^C *[0-9]*;" $afm | tail -1 | sed "s!^C *\([^;]*\).*!\\1!"` -# num=66 -# tex=out/$font.tex -# cat > $tex < out/$font-$i.xpm -done -rm -f $PBMS diff --git a/bin/mudela-book.py b/bin/mudela-book.py deleted file mode 100644 index 3faa60d238..0000000000 --- a/bin/mudela-book.py +++ /dev/null @@ -1,448 +0,0 @@ -#!@PYTHON@ -# All non-english comments are NOT in swedish, they are norwegian! - -# TODO: center option (??) -# * clean up handling of filename of inputfile -# * steal Props class from ly2dvi? -# * \onecolumn, \twocolumn -# * fontsize change with commandline parameters -# * the verbatim option should not be visible in the created latex file -# * what the h.. does castingalgorithm do/mean??? -# * compile all regular expressions -# * the following fails because mudelabook doesn't care that the -# last } after \end{mudela} finishes the marginpar: -# \marginpar{ -# \begin{mudela}[fragment] -# c d e f g -# \end{mudela}} -# * Command line parameter that force all inline mudela to be verbatim, and -# one that forces all to be printed -# log: - -# 0.3: -# rewrite in Python. -# 0.4: -# much rewritten by new author. I think the work has been split more -# logical between different classes. -# - -import os -import string -import re -import getopt -import sys -import regsub - -outdir = 'out' -program_version = '0.4' -default_paper_size_global = 'a4' -default_mudela_fontsize = '16pt' -force_mudela_fontsize_b = 0 - -fontsize_i2a = {11:'eleven', 13:'thirteen', 16:'sixteen', 20:'twenty', 26:'twentysix'} -fontsize_pt2i = {'11pt':11, '13pt':13, '16pt':16, '20pt':20, '26pt':26} - -def file_exist_b(name): - try: - f = open(name) - except IOError: - return 0 - f.close () - return 1 - -def ps_dimention(fname): - fd = open(fname) - lines = fd.readlines() - reg = re.compile('%%BoundingBox: ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)') - for line in lines: - s = reg.search(line) - if s: - break - return (int(s.groups()[2])-int(s.groups()[0]), - int(s.groups()[3])-int(s.groups()[1])) - - -class CompileStatus: - pass - -def file_mtime (name): - return os.stat (name)[8] #mod time -# -# executes os.system(command) if infile is newer than -# outfile or outfile don't exist -# -def compile (command, workingdir, infile, outfile): - indate = file_mtime (workingdir+infile) - try: - outdate = file_mtime (outfile) - recompile = indate > outdate - - except os.error: - recompile = 1 - - if recompile: - sys.stderr.write ('invoking `%s\'\n' % command) - if workingdir == '': - status = os.system (command) - else: - status = os.system ('cd %s; %s' %(workingdir, command)) - if status: - raise CompileStatus - - -class PaperDef: - __onecolumn_linewidth = { - 'a4':{'10pt': 345, '11pt': 360, '12pt':390}, - 'a5':{'10pt': 276, '11pt': 276, '12pt':276}, - 'b5':{'10pt': 345, '11pt': 356, '12pt':356}, - 'letter':{'10pt': 345, '11pt': 360, '12pt':390}, - 'legal':{'10pt': 345, '11pt': 360, '12pt':390}, - 'executive':{'10pt': 345, '11pt': 360, '12pt':379} - } - __twocolumn_linewidth = { - 'a4':{'10pt': 167, '11pt': 175, '12pt':190}, - 'a5':{'10pt': 133, '11pt': 133, '12pt':133}, - 'b5':{'10pt': 167, '11pt': 173, '12pt':173}, - 'letter':{'10pt': 167, '11pt': 175, '12pt':190}, - 'legal':{'10pt': 167, '11pt': 175, '12pt':190}, - 'executive':{'10pt': 167, '11pt': 175, '12pt':184} - } - __numcolumn = 1 - __fontsize = '11pt' - # - # init - # - def __init__(self): - self.__papersize = default_paper_size_global - def set_papersize (self, p): - if not self.__onecolumn_linewidth.has_key(p): - print "warning:unsupported papersize", p, \ - "will use", default_paper_size_global - self.__papersize = default_paper_size_global - else: - self.__papersize = p - def set_fontsize(self, pt): - self.__fontsize = pt - def get_linewidth (self): - if self.__numcolumn == 1: - return self.__onecolumn_linewidth[self.__papersize][self.__fontsize] - else: - return self.__twocolumn_linewidth[self.__papersize][self.__fontsize] - def onecolumn (slef): - self.__numcolumn = 1 - def twocolumn (self): - self.__numcolumn = 2 - - -class Mudela_output: - def __init__ (self, basename): - self.basename = basename - # it's an integer! - self.feta_pt_size = fontsize_pt2i[default_mudela_fontsize] - self.temp_filename = "%s/%s" %(outdir, 'mudela-temp.ly') - self.file = open (self.temp_filename, 'w') - # 'tex' or 'eps' - self.graphic_type = 'tex' - self.fragment = 0 - def write (self, line): - # match only if there is nothing but whitespace before \begin - if re.search('^\s*\\\\begin{mudela}', line): - self.scan_begin_statement(line) - self.write_red_tape() - else: - self.file.write (line) - def scan_begin_statement(self, line): - r = begin_mudela_opts_re.search(line) - if r: - o = r.group()[1:][:-1] - optlist = re.compile('[ ,]*').split(o) - else: - optlist = [] - if 'floating' in optlist: - self.graphic_type = 'eps' - else: - self.graphic_type = 'tex' - if 'fragment' in optlist: - self.fragment = 1 - else: - self.fragment = 0 - for pt in fontsize_pt2i.keys(): - if pt in optlist: - self.feta_pt_size = fontsize_pt2i[pt] - def write_red_tape(self): - self.file.write ('\\include \"paper%d.ly\"\n' % self.feta_pt_size) - s = fontsize_i2a[self.feta_pt_size] - if self.fragment: - self.file.write("default_paper = \\paper {" - + "\\paper_%s\n linewidth = -1.\\pt;" % s - + "castingalgorithm = \Wordwrap; indent = 2.\cm; \n}") - self.file.write("\\score{\n\\notes") #HACK - else: - self.file.write ("default_paper = \\paper {" - + "\\paper_%s\n linewidth = %i.\\pt;" % \ - (s, Paper.get_linewidth()) \ - + "castingalgorithm = \Wordwrap; indent = 2.\cm;\n}") - def close (self): - if self.fragment: - self.file.write ('\\paper { \\default_paper; } }\n') - self.file.close () - - inf = self.basename + '.ly' - outf = self.basename + '.tex' - if not file_exist_b (inf): - status = 1 - else: - status = os.system ('diff -q %s %s' % (self.temp_filename, inf)) - - if status: - os.rename (self.temp_filename, inf) - compile ('lilypond -o %s %s;'% (self.basename, inf), '', inf, outf) - if self.graphic_type == 'eps': - bname = self.basename[string.rfind(self.basename, '/')+1:] - tex_name = bname+'.tex' - dvi_name = bname+'.dvi' - eps_name = bname+'.eps' - compile ('tex %s' % tex_name, outdir, tex_name, dvi_name) - compile ('dvips -E -o %s %s' % (eps_name, dvi_name), outdir, dvi_name, eps_name) - def insert_me_string(self): - "Returns a string that can be used directly in latex." - if self.graphic_type == 'tex': - return '\\preMudelaExample\\input %s\n\postMudelaExample\n' % self.basename - elif self.graphic_type == 'eps': - ps_dim = ps_dimention('%s.eps' % self.basename) - return '\\parbox{%ipt}{\includegraphics{%s.eps}}' % (ps_dim[0], self.basename) - else: - print "Unsupported graphic type '%s'" % self.graphic_type - sys.exit(1) - -class Tex_output: - def __init__ (self, name): - self.output_fn = '%s/%s' % (outdir, name) - self.file = open (self.output_fn , 'w') - def open_mudela (self, basename): - self.mudela_basename = basename - def open_verbatim (self): - self.file.write ('\\begin{verbatim}\n') - def close_verbatim (self): - self.file.write ('\\end{verbatim}\n') - def write (self, s): - self.file.write (s) - -begin_mudela_re = re.compile ('^ *\\\\begin{mudela}') -begin_mudela_opts_re = re.compile('\[[^\]]*\]') -end_mudela_re = re.compile ('^ *\\\\end{mudela}') -section_re = re.compile ('\\\\section') -chapter_re = re.compile ('\\\\chapter') -input_re = re.compile ('^\\\\input{([^}]*)') -include_re = re.compile ('^\\\\include{([^}]*)') -begin_document_re = re.compile ('^ *\\\\begin{document}') -documentclass_re = re.compile('\\\\documentclass') -twocolumn_re = re.compile('\\\\twocolumn') -onecolumn_re = re.compile('\\\\onecolumn') - -class Tex_input: - def __init__ (self,name): - # HACK - if (name[-4:] != '.tex') and (name[-4:] != '.doc'): - name = name + '.tex' - self.filename = name - self.infile = open (name) - - def get_lines (self): - lines = self.infile.readlines () - (retlines, retdeps) = ([],[self.filename]) - for line in lines: - r = input_re.search (line) - ri = include_re.search (line) - if r: - t = Tex_input (r.groups()[0]) - ls =t.get_lines () - retlines = retlines + ls[0] - retdeps = retdeps + ls[1] - elif ri: - t = Tex_input (ri.groups()[0]) - ls =t.get_lines () - ls[0].insert(0, '\\newpage') - ls[0].append('\\newpage') - retlines = retlines + ls[0] - retdeps = retdeps + ls[1] - else: - retlines.append (line) - return (retlines, retdeps) - - -class Main_tex_input(Tex_input): - def __init__ (self, name, outname): - - Tex_input.__init__ (self, name) # ugh - - self.outname = outname - self.chapter = 0 - self.section = 0 - self.fine_count =0 - self.mudtex = Tex_output (self.outname) - self.mudela = None - self.deps = [] - self.verbatim = 0 - # set to 'mudela' when we are processing mudela code, - # both verbatim and graphic-to-be - self.mode = 'latex' - def set_sections (self, l): - if section_re.search (l): - self.section = self.section + 1 - if chapter_re.search (l): - self.section = 0 - self.chapter = self.chapter + 1 - - def gen_basename (self): - return '%s/%s-%d.%d.%d' % (outdir, self.outname,self.chapter,self.section,self.fine_count) - - def extract_papersize_from_documentclass(self, line): - pre = re.search('\\\\documentclass[\[, ]*(\w*)paper[\w ,]*\]\{\w*\}', line) - if not pre: - return default_paper_size_global - return pre.groups()[0] - def extract_fontsize_from_documentclass(self, line): - if re.search('\\\\documentclass\[[^\]]*\]\{[^\}]*\}', line): - r = re.search('[ ,\[]*([0-9]*pt)', line) - if r: - return r.groups()[0] - return '10pt' - def do_it(self): - (lines, self.deps) = self.get_lines () - for line in lines: - if documentclass_re.search (line): - Paper.set_papersize (self.extract_papersize_from_documentclass (line) ) - Paper.set_fontsize (self.extract_fontsize_from_documentclass (line) ) - elif twocolumn_re.search (line): - Paper.twocolumn () - elif onecolumn_re.search (line): - Paper.onecolumn () - elif begin_document_re.search (line): - self.mudtex.write ('\\def\\preMudelaExample{}\n') - self.mudtex.write ('\\def\\postMudelaExample{}\n') - elif begin_mudela_re.search (line): - if __debug__: - if self.mode == 'mudela': - raise AssertionError - self.mode = 'mudela' - r = begin_mudela_opts_re.search (line) - if r: - o = r.group()[1:][:-1] - optlist = re.compile('[ ,]*').split(o) - else: - optlist = [] - if 'verbatim' in optlist: - self.verbatim = 1 - self.mudtex.open_verbatim () - else: - self.verbatim = 0 - self.mudela = Mudela_output (self.gen_basename ()) - - elif end_mudela_re.search (line): - if __debug__: - if self.mode != 'mudela': - raise AssertionError - if self.mudela: - self.mudela.close () - self.mudtex.write (self.mudela.insert_me_string()) - del self.mudela - self.mudela = None - self.fine_count = self.fine_count + 1 - else: - self.mudtex.write (line) - self.mudtex.close_verbatim () - self.mode = 'latex' - continue - - if self.mode == 'mudela' and not self.verbatim: - self.mudela.write (line) - else: - self.mudtex.write (line) - self.set_sections(line) - del self.mudtex - - -def help(): - sys.stdout.write("Usage: mudela-book [options] FILE\n" - + "Generate hybrid LaTeX input from Latex + mudela" - + "Options:\n" - + " -h, --help print this help\n" - + " -d, --outdir=DIR directory to put generated files\n" - + " -o, --outname=FILE prefix for filenames\n" - + " --mudela-fontsize=??pt default fontsize when no parameter for \\begin{mudela}\n" - + " --force-mudela-fontsize=??pt force fontsize for all inline mudela\n" - ) - sys.exit (0) - - -def write_deps (fn, out, deps): - out_fn = outdir + '/' + fn - print '\`writing \`%s\'\n\'' % out_fn - - f = open (out_fn, 'w') - f.write ('%s: %s\n'% (outdir + '/' + out + '.dvi', - reduce (lambda x,y: x + ' '+ y, deps))) - f.close () - -def identify(): - sys.stderr.write('*** Lokal versjon av mudela-book ***\n') - sys.stderr.write ('This is %s version %s\n' % ('mudela-book', program_version)) - -def main(): - global default_mudela_fontsize, outdir - outname = '' - try: - (options, files) = getopt.getopt( - sys.argv[1:], 'hd:o:', ['outdir=', 'outname=', 'mudela-fontsize=', - 'force-mudela-fontsize=', 'help', 'dependencies']) - except getopt.error, msg: - print "error:", msg - sys.exit(1) - - do_deps = 0 - for opt in options: - o = opt[0] - a = opt[1] - if o == '--outname' or o == '-o': - outname = a - if o == '--outdir' or o == '-d': - outdir = a - if o == '--help' or o == '-h': - help () - if o == '--dependencies': - do_deps = 1 - if o == '--mudela-fontsize': - default_mudela_fontsize = a - if o == '--force-mudela-fontsize': - default_mudela_fontsize = a - force_mudela_fontsize_b = 1 - - if outdir[-1:] != '/': - outdir = outdir + '/' - - if not file_exist_b(outdir): - os.system('mkdir %s' % outdir) - - if not fontsize_pt2i.has_key(default_mudela_fontsize): - print "warning: fontsize %s is not supported using 16pt" % default_mudela_fontsize - default_mudela_fontsize = '16pt' - - for f in files: - my_outname = outname - if not my_outname: - my_outname = regsub.sub ('\\(.*\\)\\.doc', '\\1', f) - - my_depname = my_outname + '.dep' - - inp = Main_tex_input (f, my_outname) - inp.do_it () - - if do_deps: - write_deps (my_depname, my_outname, inp.deps) - - - -identify() -Paper = PaperDef() -main() diff --git a/bin/mutopia-index.py b/bin/mutopia-index.py deleted file mode 100644 index b72042cadf..0000000000 --- a/bin/mutopia-index.py +++ /dev/null @@ -1,172 +0,0 @@ -#!@PYTHON@ -# mutopia-index.py - -name = 'mutopia-index' - -import regex -import os -import sys -import stat -sys.path.append ('@abs-step-bindir@') - - - -header_regex = regex.compile('\\header[ \t\n]*{\([^}]*\)}') -header_entry_regex = regex.compile('[\n\t ]*\([^\n\t ]+\)[\n\t ]*=[\n \t]*\([^;]+\)[\n \t]*;') - -# -# FIXME breaks on multiple strings. -# -def read_mudela_header (fn): - s = gulp_file(fn) - s = regsub.gsub('%.*$', '', s) - s = regsub.gsub('\n', ' ', s) - - dict = {} - if header_regex.search(s) <> -1: - h = header_regex.group(1) - else: - return dict - - while regex.search('=', h) <> -1: - - if header_entry_regex.search (h) == -1: - - raise 'format error' - - h = regsub.sub(header_entry_regex, '', h) - left = header_entry_regex.group(1) - right = header_entry_regex.group(2) - - right = regsub.gsub('\([^\\]\)\"', '\\1', right) - right = regsub.gsub('^"', '', right) - left = regsub.gsub('\([^\\]\)\"', '', left) - left = regsub.gsub('^"', '', left) - - dict[left] = right - - return dict - - - - -def help (): - sys.stdout.write ("Usage: " + name + " [options] INFILE OUTFILE\n" - + "Generate index for mutopia\n\n" - + "Options:\n" - + " -h, --help print this help\n" - + " -p, --package=DIR specify package\n" - + " --prefix=PRE specify prefix\n" - + " -s, --subdirs=DIR add subdir\n" - + " --suffix=SUF specify suffix\n" - ) - sys.exit (0) - -def gen_list(inputs, subdir, filename): - (pre, subdirs, post)=subdir - print "generating HTML list %s\n" % filename - list = open(filename, 'w') - list.write ('Rendered Examples\n') - list.write ('') - if len(subdirs): - list.write ('

subdirectories

') - list.write ('
    ') - for ex in subdirs: - print 'subdir %s ' % ex - list.write ('
  • Subdirectory: %s
  • \n' % (pre + ex + post , ex)) - - list.write ('
') - - list.write('

Contents of this directory

\n'); - list.write ( - 'These example files are taken from the LilyPond distribution. ' - 'LilyPond currently only outputs TeX and MIDI. The pictures and ' - 'PostScript files were generated using TeX, Ghostscript and some ' - 'graphics tools. The papersize used for these examples is A4. ' - 'As you know, no gifs due to patent problems, ' - 'but the png images should be viewable with any current browser ' - '(jpeg is inappropriate for music images).' - '\n'); - - - for ex in inputs: - ex_ext = '.ly' - print '%s, ' % ex - try: - header = read_mudela_header(ex + ex_ext + '.txt') - except: - ex_ext = '.fly' - header = read_mudela_header(ex + ex_ext + '.txt') - - def read_dict(s, default, h =header): - try: - ret = h[s] - except KeyError: - ret = default - return ret - head = read_dict('title', ex) - composer = read_dict('composer', '') - desc = read_dict('description', '') - list.write('
') - list.write('

example file: %s

' % head); - if composer <> '': - list.write('

%s

\n' % composer) - if desc <> '': - list.write('%s

' % desc) - list.write ('

    ') - def list_item(filename, desc, type, l = list): - if file_exist_b(filename): - l.write ('
  • %s' % (filename, desc)) - size=os.stat(filename)[stat.ST_SIZE] - l.write (' (%s %dk)' % (type, (size + 512) / 1024)) - pictures = ['jpeg', 'png', 'xpm'] - # silly, no? - if 0 and type in pictures: - l.write (' no gifs due to patent problems') - l.write ('\n') - list_item(ex + ex_ext + '.txt', 'The input', 'ASCII') - for pageno in range(1,100): - f = ex + '-page%d.png' % pageno - if not file_exist_b (f): - break - list_item(f, 'The output, page %d' % pageno, 'png') - list_item(ex + '.ps.gz', 'The output', 'gzipped PostScript') - list_item(ex + '.midi', 'The output', 'MIDI') - list.write ("
"); - - list.write( ""); - list.close() - -import getopt - -(options, files) = getopt.getopt(sys.argv[1:], - 'hp:s:', ['help', 'subdirs=', 'suffix=', 'package=', 'prefix=']) -subdir_pre='' -subdir_suf ='' - -subdirs =[] -for opt in options: - o = opt[0] - a = opt[1] - if o == '--subdirs' or o == '-s': - subdirs.append (a) - elif o == '--prefix': - subdir_pre = a - elif o == '-p' or o == '--package': - topdir = a - elif o == '--suffix': - subdir_suf = a - - sys.path.append (topdir + '/stepmake/bin') - from packagepython import * - package = Package (topdir) - packager = Packager () - - from flower import * - - -# huh? -allfiles = multiple_find (['*.*ly.txt'], '.') - -gen_list (files, (subdir_pre, subdirs, subdir_suf), 'index.html') - diff --git a/bin/profile-conf.sh b/bin/profile-conf.sh deleted file mode 100644 index 79dbd73463..0000000000 --- a/bin/profile-conf.sh +++ /dev/null @@ -1,2 +0,0 @@ - -configure --prefix=~ --enable-profiling --enable-config=optprof --enable-optimise --disable-checking diff --git a/bin/ps-to-gifs.sh b/bin/ps-to-gifs.sh deleted file mode 100644 index 0f4afe0a5a..0000000000 --- a/bin/ps-to-gifs.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -# ps-to-gifs, convert PS to multiple gifs or other bitmaps - -usage() -{ - cat < $OUTFILE -PPMS=`ls $BASE*ppm` -for i in $PPMS; do - o=`dirname $i`/`basename $i .ppm`.$GIF - cat $i | pnmscale 0.5 | $CROP | $PNMTOGIF $color > $o - rm $i -done - -if [ "x$OUTFILE" != "x" ]; then - mv $BASE-page1.$GIF $BASE.$GIF -fi - diff --git a/bin/ps-to-pngs.sh b/bin/ps-to-pngs.sh deleted file mode 100644 index 2a3f3636b5..0000000000 --- a/bin/ps-to-pngs.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# ps-to-pngs, convert PS to multiple pngs - -ps-to-gifs --png $* diff --git a/bin/run-lilypond.sh b/bin/run-lilypond.sh deleted file mode 100644 index 2a69e5a3e2..0000000000 --- a/bin/run-lilypond.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -LILYTOPDIR=$1 -shift -export LILYINCLUDE="$LILYTOPDIR/init:$LILYTOPDIR/mf/out:$LILYINCLUDE" -export TEXINPUTS="$LILYTOPDIR/tex:$TEXINPUTS" -export MFINPUTS="$LILYTOPDIR/mf:$TEXINPUTS" - -$LILYTOPDIR/lily/out/lilypond $* diff --git a/bin/set-lily.sh b/bin/set-lily.sh deleted file mode 100644 index c85a44b8e3..0000000000 --- a/bin/set-lily.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# zet-lily.sh --- configure LilyPond sourcetree -# nice in first character unique name -# -PACKAGE_NAME=LilyPond -export PACKAGE_NAME -prefix=$HOME/usr -sources=$prefix/src -# -# -. ./stepmake/bin/package-zet.sh -# -# The $sources dir looks like this: -# -# -# -if [ "x$LILYINCLUDE" = "x" ]; then - # we can try... - echo you should add the following to your profile script - if [ "x$MAILADDRESS" = "x" ]; then - MAILADDRESS=$USER@`hostname` - export MAILADDRESS - echo " MAILADDRESS=\$USER@`hostname`" - echo " export MAILADDRESS" - fi - LILYINCLUDE=$LILYPOND_SOURCEDIR/init:$LILYPOND_SOURCEDIR/input:$LILYPOND_SOURCEDIR/mf/out - MFINPUTS=$MFINPUTS:$LILYPOND_SOURCEDIR/mf - TEXINPUTS=$TEXINPUTS:$LILYPOND_SOURCEDIR/mf/out - export LILYINCLUDE MFINPUTS TEXINPUTS - cat < /tmp/cleaning-font-dummy +FILES=`find . $TEXDIR -name "feta*$WHAT*tfm" -or -name "feta*$WHAT*pk"` + +echo removing $FILES +rm -f $FILES /tmp/cleaning-font-dummy diff --git a/buildscripts/docxx-lily.sh b/buildscripts/docxx-lily.sh new file mode 100644 index 0000000000..82407ed1ff --- /dev/null +++ b/buildscripts/docxx-lily.sh @@ -0,0 +1,16 @@ +#!/bin/sh +cwd=`pwd` + +{ cd $LILYPOND_SOURCEDIR; cd ..; +export LILYPOND_ROOTDIR=`pwd` } + +if [ "$1" = "" ]; then + VERSION=`show-current` + TARBALL=$LILYPOND_ROOTDIR/releases/lilypond-$VERSION.tar.gz + cwd=`pwd` +else + TARBALL=$1 +fi + + +tar-docxx $TARBALL diff --git a/buildscripts/find-typenames.pl b/buildscripts/find-typenames.pl new file mode 100644 index 0000000000..890f9cabd0 --- /dev/null +++ b/buildscripts/find-typenames.pl @@ -0,0 +1,20 @@ +#!@PERL@ + +open GREP, "egrep -h '^struct|^class' *.hh *.cc|"; +open OUT, "|sort | uniq"; +while () { + + s/^struct/class/; + if (! /; *$/) { + s/:[^{]+{.*$//; + s/ *{.*$/;/; + } + if (! /; *$/) { + chop; + $_ .= ";\n"; + + } + print OUT; +} +close OUT; +close GREP; diff --git a/buildscripts/gen-sitemap.sh b/buildscripts/gen-sitemap.sh new file mode 100644 index 0000000000..7f9bcbc95e --- /dev/null +++ b/buildscripts/gen-sitemap.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +TMPDIR=/tmp/gen-sitemap +for tarball in $*; do + tar -C $TMPDIR -xfz $tarball '*.html' +done diff --git a/buildscripts/genheader.py b/buildscripts/genheader.py new file mode 100644 index 0000000000..4dbb07f358 --- /dev/null +++ b/buildscripts/genheader.py @@ -0,0 +1,149 @@ +#!@PYTHON@ + +# genheader.py -- do headers (like these) +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1997--1998 Han-Wen Nienhuys + +import os +import sys +import pwd +import regex +import regsub +import string +import getopt +import time + +class My_options: + def __init__(self): + self.commentify = None + self.add_hdr_def = 0 + self.classname = '' + +my_options = My_options() + + +def name(): + return os.environ['USERNAME'] + +# field 4 of passwd is also used for finger info (phone no., office etc) +# return pwd.getpwuid(os.getuid())[4] + +def c_commentify(str): + return '/* ' + regsub.gsub('^',' ', str) + '\n */'; + +def sh_commentify(str): + return regsub.gsub('^', '# ', str) + +def tex_commentify(str): + return regsub.gsub('^', '% ', str) + +def project_str(): + cwd = os.getcwd() + if regex.search('flower', cwd) <> -1: + PROJECT = "the Flower Library" + elif regex.search('mf$', cwd) <> -1: + PROJECT = "the Feta (defintively not an abbreviation for Font-En-Tja) music font" + else: + PROJECT = "the GNU LilyPond music typesetter" + return PROJECT + +def head_str(filename): + if my_options.add_hdr_def: + what = "declare " + else: + what=" implement " + + + mailaddres = '' + try: + mailaddres = '<%s>' % os.environ['MAILADDRESS'] + except KeyError: + pass + headstr = '\n%s -- %s\n\nsource file of %s\n\n(c) %d %s %s\n' \ + %(filename, what, project_str(), + time.localtime (time.time ())[0], name(), mailaddres) + return headstr + + +def c_include(filename): + startdef= filename; + trans = string.maketrans( string.lowercase + '-.', string.uppercase + '__') + startdef = string.translate(filename, trans) + + + headstr = "\n\n#ifndef %s\n#define %s\n" % (startdef, startdef) + terminatestr = "#endif /* %s */\n" % (startdef); + + return headstr+ '\n\n'+ terminatestr; + + +def help (): + sys.stdout.write ("Usage: genheader [options] FILENAME\n" + + "Generate file with header FILENAME\n\n" + + "Options:\n" + + " -h, --header generate header\n" + + " --help print this help\n" + + " -p, --package=DIR specify package\n" + ) + + sys.exit (0) + + +(options, files) = getopt.getopt(sys.argv[1:], 'tcshp:', ['class', 'package=', 'help']) + +for opt in options: + o = opt[0] + a = opt[1] + if o == '-c': + my_options.commentify = c_commentify + elif o == '-t': + my_options.commentify = tex_commentify + elif o == '-s': + my_options.commentify = sh_commentify + elif o == '-h' or o == '--header': + my_options.add_hdr_def = 1 + elif o == '--class': + my_options.classname = a + elif o == '--help': + help () + +# FIXME: should create xxx.cc and include/xxx.hh, with implement/declare Xxx +# in one run +if my_options.classname: + pass + +def do_file(nm): + s = my_options.commentify(head_str(nm)) + if my_options.add_hdr_def: + s = s + c_include(nm) + return s + + +def extension(ext,nm): + ext = '\\.' + ext + return regex.search(ext, nm) <> -1 + +def c_extension(nm): + return extension('hh',nm) or extension('cc',nm) \ + or extension('icc', nm) or extension('tcc',nm) + +def select_commentification(nm): + if c_extension (nm): + return c_commentify + elif extension('py',nm) or extension('pl',nm) or extension('sh',nm): + return sh_commentify + elif extension('mf',nm) or extension('tex',nm) or extension('ly',nm): + return tex_commentify + else: + sys.stderr.write ('unknown extension for file %s\n' % nm) + raise 'help' + +for nm in files: + if extension('hh', nm) or extension('icc', nm) or extension('tcc', nm): + my_options.add_hdr_def = 1 + if my_options.commentify == None: + my_options.commentify = select_commentification(nm) + print do_file(nm) + diff --git a/buildscripts/html-accents.py b/buildscripts/html-accents.py new file mode 100644 index 0000000000..228ed7485f --- /dev/null +++ b/buildscripts/html-accents.py @@ -0,0 +1,115 @@ +#!@PYTHON@ + +# html-accents.py -- convert (some) latin1 chars to html +# pod2html is so broken... +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1998 Jan Nieuwenhuizen + +name = 'html-accents' +version = '0.1' + +import os +import sys +sys.path.append ('@abs-step-bindir@') +sys.path.append (os.environ['HOME'] + '/usr/src/lilypond/stepmake/bin') + +import getopt +from string import * +import regex +import regsub +import time + +def program_id (): + return name + ' version ' + version; + +def identify (): + sys.stdout.write (program_id () + '\n') + +def help (): + sys.stdout.write ("Usage: " + name + " [options] INFILE OUTFILE\n" + + "Convert (some) latin1 chars to html &xxx;\n\n" + + "Options:\n" + + " -h, --help print this help\n" + + " -p, --package=DIR specify package\n" + ) + sys.exit (0) + +# chars = {'è':'è', } +chars = { +'á':'á', +'â':'â', +'æ':'æ', +'à':'à', +'å':'å', +'ã':'ã', +'ä':'ä', + +'ç':'ç', + +'é':'é', +'ê':'ê', +'è':'è', +'ë':'ë', + +'í':'í', +'î':'î', +'ì':'ì', +'ï':'ï', + +'ñ':'ñ', + +'ó':'ó', +'ô':'ô', +'ò':'ò', +'ø':'ø', +'õ':'õ', +'ö':'ö', + +'ú':'ú', +'û':'û', +'ù':'ù', +'ü':'ü' +} + +def convert_accents (inname, outname): + from flower import * + text = File (inname) + # ugh + html = File (outname, 'w') + + while not text.eof (): + line = text.readline () + for i in chars.keys (): + line = regsub.gsub (i, chars[i], line) + html.write (line) + text.close () + html.close () + +def main (): + identify () + (options, files) = getopt.getopt ( + sys.argv[1:], 'hp:', ['help', 'package=']) + for opt in options: + o = opt[0] + a = opt[1] + if o== '--help' or o == '-h': + help () + elif o == '-p' or o == '--package': + topdir = a + else: + print o + raise getopt.error + + sys.path.append (topdir + '/stepmake/bin') + from packagepython import * + package = Package (topdir) + packager = Packager () + + from flower import * + + convert_accents (files[0], files[1]) + +main () + diff --git a/buildscripts/lilypond-login.sh b/buildscripts/lilypond-login.sh new file mode 100644 index 0000000000..d4a482ebe6 --- /dev/null +++ b/buildscripts/lilypond-login.sh @@ -0,0 +1,13 @@ +#!/bin/csh + +# env. vars for the C-shell. + +# set environment for LilyPond. To be installed in /etc/profile.d/ +setenv GS_LIB "@datadir@/afm" +setenv GS_FONTPATH "@datadir@/ps" +setenv LILYINCLUDE "@datadir@/ly:@datadir@/afm" + +# include an empty path component for the system wide includes. +setenv MFINPUTS "@datadir@/mf:"${MFINPUTS:=":"} +setenv TEXINPUTS "@datadir@/tex:"${TEXINPUTS:=":"} + diff --git a/buildscripts/lilypond-profile.sh b/buildscripts/lilypond-profile.sh new file mode 100644 index 0000000000..176f63629e --- /dev/null +++ b/buildscripts/lilypond-profile.sh @@ -0,0 +1,17 @@ +#!/bin/sh + + +# set environment for LilyPond. To be installed in /etc/profile.d/ +GS_LIB="@datadir@/afm" +GS_FONTPATH="@datadir@/ps" +LILYINCLUDE="@datadir@/ly:@datadir@/afm" + +# include an empty path component for the system wide includes. +MFINPUTS="@datadir@/mf:"${MFINPUTS:=":"} +TEXINPUTS="@datadir@/tex:"${TEXINPUTS:=":"} + +export LILYINCLUDE MFINPUTS TEXINPUTS GS_LIB GS_FONTPATH + +# echo $LILYINCLUDE $MFINPUTS $TEXINPUTS $GS_LIB $GS_FONTPATH + + diff --git a/buildscripts/localpackage.py b/buildscripts/localpackage.py new file mode 100644 index 0000000000..f37fc8267b --- /dev/null +++ b/buildscripts/localpackage.py @@ -0,0 +1,16 @@ +# localpackage.py +# must be included in package's python bin dir + +def localpackage (n): + p=lower (n) + P=upper (n) + if topdir == '': + try: + topdir = os.environ[P + '_SOURCEDIR'] + except: + topdir = os.environ['HOME'] + '/usr/src/' + p + sys.path.append (topdir + '/stepmake/bin') + from packagepython import * + package = Package (topdir) + packager = Packager () + diff --git a/buildscripts/ltmain.sh b/buildscripts/ltmain.sh new file mode 100644 index 0000000000..e9350b3fab --- /dev/null +++ b/buildscripts/ltmain.sh @@ -0,0 +1,2453 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1998 Free Software Foundation, Inc. +# Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# The name of this program. +progname=`$echo "$0" | sed 's%^.*/%%'` +modename="$progname" + +# Constants. +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.2 + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +if test "$LTCONFIG_VERSION" != "$VERSION"; then + echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION" + exit 0 + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + + # Recognize several different file suffixes. + xform='[cCFSfms]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;; + *) + $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + $run $rm $obj $libobj + trap "$run $rm $obj $libobj; exit 1" 1 2 15 + else + $run $rm $libobj + trap "$run $rm $libobj; exit 1" 1 2 15 + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + $show "$base_compile$pic_flag -DPIC $srcfile" + if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then : + else + test -n "$obj" && $run $rm $obj + exit 1 + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag"; then + $show "$LN_S $obj $libobj" + $run $LN_S $obj $libobj + exit $? + fi + + # Just move the object, then go on to compile the next one + $show "$mv $obj $libobj" + $run $mv $obj $libobj || exit 1 + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + # Suppress compiler output if we already did a PIC compilation. + $show "$base_compile $srcfile$suppress_output" + if $run eval "$base_compile \$srcfile$suppress_output"; then : + else + $run $rm $obj $libobj + exit 1 + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + CC="$nonopt" + allow_undefined=yes + compile_command="$CC" + finalize_command="$CC" + + compile_shlibpath= + finalize_shlibpath= + deplibs= + dlfiles= + dlprefiles= + export_dynamic=no + hardcode_libdirs= + libobjs= + link_against_libtool_libs= + ltlibs= + objs= + prev= + prevarg= + release= + rpath= + perm_rpath= + temp_rpath= + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case "$arg" in + -all-static | -static) + if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + for arg + do + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + *) + dlprefiles="$dlprefiles $arg" + test "$prev" = dlfiles && dlfiles="$dlfiles $arg" + prev= + ;; + esac + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath) + rpath="$rpath $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + if test "$export_dynamic" != yes; then + export_dynamic=yes + if test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + else + arg= + fi + + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + fi + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` + case "$dir" in + /* | [A-Za-z]:\\*) + # Add the corresponding hardcode_libdir_flag, if it is not identical. + ;; + *) + $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 + exit 1 + ;; + esac + deplibs="$deplibs $arg" + ;; + + -l*) deplibs="$deplibs $arg" ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.a) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$libdir"; then + $echo "$modename: \`$arg' contains no -rpath information" 1>&2 + exit 1 + fi + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname"; then + # If there is no dlname, we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test "$build_libtool_libs" = yes && test -n "$library_names"; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # This is the magic to use -rpath. + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + # Put the magic libdir with the hardcode flag. + hardcode_libdirs="$libdir" + libdir="@HARDCODE_LIBDIRS@" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + libdir= + fi + fi + + if test -n "$libdir"; then + eval flag=\"$hardcode_libdir_flag_spec\" + + compile_command="$compile_command $flag" + finalize_command="$finalize_command $flag" + fi + elif test -n "$runpath_var"; then + # Do the same for the permanent run path. + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + + + case "$hardcode_action" in + immediate) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; + + relink) + # We need an absolute path. + case "$dir" in + /* | [A-Za-z]:\\*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + compile_command="$compile_command -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + compile_shlibpath="$compile_shlibpath$dir:" + compile_command="$compile_command -l$name" + fi + ;; + + *) + $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2 + exit 1 + ;; + esac + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + finalize_command="$finalize_command -L$libdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + finalize_shlibpath="$finalize_shlibpath$libdir:" + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + finalize_command="$finalize_command -L$libdir -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + compile_command="$compile_command -L$dir -l$name" + finalize_command="$finalize_command -L$dir -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$vinfo" && test -n "$release"; then + $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + oldlib= + oldobjs= + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + */* | *\\*) + $echo "$modename: output file \`$output' must have no directory components" 1>&2 + exit 1 + ;; + + *.a) + # Now set the variables for building old libraries. + build_libtool_libs=no + build_old_libs=yes + oldlib="$output" + $show "$rm $oldlib" + $run $rm $oldlib + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$output" in + lib*) ;; + *) + $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + current=0 + revision=0 + age=0 + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles"; then + $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2 + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$rpath"; then + $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo + IFS="$save_ifs" + + if test -n "$5"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + test -n "$2" && current="$2" + test -n "$3" && revision="$3" + test -n "$4" && age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + version_vars="version_type current age revision" + case "$version_type" in + none) ;; + + linux) + version_vars="$version_vars major versuffix" + major=`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + version_vars="$version_vars versuffix verstring" + major=`expr $current - $age` + versuffix="$current.$age.$revision" + verstring="$versuffix" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + version_vars="$version_vars major versuffix" + major="$current" + versuffix="$current.$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Create the output directory, or remove our outputs if we need to. + if test -d $objdir; then + $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*" + $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.* + else + $show "$mkdir $objdir" + $run $mkdir $objdir + status=$? + if test $status -eq 0 || test -d $objdir; then : + else + exit $status + fi + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + # Add libc to deplibs on all systems. + dependency_libs="$deplibs" + deplibs="$deplibs -lc" + + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are PIC. + test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'` + + # Do each of the archive commands. + eval cmds=\"$archive_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + $show "(cd $objdir && $LN_S $realname $linkname)" + $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $? + done + + # If -export-dynamic was specified, set the dlname. + if test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + + # Now set the variables for building old libraries. + oldlib="$objdir/$libname.a" + ;; + + *.lo | *.o) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles"; then + $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2 + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Create the old-style object. + reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + test -z "$libobj" && exit 0 + + if test "$build_libtool_libs" != yes; then + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show "$LN_S $obj $libobj" + $run $LN_S $obj $libobj || exit 1 + fi + + exit 0 + ;; + + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2 + fi + + if test -n "$rpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + # Put the magic libdir with the hardcode flag. + hardcode_libdirs="$libdir" + libdir="@HARDCODE_LIBDIRS@" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + libdir= + fi + fi + + if test -n "$libdir"; then + eval flag=\"$hardcode_libdir_flag_spec\" + + compile_command="$compile_command $flag" + finalize_command="$finalize_command $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + fi + + # Substitute the hardcoded libdirs into the compile commands. + if test -n "$hardcode_libdir_separator"; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` + finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` + fi + + if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${output}S.c" + else + dlsyms= + fi + + if test -n "$dlsyms"; then + # Add our own program objects to the preloaded list. + dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'` + + # Discover the nlist of each of the dlfiles. + nlist="$objdir/${output}.nm" + + if test -d $objdir; then + $show "$rm $nlist ${nlist}T" + $run $rm "$nlist" "${nlist}T" + else + $show "$mkdir $objdir" + $run $mkdir $objdir + status=$? + if test $status -eq 0 || test -d $objdir; then : + else + exit $status + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + # Parse the name list into a source file. + $show "creating $objdir/$dlsyms" + if test -z "$run"; then + # Make sure we at least have an empty file. + test -f "$nlist" || : > "$nlist" + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + wcout=`wc "$nlist" 2>/dev/null` + count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` + (test "$count" -ge 0) 2>/dev/null || count=-1 + else + $rm "$nlist"T + count=-1 + fi + + case "$dlsyms" in + "") ;; + *.c) + $echo > "$objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define dld_preloaded_symbol_count some_other_symbol +#define dld_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test -f "$nlist"; then + sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms" + else + echo '/* NONE */' >> "$objdir/$dlsyms" + fi + + $echo >> "$objdir/$dlsyms" "\ + +#undef dld_preloaded_symbol_count +#undef dld_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define __ptr_t void * +#else +# define __ptr_t char * +#endif + +/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ +int dld_preloaded_symbol_count = $count; + +/* The mapping between symbol names and symbols. */ +struct { + char *name; + __ptr_t address; +} +dld_preloaded_symbols[] = +{\ +" + + if test -f "$nlist"; then + sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms" + fi + + $echo >> "$objdir/$dlsyms" "\ + {0, (__ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif\ +" + ;; + + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + fi + + # Now compile the dynamic symbol file. + $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")" + $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $? + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"` + elif test "$export_dynamic" != yes; then + test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 + else + # We keep going just in case the user didn't refer to + # dld_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + + # We have no uninstalled library dependencies, so finalize right now. + $show "$compile_command" + $run eval "$compile_command" + exit $? + fi + + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'` + finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'` + + # Create the binary in the object directory, then wrap it. + if test -d $objdir; then : + else + $show "$mkdir $objdir" + $run $mkdir $objdir + status=$? + if test $status -eq 0 || test -d $objdir; then : + else + exit $status + fi + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + /* | [A-Za-z]:\\*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + # Delete the old output file. + $run $rm $output + + if test -n "$compile_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" + finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" + fi + + case "$hardcode_action" in + relink) + # AGH! Flame the AIX and HP-UX people for me, will ya? + $echo "$modename: warning: using a buggy system linker" 1>&2 + $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2 + ;; + esac + + $show "$compile_command" + $run eval "$compile_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the finalize command for shipping. + finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"` + + # Quote $echo for shipping. + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! /bin/sh + +# $output - temporary wrapper script for $objdir/$output +# Generated by ltmain.sh - GNU $PACKAGE $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of \``pwd`'. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + link_against_libtool_libs='$link_against_libtool_libs' + finalize_command=\"$finalize_command\" +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" = \"$magic\"; then : + else + echo=\"$qecho\" + file=\"\$0\" + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" + + progdir=\"\$thisdir/$objdir\" + program='$output' + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\` + + export $shlibpath_var +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} + + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + if test "$build_old_libs" = "yes"; then + # Transform .lo files to .o files. + oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'` + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.a" + + $show "creating $output" + + # Only create the output if not a dry run. + if test -z "$run"; then + $echo > $output "\ +# $output - a libtool library file +# Generated by ltmain.sh - GNU $PACKAGE $VERSION + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $objdir && $LN_S ../$output $output)" + $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1 + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional /bin/sh argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL"; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir= + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test -n "$isdir"; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + /* | [A-Za-z]:\\*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + test "X$dlname" = "X$realname" && dlname= + + if test $# -gt 0; then + # Delete the old symlinks. + rmcmd="$rm" + for linkname + do + rmcmd="$rmcmd $destdir/$linkname" + done + $show "$rmcmd" + $run $rmcmd + + # ... and create new ones. + for linkname + do + test "X$dlname" = "X$linkname" && dlname= + $show "(cd $destdir && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $LN_S $realname $linkname)" + done + fi + + if test -n "$dlname"; then + # Install the dynamically-loadable library. + $show "$install_prog $dir/$dlname $destdir/$dlname" + $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + $show "$install_prog $file $destdir/$name" + $run eval "$install_prog $file $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'` + ;; + *.o) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + link_against_libtool_libs= + finalize_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -z "$libdir"; then + $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2 + elif test -f "$libfile"; then : + else + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + if test "$hardcode_action" = relink; then + if test "$finalize" = yes; then + $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 + $show "$finalize_command" + if $run eval "$finalize_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + file="$objdir/$file"T + else + $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $dest" + $run eval "$install_prog\$stripme \$file \$dest" || exit $? + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" + fi + done + fi + + echo "------------------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "To link against installed libraries in a given directory, LIBDIR," + echo "you must use the \`-LLIBDIR' flag during linking." + echo + echo " You will also need to do one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "------------------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test -f "$file"; then : + else + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + test "X$n" = "X$dlname" && dlname= + done + test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + +-n, --dry-run display commands without modifying any files + --features display configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only +library objects (\`.lo' files) may be specified, and \`-rpath' is required. + +If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' +and \`ranlib'. + +If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is +created, otherwise an executable program is created." + ;; + +uninstall) + $echo +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/buildscripts/mail-address.sh b/buildscripts/mail-address.sh new file mode 100644 index 0000000000..37e1141751 --- /dev/null +++ b/buildscripts/mail-address.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# mail-address +if [ "$MAILADDRESS" != "" ]; then + echo $MAILADDRESS +else + echo "mail-address:6: warning: \$MAILADDRESS undefined" > /dev/stderr + echo $USER@`hostname` +fi diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py new file mode 100644 index 0000000000..4d4b505197 --- /dev/null +++ b/buildscripts/mf-to-table.py @@ -0,0 +1,327 @@ +#!@PYTHON@ + +# mf-to-table.py -- convert spacing info in MF logs .ly and .tex +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1997 Han-Wen Nienhuys + +import os +import sys +import getopt +from string import * +import regex +import regsub +import time + + +(options, files) = getopt.getopt( + sys.argv[1:], 'a:d:hl:o:p:t:', + ['afm=', 'outdir=', 'dep=', 'ly=', 'tex=', 'debug', 'help', 'package=']) + +for opt in options: + o = opt[0] + a = opt[1] + if o == '-p' or o == '--package': + topdir = a + +sys.path.append (topdir + '/stepmake/bin') +from packagepython import * +package = Package (topdir) +packager = Packager () + +from packagepython import * +from flower import * + +begin_autometric_re = regex.compile('@{') +end_autometric_re = regex.compile('@}') +include_re = regex.compile ('(\([a-zA-Z_0-9-]+\.mf\)') +autometric_re = regex.compile('@{\(.*\)@}') +version = '0.7' +postfixes = ['log', 'dvi', '2602gf', 'tfm'] + +class Feta_file(File): + """Read Feta metrics from a metafont log-file.""" + + def include_scan (self, line): + include_pos = include_re.search (line) + while include_pos <> -1: + self.dependencies.append (include_re.group (1)) + + line = line[include_pos + 1:] + include_pos = include_re.search (line) + + def read_autometricline(self): + line = '' + while end_autometric_re.search(line) == -1 and not self.eof(): + suf = File.readline(self) + self.include_scan (suf) + if begin_autometric_re.search(line) == -1: + line = '' + line = line + regsub.sub('\n','', suf) + line = regsub.sub('\r','', line) + + if self.eof(): + return '' + + return line; + def readline(self): + """return what is enclosed in one @{ @} pair""" + line = ''; + while autometric_re.search(line) == -1 and not self.eof(): + line = self.read_autometricline() + + if self.eof(): + return ''; + + return autometric_re.group(1); + def __init__(self, nm): + File.__init__(self, nm) + self.dependencies = [] + def do_file(infile_nm): + infile = readline(); + +# +# FIXME: should parse output for {} to do indenting. +# +class Indentable_file(File): + """Output file with support for indentation""" + def __init__(self,nm, mode): + File.__init__(self,nm,mode) + self.current_indent_ = 0 + self.delta_indent_ = 4 + def writeline (self, str): + File.write(self, str) + def writeeol(self): + File.write(self, '\n') + File.write(self, ' '* self.current_indent_) + + def indent(self): + self.current_indent_ = self.delta_indent_ + self.current_indent_; + def dedent(self): + self.current_indent_ = self.current_indent_ - self.delta_indent_; + if self.current_indent_ < 0: + raise 'Nesting!' + + def write(self, str): + lines = split(str, '\n') + for l in lines[:-1]: + self.writeline(l) + self.writeeol() + self.writeline (lines[-1]) + +class Afm_file (File): + def print_f_dimen(self, f): + f = f * 1000 + + dimstr = '%.2f' % f + + # try to mask rounding errors + if (dimstr == '-0.00'): + dimstr = '0.00' + self.write( dimstr +' '); + + def neg_print_dimen(self, str): + self.print_f_dimen(-atof(str)) + def print_dimen(self, str): + self.print_f_dimen(atof(str)) + def def_symbol (self, code, lily_id, tex_id, xdim, ydim): + self.write ('C %s; N %s-%s; B ' % (code, self.groupname, lily_id)) + + self.neg_print_dimen(xdim [0]) + self.neg_print_dimen(ydim [0]) + self.print_dimen(xdim [1]) + self.print_dimen(ydim [1]) + + self.write (';\n'); + + def start (self,nm): + self.write ('Start%s\n' % nm) + def end (self,nm): + self.write ('End%s\n' % nm) + +class Ly_file(Indentable_file): + """extra provisions for mozarella quirks""" + def print_lit(self, str): + self.write('\"%s\"\t' % str) + + def print_f_dimen(self, f): + dimstr = '%.2f' % f + + # try to mask rounding errors + if (dimstr == '-0.00'): + dimstr = '0.00' + self.write( dimstr +'\\pt\t'); + + def print_dimen(self, str): + self.print_f_dimen(atof(str)) + + def neg_print_dimen(self, str): + self.print_f_dimen(-atof(str)); + + def def_symbol(self, code, lily_id, tex_id, xdim, ydim): + self.print_lit(lily_id) + self.print_lit('\\\\' + tex_id) + + self.neg_print_dimen(xdim [0]) + self.print_dimen(xdim [1]) + self.neg_print_dimen(ydim [0]) + self.print_dimen(ydim [1]) + self.write('\n') + + +class Log_reader: + """Read logs, destill info, and put into output files""" + def output_label(self, line): + + if not line: + return; + tags = split(line, '@:') + label = tags[0] + name = tags[1] + ly = self.lyfile + afm = self.afmfile + if tags[0] == 'font': + ly.indent() + ly.write("% name=\\symboltables {\n") + self.texfile.write("% name\n") + + afm.write ('FontName %s\n' % name) + afm.start ('FontMetrics') + afm.start ('CharMetrics') + + elif label == "group": + ly.indent() + ly.print_lit(name) + ly.write(' = \\table {\n') + self.texfile.write("% " + name + "\n") + afm.groupname = name + elif label == "puorg": + ly.dedent() + ly.write("}\n") + self.texfile.write("\n") + elif label == "tnof": + ly.dedent() + ly.write("% } % $name\n") + afm.end ('CharMetrics') + afm.end('FontMetrics'); + elif label == "char": + code = tags[2] + id = tags [7] + texstr = tags [8] + xdim = tags[3:5] + ydim = tags[5:7] + ly.def_symbol(code, id, texstr, xdim, ydim) + + self.texfile.write("\\fetdef\\%s{%s}\n" % (texstr, code)) + afm.def_symbol (code, id, texstr, xdim, ydim) + else: + raise 'unknown label: ' + label + + def writedeps (self, deps): + if not len (deps): + sys.stderr.write ('Huh, no main target??') + return + filename = deps[0] + split = os.path.splitext(filename) + basename=split[0]; + + targets = map (lambda x,y = basename, z = self.outdir: z + '/' + y + '.' + x, postfixes) + depstring = reduce(lambda x,y: x + ' ' + y, deps) + dependencies = map (lambda x, y=depstring: x + ': ' + y, targets) + for x in dependencies: + self.depfile.write (x + '\n') + + def do_file(self,filenm): + self.lyfile.write ('\n% input from ' + filenm + '\n') + self.texfile.write ('\n% input from ' + filenm + '\n') + feta = Feta_file(filenm) + while not feta.eof(): + line = feta.readline() + self.output_label(line) + feta.close() + + self.writedeps (feta.dependencies) + + def __init__(self, lyfile_nm, texfile_nm, depfile_nm, afmfile_nm): + self.lyfile = Ly_file(lyfile_nm, 'w') + self.texfile = Indentable_file(texfile_nm, 'w') + self.depfile = File (depfile_nm, 'w') + self.afmfile = Afm_file (afmfile_nm, 'w') + headerstr = '%% Creator: %s\n%% Automatically generated on\n%% Do not edit' % \ + (program_id() ) + + self.lyfile.write(headerstr) + self.texfile.write(headerstr) + self.depfile.write ('# automatically generated by %s\n' % program_id ()) + + def close(self): + self.lyfile.close() + self.texfile.close() + self.depfile.close () + + def __del__(self): + self.close() + +def today_str(): + return time.asctime(time.localtime(time.time())) + +def program_id(): + return 'mf-to-table.py version ' + version; + +def identify(): + sys.stdout.write(program_id() + '\n') + +def help(): + sys.stdout.write("Usage: mf-to-table [options] LOGFILEs\n" + + "Generate mozarella metrics table from preparated feta log\n\n" + + "Options:\n" + + " -a, --afm=FILE .afm file\n" + + " -d, --dep=FILE print dependency info to FILE\n" + + " -h, --help print this help\n" + + " -l, --ly=FILE name output table\n" + + " -o, --outdir=DIR prefix for dependency info\n" + + " -p, --package=DIR specify package\n" + + " -t, --tex=FILE name output tex chardefs\n" + ) + sys.exit (0) + + +def main(): + identify() + + lyfile_nm = texfile_nm = ''; + depfile_nm = '' + afmfile_nm = '' + outdir_prefix = '.' + for opt in options: + o = opt[0] + a = opt[1] + if o == '--dep' or o == '-d': + depfile_nm = a + elif o == '--outdir' or o == '-o': + outdir_prefix = a + elif o == '--ly' or o == '-l': + lyfile_nm = a + elif o == '--tex' or o == '-t': + texfile_nm = a + elif o== '--help' or o == '-h': + help() + elif o=='--afm' or o == '-a': + afmfile_nm = a + elif o == '--debug': + debug_b = 1 + elif o == '-p' or o == '--package': + topdir = a + else: + print o + raise getopt.error + + log_reader = Log_reader(lyfile_nm, texfile_nm, depfile_nm, afmfile_nm) + log_reader.outdir = outdir_prefix + for filenm in files: + log_reader.do_file(filenm) + log_reader.close() + + +main() diff --git a/buildscripts/mf-to-xpms.sh b/buildscripts/mf-to-xpms.sh new file mode 100644 index 0000000000..03729893d9 --- /dev/null +++ b/buildscripts/mf-to-xpms.sh @@ -0,0 +1,60 @@ +#!@SHELL@ +# mf-to-xpms.sh + +if [ $# -ne 1 ]; then + echo Usage: mf-to-xpms feta20 + exit 2 +fi + +font=`basename $1 .mf` +mf=$font.mf +afm=out/$font.afm +PKTOPBM=pktopbm +MODE=ibmvga +RESOLUTION=110 +named=yes + +if [ ! -e out/$font.${RESOLUTION}pk ]; then + mf "\\mode=${MODE}; \\input $mf" + mv $font.${RESOLUTION}gf out + rm -f $font.log $font.tfm + gftopk out/$font.${RESOLUTION}gf out/$font.${RESOLUTION}pk +fi + +# num=`grep "^C *[0-9]*;" $afm | tail -1 | sed "s!^C *\([^;]*\).*!\\1!"` +# num=66 +# tex=out/$font.tex +# cat > $tex < out/$font-$i.xpm +done +rm -f $PBMS diff --git a/buildscripts/mutopia-index.py b/buildscripts/mutopia-index.py new file mode 100644 index 0000000000..b72042cadf --- /dev/null +++ b/buildscripts/mutopia-index.py @@ -0,0 +1,172 @@ +#!@PYTHON@ +# mutopia-index.py + +name = 'mutopia-index' + +import regex +import os +import sys +import stat +sys.path.append ('@abs-step-bindir@') + + + +header_regex = regex.compile('\\header[ \t\n]*{\([^}]*\)}') +header_entry_regex = regex.compile('[\n\t ]*\([^\n\t ]+\)[\n\t ]*=[\n \t]*\([^;]+\)[\n \t]*;') + +# +# FIXME breaks on multiple strings. +# +def read_mudela_header (fn): + s = gulp_file(fn) + s = regsub.gsub('%.*$', '', s) + s = regsub.gsub('\n', ' ', s) + + dict = {} + if header_regex.search(s) <> -1: + h = header_regex.group(1) + else: + return dict + + while regex.search('=', h) <> -1: + + if header_entry_regex.search (h) == -1: + + raise 'format error' + + h = regsub.sub(header_entry_regex, '', h) + left = header_entry_regex.group(1) + right = header_entry_regex.group(2) + + right = regsub.gsub('\([^\\]\)\"', '\\1', right) + right = regsub.gsub('^"', '', right) + left = regsub.gsub('\([^\\]\)\"', '', left) + left = regsub.gsub('^"', '', left) + + dict[left] = right + + return dict + + + + +def help (): + sys.stdout.write ("Usage: " + name + " [options] INFILE OUTFILE\n" + + "Generate index for mutopia\n\n" + + "Options:\n" + + " -h, --help print this help\n" + + " -p, --package=DIR specify package\n" + + " --prefix=PRE specify prefix\n" + + " -s, --subdirs=DIR add subdir\n" + + " --suffix=SUF specify suffix\n" + ) + sys.exit (0) + +def gen_list(inputs, subdir, filename): + (pre, subdirs, post)=subdir + print "generating HTML list %s\n" % filename + list = open(filename, 'w') + list.write ('Rendered Examples\n') + list.write ('') + if len(subdirs): + list.write ('

subdirectories

') + list.write ('
    ') + for ex in subdirs: + print 'subdir %s ' % ex + list.write ('
  • Subdirectory: %s
  • \n' % (pre + ex + post , ex)) + + list.write ('
') + + list.write('

Contents of this directory

\n'); + list.write ( + 'These example files are taken from the LilyPond distribution. ' + 'LilyPond currently only outputs TeX and MIDI. The pictures and ' + 'PostScript files were generated using TeX, Ghostscript and some ' + 'graphics tools. The papersize used for these examples is A4. ' + 'As you know, no gifs due to patent problems, ' + 'but the png images should be viewable with any current browser ' + '(jpeg is inappropriate for music images).' + '\n'); + + + for ex in inputs: + ex_ext = '.ly' + print '%s, ' % ex + try: + header = read_mudela_header(ex + ex_ext + '.txt') + except: + ex_ext = '.fly' + header = read_mudela_header(ex + ex_ext + '.txt') + + def read_dict(s, default, h =header): + try: + ret = h[s] + except KeyError: + ret = default + return ret + head = read_dict('title', ex) + composer = read_dict('composer', '') + desc = read_dict('description', '') + list.write('
') + list.write('

example file: %s

' % head); + if composer <> '': + list.write('

%s

\n' % composer) + if desc <> '': + list.write('%s

' % desc) + list.write ('

    ') + def list_item(filename, desc, type, l = list): + if file_exist_b(filename): + l.write ('
  • %s' % (filename, desc)) + size=os.stat(filename)[stat.ST_SIZE] + l.write (' (%s %dk)' % (type, (size + 512) / 1024)) + pictures = ['jpeg', 'png', 'xpm'] + # silly, no? + if 0 and type in pictures: + l.write (' no gifs due to patent problems') + l.write ('\n') + list_item(ex + ex_ext + '.txt', 'The input', 'ASCII') + for pageno in range(1,100): + f = ex + '-page%d.png' % pageno + if not file_exist_b (f): + break + list_item(f, 'The output, page %d' % pageno, 'png') + list_item(ex + '.ps.gz', 'The output', 'gzipped PostScript') + list_item(ex + '.midi', 'The output', 'MIDI') + list.write ("
"); + + list.write( ""); + list.close() + +import getopt + +(options, files) = getopt.getopt(sys.argv[1:], + 'hp:s:', ['help', 'subdirs=', 'suffix=', 'package=', 'prefix=']) +subdir_pre='' +subdir_suf ='' + +subdirs =[] +for opt in options: + o = opt[0] + a = opt[1] + if o == '--subdirs' or o == '-s': + subdirs.append (a) + elif o == '--prefix': + subdir_pre = a + elif o == '-p' or o == '--package': + topdir = a + elif o == '--suffix': + subdir_suf = a + + sys.path.append (topdir + '/stepmake/bin') + from packagepython import * + package = Package (topdir) + packager = Packager () + + from flower import * + + +# huh? +allfiles = multiple_find (['*.*ly.txt'], '.') + +gen_list (files, (subdir_pre, subdirs, subdir_suf), 'index.html') + diff --git a/buildscripts/profile-conf.sh b/buildscripts/profile-conf.sh new file mode 100644 index 0000000000..79dbd73463 --- /dev/null +++ b/buildscripts/profile-conf.sh @@ -0,0 +1,2 @@ + +configure --prefix=~ --enable-profiling --enable-config=optprof --enable-optimise --disable-checking diff --git a/buildscripts/ps-to-gifs.sh b/buildscripts/ps-to-gifs.sh new file mode 100755 index 0000000000..0f4afe0a5a --- /dev/null +++ b/buildscripts/ps-to-gifs.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# ps-to-gifs, convert PS to multiple gifs or other bitmaps + +usage() +{ + cat < $OUTFILE +PPMS=`ls $BASE*ppm` +for i in $PPMS; do + o=`dirname $i`/`basename $i .ppm`.$GIF + cat $i | pnmscale 0.5 | $CROP | $PNMTOGIF $color > $o + rm $i +done + +if [ "x$OUTFILE" != "x" ]; then + mv $BASE-page1.$GIF $BASE.$GIF +fi + diff --git a/buildscripts/ps-to-pngs.sh b/buildscripts/ps-to-pngs.sh new file mode 100755 index 0000000000..2a3f3636b5 --- /dev/null +++ b/buildscripts/ps-to-pngs.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# ps-to-pngs, convert PS to multiple pngs + +ps-to-gifs --png $* diff --git a/buildscripts/run-lilypond.sh b/buildscripts/run-lilypond.sh new file mode 100644 index 0000000000..2a69e5a3e2 --- /dev/null +++ b/buildscripts/run-lilypond.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +LILYTOPDIR=$1 +shift +export LILYINCLUDE="$LILYTOPDIR/init:$LILYTOPDIR/mf/out:$LILYINCLUDE" +export TEXINPUTS="$LILYTOPDIR/tex:$TEXINPUTS" +export MFINPUTS="$LILYTOPDIR/mf:$TEXINPUTS" + +$LILYTOPDIR/lily/out/lilypond $* diff --git a/buildscripts/set-lily.sh b/buildscripts/set-lily.sh new file mode 100755 index 0000000000..d44317dc8e --- /dev/null +++ b/buildscripts/set-lily.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# zet-lily.sh --- configure LilyPond sourcetree +# nice in first character unique name +# +PACKAGE_NAME=LilyPond +export PACKAGE_NAME +prefix=$HOME/usr +sources=$prefix/src +# +# +. ./stepmake/bin/package-zet.sh +# +# The $sources dir looks like this: +# +# +# +if [ "x$LILYINCLUDE" = "x" ]; then + # we can try... + echo you should add the following to your profile script + if [ "x$MAILADDRESS" = "x" ]; then + MAILADDRESS=$USER@`hostname` + export MAILADDRESS + echo " MAILADDRESS=\$USER@`hostname`" + echo " export MAILADDRESS" + fi + LILYINCLUDE=$LILYPOND_SOURCEDIR/init:$LILYPOND_SOURCEDIR/input:$LILYPOND_SOURCEDIR/mf/out + MFINPUTS=$MFINPUTS:$LILYPOND_SOURCEDIR/mf + TEXINPUTS=$TEXINPUTS:$LILYPOND_SOURCEDIR/mf/out + export LILYINCLUDE MFINPUTS TEXINPUTS + cat < */ diff --git a/flower/include/array.hh b/flower/include/array.hh index c40e639817..c9c146e9f1 100644 --- a/flower/include/array.hh +++ b/flower/include/array.hh @@ -66,12 +66,23 @@ public: {setsize_} */ int size() const - { return size_; } + { + return size_; + } /// POST: size() == 0 - void clear() - { size_ = 0; } + void clear() + { + size_ = 0; + } + Array (T *tp, int n) + { + array_p_ = new T[n]; + max_ =size_ = n; + arrcpy (array_p_, tp, n); + } + Array() { array_p_ = 0; max_ =0; size_ =0; } diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index d3c9a7afb3..e1e840b8a1 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -183,7 +183,7 @@ public: V retval; if (!elem_b (k)) return retval ; - retval ((Dictionary *) this)->elem (k); + return ((Dictionary *) this)->elem (k); } V remove (String s) diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 8b4d280cf5..b4eeb97597 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -78,6 +78,7 @@ public: return sqrt (norm_sq()); } operator Array() { return dat; } + Array const &to_array()const { return dat; } void print() const; /// set to j-th element of unit-base void set_unit (int j) ; diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index 39795ce115..909267165b 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -10,6 +10,7 @@ #ifndef VIRTUAL_METHODS_HH #define VIRTUAL_METHODS_HH +#include #include "stdlib.h" // size_t /** Declare the classes name as a static and virtual function. @@ -17,49 +18,79 @@ s->name() != S::static_name (). Overlapping strings need not be merged in C++ */ #define DECLARE_MY_RUNTIME_TYPEINFO \ -static bool static_is_type_b (const char*s);\ -virtual bool is_type_b (const char *s) const { return static_is_type_b (s); } \ -virtual char const *name() const{ return static_name (); } \ -virtual size_t class_size () const { return static_class_size (); }\ -static size_t static_class_size (); \ +virtual char const *name() const{ return static_name (); }\ static char const *static_name() -#define IMPLEMENT_STATIC_NAME(c)\ - char const *c::static_name() { return #c; } \ - size_t c::static_class_size () { return sizeof (c); } +#if 0 + /* + oops. before() has nothing to do with inheritance + */ +inline bool operator > (type_info const &a1, type_info const &a2) +{ + return a2.before (a1); +} +inline bool operator < (type_info const &a1, type_info const &a2) +{ + return a1.before (a2); +} -#define VIRTUAL_COPY_CONS(T, R)\ - virtual R *clone() const { return new T(*this); } \ - int yet_another_stupid_function_to_allow_semicolon() +inline bool operator <= (type_info const &a1, type_info const &a2) +{ + return a1 == a2 || a1 < a2; +} + +inline bool operator >= (type_info const &a1, type_info const &a2) +{ + return a1 == a2 || a1 > a2; +} +#endif + +#define IMPLEMENT_STATIC_NAME(c)\ + char const *c::static_name() { return #c; } + + /* + size_t c::static_class_size () { return sizeof (c); } + */ +#define VIRTUAL_COPY_CONS(T, R)\ + virtual R *clone() const { return new T(*this); } #define DECLARE_VIRTUAL_COPY_CONS(T, R)\ virtual R *clone() const + #define IMPLEMENT_VIRTUAL_COPY_CONS(T, R)\ R *T::clone() const { return new T(*this); }\ #define IMPLEMENT_IS_TYPE_B(D)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) + +/* bool D::static_is_type_b (const char *s)\ {\ return s == static_name();\ -} +}*/ #define IMPLEMENT_IS_TYPE_B1(D, B)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) +/* bool D::static_is_type_b (const char *s)\ {\ return s == static_name() || B::static_is_type_b (s);\ } +*/ #define IMPLEMENT_IS_TYPE_B2(D, BA, BB)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) + +/* + bool D::static_is_type_b (const char *s)\ {\ return s == static_name() || BA::static_is_type_b (s) || BB::static_is_type_b (s);\ } +*/ #endif diff --git a/lily/GNUmakefile b/lily/GNUmakefile index cf4db4c84a..e04d9f6476 100644 --- a/lily/GNUmakefile +++ b/lily/GNUmakefile @@ -6,9 +6,15 @@ depth = .. NAME = lilypond SUBDIRS = include -MODULE_LIBS=$(depth)/lib $(depth)/flower +MODULE_LIBS=$(depth)/lib $(depth)/flower +MODULE_INCLUDES=$(depth)/lib/include $(depth)/flower/include -STEPMAKE_TEMPLATES= c++ executable +STEPMAKE_TEMPLATES= c++ executable + +MODULE_LIBES=-lguile + +# for the RedHat GUILE 1.3 RPM +MODULE_LIBES+= -lreadline -ldl include $(depth)/make/stepmake.make diff --git a/lily/abbrev.cc b/lily/abbrev.cc index eb87945cd7..841f063ca6 100644 --- a/lily/abbrev.cc +++ b/lily/abbrev.cc @@ -129,7 +129,7 @@ void Abbreviation::do_substitute_dependent (Score_element*o, Score_element*n) { if (stem_l_ == o) - stem_l_ = n ? dynamic_cast (n) : 0; + stem_l_ = dynamic_cast (n); } diff --git a/lily/abbreviation-beam-engraver.cc b/lily/abbreviation-beam-engraver.cc index be29437462..145ab50bcb 100644 --- a/lily/abbreviation-beam-engraver.cc +++ b/lily/abbreviation-beam-engraver.cc @@ -27,11 +27,7 @@ Abbreviation_beam_engraver::Abbreviation_beam_engraver () bool Abbreviation_beam_engraver::do_try_request (Request*r) { - Musical_req* mus_l = dynamic_cast (r); - if (!mus_l) - return false; - - Abbreviation_beam_req * b = dynamic_cast (mus_l); + Abbreviation_beam_req * b = dynamic_cast (r); if (!b) return false; @@ -40,7 +36,7 @@ Abbreviation_beam_engraver::do_try_request (Request*r) return false; Direction d = (!abeam_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l)) + if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b)) return false; span_reqs_drul_[d] = b; @@ -82,11 +78,10 @@ Abbreviation_beam_engraver::do_removal_processing () void Abbreviation_beam_engraver::acknowledge_element (Score_element_info i) { - if (!abeam_p_ || !i.elem_l_->is_type_b (Stem::static_name ())) + Stem* s = dynamic_cast (i.elem_l_); + if (!abeam_p_ || !s) return; - Stem* s = (Stem*)dynamic_cast (i.elem_l_); - int type_i = span_reqs_drul_[LEFT]->type_i_; s->flag_i_ = intlog2 (type_i) - 2; if (span_reqs_drul_[RIGHT]) diff --git a/lily/atom.cc b/lily/atom.cc index 2d8f11e78e..ae6092c165 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -6,7 +6,6 @@ (c) 1997--1998 Han-Wen Nienhuys */ - #include "atom.hh" #include "interval.hh" #include "string.hh" @@ -66,6 +65,7 @@ Atom::extent () const } + Atom::Atom () : dim_ (Interval (0,0),Interval (0,0)) { @@ -76,15 +76,15 @@ Atom::Atom () But Atom is used as a simple type *everywhere*, and we don't have virtual contructors. */ - lambda_ = 0; str_ = "unknown\n"; + origin_l_ = 0; } Atom::Atom (String s, Box b) : dim_ (b) { - lambda_ = 0; str_ = s; + origin_l_ = 0; } @@ -101,8 +101,6 @@ Atom::offset () const return off_; } - - void Atom::translate_axis (Real r, Axis a) { diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 71757314a7..2ec7736a40 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -80,6 +80,7 @@ Audio_time_signature::midi_item_p() { return new Midi_time_signature (this); } + IMPLEMENT_IS_TYPE_B1(Audio_time_signature, Audio_item); Audio_text::Audio_text (Audio_text::Type type, String text_str) @@ -96,7 +97,6 @@ Audio_text::midi_item_p() } IMPLEMENT_IS_TYPE_B1(Audio_text, Audio_item); - IMPLEMENT_IS_TYPE_B1(Audio_item, Audio_element); void diff --git a/lily/auto-plet-engraver.cc b/lily/auto-plet-engraver.cc index 254f029f59..c97be06723 100644 --- a/lily/auto-plet-engraver.cc +++ b/lily/auto-plet-engraver.cc @@ -15,16 +15,12 @@ bool Tuplet_engraver::do_try_request (Request *r) { - Command_req * c = dynamic_cast (r); - if (!(c && - dynamic_cast (c))) + if (Bracket_req * b = dynamic_cast (r)) { - return false; + bracket_req_arr_.push (b); + return true; } - - Bracket_req * b = dynamic_cast (c); - bracket_req_arr_.push (b); - return true; + return false; } void @@ -59,9 +55,9 @@ Tuplet_engraver::do_process_requests () void Tuplet_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (Note_column *nc = dynamic_cast (i.elem_l_)) { - Note_column *nc = (Note_column*)dynamic_cast (i.elem_l_); + for (int j =0; j add_column (nc); ; diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc index 928f64de0c..a19d26c6c3 100644 --- a/lily/axis-group-element.cc +++ b/lily/axis-group-element.cc @@ -76,12 +76,5 @@ Axis_group_element::Axis_group_element () transparent_b_ = true; } -Axis_group_element* -Axis_group_element::access_Axis_group_element () -{ - return this; -} - - IMPLEMENT_IS_TYPE_B2(Axis_group_element, Score_element, Graphical_axis_group); diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc index 273116d1ea..6eabab3a58 100644 --- a/lily/axis-group-item.cc +++ b/lily/axis-group-item.cc @@ -40,7 +40,7 @@ Axis_group_item::do_breakable_col_processing() { Item *new_l = it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_dir_); - ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l); + (dynamic_cast (broken_to_drul_[j]))->add_element (new_l); } while (flip(&j)!=LEFT); } diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 70c70c297f..fdd2969b5e 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -65,39 +65,36 @@ Axis_group_spanner::do_break_processing() /* this piece doesn't know where it belongs. Find out if it was broken, and use the broken remains */ - if (dynamic_cast (elt)) + Spanner * sp =dynamic_cast (elt); + Item *it = dynamic_cast (elt) ; + if (sp) { - Spanner * sp = dynamic_cast (elt); - for (int j =0; j < broken_into_l_arr_.size(); j++) { Axis_group_spanner * my_broken_l - = (Axis_group_spanner*)broken_into_l_arr_[j]; + = dynamic_cast(broken_into_l_arr_[j]); Spanner * broken_span_l - = sp->find_broken_piece ( - ((Score_element*)my_broken_l)->line_l()); + = sp->find_broken_piece (dynamic_cast(my_broken_l)->line_l()); if (broken_span_l) my_broken_l->add_element (broken_span_l); } } - else if (dynamic_cast (elt) - && dynamic_cast (elt)->breakable_b_ - && dynamic_cast (elt)->break_status_dir () == 0) + else if (it && it->breakable_b_ && it->break_status_dir () == 0) { // broken items Direction j=LEFT; do { - Item * my_item = dynamic_cast (elt)->broken_to_drul_[j]; + Item * my_item = it->broken_to_drul_[j]; Line_of_score * item_line_l = my_item->line_l() ; if (! item_line_l) continue; Axis_group_spanner * v - = (Axis_group_spanner*)find_broken_piece (item_line_l); + = dynamic_cast(find_broken_piece (item_line_l)); if (v) v->add_element (my_item); else @@ -118,7 +115,7 @@ Axis_group_spanner::do_break_processing() Put it in appropriate piece of this spanner */ Axis_group_spanner * my_broken_l - = (Axis_group_spanner*)find_broken_piece (elt->line_l()); + = dynamic_cast (find_broken_piece (elt->line_l())); my_broken_l->add_element (elt); } } diff --git a/lily/bar-column-engraver.cc b/lily/bar-column-engraver.cc index 0832448a2a..230a0f3ea2 100644 --- a/lily/bar-column-engraver.cc +++ b/lily/bar-column-engraver.cc @@ -12,6 +12,7 @@ #include "request.hh" #include "script.hh" #include "bar.hh" +#include Bar_column_engraver::Bar_column_engraver() { @@ -55,22 +56,24 @@ Bar_column_engraver::acknowledge_element (Score_element_info info) Item * it = dynamic_cast (info.elem_l_); if (!it) return; - - if (it->is_type_b (Script::static_name()) + Script *s = dynamic_cast (it); + Bar *b = dynamic_cast (it); + if (s && it->breakable_b_ && info.origin_grav_l_arr_.size() == 1 && it->break_priority_i_ == break_priority_i_) { create_column (); - barcol_p_->add_script ((Script*)it); + barcol_p_->add_script (s); } else if (info.origin_grav_l_arr_.size() == 1 && it->break_priority_i_ == break_priority_i_ - && it->breakable_b_ - && it->is_type_b (Bar::static_name())) + && it->breakable_b_ + &&b) + { create_column (); - barcol_p_->set_bar ( (Bar*)it); + barcol_p_->set_bar (b); } } diff --git a/lily/bar-column.cc b/lily/bar-column.cc index 74ce5386af..5f1a40d93f 100644 --- a/lily/bar-column.cc +++ b/lily/bar-column.cc @@ -28,7 +28,7 @@ Bar_column::do_substitute_dependency (Score_element*o,Score_element*n) Script_column::do_substitute_dependency (o,n); if (o == bar_l_) { - bar_l_ = n ? (Bar*)dynamic_cast (n) : 0; + bar_l_ = dynamic_cast (n); } } diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 7a2a515cdc..456a13cf40 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -23,16 +23,18 @@ Bar_engraver::Bar_engraver() bool Bar_engraver::do_try_request (Request*r_l) { - Command_req* c_l = dynamic_cast (r_l); - if (!c_l|| !dynamic_cast (c_l)) - return false; - Bar_req * b= dynamic_cast (c_l); - if (bar_req_l_ && bar_req_l_->equal_b (b)) - return false; + if (Bar_req * b= dynamic_cast (r_l)) + { + if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh? + return false; + + bar_req_l_ = b; + + return true; + } - bar_req_l_ = b; + return false; - return true; } void diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 380cb65145..455690e516 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -25,10 +25,8 @@ Bar_number_engraver::Bar_number_engraver() void Bar_number_engraver::acknowledge_element (Score_element_info i) { - - Item *it=dynamic_cast (i.elem_l_); - if (script_p_ - || !it || !it->is_type_b (Bar::static_name())) + Bar *b =dynamic_cast (i.elem_l_); + if (script_p_ || !b) return; /* Only put numbers on bars that are at our own level (don't put @@ -58,7 +56,7 @@ Bar_number_engraver::acknowledge_element (Score_element_info i) script_p_->break_priority_i_ = int (pri); } else - script_p_->break_priority_i_ = it->break_priority_i_; + script_p_->break_priority_i_ = b->break_priority_i_; Scalar padding = get_property ("barScriptPadding"); if (padding.length_i() && padding.isnum_b ()) diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 4ef398b499..b8eb55903b 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -25,11 +25,7 @@ Beam_engraver::Beam_engraver() bool Beam_engraver::do_try_request(Request*r) { - Musical_req* mus_l = dynamic_cast (r); - if (!mus_l) - return false; - - Beam_req* b = dynamic_cast (mus_l); + Beam_req* b = dynamic_cast (r); if (!b) return false; @@ -37,7 +33,7 @@ Beam_engraver::do_try_request(Request*r) return false; Direction d = (!beam_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l)) + if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b)) return false; span_reqs_drul_[d] = b; @@ -97,10 +93,10 @@ Beam_engraver::do_removal_processing() void Beam_engraver::acknowledge_element (Score_element_info i) { - if (!beam_p_ || !i.elem_l_->is_type_b (Stem::static_name ())) + Stem* s = dynamic_cast (i.elem_l_); + if (!beam_p_ || !s) return; - Stem* s = (Stem*)dynamic_cast (i.elem_l_); if (!dynamic_cast (i.req_l_)) { ::warning ( _("Stem must have Rhythmic structure.")); diff --git a/lily/beam.cc b/lily/beam.cc index a9dd24bda3..4982dd3937 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -125,8 +125,9 @@ Beam::do_post_processing () void Beam::do_substitute_dependent (Score_element*o,Score_element*n) { - if (o->is_type_b (Stem::static_name ())) - stems_.substitute ((Stem*)dynamic_cast (o), n? (Stem*) dynamic_cast (n):0); + if (Stem * os = dynamic_cast (o)) + stems_.substitute (os, + dynamic_cast (n)); } Interval diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc index 34c91c586c..8b691619ee 100644 --- a/lily/chord-iterator.cc +++ b/lily/chord-iterator.cc @@ -24,7 +24,7 @@ Simultaneous_music_iterator::construct_children() if (mi->ok()) { if (simultaneous_music_l ()->translator_type_str_.empty_b ()) - set_translator (mi->report_to_l()->ancestor_l (simultaneous_music_l ()->multi_level_i_)); + set_translator (mi->report_to_l()->ancestor_l (0)); children_p_list_.bottom().add (mi); } else diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 462a9c1402..83e6eff1e6 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -14,8 +14,6 @@ #include "debug.hh" #include "command-request.hh" #include "time-description.hh" - - #include "note-head.hh" #include "key-item.hh" #include "local-key-item.hh" @@ -148,7 +146,7 @@ Clef_engraver::read_req (Clef_change_req*c_l) void Clef_engraver::acknowledge_element (Score_element_info info) { - if (info.elem_l_->is_type_b (Bar::static_name ()) + if (dynamic_cast(info.elem_l_) && clef_type_str_.length_i()) { create_clef(); @@ -158,24 +156,21 @@ Clef_engraver::acknowledge_element (Score_element_info info) /* ugh; should make Clef_referenced baseclass */ Item * it_l =dynamic_cast (info.elem_l_); -if (it_l) - { - if (it_l->is_type_b (Note_head::static_name ())) + if (it_l) { - Note_head * h = (Note_head*)it_l; - h->position_i_ += c0_position_i_; - } - else if (it_l->is_type_b (Local_key_item::static_name ())) - { - Local_key_item *i = (Local_key_item*)it_l; - i->c0_position_i_ =c0_position_i_; - } - else if (it_l->is_type_b (Key_item::static_name ())) - { - Key_item *k = (Key_item*)it_l; - k-> set_c_position (c0_position_i_); - } - } + if (Note_head * h = dynamic_cast(it_l)) + { + h->position_i_ += c0_position_i_; + } + else if (Local_key_item *i = dynamic_cast (it_l)) + { + i->c0_position_i_ =c0_position_i_; + } + else if (Key_item *k = dynamic_cast(it_l)) + { + k-> set_c_position (c0_position_i_); + } + } } void @@ -195,13 +190,15 @@ Clef_engraver::do_creation_processing() bool Clef_engraver::do_try_request (Request * r_l) { - Command_req* creq_l= dynamic_cast (r_l); - if (!creq_l || !dynamic_cast (creq_l)) + if (Clef_change_req *cl = dynamic_cast (r_l)) + { + clef_req_l_ = cl; + read_req (clef_req_l_); + return true; + } + else return false; - clef_req_l_ = dynamic_cast (creq_l); - read_req (clef_req_l_); - return true; } void diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc index d7c6a102ab..a0d5dc1006 100644 --- a/lily/collision-engraver.cc +++ b/lily/collision-engraver.cc @@ -28,9 +28,8 @@ Collision_engraver::process_acknowledged () void Collision_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (Note_column * c = dynamic_cast (i.elem_l_)) { - Note_column * c = (Note_column*) dynamic_cast (i.elem_l_); if (c->rest_b ()) return ; diff --git a/lily/collision.cc b/lily/collision.cc index 3a07ce18e1..a9971951b9 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -18,6 +18,7 @@ Collision::Collision() void Collision::add_column (Note_column* ncol_l) { + // ugh. Fixme. clash_l_arr_.push (ncol_l); add_element (ncol_l); add_dependency (ncol_l); @@ -165,6 +166,10 @@ IMPLEMENT_IS_TYPE_B1(Collision, Item); void Collision::do_substitute_dependency (Score_element*o_l,Score_element*n_l) { - clash_l_arr_.substitute ((Note_column*)dynamic_cast (o_l), - (Note_column*)(n_l?dynamic_cast (n_l):0)); + if (o_l) + { + clash_l_arr_.substitute (dynamic_cast (o_l), + dynamic_cast (n_l)); + + } } diff --git a/lily/command-request.cc b/lily/command-request.cc index e407f30661..5a67560e45 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -33,8 +33,7 @@ bool Cadenza_req::do_equal_b (Request*r) const { Cadenza_req*cad = dynamic_cast (r); - - return cad->on_b_ == on_b_; + return cad && cad->on_b_ == on_b_; } Cadenza_req::Cadenza_req (bool b) @@ -48,7 +47,7 @@ bool Bar_req::do_equal_b (Request*r) const { Bar_req * b = dynamic_cast (r); - return type_str_ == b->type_str_; + return b && type_str_ == b->type_str_; } @@ -83,7 +82,7 @@ Partial_measure_req::do_equal_b (Request* r) const { Partial_measure_req *p = dynamic_cast (r); - return p->duration_ == duration_; + return p&& p->duration_ == duration_; } @@ -104,9 +103,10 @@ void Barcheck_req::do_print() const{} bool -Barcheck_req::do_equal_b (Request*) const +Barcheck_req::do_equal_b (Request*r) const { - return true; + Barcheck_req *b = dynamic_cast (r); + return r; } @@ -152,7 +152,7 @@ Time_signature_change_req::do_equal_b (Request * r) const { Time_signature_change_req * m = dynamic_cast (r); - return m->beats_i_ == beats_i_ + return m && m->beats_i_ == beats_i_ && one_beat_i_ == m->one_beat_i_; } @@ -181,7 +181,7 @@ Tempo_req::do_equal_b (Request *r) const { Tempo_req *t = dynamic_cast (r); - return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_; + return t&& t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_; } diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index ae6259ac4c..771963e348 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -30,13 +30,10 @@ Dot_column_engraver::do_pre_move_processing () void Dot_column_engraver::acknowledge_element (Score_element_info info) { - Item * i=dynamic_cast (info.elem_l_); - - if (! (i && i->is_type_b (Rhythmic_head::static_name ()))) + Rhythmic_head * h = dynamic_cast(info.elem_l_); + if (!h) return; - Rhythmic_head * h = (Rhythmic_head*)i; - if (!h->dots_l_) return; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index cee8a3edec..284b746cc9 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -33,12 +33,13 @@ void Dot_column::do_substitute_dependency (Score_element*o,Score_element*n) { Item *oi =dynamic_cast (o); - Item *ni = n?dynamic_cast (n):0; - if (oi&&oi->is_type_b (Rhythmic_head::static_name ())) - head_l_arr_.substitute ((Rhythmic_head*)oi, (Rhythmic_head*)ni); - else if (oi && oi->is_type_b (Dots::static_name ())) - dot_l_arr_.substitute ((Dots*) oi, (Dots*) ni); + if (oi && dynamic_cast (oi)) + head_l_arr_.substitute (dynamic_cast (oi), + dynamic_cast(n)); + else if (oi && dynamic_cast (oi)) + dot_l_arr_.substitute (dynamic_cast (oi), + dynamic_cast (n)); } void diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 2b38c4c08e..e0f2680748 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -34,24 +34,16 @@ Dynamic_engraver::do_post_move_processing() bool Dynamic_engraver::do_try_request (Request * r) { - Musical_req * m = dynamic_cast (r); - if (!m) - return false; - Dynamic_req * d = dynamic_cast (m); - if (!d) - return false; - -#if 0 - if (cresc_p_ && dynamic_cast (d) - && dynamic_cast (d)->spantype == Span_req::START) - return false; -#endif - for (int i=0; i < dynamic_req_l_arr_.size (); i++) - if (d->equal_b (dynamic_req_l_arr_[i])) + if(Dynamic_req * d = dynamic_cast (r)) + { + for (int i=0; i < dynamic_req_l_arr_.size (); i++) + if (d->equal_b (dynamic_req_l_arr_[i])) + return true; + + dynamic_req_l_arr_.push (d); return true; - - dynamic_req_l_arr_.push (dynamic_cast (m)); - return true; + } + return false; } void Dynamic_engraver::do_process_requests() @@ -60,7 +52,7 @@ Dynamic_engraver::do_process_requests() for (int i=0; i < dynamic_req_l_arr_.size(); i++) { Dynamic_req *dreq_l = dynamic_req_l_arr_[i]; - if (dynamic_cast (dreq_l)) + if (Absolute_dynamic_req *absd = dynamic_cast (dreq_l)) { if (dynamic_p_) @@ -71,8 +63,8 @@ Dynamic_engraver::do_process_requests() Text_def * td_p = new Text_def; td_p->align_dir_ = CENTER; - String loud = dynamic_cast (dreq_l)->loudness_str (); - td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; + String loud = absd->loudness_str (); + td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh td_p->style_str_ = "dynamic"; @@ -80,9 +72,8 @@ Dynamic_engraver::do_process_requests() dynamic_p_ = new Text_item (td_p); announce_element (Score_element_info (dynamic_p_, dreq_l)); } - else if (dynamic_cast (dreq_l)) + else if (Span_dynamic_req *span_l = dynamic_cast (dreq_l)) { - Span_dynamic_req* span_l = dynamic_cast (dreq_l); if (span_l->spantype == Span_req::STOP) { if (!cresc_p_) @@ -188,7 +179,7 @@ Dynamic_engraver::do_removal_processing () void Dynamic_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (dynamic_cast (i.elem_l_)) { if (dynamic_p_) dynamic_p_->add_support (i.elem_l_); diff --git a/lily/engraver.cc b/lily/engraver.cc index 8a79b60346..8fccb6a84d 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -57,6 +57,6 @@ Engraver_group_engraver* Engraver::daddy_grav_l () const { return (daddy_trans_l_ ) - ? (Engraver_group_engraver*) dynamic_cast (daddy_trans_l_) + ? dynamic_cast (daddy_trans_l_) : 0; } diff --git a/lily/hara-kiri-line-group-engraver.cc b/lily/hara-kiri-line-group-engraver.cc index d85437a921..16619f83c8 100644 --- a/lily/hara-kiri-line-group-engraver.cc +++ b/lily/hara-kiri-line-group-engraver.cc @@ -24,10 +24,11 @@ Hara_kiri_line_group_engraver::create_line_spanner () void Hara_kiri_line_group_engraver::typeset_element(Score_element * e) { - if (e->is_type_b (Note_head::static_name ())) - ((Hara_kiri_vertical_group_spanner*)staffline_p_)->add_note - ((Note_head*)dynamic_cast (e)); - + if (Note_head *h = dynamic_cast (e)) + { + dynamic_cast (staffline_p_) + ->add_note (h); + } Line_group_engraver_group::typeset_element (e); } diff --git a/lily/hara-kiri-vertical-group-spanner.cc b/lily/hara-kiri-vertical-group-spanner.cc index 38468cf91c..9a31e52bca 100644 --- a/lily/hara-kiri-vertical-group-spanner.cc +++ b/lily/hara-kiri-vertical-group-spanner.cc @@ -43,9 +43,9 @@ Hara_kiri_vertical_group_spanner::do_post_processing () void Hara_kiri_vertical_group_spanner::do_substitute_dependency (Score_element*o, Score_element*n) { - if (o->is_type_b (Note_head::static_name ())) - head_l_arr_.substitute ((Note_head*)dynamic_cast (o), - (n)? (Note_head*)dynamic_cast (n) : 0); + if (dynamic_cast (o)) + head_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } diff --git a/lily/head-engraver.cc b/lily/head-engraver.cc index ce4e5dcdf3..4b0a3b06fd 100644 --- a/lily/head-engraver.cc +++ b/lily/head-engraver.cc @@ -23,11 +23,12 @@ Note_head_engraver::do_try_request (Request *req_l) if (note_req_l_) return false; - if (!(dynamic_cast (req_l))) - return false; - - note_req_l_=dynamic_cast (req_l); - return true; + if (Note_req * nr = dynamic_cast (req_l)) + { + note_req_l_= nr; + return true; + } + return false; } void diff --git a/lily/heads-engraver.cc b/lily/heads-engraver.cc index a8e0aaa46b..1fc2627102 100644 --- a/lily/heads-engraver.cc +++ b/lily/heads-engraver.cc @@ -18,15 +18,12 @@ Note_heads_engraver::Note_heads_engraver() bool Note_heads_engraver::do_try_request (Request *req_l) { - if (!dynamic_cast (req_l)) - return false; - - Note_req * n =dynamic_cast (req_l); - if (!n) - return false; - - note_req_l_arr_.push (n); - return true; + if (Note_req * n =dynamic_cast (req_l)) + { + note_req_l_arr_.push (n); + return true; + } + return false; } void @@ -49,7 +46,7 @@ Note_heads_engraver::do_process_requests() dot_p_arr_.push (d); } - note_p->position_i_ = dynamic_cast (note_req_l)->pitch_.steps (); + note_p->position_i_ = note_req_l->pitch_.steps (); Score_element_info itinf (note_p,note_req_l); diff --git a/lily/identifier.cc b/lily/identifier.cc index bdd40f69a4..d09749daed 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -77,7 +77,7 @@ Identifier::do_print () const #define DEFAULT_PRINT(Class) \ void \ Class ## _identifier::do_print () const { \ - Class *cl = ((Class ## _identifier *)this)->access_ ## Class(false);\ + Class *cl = ((Class ## _identifier *)this)->access_content_ ## Class(false);\ cl->print (); \ } @@ -143,14 +143,14 @@ DEFAULT_STR(String); #define DEFAULT_ACCESSOR(Class)\ Class*\ -Class ## _identifier::access_ ## Class (bool copy_b) const {\ +Class ## _identifier::access_content_ ## Class (bool copy_b) const {\ ((Class ## _identifier*)this)->accessed_b_ = true;\ return copy_b ? new Class (*data_p_) : data_p_;\ } #define VIRTUAL_ACCESSOR(Class)\ Class*\ -Class ## _identifier::access_ ## Class (bool copy_b) const{\ +Class ## _identifier::access_content_ ## Class (bool copy_b) const{\ ((Class ## _identifier*)this)->accessed_b_ = true;\ return copy_b ? (Class*)data_p_->clone() : data_p_;\ } @@ -166,7 +166,7 @@ Class ## _identifier::access_ ## Class (bool copy_b) const{\ Class ## _identifier::Class ## _identifier (Class ## _identifier const &s) \ : Identifier (s)\ {\ - data_p_ = s.access_ ## Class (true);\ + data_p_ = s.access_content_ ## Class (true);\ } diff --git a/lily/include/atom.hh b/lily/include/atom.hh index f9621382bc..1fd7ef262c 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -9,7 +9,7 @@ #ifndef ATOM_HH #define ATOM_HH -#include "lily-guile.hh" +#include "protected-scm.hh" #include "string.hh" #include "box.hh" #include "lily-proto.hh" @@ -17,11 +17,15 @@ /// a symbol which can be translated, and freely copied class Atom { Offset off_; + + public: + Protected_scm lambda_; + Score_element * origin_l_; + // urg, only used as a temp buffer String str_; String font_; - SCM lambda_; Box dim_; Offset offset () const; diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index f1389deebd..f753b9015f 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -24,7 +24,6 @@ protected: virtual Link_array get_extra_dependencies() const; virtual void do_unlink(); virtual void do_junk_links(); - virtual Axis_group_element * access_Axis_group_element (); public: virtual Link_array elem_l_arr() const; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index a0afdc8f5e..96c010322b 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -21,18 +21,6 @@ class Command_req : public virtual Request { public: REQUESTMETHODS(Command_req); - DEFAULTACCESSOR(Measure_grouping_req) - DEFAULTACCESSOR(Clef_change_req) - DEFAULTACCESSOR(Key_change_req) - DEFAULTACCESSOR(Partial_measure_req) - DEFAULTACCESSOR(Time_signature_change_req) - DEFAULTACCESSOR(Bar_req) - DEFAULTACCESSOR(Cadenza_req) - DEFAULTACCESSOR(Timing_req) - DEFAULTACCESSOR(Command_script_req) - DEFAULTACCESSOR(Break_req) - DEFAULTACCESSOR(Mark_req) - DEFAULTACCESSOR(Bracket_req) }; @@ -64,7 +52,6 @@ public: class Timing_req : public Command_req { public: REQUESTMETHODS(Timing_req); - DEFAULTACCESSOR(Tempo_req) }; diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index 9dc6594c8e..1b73406b84 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -71,7 +71,6 @@ public: Engraver () {} DECLARE_MY_RUNTIME_TYPEINFO; - virtual Engraver * access_Engraver () { return this; } }; diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh index 3a57588a7d..d6bd8babe6 100644 --- a/lily/include/graphical-element.hh +++ b/lily/include/graphical-element.hh @@ -32,8 +32,6 @@ class Graphical_element bool cached_valid_b_a_[NO_AXES]; public: - // suck me plenty - virtual Score_element* access_Score_element () { return 0; } void set_empty (bool); bool empty_b () const; diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index cb36305966..66644eeef3 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -32,8 +32,8 @@ class Duration_identifier; #define IDACCESSOR(Class)\ -virtual Class * access_ ## Class (bool=true) const { error (#Class + String ("_identifier")); return 0; }\ -virtual Class ## _identifier * access_ ## Class ## _identifier () { return 0; } +virtual Class * access_content_ ## Class (bool) const { error (#Class + String ("_identifier")); return 0; }\ + /** A declarable data structure in mudela. @@ -78,11 +78,7 @@ struct Class ## _identifier : Identifier {\ Class ## _identifier (Class ## _identifier const&);\ Class ## _identifier (Class*st, int code);\ VIRTUAL_COPY_CONS (Class ## _identifier, Identifier);\ - virtual Class ## _identifier * access_ ## Class ## _identifier ()\ - {\ - return this;\ - }\ - virtual Class* access_ ## Class (bool copy_b) const;\ + virtual Class* access_content_ ## Class (bool copy_b) const;\ ~Class ## _identifier();\ virtual void do_print () const; \ virtual String do_str () const; \ diff --git a/lily/include/item.hh b/lily/include/item.hh index bd38edcc0f..ec0e1ae098 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -40,7 +40,6 @@ public: Item * find_prebroken_piece (Direction) const; Item * find_prebroken_piece (Line_of_score*) const; - virtual Item *access_Item() ; Item(); Real hpos_f() const; DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 56ce820c7e..c4479cb567 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -40,4 +40,7 @@ SCM ly_quote (); SCM lambda_scm (String str, Array args_arr); SCM lambda_scm (String str, Array args_arr); + + + #endif // LILY_GUILE_HH diff --git a/lily/include/lyric-performer.hh b/lily/include/lyric-performer.hh index 29a5f92390..df77b0f028 100644 --- a/lily/include/lyric-performer.hh +++ b/lily/include/lyric-performer.hh @@ -17,17 +17,15 @@ class Lyric_performer : public Performer { public: TRANSLATOR_CLONE(Lyric_performer); - DECLARE_MY_RUNTIME_TYPEINFO; - Lyric_performer(); - ~Lyric_performer(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - void do_print() const; - virtual bool do_try_request (Request* req_l); - virtual void do_process_requests(); + void do_print() const; + virtual bool do_try_request (Request* req_l); + virtual void do_process_requests(); private: - Array lreq_arr_; + Array lreq_arr_; }; #endif // LYRIC_PERFOMER_HH diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 6cdda3dc5b..477ab2465f 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -30,7 +30,6 @@ public: class Music_sequence : public Music { public: - int multi_level_i_; Music_list * music_p_list_p_; Music_sequence (Music_sequence const&); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 2f3c3f599c..d280d158ac 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -22,26 +22,7 @@ class Musical_req : public virtual Request { public: - DEFAULTACCESSOR(Lyric_req) - DEFAULTACCESSOR(Note_req ) - DEFAULTACCESSOR(Stem_req ) - DEFAULTACCESSOR(Melodic_req ) - DEFAULTACCESSOR(Slur_req ) - DEFAULTACCESSOR(Beam_req ) - DEFAULTACCESSOR(Abbreviation_beam_req) - DEFAULTACCESSOR(Rhythmic_req) - DEFAULTACCESSOR(Musical_script_req) - DEFAULTACCESSOR(Text_req) - DEFAULTACCESSOR(Rest_req ) - DEFAULTACCESSOR(Skip_req) - DEFAULTACCESSOR(Dynamic_req) - DEFAULTACCESSOR(Absolute_dynamic_req ) - DEFAULTACCESSOR(Tie_req) - DEFAULTACCESSOR(Musical_span_req) - DEFAULTACCESSOR(Plet_req) - DEFAULTACCESSOR(Span_dynamic_req ) - DEFAULTACCESSOR(Abbreviation_req) - DEFAULTACCESSOR(Multi_measure_rest_req) + REQUESTMETHODS(Musical_req); }; @@ -131,7 +112,6 @@ public: bool forceacc_b_; Note_req(); bool do_equal_b (Request*) const; - Rhythmic_req* access_Rhythmic_req () { return Rhythmic_req::access_Rhythmic_req (); } REQUESTMETHODS(Note_req); }; diff --git a/lily/include/performer.hh b/lily/include/performer.hh index 61fd1d2aba..75fbeccf7e 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -27,7 +27,6 @@ public: protected: virtual int get_tempo_i() const; virtual void play (Audio_element * elem_p ); - Performer * access_Performer () { return this; } }; diff --git a/lily/include/protected-scm.hh b/lily/include/protected-scm.hh new file mode 100644 index 0000000000..e83593a537 --- /dev/null +++ b/lily/include/protected-scm.hh @@ -0,0 +1,30 @@ +/* + protected-scm.hh -- declare Protected_scm + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef PROTECTED_SCM_HH +#define PROTECTED_SCM_HH + +#include "lily-guile.hh" + +/* + Mix GUILE GC with C++ ctors and dtors. + */ +class Protected_scm +{ + SCM object_; +public: + Protected_scm (); + Protected_scm (SCM); + Protected_scm (Protected_scm const &); + ~Protected_scm (); + Protected_scm &operator = (Protected_scm const &); + operator SCM (); +}; + +#endif /* PROTECTED_SCM_HH */ diff --git a/lily/include/request.hh b/lily/include/request.hh index 7d976a648e..4394fce306 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -17,8 +17,6 @@ #include "music.hh" #include "direction.hh" -#define DEFAULTACCESSOR(T) virtual T *access_ ## T () { return 0; } - /** An atom of musical information. This is an abstract class for any piece of music that does not contain other Music. @@ -35,17 +33,6 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Request,Music); - /* accessors for children - maybe checkout RTTI - */ - - DEFAULTACCESSOR(Barcheck_req) - DEFAULTACCESSOR(Script_req) - DEFAULTACCESSOR(Span_req) - DEFAULTACCESSOR(Spacing_req) - DEFAULTACCESSOR(Musical_req) - DEFAULTACCESSOR(Command_req) - bool equal_b (Request*) const; protected: virtual bool do_equal_b (Request*) const; @@ -54,7 +41,6 @@ protected: #define REQUESTMETHODS(T) \ -virtual T * access_ ## T() { return this;}\ DECLARE_MY_RUNTIME_TYPEINFO;\ VIRTUAL_COPY_CONS(T, Request);\ virtual void do_print() const diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index e9ea8aff99..4ad95c7371 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -52,16 +52,6 @@ public: */ void add_dependency (Score_element*); - /* - virtual accessors - */ - - virtual Spanner* access_Spanner () { return 0; } - virtual Span_bar* access_Span_bar () { return 0; } - virtual Axis_group_element * access_Axis_group_element () { return 0; } - virtual Score_element* access_Score_element () { return this; } - - virtual Item * access_Item () { return 0; } virtual Line_of_score * line_l () const; virtual bool linked_b () const; SCORE_ELEMENT_CLONE (Score_element); diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 1aec571514..825d1d8cbe 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -20,7 +20,6 @@ public: Span_bar(); DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEMENT_CLONE(Span_bar); - virtual Span_bar* access_Span_bar (); void add_bar (Bar*); void set_align (Align_element *); diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 1cad1d8ebb..255b21eaa8 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -38,7 +38,6 @@ public: void set_bounds (Direction d, Item*); DECLARE_MY_RUNTIME_TYPEINFO; - virtual Spanner* access_Spanner (); Spanner (); Spanner (Spanner const &); bool broken_b () const; diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index defcd15bc3..33390810ce 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -45,12 +45,11 @@ class Spring_spacer : public Line_spacer { friend class Durations_iter; - - + Pointer_list ideal_p_list_; Array cols_; Array loose_col_arr_; - Array rods_; + /// mark column #i# as being loose. void loosen_column (int i); diff --git a/lily/include/timing-engraver.hh b/lily/include/timing-engraver.hh index 18aa404ab5..cc52fa13c0 100644 --- a/lily/include/timing-engraver.hh +++ b/lily/include/timing-engraver.hh @@ -19,7 +19,6 @@ class Timing_engraver : public Timing_translator, public Engraver { protected: virtual void fill_staff_info (Staff_info&); - virtual Engraver * access_Engraver () { return Engraver::access_Engraver (); } public: TRANSLATOR_CLONE(Timing_engraver); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 1b1f05f004..fb1c8e2d23 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -33,8 +33,6 @@ public: String id_str_; - - int iterator_count_; TRANSLATOR_CLONE(Translator_group); @@ -72,7 +70,6 @@ public: Translator_group*get_default_interpreter(); protected: virtual ~Translator_group (); - virtual Translator_group * access_Translator_group () { return this; } virtual void do_print () const; virtual void do_process_requests (); virtual void do_add_processing (); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 57d45e4d98..b0257a4448 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -66,9 +66,6 @@ public: Music_output_def *output_def_l () const; virtual Moment now_moment () const; - virtual Engraver *access_Engraver () { return 0; } - virtual Performer *access_Performer() { return 0; } - virtual Translator_group * access_Translator_group () { return 0; } protected: enum { diff --git a/lily/include/type-swallow-trans.hh b/lily/include/type-swallow-trans.hh index 53eb7ea04a..27bac3d661 100644 --- a/lily/include/type-swallow-trans.hh +++ b/lily/include/type-swallow-trans.hh @@ -11,11 +11,12 @@ #define TYPESWALLOW_GRAV_HH #include "translator.hh" + /// eat a certain type of request class Type_swallow_translator : public virtual Translator { protected: - const char * type_; + const type_info * type_; bool do_try_request (Request*); public: DECLARE_MY_RUNTIME_TYPEINFO; @@ -26,7 +27,7 @@ public: #define DECLARE_REQUEST_SWALLOWER(TYPE) \ struct TYPE ## _swallow_translator : public Type_swallow_translator {\ TYPE ## _swallow_translator() { \ - type_ = TYPE::static_name ();\ + type_ = &typeid (TYPE);\ }\ DECLARE_MY_RUNTIME_TYPEINFO;\ TRANSLATOR_CLONE(TYPE ## _swallow_translator);\ diff --git a/lily/item.cc b/lily/item.cc index e48d576cfd..ad00cb3685 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -129,10 +129,10 @@ Item::handle_prebroken_dependencies() int Item::left_right_compare(Item const *l, Item const *r) { - while (!l->is_type_b (Paper_column::static_name ())) - l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); - while (!r->is_type_b (Paper_column::static_name ())) - r = dynamic_cast (r->axis_group_l_a_[X_AXIS]); + while (!(dynamic_cast (l))) + l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); + while (!(dynamic_cast (r))) + r = dynamic_cast (r->axis_group_l_a_[X_AXIS]); Paper_column *p1 = (Paper_column*)l; Paper_column* p2 = (Paper_column*)r; @@ -190,8 +190,3 @@ Item::Item (Item const &s) break_priority_i_ = s.break_priority_i_; } -Item * -Item::access_Item () -{ - return this; -} diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index bb66802d86..77a29425f5 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -36,29 +36,27 @@ Key_engraver::create_key () bool Key_engraver::do_try_request (Request * req_l) { - Command_req* creq_l= dynamic_cast (req_l); - if (!creq_l|| !dynamic_cast (creq_l)) - return false; - - if (keyreq_l_) - return false; // TODO - keyreq_l_ = dynamic_cast (creq_l); - read_req (keyreq_l_); - return true; + if (Key_change_req *kc = dynamic_cast (req_l)) + { + if (keyreq_l_) + warning ("Fixme: key change merge."); + keyreq_l_ = kc; + read_req (keyreq_l_); + return true; + } + return false; } void Key_engraver::acknowledge_element (Score_element_info info) { - Command_req * r_l = dynamic_cast (info.req_l_) ; - - if (r_l && dynamic_cast (r_l)) + if (dynamic_cast (info.req_l_)) { int i= get_property ("createKeyOnClefChange").length_i (); if (i) create_key (); } - else if (info.elem_l_->is_type_b (Bar::static_name ()) + else if (dynamic_cast (info.elem_l_) && accidental_idx_arr_.size ()) { if (!keyreq_l_) diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 3ccac03e21..b163e4022f 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -29,7 +29,7 @@ Key_performer::do_print() const { #ifndef NPRINT if (key_req_l_) - key_req_l_->print(); + key_req_l_->print(); #endif } @@ -37,19 +37,19 @@ void Key_performer::do_process_requests() { if (key_req_l_) - play (new Audio_key (key_req_l_)); + play (new Audio_key (key_req_l_)); key_req_l_ = 0; } bool Key_performer::do_try_request (Request* req_l) { - if (key_req_l_) - return false; - - if (dynamic_cast (req_l)) + if (Key_change_req *kc = dynamic_cast (req_l)) { - key_req_l_ = dynamic_cast (req_l); + if (key_req_l_) + warning ("FIXME. Key change merge"); + + key_req_l_ = kc; return true; } diff --git a/lily/lexer.ll b/lily/lexer.ll index 43fffba484..b61c4c1975 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -89,7 +89,6 @@ HORIZONTALWHITE [ \t] BLACK [^ \n\t\f\r] RESTNAME [rs] NOTECOMMAND \\{A}+ -ANDREWLYRICS ([^ \n\t\f\\{}<>0-9";.|]|\\[^a-zA-Z\]\[<>])[^0-9 \t\n\f] LYRICS ({AA}|{TEX})[^0-9 \t\n\f]* ESCAPED [nt\\'"] PLET \\\[ @@ -159,10 +158,10 @@ TELP \\\] Identifier * id = lookup_identifier (s); if (id) { - String* s_p = id->access_String (); - DOUT << "#include `" << *s_p << "\'\n"; - new_input (*s_p, source_global_l); - delete s_p; + String* s_l = id->access_content_String (false); + DOUT << "#include `" << *s_l << "\'\n"; + new_input (*s_l, source_global_l); + yy_pop_state (); } else diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index daa7588554..375ff46359 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -97,3 +97,4 @@ lambda_scm (String str, Array args_arr) return scm; } + diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 54df397c45..9b0658b647 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -40,7 +40,7 @@ Local_key_engraver::do_creation_processing () } else { - key_C_ = &((Key_engraver*)dynamic_cast (result))->key_; + key_C_ = &(dynamic_cast (result))->key_; local_key_ = *key_C_; } } @@ -96,23 +96,20 @@ Local_key_engraver::do_pre_move_processing() void Local_key_engraver::acknowledge_element (Score_element_info info) { - Score_element * elem_l = info.elem_l_; - Item * item_l = dynamic_cast (elem_l); - Note_req * note_l = dynamic_cast (info.req_l_); - - if (note_l && item_l && item_l->is_type_b (Note_head::static_name ())) + Note_head * note_head = dynamic_cast (info.elem_l_); + + if (note_l && note_head) { mel_l_arr_.push (note_l); - support_l_arr_.push (item_l); + support_l_arr_.push (note_head); } else if (dynamic_cast (info.req_l_)) { local_key_ = *key_C_; } - else if (elem_l->is_type_b (Tie::static_name ())) + else if (Tie * tie_l = dynamic_cast (info.elem_l_)) { - Tie * tie_l = (Tie*)dynamic_cast (elem_l); if (tie_l->same_pitch_b_) tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]); } diff --git a/lily/lookup.cc b/lily/lookup.cc index a8a4af3dd5..c763bb56e1 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -86,7 +86,7 @@ Lookup::afm_find (String s) const a.dim_[Y_AXIS] *= 1 / 1000.0; Array arr; arr.push (m.code ()); - a.lambda_ = lambda_scm ("char", arr); + a.lambda_ = (lambda_scm ("char", arr)); a.font_ = font_; return a; } @@ -106,7 +106,7 @@ Lookup::bar (String str, Real h) const Array arr; arr.push (h); Atom a = (*symtables_p_) ("bars")->lookup (str); - a.lambda_ = lambda_scm (a.str_, arr); + a.lambda_ = (lambda_scm (a.str_, arr)); a.dim_.y () = Interval (-h/2, h/2); a.font_ = font_; return a; @@ -125,7 +125,7 @@ Lookup::beam (Real slope, Real width, Real thick) const arr.push (thick); Atom a; - a.lambda_ = lambda_scm ("beam", arr); + a.lambda_ = (lambda_scm ("beam", arr)); a.dim_[X_AXIS] = Interval (0, width); a.dim_[Y_AXIS] = Interval (min_y, max_y); return a; @@ -151,7 +151,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const a.dim_[Y_AXIS] = Interval (0 ? dy); // (lambda (o) (dashed-slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))) - a.lambda_ = + a.lambda_ = ( ly_append (ly_lambda_o (), ly_list1 (ly_append (ly_func_o ("dashed-slur"), gh_cons (gh_double2scm (thick), gh_cons (gh_double2scm (dash), @@ -160,7 +160,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL))))))))))); + SCM_EOL)))))))))))); return a; } @@ -216,7 +216,7 @@ Lookup::rule_symbol (Real height, Real width) const Array args; args.push (height); args.push (width); - bs.lambda_ = lambda_scm (bs.str_, args); + bs.lambda_ = (lambda_scm (bs.str_, args)); bs.dim_.x () = Interval (0, width); bs.dim_.y () = Interval (0, height); return bs; @@ -274,7 +274,7 @@ Lookup::stem (Real y1, Real y2) const a.push (y2); a.push (-y1); - s.lambda_ = lambda_scm ("stem", a); + s.lambda_ = (lambda_scm ("stem", a)); s.font_ = font_; return s; } @@ -295,7 +295,7 @@ Lookup::text (String style, String text) const a.push (text); Atom s = (*symtables_p_) ("style")->lookup (style); - s.lambda_ = lambda_scm (s.str_, a); + s.lambda_ = (lambda_scm (s.str_, a)); s.font_ = font_; return s; @@ -305,7 +305,7 @@ Atom Lookup::time_signature (Array a) const { Atom s ((*symtables_p_) ("param")->lookup ("time_signature")); - s.lambda_ = lambda_scm (s.str_, a); + s.lambda_ = (lambda_scm (s.str_, a)); return s; } @@ -340,7 +340,7 @@ Lookup::vbrace (Real &y) const Array a; a.push (idx); - brace.lambda_ = lambda_scm (brace.str_, a); + brace.lambda_ = (lambda_scm (brace.str_, a)); brace.dim_[Y_AXIS] = Interval (-y/2,y/2); brace.font_ = font_; @@ -395,7 +395,7 @@ Lookup::slur (Array controls) const Atom a; // (lambda (o) (slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2) .. ))) - a.lambda_ = + a.lambda_ = ( ly_append (ly_lambda_o (), ly_list1 (ly_append (ly_func_o ("slur"), ly_list1 (ly_list2 (ly_quote (), @@ -407,7 +407,7 @@ Lookup::slur (Array controls) const gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL))))))))))))); + SCM_EOL)))))))))))))); a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); @@ -428,7 +428,7 @@ Lookup::vbracket (Real &y) const } Array arr; arr.push (y); - a.lambda_ = lambda_scm ("bracket", arr); + a.lambda_ = (lambda_scm ("bracket", arr)); a.dim_[Y_AXIS] = Interval (-y/2,y/2); a.dim_[X_AXIS] = Interval (0,4 PT); return a; diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index da7102b1f7..9555cad7eb 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -23,12 +23,12 @@ Lyric_engraver::Lyric_engraver() bool Lyric_engraver::do_try_request (Request*r) { - Musical_req * m =dynamic_cast (r); - if (!m || ! dynamic_cast (m)) - return false; - lreq_l_ = dynamic_cast (m); - - return true; + if (Lyric_req * lr = dynamic_cast (r)) + { + lreq_l_ = lr; + return true; + } + return false; } void diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc index 43fe0f2634..e8c8892339 100644 --- a/lily/lyric-performer.cc +++ b/lily/lyric-performer.cc @@ -16,20 +16,12 @@ IMPLEMENT_IS_TYPE_B1(Lyric_performer,Performer); ADD_THIS_TRANSLATOR(Lyric_performer); -Lyric_performer::Lyric_performer() -{ -} - -Lyric_performer::~Lyric_performer() -{ -} - void Lyric_performer::do_print() const { #ifndef NPRINT if (lreq_arr_.size()) - lreq_arr_[ 0 ]->print(); + lreq_arr_[0]->print(); #endif } @@ -37,18 +29,18 @@ void Lyric_performer::do_process_requests() { if (lreq_arr_.size() && lreq_arr_[0]->text_str_.length_i()) - play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->text_str_)); + play (new Audio_text (Audio_text::LYRIC, lreq_arr_[0]->text_str_)); lreq_arr_.clear(); } bool Lyric_performer::do_try_request (Request* req_l) { - Musical_req* m_l = dynamic_cast (req_l); - if (!m_l || ! dynamic_cast (m_l)) - return false; - lreq_arr_.push (dynamic_cast (m_l)); - - return true; + if (Lyric_req *lr = dynamic_cast (req_l)) + { + lreq_arr_.push (lr); + return true; + } + return false; } diff --git a/lily/main.cc b/lily/main.cc index d9a7a0afc0..9adf5a5941 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -224,15 +224,18 @@ setup_paths () if (!prefix_directory.empty_b()) { - global_path.add (prefix_directory + "/share/lilypond/init/"); - global_path.add (prefix_directory + "/share/lilypond"); + global_path.add (prefix_directory + "/share/lilypond/ly/"); + global_path.add (prefix_directory + "/share/lilypond/afm/"); + } + else + { + global_path.add (String (DIR_DATADIR) + "/ly/"); + global_path.add (String (DIR_DATADIR) + "/afm/"); } - - global_path.add (String (DIR_DATADIR) + "/ly/"); - global_path.add (String (DIR_DATADIR) + "/afm/"); } + void main_prog (int argc, char **argv) { @@ -341,6 +344,7 @@ main_prog (int argc, char **argv) default_outname_base_global = outname_str; do_one_file (i, default_outname_base_global); } + exit( exit_status_i_); } int @@ -355,12 +359,12 @@ main (int argc, char **argv) #endif } -/* - urg: make input file name: +/** + make input file name from command arg. - input: file name + @input file name - output: file name with added default extension. "" is stdin. + @output file name with added default extension. "" is stdin. in reference argument: the extension. ".ly" if none */ String @@ -375,6 +379,7 @@ distill_inname_str (String name_str, String& ext_r) split_path (str,a,b,c,ext_r); // add extension if not present. + // UGH. Should parametrise in list of default extensions. if (ext_r.empty_b ()) { ext_r = ".fly"; diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 71119e4eb6..3c25f1aeae 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -26,13 +26,12 @@ Mark_engraver::Mark_engraver () bool Mark_engraver::do_try_request (Request* r_l) { - Command_req* c_l = dynamic_cast (r_l); - if (!c_l || !dynamic_cast (c_l) || mark_req_l_) - return false; - - mark_req_l_ = dynamic_cast (c_l); - - return true; + if (Mark_req *mr = dynamic_cast (r_l)) + { + mark_req_l_ = mr; + return true; + } + return false; } void diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 362508ee64..7ae9551f7d 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -399,6 +399,7 @@ Midi_note::Midi_note (Audio_item* audio_item_l) : Midi_item (audio_item_l) { dynamic_byte_ = 0x7f; + assert (dynamic_cast (audio_item_l)); } Moment diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index 81489c2ad0..90477a3009 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -48,10 +48,10 @@ Midi_walker::do_start_note (Midi_note* note_p) Moment stop_mom = note_p->duration() + ptr ()->audio_column_l_->at_mom (); for (int i=0; i < stop_note_queue.size(); i++) { - if (stop_note_queue[ i ].val->pitch_i() == note_p->pitch_i ()) + if (stop_note_queue[i].val->pitch_i() == note_p->pitch_i ()) { - if (stop_note_queue[ i ].key < stop_mom) - stop_note_queue[ i ].ignore_b_ = true; + if (stop_note_queue[i].key < stop_mom) + stop_note_queue[i].ignore_b_ = true; else { // skip the stopnote delete note_p; @@ -111,9 +111,9 @@ Midi_walker::process() return; p->channel_i_ = track_l_->number_i_; - if (p->name() != Midi_note::static_name ()) - output_event (ptr()->audio_column_l_->at_mom (), p); + if (Midi_item *mi = dynamic_cast(p)) + do_start_note (mi); else - do_start_note ((Midi_note*)p); + output_event (ptr()->audio_column_l_->at_mom (), p); } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 03578a5815..d72da1d4f0 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -26,20 +26,20 @@ Multi_measure_rest_engraver::Multi_measure_rest_engraver () bool Multi_measure_rest_engraver::do_try_request (Request* req_l) { - if (!dynamic_cast (req_l)) - return false; - - if (multi_measure_req_l_) - if (!multi_measure_req_l_->equal_b (req_l) - || req_start_mom_ != now_moment ()) - return false; - - multi_measure_req_l_ = dynamic_cast (req_l); - req_start_mom_ = now_moment (); + if (Multi_measure_rest_req *mr = dynamic_cast (req_l)) + { + if (multi_measure_req_l_) + if (!multi_measure_req_l_->equal_b (req_l) + || req_start_mom_ != now_moment ()) + return false; - rest_req_stop_mom_ = req_start_mom_ + multi_measure_req_l_->duration_.length (); - - return true; + multi_measure_req_l_ = mr; + req_start_mom_ = now_moment (); + + rest_req_stop_mom_ = req_start_mom_ + multi_measure_req_l_->duration_.length (); + return true; + } + return false; } void diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 2b329815d6..5505c145a7 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -136,19 +136,19 @@ Music_iterator* Music_iterator::static_get_iterator_p (Music const *m, Translator_group *report_l) { Music_iterator * p =0; - if (m->is_type_b (Request_chord::static_name())) + if (dynamic_cast (m)) p = new Request_chord_iterator; - else if (m->is_type_b (Simultaneous_music::static_name())) + else if (dynamic_cast (m)) p = new Simultaneous_music_iterator; - else if (m->is_type_b (Sequential_music::static_name())) + else if (dynamic_cast (m)) p = new Sequential_music_iterator; - else if (m->is_type_b (Translation_property::static_name ())) + else if (dynamic_cast (m)) p = new Property_iterator; - else if (m->is_type_b (Change_translator::static_name ())) + else if (dynamic_cast (m)) p = new Change_iterator; - else if (m->is_type_b (Compressed_music::static_name ())) + else if (dynamic_cast (m)) p = new Compressed_music_iterator; - else if (m->is_type_b (Music_wrapper::static_name ())) + else if (dynamic_cast (m)) p = new Music_wrapper_iterator; p->music_l_ = m; diff --git a/lily/music-list.cc b/lily/music-list.cc index 7c47ded027..b712f3e255 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -109,7 +109,6 @@ IMPLEMENT_IS_TYPE_B1(Request_chord, Simultaneous_music); Request_chord::Request_chord() : Simultaneous_music (new Music_list) { - multi_level_i_ =0; } @@ -118,10 +117,9 @@ Request_chord::to_relative_octave (Musical_pitch last) { for (iter (music_p_list_p_->top(),i); i.ok (); i++) { - Musical_req *m = dynamic_cast (i.ptr ()); - if (m && dynamic_cast (m)) + if (Melodic_req *m= dynamic_cast (i.ptr ())) { - Musical_pitch &pit = dynamic_cast (m)->pitch_; + Musical_pitch &pit = m->pitch_; pit.to_relative_octave (last); return pit; } diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 8e28cdf4bb..cdd7af56a8 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -40,7 +40,7 @@ Music_output_def::Music_output_def (Music_output_def const &s) for (Dictionary_iter i (*translator_p_dict_p_); i.ok (); i++) { - Translator * t = i.val ()->access_Translator (false); + Translator * t = i.val ()->access_content_Translator (false); t-> output_def_l_ = this; } } @@ -60,7 +60,7 @@ Translator* Music_output_def::find_translator_l (String name) const { if (translator_p_dict_p_->elem_b (name)) - return (*translator_p_dict_p_)[name]->access_Translator (); + return (*translator_p_dict_p_)[name]->access_content_Translator (false); if (global_translator_dict_p->elem_b (name)) return (*global_translator_dict_p)[name]; @@ -76,7 +76,7 @@ Music_output_def::get_global_translator_p () if (!t) error (_("Can't find Score context")); t = t->clone (); - Global_translator *g = dynamic_cast (t)->global_l (); + Global_translator *g = dynamic_cast (t); t->add_processing (); return g; @@ -98,6 +98,6 @@ Music_output_def::get_default_output () const return ""; Identifier * id = (*scope_p_) ["output"]; - String *p = dynamic_cast (id); + String *p = id->access_content_String (false); return p ? *p : String (""); } diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index fd00a120e8..8d8299a510 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -13,7 +13,6 @@ Music_sequence::Music_sequence (Music_sequence const&s) : Music (s) { - multi_level_i_ = s.multi_level_i_; music_p_list_p_ = new Music_list (*s.music_p_list_p_); } @@ -21,7 +20,6 @@ IMPLEMENT_IS_TYPE_B1(Music_sequence, Music); Music_sequence::Music_sequence(Music_list *mlist_p) { - multi_level_i_ = 0; music_p_list_p_ = mlist_p; } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 6c72cb538a..c12cd16c29 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -105,7 +105,7 @@ bool Melodic_req::do_equal_b (Request*r) const { Melodic_req* m= dynamic_cast (r); - return !compare (*m, *this); + return m&& !compare (*m, *this); } int @@ -131,7 +131,7 @@ Rhythmic_req::do_equal_b (Request*r) const { Rhythmic_req* rh = dynamic_cast (r); - return !compare (*this, *rh); + return rh&& !compare (*this, *rh); } @@ -178,7 +178,8 @@ Lyric_req::do_print () const bool Note_req::do_equal_b (Request*r) const { - return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r); + Note_req *n = dynamic_cast (r); + return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n); } @@ -270,7 +271,7 @@ bool Span_req:: do_equal_b (Request*r) const { Span_req * s = dynamic_cast (r); - return spantype == s->spantype; + return s&& spantype == s->spantype; } Span_req::Span_req () @@ -294,7 +295,7 @@ Script_req::do_equal_b (Request*r) const { Script_req * s = dynamic_cast (r); - return scriptdef_p_->equal_b (*s->scriptdef_p_); + return s&& scriptdef_p_->equal_b (*s->scriptdef_p_); } Script_req::Script_req () @@ -401,7 +402,7 @@ bool Absolute_dynamic_req::do_equal_b (Request *r) const { Absolute_dynamic_req *a = dynamic_cast (r); - return loudness_ == a->loudness_; + return a&& loudness_ == a->loudness_; } String @@ -451,7 +452,7 @@ Span_dynamic_req::do_equal_b (Request *req) const { Span_dynamic_req * s = dynamic_cast (req); - return Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_; + return s&& Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_; } Span_dynamic_req::Span_dynamic_req () diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 4c7d05a9a2..df3634bce5 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -109,7 +109,7 @@ My_lily_lexer::start_main_input () } void -My_lily_lexer::set_identifier (String name_str, Identifier* i, bool unique_b) +My_lily_lexer::set_identifier (String name_str, Identifier* i, bool ) { Identifier *old =0; if (scope_l_arr_.top ()->elem_b (name_str)) @@ -140,7 +140,7 @@ My_lily_lexer::~My_lily_lexer() } void -My_lily_lexer::print_declarations (bool init_b) const +My_lily_lexer::print_declarations (bool ) const { for (int i=scope_l_arr_.size (); i--; ) { diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index f3cdf87aba..a024f0dd68 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -177,6 +177,10 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) return v; } + +/* + UGH. + */ Array* My_lily_parser::get_parens_request (int t) { @@ -314,13 +318,13 @@ Paper_def* My_lily_parser::default_paper_p () { Identifier *id = lexer_p_->lookup_identifier ("$defaultpaper"); - return id ? id->access_Paper_def () : new Paper_def ; + return id ? id->access_content_Paper_def (true) : new Paper_def ; } Midi_def* My_lily_parser::default_midi_p () { Identifier *id = lexer_p_->lookup_identifier ("$defaultmidi"); - return id ? id->access_Midi_def () : new Midi_def ; + return id ? id->access_content_Midi_def (true) : new Midi_def ; } diff --git a/lily/note-column.cc b/lily/note-column.cc index b00cb5ea0a..ef0c81e380 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -102,30 +102,30 @@ Note_column::do_substitute_dependency (Score_element*o, Score_element*n) { if (stem_l_ == o) { - stem_l_ = n ? (Stem*)dynamic_cast (n):0; + stem_l_ = n ? dynamic_cast (n):0; } - if (o->is_type_b (Note_head::static_name ())) + if (dynamic_cast (o)) { - head_l_arr_.substitute ((Note_head*)dynamic_cast (o), - (n)? (Note_head*)dynamic_cast (n) : 0); + head_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } Script_column::do_substitute_dependency (o,n); - if (o->is_type_b (Rest::static_name ())) + if (dynamic_cast (o)) { - rest_l_arr_.substitute ((Rest*)dynamic_cast (o), - (n)? (Rest*)dynamic_cast (n) : 0); + rest_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } } void Note_column::add_head (Rhythmic_head *h) { - if (h->is_type_b (Rest::static_name ())) + if (dynamic_cast (h)) { rest_l_arr_.push ((Rest*)h); add_support (h); } - if (h->is_type_b (Note_head::static_name ())) + if (dynamic_cast (h)) { head_l_arr_.push ((Note_head*) h); add_support (h); diff --git a/lily/note-performer.cc b/lily/note-performer.cc index 5f8923c284..d63b433a4f 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -24,27 +24,26 @@ Note_performer::do_print () const { #ifndef NPRINT if (note_req_l_) - note_req_l_->print (); + note_req_l_->print (); #endif } void Note_performer::do_process_requests () { - // this is _really_ braindead, but it generates some output - if (!note_req_l_ || !dynamic_cast (note_req_l_) || !dynamic_cast (note_req_l_)) - return; - - int transposing_i = 0; - //urg - Scalar prop = get_property ("transposing"); - if (!prop.empty_b () && prop.isnum_b ()) - transposing_i = prop; + if (note_req_l_) + { + int transposing_i = 0; + //urg + Scalar prop = get_property ("transposing"); + if (!prop.empty_b () && prop.isnum_b ()) + transposing_i = prop; - play (new Audio_note (note_req_l_, transposing_i)); + play (new Audio_note (note_req_l_, transposing_i)); - note_req_l_ = 0; + note_req_l_ = 0; + } } bool diff --git a/lily/p-score.cc b/lily/p-score.cc index be107cd929..6b68f7f0fd 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -25,9 +25,11 @@ #include "file-results.hh" #include "misc.hh" +#if 0 // has w32 advanced? // sucking Cygnus egcs - w32 #include "list.tcc" #include "cursor.tcc" +#endif Paper_score::Paper_score () { @@ -319,10 +321,11 @@ Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const Item const*l=l_item_l; Item const*r=r_item_l; - while (! l->is_type_b(Paper_column::static_name ())) + // huh? see Item::left_right_compare () + while (! (dynamic_cast (l))) l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); - while (! r->is_type_b(Paper_column::static_name ())) + while (! (dynamic_cast (r))) r = dynamic_cast(r->axis_group_l_a_[X_AXIS]); PCursor start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ()); diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 5ce8b04cd9..85abdd931b 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -57,7 +57,7 @@ Paper_def::get_var (String s) const { if (!scope_p_->elem_b (s)) error (_f ("unknown paper variable: `%s\'", s)); - Real * p = scope_p_->elem (s)->access_Real (false); + Real * p = scope_p_->elem (s)->access_content_Real (false); if (!p) { error (_ ("not a real variable")); @@ -247,10 +247,10 @@ output_header (Paper_outputter* p, Scope *head) for (Dictionary_iter i (*head); i.ok (); i++) { - if (!i.val ()->access_String_identifier ()) + if (!i.val ()->access_content_String (false)) continue; - String val = *i.val()->access_String_identifier ()->data_p_; + String val = *i.val()->access_content_String (false); output_def (p, i.key (), val); } } @@ -260,7 +260,7 @@ Paper_def::output_settings (Paper_outputter* p) const { for (Dictionary_iter i (*scope_p_); i.ok (); i++) output_def (p, String ("mudelapaper") + i.key (), i.val ()->str ()); - p->output_string (*scope_p_->elem (String (output_global_ch) + "setting")->access_String ()); + p->output_string (*scope_p_->elem (String (output_global_ch) + "setting")->access_content_String (false)); } Paper_outputter* diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index ade5ef13fc..033fbf3f06 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -85,8 +85,7 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) if (!i->lambda_) { // urg - i->lambda_ = - ly_append (ly_lambda_o (), + i->lambda_ = ly_append (ly_lambda_o (), ly_list1 (ly_func_o ("empty"))); } diff --git a/lily/parser.yy b/lily/parser.yy index ccca7e4942..bc0680a301 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -358,7 +358,7 @@ notenames_body: $$ = new Notename_table; } | NOTENAME_TABLE_IDENTIFIER { - $$ = $1-> access_Notename_table(true); + $$ = $1-> access_content_Notename_table(true); } | notenames_body STRING '=' explicit_musical_pitch { (*$$)[*$2] = *$4; @@ -461,12 +461,12 @@ translator_spec: translator_spec_body: TRANS_IDENTIFIER { - $$ = $1->access_Translator (true); + $$ = $1->access_content_Translator (true); $$-> set_spot (THIS->here_input ()); } | TYPE STRING ';' { Translator* t = get_translator_l (*$2); - Translator_group * tg = t->access_Translator_group (); + Translator_group * tg = dynamic_cast (t); if (!tg) THIS->parser_error (_("Need a translator group for a context")); @@ -478,14 +478,14 @@ translator_spec_body: } | translator_spec_body STRING '=' simple_identifier_init ';' { Identifier* id = $4; - String_identifier *s = id->access_String_identifier (); - Real_identifier *r= id->access_Real_identifier (); - int_identifier *i = id->access_int_identifier (); + String_identifier *s = dynamic_cast (id); + Real_identifier *r= dynamic_cast(id); + int_identifier *i = dynamic_cast (id); String str; - if (s) str = *s->access_String (false); - if (i) str = to_str (*i->access_int (false)); - if (r) str = to_str (*r->access_Real (false)); + if (s) str = *s->access_content_String (false); + if (i) str = to_str (*i->access_content_int (false)); + if (r) str = to_str (*r->access_content_Real (false)); if (!s && !i && !r) THIS->parser_error (_("Wrong type for property value")); @@ -497,15 +497,15 @@ translator_spec_body: delete $3; } | translator_spec_body CONSISTS STRING ';' { - $$->access_Translator_group ()-> set_element (*$3, true); + dynamic_cast ($$)-> set_element (*$3, true); delete $3; } | translator_spec_body ACCEPTS STRING ';' { - $$->access_Translator_group ()-> set_acceptor (*$3, true); + dynamic_cast ($$)-> set_acceptor (*$3, true); delete $3; } | translator_spec_body REMOVE STRING ';' { - $$->access_Translator_group ()-> set_element (*$3, false); + dynamic_cast ($$)-> set_element (*$3, false); delete $3; } ; @@ -533,7 +533,7 @@ score_body: { $$ = new Score; } | SCORE_IDENTIFIER { - $$ = $1->access_Score (true); + $$ = $1->access_content_Score (true); } | score_body mudela_header { $$->header_p_ = $2; @@ -593,7 +593,7 @@ paper_def_body: $$ = p; } | PAPER_IDENTIFIER optional_semicolon { - Paper_def *p = $1->access_Paper_def (true); + Paper_def *p = $1->access_content_Paper_def (true); THIS->lexer_p_->scope_l_arr_.push (p->scope_p_); $$ = p; } @@ -643,7 +643,7 @@ real_expression: } | dimension | REAL_IDENTIFIER { - $$= *$1->access_Real (false); + $$= *$1->access_content_Real (false); } | '-' real_expression %prec UNARY_MINUS { $$ = -$2; @@ -687,7 +687,7 @@ midi_body: /* empty */ { $$ = THIS->default_midi_p (); } | MIDI_IDENTIFIER { - $$ = $1-> access_Midi_def (true); + $$ = $1-> access_content_Midi_def (true); } | midi_body translator_spec { $$-> assign_translator ($2); @@ -738,7 +738,7 @@ Simultaneous_music: '<' Music_list '>' { Simple_music: request_chord { $$ = $1; } - | MUSIC_IDENTIFIER { $$ = $1->access_Music (true); } + | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); } | property_def | translator_change ; @@ -851,7 +851,7 @@ abbrev_command_req: $$ = new Barcheck_req; } | COMMAND_IDENTIFIER { - $$ = $1->access_Request (true); + $$ = $1->access_content_Request (true); } /* | '[' { @@ -958,7 +958,7 @@ structured_post_request: post_request: POST_REQUEST_IDENTIFIER { - $$ = (Request*)$1->access_Request (true); + $$ = (Request*)$1->access_content_Request (true); } | dynamic_req { $$ = $1; @@ -1226,10 +1226,10 @@ script_abbreviation: ; mudela_script: - SCRIPT_IDENTIFIER { $$ = $1->access_General_script_def (true); } + SCRIPT_IDENTIFIER { $$ = $1->access_content_General_script_def (true); } | script_definition { $$ = $1; } | script_abbreviation { - $$ = THIS->lexer_p_->lookup_identifier (*$1)->access_General_script_def (true); + $$ = THIS->lexer_p_->lookup_identifier (*$1)->access_content_General_script_def (true); delete $1; } ; @@ -1299,7 +1299,7 @@ steno_duration: } } | DURATION_IDENTIFIER { - $$ = $1->access_Duration (true); + $$ = $1->access_content_Duration (true); } | steno_duration '.' { $$->dots_i_ ++; @@ -1396,7 +1396,7 @@ int: $$ = -$2; } | INT_IDENTIFIER { - $$ = *$1->access_int (false); + $$ = *$1->access_content_int (false); } ; @@ -1406,7 +1406,7 @@ string: $$ = $1; } | STRING_IDENTIFIER { - $$ = $1->access_String (true); + $$ = $1->access_content_String (true); } | string '+' string { *$$ += *$3; @@ -1428,7 +1428,7 @@ symtables_body: $$ = new Symtables; } | IDENTIFIER { - $$ = $1->access_Symtables (true); + $$ = $1->access_content_Symtables (true); } | symtables_body FONT STRING { $$->font_ = *$3; diff --git a/lily/performer.cc b/lily/performer.cc index 7c5e541f82..449caf22bb 100644 --- a/lily/performer.cc +++ b/lily/performer.cc @@ -30,6 +30,6 @@ Performer_group_performer* Performer::daddy_perf_l () const { return (daddy_trans_l_) - ?(Performer_group_performer*) dynamic_cast (daddy_trans_l_) + ?dynamic_cast (daddy_trans_l_) : 0; } diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 4851cee02c..8c3273cd7c 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -13,10 +13,9 @@ void Pitch_squash_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_head::static_name ())) + if (Note_head *nh = dynamic_cast (i.elem_l_)) { - Note_head * nl = (Note_head*)dynamic_cast (i.elem_l_); - nl->position_i_ =0; + nh->position_i_ =0; } } diff --git a/lily/plet-engraver.cc b/lily/plet-engraver.cc index ed85c58bfd..172a491200 100644 --- a/lily/plet-engraver.cc +++ b/lily/plet-engraver.cc @@ -27,7 +27,9 @@ Plet_engraver::Plet_engraver () void Plet_engraver::acknowledge_element (Score_element_info i) { - if (!i.elem_l_->is_type_b (Stem::static_name ())) + + Stem * st = (dynamic_cast (i.elem_l_)); + if (!st) return; if (!plet_spanner_p_) return; @@ -35,10 +37,10 @@ Plet_engraver::acknowledge_element (Score_element_info i) return; if (!plet_spanner_p_->stem_l_drul_[LEFT]) - plet_spanner_p_->set_stem (LEFT, (Stem*)dynamic_cast (i.elem_l_)); + plet_spanner_p_->set_stem (LEFT, st); else if (span_reqs_drul_[RIGHT] && !plet_spanner_p_->stem_l_drul_[RIGHT]) - plet_spanner_p_->set_stem (RIGHT, (Stem*)dynamic_cast (i.elem_l_)); + plet_spanner_p_->set_stem (RIGHT, st); } bool diff --git a/lily/plet-spanner.cc b/lily/plet-spanner.cc index 4a032ffc72..57f6ca30cf 100644 --- a/lily/plet-spanner.cc +++ b/lily/plet-spanner.cc @@ -130,7 +130,7 @@ Plet_spanner::do_post_processing () void Plet_spanner::do_substitute_dependency (Score_element* o, Score_element* n) { - Stem* new_l = n ? (Stem*)dynamic_cast (n) : 0; + Stem* new_l = n ? dynamic_cast (n) : 0; if (dynamic_cast (o) == stem_l_drul_[LEFT]) stem_l_drul_[LEFT] = new_l; else if (dynamic_cast (o) == stem_l_drul_[RIGHT]) diff --git a/lily/plet-swallow-engraver.cc b/lily/plet-swallow-engraver.cc index 47da034354..994a84003b 100644 --- a/lily/plet-swallow-engraver.cc +++ b/lily/plet-swallow-engraver.cc @@ -15,5 +15,5 @@ ADD_THIS_TRANSLATOR(Plet_swallow_engraver); bool Plet_swallow_engraver::do_try_request (Request* req_l) { - return dynamic_cast (req_l); + return dynamic_cast (req_l); } diff --git a/lily/priority-halign-engraver.cc b/lily/priority-halign-engraver.cc index 2aa56cb7cf..6a9d8d15dd 100644 --- a/lily/priority-halign-engraver.cc +++ b/lily/priority-halign-engraver.cc @@ -30,7 +30,7 @@ void Priority_horizontal_align_engraver::acknowledge_element (Score_element_info i) { Engraver* reg = i.origin_grav_l_arr_[0]; - if (reg->is_type_b (Score_priority_engraver::static_name())) + if (dynamic_cast (reg)) { if (!halign_p_) { diff --git a/lily/protected-scm.cc b/lily/protected-scm.cc new file mode 100644 index 0000000000..0304d91f91 --- /dev/null +++ b/lily/protected-scm.cc @@ -0,0 +1,52 @@ +/* + protected-scm.cc -- implement Protected_scm + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ +#include "protected-scm.hh" +extern "C" +{ +#include +}; + + +Protected_scm::Protected_scm () +{ + object_ = 0; +} + +Protected_scm::Protected_scm (SCM s) +{ + object_ = s ? scm_protect_object (s): 0; +} + +Protected_scm::Protected_scm (Protected_scm const &s) +{ + object_ = s.object_ ? scm_protect_object (s.object_) : 0; +} + +Protected_scm & +Protected_scm::operator =(Protected_scm const &s) +{ + if (this == &s) + return *this; + if (object_) + scm_unprotect_object(object_); + + object_ = (s.object_) ? scm_protect_object (s.object_): 0; + return *this; +} + +Protected_scm::~Protected_scm () +{ + if (object_) + scm_unprotect_object (object_); +} + +Protected_scm::operator SCM () +{ + return object_; +} diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc index 56764298f5..5ed0f31155 100644 --- a/lily/request-iterator.cc +++ b/lily/request-iterator.cc @@ -65,11 +65,14 @@ Request_chord_iterator::do_process_and_next (Moment mom) { for (PCursor i (elt_l ()->music_p_list_p_->top ()); i.ok(); i++) { - assert (i->is_type_b (Request::static_name())); - Request * req_l = (Request*)i.ptr(); - bool gotcha = report_to_l()->try_request (req_l); - if (!gotcha) - req_l->warning (_f ("junking request: `%s\'", req_l->name())); + if (Request * req_l = dynamic_cast (i.ptr())) + { + bool gotcha = report_to_l()->try_request (req_l); + if (!gotcha) + req_l->warning (_f ("junking request: `%s\'", req_l->name())); + } + else + i.ptr ()->warning (_f ("Huh? Not a Request: `%s\'", i.ptr()->name ())); } first_b_ = false; } diff --git a/lily/request.cc b/lily/request.cc index 858d5c44d5..aadbe80aef 100644 --- a/lily/request.cc +++ b/lily/request.cc @@ -23,17 +23,12 @@ Request::do_print() const bool Request::equal_b (Request *r) const { - if (is_type_b (r->name())) - return r->do_equal_b ((Request*)this); - if (r->is_type_b (name())) - return do_equal_b (r); - - return false; + return r->do_equal_b (this) || this->do_equal_b (r) ; } bool Request::do_equal_b (Request*) const { - return false; + return true; } diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index 2c52168807..89ac8e6531 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -36,8 +36,8 @@ Rest_collision_engraver::process_acknowledged () void Rest_collision_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name())) - note_column_l_arr_.push ((Note_column*)dynamic_cast (i.elem_l_)); + if (dynamic_cast (i.elem_l_)) + note_column_l_arr_.push (dynamic_cast (i.elem_l_)); } void diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 54cfe814c1..095c6ac469 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -133,14 +133,11 @@ Rest_collision::do_print() const void Rest_collision::do_substitute_dependency (Score_element*o,Score_element*n) { - Item*o_l = dynamic_cast (o); - - - if (o_l&&o_l->is_type_b (Note_column::static_name ())) + if (Note_column *onl = dynamic_cast (o)) { - Note_column *n_l = n?(Note_column*)dynamic_cast (n):0; - rest_l_arr_.substitute ((Note_column*)o_l, n_l); - ncol_l_arr_.substitute ((Note_column*)o_l, n_l); + Note_column *n_l = n?dynamic_cast (n):0; + rest_l_arr_.substitute (onl, n_l); + ncol_l_arr_.substitute (onl, n_l); } } diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index f4f2e6efbe..2170886e55 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -60,14 +60,14 @@ Rest_engraver::do_process_requests () } bool -Rest_engraver::do_try_request (Request *r) +Rest_engraver::do_try_request (Request *req) { - Musical_req *m = dynamic_cast (r); - if (!m || !dynamic_cast (m)) - return false; - - rest_req_l_ = dynamic_cast (m); // ugh - return true; + if (Rest_req *r = dynamic_cast (req)) + { + rest_req_l_ = r; + return true; + } + return false; } IMPLEMENT_IS_TYPE_B1(Rest_engraver, Engraver); diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 8c1cacfdf5..8bccc1eec6 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -70,21 +70,21 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i) Item * item = dynamic_cast (i.elem_l_); if (!item) return; - if (item->is_type_b (Script::static_name ()) + if (dynamic_cast