From abe552b04afa101634f8aa0fe8b5fd0d99ccdc00 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 9 Mar 2006 22:15:41 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 14 ++++++++++ Documentation/user/invoking.itely | 19 ++++++++++++- THANKS | 1 + lily/constrained-breaking.cc | 41 ++++++++++++++++------------ lily/include/constrained-breaking.hh | 8 +++--- lily/main.cc | 2 +- po/cs.po | 2 +- po/da.po | 2 +- po/de.po | 4 +-- po/es.po | 2 +- po/fr.po | 4 +-- po/it.po | 2 +- po/ja.po | 2 +- po/lilypond.pot | 2 +- po/nl.po | 4 +-- po/ru.po | 2 +- po/rw.po | 2 +- po/sv.po | 2 +- po/tr.po | 2 +- po/zh_TW.po | 4 +-- 20 files changed, 80 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9a3299dac..72d94e1706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ +2006-03-08 Joe Neeman + + * lily/constrained-breaking.cc (get_max_systems): used to return a + much too big value + (combine_demerits): use pointers to reduce copying data + (calc_subproblem): idem + (get_page_penalty): add page turn penalties + 2006-03-09 Han-Wen Nienhuys + * Documentation/user/invoking.itely (Invoking lilypond): better + explanation of -e usage. + + * lily/main.cc (main_with_guile): don't append to + init_scheme_code_string + * tex/texinfo.tex (sectionheading, q.v.): don't center @image. * Documentation/user/invoking.itely: add note about MacOS X scripts. diff --git a/Documentation/user/invoking.itely b/Documentation/user/invoking.itely index 82e9cefdb7..e4b4c95c05 100644 --- a/Documentation/user/invoking.itely +++ b/Documentation/user/invoking.itely @@ -52,7 +52,24 @@ The following options are supported: @item -e,--evaluate=@var{expr} Evaluate the Scheme @var{expr} before parsing any @file{.ly} files. Multiple @code{-e} options may be given, they will be evaluated -sequentially. +sequentially. + +The expression will be evaluated in the @code{guile-user} module, so +if you want to use definitions in @var{expr}, use + +@example +lilypond -e '(define-public a 42)' +@end example + +@noindent +on the command-line, and include + +@example +#(use-modules (guile-user)) +@end example + +@noindent +at the top of the @code{.ly} file. @item -f,--format=@var{format} which formats should be written. Choices are @code{svg}, @code{ps}, diff --git a/THANKS b/THANKS index e4385208eb..52db802432 100644 --- a/THANKS +++ b/THANKS @@ -53,6 +53,7 @@ Vicente Solsona Dellá BUG HUNTERS/SUGGESTIONS +Alan Stern Andrea Valle Bertalan Fodor Bob Broadus diff --git a/lily/constrained-breaking.cc b/lily/constrained-breaking.cc index b507c0725d..f5183f1204 100644 --- a/lily/constrained-breaking.cc +++ b/lily/constrained-breaking.cc @@ -82,8 +82,8 @@ Constrained_breaking::calc_subproblem (vsize start, vsize sys, vsize brk) if (0 == sys && j > 0) break; /* the first line cannot have its first break after the beginning */ - Column_x_positions const &cur = cols_[(j + start_col)*cols_rank_ + brk]; - Column_x_positions prev; + Column_x_positions const *cur = &cols_[(j + start_col)*cols_rank_ + brk]; + Column_x_positions const *prev = NULL; Real prev_dem = 0; if (sys > 0) @@ -97,7 +97,7 @@ Constrained_breaking::calc_subproblem (vsize start, vsize sys, vsize brk) Real dem; Real force; Real pen; - combine_demerits(prev, cur, &force, &pen, &dem); + combine_demerits (prev, cur, &force, &pen, &dem); dem += prev_dem; if (isinf (dem)) continue; @@ -229,7 +229,7 @@ Constrained_breaking::get_solution (vsize start, vsize end, vsize sys_count) for (vsize cur_sys = sys; cur_sys != VPOS; cur_sys--) { assert (brk != VPOS); - ret.push_back( st[cur_sys*rank + brk].line_config_ ); + ret.push_back( *st[cur_sys*rank + brk].line_config_ ); brk = st[cur_sys*rank + brk].prev_; } reverse (ret); @@ -284,7 +284,7 @@ Constrained_breaking::get_penalty (vsize start, vsize end, vsize sys_count) } Real -Constrained_breaking::get_page_penalty (vsize start, vsize end, vsize sys_count, vsize sys_num) +Constrained_breaking::get_page_penalty (vsize start, vsize end, vsize sys_count, vsize sys_num, bool turn) { vsize rank; vsize brk; @@ -296,16 +296,21 @@ Constrained_breaking::get_page_penalty (vsize start, vsize end, vsize sys_count, if (brk == VPOS) /* we didn't satisfy constraints */ return 0; - vector &cols = state_[start][sys*rank + brk].line_config_.cols_; + vector const &cols = state_[start][sys*rank + brk].line_config_->cols_; if (cols.empty ()) return 0; - Grob *pc = cols.back (); + Grob const *pc = cols.back (); if (pc->original ()) { SCM pen = pc->get_property ("page-penalty"); - if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000) - return scm_to_double (pen); + SCM turn_pen = pc->get_property ("page-turn-penalty"); + Real ret = 0; + if (!turn && scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000) + ret = scm_to_double (pen); + if (turn && scm_is_number (turn_pen) && fabs (scm_to_double (turn_pen)) < 10000) + ret = scm_to_double (turn_pen); + return ret; } return 0; } @@ -331,13 +336,13 @@ Constrained_breaking::get_min_systems (vsize start, vsize end) return sys_count + 1; } /* no possible breaks satisfy constraints */ - return 0; + return 1; } int Constrained_breaking::get_max_systems (vsize start, vsize end) { - vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : start_[end]; + vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : starting_breakpoints_[end]; return brk - starting_breakpoints_[start]; } @@ -369,20 +374,22 @@ Constrained_breaking::Constrained_breaking (vector const &start) } void -Constrained_breaking::combine_demerits (Column_x_positions const &prev, - Column_x_positions const &col, +Constrained_breaking::combine_demerits (Column_x_positions const *prev, + Column_x_positions const *col, Real *force, Real *penalty, Real *demerits) const { + Real prev_f = prev ? prev->force_ : 0; + *penalty = 0; - if (col.cols_.empty () || !col.satisfies_constraints_) + if (col->cols_.empty () || !col->satisfies_constraints_) *force = infinity_f; else { - *force = col.force_; + *force = col->force_; - Grob *pc = col.cols_.back (); + Grob *pc = col->cols_.back (); if (pc->original ()) { SCM pen = pc->get_property ("penalty"); @@ -391,6 +398,6 @@ Constrained_breaking::combine_demerits (Column_x_positions const &prev, } } - *demerits = (*force) * (*force) + abs (prev.force_ - *force) + *penalty; + *demerits = (*force) * (*force) + abs (prev_f - *force) + *penalty; } diff --git a/lily/include/constrained-breaking.hh b/lily/include/constrained-breaking.hh index f96e264a16..41dae1cd5e 100644 --- a/lily/include/constrained-breaking.hh +++ b/lily/include/constrained-breaking.hh @@ -26,7 +26,7 @@ struct Constrained_break_node Real demerits_; Real force_; Real penalty_; - Column_x_positions line_config_; + Column_x_positions const *line_config_; Constrained_break_node () { @@ -34,7 +34,7 @@ struct Constrained_break_node demerits_ = infinity_f; force_ = infinity_f; penalty_ = 0; - line_config_.satisfies_constraints_ = false; + line_config_ = 0; } void print () const @@ -62,7 +62,7 @@ public: int get_min_systems (vsize start, vsize end); /* get the page penalty of system number sys with the given breaking */ - Real get_page_penalty (vsize start, vsize end, vsize sys_count, vsize sys); + Real get_page_penalty (vsize start, vsize end, vsize sys_count, vsize sys, bool turn); void resize (vsize systems); @@ -88,7 +88,7 @@ private: Column_x_positions space_line (vsize start_col, vsize end_col); void prepare_solution (vsize start, vsize end, vsize sys_count, vsize *rank, vsize *brk); - void combine_demerits (Column_x_positions const &, Column_x_positions const &, + void combine_demerits (Column_x_positions const *, Column_x_positions const *, Real *force, Real *pen, Real *dem) const; bool calc_subproblem(vsize start, vsize systems, vsize max_break_index); diff --git a/lily/main.cc b/lily/main.cc index 8f0678bc48..6f985ae253 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -402,7 +402,7 @@ main_with_guile (void *, int, char **) + init_scheme_variables + "))"; init_scheme_code_string - += "(begin #t " + = "(begin #t " + init_scheme_variables + init_scheme_code_string + ")"; diff --git a/po/cs.po b/po/cs.po index 7940cc8bb9..3a5bacdebe 100644 --- a/po/cs.po +++ b/po/cs.po @@ -1981,7 +1981,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/da.po b/po/da.po index b4affe1071..a057da4bef 100644 --- a/po/da.po +++ b/po/da.po @@ -1972,7 +1972,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/de.po b/po/de.po index e6ec4f4eb7..27ae846b7c 100644 --- a/po/de.po +++ b/po/de.po @@ -1926,8 +1926,8 @@ msgid "quoted string expected after \\version" msgstr "zitierte Zeichenkette hinter \\version erwartet" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" -msgstr "zitierte Zeichenkette hinter \\renameinput erwartet" +msgid "quoted string expected after \\sourcefilename" +msgstr "zitierte Zeichenkette hinter \\sourcefilename erwartet" #: lexer.ll:218 msgid "EOF found inside a comment" diff --git a/po/es.po b/po/es.po index af2a2d6c8c..09ff9f55f5 100644 --- a/po/es.po +++ b/po/es.po @@ -1933,7 +1933,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/fr.po b/po/fr.po index f489a8fd98..4482f7b1dc 100644 --- a/po/fr.po +++ b/po/fr.po @@ -1927,8 +1927,8 @@ msgid "quoted string expected after \\version" msgstr "\\version doit être suivi d'une chaîne entre guillemets" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" -msgstr "\\renameinput doit être suivi d'une chaîne entre guillemets" +msgid "quoted string expected after \\sourcefilename" +msgstr "\\sourcefilename doit être suivi d'une chaîne entre guillemets" #: lexer.ll:218 msgid "EOF found inside a comment" diff --git a/po/it.po b/po/it.po index be4069bacc..ba1bfe9f98 100644 --- a/po/it.po +++ b/po/it.po @@ -1957,7 +1957,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/ja.po b/po/ja.po index 5a4f31a20e..efd9bc970d 100644 --- a/po/ja.po +++ b/po/ja.po @@ -1995,7 +1995,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/lilypond.pot b/po/lilypond.pot index 847af287ba..28f8b29921 100644 --- a/po/lilypond.pot +++ b/po/lilypond.pot @@ -1880,7 +1880,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/nl.po b/po/nl.po index d0fe2eba47..a901c72750 100644 --- a/po/nl.po +++ b/po/nl.po @@ -1950,8 +1950,8 @@ msgid "quoted string expected after \\version" msgstr "tekst tussen aanhalingstekens verwacht na \\version" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" -msgstr "tekst tussen aanhalingstekens verwacht na \\renameinput" +msgid "quoted string expected after \\sourcefilename" +msgstr "tekst tussen aanhalingstekens verwacht na \\sourcefilename" #: lexer.ll:218 msgid "EOF found inside a comment" diff --git a/po/ru.po b/po/ru.po index 74460b2b52..432b48a31b 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1941,7 +1941,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/rw.po b/po/rw.po index 1b82d38f26..a2190fc163 100644 --- a/po/rw.po +++ b/po/rw.po @@ -2038,7 +2038,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/sv.po b/po/sv.po index e02175b57e..c533e275d6 100644 --- a/po/sv.po +++ b/po/sv.po @@ -1977,7 +1977,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/tr.po b/po/tr.po index f55a6787fe..6d147e66f2 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1989,7 +1989,7 @@ msgid "quoted string expected after \\version" msgstr "" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" +msgid "quoted string expected after \\sourcefilename" msgstr "" #: lexer.ll:218 diff --git a/po/zh_TW.po b/po/zh_TW.po index fd6445d85c..adcc11f9bf 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -1899,8 +1899,8 @@ msgid "quoted string expected after \\version" msgstr "\\version 後應該是加上引號的字串" #: lexer.ll:205 -msgid "quoted string expected after \\renameinput" -msgstr "\\renameinput 後應該是加上引號的字串" +msgid "quoted string expected after \\sourcefilename" +msgstr "\\sourcefilename 後應該是加上引號的字串" #: lexer.ll:218 msgid "EOF found inside a comment" -- 2.39.2