From 305630df992f855678abd12d2c94ec44ff54ae87 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 4 Sep 2002 23:28:00 +0000 Subject: [PATCH] * scripts/lilypond-book.py (output_verbatim): python 2.2 workaround. * scm/documentation-lib.scm (scm->string): print procedure name in stead of # * scripts/ly2dvi.py (run_lilypond): exit with error if lily exited any file with an error. * input/regression/molecule-hacking.ly: also restore Y extent. Fixes bugs with stem attachment of parenthesized note heads. --- ChangeLog | 8 ++++++++ buildscripts/lilypond-login.sh | 28 +++++++++++++++------------- buildscripts/lilypond-profile.sh | 8 ++++---- input/regression/molecule-hacking.ly | 2 +- lily/stem-engraver.cc | 21 ++++++++++----------- scm/documentation-lib.scm | 14 ++++++++++---- scripts/lilypond-book.py | 6 +++++- scripts/ly2dvi.py | 23 +++++++++++++++++------ 8 files changed, 70 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index ece84a094c..c0703d4baf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-09-05 Han-Wen Nienhuys + * scripts/lilypond-book.py (output_verbatim): python 2.2 workaround. + + * scm/documentation-lib.scm (scm->string): print procedure name in + stead of # + + * scripts/ly2dvi.py (run_lilypond): exit with error if lily exited + any file with an error. + * input/regression/molecule-hacking.ly: also restore Y extent. Fixes bugs with stem attachment of parenthesized note heads. diff --git a/buildscripts/lilypond-login.sh b/buildscripts/lilypond-login.sh index 21333f50ba..8279c4778d 100644 --- a/buildscripts/lilypond-login.sh +++ b/buildscripts/lilypond-login.sh @@ -12,15 +12,7 @@ # strange shell, this C set datadir="@local_lilypond_datadir@" - if ( $?GS_LIB ) then - setenv GS_LIB "$datadir/ps:$GS_LIB" - else - setenv GS_LIB "$datadir/ps" - endif - - # setenv LILYPONDPREFIX "$datadir" - # bit silly. for ly2dvi, overrules compiled-in datadir... # setenv LILYPONDPREFIX "@local_lilypond_datadir@" @@ -31,11 +23,21 @@ set noglob setenv TEXMF "{$datadir,"`kpsexpand \$TEXMF`"}" unset noglob + + +# if ( $?GS_LIB ) then +# setenv GS_LIB "$datadir/ps:$GS_LIB" +# else +# setenv GS_LIB "$datadir/ps" +# endif + + + # Add all available TeX Type1 fonts (including Feta) to Ghostscript: -if ( $?GS_FONTPATH ) then - setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS`:$GS_FONTPATH -else - setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS` -endif +#if ( $?GS_FONTPATH ) then +# setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS`:$GS_FONTPATH +#else +# setenv GS_FONTPATH `kpsewhich -expand-path=\$T1FONTS` +#endif diff --git a/buildscripts/lilypond-profile.sh b/buildscripts/lilypond-profile.sh index 6f88b34523..f1a941c411 100644 --- a/buildscripts/lilypond-profile.sh +++ b/buildscripts/lilypond-profile.sh @@ -23,12 +23,12 @@ TEXMF="{$datadir,"`kpsexpand \\$TEXMF`"}" export TEXMF # For direct ps output: ps/lilyponddefs.ps -GS_LIB="$datadir/ps:"${GS_LIB:=""} -export GS_LIB +## GS_LIB="$datadir/ps:"${GS_LIB:=""} +## export GS_LIB # For direct ps output fonts. Add all available TeX Type1 fonts -GS_FONTPATH=`kpsewhich -expand-path=\\$T1FONTS`:${GS_FONTPATH:=""} -export GS_FONTPATH +## GS_FONTPATH=`kpsewhich -expand-path=\\$T1FONTS`:${GS_FONTPATH:=""} +## export GS_FONTPATH diff --git a/input/regression/molecule-hacking.ly b/input/regression/molecule-hacking.ly index b14b817996..3ff3c6a685 100644 --- a/input/regression/molecule-hacking.ly +++ b/input/regression/molecule-hacking.ly @@ -9,7 +9,7 @@ Beam. The note head is also rather naive, since the extent of the parens are also not seen by accidentals. " - } +} #(define (parenthesize-callback callback) "Construct a function that will do CALLBACK and add parentheses. diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 25c5f01954..b1f3eb4b99 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -79,18 +79,21 @@ Stem_engraver::acknowledge_grob (Grob_info i) the first and last (quarter) note bothe get one tremolo flag. */ int requested_type = gh_scm2int (tremolo_req_->get_mus_property ("tremolo-type")); - if (requested_type <= 8) - { - tremolo_req_->origin()->warning (_("tremolo duration is too long")); - requested_type = 0; - } SCM f = get_property ("tremoloFlags"); if (!requested_type && gh_number_p (f)) requested_type = gh_scm2int (f); else daddy_trans_->set_property ("tremoloFlags", gh_int2scm (requested_type)); - if (requested_type) + int tremolo_flags = intlog2 (requested_type) - 2 + - (duration_log > 2 ? duration_log - 2 : 0); + if (tremolo_flags <= 0) + { + tremolo_req_->origin()->warning (_("tremolo duration is too long")); + tremolo_flags = 0; + } + + if (tremolo_flags) { tremolo_ = new Item (get_property ("StemTremolo")); announce_grob(tremolo_, tremolo_req_->self_scm()); @@ -100,11 +103,7 @@ Stem_engraver::acknowledge_grob (Grob_info i) the tremolo-type minus the number of flags of the note itself. */ - int tremolo_flags = intlog2 (requested_type) - 2 - - (duration_log > 2 ? duration_log - 2 : 0); - if (tremolo_flags < 0) - tremolo_flags = 0; - tremolo_->set_grob_property ("flag-count", + tremolo_->set_grob_property ("flag-count", gh_int2scm (tremolo_flags)); tremolo_->set_parent (stem_, X_AXIS); } diff --git a/scm/documentation-lib.scm b/scm/documentation-lib.scm index ba9685ad0a..cb030c50d5 100644 --- a/scm/documentation-lib.scm +++ b/scm/documentation-lib.scm @@ -27,11 +27,17 @@ (string-append "@code{" (texify (scm->string x)) "}") ) + +;; +;; don't confuse users with # syntax. +;; (define (scm->string val) - (string-append - (if (self-evaluating? val) "" "'") - (call-with-output-string (lambda (port) (display val port))) - )) + (if (procedure? val) + (symbol->string (procedure-name val)) + (string-append + (if (self-evaluating? val) "" "'") + (call-with-output-string (lambda (port) (display val port))) + ))) (define (node name) (string-append diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index cd3bf0de69..be57defa60 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -456,7 +456,11 @@ def output_verbatim (body, small): body = re.sub ('>', '>', body) body = re.sub ('<', '<', body) elif __main__.format == 'texi': - body = re.sub ('([@{}])', '@\\1', body) + + # clumsy workaround for python 2.2 pre bug. + body = re.sub ('@', '@@', body) + body = re.sub ('{', '@{', body) + body = re.sub ('}', '@}', body) if small: key = 'output-small-verbatim' diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 6428188e1f..0c3dd95158 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -130,9 +130,13 @@ def user_error (s, e=1): sys.exit (e) def error (s): - '''Report the error S. Exit by raising an exception. Please - do not abuse by trying to catch this error. If you do not want - a stack trace, write to the output directly. + '''Report the error S. + + If verbose is set, exit by raising an exception. Otherwise, + simply sys.exit(). + + Please do not abuse by trying to catch this error. If you do + not want a stack trace, write to the output directly. RETURN VALUE @@ -141,7 +145,10 @@ def error (s): ''' progress (_ ("error: ") + s) - raise _ ("Exiting ... ") + if verbose_p: + raise _ ("Exiting ... ") + else: + sys.exit (2) def getopt_args (opts): '''Construct arguments (LONG, SHORT) for getopt from list of options.''' @@ -321,6 +328,7 @@ errorport = sys.stderr keep_temp_dir_p = 0 verbose_p = 0 preview_p = 0 +lilypond_error_p = 0 preview_resolution = 90 pseudo_filter_p = 0 latex_cmd = 'latex' @@ -512,7 +520,9 @@ def run_lilypond (files, dep_prefix): sys.stderr.write ( "\n" \ + _ ("LilyPond failed on an input file (exit status %d).") % exit_status + "\n") sys.stderr.write (_("Trying to salvage the rest.") +'\n\n') - + + global lilypond_error_p + lilypond_error_p = 1 def analyse_lilypond_output (filename, extra): @@ -1107,7 +1117,8 @@ if files: os.chdir (original_dir) cleanup_temp () - + + sys.exit (lilypond_error_p) else: help () user_error (_ ("no files specified on command line"), 2) -- 2.39.5