[Pkg-octave-commit] [SCM] Debian packaging for octave-miscellaneous branch, master, updated. df82b9236277a2fff70371e2b1b1ea0cd7411232

Sébastien Villemot sebastien.villemot at ens.fr
Fri Mar 9 12:07:56 UTC 2012


The following commit has been merged in the master branch:
commit c79dd272aae1d9d16158e3f1837ef061644d9109
Author: Sébastien Villemot <sebastien.villemot at ens.fr>
Date:   Fri Mar 9 12:45:30 2012 +0100

    debian/patches/match-cell-array.patch: new patch

diff --git a/debian/patches/match-cell-array.patch b/debian/patches/match-cell-array.patch
new file mode 100644
index 0000000..d1716cf
--- /dev/null
+++ b/debian/patches/match-cell-array.patch
@@ -0,0 +1,108 @@
+Description: Bug fix for match, make it work properly for cell arrays
+Author: Carnë Draug <carandraug+dev at gmail.com>
+Origin: commit: 9780, 9781
+Last-Update: 2012-03-09
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/inst/match.m
++++ b/inst/match.m
+@@ -1,18 +1,18 @@
+-## Copyright (C) 2007 Muthiah Annamalai
++## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai at mavs.uta.edu>
++## Copyright (C) 2012 Carnë Draug <carandraug+dev at gmail.com>
+ ##
+-## 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 2, or (at your option) any later version.
++## 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 software 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
++## 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/>.
++## You should have received a copy of the GNU General Public License along with
++## this program; if not, see <http://www.gnu.org/licenses/>.
+ 
+ ## -*- texinfo -*-
+ ## @deftypefn {Function File}  @var{result} = {} match ( @var{fun_handle}, @var{iterable} )
+@@ -36,39 +36,39 @@
+ ## [1, 2]
+ ## @end example
+ ## @end deftypefn
+- 
+-## Last Modified by Muthiah Annamalai
+ 
+-function rval = match (fun_handle,data)
+-  
+-  if (nargin >= 1)
+-
+-    try
+-      if ( ischar(fun_handle) )
+-	fun_handle=eval(strcat("@",fun_handle));
+-      end
+-      fstr=typeinfo(fun_handle);
+-    catch
+-      error('Error: Cannot find function handle, or funtion doesnt exist')
+-    end
+-  end
+-
+-  if (nargin<2)
+-    error("match: incorrect number of arguments; expecting at least two.");
+-  end
+-  
+-  LD=length(data);
+-  rval=[];
+-  for idx=1:LD
+-    if fun_handle(data(idx)) %anything thats true
+-      rval=[rval, data(idx)];
+-    end
+-  end
+-  return
++function rval = match (fun_handle, data)
++
++  if (nargin != 2)
++    print_usage;
++  endif
++
++  if (isa (fun_handle, "function_handle"))
++    ##do nothing
++  elseif (ischar (fun_handle))
++    fun_handle = str2func (fun_handle);
++  else
++    error ("fun_handle must either be a function handle or the name of a function");
++  endif
++
++  LD   = length(data);
++
++  if (iscell (data))
++    rval = {};
++    for idx=1:LD
++      if fun_handle(data{idx}), rval = [rval, data{idx}]; endif
++    endfor
++  elseif (ismatrix (data))
++    rval = [];
++    for idx=1:LD
++      if fun_handle(data(idx)), rval = [rval, data(idx)]; endif
++    endfor
++  else
++    error("data must either be a cell array or matrix");
++  endif
+ endfunction
+-%!
++
+ %!assert(match(@(x) mod(x,2),1:10),[1:2:10],0)
+ %!assert(match(@sin,1:10),[1:10],0)
+ %!assert(match(@(x) strcmp('Octave',x),{'Matlab','Octave'}),{'Octave'},0)
+ %!assert(match(@(x) (x>0), [-10:+10]),[1:10],0)
+-%!
diff --git a/debian/patches/series b/debian/patches/series
index bc8537f..7e8ea01 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 special_matrix_lauchli
+match-cell-array.patch

-- 
Debian packaging for octave-miscellaneous



More information about the Pkg-octave-commit mailing list