From 6eced6a93bbfda6e6af37a7d77a8e75a5052dbee Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 11 Jul 2005 11:51:43 +0000 Subject: [PATCH] * lily/include/lily-guile.hh: rename ly_c_X_p -> ly_is_X * lily/paper-outputter.cc (Paper_outputter): take port argument. * lily/paper-outputter-scheme.cc (LY_DEFINE): take port argument. * scm/framework-texstr.scm (output-framework): --- ChangeLog | 10 ++++++++++ lily/accidental-engraver.cc | 2 +- lily/accidental.cc | 6 +++--- lily/all-font-metrics.cc | 2 +- lily/apply-context-iterator.cc | 2 +- lily/balloon.cc | 2 +- lily/bar-line.cc | 4 ++-- lily/bar-number-engraver.cc | 2 +- lily/beam.cc | 2 +- lily/chord-name-engraver.cc | 2 +- lily/context-def.cc | 2 +- lily/context-property.cc | 2 +- lily/dynamic-performer.cc | 4 ++-- lily/event.cc | 2 +- lily/figured-bass-engraver.cc | 2 +- lily/grob-interface-scheme.cc | 2 +- lily/grob.cc | 14 +++++++------- lily/hairpin.cc | 2 +- lily/include/lily-guile.hh | 9 ++++++--- lily/include/paper-outputter.hh | 4 ++-- lily/item.cc | 2 +- lily/key-engraver.cc | 2 +- lily/lily-guile.cc | 10 +++++----- lily/mark-engraver.cc | 2 +- lily/music-function.cc | 2 +- lily/music-iterator.cc | 2 +- lily/music.cc | 6 +++--- lily/note-collision.cc | 2 +- lily/note-head.cc | 4 ++-- lily/output-property-engraver.cc | 2 +- lily/paper-book.cc | 4 ++-- lily/paper-outputter-scheme.cc | 18 +++++++++--------- lily/paper-outputter.cc | 17 +++-------------- lily/parser.yy | 10 +++++----- lily/piano-pedal-engraver.cc | 2 +- lily/piano-pedal-performer.cc | 2 +- lily/recording-group-engraver.cc | 2 +- lily/repeat-acknowledge-engraver.cc | 2 +- lily/script-engraver.cc | 4 ++-- lily/slur-scoring.cc | 2 +- lily/span-bar-engraver.cc | 2 +- lily/stencil-scheme.cc | 2 +- lily/system-start-delimiter-engraver.cc | 8 ++++---- lily/system-start-delimiter.cc | 2 +- lily/system.cc | 2 +- lily/tie-engraver.cc | 2 +- lily/tie-performer.cc | 2 +- lily/time-signature-performer.cc | 2 +- lily/tuplet-engraver.cc | 2 +- lily/tweak-registration-scheme.cc | 4 ++-- scm/framework-ps.scm | 10 ++++++++-- scm/framework-svg.scm | 2 +- scm/framework-tex.scm | 7 ++++--- scm/framework-texstr.scm | 9 +++++++-- 54 files changed, 122 insertions(+), 108 deletions(-) diff --git a/ChangeLog b/ChangeLog index bff58110e3..6e730da368 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2005-07-11 Han-Wen Nienhuys + * scm/framework-*.scm: use port arguments throughout. + + * lily/include/lily-guile.hh: rename ly_c_X_p -> ly_is_X + + * lily/paper-outputter.cc (Paper_outputter): take port argument. + + * lily/paper-outputter-scheme.cc (LY_DEFINE): take port argument. + + * scm/framework-texstr.scm (output-framework): + * input/regression/repeat-fold.ly (texidoc): remove TeX strings. * scm/output-lib.scm (tablature-stem-attachment-function): diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index a0f30df239..93744e5a7b 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -486,7 +486,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info) && Rhythmic_head::has_interface (info.grob ())) { if (to_boolean (get_property ("harmonicAccidentals")) - || !ly_c_equal_p (info.grob ()->get_property ("style"), + || !ly_is_equal (info.grob ()->get_property ("style"), ly_symbol2scm ("harmonic"))) { Accidental_entry entry; diff --git a/lily/accidental.cc b/lily/accidental.cc index 26909e72a0..9f08691f10 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -57,7 +57,7 @@ Accidental_interface::accurate_boxes (Grob *a, Grob **common) if (to_boolean (a->get_property ("cautionary"))) { SCM cstyle = a->get_property ("cautionary-style"); - parens = ly_c_equal_p (cstyle, ly_symbol2scm ("parentheses")); + parens = ly_is_equal (cstyle, ly_symbol2scm ("parentheses")); } SCM accs = a->get_property ("accidentals"); @@ -191,8 +191,8 @@ Accidental_interface::print (SCM smob) if (caut) { SCM cstyle = me->get_property ("cautionary-style"); - parens = ly_c_equal_p (cstyle, ly_symbol2scm ("parentheses")); - smaller = ly_c_equal_p (cstyle, ly_symbol2scm ("smaller")); + parens = ly_is_equal (cstyle, ly_symbol2scm ("parentheses")); + smaller = ly_is_equal (cstyle, ly_symbol2scm ("smaller")); } SCM scm_style = me->get_property ("style"); diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 1273a3ae59..8c4d40ffc8 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -106,7 +106,7 @@ kpathsea_find_file (String name, String ext) return path; SCM kpath = ly_lily_module_constant ("ly:kpathsea-find-file"); - if (ly_c_procedure_p (kpath)) + if (ly_is_procedure (kpath)) { SCM kp_result = scm_call_1 (kpath, scm_makfrom0str (name.to_str0 ())); if (scm_is_string (kp_result)) diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc index 6f69bbc7b8..d263ba1fd7 100644 --- a/lily/apply-context-iterator.cc +++ b/lily/apply-context-iterator.cc @@ -27,7 +27,7 @@ Apply_context_iterator::process (Moment m) { SCM proc = get_music ()->get_property ("procedure"); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) scm_call_1 (proc, get_outlet ()->self_scm ()); else get_music ()->origin ()->warning (_ ("\\applycontext argument is not a procedure")); diff --git a/lily/balloon.cc b/lily/balloon.cc index df2cf7d30c..20508d8db3 100644 --- a/lily/balloon.cc +++ b/lily/balloon.cc @@ -31,7 +31,7 @@ Balloon_interface::print (SCM smob) SCM cb = me->get_property ("balloon-original-callback"); SCM stil = SCM_EOL; - if (ly_c_procedure_p (cb)) + if (ly_is_procedure (cb)) stil = scm_call_1 (cb, smob); if (!unsmob_stencil (stil)) diff --git a/lily/bar-line.cc b/lily/bar-line.cc index ee3e6b0cdd..f8942db710 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -26,7 +26,7 @@ Bar_line::print (SCM smob) SCM s = me->get_property ("glyph"); SCM barsiz_proc = me->get_property ("bar-size-procedure"); - if (scm_is_string (s) && ly_c_procedure_p (barsiz_proc)) + if (scm_is_string (s) && ly_is_procedure (barsiz_proc)) { String str = ly_scm2string (s); SCM siz = scm_call_1 (barsiz_proc, me->self_scm ()); @@ -180,7 +180,7 @@ Bar_line::before_line_breaking (SCM smob) // leave y_extent for spanbar? } - if (! ly_c_equal_p (g, orig)) + if (! ly_is_equal (g, orig)) me->set_property ("glyph", g); return SCM_UNSPECIFIED; diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index b694089094..9b8d0bdf86 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -44,7 +44,7 @@ Bar_number_engraver::process_music () { SCM bn = get_property ("currentBarNumber"); SCM proc = get_property ("barNumberVisibility"); - if (scm_is_number (bn) && ly_c_procedure_p (proc) + if (scm_is_number (bn) && ly_is_procedure (proc) && to_boolean (scm_call_1 (proc, bn))) { create_items (); diff --git a/lily/beam.cc b/lily/beam.cc index 868470c3b5..ed5797fbc3 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -72,7 +72,7 @@ Beam::get_beam_translation (Grob *me) { SCM func = me->get_property ("space-function"); - if (ly_c_procedure_p (func)) + if (ly_is_procedure (func)) { SCM s = scm_call_2 (func, me->self_scm (), scm_int2num (get_beam_count (me))); return scm_to_double (s); diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 3e8228be8a..2eb1f1a695 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -118,7 +118,7 @@ Chord_name_engraver::process_music () SCM s = get_property ("chordChanges"); if (to_boolean (s) && scm_is_pair (last_chord_) - && ly_c_equal_p (chord_as_scm, last_chord_)) + && ly_is_equal (chord_as_scm, last_chord_)) chord_name_->set_property ("begin-of-line-visible", SCM_BOOL_T); last_chord_ = chord_as_scm; diff --git a/lily/context-def.cc b/lily/context-def.cc index b5d0d940cc..fc9466fb1a 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -211,7 +211,7 @@ Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const { /* do not check aliases, because \context Staff should not create RhythmicStaff. */ - if (ly_c_equal_p (accepteds[i]->get_context_name (), type_sym)) + if (ly_is_equal (accepteds[i]->get_context_name (), type_sym)) { best_result.push (accepteds[i]); return best_result; diff --git a/lily/context-property.cc b/lily/context-property.cc index 940643e766..15685b1c22 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -86,7 +86,7 @@ execute_pushpop_property (Context *trg, while (prev_alist != daddy) { - if (ly_c_equal_p (scm_caar (prev_alist), eltprop)) + if (ly_is_equal (scm_caar (prev_alist), eltprop)) { prev_alist = scm_cdr (prev_alist); break; diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index 71ce23fb74..12312c74c8 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -44,7 +44,7 @@ Dynamic_performer::create_audio_elements () SCM proc = get_property ("dynamicAbsoluteVolumeFunction"); SCM svolume = SCM_EOL; - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) { // urg svolume = scm_call_1 (proc, script_req_->get_property ("text")); @@ -80,7 +80,7 @@ Dynamic_performer::create_audio_elements () s = scm_makfrom0str ("piano"); SCM eq = get_property ("instrumentEqualizer"); - if (ly_c_procedure_p (eq)) + if (ly_is_procedure (eq)) { s = scm_call_1 (eq, s); } diff --git a/lily/event.cc b/lily/event.cc index 314ed194d6..efea416800 100644 --- a/lily/event.cc +++ b/lily/event.cc @@ -27,7 +27,7 @@ Event::length_callback (SCM m) Event::Event (SCM i) : Music (i) { - if (!ly_c_procedure_p (length_callback_)) + if (!ly_is_procedure (length_callback_)) { length_callback_ = length_callback_proc; } diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index b4f2cd98ea..a15b12c3e8 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -67,7 +67,7 @@ Figured_bass_engraver::process_music () else if (figures_.size ()) { SCM proc = get_property ("bassFigureFormatFunction"); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) { SCM l = SCM_EOL; SCM *t = &l; diff --git a/lily/grob-interface-scheme.cc b/lily/grob-interface-scheme.cc index b586995209..17737991e7 100644 --- a/lily/grob-interface-scheme.cc +++ b/lily/grob-interface-scheme.cc @@ -17,7 +17,7 @@ LY_DEFINE (ly_add_interface, "ly:add-interface", 3, 0, 0, (SCM a, SCM b, SCM c), { SCM_ASSERT_TYPE (scm_is_symbol (a), a, SCM_ARG1, __FUNCTION__, "symbol"); SCM_ASSERT_TYPE (scm_is_string (b), b, SCM_ARG2, __FUNCTION__, "string"); - SCM_ASSERT_TYPE (ly_c_list_p (c), c, SCM_ARG3, __FUNCTION__, "list of syms"); + SCM_ASSERT_TYPE (ly_is_list (c), c, SCM_ARG3, __FUNCTION__, "list of syms"); if (!scm_is_vector (all_ifaces)) all_ifaces = scm_make_vector (scm_int2num (40), SCM_EOL); diff --git a/lily/grob.cc b/lily/grob.cc index 548c82f2c8..87e81ebef9 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -110,12 +110,12 @@ Grob::Grob (SCM basicprops, { dim_cache_[a].dimension_ = xt; } - else if (ly_c_procedure_p (cb)) + else if (ly_is_procedure (cb)) { dim_cache_[a].dimension_callback_ = cb; } else if (cb == SCM_EOL - && ly_c_procedure_p (get_property ("print-function"))) + && ly_is_procedure (get_property ("print-function"))) dim_cache_[a].dimension_callback_ = stencil_extent_proc; } } @@ -199,7 +199,7 @@ Grob::calculate_dependencies (int final, int busy, SCM funcname) unsmob_grob (scm_car (d))->calculate_dependencies (final, busy, funcname); SCM proc = internal_get_property (funcname); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) scm_call_1 (proc, this->self_scm ()); status_ = final; @@ -231,7 +231,7 @@ Grob::get_uncached_stencil () const SCM proc = get_property ("print-function"); SCM stil = SCM_EOL; - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) stil = scm_apply_0 (proc, scm_list_n (this->self_scm (), SCM_UNDEFINED)); if (Stencil *m = unsmob_stencil (stil)) @@ -419,14 +419,14 @@ bool Grob::is_empty (Axis a) const { return !(scm_is_pair (dim_cache_[a].dimension_) - || ly_c_procedure_p (dim_cache_[a].dimension_callback_)); + || ly_is_procedure (dim_cache_[a].dimension_callback_)); } void Grob::flush_extent_cache (Axis axis) { Dimension_cache *d = &dim_cache_[axis]; - if (ly_c_procedure_p (d->dimension_callback_) + if (ly_is_procedure (d->dimension_callback_) && scm_is_pair (d->dimension_)) { d->dimension_ = SCM_EOL; @@ -447,7 +447,7 @@ Grob::extent (Grob *refp, Axis a) const SCM dimpair = d->dimension_; if (scm_is_pair (dimpair)) ; - else if (ly_c_procedure_p (d->dimension_callback_) + else if (ly_is_procedure (d->dimension_callback_) && d->dimension_ == SCM_EOL) d->dimension_ = scm_call_2 (d->dimension_callback_, self_scm (), scm_int2num (a)); else diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 5b1eda0e09..0d25cf1bdf 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -37,7 +37,7 @@ Hairpin::after_line_breaking (SCM smob) while (flip (&d) != LEFT); if (broken[LEFT] - && ly_c_equal_p (bounds[RIGHT]->get_column ()->get_property ("when"), + && ly_is_equal (bounds[RIGHT]->get_column ()->get_property ("when"), bounds[LEFT]->get_property ("when"))) { me->suicide (); diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index dd28743ccf..b0b302b0ff 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -72,9 +72,12 @@ inline SCM ly_assoc_front_x (SCM alist, SCM key, SCM val) { return scm_acons (key, val, scm_assoc_remove_x (alist, key)); } -inline bool ly_c_list_p (SCM x) { return SCM_NFALSEP (scm_list_p (x)); } -inline bool ly_c_procedure_p (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); } -inline bool ly_c_equal_p (SCM x, SCM y) +inline bool ly_is_list (SCM x) { return SCM_NFALSEP (scm_list_p (x)); } +inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); } +inline bool ly_is_port (SCM x) { return SCM_NFALSEP (scm_port_p (x)); } + + +inline bool ly_is_equal (SCM x, SCM y) { return SCM_NFALSEP (scm_equal_p (x, y)); } diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index 77963e8449..7f0ec4be10 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -29,10 +29,10 @@ public: DECLARE_SMOBS (Paper_outputter,); public: - SCM file (); + SCM file () const; SCM dump_string (SCM); void output_scheme (SCM scm); - Paper_outputter (String nm, String format); + Paper_outputter (SCM port, String format); SCM scheme_to_string (SCM); void output_stencil (Stencil); void close (); diff --git a/lily/item.cc b/lily/item.cc index d478d682e2..1af1ef1a46 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -156,7 +156,7 @@ Item::handle_prebroken_dependencies () more complicated things. */ SCM vis = get_property ("break-visibility"); - if (ly_c_procedure_p (vis)) + if (ly_is_procedure (vis)) { SCM args = scm_list_n (scm_int2num (break_status_dir ()), SCM_UNDEFINED); SCM result = scm_apply_0 (vis, args); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index e8ad6ab2b3..f7fd06fc52 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -80,7 +80,7 @@ Key_engraver::create_key (bool def) if (!def) { SCM vis = get_property ("explicitKeySignatureVisibility"); - if (ly_c_procedure_p (vis)) + if (ly_is_procedure (vis)) item_->set_property ("break-visibility", vis); } } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 5b80d8580b..500aa5d178 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -453,7 +453,7 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) SCM type = scm_object_property (sym, type_symbol); - if (type != SCM_EOL && !ly_c_procedure_p (type)) + if (type != SCM_EOL && !ly_is_procedure (type)) { warning (_f ("can't find property type-check for `%s' (%s).", ly_symbol2string (sym).to_str0 (), @@ -469,7 +469,7 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) else { if (val != SCM_EOL - && ly_c_procedure_p (type) + && ly_is_procedure (type) && scm_call_1 (type, val) == SCM_BOOL_F) { ok = false; @@ -499,7 +499,7 @@ ly_unique (SCM list) for (SCM i = list; scm_is_pair (i); i = scm_cdr (i)) { if (!scm_is_pair (scm_cdr (i)) - || !ly_c_equal_p (scm_car (i), scm_cadr (i))) + || !ly_is_equal (scm_car (i), scm_cadr (i))) unique = scm_cons (scm_car (i), unique); } return scm_reverse_x (unique, SCM_EOL); @@ -560,7 +560,7 @@ ly_split_list (SCM s, SCM list) { SCM i = scm_car (after); after = scm_cdr (after); - if (ly_c_equal_p (i, s)) + if (ly_is_equal (i, s)) break; before = scm_cons (i, before); } @@ -686,7 +686,7 @@ alist_equal_p (SCM a, SCM b) SCM l = scm_assoc (key, b); if (l == SCM_BOOL_F - || !ly_c_equal_p (scm_cdr (l), val)) + || !ly_is_equal (scm_cdr (l), val)) return false; } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 92bf4952c2..48e22c3465 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -102,7 +102,7 @@ Mark_engraver::process_music () SCM m = mark_ev_->get_property ("label"); SCM proc = get_property ("markFormatter"); if (!Text_interface::markup_p (m) - && ly_c_procedure_p (proc)) + && ly_is_procedure (proc)) { if (!scm_is_number (m)) m = get_property ("rehearsalMark"); diff --git a/lily/music-function.cc b/lily/music-function.cc index b1b3bba0bb..b784131650 100644 --- a/lily/music-function.cc +++ b/lily/music-function.cc @@ -43,7 +43,7 @@ LY_DEFINE (ly_make_music_function, "ly:make-music-function", 2, 0, 0, str += "music"; else if (scm_car (s) == ly_lily_module_constant ("markup?")) str += "markup"; - else if (ly_c_procedure_p (scm_car (s))) + else if (ly_is_procedure (scm_car (s))) str += "scm"; } if (str == "") str = "noarg"; diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index bd7dcee4eb..14b084780b 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -78,7 +78,7 @@ Music_iterator::get_static_get_iterator (Music *m) SCM ctor = m->get_property ("iterator-ctor"); SCM iter = SCM_EOL; - if (ly_c_procedure_p (ctor)) + if (ly_is_procedure (ctor)) { iter = scm_call_0 (ctor); p = unsmob_iterator (iter); diff --git a/lily/music.cc b/lily/music.cc index 304f658e4b..c34e970e74 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -100,7 +100,7 @@ Music::get_length () const if (unsmob_moment (lst)) return *unsmob_moment (lst); - if (ly_c_procedure_p (length_callback_)) + if (ly_is_procedure (length_callback_)) { SCM res = scm_call_1 (length_callback_, self_scm ()); return *unsmob_moment (res); @@ -113,7 +113,7 @@ Moment Music::start_mom () const { SCM lst = start_callback_; - if (ly_c_procedure_p (lst)) + if (ly_is_procedure (lst)) { SCM res = scm_call_1 (lst, self_scm ()); return *unsmob_moment (res); @@ -195,7 +195,7 @@ Pitch Music::to_relative_octave (Pitch last) { SCM callback = get_property ("to-relative-callback"); - if (ly_c_procedure_p (callback)) + if (ly_is_procedure (callback)) { Pitch *p = unsmob_pitch (scm_call_2 (callback, self_scm (), last.smobbed_copy ())); return *p; diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 333970b187..3be575f661 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -71,7 +71,7 @@ check_meshing_chords (Grob *me, bool merge_possible = (ups[0] >= dps[0]) && (ups.top () >= dps.top ()); /* Do not merge notes typeset in different style. */ - if (!ly_c_equal_p (nu->get_property ("style"), + if (!ly_is_equal (nu->get_property ("style"), nd->get_property ("style"))) merge_possible = false; diff --git a/lily/note-head.cc b/lily/note-head.cc index bfdc201fc2..b3fb07b8fc 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -42,7 +42,7 @@ internal_print (Grob *me, String *font_char) SCM proc = me->get_property ("glyph-name-procedure"); String suffix = to_string (robust_scm2int (me->get_property ("duration-log"), 2)); - if (scm_procedure_p (proc) == SCM_BOOL_T) + if (ly_is_procedure (proc)) suffix = ly_scm2string (scm_call_2 (proc, log, style)); Font_metric *fm = Font_interface::get_default_font (me); @@ -115,7 +115,7 @@ Note_head::stem_attachment_coordinate (Grob *me, Axis a) Fallback */ SCM v = me->get_property ("stem-attachment-function"); - if (!ly_c_procedure_p (v)) + if (!ly_is_procedure (v)) return 0.0; SCM result = scm_call_2 (v, me->self_scm (), scm_int2num (a)); diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc index c80cc9c051..2400383e61 100644 --- a/lily/output-property-engraver.cc +++ b/lily/output-property-engraver.cc @@ -44,7 +44,7 @@ Output_property_engraver::acknowledge_grob (Grob_info inf) - if (ly_c_procedure_p (pred)) + if (ly_is_procedure (pred)) { /* should typecheck pred. diff --git a/lily/paper-book.cc b/lily/paper-book.cc index cf1585bcd9..97be3c094a 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -160,7 +160,7 @@ Paper_book::book_title () scopes = scm_cons (header_, scopes); SCM tit = SCM_EOL; - if (ly_c_procedure_p (title_func)) + if (ly_is_procedure (title_func)) tit = scm_call_2 (title_func, paper_->self_scm (), scopes); @@ -189,7 +189,7 @@ Paper_book::score_title (SCM header) scopes = scm_cons (header, scopes); SCM tit = SCM_EOL; - if (ly_c_procedure_p (title_func)) + if (ly_is_procedure (title_func)) tit = scm_call_2 (title_func, paper_->self_scm (), scopes); diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc index 2c8af7e906..81d1fcd29a 100644 --- a/lily/paper-outputter-scheme.cc +++ b/lily/paper-outputter-scheme.cc @@ -10,25 +10,25 @@ #include "warn.hh" #include "stencil.hh" + + LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter", - 2, 0, 0, (SCM outname, SCM format), + 2, 0, 0, (SCM port, SCM format), "Create an outputter that evaluates within " - "@code{output-}@var{format}, writing to file @var{outname}.") + "@code{output-}@var{format}, writing to @var{port}.") { - SCM_ASSERT_TYPE (scm_is_string (outname), outname, SCM_ARG1, __FUNCTION__, - "String"); + SCM_ASSERT_TYPE (ly_is_port (port), port, SCM_ARG1, __FUNCTION__, + "port"); SCM_ASSERT_TYPE (scm_is_string (format), format, SCM_ARG2, __FUNCTION__, "String"); - String outname_str = ly_scm2string (outname); String f = ly_scm2string (format); message (_f ("Layout output to `%s'...", - outname_str == "-" - ? String ("") - : outname_str)); + ly_scm2string (scm_port_filename (port)).to_str0 ())); + progress_indication ("\n"); - Paper_outputter *po = new Paper_outputter (outname_str, f); + Paper_outputter *po = new Paper_outputter (port, f); scm_gc_unprotect_object (po->self_scm ()); return po->self_scm (); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 778c15880e..de9c16fc87 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -27,13 +27,12 @@ #include "ly-smobs.icc" -Paper_outputter::Paper_outputter (String file_name, String format) +Paper_outputter::Paper_outputter (SCM port, String format) { - file_ = SCM_EOL; + file_ = port; output_module_ = SCM_EOL; smobify_self (); - file_name_ = file_name; String module_name = "scm output-" + format; output_module_ = scm_c_resolve_module (module_name.to_str0 ()); } @@ -62,18 +61,8 @@ Paper_outputter::print_smob (SCM x, SCM p, scm_print_state*) } SCM -Paper_outputter::file () +Paper_outputter::file () const { - if (file_ == SCM_EOL) - if (file_name_ == "-") - file_ = scm_current_output_port (); - else - /* - Opening binary sucks a little for DOS, since PS doesn't look like - ASCII anymore, but binary CFFs will get embedded correctly. - */ - file_ = scm_open_file (scm_makfrom0str (file_name_.to_str0 ()), - scm_makfrom0str ("wb")); return file_; } diff --git a/lily/parser.yy b/lily/parser.yy index b12b03e796..78d54517a3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -84,7 +84,7 @@ tag_music (Music *m, SCM tag, Input ip) SCM tags = m->get_property ("tags"); if (scm_is_symbol (tag)) tags = scm_cons (tag, tags); - else if (ly_c_list_p (tag)) + else if (ly_is_list (tag)) tags = ly_append2 (tag, tags); else ip.warning (_ ("tag must be symbol or list of symbols")); @@ -171,8 +171,8 @@ make_chord (SCM pitch, SCM dur, SCM modification_list) bool ly_input_procedure_p (SCM x) { - return ly_c_procedure_p (x) - || (scm_is_pair (x) && ly_c_procedure_p (scm_car (x))); + return ly_is_procedure (x) + || (scm_is_pair (x) && ly_is_procedure (scm_car (x))); } Music* @@ -999,7 +999,7 @@ Repeated_music: r->set_property ("repeat-count", scm_int2num (max (times, 1))); r-> set_property ("elements",alts); - if (ly_c_equal_p ($2, scm_makfrom0str ("tremolo"))) { + if (ly_is_equal ($2, scm_makfrom0str ("tremolo"))) { /* TODO: move this code to Scheme. */ @@ -2756,7 +2756,7 @@ property_op_to_music (SCM op) bool itc = do_internal_type_checking_global; /* UGH. */ - bool autobeam = ly_c_equal_p (symbol, ly_symbol2scm ("autoBeamSettings")); + bool autobeam = ly_is_equal (symbol, ly_symbol2scm ("autoBeamSettings")); if (autobeam) do_internal_type_checking_global = false; m->set_property ("grob-property", grob_sym); diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 835d6b1f59..c1c3bcb250 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -154,7 +154,7 @@ Piano_pedal_engraver::try_music (Music *m) for (Pedal_info *p = info_list_; p->name_; p++) { String nm = p->name_ + String ("Event"); - if (ly_c_equal_p (m->get_property ("name"), + if (ly_is_equal (m->get_property ("name"), scm_str2symbol (nm.to_str0 ()))) { Direction d = to_dir (m->get_property ("span-direction")); diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index 8393fbe83d..242a181fcd 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -128,7 +128,7 @@ Piano_pedal_performer::try_music (Music *r) for (Pedal_info *p = info_alist_; p->name_; p++) { String nm = p->name_ + String ("Event"); - if (ly_c_equal_p (r->get_property ("name"), + if (ly_is_equal (r->get_property ("name"), scm_str2symbol (nm.to_str0 ()))) { Direction d = to_dir (r->get_property ("span-direction")); diff --git a/lily/recording-group-engraver.cc b/lily/recording-group-engraver.cc index 5b98ba672d..5cf6c71304 100644 --- a/lily/recording-group-engraver.cc +++ b/lily/recording-group-engraver.cc @@ -68,7 +68,7 @@ Recording_group_engraver::finalize () Engraver_group_engraver::finalize (); SCM proc = get_property ("recordEventSequence"); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) scm_call_2 (proc, context ()->self_scm (), scm_cdr (accumulator_)); } diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index 376a89b0ab..77b840d597 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -96,7 +96,7 @@ Repeat_acknowledge_engraver::process_music () */ SCM wb = get_property ("whichBar"); SCM db = get_property ("defaultBarType"); - if (!scm_is_string (wb) || ly_c_equal_p (db, wb)) + if (!scm_is_string (wb) || ly_is_equal (db, wb)) { if (s != "" || (volta_found && !scm_is_string (wb))) { diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index bc001d68a7..42a766b339 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -60,7 +60,7 @@ Script_engraver::try_music (Music *m) /* Discard double articulations for part-combining. */ int script_count = scripts_.size (); for (int i = 0; i < script_count; i++) - if (ly_c_equal_p (scripts_[i].event_ + if (ly_is_equal (scripts_[i].event_ ->get_property ("articulation-type"), m->get_property ("articulation-type"))) return true; @@ -116,7 +116,7 @@ void make_script_from_event (Grob *p, bool *follow, Context *tg, { SCM sym = scm_caar (s); SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?")); - if (!ly_c_procedure_p (type)) + if (!ly_is_procedure (type)) continue; SCM val = scm_cdar (s); diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 7239ba9289..84a1beaf49 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -824,7 +824,7 @@ Slur_score_state::get_extra_encompass_infos () const if (to_boolean (g->get_property ("cautionary"))) { SCM cstyle = g->get_property ("cautionary-style"); - parens = ly_c_equal_p (cstyle, ly_symbol2scm ("parentheses")); + parens = ly_is_equal (cstyle, ly_symbol2scm ("parentheses")); } SCM accs = g->get_property ("accidentals"); diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc index a3d1fc4887..80339b3ce8 100644 --- a/lily/span-bar-engraver.cc +++ b/lily/span-bar-engraver.cc @@ -64,7 +64,7 @@ Span_bar_engraver::stop_translation_timestep () SCM vissym = ly_symbol2scm ("break-visibility"); SCM vis = bars_[0]->internal_get_property (vissym); - if (ly_c_equal_p (spanbar_->internal_get_property (vissym), vis)) + if (ly_is_equal (spanbar_->internal_get_property (vissym), vis)) spanbar_->internal_set_property (vissym, vis); spanbar_ = 0; diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index b497f3f9af..4b40e88659 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -293,7 +293,7 @@ LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression", 4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset), "Parse EXPR, feed bits to FUNC with first arg ARG1") { - SCM_ASSERT_TYPE (ly_c_procedure_p (func), func, SCM_ARG1, __FUNCTION__, + SCM_ASSERT_TYPE (ly_is_procedure (func), func, SCM_ARG1, __FUNCTION__, "procedure"); Stencil_interpret_arguments a; diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index bf6daa8b9e..389c355a1a 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -45,11 +45,11 @@ System_start_delimiter_engraver::acknowledge_grob (Grob_info inf) /* UGH UGH */ - if (scm_is_string (gl) && ly_c_equal_p (gl, scm_makfrom0str ("brace")) - && scm_is_string (my_gl) && ly_c_equal_p (my_gl, scm_makfrom0str ("bracket"))) + if (scm_is_string (gl) && ly_is_equal (gl, scm_makfrom0str ("brace")) + && scm_is_string (my_gl) && ly_is_equal (my_gl, scm_makfrom0str ("bracket"))) inf.grob ()->translate_axis (-0.8, X_AXIS); // ugh - else if (scm_is_string (gl) && ly_c_equal_p (gl, scm_makfrom0str ("bracket")) - && scm_is_string (my_gl) && ly_c_equal_p (my_gl, scm_makfrom0str ("bracket"))) + else if (scm_is_string (gl) && ly_is_equal (gl, scm_makfrom0str ("bracket")) + && scm_is_string (my_gl) && ly_is_equal (my_gl, scm_makfrom0str ("bracket"))) { inf.grob ()->translate_axis (-0.8, X_AXIS); // ugh } diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 9192c7acf3..8e978a4bc5 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -65,7 +65,7 @@ System_start_delimiter::after_line_breaking (SCM smob) Spanner *me = dynamic_cast (unsmob_grob (smob)); SCM gl = me->get_property ("glyph"); - if (ly_c_equal_p (gl, scm_makfrom0str ("bar-line"))) + if (ly_is_equal (gl, scm_makfrom0str ("bar-line"))) { int count = 0; Paper_column *left_column = me->get_bound (LEFT)->get_column (); diff --git a/lily/system.cc b/lily/system.cc index cf011b16ce..2a88a4ae3c 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -243,7 +243,7 @@ System::pre_processing () { Grob *e = unsmob_grob (scm_car (s)); SCM proc = e->get_property ("spacing-procedure"); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) scm_call_1 (proc, e->self_scm ()); } } diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 2e9ce6c196..0705690f17 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -115,7 +115,7 @@ Tie_engraver::acknowledge_grob (Grob_info i) maybe should check positions too. */ if (right_mus && left_mus - && ly_c_equal_p (right_mus->get_property ("pitch"), + && ly_is_equal (right_mus->get_property ("pitch"), left_mus->get_property ("pitch"))) { Grob *p = new Spanner (heads_to_tie_[i].tie_definition_, diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index f415317ae7..652046e0a6 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -69,7 +69,7 @@ Tie_performer::acknowledge_audio_element (Audio_element_info inf) Music *left_mus = heads_to_tie_[i].event_; if (right_mus && left_mus - && ly_c_equal_p (right_mus->get_property ("pitch"), + && ly_is_equal (right_mus->get_property ("pitch"), left_mus->get_property ("pitch"))) { an->tie_to (th); diff --git a/lily/time-signature-performer.cc b/lily/time-signature-performer.cc index 397b3cf653..072990db3f 100644 --- a/lily/time-signature-performer.cc +++ b/lily/time-signature-performer.cc @@ -47,7 +47,7 @@ void Time_signature_performer::create_audio_elements () { SCM fr = get_property ("timeSignatureFraction"); - if (scm_is_pair (fr) && !ly_c_equal_p (fr, prev_fraction_)) + if (scm_is_pair (fr) && !ly_is_equal (fr, prev_fraction_)) { prev_fraction_ = fr; int b = scm_to_int (scm_car (fr)); diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index bf82dc0931..2b1df50fa2 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -76,7 +76,7 @@ Tuplet_engraver::process_music () tuplets_[i].spanner_ = spanner; SCM proc = get_property ("tupletNumberFormatFunction"); - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) { SCM t = scm_apply_0 (proc, scm_list_1 (tuplets_[i].music_->self_scm ())); spanner->set_property ("text", t); diff --git a/lily/tweak-registration-scheme.cc b/lily/tweak-registration-scheme.cc index 694f4e4451..7770d9b13c 100644 --- a/lily/tweak-registration-scheme.cc +++ b/lily/tweak-registration-scheme.cc @@ -26,7 +26,7 @@ LY_DEFINE (ly_grob_insert_tweak, "ly:grob-insert-tweak", Grob *gr = unsmob_grob (grob); SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "Grob"); SCM_ASSERT_TYPE (scm_list_p (tweak) == SCM_BOOL_T - && ly_c_procedure_p (scm_car (tweak)), + && ly_is_procedure (scm_car (tweak)), tweak, SCM_ARG2, __FUNCTION__, "Tweak"); global_registry_->insert_grob_tweak (gr, tweak); @@ -41,7 +41,7 @@ LY_DEFINE (ly_grob_replace_tweak, "ly:grob-replace-tweak", Grob *gr = unsmob_grob (grob); SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "Grob"); SCM_ASSERT_TYPE (scm_list_p (tweak) == SCM_BOOL_T - && ly_c_procedure_p (scm_car (tweak)), + && ly_is_procedure (scm_car (tweak)), tweak, SCM_ARG2, __FUNCTION__, "Tweak"); global_registry_->replace_grob_tweak (gr, tweak); diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 0dad2a827b..27f0b65df3 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -408,7 +408,9 @@ (define-public (output-framework basename book scopes fields) (let* ((filename (format "~a.ps" basename)) - (outputter (ly:make-paper-outputter filename "ps")) + (outputter (ly:make-paper-outputter + (open-file filename "wb") + "ps")) (paper (ly:paper-book-paper book)) (pages (ly:paper-book-pages book)) (landscape? (eq? (ly:output-def-lookup paper 'landscape) #t)) @@ -449,7 +451,11 @@ (max (1+ (car box)) (caddr box)) (max (1+ (cadr box)) (cadddr box))))) - (let* ((outputter (ly:make-paper-outputter (format "~a.eps" filename) "ps")) + (let* ((outputter (ly:make-paper-outputter + + ;; need to have binary for embedding CFFs + (open-file (format "~a.eps" filename) "wb") + "ps")) (port (ly:outputter-port outputter)) (xext (ly:stencil-extent dump-me X)) (yext (ly:stencil-extent dump-me Y)) diff --git a/scm/framework-svg.scm b/scm/framework-svg.scm index 192b7960c2..9efd4f8328 100644 --- a/scm/framework-svg.scm +++ b/scm/framework-svg.scm @@ -18,7 +18,7 @@ (define-public (output-framework basename book scopes fields) (let* ((filename (format "~a.svg" basename)) - (outputter (ly:make-paper-outputter filename + (outputter (ly:make-paper-outputter (open-file filename "wb") (ly:output-backend))) (dump (lambda (str) (display str (ly:outputter-port outputter)))) (paper (ly:paper-book-paper book)) diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index 441fcd557d..a6b28b1d23 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -191,7 +191,7 @@ (define-public (output-framework basename book scopes fields) (let* ((filename (format "~a.tex" basename)) - (outputter (ly:make-paper-outputter filename "tex")) + (outputter (ly:make-paper-outputter (open-file filename "wb") "tex")) (paper (ly:paper-book-paper book)) (pages (ly:paper-book-pages book)) (last-page (car (last-pair pages))) @@ -233,7 +233,8 @@ (define-public (output-classic-framework basename book scopes fields) (let* ((filename (format "~a.tex" basename)) - (outputter (ly:make-paper-outputter filename "tex")) + (outputter (ly:make-paper-outputter + (open-file filename "w") "tex")) (paper (ly:paper-book-paper book)) (lines (ly:paper-book-systems book)) (last-line (car (last-pair lines)))) @@ -259,7 +260,7 @@ (define-public (output-preview-framework basename book scopes fields) (let* ((filename (format "~a.tex" basename)) - (outputter (ly:make-paper-outputter filename + (outputter (ly:make-paper-outputter (open-file filename "wb") "tex")) (paper (ly:paper-book-paper book)) (lines (ly:paper-book-systems book)) diff --git a/scm/framework-texstr.scm b/scm/framework-texstr.scm index df677004e8..7fd5294b49 100644 --- a/scm/framework-texstr.scm +++ b/scm/framework-texstr.scm @@ -32,7 +32,9 @@ (define-public (output-classic-framework basename book scopes fields) (let* ((filename (format "~a.texstr" basename)) - (outputter (ly:make-paper-outputter filename (ly:output-backend))) + (outputter (ly:make-paper-outputter + (open-file filename "wb") + (ly:output-backend))) (paper (ly:paper-book-paper book)) (lines (ly:paper-book-systems book))) (ly:outputter-dump-string outputter (header basename)) @@ -44,7 +46,10 @@ (define-public (output-framework basename book scopes fields ) (let* ((filename (format "~a.texstr" basename)) - (outputter (ly:make-paper-outputter filename (ly:output-backend))) + (outputter + (ly:make-paper-outputter + (open-file filename "wb") + (ly:output-backend))) (paper (ly:paper-book-paper book)) (pages (ly:paper-book-pages book))) (ly:outputter-dump-string outputter (header basename)) -- 2.39.2