* Bugfix: Pitch::transpose ().
-1.3.134.jcn1
-============
-
* Small doco update.
* Silly build and website-build fixes.
* convert-ly: added conversions, converted glossary, refman and examples.
+1.3.134.hwn1
+============
+
+* Rewrote ly2dvi, moved the old one to buildscripts/. The result is
+490 lines code in stead of 1230.
+
+* Modified kpathsea lookup so it will find system-installed feta TFMs first.
+Now lily doesn't clutter the CWD with .TFM files. Kpathsea is fun if you like
+pasta.
+
1.3.133.jcn5
============
in the output (@TeX{}) files, and latex is finally run to create
one or more DVI files.
-The majority of this utility came from a bourne script written by Jan
-Arne Fagertun name @file{ly2dvi}.
-
@subsection Invoking ly2dvi
@example
@unnumberedsec Options
@table @code
-@item -D,--debug
- Set debug mode. There are two levels - in level one some debug
- info is written, in level two the command @strong{set -x} is run, which
- echoes every command in the ly2dvi script.
-@item -F,--headers=
- Name of additional La@TeX{} headers file. This is included in the
- tex file at the end of the headers, last line before @code{\begin@{document@}}
-@item -H,--Heigth=
- Set paper heigth (points). Used together with width and La@TeX{} name of
- papersize in case of papersize unknown to ly2dvi.
-@item -K,--keeplilypond
- Keep LilyPond output after the run.
-@item -L,--landscape
- Set landscape orientation - portrait is the default.
- Use together with @code{dvips -t landscape} if you run dvips
- separately.
-@item -N,--nonumber
- Switch off page numbering.
-@item -O,--orientation=
- Set orientation landscape - obsolete, use @strong{-L} instead.
+@item -s,--set=@var{KEY}=@var{VAL}
+ Add @var{key}= @var{val} to the settings, overriding those specified
+in the files. Possible keys: language, latexheaders, latexpackages,
+papersizename, pagenumber, linewidth, orientation, textheight.
+
+@item -k,--keep
+ Keep the temporary directory including LilyPond and ly2dvi output
+files. The temporary directory is created in the current directory as @code{ly2dvi.dir}.
@item -P,--postscript
- In addition to the DVI file, also Generate a postsript file.
-@item -W,--Width=
- Set paper width (points). Used together with heigth and La@TeX{} name of
- papersize in case of papersize unknown to ly2dvi.
-@item -d,--dependencies
- Tell LilyPond to make dependencies file.
+ Generate PostScript in stead of DVI.
+@item --no-lily
+ Do not run LilyPond; useful for debugging ly2dvi.
@item -h,--help
Print help.
-@item -k,--keeply2dvi
- Keep the La@TeX{} file after the run.
-@item -l,--language=
- Specify La@TeX{} language.
- (@strong{-l norsk} produces @code{\usepackage[norsk]@{babel@}}).
-@item -o,--output=
- Set output directory.
-@item -p,--papersize=
- Specify papersize.
- (@strong{-p a4} produces @code{\usepackage[a4paper]@{article@}})
-@item -s,--separate
- Normally all output files are included into one La@TeX{} file.
- With this switch all files are run separately, to produce one
- DVI file for each.
-@end table
-
-
-@subsection Features
-
-Ly2dvi responds to several parameters specified in the LilyPond
-file. They are overridden by corresponding command line options.
+@item -I,--include
+ Add to the lilypond include path.
+@item -d,--dependencies
+ Make a dependency file for the output.
+@item --outdir=@var{dir}
+ Generate output (including MIDI files) in @var{dir}
-@table @code
-@item language="";
- Specify La@TeX{} language
-@item latexheaders="";
- Specify additional La@TeX{} headers file
-@item orientation="";
- Set orientation.
-@item paperlinewidth="";
- Specify the width (pt, mm or cm) of the printed lines.
-@item papersize="";
- Specify name of papersize.
@end table
-@subsection Environment
-
-@table @code
-@item LILYPONDPREFIX
- Sets the root directory of the LilyPond installation
-@item LILYINCLUDE
- Additional directories for input files.
-@item TMP
- Temporary directory name. Default is /tmp
-@end table
+@subsection Titling layout
-@subsection Files
-
-@file{titledefs.tex} is inspected for definitions used to extract
-additional text definitions from the LilyPond file. In the current
-version the following are defined:
+Ly2dvi extracts the following header fields from the .ly files to
+generate titling:
@table @code
@item title
Name of the piece, leftflushed below the instrument
@end table
-@file{$LILYPONDPREFIX/share/.lilyrc $HOME/.lilyrc ./.lilyrc} are files
-to set up default running conditions. On Windows OS initialization
-files are named @file{_lilyrc}. The file syntax is as follows:
-@example
-VARIABLE-NAME=VALUE
-@end example
-
+@subsection Additional parameters
-Where @strong{VARIABLE-NAME} is the name of the variable documented below
-and @strong{VALUE} is either a string, a 1, or a 0. All files are parsed,
-in the shown sequence. In the current version the following are
-allowed:
+Ly2dvi responds to several parameters specified in the LilyPond
+file. They can be overridden by supplying the @code{--set} command line
+option.
@table @code
-@item DEBUG=value
-This turns off (default) or on the debug capabilities. Possible
-values are 0 (off) and 1 (on).
-@item DEPENDENCIES=value
-This turns off (default) or on the ability to generate a Makefile
-dependency list. Possible values are 0 (off) and 1 (on).
-@item KEEPLILYPOND=value
-This turns off (default) or on the ability to keep the log file
-associated with the LilyPond job. Possible values are 0 (off) and 1
-(on).
-@item KEEPLY2DVI=value
-This turns off (default) or on the ability to keep the temporary files
-that are generated by the ly2dvi job. Possible values are 0 (off) and
-1 (on)
-@item LANGUAGE=value
-Specify La@TeX{} language. Possible value is a valid La@TeX{} language.
-@item LATEXHF=value
-Specify additional La@TeX{} headers file. Possible value is a file
-specification.
-@item LILYINCLUDE=value
-Additional directories for input files. Possible value is a delimited
-directory path list.
-@item LILYPONDPREFIX=value
-This defines the LilyPond root directory. Possible value is a valid
-directory specification to the LilyPond distribution location.
-@item NONUMBER=value
-This turns off (default) or on the page numbering capability.
-Possible values are 0 (page numbering enabled) and 1 (page numbering
-disabled).
-@item ORIENTATION=value
-This sets the image orientation. Possible values are
-portrait (default) and landscape.
-@item OUTPUTDIR=value
-This defines the directory where the resultant files will be
-generated. Possible value is a valid directory specification.
-Default is the current working directory.
-@item PAPERSIZE=value
-This defines the papersize the image will be sized to fit. Possible
-values are a0, a1, a2, a3, a4 (default), a5, a6, a7, a8, a9, a10, b0,
-b1, b2, b3, b4, b5, archA, archB, archC, archD, archE, flsa, flse,
-halfletter, ledger, legal, letter, or note.
-@item PHEIGHT=value
-Specify paperheight (points - an inch is 72.27, a cm is 28.453 points).
-@item POSTSCRIPT=value
-This turns off (default) or on the capability of additionally
-generating a postscript file. Possible values are 0 (off) and 1 (on).
-@item PWIDTH=value
-Specify paperwidth (points - an inch is 72.27, a cm is 28.453 points).
-@item SEPARATE=value
-This turns off (default) or on the capability of generating multiple
-dvi and postscript files from multiple source files. The default is
-to generate a concatenation of the source files. Possible values are
-0 (single file) and 1 (separate files).
-@item TMP=value
-This defines the emporary directory. Actually this is not used at the
-present. Possible value is a valid directory specification that is
-writable to the user.
-@end table
+@item language
+ Specify La@TeX{} language: the @code{babel} package will be
+included. Default: unset.
-@subsection Initialization Sequence
-The initialization process reads inputs for several sources. Below is
-a list of priorities for lowest to hightest proirity.
+ Read from the @code{\header} block.
-[FIXME: should use ly2dvirc iso lilyrc]
+@item latexheaders
+ Specify additional La@TeX{} headers file.
-@itemize @bullet
-@item Program's defaults
-@item Values found in LilyPond output file
-@item Environment variables
-@item $LILYPONDPREFIX/share/lilypond/.lilyrc
-@item $HOME/.lilyrc
-@item ./.lilyrc
-@item command line options
-@end itemize
+ Normally read from the @code{\header} block. Default value: empty
-@subsection Bugs
+@item latexheaders
+ Specify additional La@TeX{} packages file. This works cumulative,
+so you can add multiple packages using multiple @code{-s=latexpackages} options.
+ Normally read from the @code{\header} block. Default value:
+@code{geometry}.
-If find something that you consider a bug, please send a bugreport (See
-@ref{Bug reports}) to @email{bug-gnu-music@@gnu.org}.
+@item orientation
+ Set orientation. Choices are @code{portrait} or @code{landscape}. Is
+read from the @code{\paper} block, if set.
+
+@cindex
+@item linewidth
+ Is read from the @code{\paper} block.
-@subsection Remarks
+@item papersizename
+ Specify name of papersize. Is read from the @code{\paper} block.
+@end table
-Many papersizes are now supported. Information on other sizes
-(La@TeX{} names, horizontal and vertical sizes) should be mailed to
-the author or to the mailing list.
+@subsection Bugs
-Supported papersizes are:
+Assumes that settings for LilyPond are correct. Assumes that @code{cp}
+and @code{rm} are in the path.
-a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, archA, archB, archC, archD,
-archE, b0, b1, b2, b3, b4, b5, flsa, flse, halfletter, ledger, legal,
-letter, note
+If find something that you consider a bug, please send a bugreport (See
+@ref{Bug reports}) to @email{bug-gnu-music@@gnu.org}.
@subsection Authors
-Python Version author:
-@email{daboys@@austin.rr.com, Jeffrey B. Reed},
-@uref{http://home.austin.rr.com/jbr/jeff/lilypond/}
-Original bourne shell version author:
-@email{Jan.A.Fagertun@@energy.sintef.no, Jan Arne Fagertun},
-@uref{http://www.termo.unit.no/mtf/people/janaf/}
+@email{hanwen@@cs.uu.nl,Han-Wen Nienhuys}.
+
+Earlier incarnations of ly2dvi were written by
+@email{daboys@@austin.rr.com, Jeffrey B. Reed} (Python version), and
+@email{Jan.A.Fagertun@@energy.sintef.no, Jan Arne Fagertun} (Bourne
+shell version)
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=134
-MY_PATCH_LEVEL=jcn2
+PATCH_LEVEL=135
+MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
presome=${ac_default_prefix}
fi
DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
+
AC_SUBST(datadir)
AC_SUBST(DIR_DATADIR)
+
+ dnl yeah, so fuck me gently with a cactus: this doesnt belong here
+ dnl Please take the person responsible for inventing shell-scripts out
+ dnl and shoot him. On behalf of the sane world, thank you.
+ dnl DIR_SHAREDSTATEDIR="foobar"
+ dnl AC_SUBST(DIR_SHAREDSTATEDIR)
+
AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
])
--- /dev/null
+#!@PYTHON@
+
+
+# TODO:
+#
+# * Rewrite this. The control structure is too hairy.
+# * (c) on page 1
+# * more helpful info on lily crashes
+# * Should use files in /tmp/ only. This potentially messes with
+# user generated files in the CWD
+
+
+"""
+=======================================================================
+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 = '@TOPLEVEL_VERSION@'
+errorlog = ''
+
+import sys
+import os
+import getopt
+import re
+import string
+import time
+import glob
+import tempfile
+
+# Can't grep localized msgs
+os.environ['LC_ALL'] = ''
+os.environ['LANG'] = ''
+os.environ['LC_LANG'] = ''
+
+
+
+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, file.sly 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', '.sly']:
+ 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('% Generated automatically by: 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 ),
+ ( 'latexpackages', Props.setPackages ),
+ ( 'paperorientation', 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\\\\lilypond([\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:
+ __lilypondDefs(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 __lilypondDefs(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\\lilypond%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. Sets the linewidth (and possibly the
+ textheight) and leaves the page layout to the geometry
+ package. 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()))
+
+ # Only set the textheight if it was explicitly set by the user,
+ # otherwise use the default. Helps to handle landscape correctly!
+ if Props.get('textheight') > 0:
+ textheightsetting = ',textheight=' + `Props.get('textheight')` + 'pt'
+ else:
+ textheightsetting = ''
+
+
+ top= r"""
+%% Creator: %s
+%% Generated automatically by: %s, from %s, at %s
+
+\documentclass[%s]{article}
+
+%s
+\usepackage{geometry}
+\usepackage[latin1]{inputenc}
+%%\usepackage[T1]{fontenc}
+%%
+%% don not waste unused space at bottom of page
+%% (unless we have footnotes ...)
+%%\headheight9pt
+%%\headsep0pt
+%% Maybe this is too drastic, but let us give it a try.
+\geometry{width=%spt%s,headheight=2mm,headsep=0pt,footskip=2mm,%s}
+\input{titledefs}
+%s
+\makeatletter
+\renewcommand{\@oddhead}{\parbox{\textwidth}%%
+ {\mbox{}\small\theheader\hfill\textbf{\thepage}}}%%
+%% UGR.
+%%\renewcommand{\@evenhead}{eve!{\small\lilypondinstrument{,}\quad\textbf{\thepage}}\hfil}%%
+\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%%
+%s
+\begin{document}
+""" % ( program_id(), program_id(), Props.get('filename'), now, Props.get('papersize'),
+ Props.get('language'), Props.get('linewidth'), textheightsetting,
+ Props.get('orientation'), Props.get('header'), Props.get('pagenumber'))
+
+ base, ext = os.path.splitext(file)
+ this.__base = base
+ tempfile.template= base + '_ly'
+ this.__outfile = tempfile.mktemp(ext)
+ base, ext = os.path.splitext(this.__outfile)
+ this.__tmpbase = base
+ try:
+ this.__fd = open(this.__outfile,"w")
+ except:
+ sys.exit('ExitNoWrite', this.__outfile)
+ this.write(top)
+ this.__lilypondDefs('')
+ this.write("""\
+\\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\\lilypondopus{}%
+\\def\\lilypondpiece{}%
+""")
+ this.__lilypondDefs("\\def")
+ this.write("""\
+\\def\\theopus{\\lilypondopus}% ugh
+\\def\\thepiece{\\lilypondpiece}%
+\\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') != '':
+ if not os.path.exists(Props.get('output')):
+ os.mkdir(Props.get('output'))
+
+ outfile = os.path.join(Props.get('output'), outfile )
+
+ this.write(r"""
+%% \vfill\hfill{\lilypondtagline}
+\makeatletter
+\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\lilypondtagline}}%%
+\makeatother
+\end{document}
+""")
+ this.__fd.close()
+ if os.path.isfile(outfile):
+ os.remove(outfile)
+ 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 not os.path.isfile(outfile):
+ os.rename(this.__tmpbase + '.dvi', outfile)
+
+ sys.stderr.write('\n' + program_id() + ': dvi file name is %s\n\n'
+ % (outfile))
+
+ if Props.get('postscript'):
+ dvipsopts=''
+ if Props.get('orientation') == 'landscape':
+ dvipsopts=dvipsopts + ' -t landscape'
+ psoutfile=this.__base + '.ps'
+ if Props.get('output') != '':
+ psoutfile = os.path.join(Props.get('output'), psoutfile )
+ stat = os.system('dvips %s -o %s %s' % (dvipsopts,psoutfile,outfile))
+ if stat:
+ sys.exit('ExitBadPostscript')
+
+
+\f
+
+
+# ARG! THIS CODE IS BLOATED:
+# FIXME: Junk all set/get methods.
+
+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/.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 = {
+ 'papersize' : ['a4paper', this.__overrideTable['init']],
+ 'textheight' : [0, this.__overrideTable['init']],
+ 'linewidth' : [500, 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])
+ # bit silly. for ly2dvi, overrules compiled-in datadir...
+ # how to do this better (without running lily, of course?
+ this.setRoot(os.path.join(p[0],'share','lilypond'), '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 = os.pathsep
+ if os.environ.has_key ('TEXINPUTS'):
+ t = os.environ['TEXINPUTS'] + os.pathsep
+
+ ly2dvi_t = t + \
+ os.path.join(this.get('root'), 'tex' ) + \
+ os.pathsep + os.path.join(this.get('root'), 'ps' )
+ # Don't add the magic `//' to TEXINPUTS
+ ly2dvi_t = re.sub ('//*', '/', ly2dvi_t)
+ os.environ['TEXINPUTS'] = ly2dvi_t
+
+ m = ''
+ if os.environ.has_key ('MFINPUTS'):
+ m = os.environ['MFINPUTS']
+ ly2dvi_m = m + os.pathsep + \
+ os.path.join(this.get('root'), 'mf')
+ ly2dvi_m = re.sub ('//*', '/', ly2dvi_m)
+ # Don't add the magic `//' to MFINPUTS
+ os.environ['MFINPUTS'] = ly2dvi_m
+
+ if os.environ.has_key('TMP'):
+ this.__set('tmp',os.environ['TMP'],'environment')
+
+
+ def read_titledefs (this):
+ fd=this.get_texfile_path ('titledefs.tex')
+ mudefs=[]
+
+ for line in fd.readlines():
+ m=re.match('\\\\newcommand\*{\\\\lilypond([\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'), 'tex', var)
+ else:
+ path =''
+ cmd =('kpsewhich tex %s %s' % (var,errorlog))
+ sys.stderr.write ('executing: %s'% cmd)
+ pipe = os.popen (cmd, 'r')
+ path = pipe.readline ()[:-1] # chop off \n
+ return_status = pipe.close()
+ sys.stderr.write ('\n')
+ if return_status and not path:
+ path = os.path.join(this.get('root'), '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 ),
+ ( 'LATEXPKG', this.setPackages ),
+ ( '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'),'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('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.stderr.write ('ly2dvi: warning: ignoring linewidth: ' + size + '\n')
+
+ #
+ # 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','\\pagestyle{empty}',requester)
+ else:
+ this.__set('pagenumber','%',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','\\input{' + head + '}'+this.get('header'),requester)
+
+ #
+ # Set latex package name
+ #
+ def setPackages(this,pkgs, requester):
+ this.__set('header','\\usepackage{' + pkgs + '}'+this.get('header'),requester)
+
+ #
+ # Set or Clear Dependencies flag to generate makefile dependencies
+ #
+ def setDependencies(this, value, 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 lilypond 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
+ if os.name == 'nt' or os.name == 'dos':
+ path = unc2dos(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 = string.join (map (lambda x: '-I "%s"' % x, Props.get('include')))
+ dep=''
+ if Props.get('dependencies'):
+ dep=' --dependencies'
+ return inc + dep
+
+def writeLilylog(file,contents):
+ if Props.get('keeplilypond'):
+ base, ext = os.path.splitext(file)
+ tempfile.template=base + "_li"
+ file=tempfile.mktemp('.log')
+ 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 getDepFiles (log):
+ files=[]
+ for line in string.split (log,'\n'):
+ m = re.search ("dependencies output to (.+)\.\.\.", line)
+ if m:
+ files.append (m.group (1))
+ return files
+
+def unc2dos(path):
+ """
+ Convert a path of format //<drive>/this/that/the/other to
+ <drive>:\this\that\the\other
+ """
+ m=re.match('^//([A-Za-z])(/.*)$',path)
+ if m:
+ return m.group(1) + ':' + os.path.normpath(m.group(2))
+
+
+
+def program_id ():
+ return 'ly2dvi (GNU LilyPond) ' + version;
+
+
+def mailaddress():
+ try:
+ return os.environ['MAILADDRESS']
+ except KeyError:
+ return '(address unknown)'
+
+
+def identify ():
+ sys.stderr.write (program_id () + '\n')
+
+def print_version ():
+ sys.stdout.write (program_id () + '\n')
+
+def help ():
+ sys.stdout.write (
+"""Usage: %s [OPTION]... [FILE]...
+
+Generate dvi file from LilyPond source/output
+
+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 LilyPond\'s search path
+ -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)
+ -P,--postscript generate PostScript file
+ -W,--Width= set paper width (points) (see manual page)
+ -M,--dependencies tell LilyPond to make a dependencies file
+ -h,--help this help text
+ -k,--keeply2dvi keep ly2dvi output files
+ -l,--language= give LaTeX language (babel)
+ -o,--outdir= set output directory
+ --output= set output directory
+ -p,--papersize= give LaTeX papersize (eg. a4)
+ -s,--separate run all files separately through LaTeX
+
+files may be (a mix of) input to or output from LilyPond(1)
+""" % name)
+
+\f
+
+#
+# main
+#
+
+def main():
+ """Generate dvi files from LilyPond source/output"""
+
+ infile = Input()
+ outfile = TeXOutput()
+ texInputFiles=[]
+ tempfile.tempdir=""
+
+ (options, files) = getopt.getopt (sys.argv[1:],
+ 'DF:H:I:KLNPW:Mhkl:o:p:s',
+ ['debug', 'headers=', 'Height=',
+ 'include=', 'keeplilypond', 'landscape',
+ 'nonumber', 'Width=', 'dependencies',
+ 'help', 'keeply2dvi', 'language=',
+ 'outdir=', 'output=', 'version',
+ '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(1,'commandline')
+ elif o == '--Width' or o == '-W':
+ Props.setLineWidth(a,'commandline')
+ elif o == '--dependencies' or o == '-M':
+ Props.setDependencies(1,'commandline')
+ elif o == '--help' or o == '-h':
+ help()
+ sys.exit (0)
+ elif o == '--keeply2dvi' or o == '-k':
+ Props.setKeeply2dvi(1,'commandline')
+ elif o == '--language' or o == '-l':
+ Props.setLanguage(a,'commandline')
+ elif o == '--outdir' or o == '-o' or o == '--output':
+ 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')
+ elif o == '--version':
+ print_version ()
+ return 0
+ else:
+ print o
+ raise getopt.error
+
+ identify()
+ Props.read_titledefs ()
+
+ if len(files):
+ for file in files:
+ infile.open(file)
+ type = infile.type()
+ infile.close()
+ if type == 'source':
+ if os.environ.has_key('OS') and \
+ os.environ['OS'] == 'Windows_95':
+ cmd = 'ash -c "lilypond %s %s 2>&1"' %(getLilyopts(), file)
+ else:
+ cmd = 'lilypond %s %s 2>&1' % (getLilyopts(), file)
+ sys.stderr.write ('executing: %s\n'% cmd)
+
+ fd = os.popen(cmd , 'r')
+ log = ''
+
+ s = fd.readline()
+ while len(s) > 0:
+ sys.stderr.write (s)
+ sys.stderr.flush ()
+ log = log + s
+ s = fd.readline ()
+ if 0:
+ s = fd.read (1)
+ while len(s) > 0:
+ sys.stderr.write (s)
+ sys.stderr.flush ()
+ s = fd.read (1)
+ log = log + s
+ stat = fd.close()
+ if stat:
+ sys.exit('ExitBadLily', cmd )
+ texFiles=getTeXFile(log)
+ depFiles=getDepFiles (log)
+ writeLilylog(file,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) # allow for specified name
+ else:
+ outfile.next()
+ outfile.write("""\
+\\input{%s}
+""" % (file))
+ if Props.get('separate'):
+ outfile.end()
+ else:
+ firstfile=0
+ if not Props.get('separate'):
+ outfile.end()
+
+ # --outdir mess
+ if Props.get ('output'):
+ outdir=Props.get ('output')
+ for i in depFiles:
+ text=open (i).read ()
+ # ugh, should use lilypond -o DIR/foo.tex
+ # or --dep-prefix to fix dependencies
+ text=re.sub ('\n([^:]*).tex', '\n' + outdir + '/\\1.dvi', text)
+ text=re.sub (' ([^:]*).tex', ' ' + outdir + '/\\1.dvi', text)
+ open (os.path.join (outdir, i), 'w').write (text)
+ os.remove (i)
+
+ 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('*_ly[0-9]*.*')
+ for file in lilyfiles + tmpfiles:
+ if os.path.isfile(file):
+ os.remove(file)
+
+
+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()
+
+
+
+
-/* @configure_input@ */
+/* @AUTOGENERATE@ */
/* Hmm */
#define PACKAGE "@package@"
+/* define if bla bla /var and the like. */
+#define DIR_SHAREDSTATEDIR "@DIR_SHAREDSTATEDIR@"
+
+#define DIR_DATADIR "@DIR_DATADIR@"
+
/* default lilypond init and input dir */
#define DIR_DATADIR "@DIR_DATADIR@"
includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
+sharedstatedir = @sharedstatedir@
program_prefix = @program_prefix@
program_suffix = @program_suffix@
EXTRA_LIBES = @EXTRA_LIBES@ @LIBS@
TAR= @TAR@
TBL = @TBL@
TROFF = @TROFF@
-YODL= @YODL@
-YODL2HTML= @YODL2HTML@
-YODL2LATEX= @YODL2LATEX@
-YODL2LESS_DIR= @YODL2LESS_DIR@
-YODL2MAN= @YODL2MAN@
-YODL2MSLESS= @YODL2MSLESS@
-YODL2TEXINFO= @YODL2TEXINFO@
-YODL2TXT= @YODL2TXT@
ZIP = @ZIP@
presome=${ac_default_prefix}
fi
DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
+
+
+
cat >> confdefs.h <<EOF
#define DIR_DATADIR "${DIR_DATADIR}"
EOF
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1293: checking for $ac_word" >&5
+echo "configure:1296: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1323: checking for $ac_word" >&5
+echo "configure:1326: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1374: checking for $ac_word" >&5
+echo "configure:1377: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1406: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1409: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 1417 "configure"
+#line 1420 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1448: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1451: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1453: checking whether we are using GNU C" >&5
+echo "configure:1456: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1465: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1481: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1484: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# AC_HAVE_HEADERS(limits.h malloc.h string.h unistd.h values.h)
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1528: checking how to run the C preprocessor" >&5
+echo "configure:1531: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1543 "configure"
+#line 1546 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1560 "configure"
+#line 1563 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1577 "configure"
+#line 1580 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1611: checking for $ac_hdr" >&5
+echo "configure:1614: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1616 "configure"
+#line 1619 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1624: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:1648: checking whether stat file-mode macros are broken" >&5
+echo "configure:1651: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1653 "configure"
+#line 1656 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
fi
-
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:1714: checking how to run the C++ preprocessor" >&5
+echo "configure:1716: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 1727 "configure"
+#line 1729 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1769: checking for $ac_word" >&5
+echo "configure:1771: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1801: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1803: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 1812 "configure"
+#line 1814 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
-if { (eval echo configure:1817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1843: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1845: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1848: checking whether we are using GNU C++" >&5
+echo "configure:1850: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1857: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1876: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1878: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6
-echo "configure:1910: checking for FlexLexer.h" >&5
+echo "configure:1912: checking for FlexLexer.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1915 "configure"
+#line 1917 "configure"
#include "confdefs.h"
#include <FlexLexer.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking whether explicit instantiation is needed""... $ac_c" 1>&6
-echo "configure:1971: checking whether explicit instantiation is needed" >&5
+echo "configure:1973: checking whether explicit instantiation is needed" >&5
if eval "test \"`echo '$''{'lily_cv_need_explicit_instantiation'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1976 "configure"
+#line 1978 "configure"
#include "confdefs.h"
template <class T> struct foo { static int baz; };
return foo<int>::baz;
; return 0; }
EOF
-if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lily_cv_need_explicit_instantiation=no
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2013: checking for $ac_word" >&5
+echo "configure:2015: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2056: checking for $ac_word" >&5
+echo "configure:2058: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2091: checking for $ac_word" >&5
+echo "configure:2093: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2159: checking for $ac_word" >&5
+echo "configure:2161: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2192: checking for $ac_word" >&5
+echo "configure:2194: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking language""... $ac_c" 1>&6
-echo "configure:2248: checking language" >&5
+echo "configure:2250: checking language" >&5
case "$language" in
En* | en* | Am* | am* | US* | us*)
lang=English;;
echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
-echo "configure:2284: checking for gettext in -lintl" >&5
+echo "configure:2286: checking for gettext in -lintl" >&5
ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2292 "configure"
+#line 2294 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
gettext()
; return 0; }
EOF
-if { (eval echo configure:2306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in gettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2336: checking for $ac_func" >&5
+echo "configure:2338: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2341 "configure"
+#line 2343 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2399: checking for $ac_word" >&5
+echo "configure:2401: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
test -n "$MSGFMT" || MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh "
echo $ac_n "checking whether msgfmt accepts -o""... $ac_c" 1>&6
-echo "configure:2430: checking whether msgfmt accepts -o" >&5
+echo "configure:2432: checking whether msgfmt accepts -o" >&5
msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
if test "$msgfmt_output" = ""; then
echo "$ac_t""yes" 1>&6
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2458: checking for $ac_word" >&5
+echo "configure:2460: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_METAFONT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2494: checking for $ac_word" >&5
+echo "configure:2496: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MFONT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2532: checking for $ac_word" >&5
+echo "configure:2534: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_METAPOST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2568: checking for $ac_word" >&5
+echo "configure:2570: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MPOST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2607: checking for $ac_word" >&5
+echo "configure:2609: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_INIMETAFONT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2643: checking for $ac_word" >&5
+echo "configure:2645: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_INIMFONT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2681: checking for $ac_word" >&5
+echo "configure:2683: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_INIMETAPOST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2717: checking for $ac_word" >&5
+echo "configure:2719: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_INIMPOST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking for working metafont mode""... $ac_c" 1>&6
-echo "configure:2751: checking for working metafont mode" >&5
+echo "configure:2753: checking for working metafont mode" >&5
modelist='ljfour lj4 lj3 lj2 ljet laserjet'
for MFMODE in $modelist; do
$METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
echo "$ac_t""$MFMODE" 1>&6
echo $ac_n "checking for mfplain.mp""... $ac_c" 1>&6
-echo "configure:2762: checking for mfplain.mp" >&5
+echo "configure:2764: checking for mfplain.mp" >&5
#
# For now let people define these in their environments
#
echo "$ac_t""$MFPLAIN_MP" 1>&6
echo $ac_n "checking for inimetapost flags""... $ac_c" 1>&6
-echo "configure:2770: checking for inimetapost flags" >&5
+echo "configure:2772: checking for inimetapost flags" >&5
if test ${INIMETAPOST} = "inimp" ; then
: ${INIMETAPOST_FLAGS=''}
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2803: checking for $ac_word" >&5
+echo "configure:2805: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_KPSEWHICH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
test -n "$KPSEWHICH" || KPSEWHICH="no"
echo $ac_n "checking for tfm path""... $ac_c" 1>&6
-echo "configure:2834: checking for tfm path" >&5
+echo "configure:2836: checking for tfm path" >&5
TFM_FONTS="cmr msam"
## First, let's just see if we can find Guile at all.
echo $ac_n "checking "for guile-config"""... $ac_c" 1>&6
-echo "configure:2862: checking "for guile-config"" >&5
+echo "configure:2864: checking "for guile-config"" >&5
for guile_config in guile-config $target-guile-config $build-guile-config; do
echo "$ac_t"""$guile_config"" 1>&6
if ! $guile_config --version > /dev/null 2>&1 ; then
echo "configure: warning: "cannot execute $guile_config"" 1>&2
echo $ac_n "checking "if we are cross compiling"""... $ac_c" 1>&6
-echo "configure:2868: checking "if we are cross compiling"" >&5
+echo "configure:2870: checking "if we are cross compiling"" >&5
guile_config=error
else
break
exit 1
fi
echo $ac_n "checking "Guile version"""... $ac_c" 1>&6
-echo "configure:2879: checking "Guile version"" >&5
+echo "configure:2881: checking "Guile version"" >&5
need_guile_version="1.3.4"
need_guile_version_numeric=100304
guile_version=`$guile_config --version 2>&1 | awk '{print $NF}'`
## The GUILE_FLAGS macro.
echo $ac_n "checking for Guile""... $ac_c" 1>&6
-echo "configure:2898: checking for Guile" >&5
+echo "configure:2900: checking for Guile" >&5
if ! $guile_config link > /dev/null ; then
echo "$ac_t"""cannot execute $guile_config"" 1>&6
{ echo "configure: error: "cannot find guile-config; is Guile installed?"" 1>&2; exit 1; }
# Extract the first word of "guile", so it can be a program name with args.
set dummy guile; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2913: checking for $ac_word" >&5
+echo "configure:2915: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GUILE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2963: checking for $ac_hdr" >&5
+echo "configure:2965: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2968 "configure"
+#line 2970 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2973: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for kpse_find_file in -lkpathsea""... $ac_c" 1>&6
-echo "configure:3000: checking for kpse_find_file in -lkpathsea" >&5
+echo "configure:3002: checking for kpse_find_file in -lkpathsea" >&5
ac_lib_var=`echo kpathsea'_'kpse_find_file | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkpathsea $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3008 "configure"
+#line 3010 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
kpse_find_file()
; return 0; }
EOF
-if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in kpse_find_file
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3055: checking for $ac_func" >&5
+echo "configure:3057: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3060 "configure"
+#line 3062 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:3086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
fi
echo $ac_n "checking whether to use kpathsea""... $ac_c" 1>&6
-echo "configure:3115: checking whether to use kpathsea" >&5
+echo "configure:3117: checking whether to use kpathsea" >&5
if test $kpathsea_b = yes; then
echo "$ac_t""yes" 1>&6
KPATHSEA=1
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3136: checking for $ac_word" >&5
+echo "configure:3138: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_BIBTEX2HTML'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:3177: checking for 8-bit clean memcmp" >&5
+echo "configure:3179: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 3185 "configure"
+#line 3187 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
}
EOF
-if { (eval echo configure:3198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:3216: checking for vprintf" >&5
+echo "configure:3218: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3221 "configure"
+#line 3223 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:3271: checking for _doprnt" >&5
+echo "configure:3273: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3276 "configure"
+#line 3278 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:3302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
for ac_func in memmem snprintf vsnprintf gettext isinf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3329: checking for $ac_func" >&5
+echo "configure:3331: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3334 "configure"
+#line 3336 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:3360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3399: checking for $ac_word" >&5
+echo "configure:3401: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3432: checking for $ac_word" >&5
+echo "configure:3434: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
AC_DEFINE(STRINGS_UTILS_INLINED)
fi
-
AC_STEPMAKE_CXX
AC_STEPMAKE_GXX
AC_STEPMAKE_CXXTEMPLATE
#include "lily-guile.hh"
class Scheme_hash_table;
+
+/*
+ Junk this almost-void class.
+ */
class Scope {
Scheme_hash_table *id_dict_;
Scope (Scope const &);
*/
kpse_set_program_name(av0, NULL);
kpse_maketex_option("tfm", TRUE);
+
+ /*
+ UGH: should not use DIR_DATADIR, but /var,
+ */
+
+ /*
+ ugh: apparently the program_args is non-functional.
+ */
+ kpse_format_info[kpse_tfm_format].program ="mktextfm --destdir " DIR_DATADIR "/tfm";
+
+ kpse_format_info[kpse_tfm_format].client_path =
+ (DIR_DATADIR "/tfm" );
+
#endif
}
+
+
{
if (header_l_)
outputter_l_->output_scope (header_l_, "lilypond");
+
+ outputter_l_->write_header_fields_to_file (header_l_);
}
outputter_l_->output_comment (_ ("Outputting Score, defined at: "));
progress_indication ("\n");
- if (global_header_p)
- {
- Scope gh (global_header_p);
- outputter_l_->write_header_fields_to_file (&gh);
- }
-
+
// huh?
delete outputter_l_;
outputter_l_ = 0;
*/
static Byte pitch_byte_a[ ] = { 0, 2, 4, 5, 7, 9, 11 };
-int
-sign_safe_div (int n, int d)
-{
- if (n < 0)
- return - (-n / d) - 1;
- return n / d;
-}
/* Calculate pitch height in 12th octave steps. Don't assume
normalised pitch as this function is used to normalise the pitch. */
int
Pitch::semitone_pitch () const
{
- return (octave_i_ + sign_safe_div (notename_i_, 7)) * 12
- + pitch_byte_a[notename_i_ % 7]
- + alteration_i_;
+ int o = octave_i_;
+ int n = notename_i_;
+ while (n < 0)
+ {
+ n += 7;
+ o -= 1;
+ }
+ return (o + n / 7) * 12 + pitch_byte_a[n % 7] + alteration_i_;
}
void
$(outdir)/%.dvi: $(outdir)/%.ly
$(PYTHON) $(LY2DVI) --outdir=$(outdir) --dependencies $<
- -mv $(basename $(<F))*.midi $(outdir)
# don't junk intermediate .dvi files. They're easier to view than
# .ps or .png
$(outdir)/%.dvi: %.ly
$(PYTHON) $(LY2DVI) --outdir=$(outdir) --dependencies $<
- -mv $(basename $<)*.midi $(outdir)
$(outdir)-$(PAPERSIZE)/%.dvi: %.ly
$(PYTHON) $(LY2DVI) --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $<
- -mv $(basename $<)*.midi $(outdir)-$(PAPERSIZE)
-$(outdir)/%.dvi: %.fly
- $(PYTHON) $(LY2DVI) -o $(outdir) $<
- -mv $(basename $<)*.midi $(outdir)
Begin3
Title: LilyPond
-Version: 1.3.134
-Entered-date: 02MAR01
+Version: 1.3.135
+Entered-date: 05MAR01
Description: @BLURB@
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.134.tar.gz
+ 1000k lilypond-1.3.135.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.134.tar.gz
+ 1000k lilypond-1.3.135.tar.gz
Copying-policy: GPL
End
%define info yes
Name: lilypond
-Version: 1.3.134
+Version: 1.3.135
Release: 1
License: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.134.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.135.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# Icon: lilypond-icon.gif
ATVARIABLES = \
BASH\
DATE\
+ sharedstatedir\
GUILE\
date\
datadir\
#!@PYTHON@
+# run lily, setup LaTeX input.
+""" TODO: --dependencies
-# TODO:
-#
-# * Rewrite this. The control structure is too hairy.
-# * (c) on page 1
-# * more helpful info on lily crashes
-# * Should use files in /tmp/ only. This potentially messes with
-# user generated files in the CWD
-
-
-"""
-=======================================================================
-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 = '@TOPLEVEL_VERSION@'
-errorlog = ''
-import sys
import os
-import getopt
-import re
+import stat
import string
-import time
-import glob
+import re
+import getopt
+import sys
+import __main__
+import operator
import tempfile
-# Can't grep localized msgs
-os.environ['LC_ALL'] = ''
-os.environ['LANG'] = ''
-os.environ['LC_LANG'] = ''
-
-
-
-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, file.sly 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', '.sly']:
- 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('% Generated automatically by: 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 ),
- ( 'latexpackages', Props.setPackages ),
- ( 'paperorientation', 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\\\\lilypond([\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:
- __lilypondDefs(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 __lilypondDefs(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\\lilypond%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. Sets the linewidth (and possibly the
- textheight) and leaves the page layout to the geometry
- package. 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()))
-
- # Only set the textheight if it was explicitly set by the user,
- # otherwise use the default. Helps to handle landscape correctly!
- if Props.get('textheight') > 0:
- textheightsetting = ',textheight=' + `Props.get('textheight')` + 'pt'
- else:
- textheightsetting = ''
-
-
- top= r"""
-%% Creator: %s
-%% Generated automatically by: %s, from %s, at %s
-
-\documentclass[%s]{article}
-
-%s
-\usepackage{geometry}
-\usepackage[latin1]{inputenc}
-%%\usepackage[T1]{fontenc}
-%%
-%% don not waste unused space at bottom of page
-%% (unless we have footnotes ...)
-%%\headheight9pt
-%%\headsep0pt
-%% Maybe this is too drastic, but let us give it a try.
-\geometry{width=%spt%s,headheight=2mm,headsep=0pt,footskip=2mm,%s}
-\input{titledefs}
-%s
-\makeatletter
-\renewcommand{\@oddhead}{\parbox{\textwidth}%%
- {\mbox{}\small\theheader\hfill\textbf{\thepage}}}%%
-%% UGR.
-%%\renewcommand{\@evenhead}{eve!{\small\lilypondinstrument{,}\quad\textbf{\thepage}}\hfil}%%
-\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%%
-%s
-\begin{document}
-""" % ( program_id(), program_id(), Props.get('filename'), now, Props.get('papersize'),
- Props.get('language'), Props.get('linewidth'), textheightsetting,
- Props.get('orientation'), Props.get('header'), Props.get('pagenumber'))
-
- base, ext = os.path.splitext(file)
- this.__base = base
- tempfile.template= base + '_ly'
- this.__outfile = tempfile.mktemp(ext)
- base, ext = os.path.splitext(this.__outfile)
- this.__tmpbase = base
- try:
- this.__fd = open(this.__outfile,"w")
- except:
- sys.exit('ExitNoWrite', this.__outfile)
- this.write(top)
- this.__lilypondDefs('')
- this.write("""\
-\\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\\lilypondopus{}%
-\\def\\lilypondpiece{}%
+
+layout_fields = ['title', 'subtitle', 'subsubtitle', 'footer', 'head',
+ 'composer', 'arranger', 'instrument', 'opus', 'piece', 'metre',
+ 'meter', 'poet']
+
+
+# init to empty; values here take precedence over values in the file
+extra_init = {
+ 'language' : [],
+ 'latexheaders' : [],
+ 'latexpackages' : ['geometry'],
+ 'papersizename' : [],
+ 'pagenumber' : [],
+ 'textheight' : [],
+ 'linewidth' : [],
+ 'orientation' : []
+}
+
+extra_fields = extra_init.keys ()
+
+fields = layout_fields + extra_fields
+original_dir = os.getcwd ()
+include_path = ['.']
+temp_dir = ''
+keep_temp_dir = 0
+no_lily = 0
+outdir = '.'
+track_dependencies_p = 0
+
+dependency_files = []
+
+
+program_version = '@TOPLEVEL_VERSION@'
+if program_version == '@' + 'TOPLEVEL_VERSION' + '@':
+ program_version = '1.3.134'
+
+# generate ps ?
+postscript_p = 0
+
+option_definitions = [
+ ('', 'h', 'help', 'print help'),
+ ('KEY=VAL', 's', 'set', 'change global setting KEY to VAL'),
+ ('', 'P', 'postscript', 'Generate PostScript output'),
+ ('', 'k', 'keep', 'Keep all output, and name the directory ly2dvi.dir'),
+ ('', '', 'no-lily', 'Don\'t run lilypond'),
+ ('', 'v', 'version', "Print version and copyright info"),
+ ('DIR', '', 'outdir', 'Dump all final output into DIR'),
+ ('', 'd', 'dependencies', 'Dump all final output into DIR'),
+ ]
+
+
+
+def identify():
+ sys.stdout.write ('lilypond-book (GNU LilyPond) %s\n' % program_version)
+
+def print_version ():
+ identify()
+ sys.stdout.write (r"""Copyright 1998--1999
+Distributed under terms of the GNU General Public License. It comes with
+NO WARRANTY.""")
+
+
+
+def progress (s):
+ """Make the progress messages stand out between lilypond stuff"""
+ sys.stderr.write (' *** ' + s+ '\n')
+
+def error (s):
+ sys.stderr.write (s)
+ raise 'Exiting ... '
+
+
+def find_file (name):
+ """
+ Search the include path for NAME. If found, return the (CONTENTS, PATH) of the file.
+ """
+
+ f = None
+ nm = ''
+ for a in include_path:
+ try:
+ nm = os.path.join (a, name)
+ f = open (nm)
+ __main__.read_files.append (nm)
+ break
+ except IOError:
+ pass
+ if f:
+ sys.stderr.write ("Reading `%s'\n" % nm)
+ return (f.read (), nm)
+ else:
+ error ("File not found `%s'\n" % name)
+ return ('', '')
+
+
+
+
+def getopt_args (opts):
+ "Construct arguments (LONG, SHORT) for getopt from list of options."
+ short = ''
+ long = []
+ for o in opts:
+ if o[1]:
+ short = short + o[1]
+ if o[0]:
+ short = short + ':'
+ if o[2]:
+ l = o[2]
+ if o[0]:
+ l = l + '='
+ long.append (l)
+ return (short, long)
+
+def option_help_str (o):
+ "Transform one option description (4-tuple ) into neatly formatted string"
+ sh = ' '
+ if o[1]:
+ sh = '-%s' % o[1]
+
+ sep = ' '
+ if o[1] and o[2]:
+ sep = ','
+
+ long = ''
+ if o[2]:
+ long= '--%s' % o[2]
+
+ arg = ''
+ if o[0]:
+ if o[2]:
+ arg = '='
+ arg = arg + o[0]
+ return ' ' + sh + sep + long + arg
+
+
+def options_help_str (opts):
+ "Convert a list of options into a neatly formatted string"
+ w = 0
+ strs =[]
+ helps = []
+
+ for o in opts:
+ s = option_help_str (o)
+ strs.append ((s, o[3]))
+ if len (s) > w:
+ w = len (s)
+
+ str = ''
+ for s in strs:
+ str = str + '%s%s%s\n' % (s[0], ' ' * (w - len(s[0]) + 3), s[1])
+ return str
+
+def help():
+ sys.stdout.write("""Usage: lyvi [options] FILE\n
+Generate .dvi with LaTeX for lilypond
+Options:
""")
- this.__lilypondDefs("\\def")
- this.write("""\
-\\def\\theopus{\\lilypondopus}% ugh
-\\def\\thepiece{\\lilypondpiece}%
-\\makelilypiecetitle
+ sys.stdout.write (options_help_str (option_definitions))
+ sys.stdout.write (r"""Warning all output is written in the CURRENT directory
+
+
+
+Report bugs to bug-gnu-music@gnu.org.
+
+Written by
+Han-Wen Nienhuys <hanwen@cs.uu.nl>
""")
+ sys.exit (0)
- #
- # end
- #
- def end(this):
- """
- Close output file and run latex on it.
- input: None
- output: None
- error: ExitBadLatex Exception
- """
+def setup_temp ():
+ global temp_dir
+ temp_dir = 'ly2dvi.dir'
+ if not keep_temp_dir:
+ temp_dir = tempfile.mktemp ('ly2dvi')
+
+ try:
+ os.mkdir (temp_dir)
+ except OSError:
+ pass
+
- outfile=this.__base + '.dvi'
- if Props.get('output') != '':
- if not os.path.exists(Props.get('output')):
- os.mkdir(Props.get('output'))
+ # try not to gen/search MF stuff in temp dir
+ fp = ''
+ try:
+ fp = ':' + os.environ['TFMFONTS']
+ except KeyError:
+ fp = '://:'
- outfile = os.path.join(Props.get('output'), outfile )
-
- this.write(r"""
-%% \vfill\hfill{\lilypondtagline}
-\makeatletter
-\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\lilypondtagline}}%%
-\makeatother
-\end{document}
-""")
- this.__fd.close()
- if os.path.isfile(outfile):
- os.remove(outfile)
- 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 not os.path.isfile(outfile):
- os.rename(this.__tmpbase + '.dvi', outfile)
- sys.stderr.write('\n' + program_id() + ': dvi file name is %s\n\n'
- % (outfile))
-
- if Props.get('postscript'):
- dvipsopts=''
- if Props.get('orientation') == 'landscape':
- dvipsopts=dvipsopts + ' -t landscape'
- psoutfile=this.__base + '.ps'
- if Props.get('output') != '':
- psoutfile = os.path.join(Props.get('output'), psoutfile )
- stat = os.system('dvips %s -o %s %s' % (dvipsopts,psoutfile,outfile))
- if stat:
- sys.exit('ExitBadPostscript')
-
-
-\f
-
-
-# ARG! THIS CODE IS BLOATED:
-# FIXME: Junk all set/get methods.
-
-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/.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 = {
- 'papersize' : ['a4paper', this.__overrideTable['init']],
- 'textheight' : [0, this.__overrideTable['init']],
- 'linewidth' : [500, 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])
- # bit silly. for ly2dvi, overrules compiled-in datadir...
- # how to do this better (without running lily, of course?
- this.setRoot(os.path.join(p[0],'share','lilypond'), '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 = os.pathsep
- if os.environ.has_key ('TEXINPUTS'):
- t = os.environ['TEXINPUTS'] + os.pathsep
-
- ly2dvi_t = t + \
- os.path.join(this.get('root'), 'tex' ) + \
- os.pathsep + os.path.join(this.get('root'), 'ps' )
- # Don't add the magic `//' to TEXINPUTS
- ly2dvi_t = re.sub ('//*', '/', ly2dvi_t)
- os.environ['TEXINPUTS'] = ly2dvi_t
-
- m = ''
- if os.environ.has_key ('MFINPUTS'):
- m = os.environ['MFINPUTS']
- ly2dvi_m = m + os.pathsep + \
- os.path.join(this.get('root'), 'mf')
- ly2dvi_m = re.sub ('//*', '/', ly2dvi_m)
- # Don't add the magic `//' to MFINPUTS
- os.environ['MFINPUTS'] = ly2dvi_m
-
- if os.environ.has_key('TMP'):
- this.__set('tmp',os.environ['TMP'],'environment')
-
-
- def read_titledefs (this):
- fd=this.get_texfile_path ('titledefs.tex')
- mudefs=[]
-
- for line in fd.readlines():
- m=re.match('\\\\newcommand\*{\\\\lilypond([\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'), 'tex', var)
- else:
- path =''
- cmd =('kpsewhich tex %s %s' % (var,errorlog))
- sys.stderr.write ('executing: %s'% cmd)
- pipe = os.popen (cmd, 'r')
- path = pipe.readline ()[:-1] # chop off \n
- return_status = pipe.close()
- sys.stderr.write ('\n')
- if return_status and not path:
- path = os.path.join(this.get('root'), '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 ),
- ( 'LATEXPKG', this.setPackages ),
- ( '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'),'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)
+ os.environ['TFMFONTS'] = original_dir + fp
+
+ os.chdir (temp_dir)
+ progress ('Temp directory is `%s\'\n' % temp_dir)
+
+
+def system (cmd, ignore_error = 0):
+ sys.stderr.write ("invoking `%s\'\n" % cmd)
+ st = os.system (cmd)
+ if st:
+ msg = ('Error command exited with value %d' % st)
+ if ignore_error:
+ sys.stderr.write (msg + ' (ignored)\n')
+ else:
+ error (msg)
+
+ return st
+
+def cleanup_temp ():
+ if not keep_temp_dir:
+ progress ('Cleaning up `%s\'' % temp_dir)
+ system ('rm -rf %s' % temp_dir)
+
+
+def run_lilypond (files):
+ opts = ''
+ opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path))
+ opts = opts + ' ' + string.join (map (lambda x : '-H ' + x, fields))
+
+ if track_dependencies_p:
+ opts = opts + " --dependencies "
+
+ fs = string.join (files)
+
+ system ('lilypond %s %s ' % (opts, fs))
+
+
+def set_setting (dict, key, val):
+ try:
+ val = string.atof (val)
+ except ValueError:
+ pass
+
+ try:
+ dict[key].append (val)
+ except KeyError:
+ dict[key] = [val]
+
+
+def analyse_lilypond_output (filename, extra):
+ """Grep FILENAME for interesting stuff, and
+ put relevant info into EXTRA."""
+ filename = filename+'.tex'
+ progress ("Analyzing `%s'" % filename)
+ s = open (filename).read ()
+
+ # search only the first 10k
+ s = s[:10240]
+ for x in ('textheight', 'linewidth', 'papersizename', 'orientation'):
+ m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}'%x, s)
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('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.stderr.write ('ly2dvi: warning: ignoring linewidth: ' + size + '\n')
-
- #
- # setOrientation
- #
- def setOrientation(this,orient,requester):
- """
- Set orientation property
- """
-
- if orient == 'landscape' or orient == 'portrait':
- this.__set('orientation', orient, requester )
+ set_setting (extra, x, m.group (1))
+
+def find_tex_files_for_base (base, extra):
+ headerfiles = {}
+ for f in layout_fields:
+ if os.path.exists (base + '.' + f):
+ headerfiles[f] = base+'.'+f
+
+ if os.path.exists (base +'.dep'):
+ dependency_files.append (base + '.dep')
+
+ for f in extra_fields:
+ if os.path.exists (base + '.' + f):
+ extra[f].append (open (base + '.' + f).read ())
+
+ return (base +'.tex',headerfiles)
+
+
+def find_tex_files (files, extra):
+ tfiles = []
+ for f in files:
+ x = 0
+ while 1:
+ fname = os.path.basename (f)
+ fname = os.path.splitext (fname)[0]
+ if x:
+ fname = fname + '-%d' % x
+
+ if os.path.exists (fname + '.tex'):
+ tfiles.append (find_tex_files_for_base (fname, extra))
+ analyse_lilypond_output (fname, extra)
+ else:
+ break
+
+ x = x +1
+ return tfiles
+
+def one_latex_definition (defn, first):
+ s = ''
+ for (k,v) in defn[1].items ():
+ s = r"""\def\the%s{%s}""" % (k,open (v).read ())
+
+ if first:
+ s = s + '\\makelilytitle\n'
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','\\pagestyle{empty}',requester)
- else:
- this.__set('pagenumber','%',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','\\input{' + head + '}'+this.get('header'),requester)
-
- #
- # Set latex package name
- #
- def setPackages(this,pkgs, requester):
- this.__set('header','\\usepackage{' + pkgs + '}'+this.get('header'),requester)
-
- #
- # Set or Clear Dependencies flag to generate makefile dependencies
- #
- def setDependencies(this, value, 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 lilypond 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
- if os.name == 'nt' or os.name == 'dos':
- path = unc2dos(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 = string.join (map (lambda x: '-I "%s"' % x, Props.get('include')))
- dep=''
- if Props.get('dependencies'):
- dep=' --dependencies'
- return inc + dep
-
-def writeLilylog(file,contents):
- if Props.get('keeplilypond'):
- base, ext = os.path.splitext(file)
- tempfile.template=base + "_li"
- file=tempfile.mktemp('.log')
- 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 getDepFiles (log):
- files=[]
- for line in string.split (log,'\n'):
- m = re.search ("dependencies output to (.+)\.\.\.", line)
- if m:
- files.append (m.group (1))
- return files
-
-def unc2dos(path):
- """
- Convert a path of format //<drive>/this/that/the/other to
- <drive>:\this\that\the\other
- """
- m=re.match('^//([A-Za-z])(/.*)$',path)
- if m:
- return m.group(1) + ':' + os.path.normpath(m.group(2))
-
-
-
-def program_id ():
- return 'ly2dvi (GNU LilyPond) ' + version;
-
-
-def mailaddress():
- try:
- return os.environ['MAILADDRESS']
- except KeyError:
- return '(address unknown)'
-
-
-def identify ():
- sys.stderr.write (program_id () + '\n')
+ s = s + '\\makelilypiecetitle\n'
+
+ s = s + '\\input %s' % defn[0]
+ return s
-def print_version ():
- sys.stdout.write (program_id () + '\n')
-def help ():
- sys.stdout.write (
-"""Usage: %s [OPTION]... [FILE]...
+ly_paper_to_latexpaper = {
+ 'a4' : 'a4paper',
+
+}
-Generate dvi file from LilyPond source/output
+def global_latex_definition (tfiles, extra):
+ """construct preamble from EXTRA,
+ dump lily output files after that, and return result.
+ """
-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 LilyPond\'s search path
- -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)
- -P,--postscript generate PostScript file
- -W,--Width= set paper width (points) (see manual page)
- -M,--dependencies tell LilyPond to make a dependencies file
- -h,--help this help text
- -k,--keeply2dvi keep ly2dvi output files
- -l,--language= give LaTeX language (babel)
- -o,--outdir= set output directory
- --output= set output directory
- -p,--papersize= give LaTeX papersize (eg. a4)
- -s,--separate run all files separately through LaTeX
-
-files may be (a mix of) input to or output from LilyPond(1)
-""" % name)
-
-\f
-
-#
-# main
-#
-
-def main():
- """Generate dvi files from LilyPond source/output"""
-
- infile = Input()
- outfile = TeXOutput()
- texInputFiles=[]
- tempfile.tempdir=""
-
- (options, files) = getopt.getopt (sys.argv[1:],
- 'DF:H:I:KLNPW:Mhkl:o:p:s',
- ['debug', 'headers=', 'Height=',
- 'include=', 'keeplilypond', 'landscape',
- 'nonumber', 'Width=', 'dependencies',
- 'help', 'keeply2dvi', 'language=',
- 'outdir=', 'output=', 'version',
- '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(1,'commandline')
- elif o == '--Width' or o == '-W':
- Props.setLineWidth(a,'commandline')
- elif o == '--dependencies' or o == '-M':
- Props.setDependencies(1,'commandline')
- elif o == '--help' or o == '-h':
- help()
- sys.exit (0)
- elif o == '--keeply2dvi' or o == '-k':
- Props.setKeeply2dvi(1,'commandline')
- elif o == '--language' or o == '-l':
- Props.setLanguage(a,'commandline')
- elif o == '--outdir' or o == '-o' or o == '--output':
- 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')
- elif o == '--version':
- print_version ()
- return 0
+
+ s = ""
+ s = s + '% generation tag\n'
+
+ paper = ''
+
+ if extra['papersizename']:
+ paper = '[%s]' % ly_paper_to_latexpaper[extra['papersizename'][0]]
+ s = s + '\\documentclass%s{article}\n' % paper
+
+ if extra['language']:
+ s = s + r'\usepackage[%s]{babel}\n' % extra['language'][-1]
+
+
+ s = s + '\\usepackage{%s}\n' \
+ % string.join (extra['latexpackages'], ',')
+
+ s = s + string.join (extra['latexheaders'], ' ')
+
+ textheight = ''
+ if extra['textheight']:
+ textheight = ',textheight=%fpt' % extra['textheight'][0]
+
+ orientation = 'portrait'
+ if extra['orientation']:
+ orientation = extra['orientation'][0]
+
+ s = s + '\geometry{width=%spt%s,headheight=2mm,headsep=0pt,footskip=2mm,%s}\n' % (extra['linewidth'][0], textheight, orientation)
+
+ s= s + r"""
+\usepackage[latin1]{inputenc}
+\input{titledefs}
+\makeatletter
+\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%%
+"""
+ if extra['pagenumber'] and extra['pagenumber'][-1]:
+ s = s + r"""
+ \renewcommand{\@oddhead}{\parbox{\textwidth}%%
+ {\mbox{}\small\theheader\hfill\textbf{\thepage}}}%%"""
else:
- print o
- raise getopt.error
-
- identify()
- Props.read_titledefs ()
-
- if len(files):
- for file in files:
- infile.open(file)
- type = infile.type()
- infile.close()
- if type == 'source':
- if os.environ.has_key('OS') and \
- os.environ['OS'] == 'Windows_95':
- cmd = 'ash -c "lilypond %s %s 2>&1"' %(getLilyopts(), file)
- else:
- cmd = 'lilypond %s %s 2>&1' % (getLilyopts(), file)
- sys.stderr.write ('executing: %s\n'% cmd)
+ s = s + '\\pagestyle{empty}'
- fd = os.popen(cmd , 'r')
- log = ''
+ s = s + '\\begin{document}'
+
+ first = 1
+ for t in tfiles:
+ s = s + one_latex_definition (t, first)
+ first = 0
- s = fd.readline()
- while len(s) > 0:
- sys.stderr.write (s)
- sys.stderr.flush ()
- log = log + s
- s = fd.readline ()
- if 0:
- s = fd.read (1)
- while len(s) > 0:
- sys.stderr.write (s)
- sys.stderr.flush ()
- s = fd.read (1)
- log = log + s
- stat = fd.close()
- if stat:
- sys.exit('ExitBadLily', cmd )
- texFiles=getTeXFile(log)
- depFiles=getDepFiles (log)
- writeLilylog(file,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) # allow for specified name
- else:
- outfile.next()
- outfile.write("""\
-\\input{%s}
-""" % (file))
- if Props.get('separate'):
- outfile.end()
- else:
- firstfile=0
- if not Props.get('separate'):
- outfile.end()
-
- # --outdir mess
- if Props.get ('output'):
- outdir=Props.get ('output')
- for i in depFiles:
- text=open (i).read ()
- # ugh, should use lilypond -o DIR/foo.tex
- # or --dep-prefix to fix dependencies
- text=re.sub ('\n([^:]*).tex', '\n' + outdir + '/\\1.dvi', text)
- text=re.sub (' ([^:]*).tex', ' ' + outdir + '/\\1.dvi', text)
- open (os.path.join (outdir, i), 'w').write (text)
- os.remove (i)
-
- 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('*_ly[0-9]*.*')
- for file in lilyfiles + tmpfiles:
- if os.path.isfile(file):
- os.remove(file)
-
-
-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()
+ s = s + '\\end{document}'
+
+ return s
+
+def do_files (fs, extra):
+
+ """process the list of filenames in FS, using standard settings in EXTRA.
+ """
+ if not no_lily:
+ run_lilypond (fs)
+
+ wfs = find_tex_files (fs, extra)
+ s = global_latex_definition (wfs, extra)
+
+ latex_file ='ly2dvi.out'
+ f = open (latex_file + '.tex', 'w')
+ f.write (s)
+ f.close ()
+
+ # todo: nonstopmode
+ system ('latex %s' % latex_file)
+ return latex_file + '.dvi'
+
+def generate_postscript (dvi_name, extra):
+ """Run dvips on DVI_NAME, optionally doing -t landscape"""
+
+ opts = ''
+ if extra['papersizename']:
+ opts = opts + ' -t %s' % extra['papersizename'][0]
+
+ if extra['orientation'] and extra['orientation'][0] == 'landscape':
+ opts = opts + ' -t landscape'
+
+ ps_name = re.sub (r'\.dvi', r'.ps', dvi_name)
+ system ('dvips %s -o %s %s' % (opts, ps_name, dvi_name))
+
+ return ps_name
+
+
+
+def generate_dependency_file (depfile, outname):
+ df = open (depfile, 'w')
+ df.write (outname + ':' )
+
+ for d in dependency_files:
+ s = open (d).read ()
+ s = re.sub ('#[^\n]*\n', '', s)
+ s = re.sub (r'\\\n', ' ', s)
+ m = re.search ('.*:(.*)\n', s)
+
+ # ugh. Different targets?
+ if m:
+ df.write ( m.group (1) + ' ' )
+
+ df.write ('\n')
+ df.close ();
+
+(sh, long) = getopt_args (__main__.option_definitions)
+(options, files) = getopt.getopt(sys.argv[1:], sh, long)
+for opt in options:
+ o = opt[0]
+ a = opt[1]
+
+ if 0:
+ pass
+ elif o == '--help' or o == '-h':
+ help ()
+ elif o == '--include' or o == '-I':
+ include_path.append (a)
+ elif o == '--postscript' or o == '-P':
+ postscript_p = 1
+ elif o == '--keep' or o == '-k':
+ keep_temp_dir = 1
+ elif o == '--no-lily':
+ no_lily = 1
+ elif o == '--outdir':
+ outdir = a
+ elif o == '--set' or o == '-s':
+ ss = string.split (a, '=')
+ set_setting (extra_init, ss[0], ss[1])
+ elif o == '--dependencies' or o == '-d':
+ track_dependencies_p = 1
+ elif o == '--version' or o == '-v':
+ identify ()
+
+
+include_path = map (os.path.abspath, include_path)
+files = map (os.path.abspath, files)
+outdir = os.path.abspath (outdir)
+
+def strip_ly_suffix (f):
+ (p, e) =os.path.splitext (f)
+ if e == '.ly':
+ e = ''
+ return p +e
+
+files = map (strip_ly_suffix, files)
+
+if files:
+ setup_temp ()
+ extra = extra_init
+
+ dvi_name = do_files (files, extra)
+
+ if postscript_p:
+ ps_name = generate_postscript (dvi_name, extra)
+
+
+
+ base = os.path.basename (files[0])
+ dest = base
+ type = 'foobar'
+ srcname = 'foobar'
+
+ if postscript_p:
+ srcname = ps_name
+ dest = dest + '.ps'
+ type = 'PS'
+ else:
+ srcname = dvi_name
+ dest= dest + '.dvi'
+ type = 'DVI'
+
+ dest = os.path.join (outdir, dest)
+ system ('cp \"%s\" \"%s\"' % (srcname, dest ))
+ system ('cp *.midi %s' % outdir, ignore_error = 1)
+
+ progress ("%s file left in `%s'\n" % (type, dest))
+
+ depfile = os.path.join (outdir, base + '.dep')
+
+ if track_dependencies_p:
+ generate_dependency_file (depfile, dest)
+ progress ("Dependency file left in `%s'\n" % depfile)
+
+ cleanup_temp ()
+
+
presome=${ac_default_prefix}
fi
DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
+
AC_SUBST(datadir)
AC_SUBST(DIR_DATADIR)
+
+ dnl yeah, so fuck me gently with a cactus: this doesnt belong here
+ dnl Please take the person responsible for inventing shell-scripts out
+ dnl and shoot him. On behalf of the sane world, thank you.
+ dnl DIR_SHAREDSTATEDIR="foobar"
+ dnl AC_SUBST(DIR_SHAREDSTATEDIR)
+
AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
])
presome=${ac_default_prefix}
fi
DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
+
+
+
cat >> confdefs.h <<EOF
#define DIR_DATADIR "${DIR_DATADIR}"
EOF
echo $ac_n "checking language""... $ac_c" 1>&6
-echo "configure:1221: checking language" >&5
+echo "configure:1224: checking language" >&5
case "$language" in
En* | en* | Am* | am* | US* | us*)
lang=English;;
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1256: checking for $ac_word" >&5
+echo "configure:1259: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
+# WHAT THE FUCK IS THIS DOING IN STEPMAKE???
+
$(outdir)/%.afm: %.af
grep '[[:cntrl:]]' $< | sed 's/^[[:cntrl:]] *//' > $@
# grep '[[:cntrl:]]' $< | sed 's/^. *//' > $@
sed-atvariables = -e '\#' $(foreach i, $(ATVARIABLES), -e 's!@$i@!$($i)!g')
# these are obsolete
+
+# then remove them --hwn
+
# use ATVARIABLES
sed-date=sed 's!@DATE@!${date}!g'
sed-PACKAGE = sed 's!@PACKAGE@!${PACKAGE}!g'