Mercurial > forge
changeset 9689:52bed4508230 octave-forge
__lookup_compat__: package is now dependent on older versions of octave, removing compatibility fix exclusive for 3.2.X
author | carandraug |
---|---|
date | Tue, 13 Mar 2012 22:47:05 +0000 |
parents | a80a8a99b384 |
children | a2504a30b53e |
files | main/general/inst/@dict/get.m main/general/inst/@dict/has.m main/general/inst/@dict/private/__lookup_compat__.m main/general/inst/@dict/subsasgn.m main/general/inst/@dict/subsref.m |
diffstat | 5 files changed, 0 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/main/general/inst/@dict/get.m Tue Mar 13 22:42:26 2012 +0000 +++ b/main/general/inst/@dict/get.m Tue Mar 13 22:47:05 2012 +0000 @@ -29,8 +29,6 @@ print_usage (); endif - lookup = __lookup_compat__; # FIXME: remove when 3.3.x is required. - if (ischar (key)) i = lookup (d.keys, key, "m"); if (i)
--- a/main/general/inst/@dict/has.m Tue Mar 13 22:42:26 2012 +0000 +++ b/main/general/inst/@dict/has.m Tue Mar 13 22:47:05 2012 +0000 @@ -28,8 +28,6 @@ print_usage (); endif - lookup = __lookup_compat__; # FIXME: remove when 3.3.x is required. - if (ischar (key) || iscellstr (key)) b = lookup (d.keys, key, "b"); else
--- a/main/general/inst/@dict/private/__lookup_compat__.m Tue Mar 13 22:42:26 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -## Copyright (C) 2009 VZLU Prague, a.s., Czech Republic -## -## This program is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free Software -## Foundation; either version 3 of the License, or (at your option) any later -## version. -## -## This program is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -## details. -## -## You should have received a copy of the GNU General Public License along with -## this program; if not, see <http://www.gnu.org/licenses/>. - -## This replaces the missing functionality of "lookup" if on Octave 3.2. - -## Author: Jaroslav Hajek <highegg@gmail.com> - -function lookup_func = __lookup_compat__ () - persistent octave32 = issorted ({"3.0.0", version, "3.3.0"}); - if (octave32) - lookup_func = @__my_lookup__; - else - lookup_func = @lookup; - endif -endfunction - -function ind = __my_lookup__ (table, y, opt = "") - - mopt = any (opt == 'm'); - bopt = any (opt == 'b'); - - opt(opt == 'm' | opt == 'b') = []; - - ind = lookup (table, y, opt); - if (numel (table) > 0) - if (ischar (table) || iscellstr (table)) - match = strcmp (table(max (1, ind)), y); - else - match = table(max (1, ind)) == y; - endif - else - match = false (size (y)); - endif - - if (mopt) - ind(! match) = 0; - elseif (bopt) - ind = match; - endif -endfunction - - - -
--- a/main/general/inst/@dict/subsasgn.m Tue Mar 13 22:42:26 2012 +0000 +++ b/main/general/inst/@dict/subsasgn.m Tue Mar 13 22:47:05 2012 +0000 @@ -25,8 +25,6 @@ error ("dict: missing index"); endif - lookup = __lookup_compat__; # FIXME: remove when 3.3.x is required. - switch (s(1).type) case "()" ind = s(1).subs;
--- a/main/general/inst/@dict/subsref.m Tue Mar 13 22:42:26 2012 +0000 +++ b/main/general/inst/@dict/subsref.m Tue Mar 13 22:47:05 2012 +0000 @@ -25,8 +25,6 @@ error ("dict: missing index"); endif - lookup = __lookup_compat__; # FIXME: remove when 3.3.x is required. - switch (s(1).type) case "()" ind = s(1).subs;