From ff8dce20f0abe6998fa4bf3818ba4ba81eb32f9d Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 01:02:46 +0000 Subject: [PATCH] lilypond-1.3.149 --- Documentation/user/glossary.tely | 11 +- flower/parse-afm.cc | 5 +- mutopia/F.Schubert/standchen.ly | 4 +- scripts/lilypond-book.py | 8 +- scripts/ly2dvi.py | 182 +++++++++++++++++++------------ tex/titledefs.tex | 4 +- 6 files changed, 136 insertions(+), 78 deletions(-) diff --git a/Documentation/user/glossary.tely b/Documentation/user/glossary.tely index 695c8eede1..ad9f9f4759 100644 --- a/Documentation/user/glossary.tely +++ b/Documentation/user/glossary.tely @@ -1458,15 +1458,16 @@ unlike @emph{leggiero} or @emph{non-legato} (b), @emph{portato} (c) and @lilypond[13pt,eps] \property Score.barNonAuto = ##t -\property Lyrics.LyricText \set #'font-style = #'large \addlyrics -\notes\relative c'' { +\context Staff \notes\relative c'' { c4( d )e \bar "||" c4-- d-- e-- \bar "||" c4-.( d-. )e-. \bar "||" c4-. d-. e-. \bar "||" } -\context Lyrics \lyrics { a "" "" b "" "" c "" "" d } +\context Lyrics \lyrics { + \property Lyrics . LyricText \set #'font-style = #'large + a "" "" b "" "" c "" "" d } @end lilypond @item legato curve @@ -2059,10 +2060,10 @@ sub@-do@-mi@-nant (S) and V = dominant (D). @lilypond[13pt,eps] \property Score.barNonAuto = ##t -\property Lyrics.LyricText \set #'font-style = #'large +\property Score.LyricText \set #'font-style = #'large %\property Lyrics.minVerticalAlign = #8 \addlyrics -\notes\relative c' { +\context Staff \notes\relative c' { c1 d e f g a b c } \context Lyrics \lyrics { < { I II III IV V VI VII I } diff --git a/flower/parse-afm.cc b/flower/parse-afm.cc index 39b9c0d7d9..3d205f0089 100644 --- a/flower/parse-afm.cc +++ b/flower/parse-afm.cc @@ -225,7 +225,10 @@ static char *linetoken (FILE *stream) static enum parseKey recognize ( register char *ident) { - int lower = 0, upper = (int) NOPE, midpoint, cmpvalue; + int lower = 0, + upper = (int) NOPE, + midpoint = 0, + cmpvalue = 0; BOOL found = FALSE; while ((upper >= lower) && !found) diff --git a/mutopia/F.Schubert/standchen.ly b/mutopia/F.Schubert/standchen.ly index f008fdef15..d5c804ee8f 100644 --- a/mutopia/F.Schubert/standchen.ly +++ b/mutopia/F.Schubert/standchen.ly @@ -406,6 +406,7 @@ bassStaff = \context Staff = bass< > grandStaff = \context PianoStaff < + \trebleStaff \bassStaff > @@ -431,12 +432,13 @@ grandStaff = \context PianoStaff < \grandStaff > \paper { - \translator { +%{ \translator { \HaraKiriStaffContext %VerticalExtent = #'(0 . 0) %MinimumVerticalExtent = #'(0 . 0) %StaffMinimumVerticalExtent = #'(0 . 0) } + %} \translator { \LyricsContext VerticalExtent = #'(1.2 . 1.2) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 28e01f1a12..e0a2d5d001 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -495,7 +495,6 @@ def bounding_box_dimensions(fname): else: return (0,0) - def error (str): sys.stderr.write (str + "\n Exiting ... \n\n") raise 'Exiting.' @@ -980,7 +979,12 @@ def compile_all_files (chunks): for g in png: cmd = r"""gs -sDEVICE=pgm -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=- -r90 -dNOPAUSE %s -c quit | pnmcrop | pnmtopng > %s""" cmd = cmd % (g + '.eps', g + '.png') - system (cmd) + try: + status = system (cmd) + except: + os.unlink (g + '.png') + error ("Removing output file") + os.chdir (d) diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 56a0450df1..26f7bd2635 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -99,7 +99,7 @@ include_path = ['.'] lily_p = 1 paper_p = 1 -output = 0 +output_name = '' targets = { 'DVI' : 0, 'LATEX' : 0, @@ -120,7 +120,7 @@ dependency_files = [] program_version = '@TOPLEVEL_VERSION@' if program_version == '@' + 'TOPLEVEL_VERSION' + '@': - program_version = '1.3.142' + program_version = '1.3.148' original_dir = os.getcwd () @@ -177,6 +177,18 @@ def warning (s): progress (_ ("warning: ") + s) def error (s): + + + """Report the error S. Exit by raising an exception. Please + do not abuse by trying to catch this error. If you donn't want + a stack trace, write to the output directly. + + RETURN VALUE + + None + + """ + progress (_ ("error: ") + s) raise _ ("Exiting ... ") @@ -236,17 +248,18 @@ def options_help_str (opts): return str def help (): - sys.stdout.write (_ ("Usage: %s [OPTION]... FILE") % program_name) - sys.stdout.write ('\n\n') - sys.stdout.write (help_summary) - sys.stdout.write ('\n\n') - sys.stdout.write (_ ("Options:")) - sys.stdout.write ('\n') - sys.stdout.write (options_help_str (option_definitions)) - sys.stdout.write ('\n\n') - sys.stdout.write (_ ("Report bugs to %s") % 'bug-gnu-music@gnu.org') - sys.stdout.write ('\n') - + ls = [(_ ("Usage: %s [OPTION]... FILE") % program_name), + ('\n\n'), + (help_summary), + ('\n\n'), + (_ ("Options:")), + ('\n'), + (options_help_str (option_definitions)), + ('\n\n'), + (_ ("Report bugs to %s") % 'bug-gnu-music@gnu.org'), + ('\n')] + map (sys.stdout.write, ls) + def setup_temp (): global temp_dir if not keep_temp_dir_p: @@ -259,6 +272,13 @@ def setup_temp (): def system (cmd, ignore_error = 0): + """Run CMD. If IGNORE_ERROR is set, don't complain when CMD returns non zero. + + RETURN VALUE + + Exit status of CMD + """ + if verbose_p: progress (_ ("Invoking `%s\'") % cmd) st = os.system (cmd) >> 8 @@ -280,6 +300,7 @@ def cleanup_temp (): shutil.rmtree (temp_dir) +#what a name. def set_setting (dict, key, val): try: val = string.atof (val) @@ -293,6 +314,7 @@ def set_setting (dict, key, val): warning (_ ("no such setting: %s") % `key`) dict[key] = [val] + def strip_extension (f, ext): (p, e) = os.path.splitext (f) if e == ext: @@ -318,7 +340,8 @@ option_definitions = [ ] def run_lilypond (files, outbase, dep_prefix): - opts = '--output=%s.tex' % outbase + opts = '' +# opts = opts + '--output=%s.tex' % outbase opts = opts + ' ' + string.join (map (lambda x : '-I ' + x, include_path)) if paper_p: @@ -359,6 +382,11 @@ def analyse_lilypond_output (filename, extra): set_setting (extra, x, m.group (1)) def find_tex_files_for_base (base, extra): + + """ + Find the \header fields dumped from BASE. + """ + headerfiles = {} for f in layout_fields: if os.path.exists (base + '.' + f): @@ -375,6 +403,11 @@ def find_tex_files_for_base (base, extra): def find_tex_files (files, extra): + """ + Find all .tex files whose prefixes start with some name in FILES. + + """ + tfiles = [] for f in files: @@ -393,7 +426,8 @@ def find_tex_files (files, extra): x = x + 1 if not x: - warning (_ ("no lilypond output found for %s") % `files`) + fstr = string.join (files, ', ') + warning (_ ("no lilypond output found for %s") % fstr) return tfiles def one_latex_definition (defn, first): @@ -421,9 +455,9 @@ ly_paper_to_latexpaper = { } def global_latex_definition (tfiles, extra): - '''construct preamble from EXTRA, - dump lily output files after that, and return result. - ''' + + '''construct preamble from EXTRA, dump Latex stuff for each +lily output file in TFILES after that, and return the Latex file constructed. ''' s = "" @@ -434,13 +468,13 @@ def global_latex_definition (tfiles, extra): if extra['papersize']: try: options = '%s' % ly_paper_to_latexpaper[extra['papersize'][0]] - except: + except KeyError: warning (_ ("invalid value: %s") % `extra['papersize'][0]`) pass if extra['latexoptions']: options = options + ',' + extra['latexoptions'][-1] - + s = s + '\\documentclass[%s]{article}\n' % options if extra['language']: @@ -471,7 +505,7 @@ def global_latex_definition (tfiles, extra): if extra['latexoptions']: s = s + '\geometry{twosideshift=4mm}\n' - + s = s + r''' \usepackage[latin1]{inputenc} \input{titledefs} @@ -482,10 +516,8 @@ def global_latex_definition (tfiles, extra): if extra['pagenumber'] and extra['pagenumber'][-1] and extra['pagenumber'][-1] != 'no': s = s + r''' -\renewcommand{\@evenhead}{\parbox{\textwidth}% - {\mbox{}\textbf{\thepage}\hfill\small\theheader}} -\renewcommand{\@oddhead}{\parbox{\textwidth}% - {\mbox{}\small\theheader\hfill\textbf{\thepage}}} +\renewcommand{\@evenhead}{\hbox to\textwidth{\textbf{\thepage}\hfill{\small\theheader}}} +\renewcommand{\@oddhead}{\hbox to \textwidth{{\small\theheader}\hfill\textbf{\thepage}}} ''' else: s = s + '\\pagestyle{empty}\n' @@ -511,17 +543,28 @@ def global_latex_definition (tfiles, extra): return s def run_latex (files, outbase, extra): - wfs = find_tex_files ([outbase] + files[1:], extra) + + """Construct latex file, for FILES and EXTRA, dump it into +OUTBASE.latex. Run LaTeX on it. + +RETURN VALUE + +None + """ + latex_fn = outbase + '.latex' + + wfs = find_tex_files (files, extra) s = global_latex_definition (wfs, extra) - f = open (outbase + '.latex', 'w') + f = open (latex_fn, 'w') f.write (s) f.close () if ( os.name == 'posix' ): - cmd = 'latex \\\\nonstopmode \\\\input %s' % outbase + '.latex' + cmd = 'latex \\\\nonstopmode \\\\input %s' % latex_fn else: - cmd = 'latex \\nonstopmode \\input %s' % outbase + '.latex' + cmd = 'latex \\nonstopmode \\input %s' % latex_fn + if not verbose_p: progress ( _("Running %s...") % 'LaTeX') cmd = cmd + ' 1> /dev/null 2> /dev/null' @@ -530,6 +573,14 @@ def run_latex (files, outbase, extra): def run_dvips (outbase, extra): + + """Run dvips using the correct options taken from EXTRA, +leaving a PS file in OUTBASE.ps + +RETURN VALUE + +None. +""" opts = '' if extra['papersize']: opts = opts + ' -t%s' % extra['papersize'][0] @@ -566,7 +617,8 @@ def generate_dependency_file (depfile, outname): (sh, long) = getopt_args (__main__.option_definitions) try: (options, files) = getopt.getopt(sys.argv[1:], sh, long) -except: +except getopt.error, s: + errorport.write ("\nerror: getopt says `%s\'\n\n" % s) help () sys.exit (2) @@ -592,7 +644,7 @@ for opt in options: targets['MIDI'] = 0 paper_p = 0 elif o == '--output' or o == '-o': - output = a + output_name = a elif o == '--set' or o == '-s': ss = string.split (a, '=') set_setting (extra_init, ss[0], ss[1]) @@ -604,10 +656,10 @@ for opt in options: identify () sys.exit (0) elif o == '--warranty' or o == '-w': - try: - system ('lilypond -w') - except: + status = system ('lilypond -w', ignore_error = 1) + if status: warranty () + sys.exit (0) @@ -640,27 +692,27 @@ def mkdir_p (dir, mode=0777): include_path = map (abspath, include_path) -original_output = output +original_output = output_name if files and files[0] != '-': files = map (lambda x: strip_extension (x, '.ly'), files) - if not output: - output = os.path.basename (files[0]) + if not output_name: + output_name = os.path.basename (files[0]) for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'): - output = strip_extension (output, i) + output_name = strip_extension (output_name, i) files = map (abspath, files) - if os.path.dirname (output) != '.': - dep_prefix = os.path.dirname (output) + if os.path.dirname (output_name) != '.': + dep_prefix = os.path.dirname (output_name) else: dep_prefix = 0 - reldir = os.path.dirname (output) - (outdir, outbase) = os.path.split (abspath (output)) + reldir = os.path.dirname (output_name) + (outdir, outbase) = os.path.split (abspath (output_name)) setup_environment () setup_temp () @@ -668,33 +720,33 @@ if files and files[0] != '-': extra = extra_init if lily_p: - try: +## try: run_lilypond (files, outbase, dep_prefix) - except: - # TODO: friendly message about LilyPond setup/failing? - # - # TODO: lilypond should fail with different - # error codes for: - # - guile setup/startup failure - # - font setup failure - # - init.ly setup failure - # - parse error in .ly - # - unexpected: assert/core dump - targets = {} +## # except: +## # TODO: friendly message about LilyPond setup/failing? +## # +## # TODO: lilypond should fail with different +## # error codes for: +## # - guile setup/startup failure +## # - font setup failure +## # - init.ly setup failure +## # - parse error in .ly +## # - unexpected: assert/core dump +## # targets = {} if targets.has_key ('DVI') or targets.has_key ('PS'): - try: +# try: run_latex (files, outbase, extra) # unless: add --tex, or --latex? del targets['TEX'] del targets['LATEX'] - except: - # TODO: friendly message about TeX/LaTeX setup, - # trying to run tex/latex by hand - if targets.has_key ('DVI'): - del targets['DVI'] - if targets.has_key ('PS'): - del targets['PS'] +# except Foobar: +# # TODO: friendly message about TeX/LaTeX setup, +# # trying to run tex/latex by hand +# if targets.has_key ('DVI'): +# del targets['DVI'] +# if targets.has_key ('PS'): +# del targets['PS'] # TODO: does dvips ever fail? if targets.has_key ('PS'): @@ -728,11 +780,7 @@ if files and files[0] != '-': else: # FIXME help () - progress ('\n') - try: - error (_ ("no FILEs specified, can't invoke as filter")) - except: - pass + errorport.write ("ly2dvi: error: " + _ ("no files specified on command line.\n")) sys.exit (2) diff --git a/tex/titledefs.tex b/tex/titledefs.tex index 698d26b7e6..8a3950c51f 100644 --- a/tex/titledefs.tex +++ b/tex/titledefs.tex @@ -54,12 +54,12 @@ \def\theheader { \ifx\lilypondhead\undefined\else% - \parbox{\textwidth}{\mbox{}\lilypondhead}\fi + \lilypondhead\fi } \def\thefooter { \ifx\lilypondfooter\undefined\else% - \parbox{\textwidth}{\mbox{}\lilypondfooter}\fi + \lilypondfooter\fi } \def\makelilypondtagline { -- 2.39.5