Mercurial > hg > octave-shane
changeset 11346:30f54b3b9953
drop support of 'i' option in lookup
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 12 Dec 2010 21:58:30 +0100 |
parents | 488f07b65b1d |
children | 2726132f77f6 |
files | scripts/ChangeLog scripts/miscellaneous/parseparams.m scripts/optimization/optimget.m scripts/optimization/optimset.m src/ChangeLog src/DLD-FUNCTIONS/lookup.cc |
diffstat | 6 files changed, 15 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2010-12-12 Jaroslav Hajek <highegg@gmail.com> + + * optimization/optimget.m: Use explicit toupper conversion rather than + lookup(..., "i"). + * optimization/optimset.m: Ditto. + * miscellaneous/parseparams.m: Ditto. + 2010-12-12 Kai Habel <kai.habel@gmx.de> * plot/view.m: Fix bugs with respect to number if inputs and argument
--- a/scripts/miscellaneous/parseparams.m +++ b/scripts/miscellaneous/parseparams.m @@ -88,7 +88,7 @@ if (! size_equal (pnames, values) || ! all (strs(i:2:end))) error_as_caller ("options must be given as name-value pairs"); endif - idx = lookup (names, pnames, "mi"); + idx = lookup (toupper(names), toupper(pnames), "mi); if (! all (idx)) error_as_caller ("unrecognized option: %s", pnames{find (idx == 0, 1)}); else
--- a/scripts/optimization/optimget.m +++ b/scripts/optimization/optimget.m @@ -33,7 +33,7 @@ endif opts = __all_opts__ (); - idx = lookup (opts, parname, "im"); + idx = lookup (toupper(opts), toupper(parname), "m"); if (idx) parname = opts{idx};
--- a/scripts/optimization/optimset.m +++ b/scripts/optimization/optimset.m @@ -59,10 +59,11 @@ fnames = fieldnames (old); ## skip validation if we're in the internal query validation = ! isempty (opts); + uopts = toupper(opts); for [val, key] = new if (validation) ## Case insensitive lookup in all options. - i = lookup (opts, key, "i"); + i = lookup (uopts, toupper(key), "i"); ## Validate option. if (i > 0 && strcmpi (opts{i}, key)) ## Use correct case.
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-12-12 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/lookup.cc (Flookup): Drop support for the "i" option. + 2010-12-09 Marco Atzeri <marco_atzeri@yahoo.it> * mappers.cc: In test for gamma, expect Inf for gamma(-1), not NaN.
--- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -232,9 +232,6 @@ For numeric lookups\n\ the rightmost subinterval shall be extended to infinity (i.e., all indices\n\ at most n-1).\n\ -\n\ -@item i\n\ -For string lookups, use case-insensitive comparison.\n\ @end table\n\ @end deftypefn") { @@ -259,14 +256,12 @@ bool right_inf = false; bool match_idx = false; bool match_bool = false; - bool icase = false; if (nargin == 3) { std::string opt = args(2).string_value (); left_inf = contains_char (opt, 'l'); right_inf = contains_char (opt, 'r'); - icase = contains_char (opt, 'i'); match_idx = contains_char (opt, 'm'); match_bool = contains_char (opt, 'b'); } @@ -277,8 +272,6 @@ error ("lookup: only one of m, b can be specified"); else if (str_case && (left_inf || right_inf)) error ("lookup: l,r not recognized for string lookups"); - else if (num_case && icase) - error ("lookup: i not recognized for numeric lookups"); if (error_state) return retval; @@ -325,13 +318,6 @@ } else if (str_case) { - // FIXME: this should be handled directly. - if (icase) - { - table = table.xtoupper (); - y = y.xtoupper (); - } - Array<std::string> str_table = table.cellstr_value (); Array<std::string> str_y (1, 1);