X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fprogram-option-scheme.cc;h=88d16e167f94e904b99e0a6f111776e9c05d70f4;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=616e99397a4d2c8c70b7cd5235bf08a9350fcf35;hpb=16ac0db39d8cca1de68ce79154386764172aca10;p=lilypond.git diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index 616e99397a..88d16e167f 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2001--2012 Han-Wen Nienhuys + Copyright (C) 2001--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,8 @@ using namespace std; #include "parse-scm.hh" #include "string-convert.hh" #include "warn.hh" +#include "lily-imports.hh" +#include "protected-scm.hh" bool debug_skylines; bool debug_property_callbacks; @@ -37,11 +39,6 @@ bool debug_page_breaking_scoring; bool music_strings_to_paths; bool relative_includes; -/* - Backwards compatibility. -*/ -bool lily_1_8_relative = false; -bool lily_1_8_compatibility_used = false; bool profile_property_accesses = false; /* crash if internally the wrong type is used for a grob property. @@ -49,7 +46,7 @@ bool profile_property_accesses = false; bool do_internal_type_checking_global; bool strict_infinity_checking = false; -static SCM option_hash; +static Protected_scm option_hash; void internal_set_option (SCM var, @@ -85,13 +82,6 @@ internal_set_option (SCM var, be_safe_global = valbool; val = val_scm_bool; } - else if (varstr == "old-relative") - { - lily_1_8_relative = valbool; - /* Needs to be reset for each file that uses this option. */ - lily_1_8_compatibility_used = valbool; - val = val_scm_bool; - } else if (varstr == "strict-infinity-checking") { strict_infinity_checking = valbool; @@ -148,7 +138,6 @@ static string get_help_string () { SCM alist = ly_hash2alist (option_hash); - SCM converter = ly_lily_module_constant ("scm->string"); vector opts; @@ -159,7 +148,7 @@ get_help_string () string opt_spec = String_convert::char_string (' ', INDENT) + ly_symbol2string (sym) + " (" - + ly_scm2string (scm_call_1 (converter, val)) + + ly_scm2string (Lily::scm_to_string (val)) + ")"; if (opt_spec.length () + SEPARATION > HELP_INDENT) @@ -202,8 +191,8 @@ LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0, "Add a program option @var{sym}. @var{val} is the default" " value and @var{description} is a string description.") { - if (!option_hash) - option_hash = scm_permanent_object (scm_c_make_hash_table (11)); + if (!option_hash.is_bound ()) + option_hash = scm_c_make_hash_table (11); LY_ASSERT_TYPE (ly_is_symbol, sym, 1); LY_ASSERT_TYPE (scm_is_string, description, 3); @@ -220,7 +209,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), { LY_ASSERT_TYPE (ly_is_symbol, var, 1); - if (val == SCM_UNDEFINED) + if (SCM_UNBNDP (val)) val = SCM_BOOL_T; string varstr = robust_symbol2string (var, ""); @@ -231,7 +220,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), } SCM handle = scm_hashq_get_handle (option_hash, var); - if (handle == SCM_BOOL_F) + if (scm_is_false (handle)) warning (_f ("no such internal option: %s", varstr.c_str ())); internal_set_option (var, val);