From: Bertrand Bordage Date: Tue, 18 Oct 2011 12:46:14 +0000 (+0200) Subject: Clean some code using robust_symbol2string. X-Git-Tag: release/2.15.15-1~33 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=71aa438bce0f68b0e8ab8c633b4902c971ede48b;p=lilypond.git Clean some code using robust_symbol2string. --- diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 0848ec70f6..a5a4e6858f 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -181,7 +181,7 @@ LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", LY_ASSERT_TYPE (ly_is_symbol, symbol, 2); - SCM val = parser->lexer_->lookup_identifier (ly_scm2string (scm_symbol_to_string (symbol))); + SCM val = parser->lexer_->lookup_identifier (ly_symbol2string (symbol)); if (val != SCM_UNDEFINED) return val; else diff --git a/lily/page-turn-engraver.cc b/lily/page-turn-engraver.cc index 925a57c218..1acbf8a13d 100644 --- a/lily/page-turn-engraver.cc +++ b/lily/page-turn-engraver.cc @@ -172,7 +172,7 @@ IMPLEMENT_TRANSLATOR_LISTENER (Page_turn_engraver, break); void Page_turn_engraver::listen_break (Stream_event *ev) { - string name = ly_scm2string (scm_symbol_to_string (ev->get_property ("class"))); + string name = ly_symbol2string (ev->get_property ("class")); if (name == "page-turn-event") { diff --git a/lily/paper-column-engraver.cc b/lily/paper-column-engraver.cc index c447db1790..43fb6cbed2 100644 --- a/lily/paper-column-engraver.cc +++ b/lily/paper-column-engraver.cc @@ -163,7 +163,7 @@ Paper_column_engraver::handle_manual_breaks (bool only_do_permissions) { string prefix; SCM name_sym = break_events_[i]->get_property ("class"); - string name = ly_scm2string (scm_symbol_to_string (name_sym)); + string name = ly_symbol2string (name_sym); size_t end = name.rfind ("-event"); if (end) prefix = name.substr (0, end); diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index ca22a2dff4..0a6c3a80dc 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -55,81 +55,84 @@ void internal_set_option (SCM var, SCM val) { + string varstr = robust_symbol2string (var, ""); + bool valbool = to_boolean (val); + SCM val_scm_bool = scm_from_bool (valbool); if (0) ; - else if (var == ly_symbol2scm ("profile-property-accesses")) + else if (varstr == "profile-property-accesses") { - profile_property_accesses = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + profile_property_accesses = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("point-and-click")) + else if (varstr == "point-and-click") { - point_and_click_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + point_and_click_global = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("protected-scheme-parsing")) + else if (varstr == "protected-scheme-parsing") { - parse_protect_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + parse_protect_global = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("check-internal-types")) + else if (varstr == "check-internal-types") { - do_internal_type_checking_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + do_internal_type_checking_global = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead")) + else if (varstr == "debug-gc-assert-parsed-dead") { - parsed_objects_should_be_dead = to_boolean (val); - val = scm_from_bool (parsed_objects_should_be_dead); + parsed_objects_should_be_dead = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("safe")) + else if (varstr == "safe") { - be_safe_global = to_boolean (val); - val = scm_from_bool (be_safe_global); + be_safe_global = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("old-relative")) + else if (varstr == "old-relative") { - lily_1_8_relative = to_boolean (val); + lily_1_8_relative = valbool; /* Needs to be reset for each file that uses this option. */ - lily_1_8_compatibility_used = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + lily_1_8_compatibility_used = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("strict-infinity-checking")) + else if (varstr == "strict-infinity-checking") { - strict_infinity_checking = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + strict_infinity_checking = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("debug-skylines")) + else if (varstr == "debug-skylines") { - debug_skylines = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + debug_skylines = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("debug-property-callbacks")) + else if (varstr == "debug-property-callbacks") { - debug_property_callbacks = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + debug_property_callbacks = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("debug-page-breaking-scoring")) + else if (varstr == "debug-page-breaking-scoring") { - debug_page_breaking_scoring = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + debug_page_breaking_scoring = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("datadir")) + else if (varstr == "datadir") { /* ignore input value. */ val = ly_string2scm (lilypond_datadir); } - else if (var == ly_symbol2scm ("relative-includes")) + else if (varstr == "relative-includes") { - relative_includes = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + relative_includes = valbool; + val = val_scm_bool; } - else if (var == ly_symbol2scm ("warning-as-error")) - val = scm_from_bool (to_boolean (val)); - else if (var == ly_symbol2scm ("music-strings-to-paths")) + else if (varstr == "warning-as-error") + val = val_scm_bool; + else if (varstr == "music-strings-to-paths") { - music_strings_to_paths = to_boolean (val); - val = scm_from_bool (to_boolean (val)); + music_strings_to_paths = valbool; + val = val_scm_bool; } scm_hashq_set_x (option_hash, var, val); @@ -221,7 +224,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), if (val == SCM_UNDEFINED) val = SCM_BOOL_T; - string varstr = ly_scm2string (scm_symbol_to_string (var)); + string varstr = robust_symbol2string (var, ""); if (varstr.substr (0, 3) == string ("no-")) { var = ly_symbol2scm (varstr.substr (3, varstr.length () - 3).c_str ()); diff --git a/lily/rest.cc b/lily/rest.cc index 0115e5176f..d86296fada 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -149,10 +149,7 @@ Rest::brew_internal_stencil (Grob *me, bool ledgered) int balltype = scm_to_int (balltype_scm); - string style; - SCM style_scm = me->get_property ("style"); - if (scm_is_symbol (style_scm)) - style = ly_scm2string (scm_symbol_to_string (style_scm)); + string style = robust_symbol2string (me->get_property ("style"), "default"); Font_metric *fm = Font_interface::get_default_font (me); string font_char = glyph_name (me, balltype, style, ledgered); diff --git a/lily/stem.cc b/lily/stem.cc index f6bedcfd95..c217d0de15 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -849,11 +849,10 @@ Stem::offset_callback (SCM smob) Real r = real_attach; /* If not centered: correct for stem thickness. */ - extract_grob_set (me, "note-heads", heads); - SCM style = heads[0]->get_property ("style"); - if (attach && !scm_is_eq (style, ly_symbol2scm ("mensural")) - && !scm_is_eq (style, ly_symbol2scm ("neomensural")) - && !scm_is_eq (style, ly_symbol2scm ("petrucci"))) + string style = robust_symbol2string (f->get_property ("style"), "default"); + if (attach && style != "mensural" + && style != "neomensural" + && style != "petrucci") { Real rule_thick = thickness (me); r += -d * rule_thick * 0.5; diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 0b22eff640..b15139a61e 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -66,7 +66,7 @@ Time_signature::print (SCM smob) Stencil Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d) { - string style = ly_scm2string (scm_symbol_to_string (scm_style)); + string style = robust_symbol2string (scm_style, "default"); if (style == "numbered") return numbered_time_signature (me, n, d);