From 023604318fe8e1ec89eb9c9e222e0dd21f103d18 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 5 Nov 2006 13:20:51 +0000 Subject: [PATCH] abc2ly new tempo syntax Lily_parser* arg for copy ctor too. bump version catch all GUILE exceptions end context snippet with '\n' --- .gitignore | 3 ++- ChangeLog | 19 +++++++++++++++++++ VERSION | 2 +- lily/include/lily-lexer.hh | 2 +- lily/input.cc | 2 +- lily/lily-lexer.cc | 3 ++- lily/lily-parser.cc | 6 ++++-- lily/parse-scm.cc | 16 ++++------------ scripts/abc2ly.py | 8 ++++---- 9 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 9526956a35..499dcc5c02 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ gcstat*.scm .htaccess *.tfm *.afm - +*.orig +*.rej diff --git a/ChangeLog b/ChangeLog index 982bd5144e..421c7e322c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2006-11-05 Han-Wen Nienhuys + + * lily/input.cc: + end context snippet with '\n' + + * lily/parse-scm.cc: + catch all GUILE exceptions + + * VERSION: + bump version + + * lily/include/lily-lexer.hh: + * lily/lily-lexer.cc: + * lily/lily-parser.cc: + Lily_parser* arg for copy ctor too. + + * scripts/abc2ly.py: + abc2ly new tempo syntax + 2006-11-04 Heikki Junes * po/fi.po: update Finnish translation. diff --git a/VERSION b/VERSION index b60133ba58..412d689a19 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=9 -PATCH_LEVEL=28 +PATCH_LEVEL=29 MY_PATCH_LEVEL= diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index b64798823b..543178ca25 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -53,7 +53,7 @@ public: Input last_input_; Lily_lexer (Sources *, Lily_parser *); - Lily_lexer (Lily_lexer const &); + Lily_lexer (Lily_lexer const &, Lily_parser *); int yylex (); void add_lexed_char (int); diff --git a/lily/input.cc b/lily/input.cc index 5ab2be4c78..14b281fbb8 100644 --- a/lily/input.cc +++ b/lily/input.cc @@ -71,7 +71,7 @@ Input::message (string s) const { if (source_file_) s = location_string () + ": " + s + "\n" - + source_file_->quote_input (start_); + + source_file_->quote_input (start_) + "\n"; ::message (s); } diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 1f39bd2425..394e20089b 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -100,9 +100,10 @@ Lily_lexer::Lily_lexer (Sources *sources, Lily_parser *parser) chordmodifier_tab_ = scm_make_vector (scm_from_int (1), SCM_EOL); } -Lily_lexer::Lily_lexer (Lily_lexer const &src) +Lily_lexer::Lily_lexer (Lily_lexer const &src, Lily_parser *parser) : Includable_lexer () { + parser_ = parser; keytable_ = (src.keytable_) ? new Keyword_table (*src.keytable_) : 0; chordmodifier_tab_ = src.chordmodifier_tab_; pitchname_tab_stack_ = src.pitchname_tab_stack_; diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index a339e8a8f5..e71176c873 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -50,8 +50,10 @@ Lily_parser::Lily_parser (Lily_parser const &src) smobify_self (); if (src.lexer_) - lexer_ = new Lily_lexer (*src.lexer_); - + { + lexer_ = new Lily_lexer (*src.lexer_, this); + } + lexer_->unprotect (); } diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 0769083cfa..c8d8d36bfa 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -94,21 +94,13 @@ parse_handler (void *data, SCM tag, SCM args) return SCM_UNDEFINED; } -/* - Do some magical incantations: if not, lily will exit on the first - GUILE error, leaving no location trace. -*/ - -#if GUILE_MINOR_VERSION < 7 -#define READ_ERROR "misc-error" -#else -#define READ_ERROR "read-error" -#endif - SCM protected_ly_parse_scm (Parse_start *ps) { - return scm_internal_catch (ly_symbol2scm (READ_ERROR), + /* + Catch #t : catch all Scheme level errors. + */ + return scm_internal_catch (SCM_BOOL_T, &catch_protected_parse_body, (void *) ps, &parse_handler, (void *) ps); diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index 91067a9e1a..e28577fb1c 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -33,6 +33,7 @@ # %%LY now supported. # \breve and \longa supported. # M:none doesn't crash lily. +# lilypond '--' supported. # Enhancements (Guy Gascoigne-Piggford) # @@ -254,13 +255,13 @@ def try_parse_q(a): if string.count(a, '/') == 1: array=string.split(a,'/') numerator=array[0] - if numerator != 1: + if int(numerator) != 1: sys.stderr.write("abc2ly: Warning, unable to translate a Q specification with a numerator of %s: %s\n" % (numerator, a)) array2=string.split(array[1],'=') denominator=array2[0] perminute=array2[1] duration=str(string.atoi(denominator)/string.atoi(numerator)) - midi_specs=string.join(["\\tempo", duration, "=", perminute]) + midi_specs=string.join([" \n\t\t\context {\n\t\t \Score tempoWholesPerMinute = #(ly:make-moment ", perminute, " ", duration, ")\n\t\t }\n"]) else: sys.stderr.write("abc2ly: Warning, unable to parse Q specification: %s\n" % a) @@ -616,8 +617,7 @@ def fix_lyric(str): def slyrics_append(a): a = re.sub ( '_', ' _ ', a) # _ to ' _ ' - a = re.sub ( '-', '- ', a) # split words with - - a = re.sub ( ' - - ', ' -- ', a) # unless was originally " -- " + a = re.sub ( '([^-])-([^-])', '\\1- \\2', a) # split words with "-" unless was originally "--" a = re.sub ( '\\\\- ', '-', a) # unless \- a = re.sub ( '~', '_', a) # ~ to space('_') a = re.sub ( '\*', '_ ', a) # * to to space -- 2.39.2