From 77e6cefa9c65766577402009987a30140c31dfe9 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 17 Aug 2004 22:39:34 +0000 Subject: [PATCH] * lily/output-def.cc (assign_context_def): use set_variable(). * lily/text-item.cc (interpret_string): accept string input encoding too. * scm/encoding.scm (read-encoding-file): print warning when file can't be found. * tex/GNUmakefile ($(outdir)/latin1.enc): create latin1 from GS. * lily/rod.cc (columnize): robustness fix. Don't crash for nil span points. Fixes: appoggiatura-segfault.ly (add_to_cols): extra robustness fix. --- ChangeLog | 30 +++++++++++++++++++++++ lily/dynamic-engraver.cc | 21 ---------------- lily/include/output-def.hh | 2 +- lily/output-def.cc | 2 +- lily/rod.cc | 11 ++++++--- lily/script-engraver.cc | 49 -------------------------------------- lily/text-item.cc | 19 ++++----------- scm/encoding.scm | 17 +++++++------ scm/lily.scm | 2 ++ tex/GNUmakefile | 7 +++--- 10 files changed, 61 insertions(+), 99 deletions(-) diff --git a/ChangeLog b/ChangeLog index 385f30c319..8d85fcee7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2004-08-18 Han-Wen Nienhuys + + * lily/output-def.cc (assign_context_def): use set_variable(). + + * lily/text-item.cc (interpret_string): accept string input + encoding too. + + * scm/encoding.scm (read-encoding-file): print warning when file + can't be found. + + * tex/latin1.enc: remove. + + * tex/GNUmakefile ($(outdir)/latin1.enc): create latin1 from GS. + + * lily/rod.cc (columnize): robustness fix. Don't crash for + nil span points. Fixes: appoggiatura-segfault.ly + (add_to_cols): extra robustness fix. + +2004-08-17 Han-Wen Nienhuys + + * lily/text-item.cc (interpret_string): use lookup_variable() to + fidn inputencoding. Now, \paper inherits inputencoding from + \bookpaper. + + * lily/script-engraver.cc (stop_translation_timestep): remove slur + collision kludge. + + * lily/dynamic-engraver.cc (typeset_all): remove slur collision + kludge. + 2004-08-14 Jan Nieuwenhuizen * lily/main.cc (parse_argv): Bugfix: handle 'p'. Add warning. diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 76dc123384..9b0b1892ad 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -313,27 +313,6 @@ Dynamic_engraver::finalize () void Dynamic_engraver::typeset_all () { - /* Simplistic slur collision handling. This fixes simple collisions - like - - a\p( b) - - which are unacceptable, but it most probably breaks for more - interesting cases. Maybe make a new colission engraver. */ - if (finished_line_spanner_ - && slur_ - && get_slur_dir (slur_) == get_grob_direction (finished_line_spanner_) - && !intersection (slur_->spanned_rank_iv (), - finished_line_spanner_->spanned_rank_iv ()).is_empty ()) - { - Real ss = Staff_symbol_referencer::staff_space (finished_line_spanner_); - Real pad = robust_scm2double (finished_line_spanner_ - ->get_property ("padding"), 0); - /* FIXME: 1ss padding hardcoded */ - finished_line_spanner_->set_property ("padding", - scm_make_real (pad + ss)); - } - if (finished_cresc_) { if (!finished_cresc_->get_bound (RIGHT)) diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index cd76d29881..4b2bf9c3e4 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -43,9 +43,9 @@ public: VIRTUAL_COPY_CONSTRUCTOR (Output_def, Output_def); DECLARE_SMOBS (Output_def,); public: + SCM scope_; Output_def * parent_; Input input_origin_; - SCM scope_; Output_def (Output_def const&); Output_def (); diff --git a/lily/output-def.cc b/lily/output-def.cc index 10dbc0f783..1895daa660 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -75,7 +75,7 @@ assign_context_def (Output_def * m, SCM transdef) if (tp) { SCM sym = tp->get_context_name (); - scm_module_define (m->scope_, sym, transdef); + m->set_variable (sym, transdef); } } diff --git a/lily/rod.cc b/lily/rod.cc index d79fd7f772..f86fc4e112 100644 --- a/lily/rod.cc +++ b/lily/rod.cc @@ -23,6 +23,10 @@ Rod::Rod () void Rod::columnize () { + if (!item_l_drul_[LEFT] + || !item_l_drul_[RIGHT]) + return ; + Direction d = LEFT; do { Paper_column * pc = item_l_drul_[d]->get_column (); @@ -36,9 +40,10 @@ void Rod::add_to_cols () { columnize (); - if (item_l_drul_[LEFT] != item_l_drul_[RIGHT]) + if (item_l_drul_[LEFT] != item_l_drul_[RIGHT] + && item_l_drul_[LEFT] && item_l_drul_[RIGHT]) Spaceable_grob::add_rod (item_l_drul_[LEFT], - item_l_drul_[RIGHT], - distance_); + item_l_drul_[RIGHT], + distance_); } diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index b8e93c6cd0..20ec7faae6 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -215,55 +215,6 @@ Script_engraver::stop_translation_timestep () ::quantised_position_proc, Y_AXIS); sc->set_property ("staff-padding", SCM_EOL); } - - /* Simplistic slur collision handling. This fixes simple collisions - like - - a_\upbow( b) - - but it most probably breaks for more interesting cases. - Maybe make a new colission engraver. - - - Assume that a SCRIPT that should collide with SLUR does not - have a negative priority. */ - SCM priority = sc->get_property ("script-priority"); - -#if 0 - // this segfaults... - int rank = Paper_column::get_rank (sc); -#endif - - int rank = -1; -#if 1 - // this always yields -1 - if (Item *i = dynamic_cast (sc)) - if (i->get_column ()) - rank = i->get_column ()->rank_; -#else - // this always yields -1 - for (Grob *p = sc; p && rank < 0; p = p->get_parent (Y_AXIS)) - { - if (Item *i = dynamic_cast (p)) - if (i->get_column ()) - rank = i->get_column ()->rank_; - } -#endif - - if (robust_scm2int (priority, 0) >= 0 - && slur_ - && get_grob_direction (sc) == get_slur_dir (slur_) - && (slur_->spanned_rank_iv ().contains (rank) - /* I'm a bit out of ideas about and time to search for - how to get our rank. Sue me. */ - || rank == -1)) - { - Real ss = Staff_symbol_referencer::staff_space (sc); - Real pad = robust_scm2double (sc->get_property ("padding"), 0); - - /* FIXME: 1ss padding hardcoded */ - sc->set_property ("padding", scm_make_real (pad + ss)); - } } scripts_.clear (); } diff --git a/lily/text-item.cc b/lily/text-item.cc index b88ad73280..1226c8e3b3 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -35,20 +35,11 @@ Text_item::interpret_string (SCM paper_smob, String str = ly_scm2string (markup); if (!ly_c_symbol_p (input_encoding)) { - /* FIXME: input_encoding is set in *book*_paper - - Options include: - - 1. produce a bookpaper from a paper. - 2. add BOOKPAPER parameter to all callers, ie, all MARKUPs. */ - - programming_error ("FIXME: looking up input_encoding in paper"); - programming_error ("as a workaround, set inputencoding in your \\paper block"); - SCM var = ly_module_lookup (paper->scope_, - ly_symbol2scm ("inputencoding")); - if (var != SCM_BOOL_F) - input_encoding = scm_variable_ref (var); - + SCM enc = paper->lookup_variable (ly_symbol2scm ("inputencoding")); + if (ly_c_string_p (enc)) + input_encoding = scm_string_to_symbol (enc); + else if (ly_c_symbol_p (enc)) + input_encoding = enc; } Font_metric *fm = select_encoded_font (paper, props, input_encoding); diff --git a/scm/encoding.scm b/scm/encoding.scm index 9c2b9906f3..5d35fe5745 100644 --- a/scm/encoding.scm +++ b/scm/encoding.scm @@ -12,10 +12,12 @@ (define-public (read-encoding-file filename) "Read .enc file, return (COMMAND-NAME . VECTOR-OF-SYMBOLS)." - (let* ((raw (ly:gulp-file (ly:kpathsea-expand-path filename))) + (let* ((path (ly:kpathsea-expand-path filename)) + (unused (if (string? path) #t (ly:warn "can't find ~s" filename))) + (raw (ly:gulp-file path)) (string (regexp-substitute/global #f "%[^\n]*" raw 'pre "" 'post)) (command (match:substring - (string-match "/([^ \t\n\r]*)[ \t\n\r]+[[]" string) 1)) + (string-match "/([^ \t\n\r]*)[ \t\n\r]+[[]" string) 1)) (encoding (match:substring (string-match "[[](.*)[]]" string) 1)) (ps-lst (string-tokenize encoding)) (lst (map (lambda (x) (string->symbol (substring x 1))) ps-lst)) @@ -101,15 +103,16 @@ vector of symbols." (define (get-coding coding-name) (let ((entry (assoc-get coding-name coding-alist))) - (if entry (cons (car entry) (force (cdr entry))) + (if entry + (cons (car entry) (force (cdr entry))) (if (equal? coding-name "feta-music") (begin (ly:warn "installation problem: deprecated encoding requested: ~S" coding-name) (exit 1)) - (let ((fallback "latin1")) -* (ly:programming-error "no such encoding: ~S" coding-name) - (ly:programming-error "programming error: cross thumbs, using: ~S:" fallback) - (get-coding fallback)))))) + (let ((fallback "latin1")) + (ly:programming-error "no such encoding: ~S" coding-name) + (ly:programming-error "programming error: cross thumbs, using: ~S:" fallback) + (get-coding fallback)))))) (define-public (get-coding-filename coding-name) (car (get-coding coding-name))) diff --git a/scm/lily.scm b/scm/lily.scm index ac1f05c374..426d461d40 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -11,6 +11,8 @@ (if (defined? 'set-debug-cell-accesses!) (set-debug-cell-accesses! #f)) +;(set-debug-cell-accesses! 5000) + (use-modules (ice-9 regex) (ice-9 safe) (oop goops) diff --git a/tex/GNUmakefile b/tex/GNUmakefile index 1c1bf5c221..706184ee68 100644 --- a/tex/GNUmakefile +++ b/tex/GNUmakefile @@ -14,8 +14,9 @@ $(outdir)/music-drawing-routines.ps: $(depth)/ps/music-drawing-routines.ps rm -f $@ -ln $< $@ -$(outdir)/latin1.enc: latin1.enc - rm -f $@ - -ln $< $@ +$(outdir)/latin1.enc: GNUmakefile + echo '/ISOLatin1Encoding ' > $@ + echo 'ISOLatin1Encoding pstack' | gs -quiet - >> $@ + echo ' def ' >> $@ all: $(INSTALLATION_FILES) -- 2.39.2