Mercurial > hg > octave-nkf
changeset 16312:d81ef5e64cf1
Accept only case-sensitive keywords 'default', 'factory', 'remove' for graphics properties.
For Matlab compatibility, change escaped versions of keywords ('\keyword') to 'keyword'.
* libinterp/interpfcn/graphics.cc(set, set_value_or_default): Switch from
caseless_str to std::string so that compare() is case sensitive. Look for
escaped keyword ('\default', '\factory') and replace with bare keyword.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 15 Mar 2013 10:21:06 -0700 |
parents | 9c4ac8f25a8c |
children | 54c4b4b58a24 |
files | libinterp/interpfcn/graphics.cc |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/graphics.cc +++ b/libinterp/interpfcn/graphics.cc @@ -1789,9 +1789,9 @@ bool remove = false; if (val.is_string ()) { - caseless_str tval = val.string_value (); - - remove = tval.compare ("remove"); + std::string tval = val.string_value (); + + remove = (tval.compare ("remove") == 0); } pval_map_type& pval_map = plist_map[pfx]; @@ -2105,11 +2105,11 @@ { if (val.is_string ()) { - caseless_str tval = val.string_value (); + std::string tval = val.string_value (); octave_value default_val; - if (tval.compare ("default")) + if (tval.compare ("default") == 0) { default_val = get_default (name); @@ -2118,7 +2118,7 @@ rep->set (name, default_val); } - else if (tval.compare ("factory")) + else if (tval.compare ("factory") == 0) { default_val = get_factory_default (name); @@ -2128,7 +2128,15 @@ rep->set (name, default_val); } else - rep->set (name, val); + { + // Matlab specifically uses "\default" to escape string setting + if (tval.compare ("\\default") == 0) + rep->set (name, "default"); + else if (tval.compare ("\\factory") == 0) + rep->set (name, "factory"); + else + rep->set (name, val); + } } else rep->set (name, val);