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!?)
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)
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
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))
# 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)
$(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
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.
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)
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)
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.
)
---- ../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
+ 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:
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 ..
BUGS:
+ * disallow backslashes
+
+ * \breathmark TeX macro
+
+ * catch GUILE errors?
-
* add new glyphs to font.ly
* formatting of input stuff.
* include MIDI list
- * make GNU style webpages.
-
* midi_instrument -> midiInstrument
* horizontal centering of dynamics
- indentation
- notenames?
- fontlock: \melodic \melodic
-
* use properties for:
- plet?
* 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.
* Documentation
- Doc (C) stuff of sheet music
- a better format? SGML? TeX? Info?
- - a tutorial
+ - a better tutorial
* more spanners (smallish)
- Glissando
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.
+++ /dev/null
-# bin/Makefile
-
-depth = ..
-SEXECUTABLES=convert-mudela mudela-book ly2dvi
-STEPMAKE_TEMPLATES=script
-
-
-include $(depth)/make/stepmake.make
-
-include $(stepdir)/executable-targets.make
-
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!@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
+++ /dev/null
-#!/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
+++ /dev/null
-#!@PERL@
-
-open GREP, "egrep -h '^struct|^class' *.hh *.cc|";
-open OUT, "|sort | uniq";
-while (<GREP>) {
-
- s/^struct/class/;
- if (! /; *$/) {
- s/:[^{]+{.*$//;
- s/ *{.*$/;/;
- }
- if (! /; *$/) {
- chop;
- $_ .= ";\n";
-
- }
- print OUT;
-}
-close OUT;
-close GREP;
+++ /dev/null
-#!/bin/sh
-
-TMPDIR=/tmp/gen-sitemap
-for tarball in $*; do
- tar -C $TMPDIR -xfz $tarball '*.html'
-done
+++ /dev/null
-#!@PYTHON@
-
-# genheader.py -- do headers (like these)
-#
-# source file of the GNU LilyPond music typesetter
-#
-# (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
-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)
-
+++ /dev/null
-#!@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 <janneke@gnu.org>
-
-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 ()
-
+++ /dev/null
-#!/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:=":"}
-
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-# 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 ()
-
+++ /dev/null
-# 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 <gord@gnu.ai.mit.edu>, 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:
+++ /dev/null
-#!/bin/sh
-#
-# Script to make a LaTeX file for Lilypond
-#
-# Written by Jan Arne Fagertun <Jan.A.Fagertun@energy.sintef.no>
-# 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 <jvromans@squirrel.nl> 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
-#
+++ /dev/null
-#!@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)
-
-\f
-
-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')
-
-
-\f
-
-class Properties:
- """
- This class handles all ly2dvi.py property manipulation
-
- Public methods:
-
- __init__() Constructor
- set<property> 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]])
-
-\f
-
-#
-# 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'
- )
-
-\f
-
-#
-# 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()
+++ /dev/null
-#!/bin/sh
-# mail-address
-if [ "$MAILADDRESS" != "" ]; then
- echo $MAILADDRESS
-else
- echo "mail-address:6: warning: \$MAILADDRESS undefined" > /dev/stderr
- echo $USER@`hostname`
-fi
+++ /dev/null
-#!@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 <hanwen@cs.uu.nl>
-
-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()
+++ /dev/null
-#!@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 <<EOF
-# \font\fetatwenty=feta20
-# \fetatwenty
-# \nopagenumbers
-# \newcount\c\c64
-# \char\c
-# \loop\ifnum\c<$num\advance\c by1
-# \vfill\eject
-# \char\c
-# \repeat
-# \vfill\eject
-# \end
-# EOF
-
-# for i in $NUMS; do
-# $PKTOPBM out/$font.${RESOLUTION}pk -c $i out/$font-$i.pbm
-# done
-
-# numbered files
-if [ "x$named" = "x" ]; then
- NUMS=`grep "^C *[0-9]*;" $afm | sed "s!^C *\([^;]*\).*!\\1!"`
- PBMS=`grep "^C *[0-9]*;" $afm | sed "s!^C *\([^;]*\).*!out/$font-\\1.pbm!"`
-else
- NUMS=`grep "^C *[0-9]*;" $afm | sed "s!^C [^;]*; *N *\([^;]*\).*!\\1!"`
- PBMS=`grep "^C *[0-9]*;" $afm | sed "s!^C [^;]*; *N *\([^;]*\).*!out/$font-\\1.pbm!"`
-fi
-
-# $PKTOPBM out/$font.${RESOLUTION}pk -x 100 -y 100 $PBMS
-$PKTOPBM out/$font.${RESOLUTION}pk $PBMS
-
-for i in $NUMS; do
- ppmtoxpm out/$font-$i.pbm > out/$font-$i.xpm
-done
-rm -f $PBMS
+++ /dev/null
-#!@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()
+++ /dev/null
-#!@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 ('<html><TITLE>Rendered Examples</TITLE>\n')
- list.write ('<body bgcolor=white>')
- if len(subdirs):
- list.write ('<h2>subdirectories</h2>')
- list.write ('<ul>')
- for ex in subdirs:
- print 'subdir %s ' % ex
- list.write ('<li><a href=%s/index.html>Subdirectory: %s</a></li>\n' % (pre + ex + post , ex))
-
- list.write ('</ul>')
-
- list.write('<h2>Contents of this directory</h2>\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, <a href="http://www.gnu.org/philosophy/gif.html">no gifs due to patent problems</a>, '
- '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('<hr>')
- list.write('<h1>example file: %s</h1>' % head);
- if composer <> '':
- list.write('<h2>%s</h2>\n' % composer)
- if desc <> '':
- list.write('%s<p>' % desc)
- list.write ('<ul>')
- def list_item(filename, desc, type, l = list):
- if file_exist_b(filename):
- l.write ('<li><a href=%s>%s</a>' % (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 (' <a href="http://www.gnu.org/philosophy/gif.html">no gifs due to patent problems</a>')
- 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 ("</ul>");
-
- list.write( "</BODY></HTML>");
- 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')
-
+++ /dev/null
-
-configure --prefix=~ --enable-profiling --enable-config=optprof --enable-optimise --disable-checking
+++ /dev/null
-#!/bin/sh
-# ps-to-gifs, convert PS to multiple gifs or other bitmaps
-
-usage()
-{
- cat <<EOF
-Convert PS to multiple gifs or other bitmaps
-Usage: ps-to-gifs.sh [OPTION]... [FILE]
-Options:
- -h, --help this help
- -c, --crop crop output
- -o, --output=NAME set output base
- -p, --png convert to png
- -s, --size=SIZE set papersize
- -t, --transparent change white to transparent
-EOF
-}
-
-if [ $# -lt 1 ]; then
- usage;
- exit 2;
-fi
-CROP=cat
-GIF=gif
-PNMTOGIF=ppmtogif
-
-while [ $# -gt 0 ]; do
-opt=$1
-shift
- case $opt in
- -t|--t*)
- color='-transparent white'
- ;;
- -h|--h*)
- usage;
- exit 0
- ;;
- -c|--c*)
- CROP=" pnmcrop "
- ;;
- -o) OUTFILE=$2; shift
- ;;
- --o*=*) OUTFILE=`echo $opt | sed -e s/"^.*="//`
- ;;
- -p|--p*)
- GIF=png
- PNMTOGIF=pnmtopng
- ;;
- -s) SIZE="-sPAPERSIZE=$2"; shift
- ;;
- --s*=*)
- SIZE="-sPAPERSIZE=`echo $opt | sed -e s/"^.*="//`"
- ;;
- -*)
- echo "ps-to-gifs: unknown option: \`$opt'"
- exit 1
- ;;
- *)
- FILE=$opt
- ;;
- esac
-done
-
-if [ "x$TRANSPARENT_IS_BROKEN" != "x" ]; then
- color=
-fi
-
-if [ "x$OUTFILE" = "x" ]; then
- BASE=`dirname $FILE`/`basename $FILE .ps`
-else
- BASE=`dirname $OUTFILE`/`basename $OUTFILE .$GIF`
-fi
-
-# urg, pipe breaks
-rm -f $BASE{.ppm,.$GIF} $BASE-page*{.ppm,.$GIF}
-
-# generate the pixmap at twice the size, then rescale (for antialiasing)
-cat $FILE | gs -sDEVICE=ppmraw $SIZE -sOutputFile="$BASE-page%d.ppm" -r180 -dNOPAUSE - -c quit $FILE
-# quant is soo slow
-# cat $PPMFILE | ppmquant 2 | pnmscale 0.3333 | pnmcrop | $PNMTOGIF $color > $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
-
+++ /dev/null
-#!/bin/sh
-# ps-to-pngs, convert PS to multiple pngs
-
-ps-to-gifs --png $*
+++ /dev/null
-#!/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 $*
+++ /dev/null
-#!/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:
-#
-# <SEE PATCHES.txt>
-#
-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 <<EOF
- LILYINCLUDE=$LILYPOND_SOURCEDIR/init:$LILYPOND_SOURCEDIR/mf/out
- MFINPUTS=\$MFINPUTS:\$LILYPOND_SOURCEDIR/mf
- TEXINPUTS=\$TEXINPUTS:\$LILYPOND_SOURCEDIR/mf/out
- export LILYINCLUDE MFINPUTS TEXINPUTS
-EOF
-
-fi
-
-ln -sf $LILYPOND_SOURCEDIR/lily/out/lilypond $prefix/bin/lilypond
-ln -sf $LILYPOND_SOURCEDIR/mi2mu/out/mi2mu $prefix/bin/mi2mu
-ln -sf $LILYPOND_SOURCEDIR/bin/ly2dvi.sh $prefix/bin/ly2dvi
-chmod 755 $LILYPOND_SOURCEDIR/bin/ps-to-gifs.sh
-ln -sf $LILYPOND_SOURCEDIR/bin/ps-to-gifs.sh $prefix/bin/ps-to-gifs
-
-if [ -f ../.gdbinit ];
-then
- ln ../.gdbinit .
-fi
-
-if [ -f ../.dstreamrc ]
-then
- ln ../.dstreamrc .
-fi
-
-./configure --prefix=$prefix --enable-debugging --enable-printing --enable-checking --disable-optimise --enable-guile
-
+++ /dev/null
-#!/bin/sh
-# show-current.sh
-
-. $LILYPOND_SOURCEDIR/VERSION
-VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
-if [ "$MY_PATCH_LEVEL" != "" ]; then
- VERSION=$VERSION.$MY_PATCH_LEVEL
-fi
-echo $VERSION
+++ /dev/null
-#!@PYTHON@
-
-# template.py --
-#
-# source file of the GNU LilyPond music typesetter
-#
-# (c) 1998
-
-program_name = 'template'
-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: %s [options] [files]\n"
- "I'm not a program, use me as a template to create one\n\n"
- + "Options:\n"
- + " -h, --help print this help\n"
- % (program_name)
- )
- sys.exit (0)
-
-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 *
-
--- /dev/null
+# bin/Makefile
+
+depth = ..
+STEPMAKE_TEMPLATES=script
+
+include $(depth)/make/stepmake.make
+
+
+
+
+
+
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!@PERL@
+
+open GREP, "egrep -h '^struct|^class' *.hh *.cc|";
+open OUT, "|sort | uniq";
+while (<GREP>) {
+
+ s/^struct/class/;
+ if (! /; *$/) {
+ s/:[^{]+{.*$//;
+ s/ *{.*$/;/;
+ }
+ if (! /; *$/) {
+ chop;
+ $_ .= ";\n";
+
+ }
+ print OUT;
+}
+close OUT;
+close GREP;
--- /dev/null
+#!/bin/sh
+
+TMPDIR=/tmp/gen-sitemap
+for tarball in $*; do
+ tar -C $TMPDIR -xfz $tarball '*.html'
+done
--- /dev/null
+#!@PYTHON@
+
+# genheader.py -- do headers (like these)
+#
+# source file of the GNU LilyPond music typesetter
+#
+# (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+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)
+
--- /dev/null
+#!@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 <janneke@gnu.org>
+
+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 ()
+
--- /dev/null
+#!/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:=":"}
+
--- /dev/null
+#!/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
+
+
--- /dev/null
+# 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 ()
+
--- /dev/null
+# 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 <gord@gnu.ai.mit.edu>, 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:
--- /dev/null
+#!/bin/sh
+# mail-address
+if [ "$MAILADDRESS" != "" ]; then
+ echo $MAILADDRESS
+else
+ echo "mail-address:6: warning: \$MAILADDRESS undefined" > /dev/stderr
+ echo $USER@`hostname`
+fi
--- /dev/null
+#!@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 <hanwen@cs.uu.nl>
+
+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()
--- /dev/null
+#!@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 <<EOF
+# \font\fetatwenty=feta20
+# \fetatwenty
+# \nopagenumbers
+# \newcount\c\c64
+# \char\c
+# \loop\ifnum\c<$num\advance\c by1
+# \vfill\eject
+# \char\c
+# \repeat
+# \vfill\eject
+# \end
+# EOF
+
+# for i in $NUMS; do
+# $PKTOPBM out/$font.${RESOLUTION}pk -c $i out/$font-$i.pbm
+# done
+
+# numbered files
+if [ "x$named" = "x" ]; then
+ NUMS=`grep "^C *[0-9]*;" $afm | sed "s!^C *\([^;]*\).*!\\1!"`
+ PBMS=`grep "^C *[0-9]*;" $afm | sed "s!^C *\([^;]*\).*!out/$font-\\1.pbm!"`
+else
+ NUMS=`grep "^C *[0-9]*;" $afm | sed "s!^C [^;]*; *N *\([^;]*\).*!\\1!"`
+ PBMS=`grep "^C *[0-9]*;" $afm | sed "s!^C [^;]*; *N *\([^;]*\).*!out/$font-\\1.pbm!"`
+fi
+
+# $PKTOPBM out/$font.${RESOLUTION}pk -x 100 -y 100 $PBMS
+$PKTOPBM out/$font.${RESOLUTION}pk $PBMS
+
+for i in $NUMS; do
+ ppmtoxpm out/$font-$i.pbm > out/$font-$i.xpm
+done
+rm -f $PBMS
--- /dev/null
+#!@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 ('<html><TITLE>Rendered Examples</TITLE>\n')
+ list.write ('<body bgcolor=white>')
+ if len(subdirs):
+ list.write ('<h2>subdirectories</h2>')
+ list.write ('<ul>')
+ for ex in subdirs:
+ print 'subdir %s ' % ex
+ list.write ('<li><a href=%s/index.html>Subdirectory: %s</a></li>\n' % (pre + ex + post , ex))
+
+ list.write ('</ul>')
+
+ list.write('<h2>Contents of this directory</h2>\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, <a href="http://www.gnu.org/philosophy/gif.html">no gifs due to patent problems</a>, '
+ '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('<hr>')
+ list.write('<h1>example file: %s</h1>' % head);
+ if composer <> '':
+ list.write('<h2>%s</h2>\n' % composer)
+ if desc <> '':
+ list.write('%s<p>' % desc)
+ list.write ('<ul>')
+ def list_item(filename, desc, type, l = list):
+ if file_exist_b(filename):
+ l.write ('<li><a href=%s>%s</a>' % (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 (' <a href="http://www.gnu.org/philosophy/gif.html">no gifs due to patent problems</a>')
+ 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 ("</ul>");
+
+ list.write( "</BODY></HTML>");
+ 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')
+
--- /dev/null
+
+configure --prefix=~ --enable-profiling --enable-config=optprof --enable-optimise --disable-checking
--- /dev/null
+#!/bin/sh
+# ps-to-gifs, convert PS to multiple gifs or other bitmaps
+
+usage()
+{
+ cat <<EOF
+Convert PS to multiple gifs or other bitmaps
+Usage: ps-to-gifs.sh [OPTION]... [FILE]
+Options:
+ -h, --help this help
+ -c, --crop crop output
+ -o, --output=NAME set output base
+ -p, --png convert to png
+ -s, --size=SIZE set papersize
+ -t, --transparent change white to transparent
+EOF
+}
+
+if [ $# -lt 1 ]; then
+ usage;
+ exit 2;
+fi
+CROP=cat
+GIF=gif
+PNMTOGIF=ppmtogif
+
+while [ $# -gt 0 ]; do
+opt=$1
+shift
+ case $opt in
+ -t|--t*)
+ color='-transparent white'
+ ;;
+ -h|--h*)
+ usage;
+ exit 0
+ ;;
+ -c|--c*)
+ CROP=" pnmcrop "
+ ;;
+ -o) OUTFILE=$2; shift
+ ;;
+ --o*=*) OUTFILE=`echo $opt | sed -e s/"^.*="//`
+ ;;
+ -p|--p*)
+ GIF=png
+ PNMTOGIF=pnmtopng
+ ;;
+ -s) SIZE="-sPAPERSIZE=$2"; shift
+ ;;
+ --s*=*)
+ SIZE="-sPAPERSIZE=`echo $opt | sed -e s/"^.*="//`"
+ ;;
+ -*)
+ echo "ps-to-gifs: unknown option: \`$opt'"
+ exit 1
+ ;;
+ *)
+ FILE=$opt
+ ;;
+ esac
+done
+
+if [ "x$TRANSPARENT_IS_BROKEN" != "x" ]; then
+ color=
+fi
+
+if [ "x$OUTFILE" = "x" ]; then
+ BASE=`dirname $FILE`/`basename $FILE .ps`
+else
+ BASE=`dirname $OUTFILE`/`basename $OUTFILE .$GIF`
+fi
+
+# urg, pipe breaks
+rm -f $BASE{.ppm,.$GIF} $BASE-page*{.ppm,.$GIF}
+
+# generate the pixmap at twice the size, then rescale (for antialiasing)
+cat $FILE | gs -sDEVICE=ppmraw $SIZE -sOutputFile="$BASE-page%d.ppm" -r180 -dNOPAUSE - -c quit $FILE
+# quant is soo slow
+# cat $PPMFILE | ppmquant 2 | pnmscale 0.3333 | pnmcrop | $PNMTOGIF $color > $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
+
--- /dev/null
+#!/bin/sh
+# ps-to-pngs, convert PS to multiple pngs
+
+ps-to-gifs --png $*
--- /dev/null
+#!/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 $*
--- /dev/null
+#!/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:
+#
+# <SEE PATCHES.txt>
+#
+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 <<EOF
+ LILYINCLUDE=$LILYPOND_SOURCEDIR/init:$LILYPOND_SOURCEDIR/mf/out
+ MFINPUTS=\$MFINPUTS:\$LILYPOND_SOURCEDIR/mf
+ TEXINPUTS=\$TEXINPUTS:\$LILYPOND_SOURCEDIR/mf/out
+ export LILYINCLUDE MFINPUTS TEXINPUTS
+EOF
+
+fi
+
+ln -sf $LILYPOND_SOURCEDIR/lily/out/lilypond $prefix/bin/lilypond
+ln -sf $LILYPOND_SOURCEDIR/mi2mu/out/mi2mu $prefix/bin/mi2mu
+ln -sf $LILYPOND_SOURCEDIR/scripts/ly2dvi.sh $prefix/bin/ly2dvi
+chmod 755 $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh
+ln -sf $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh $prefix/bin/ps-to-gifs
+
+if [ -f ../.gdbinit ];
+then
+ ln ../.gdbinit .
+fi
+
+if [ -f ../.dstreamrc ]
+then
+ ln ../.dstreamrc .
+fi
+
+./configure --prefix=$prefix --enable-debugging --enable-printing --enable-checking --disable-optimise --enable-guile
+
--- /dev/null
+#!/bin/sh
+# show-current.sh
+
+. $LILYPOND_SOURCEDIR/VERSION
+VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
+if [ "$MY_PATCH_LEVEL" != "" ]; then
+ VERSION=$VERSION.$MY_PATCH_LEVEL
+fi
+echo $VERSION
--- /dev/null
+#!@PYTHON@
+
+# template.py --
+#
+# source file of the GNU LilyPond music typesetter
+#
+# (c) 1998
+
+program_name = 'template'
+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: %s [options] [files]\n"
+ "I'm not a program, use me as a template to create one\n\n"
+ + "Options:\n"
+ + " -h, --help print this help\n"
+ % (program_name)
+ )
+ sys.exit (0)
+
+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 *
+
/*
axis.cc -- implement Axis
- source file of the GNU LilyPond music typesetter
+
(c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
{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; }
V retval;
if (!elem_b (k))
return retval ;
- retval ((Dictionary<V> *) this)->elem (k);
+ return ((Dictionary<V> *) this)->elem (k);
}
V remove (String s)
return sqrt (norm_sq());
}
operator Array<Real>() { return dat; }
+ Array<Real> const &to_array()const { return dat; }
void print() const;
/// set to j-th element of unit-base
void set_unit (int j) ;
#ifndef VIRTUAL_METHODS_HH
#define VIRTUAL_METHODS_HH
+#include <typeinfo>
#include "stdlib.h" // size_t
/** Declare the classes name as a static and virtual function.
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
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
Abbreviation::do_substitute_dependent (Score_element*o, Score_element*n)
{
if (stem_l_ == o)
- stem_l_ = n ? dynamic_cast<Stem*> (n) : 0;
+ stem_l_ = dynamic_cast<Stem*> (n);
}
bool
Abbreviation_beam_engraver::do_try_request (Request*r)
{
- Musical_req* mus_l = dynamic_cast <Musical_req *> (r);
- if (!mus_l)
- return false;
-
- Abbreviation_beam_req * b = dynamic_cast <Abbreviation_beam_req *> (mus_l);
+ Abbreviation_beam_req * b = dynamic_cast <Abbreviation_beam_req *> (r);
if (!b)
return false;
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;
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<Stem *> (i.elem_l_);
+ if (!abeam_p_ || !s)
return;
- Stem* s = (Stem*)dynamic_cast <Item *> (i.elem_l_);
-
int type_i = span_reqs_drul_[LEFT]->type_i_;
s->flag_i_ = intlog2 (type_i) - 2;
if (span_reqs_drul_[RIGHT])
(c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
#include "atom.hh"
#include "interval.hh"
#include "string.hh"
}
+
Atom::Atom ()
: dim_ (Interval (0,0),Interval (0,0))
{
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;
}
return off_;
}
-
-
void
Atom::translate_axis (Real r, Axis a)
{
{
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)
}
IMPLEMENT_IS_TYPE_B1(Audio_text, Audio_item);
-
IMPLEMENT_IS_TYPE_B1(Audio_item, Audio_element);
void
bool
Tuplet_engraver::do_try_request (Request *r)
{
- Command_req * c = dynamic_cast <Command_req *> (r);
- if (!(c &&
- dynamic_cast <Bracket_req *> (c)))
+ if (Bracket_req * b = dynamic_cast <Bracket_req *> (r))
{
- return false;
+ bracket_req_arr_.push (b);
+ return true;
}
-
- Bracket_req * b = dynamic_cast <Bracket_req *> (c);
- bracket_req_arr_.push (b);
- return true;
+ return false;
}
void
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<Note_column *> (i.elem_l_))
{
- Note_column *nc = (Note_column*)dynamic_cast <Item *> (i.elem_l_);
+
for (int j =0; j <started_span_p_arr_.size (); j++)
// started_span_p_arr_[j]->add_column (nc);
;
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);
{
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<Axis_group_item*> (broken_to_drul_[j]))->add_element (new_l);
}
while (flip(&j)!=LEFT);
}
/* this piece doesn't know where it belongs.
Find out if it was broken, and use the broken remains
*/
- if (dynamic_cast <Spanner *> (elt))
+ Spanner * sp =dynamic_cast <Spanner *> (elt);
+ Item *it = dynamic_cast <Item *> (elt) ;
+ if (sp)
{
- Spanner * sp = dynamic_cast <Spanner *> (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<Axis_group_spanner*>(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<Score_element*>(my_broken_l)->line_l());
if (broken_span_l)
my_broken_l->add_element (broken_span_l);
}
}
- else if (dynamic_cast <Item *> (elt)
- && dynamic_cast <Item *> (elt)->breakable_b_
- && dynamic_cast <Item *> (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 <Item *> (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<Axis_group_spanner*>(find_broken_piece (item_line_l));
if (v)
v->add_element (my_item);
else
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<Axis_group_spanner*> (find_broken_piece (elt->line_l()));
my_broken_l->add_element (elt);
}
}
#include "request.hh"
#include "script.hh"
#include "bar.hh"
+#include <typeinfo>
Bar_column_engraver::Bar_column_engraver()
{
Item * it = dynamic_cast <Item *> (info.elem_l_);
if (!it)
return;
-
- if (it->is_type_b (Script::static_name())
+ Script *s = dynamic_cast<Script*> (it);
+ Bar *b = dynamic_cast<Bar*> (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);
}
}
Script_column::do_substitute_dependency (o,n);
if (o == bar_l_)
{
- bar_l_ = n ? (Bar*)dynamic_cast <Item *> (n) : 0;
+ bar_l_ = dynamic_cast<Bar *> (n);
}
}
bool
Bar_engraver::do_try_request (Request*r_l)
{
- Command_req* c_l = dynamic_cast <Command_req *> (r_l);
- if (!c_l|| !dynamic_cast <Bar_req *> (c_l))
- return false;
- Bar_req * b= dynamic_cast <Bar_req *> (c_l);
- if (bar_req_l_ && bar_req_l_->equal_b (b))
- return false;
+ if (Bar_req * b= dynamic_cast <Bar_req *> (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
void
Bar_number_engraver::acknowledge_element (Score_element_info i)
{
-
- Item *it=dynamic_cast <Item *> (i.elem_l_);
- if (script_p_
- || !it || !it->is_type_b (Bar::static_name()))
+ Bar *b =dynamic_cast <Bar *> (i.elem_l_);
+ if (script_p_ || !b)
return;
/* Only put numbers on bars that are at our own level (don't put
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 ())
bool
Beam_engraver::do_try_request(Request*r)
{
- Musical_req* mus_l = dynamic_cast <Musical_req *> (r);
- if (!mus_l)
- return false;
-
- Beam_req* b = dynamic_cast <Beam_req *> (mus_l);
+ Beam_req* b = dynamic_cast <Beam_req *> (r);
if (!b)
return false;
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;
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<Stem *> (i.elem_l_);
+ if (!beam_p_ || !s)
return;
- Stem* s = (Stem*)dynamic_cast <Item *> (i.elem_l_);
if (!dynamic_cast <Rhythmic_req *> (i.req_l_))
{
::warning ( _("Stem must have Rhythmic structure."));
void
Beam::do_substitute_dependent (Score_element*o,Score_element*n)
{
- if (o->is_type_b (Stem::static_name ()))
- stems_.substitute ((Stem*)dynamic_cast <Item *> (o), n? (Stem*) dynamic_cast <Item *> (n):0);
+ if (Stem * os = dynamic_cast<Stem*> (o))
+ stems_.substitute (os,
+ dynamic_cast<Stem *> (n));
}
Interval
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
#include "debug.hh"
#include "command-request.hh"
#include "time-description.hh"
-
-
#include "note-head.hh"
#include "key-item.hh"
#include "local-key-item.hh"
void
Clef_engraver::acknowledge_element (Score_element_info info)
{
- if (info.elem_l_->is_type_b (Bar::static_name ())
+ if (dynamic_cast<Bar*>(info.elem_l_)
&& clef_type_str_.length_i())
{
create_clef();
/* ugh; should make Clef_referenced baseclass */
Item * it_l =dynamic_cast <Item *> (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<Note_head*>(it_l))
+ {
+ h->position_i_ += c0_position_i_;
+ }
+ else if (Local_key_item *i = dynamic_cast<Local_key_item*> (it_l))
+ {
+ i->c0_position_i_ =c0_position_i_;
+ }
+ else if (Key_item *k = dynamic_cast<Key_item*>(it_l))
+ {
+ k-> set_c_position (c0_position_i_);
+ }
+ }
}
void
bool
Clef_engraver::do_try_request (Request * r_l)
{
- Command_req* creq_l= dynamic_cast <Command_req *> (r_l);
- if (!creq_l || !dynamic_cast <Clef_change_req *> (creq_l))
+ if (Clef_change_req *cl = dynamic_cast <Clef_change_req *> (r_l))
+ {
+ clef_req_l_ = cl;
+ read_req (clef_req_l_);
+ return true;
+ }
+ else
return false;
- clef_req_l_ = dynamic_cast <Clef_change_req *> (creq_l);
- read_req (clef_req_l_);
- return true;
}
void
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<Note_column *> (i.elem_l_))
{
- Note_column * c = (Note_column*) dynamic_cast <Item *> (i.elem_l_);
if (c->rest_b ())
return ;
void
Collision::add_column (Note_column* ncol_l)
{
+ // ugh. Fixme.
clash_l_arr_.push (ncol_l);
add_element (ncol_l);
add_dependency (ncol_l);
void
Collision::do_substitute_dependency (Score_element*o_l,Score_element*n_l)
{
- clash_l_arr_.substitute ((Note_column*)dynamic_cast <Item *> (o_l),
- (Note_column*)(n_l?dynamic_cast <Item *> (n_l):0));
+ if (o_l)
+ {
+ clash_l_arr_.substitute (dynamic_cast<Note_column *> (o_l),
+ dynamic_cast <Note_column *> (n_l));
+
+ }
}
Cadenza_req::do_equal_b (Request*r) const
{
Cadenza_req*cad = dynamic_cast <Cadenza_req *> (r);
-
- return cad->on_b_ == on_b_;
+ return cad && cad->on_b_ == on_b_;
}
Cadenza_req::Cadenza_req (bool b)
Bar_req::do_equal_b (Request*r) const
{
Bar_req * b = dynamic_cast <Bar_req *> (r);
- return type_str_ == b->type_str_;
+ return b && type_str_ == b->type_str_;
}
{
Partial_measure_req *p = dynamic_cast <Partial_measure_req *> (r);
- return p->duration_ == duration_;
+ return p&& p->duration_ == duration_;
}
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<Barcheck_req*> (r);
+ return r;
}
{
Time_signature_change_req * m = dynamic_cast <Time_signature_change_req *> (r);
- return m->beats_i_ == beats_i_
+ return m && m->beats_i_ == beats_i_
&& one_beat_i_ == m->one_beat_i_;
}
{
Tempo_req *t = dynamic_cast <Tempo_req *> (r);
- return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
+ return t&& t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
}
void
Dot_column_engraver::acknowledge_element (Score_element_info info)
{
- Item * i=dynamic_cast <Item *> (info.elem_l_);
-
- if (! (i && i->is_type_b (Rhythmic_head::static_name ())))
+ Rhythmic_head * h = dynamic_cast<Rhythmic_head*>(info.elem_l_);
+ if (!h)
return;
- Rhythmic_head * h = (Rhythmic_head*)i;
-
if (!h->dots_l_)
return;
Dot_column::do_substitute_dependency (Score_element*o,Score_element*n)
{
Item *oi =dynamic_cast <Item *> (o);
- Item *ni = n?dynamic_cast <Item *> (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<Rhythmic_head *> (oi))
+ head_l_arr_.substitute (dynamic_cast<Rhythmic_head*> (oi),
+ dynamic_cast<Rhythmic_head*>(n));
+ else if (oi && dynamic_cast<Dots *> (oi))
+ dot_l_arr_.substitute (dynamic_cast<Dots*> (oi),
+ dynamic_cast<Dots*> (n));
}
void
bool
Dynamic_engraver::do_try_request (Request * r)
{
- Musical_req * m = dynamic_cast <Musical_req *> (r);
- if (!m)
- return false;
- Dynamic_req * d = dynamic_cast <Dynamic_req *> (m);
- if (!d)
- return false;
-
-#if 0
- if (cresc_p_ && dynamic_cast <Span_dynamic_req *> (d)
- && dynamic_cast <Span_dynamic_req *> (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 <Dynamic_req *> (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 <Dynamic_req *> (m));
- return true;
+ }
+ return false;
}
void
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 <Absolute_dynamic_req *> (dreq_l))
+ if (Absolute_dynamic_req *absd = dynamic_cast<Absolute_dynamic_req *> (dreq_l))
{
if (dynamic_p_)
Text_def * td_p = new Text_def;
td_p->align_dir_ = CENTER;
- String loud = dynamic_cast <Absolute_dynamic_req *> (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";
dynamic_p_ = new Text_item (td_p);
announce_element (Score_element_info (dynamic_p_, dreq_l));
}
- else if (dynamic_cast <Span_dynamic_req *> (dreq_l))
+ else if (Span_dynamic_req *span_l = dynamic_cast <Span_dynamic_req *> (dreq_l))
{
- Span_dynamic_req* span_l = dynamic_cast <Span_dynamic_req *> (dreq_l);
if (span_l->spantype == Span_req::STOP)
{
if (!cresc_p_)
void
Dynamic_engraver::acknowledge_element (Score_element_info i)
{
- if (i.elem_l_->is_type_b (Note_column::static_name ()))
+ if (dynamic_cast<Note_column *> (i.elem_l_))
{
if (dynamic_p_)
dynamic_p_->add_support (i.elem_l_);
Engraver::daddy_grav_l () const
{
return (daddy_trans_l_ )
- ? (Engraver_group_engraver*) dynamic_cast <Engraver *> (daddy_trans_l_)
+ ? dynamic_cast<Engraver_group_engraver *> (daddy_trans_l_)
: 0;
}
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 <Item *> (e));
-
+ if (Note_head *h = dynamic_cast<Note_head *> (e))
+ {
+ dynamic_cast<Hara_kiri_vertical_group_spanner*> (staffline_p_)
+ ->add_note (h);
+ }
Line_group_engraver_group::typeset_element (e);
}
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 <Item *> (o),
- (n)? (Note_head*)dynamic_cast <Item *> (n) : 0);
+ if (dynamic_cast<Note_head *> (o))
+ head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
+ (n)? dynamic_cast<Note_head *> (n) : 0);
}
if (note_req_l_)
return false;
- if (!(dynamic_cast <Note_req *> (req_l)))
- return false;
-
- note_req_l_=dynamic_cast <Rhythmic_req *> (req_l);
- return true;
+ if (Note_req * nr = dynamic_cast <Note_req *> (req_l))
+ {
+ note_req_l_= nr;
+ return true;
+ }
+ return false;
}
void
bool
Note_heads_engraver::do_try_request (Request *req_l)
{
- if (!dynamic_cast <Musical_req *> (req_l))
- return false;
-
- Note_req * n =dynamic_cast <Note_req *> (req_l);
- if (!n)
- return false;
-
- note_req_l_arr_.push (n);
- return true;
+ if (Note_req * n =dynamic_cast <Note_req *> (req_l))
+ {
+ note_req_l_arr_.push (n);
+ return true;
+ }
+ return false;
}
void
dot_p_arr_.push (d);
}
- note_p->position_i_ = dynamic_cast <Note_req *> (note_req_l)->pitch_.steps ();
+ note_p->position_i_ = note_req_l->pitch_.steps ();
Score_element_info itinf (note_p,note_req_l);
#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 (); \
}
#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_;\
}
Class ## _identifier::Class ## _identifier (Class ## _identifier const &s) \
: Identifier (s)\
{\
- data_p_ = s.access_ ## Class (true);\
+ data_p_ = s.access_content_ ## Class (true);\
}
#ifndef ATOM_HH
#define ATOM_HH
-#include "lily-guile.hh"
+#include "protected-scm.hh"
#include "string.hh"
#include "box.hh"
#include "lily-proto.hh"
/// 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;
virtual Link_array<Score_element> 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<Score_element> elem_l_arr() const;
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)
};
class Timing_req : public Command_req {
public:
REQUESTMETHODS(Timing_req);
- DEFAULTACCESSOR(Tempo_req)
};
Engraver () {}
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual Engraver * access_Engraver () { return this; }
};
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;
#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.
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; \
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;
SCM lambda_scm (String str, Array<Real> args_arr);
SCM lambda_scm (String str, Array<Scalar> args_arr);
+
+
+
#endif // LILY_GUILE_HH
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<Lyric_req*> lreq_arr_;
+ Array<Lyric_req*> lreq_arr_;
};
#endif // LYRIC_PERFOMER_HH
class Music_sequence : public Music
{
public:
- int multi_level_i_;
Music_list * music_p_list_p_;
Music_sequence (Music_sequence const&);
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);
};
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);
};
protected:
virtual int get_tempo_i() const;
virtual void play (Audio_element * elem_p );
- Performer * access_Performer () { return this; }
};
--- /dev/null
+/*
+ protected-scm.hh -- declare Protected_scm
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#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 */
#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.
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;
#define REQUESTMETHODS(T) \
-virtual T * access_ ## T() { return this;}\
DECLARE_MY_RUNTIME_TYPEINFO;\
VIRTUAL_COPY_CONS(T, Request);\
virtual void do_print() const
*/
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);
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 *);
void set_bounds (Direction d, Item*);
DECLARE_MY_RUNTIME_TYPEINFO;
- virtual Spanner* access_Spanner ();
Spanner ();
Spanner (Spanner const &);
bool broken_b () const;
class Spring_spacer : public Line_spacer {
friend class Durations_iter;
-
-
+
Pointer_list<Idealspacing *> ideal_p_list_;
Array<Column_info> cols_;
Array<Column_info> loose_col_arr_;
- Array<Spacer_rod> rods_;
+
/// mark column #i# as being loose.
void loosen_column (int i);
{
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;
String id_str_;
-
-
int iterator_count_;
TRANSLATOR_CLONE(Translator_group);
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 ();
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 {
#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;
#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);\
int
Item::left_right_compare(Item const *l, Item const *r)
{
- while (!l->is_type_b (Paper_column::static_name ()))
- l = dynamic_cast<Item*> (l->axis_group_l_a_[X_AXIS]);
- while (!r->is_type_b (Paper_column::static_name ()))
- r = dynamic_cast<Item*> (r->axis_group_l_a_[X_AXIS]);
+ while (!(dynamic_cast<Paper_column const *> (l)))
+ l = dynamic_cast<Item const*> (l->axis_group_l_a_[X_AXIS]);
+ while (!(dynamic_cast<Paper_column const *> (r)))
+ r = dynamic_cast<Item const*> (r->axis_group_l_a_[X_AXIS]);
Paper_column *p1 = (Paper_column*)l;
Paper_column* p2 = (Paper_column*)r;
break_priority_i_ = s.break_priority_i_;
}
-Item *
-Item::access_Item ()
-{
- return this;
-}
bool
Key_engraver::do_try_request (Request * req_l)
{
- Command_req* creq_l= dynamic_cast <Command_req *> (req_l);
- if (!creq_l|| !dynamic_cast <Key_change_req *> (creq_l))
- return false;
-
- if (keyreq_l_)
- return false; // TODO
- keyreq_l_ = dynamic_cast <Key_change_req *> (creq_l);
- read_req (keyreq_l_);
- return true;
+ if (Key_change_req *kc = dynamic_cast <Key_change_req *> (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 <Command_req *> (info.req_l_) ;
-
- if (r_l && dynamic_cast <Clef_change_req *> (r_l))
+ if (dynamic_cast <Clef_change_req *> (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<Bar *> (info.elem_l_)
&& accidental_idx_arr_.size ())
{
if (!keyreq_l_)
{
#ifndef NPRINT
if (key_req_l_)
- key_req_l_->print();
+ key_req_l_->print();
#endif
}
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 <Key_change_req *> (req_l))
+ if (Key_change_req *kc = dynamic_cast <Key_change_req *> (req_l))
{
- key_req_l_ = dynamic_cast <Key_change_req*> (req_l);
+ if (key_req_l_)
+ warning ("FIXME. Key change merge");
+
+ key_req_l_ = kc;
return true;
}
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 \\\[
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
}
else
{
- key_C_ = &((Key_engraver*)dynamic_cast <Engraver *> (result))->key_;
+ key_C_ = &(dynamic_cast<Key_engraver *> (result))->key_;
local_key_ = *key_C_;
}
}
void
Local_key_engraver::acknowledge_element (Score_element_info info)
{
- Score_element * elem_l = info.elem_l_;
- Item * item_l = dynamic_cast <Item *> (elem_l);
-
Note_req * note_l = dynamic_cast <Note_req *> (info.req_l_);
-
- if (note_l && item_l && item_l->is_type_b (Note_head::static_name ()))
+ Note_head * note_head = dynamic_cast<Note_head *> (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 <Key_change_req*> (info.req_l_))
{
local_key_ = *key_C_;
}
- else if (elem_l->is_type_b (Tie::static_name ()))
+ else if (Tie * tie_l = dynamic_cast<Tie *> (info.elem_l_))
{
- Tie * tie_l = (Tie*)dynamic_cast <Spanner *> (elem_l);
if (tie_l->same_pitch_b_)
tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
}
a.dim_[Y_AXIS] *= 1 / 1000.0;
Array<Real> arr;
arr.push (m.code ());
- a.lambda_ = lambda_scm ("char", arr);
+ a.lambda_ = (lambda_scm ("char", arr));
a.font_ = font_;
return a;
}
Array<Real> 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;
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;
a.dim_[Y_AXIS] = Interval (0 <? dy, 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),
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;
}
Array<Real> 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;
a.push (y2);
a.push (-y1);
- s.lambda_ = lambda_scm ("stem", a);
+ s.lambda_ = (lambda_scm ("stem", a));
s.font_ = font_;
return s;
}
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;
Lookup::time_signature (Array<Real> 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;
}
Array<Real> 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_;
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 (),
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, 0 >? dy);
}
Array<Real> 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;
bool
Lyric_engraver::do_try_request (Request*r)
{
- Musical_req * m =dynamic_cast <Musical_req *> (r);
- if (!m || ! dynamic_cast <Lyric_req *> (m))
- return false;
- lreq_l_ = dynamic_cast <Lyric_req *> (m);
-
- return true;
+ if (Lyric_req * lr = dynamic_cast <Lyric_req *> (r))
+ {
+ lreq_l_ = lr;
+ return true;
+ }
+ return false;
}
void
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
}
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 <Musical_req *> (req_l);
- if (!m_l || ! dynamic_cast <Lyric_req *> (m_l))
- return false;
- lreq_arr_.push (dynamic_cast <Lyric_req *> (m_l));
-
- return true;
+ if (Lyric_req *lr = dynamic_cast <Lyric_req *> (req_l))
+ {
+ lreq_arr_.push (lr);
+ return true;
+ }
+ return false;
}
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)
{
default_outname_base_global = outname_str;
do_one_file (i, default_outname_base_global);
}
+ exit( exit_status_i_);
}
int
#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
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";
bool
Mark_engraver::do_try_request (Request* r_l)
{
- Command_req* c_l = dynamic_cast <Command_req *> (r_l);
- if (!c_l || !dynamic_cast <Mark_req *> (c_l) || mark_req_l_)
- return false;
-
- mark_req_l_ = dynamic_cast <Mark_req *> (c_l);
-
- return true;
+ if (Mark_req *mr = dynamic_cast <Mark_req *> (r_l))
+ {
+ mark_req_l_ = mr;
+ return true;
+ }
+ return false;
}
void
: Midi_item (audio_item_l)
{
dynamic_byte_ = 0x7f;
+ assert (dynamic_cast<Audio_note*> (audio_item_l));
}
Moment
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;
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<Midi_note*>(p))
+ do_start_note (mi);
else
- do_start_note ((Midi_note*)p);
+ output_event (ptr()->audio_column_l_->at_mom (), p);
}
bool
Multi_measure_rest_engraver::do_try_request (Request* req_l)
{
- if (!dynamic_cast<Multi_measure_rest_req *> (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<Multi_measure_rest_req *> (req_l);
- req_start_mom_ = now_moment ();
+ if (Multi_measure_rest_req *mr = dynamic_cast<Multi_measure_rest_req *> (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
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<Request_chord const *> (m))
p = new Request_chord_iterator;
- else if (m->is_type_b (Simultaneous_music::static_name()))
+ else if (dynamic_cast<Simultaneous_music const *> (m))
p = new Simultaneous_music_iterator;
- else if (m->is_type_b (Sequential_music::static_name()))
+ else if (dynamic_cast<Sequential_music const *> (m))
p = new Sequential_music_iterator;
- else if (m->is_type_b (Translation_property::static_name ()))
+ else if (dynamic_cast<Translation_property const *> (m))
p = new Property_iterator;
- else if (m->is_type_b (Change_translator::static_name ()))
+ else if (dynamic_cast<Change_translator const *> (m))
p = new Change_iterator;
- else if (m->is_type_b (Compressed_music::static_name ()))
+ else if (dynamic_cast<Compressed_music const *> (m))
p = new Compressed_music_iterator;
- else if (m->is_type_b (Music_wrapper::static_name ()))
+ else if (dynamic_cast<Music_wrapper const *> (m))
p = new Music_wrapper_iterator;
p->music_l_ = m;
Request_chord::Request_chord()
: Simultaneous_music (new Music_list)
{
- multi_level_i_ =0;
}
{
for (iter (music_p_list_p_->top(),i); i.ok (); i++)
{
- Musical_req *m = dynamic_cast<Musical_req*> (i.ptr ());
- if (m && dynamic_cast <Melodic_req *> (m))
+ if (Melodic_req *m= dynamic_cast <Melodic_req *> (i.ptr ()))
{
- Musical_pitch &pit = dynamic_cast <Melodic_req *> (m)->pitch_;
+ Musical_pitch &pit = m->pitch_;
pit.to_relative_octave (last);
return pit;
}
for (Dictionary_iter<Identifier*> 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;
}
}
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];
if (!t)
error (_("Can't find Score context"));
t = t->clone ();
- Global_translator *g = dynamic_cast <Translator_group *> (t)->global_l ();
+ Global_translator *g = dynamic_cast <Global_translator *> (t);
t->add_processing ();
return g;
return "";
Identifier * id = (*scope_p_) ["output"];
- String *p = dynamic_cast <String *> (id);
+ String *p = id->access_content_String (false);
return p ? *p : String ("");
}
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_);
}
Music_sequence::Music_sequence(Music_list *mlist_p)
{
- multi_level_i_ = 0;
music_p_list_p_ = mlist_p;
}
Melodic_req::do_equal_b (Request*r) const
{
Melodic_req* m= dynamic_cast <Melodic_req *> (r);
- return !compare (*m, *this);
+ return m&& !compare (*m, *this);
}
int
{
Rhythmic_req* rh = dynamic_cast <Rhythmic_req *> (r);
- return !compare (*this, *rh);
+ return rh&& !compare (*this, *rh);
}
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<Note_req*> (r);
+ return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
}
Span_req:: do_equal_b (Request*r) const
{
Span_req * s = dynamic_cast <Span_req *> (r);
- return spantype == s->spantype;
+ return s&& spantype == s->spantype;
}
Span_req::Span_req ()
{
Script_req * s = dynamic_cast <Script_req *> (r);
- return scriptdef_p_->equal_b (*s->scriptdef_p_);
+ return s&& scriptdef_p_->equal_b (*s->scriptdef_p_);
}
Script_req::Script_req ()
Absolute_dynamic_req::do_equal_b (Request *r) const
{
Absolute_dynamic_req *a = dynamic_cast <Absolute_dynamic_req *> (r);
- return loudness_ == a->loudness_;
+ return a&& loudness_ == a->loudness_;
}
String
{
Span_dynamic_req * s = dynamic_cast <Span_dynamic_req *> (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 ()
}
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))
}
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--; )
{
return v;
}
+
+/*
+ UGH.
+ */
Array<Request*>*
My_lily_parser::get_parens_request (int t)
{
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 ;
}
{
if (stem_l_ == o)
{
- stem_l_ = n ? (Stem*)dynamic_cast <Item *> (n):0;
+ stem_l_ = n ? dynamic_cast<Stem *> (n):0;
}
- if (o->is_type_b (Note_head::static_name ()))
+ if (dynamic_cast<Note_head *> (o))
{
- head_l_arr_.substitute ((Note_head*)dynamic_cast <Item *> (o),
- (n)? (Note_head*)dynamic_cast <Item *> (n) : 0);
+ head_l_arr_.substitute (dynamic_cast<Note_head *> (o),
+ (n)? dynamic_cast<Note_head *> (n) : 0);
}
Script_column::do_substitute_dependency (o,n);
- if (o->is_type_b (Rest::static_name ()))
+ if (dynamic_cast<Rest *> (o))
{
- rest_l_arr_.substitute ((Rest*)dynamic_cast <Item *> (o),
- (n)? (Rest*)dynamic_cast <Item *> (n) : 0);
+ rest_l_arr_.substitute (dynamic_cast<Rest *> (o),
+ (n)? dynamic_cast<Rest *> (n) : 0);
}
}
void
Note_column::add_head (Rhythmic_head *h)
{
- if (h->is_type_b (Rest::static_name ()))
+ if (dynamic_cast<Rest *> (h))
{
rest_l_arr_.push ((Rest*)h);
add_support (h);
}
- if (h->is_type_b (Note_head::static_name ()))
+ if (dynamic_cast<Note_head *> (h))
{
head_l_arr_.push ((Note_head*) h);
add_support (h);
{
#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 <Melodic_req *> (note_req_l_) || !dynamic_cast <Rhythmic_req *> (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
#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 ()
{
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<Paper_column const *> (l)))
l = dynamic_cast<Item*> (l->axis_group_l_a_[X_AXIS]);
- while (! r->is_type_b(Paper_column::static_name ()))
+ while (! (dynamic_cast<Paper_column const *> (r)))
r = dynamic_cast<Item*>(r->axis_group_l_a_[X_AXIS]);
PCursor<Paper_column*> start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ());
{
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"));
for (Dictionary_iter<Identifier*> 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);
}
}
{
for (Dictionary_iter<Identifier*> 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*
if (!i->lambda_)
{
// urg
- i->lambda_ =
- ly_append (ly_lambda_o (),
+ i->lambda_ = ly_append (ly_lambda_o (),
ly_list1 (ly_func_o ("empty")));
}
$$ = 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;
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<Translator_group*> (t);
if (!tg)
THIS->parser_error (_("Need a translator group for a context"));
}
| 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<String_identifier*> (id);
+ Real_identifier *r= dynamic_cast<Real_identifier*>(id);
+ int_identifier *i = dynamic_cast<int_identifier*> (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"));
delete $3;
}
| translator_spec_body CONSISTS STRING ';' {
- $$->access_Translator_group ()-> set_element (*$3, true);
+ dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
delete $3;
}
| translator_spec_body ACCEPTS STRING ';' {
- $$->access_Translator_group ()-> set_acceptor (*$3, true);
+ dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
delete $3;
}
| translator_spec_body REMOVE STRING ';' {
- $$->access_Translator_group ()-> set_element (*$3, false);
+ dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
delete $3;
}
;
$$ = new Score;
}
| SCORE_IDENTIFIER {
- $$ = $1->access_Score (true);
+ $$ = $1->access_content_Score (true);
}
| score_body mudela_header {
$$->header_p_ = $2;
$$ = 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;
}
}
| dimension
| REAL_IDENTIFIER {
- $$= *$1->access_Real (false);
+ $$= *$1->access_content_Real (false);
}
| '-' real_expression %prec UNARY_MINUS {
$$ = -$2;
$$ = THIS->default_midi_p ();
}
| MIDI_IDENTIFIER {
- $$ = $1-> access_Midi_def (true);
+ $$ = $1-> access_content_Midi_def (true);
}
| midi_body translator_spec {
$$-> assign_translator ($2);
Simple_music:
request_chord { $$ = $1; }
- | MUSIC_IDENTIFIER { $$ = $1->access_Music (true); }
+ | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
| property_def
| translator_change
;
$$ = new Barcheck_req;
}
| COMMAND_IDENTIFIER {
- $$ = $1->access_Request (true);
+ $$ = $1->access_content_Request (true);
}
/*
| '[' {
post_request:
POST_REQUEST_IDENTIFIER {
- $$ = (Request*)$1->access_Request (true);
+ $$ = (Request*)$1->access_content_Request (true);
}
| dynamic_req {
$$ = $1;
;
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;
}
;
}
}
| DURATION_IDENTIFIER {
- $$ = $1->access_Duration (true);
+ $$ = $1->access_content_Duration (true);
}
| steno_duration '.' {
$$->dots_i_ ++;
$$ = -$2;
}
| INT_IDENTIFIER {
- $$ = *$1->access_int (false);
+ $$ = *$1->access_content_int (false);
}
;
$$ = $1;
}
| STRING_IDENTIFIER {
- $$ = $1->access_String (true);
+ $$ = $1->access_content_String (true);
}
| string '+' string {
*$$ += *$3;
$$ = new Symtables;
}
| IDENTIFIER {
- $$ = $1->access_Symtables (true);
+ $$ = $1->access_content_Symtables (true);
}
| symtables_body FONT STRING {
$$->font_ = *$3;
Performer::daddy_perf_l () const
{
return (daddy_trans_l_)
- ?(Performer_group_performer*) dynamic_cast <Performer *> (daddy_trans_l_)
+ ?dynamic_cast<Performer_group_performer *> (daddy_trans_l_)
: 0;
}
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<Note_head *> (i.elem_l_))
{
- Note_head * nl = (Note_head*)dynamic_cast <Item *> (i.elem_l_);
- nl->position_i_ =0;
+ nh->position_i_ =0;
}
}
void
Plet_engraver::acknowledge_element (Score_element_info i)
{
- if (!i.elem_l_->is_type_b (Stem::static_name ()))
+
+ Stem * st = (dynamic_cast<Stem *> (i.elem_l_));
+ if (!st)
return;
if (!plet_spanner_p_)
return;
return;
if (!plet_spanner_p_->stem_l_drul_[LEFT])
- plet_spanner_p_->set_stem (LEFT, (Stem*)dynamic_cast <Item *> (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 <Item *> (i.elem_l_));
+ plet_spanner_p_->set_stem (RIGHT, st);
}
bool
void
Plet_spanner::do_substitute_dependency (Score_element* o, Score_element* n)
{
- Stem* new_l = n ? (Stem*)dynamic_cast <Item *> (n) : 0;
+ Stem* new_l = n ? dynamic_cast<Stem *> (n) : 0;
if (dynamic_cast <Item *> (o) == stem_l_drul_[LEFT])
stem_l_drul_[LEFT] = new_l;
else if (dynamic_cast <Item *> (o) == stem_l_drul_[RIGHT])
bool
Plet_swallow_engraver::do_try_request (Request* req_l)
{
- return dynamic_cast <Plet_req *> (req_l);
+ return dynamic_cast<Plet_req *> (req_l);
}
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<Score_priority_engraver *> (reg))
{
if (!halign_p_)
{
--- /dev/null
+/*
+ protected-scm.cc -- implement Protected_scm
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "protected-scm.hh"
+extern "C"
+{
+#include <libguile/gc.h>
+};
+
+
+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_;
+}
{
for (PCursor<Music*> 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<Request*> (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;
}
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;
}
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 <Item *> (i.elem_l_));
+ if (dynamic_cast<Note_column *> (i.elem_l_))
+ note_column_l_arr_.push (dynamic_cast<Note_column *> (i.elem_l_));
}
void
void
Rest_collision::do_substitute_dependency (Score_element*o,Score_element*n)
{
- Item*o_l = dynamic_cast <Item *> (o);
-
-
- if (o_l&&o_l->is_type_b (Note_column::static_name ()))
+ if (Note_column *onl = dynamic_cast<Note_column *> (o))
{
- Note_column *n_l = n?(Note_column*)dynamic_cast <Item *> (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<Note_column *> (n):0;
+ rest_l_arr_.substitute (onl, n_l);
+ ncol_l_arr_.substitute (onl, n_l);
}
}
}
bool
-Rest_engraver::do_try_request (Request *r)
+Rest_engraver::do_try_request (Request *req)
{
- Musical_req *m = dynamic_cast <Musical_req *> (r);
- if (!m || !dynamic_cast <Rest_req *> (m))
- return false;
-
- rest_req_l_ = dynamic_cast <Rest_req *> (m); // ugh
- return true;
+ if (Rest_req *r = dynamic_cast <Rest_req *> (req))
+ {
+ rest_req_l_ = r;
+ return true;
+ }
+ return false;
}
IMPLEMENT_IS_TYPE_B1(Rest_engraver, Engraver);
Item * item = dynamic_cast <Item *> (i.elem_l_);
if (!item)
return;
- if (item->is_type_b (Script::static_name ())
+ if (dynamic_cast<Script *> (item)
&& i.req_l_
&& dynamic_cast <Musical_req *> (i.req_l_))
{
script_l_arr_.push ((Script*)item);
}
- else if (item->is_type_b (Stem::static_name()))
+ else if (dynamic_cast<Stem *> (item))
{
stem_l_ = (Stem*) item;
}
- else if (item->is_type_b (Rhythmic_head::static_name ()))
+ else if (dynamic_cast<Rhythmic_head *> (item))
{
rhead_l_arr_.push ((Rhythmic_head*)item);
}
- else if (item->is_type_b (Dot_column::static_name ()))
+ else if (dynamic_cast<Dot_column *> (item))
{
dotcol_l_ = (Dot_column*) item;
}
Rhythmic_head::do_substitute_dependent (Score_element*o,Score_element*n)
{
if (o == dots_l_)
- dots_l_ = n ? (Dots*)dynamic_cast <Item *> (n) :0;
+ dots_l_ = n ? dynamic_cast<Dots *> (n) :0;
}
IMPLEMENT_IS_TYPE_B1(Rhythmic_head, Item);
if (transparent_b_)
return;
Molecule *output= brew_molecule_p ();
+ for (PCursor<Atom*> i(output->atoms_); i.ok(); i++)
+ {
+ i->origin_l_ = this;
+ }
+
pscore_l_->outputter_l_->output_molecule (output, absolute_offset (), name());
delete output;
}
Score_element * elt = dependency (i);
if (elt->line_l() != line)
{
- if (dynamic_cast <Spanner *> (elt))
+ if (Spanner *sp = dynamic_cast<Spanner *> (elt))
{
- Spanner * sp = dynamic_cast <Spanner *> (elt);
Spanner * broken = sp->find_broken_piece (line);
substitute_dependency (sp, broken);
add_dependency (broken);
}
- else if (dynamic_cast <Item *> (elt))
+ else if (Item *original = dynamic_cast <Item *> (elt))
{
- Item * my_item = dynamic_cast <Item *> (elt)->find_prebroken_piece (line);
+ Item * my_item = original->find_prebroken_piece (line);
substitute_dependency (elt, my_item);
if (my_item)
*/
if (announce_info_arr_[i].req_l_)
{
- Musical_req *m =dynamic_cast <Musical_req *> ( announce_info_arr_[i].req_l_);
- if (m && dynamic_cast <Rhythmic_req *> (m))
+ if (Rhythmic_req *rq = dynamic_cast <Rhythmic_req *> (announce_info_arr_[i].req_l_))
{
- musical_column_l_->add_duration (m->duration());
+ musical_column_l_->add_duration (rq->duration());
}
}
Engraver_group_engraver::do_announces();
for (int i =0; i < elem_p_arr_.size(); i++)
{
Score_element * elem_p = elem_p_arr_[i];
- if (dynamic_cast <Spanner *> (elem_p))
+ if (Spanner *s = dynamic_cast <Spanner *> (elem_p))
{
- Spanner *s = dynamic_cast <Spanner *> (elem_p);
pscore_p_->typeset_unbroken_spanner (s);
/*
{
bool gotcha = Engraver_group_engraver::do_try_request (r);
- if (gotcha || !dynamic_cast <Command_req *> (r))
- return gotcha;
-
- Command_req * c = dynamic_cast <Command_req *> (r);
- if (dynamic_cast <Break_req *> (c))
+ if (!gotcha)
{
- Break_req* b = (Break_req*)dynamic_cast <Break_req *> (c);
- if (b->penalty_i_ <= Break_req::DISALLOW)
- break_penalty_i_ = b->penalty_i_;
- else if (b->penalty_i_ >= Break_req::FORCE)
+ if (Break_req* b = dynamic_cast<Break_req *> (r))
{
- command_column_l_->break_penalty_i_ = b->penalty_i_;
- gotcha = true;
+ if (b->penalty_i_ <= Break_req::DISALLOW)
+ break_penalty_i_ = b->penalty_i_;
+ else if (b->penalty_i_ >= Break_req::FORCE)
+ {
+ command_column_l_->break_penalty_i_ = b->penalty_i_;
+ gotcha = true;
+ }
}
}
- return gotcha;
+ return gotcha;
+
}
IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver);
Score_engraver::do_add_processing ()
{
Translator_group::do_add_processing ();
- assert (output_def_l_->is_type_b (Paper_def::static_name ()));
+ assert (dynamic_cast<Paper_def *> (output_def_l_));
assert (!daddy_trans_l_);
pscore_p_ = new Paper_score;
pscore_p_->paper_l_ = (Paper_def*)output_def_l_;
void
Score_performer::play (Audio_element * p)
{
- if (p->is_type_b (Audio_item::static_name()))
+ if (dynamic_cast<Audio_item *> (p))
{
audio_column_l_->add_audio_item ((Audio_item*)p);
}
- else if (p->is_type_b (Audio_staff::static_name()))
+ else if (dynamic_cast<Audio_staff *> (p))
{
performance_p_->add_staff ((Audio_staff*)p);
}
Score_performer::do_add_processing ()
{
Translator_group::do_add_processing ();
- assert (output_def_l_->is_type_b (Midi_def::static_name ()));
+ assert (dynamic_cast<Midi_def *> (output_def_l_));
performance_p_ = new Performance;
performance_p_->midi_l_ = (Midi_def*) output_def_l_;
}
Don't try to eat up our (probable) parent.
*/
if (inf.origin_grav_l_arr_.size () <= 1 &&
- item_l->is_type_b (Break_align_item::static_name ()))
+ dynamic_cast<Break_align_item *> (item_l))
return;
for (int i=0; i < def_p_arr_.size (); i++)
{
if (no_paper_global_b
- && def_p_arr_[i]->is_type_b (Paper_def::static_name ()))
+ && dynamic_cast<Paper_def*>(def_p_arr_[i]))
continue;
run_translator (def_p_arr_[i]);
}
{
if (dynamic_cast <Item *> (o))
{
- script_l_arr_.substitute ((Script*)dynamic_cast <Item *> (o),(Script*) (n?dynamic_cast <Item *> (n):0));
- support_l_arr_.substitute (dynamic_cast <Item *> (o), (n?dynamic_cast <Item *> (n):0));
+ script_l_arr_.substitute (dynamic_cast<Script *> (o),
+ dynamic_cast <Script *> (n));
+ support_l_arr_.substitute (dynamic_cast <Item *> (o),
+ dynamic_cast <Item *> (n));
}
}
bool
Script_def::do_equal_b (General_script_def const *g) const
{
- Script_def const * c = (Script_def const*) g;
- return (symidx_str_ == c->symidx_str_ &&
+ Script_def const * c = dynamic_cast<Script_def const*> (g);
+ return c&& (symidx_str_ == c->symidx_str_ &&
rel_stem_dir_ == c->rel_stem_dir_&&
staff_dir_ == c->staff_dir_&&
invertsym_b_ == c->invertsym_b_);
if (!script_p->specs_p_->inside_b())
script_p->add_support (s_l);
- if (script_p->specs_p_->is_type_b (Text_def::static_name ()))
+ if (dynamic_cast<Text_def *> (script_p->specs_p_)) // UGH
{
Text_def * td_l = (Text_def*)script_p->specs_p_;
Scalar style = get_property ("textstyle");
Staff_side::do_substitute_dependency (o,n);
if (o == stem_l_)
{
- stem_l_ = n ? (Stem*)dynamic_cast <Item *> (n) : 0;
+ stem_l_ = dynamic_cast<Stem *> (n);
}
}
void
Separating_group_spanner::do_substitute_dependency (Score_element*o, Score_element*n)
{
- if (o->is_type_b (Single_malt_grouping_item::static_name ()))
+ if (dynamic_cast<Single_malt_grouping_item *> (o))
{
- Single_malt_grouping_item*ns = n ?
- (Single_malt_grouping_item*)dynamic_cast <Item *> (n) : 0;
- spacing_unit_l_arr_.substitute ((Single_malt_grouping_item*)dynamic_cast <Item *> (o), ns);
+ Single_malt_grouping_item*ns = dynamic_cast<Single_malt_grouping_item *> (n);
+ spacing_unit_l_arr_.substitute (dynamic_cast<Single_malt_grouping_item *> (o), ns);
}
}
Item * it = dynamic_cast <Item *> (i.elem_l_);
if (it && !it->axis_group_l_a_[X_AXIS])
{
- Single_malt_grouping_item *&p_ref_ (it->breakable_b_ ?
- break_malt_p_ : nobreak_malt_p_);
+ Single_malt_grouping_item *&p_ref_ (it->breakable_b_
+ ? break_malt_p_ : nobreak_malt_p_);
if (!p_ref_)
{
{
if (dynamic_cast <Item *> (o))
{
- item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o), n ? dynamic_cast <Item *> (n) : 0);
+ item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
+ dynamic_cast <Item *> (n));
}
}
Slur_engraver::do_try_request (Request *req_l)
{
Musical_req *mus_l = dynamic_cast <Musical_req *> (req_l);
- if (!mus_l || !dynamic_cast <Slur_req *> (mus_l))
- return false;
-
- new_slur_req_l_arr_.push (dynamic_cast <Slur_req *> (mus_l));
- return true;
+ if (Slur_req *sl = dynamic_cast <Slur_req *> (mus_l))
+ {
+ new_slur_req_l_arr_.push (dynamic_cast <Slur_req *> (mus_l));
+ return true;
+ }
+ return false;
}
void
Slur_engraver::acknowledge_element (Score_element_info info)
{
- if (info.elem_l_->is_type_b (Note_column::static_name ()))
+ if (dynamic_cast<Note_column *> (info.elem_l_))
{
- Note_column *col_l =(Note_column*) dynamic_cast <Item *> (info.elem_l_) ;// ugh
+ Note_column *col_l =dynamic_cast<Note_column *> (info.elem_l_) ;// ugh
for (int i = 0; i < slur_l_stack_.size(); i++)
slur_l_stack_[i]->add_column (col_l);
for (int i = 0; i < end_slur_l_arr_.size(); i++)
Slur::do_substitute_dependency (Score_element*o, Score_element*n)
{
int i;
- while ((i = encompass_arr_.find_i ((Note_column*)dynamic_cast <Item *> (o))) >=0)
+ while ((i = encompass_arr_.find_i (dynamic_cast<Note_column *> (o))) >=0)
{
if (n)
- encompass_arr_[i] = (Note_column*)dynamic_cast <Item *> (n);
+ encompass_arr_[i] = dynamic_cast<Note_column *> (n);
else
encompass_arr_.del (i);
}
{
int depth = i.origin_grav_l_arr_.size();
if (depth > 1
- && i.elem_l_->is_type_b (Bar::static_name()))
+ && dynamic_cast<Bar *> (i.elem_l_))
{
- bar_l_arr_.push ((Bar*)dynamic_cast <Item *> (i.elem_l_));
+ bar_l_arr_.push (dynamic_cast<Bar *> (i.elem_l_));
if (bar_l_arr_.size() >= 2 && !spanbar_p_)
/*
spanbar_p_-> type_str_ = bar_l_arr_[0]->type_str_;
}
}
- else if (i.elem_l_->is_type_b (Vertical_align_spanner::static_name())
+ else if (dynamic_cast<Vertical_align_spanner *> (i.elem_l_)
&& i.origin_grav_l_arr_.size() <= 2)
{
- valign_l_ = (Vertical_align_spanner*)dynamic_cast <Spanner *> (i.elem_l_);
+ valign_l_ = dynamic_cast<Vertical_align_spanner *> (i.elem_l_);
}
}
{
type_str_ = "";
}
-
-Span_bar*
-Span_bar::access_Span_bar ()
-{
- return this;
-}
Staff_group_bar_engraver::acknowledge_element (Score_element_info i)
{
Span_bar_engraver::acknowledge_element (i);
- if (i.elem_l_->is_type_b (Piano_brace::static_name ()))
+ if (dynamic_cast<Piano_brace *> (i.elem_l_))
{
Span_bar* b = dynamic_cast <Span_bar *> (i.elem_l_);
Piano_brace * piano_l = (Piano_brace*) b;
}
}
-Spanner*
-Spanner::access_Spanner ()
-{
- return this;
-}
-
Spanner::Spanner ()
{
unbroken_original_l_ =0;
#include "score-column.hh"
#include "paper-def.hh"
#include "colhpos.hh"
+#include "main.hh"
Vector
Spring_spacer::default_solution() const
void
Spring_spacer::solve (Column_x_positions*positions) const
{
-
DOUT << "Spring_spacer::solve ()...";
- Vector solution_try;
+ Vector solution_try;
+
bool constraint_satisfaction = try_initial_solution_and_tell (solution_try);
if (constraint_satisfaction)
{
make_matrices (lp.quad_,lp.lin_, lp.const_term_);
make_constraints (lp);
set_fixed_cols (lp);
-
+
Vector solution_vec (lp.solve (solution_try));
-
+
positions->satisfies_constraints_b_ = check_constraints (solution_vec);
if (!positions->satisfies_constraints_b_)
{
{
positions->set_stupid_solution (solution_try);
}
+
DOUT << "Finished Spring_spacer::solve ()...";
}
if (!it
|| script_p_
- || !it->is_type_b (Bar::static_name())
+ || !(dynamic_cast<Bar *> (it))
|| (i.origin_grav_l_arr_.size() != 1))
return;
void
Staff_performer::play (Audio_element* p)
{
- if (p->is_type_b (Audio_item::static_name ()))
+ if (dynamic_cast<Audio_item *> (p))
{
audio_staff_p_->add_audio_item ( (Audio_item*)p);
}
void
Stem_engraver::acknowledge_element(Score_element_info i)
{
- if (i.elem_l_->is_type_b (Rhythmic_head::static_name()))
+ if (dynamic_cast<Rhythmic_head *> (i.elem_l_))
{
- Rhythmic_head *h = (Rhythmic_head*) dynamic_cast <Item *> (i.elem_l_);
+ Rhythmic_head *h = dynamic_cast<Rhythmic_head *> (i.elem_l_);
if (!stem_p_)
{
Rhythmic_req * r = dynamic_cast <Rhythmic_req *> (i.req_l_);
Stem::add_head (Rhythmic_head *n)
{
n->add_dependency (this); // ?
- if (n->is_type_b (Note_head::static_name ()))
+ if (dynamic_cast<Note_head *> (n))
{
head_l_arr_.push ((Note_head*)n);
}
- else if (n->is_type_b (Rest::static_name ()))
+ else if (dynamic_cast<Rest *> (n))
{
rest_l_arr_.push ((Rest*)n);
}
Symtables::~Symtables()
{
- for (Dictionary_iter< Symtable*> i (*this); i.ok(); i++)
+ for (Dictionary_iter<Symtable*> i (*this); i.ok(); i++)
{
delete i.val();
}
{
error (_f ("Symtable `%s\' unknown", s));
/*
- We can 't return, because we'll dump core anyway.
+ We can 't return, because we would dump core anyway.
*/
return 0;
}
else
- return Dictionary<Symtable*>::operator[](s);
+ return elem(s);
}
void
Symtables::print() const
bool
Text_def::do_equal_b (General_script_def const *gdef) const
{
- Text_def const *def= (Text_def*)gdef;
- return align_dir_ == def->align_dir_ && text_str_ == def->text_str_
+ Text_def const *def= dynamic_cast<Text_def const*>(gdef);
+ return def&& align_dir_ == def->align_dir_ && text_str_ == def->text_str_
&& style_str_ == def->style_str_;
}
Text_item::get_position_f () const
{
// uhuh, tdef/gdef?
- if ( (tdef_p_->name () != Text_def::static_name ())
- || ( ( (Text_def*)tdef_p_)->style_str_ != "finger"))
- return Staff_side::get_position_f ();
+ if (Text_def *tdl = dynamic_cast<Text_def*>(tdef_p_))
+ {
+ if (tdl->style_str_ != "finger") // HUHH?
+ return Staff_side::get_position_f ();
+ }
if (!dir_)
{
void
Tie::do_substitute_dependency (Score_element*o, Score_element*n)
{
- Note_head *new_l =n?(Note_head*)dynamic_cast <Item *> (n):0;
+ Note_head *new_l =n?dynamic_cast<Note_head *> (n):0;
if (dynamic_cast <Item *> (o) == head_l_drul_[LEFT])
head_l_drul_[LEFT] = new_l;
else if (dynamic_cast <Item *> (o) == head_l_drul_[RIGHT])
bool
Ties_engraver::do_try_request (Request*req)
{
- if (! dynamic_cast <Musical_req *> (req))
- return false;
-
- if(Tie_req * r= dynamic_cast <Tie_req *> (req))
+ if (Tie_req * r = dynamic_cast <Tie_req *> (req))
{
req_l_ = r;
return true;
{
if (!req_l_ && ! end_req_l_)
return;
- if (i.elem_l_->is_type_b (Note_head::static_name ()))
+ if (Note_head * h = dynamic_cast <Note_head *> (i.elem_l_))
{
- Note_head * h = dynamic_cast <Note_head *> (i.elem_l_);
Melodic_req *m = dynamic_cast <Melodic_req *> (i.req_l_);
head_mel_tuple_arr_.push (Head_melodic_tuple (h, m));
Time_signature_engraver::do_process_requests()
{
Translator * result =
- daddy_grav_l()->get_simple_translator (Timing_engraver::static_name());
+ daddy_grav_l()->get_simple_translator (Timing_engraver::static_name ()); // ugh
if (!result)
{
return ;
}
- Timing_engraver * timing_grav_l= (Timing_engraver*) dynamic_cast <Engraver *> (result);
+ Timing_engraver * timing_grav_l= dynamic_cast<Timing_engraver *> (result);
Time_signature_change_req *req = timing_grav_l->time_signature_req_l();
if (req)
bool
Timing_translator::do_try_request(Request*r)
{
- Command_req * c = dynamic_cast <Command_req *> (r);
- if (!(c && dynamic_cast <Timing_req *> (c)))
- return false;
- for (int i=0; i < timing_req_l_arr_.size (); i++)
+ if (Timing_req *t = dynamic_cast <Timing_req *> (r))
{
- if (timing_req_l_arr_[i]->equal_b(r))
- return true;
- if (timing_req_l_arr_[i]->name() == r->name())
+ for (int i=0; i < timing_req_l_arr_.size (); i++)
{
- r->warning (_ ("conflicting timing request"));
- return false;
+ if (timing_req_l_arr_[i]->equal_b(t))
+ return true;
+ if (timing_req_l_arr_[i]->name() == r->name())
+ {
+ r->warning (_ ("conflicting timing request"));
+ return false;
+ }
}
+
+ timing_req_l_arr_.push(t);
+ return true;
}
-
- timing_req_l_arr_.push(dynamic_cast <Timing_req *> (c));
- return true;
+ return false;
}
+/*ugh.
+ */
Time_signature_change_req*
Timing_translator::time_signature_req_l() const
{
for (int i=0; i < timing_req_l_arr_.size (); i++)
{
Timing_req * tr_l = timing_req_l_arr_[i];
- Time_signature_change_req *m_l = dynamic_cast <Time_signature_change_req *> (tr_l);
- if (m_l)
+
+ if (Time_signature_change_req *m_l = dynamic_cast <Time_signature_change_req *> (tr_l))
{
int b_i= m_l->beats_i_;
int o_i = m_l->one_beat_i_;
Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
}
}
- else if (dynamic_cast <Partial_measure_req *> (tr_l))
+ else if (Partial_measure_req *pm = dynamic_cast <Partial_measure_req *> (tr_l))
{
- Moment m = dynamic_cast <Partial_measure_req *> (tr_l)->duration_;
+ Moment m = pm->duration_;
String error = time_.try_set_partial_str (m);
if (error.length_i ())
{
}
}
- else if (dynamic_cast <Cadenza_req *> (tr_l))
+ else if (Cadenza_req *cr = dynamic_cast <Cadenza_req *> (tr_l))
{
- time_.set_cadenza (dynamic_cast <Cadenza_req *> (tr_l)->on_b_);
+ time_.set_cadenza (cr->on_b_);
}
- else if (dynamic_cast <Measure_grouping_req *> (tr_l))
+ else if (Measure_grouping_req *mg=dynamic_cast <Measure_grouping_req *> (tr_l))
{
default_grouping_ =
- parse_grouping (dynamic_cast <Measure_grouping_req *> (tr_l)->beat_i_arr_,
- dynamic_cast <Measure_grouping_req *> (tr_l)->elt_length_arr_);
+ parse_grouping (mg->beat_i_arr_,
+ mg->elt_length_arr_);
}
}
{
timing_req_l_arr_.set_size (0);
Global_translator *global_l =
- daddy_trans_l_->ancestor_l (100)->global_l (); // ugh 100.
+ dynamic_cast<Global_translator*> (daddy_trans_l_->ancestor_l (100)); // ugh 100.
/* allbars == ! skipbars */
bool
Type_swallow_translator::do_try_request (Request*r)
{
- if (type_&&r->is_type_b (type_))
- return true;
- return false;
+ // if (type_ && type_->before (typeid( *r))) //
+ // return true;
+ return false; // ugh. FIXME.
}
IMPLEMENT_IS_TYPE_B1(Type_swallow_translator, Translator);
Vertical_align_engraver::acknowledge_element (Score_element_info i)
{
if (i.origin_grav_l_arr_.size() == 1 &&
- i.elem_l_->is_type_b (Vertical_group_spanner::static_name()) &&
+ dynamic_cast<Vertical_group_spanner *> (i.elem_l_) &&
!i.elem_l_->axis_group_l_a_[Y_AXIS])
{
assert (!valign_p_->contains_b (i.elem_l_));
# you do make dist
#
-# urg, ambiguous and thus error prone; hardcode all $(*scripts) to bin?
-buildscripts = $(depth)/bin
-scripts = $(depth)/bin
+buildscripts = $(depth)/buildscripts
+
flower-dir = $(depth)/flower
lib-dir = $(depth)/lib
-LILYPOND_INCLUDES = $(include-lib) $(depth)/lib/$(outdir) $(include-flower) $(depth)/flower/$(outdir)
+LILYPOND_INCLUDES = -Istinho $(include-lib) $(depth)/lib/$(outdir) $(include-flower) $(depth)/flower/$(outdir)
# should use to create .spec ?
-export PATH:=$(topdir)/lily/out:$(topdir)/$(buildscripts)/out:$(PATH)
+export PATH:=$(topdir)/lily/out:$(topdir)/buildscripts/out:$(PATH)
export MFINPUTS:=$(topdir)/mf/$(PATHSEP)$(MFINPUTS)$(PATHSEP)$(PATHSEP)
export TEXINPUTS:=$(topdir)/tex/$(PATHSEP)$(TEXINPUTS)$(PATHSEP)$(PATHSEP)
export LILYINCLUDE:=$(topdir)/init$(PATHSEP)$(topdir)/mf/out$(PATHSEP)$(LILYINCLUDE)
make prefix="$RPM_BUILD_ROOT/usr" install
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
-cp bin/out/lilypond-profile $RPM_BUILD_ROOT/etc/profile.d/lilypond.sh
-cp bin/out/lilypond-login $RPM_BUILD_ROOT/etc/profile.d/lilypond.csh
+cp buildscripts/out/lilypond-profile $RPM_BUILD_ROOT/etc/profile.d/lilypond.sh
+cp buildscripts/out/lilypond-login $RPM_BUILD_ROOT/etc/profile.d/lilypond.csh
%files
mv $(notdir $@) $(outdir)
$(outdir)/%.mudtex: %.doc
- $(PYTHON) $(depth)/$(scripts)/mudela-book.py --outdir=$(outdir)/ --outname=$(notdir $@) $<
+ $(PYTHON) $(depth)/scripts/mudela-book.py --outdir=$(outdir)/ --outname=$(notdir $@) $<
.PRECIOUS: $(outdir)/%.dvi
$(outdir)/%.dvi: %.ly
- $(PYTHON) $(depth)/$(scripts)/ly2dvi.py -o $(outdir) $<
+ $(PYTHON) $(depth)/scripts/ly2dvi.py -o $(outdir) $<
-mv $(basename $<).midi $(outdir)
$(outdir)/%.dvi: %.fly
- $(PYTHON) $(depth)/$(scripts)/ly2dvi.py -o $(outdir) $<
+ $(PYTHON) $(depth)/scripts/ly2dvi.py -o $(outdir) $<
-mv $(basename $<).midi $(outdir)
$(LOOP)
local-convert-mudela:
- $(PYTHON) $(depth)/$(scripts)/convert-mudela.py -e *ly
+ $(PYTHON) $(depth)/scripts/convert-mudela.py -e *ly
Begin3
Titel: LilyPond
-Versie: 1.1.0
-Inschrijf datum: 23OCT98
+Versie: 1.1.1
+Inschrijf datum: 02NOV98
Beschrijving: @FLAPTEKST@
Trefwoorden: muziek typezetten midi notatie
Auteur: hanwen@stack.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Onderhouden door: hanwen@cs.ruu.nl (Han-Wen Nienhuys)
Voornaamste plek: sunsite.unc.edu /pub/Linux/apps
- 770k lilypond-1.1.0.tar.gz
+ 770k lilypond-1.1.1.tar.gz
Oorspronkelijke plek: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 770k lilypond-1.1.0.tar.gz
+ 770k lilypond-1.1.1.tar.gz
Copi-eer voorwaarden: GPL
End
Begin3
Title: LilyPond
-Version: 1.1.0
-Entered-date: 23OCT98
+Version: 1.1.1
+Entered-date: 02NOV98
Description:
LilyPond is the GNU Project music typesetter. This program can print
beautiful sheet music from a music definition file. It can also play
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 770k lilypond-1.1.0.tar.gz
+ 770k lilypond-1.1.1.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 770k lilypond-1.1.0.tar.gz
+ 770k lilypond-1.1.1.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.1.0
+Version: 1.1.1
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.0.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.1.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
Packager: Han-Wen Nienhuys <hanwen@cs.uu.nl>
# descent order into subdirectories:
#
-SUBDIRS = bin flower lib lily mf mi2mu po debian \
+SUBDIRS = scripts buildscripts flower lib lily mf mi2mu po debian \
Documentation init input tex make mutopia test intl stepmake\
- ps
+ ps
#
SCRIPTS = configure aclocal.m4
--- /dev/null
+# bin/Makefile
+
+depth = ..
+SEXECUTABLES=convert-mudela mudela-book ly2dvi
+STEPMAKE_TEMPLATES=script
+
+
+include $(depth)/make/stepmake.make
+
+include $(stepdir)/executable-targets.make
+
+
--- /dev/null
+#!@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.4'
+
+
+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:
+ try:
+ os.remove(infile_name + '~')
+ except:
+ pass
+ 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
--- /dev/null
+#!/bin/sh
+#
+# Script to make a LaTeX file for Lilypond
+#
+# Written by Jan Arne Fagertun <Jan.A.Fagertun@energy.sintef.no>
+# 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 <jvromans@squirrel.nl> 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
+#
--- /dev/null
+#!@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)
+
+\f
+
+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')
+
+
+\f
+
+class Properties:
+ """
+ This class handles all ly2dvi.py property manipulation
+
+ Public methods:
+
+ __init__() Constructor
+ set<property> 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'), 'share',
+ 'lilypond', 'tex' ) + t
+
+ t=''
+ if os.environ.has_key ('MFINPUTS'):
+ t = os.pathsep + os.environ['MFINPUTS']
+ os.environ['MFINPUTS'] = os.path.join(this.get('root'), 'share',
+ 'lilypond', 'mf' ) + t
+
+ 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'), 'share', 'lilypond',
+ 'tex', 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'), 'share', 'lilypond',
+ 'tex', 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','ly'), \
+ 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]])
+
+\f
+
+#
+# Misc functions
+#
+
+def getLilyopts():
+ inc = ''
+ if len(Props.get('include')) > 0:
+ inc = '-I ' + string.join(Props.get('include'),os.pathsep)
+ 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('^Paper 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'
+ )
+
+\f
+
+#
+# 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()
--- /dev/null
+#!@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()
+pl 60
+ - small fixes.
+
pl 59
- bf: package-diff (remove missing automatic)
- install templates, (urg) INSTALL*1,2 INSTALL_OUT*1,2
rm -f ${srcdir}/config.cache
PYTHON=${PYTHON:-python} ${srcdir}/configure --prefix=${distdir} \
- --srcdir=${srcdir} \
- --enable-tex-prefix=${distdir}/texmf \
- --enable-tex-dir=${distdir}/texmf/tex \
- --enable-mf-dir=${distdir}/texmf/mf
+ --srcdir=${srcdir}
if ! make ; then
echo "make failed"
#
# Rename python files to <filename>.py
#
-mv $distdir/bin/ly2dvi32 $distdir/bin/ly2dvi.py
+mv $distdir/bin/ly2dvi $distdir/bin/ly2dvi.py
mv $distdir/bin/convert-mudela $distdir/bin/convert-mudela.py
mv $distdir/bin/mudela-book $distdir/bin/mudela-book.py
#
mkdir $distdir/doc
cp Documentation/man/out/*.txt $distdir/doc
-mv $distdir/doc/ly2dvi32.txt $distdir/doc/ly2dvi_py.txt
+mv $distdir/doc/ly2dvi32.txt $distdir/doc/ly2dvi.txt
cd $distdir/..
$ZIP_CMD $ZIP_FILE $name
echo "Wrote $ZIP_FILE"
YY_FILES := $(wildcard *.yy)
LL_FILES := $(wildcard *.ll)
-SOURCE_FILES+=$(YY_FILES) $(CC_FILES) $(INL_FILES) $(TCC_FILES) $(HH_FILES) $(LL_FILES)
-O_FILES+=$(addprefix $(outdir)/, $(YY_FILES:.yy=.o) $(CC_FILES:.cc=.o) $(LL_FILES:.ll=.o))
+SOURCE_FILES+= $(CC_FILES) $(YY_FILES) $(INL_FILES) $(TCC_FILES) $(HH_FILES) $(LL_FILES)
+O_FILES+=$(addprefix $(outdir)/, $(CC_FILES:.cc=.o) $(LL_FILES:.ll=.o) $(YY_FILES:.yy=.o))
TAGS_FILES += $(TCC_FILES) $(HH_FILES) $(INL_FILES) $(CC_FILES)
# empty
LDFLAGS = $(ILDFLAGS) $(USER_LDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS)
-MODULE_LIBES=$(addsuffix /$(outdir)/library.a, $(MODULE_LIBS))
+MODULE_LIBES := $(addsuffix /$(outdir)/library.a, $(MODULE_LIBS)) $(MODULE_LIBES)
LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES)
#
ARFLAGS = ru
-INCLUDES = include $(outdir) $($(PACKAGE)_INCLUDES)
+INCLUDES = include $(outdir) $($(PACKAGE)_INCLUDES) $(MODULE_INCLUDES)
# urg: for windows ?
# LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES) -lstdc++
pks: $(addprefix $(outdir)/, $(XPM_FONTS:%=%.$(XPM_RESOLUTION)pk))
xpms: $(addprefix $(outdir)/, $(XPM_FONTS:%=%.afm)) pks
- $(SHELL) $(depth)/$(buildscripts)/mf-to-xpms.sh $(XPM_FONTS)
+ $(SHELL) $(depth)/buildscripts/mf-to-xpms.sh $(XPM_FONTS)
# to the metapost mfplain guru, really does 200dpi, iso 600dpi (minimun)
-$(METAPOST) "&mfplain \mode=lowres; \mag=100.0; batchmode; input $<"
# -$(METAPOST) "&mfmp \mode=ljfour; \mag=100.0; batchmode; input $<"
- $(PYTHON) $(depth)/$(buildscripts)/ps-to-pfa.py $<
+ $(PYTHON) $(depth)/buildscripts/ps-to-pfa.py $<
rm -f $(basename $(@F)).[0-9]*
rm -f $(basename $<).log $(basename $<).tfm