changeset 16724:b7667fcb9fbc

Substitute ostrsplit() for strsplit(). The function ostrsplit() is Octave's original strsplit(), and strsplit() has been modified to be compatible with Matlab's version. Bug #39010. * scripts/deprecated/javafields.m: Change call to ostrsplit(). * scripts/deprecated/javamethods.m: ditto * scripts/general/fieldnames.m: ditto * scripts/general/int2str.m: ditto * scripts/general/methods.m: ditto * scripts/general/num2str.m: ditto * scripts/help/gen_doc_cache.m: ditto * scripts/help/help.m: ditto * scripts/help/lookfor.m: ditto * scripts/io/strread.m: ditto * scripts/java/javaclasspath.m: ditto * scripts/miscellaneous/compare_versions.m: ditto * scripts/miscellaneous/computer.m: ditto * scripts/miscellaneous/fact.m: ditto * scripts/miscellaneous/tar.m: ditto * scripts/miscellaneous/unpack.m: ditto * scripts/miscellaneous/what.m: ditto * scripts/miscellaneous/zip.m: ditto * scripts/pkg/private/configure_make.m: ditto * scripts/pkg/private/fix_depends.m: ditto * scripts/pkg/private/generate_lookfor_cache.m: ditto * scripts/pkg/private/list_forge_packages.m: ditto * scripts/pkg/private/unload_packages.m: ditto * scripts/pkg/private/write_index.m: ditto * scripts/plot/private/__file_filter__.m: ditto * scripts/plot/private/__fltk_file_filter__.m: ditto * scripts/plot/private/__go_draw_axes__.m: ditto * scripts/plot/private/__next_line_style__.m: ditto * scripts/testfun/rundemos.m: ditto * scripts/testfun/runtests.m: ditto
author Ben Abbott <bpabbott@mac.com>
date Thu, 06 Jun 2013 10:06:12 +0800
parents 45b57ac44854
children 57bf164f1608
files scripts/deprecated/javafields.m scripts/deprecated/javamethods.m scripts/general/fieldnames.m scripts/general/int2str.m scripts/general/methods.m scripts/general/num2str.m scripts/help/gen_doc_cache.m scripts/help/help.m scripts/help/lookfor.m scripts/io/strread.m scripts/java/javaclasspath.m scripts/miscellaneous/compare_versions.m scripts/miscellaneous/computer.m scripts/miscellaneous/fact.m scripts/miscellaneous/tar.m scripts/miscellaneous/unpack.m scripts/miscellaneous/what.m scripts/miscellaneous/zip.m scripts/pkg/private/configure_make.m scripts/pkg/private/fix_depends.m scripts/pkg/private/generate_lookfor_cache.m scripts/pkg/private/list_forge_packages.m scripts/pkg/private/unload_packages.m scripts/pkg/private/write_index.m scripts/plot/private/__file_filter__.m scripts/plot/private/__fltk_file_filter__.m scripts/plot/private/__go_draw_axes__.m scripts/plot/private/__next_line_style__.m scripts/testfun/rundemos.m scripts/testfun/runtests.m
diffstat 30 files changed, 39 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/deprecated/javafields.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/deprecated/javafields.m	Thu Jun 06 10:06:12 2013 +0800
@@ -40,7 +40,7 @@
   endif
   
   c_methods = javaMethod ("getFields", "org.octave.ClassHelper", javaobj);
-  method_list = strsplit (c_methods, ';', false);
+  method_list = ostrsplit (c_methods, ';');
 
   if (nargout == 0)
     if (! isempty (method_list))
--- a/scripts/deprecated/javamethods.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/deprecated/javamethods.m	Thu Jun 06 10:06:12 2013 +0800
@@ -40,7 +40,7 @@
   endif
 
   cls_methods = javaMethod ("getMethods", "org.octave.ClassHelper", classname);
-  method_list = strsplit (cls_methods, ';', false);
+  method_list = ostrsplit (cls_methods, ';');
 
   if (nargout == 0)
     if (! isempty (method_list))
--- a/scripts/general/fieldnames.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/general/fieldnames.m	Thu Jun 06 10:06:12 2013 +0800
@@ -52,7 +52,7 @@
       obj = class (obj);
     endif
     names_str = javaMethod ("getFields", "org.octave.ClassHelper", obj);
-    names = strsplit (names_str, ';', false);
+    names = ostrsplit (names_str, ';');
   else
     error ("fieldnames: Invalid input argument"); 
   endif
--- a/scripts/general/int2str.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/general/int2str.m	Thu Jun 06 10:06:12 2013 +0800
@@ -73,7 +73,7 @@
   endif
   tmp = sprintf (fmt, permute (n, [2, 1, 3 : nd]));
   tmp(end) = "";
-  retval = char (strsplit (tmp, "\n", false));
+  retval = char (ostrsplit (tmp, "\n"));
 
 endfunction
 
--- a/scripts/general/methods.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/general/methods.m	Thu Jun 06 10:06:12 2013 +0800
@@ -43,14 +43,14 @@
     mtds_list = __methods__ (obj);
     if (isempty (mtds_list))
       mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj);
-      mtds_list = strsplit (mtds_str, ';', false);
+      mtds_list = ostrsplit (mtds_str, ';');
     endif
   elseif (isjava (obj))
     ## FIXME: Function prototype that excepts java obj exists, but doesn't
     ##        work if obj is java.lang.String.  Convert obj to classname.
     obj = class (obj);
     mtds_str = javaMethod ("getMethods", "org.octave.ClassHelper", obj);
-    mtds_list = strsplit (mtds_str, ';', false);
+    mtds_list = strsplit (mtds_str, ';');
   else
     error ("methods: Invalid input argument");
   endif
--- a/scripts/general/num2str.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/general/num2str.m	Thu Jun 06 10:06:12 2013 +0800
@@ -118,7 +118,7 @@
     fmt = cstrcat (deblank (repmat (fmt, 1, columns (x))), "\n");
     nd = ndims (x);
     tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
-    retval = strtrim (char (strsplit (tmp(1:end-1), "\n", false)));
+    retval = strtrim (char (ostrsplit (tmp(1:end-1), "\n")));
   else   # Complex matrix input
     if (nargin == 2)
       if (ischar (arg))
@@ -164,7 +164,7 @@
     tmp = regexprep (tmp, " +i\n", "i\n");
     tmp = regexprep (tmp, "( +)i", "i$1");
 
-    retval = strtrim (char (strsplit (tmp(1:end-1), "\n", false)));
+    retval = strtrim (char (ostrsplit (tmp(1:end-1), "\n")));
   endif
 
 endfunction
--- a/scripts/help/gen_doc_cache.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/help/gen_doc_cache.m	Thu Jun 06 10:06:12 2013 +0800
@@ -117,7 +117,7 @@
 function cache = gen_doc_cache_in_dir (directory)
 
   ## If 'directory' is not in the current path, add it so we search it
-  dir_in_path = ismember (directory, strsplit (path (), pathsep (), false));
+  dir_in_path = ismember (directory, ostrsplit (path (), pathsep ()));
 
   # dirs not in path
   if (! iscell (directory))
--- a/scripts/help/help.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/help/help.m	Thu Jun 06 10:06:12 2013 +0800
@@ -142,7 +142,7 @@
   builtins = sprintf ("*** builtins:\n\n%s\n\n",
                       list_in_columns (__builtins__ ()));
 
-  dirs = strsplit (path, pathsep, false);
+  dirs = ostrsplit (path, pathsep);
   flist = "";
   for i = 2:numel (dirs)
     files = sort ({dir(fullfile (dirs{i}, "*.m")).name, ...
--- a/scripts/help/lookfor.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/help/lookfor.m	Thu Jun 06 10:06:12 2013 +0800
@@ -66,10 +66,10 @@
   endif
 
   ## Search functions in new path dirs.
-  orig_path = strsplit (__pathorig__ (), pathsep (), false);
+  orig_path = ostrsplit (__pathorig__ (), pathsep ());
 
   ## ditto for path.
-  new_path = strsplit (path (), pathsep (), false);
+  new_path = ostrsplit (path (), pathsep ());
 
   ## scratch out directories already covered by orig_path.
   if (had_core_cache)
--- a/scripts/io/strread.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/io/strread.m	Thu Jun 06 10:06:12 2013 +0800
@@ -626,13 +626,13 @@
                      strrep (words(icol, jptr), fmt_words{ii}, ...
                      [char(255) char(254)]);
                 wrds(2:2:2*numel (words(icol, jptr))-1) = char (255);
-                wrds = strsplit ([wrds{:}], char (255), false);
+                wrds = ostrsplit ([wrds{:}], char (255));
                 words(icol, jptr) = ...
                   wrds(find (cellfun ("isempty", strfind (wrds, char (254)))));
                 wrds(find (cellfun ("isempty", strfind (wrds, char (254))))) ...
                    = char (255);
-                words(icol+1, jptr) = strsplit (strrep ([wrds{2:end}], ...
-                   char (254), fmt_words{ii}), char (255), false);
+                words(icol+1, jptr) = ostrsplit (strrep ([wrds{2:end}], ...
+                   char (254), fmt_words{ii}), char (255));
                 ## Former trailing literal may now be leading for next specifier
                 --ii;
                 fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))];
@@ -704,7 +704,7 @@
         case {"%0", "%1", "%2", "%3", "%4", "%5", "%6", "%7", "%8", "%9"}
           sw = regexp (fmt_words{m}, '\d', "once");
           ew = regexp (fmt_words{m}, '[nfudsq]') - 1;
-          nfmt = strsplit (fmt_words{m}(2:ew), ".", false);
+          nfmt = ostrsplit (fmt_words{m}(2:ew), ".");
           swidth = str2double (nfmt{1});
           switch fmt_words{m}(ew+1)
             case {"d", "u", "f", "n"}
@@ -777,7 +777,7 @@
   endif
 
   ## Split text string along delimiters
-  out = strsplit (text, sep, mult_dlms_s1, "delimitertype", "legacy");
+  out = ostrsplit (text, sep, mult_dlms_s1);
   if (index (sep, eol_char)); out = strrep (out, char (255), ''); endif
   ## In case of trailing delimiter, strip stray last empty word
   if (!isempty (out) && any (sep == text(end)))
--- a/scripts/java/javaclasspath.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/java/javaclasspath.m	Thu Jun 06 10:06:12 2013 +0800
@@ -58,11 +58,11 @@
 
   ## dynamic classpath
   dynamic_path = javaMethod ("getClassPath", "org.octave.ClassHelper");
-  dynamic_path_list = strsplit (dynamic_path, pathsep (), false);
+  dynamic_path_list = ostrsplit (dynamic_path, pathsep ());
 
   ## static classpath
   static_path = javaMethod ("getProperty", "java.lang.System", "java.class.path");
-  static_path_list = strsplit (static_path, pathsep (), false);
+  static_path_list = ostrsplit (static_path, pathsep ());
   if (numel (static_path_list) > 1)
     ## remove first element (which is .../octave.jar)
     static_path_list(1) = [];
--- a/scripts/miscellaneous/compare_versions.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/compare_versions.m	Thu Jun 06 10:06:12 2013 +0800
@@ -113,8 +113,8 @@
     v2nochar = v2;
   endif
 
-  v1n = str2num (char (strsplit (v1nochar, ".", false)));
-  v2n = str2num (char (strsplit (v2nochar, ".", false)));
+  v1n = str2num (char (ostrsplit (v1nochar, ".")));
+  v2n = str2num (char (ostrsplit (v2nochar, ".")));
   if ((isempty (v1n) && isempty (v1c)) || (isempty (v2n) && isempty (v2c)))
     error ("compare_versions: given version strings are not valid: %s %s",
            v1, v2);
--- a/scripts/miscellaneous/computer.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/computer.m	Thu Jun 06 10:06:12 2013 +0800
@@ -49,7 +49,7 @@
 function [c, maxsize, endian] = computer (a)
 
   if (nargin == 1 && ischar (a) && strcmpi (a, "arch"))
-    tmp = strsplit (octave_config_info ("canonical_host_type"), "-", false);
+    tmp = ostrsplit (octave_config_info ("canonical_host_type"), "-");
     if (numel (tmp) == 4)
       c = sprintf ("%s-%s-%s", tmp{4}, tmp{3}, tmp{1});
     else
--- a/scripts/miscellaneous/fact.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/fact.m	Thu Jun 06 10:06:12 2013 +0800
@@ -250,7 +250,7 @@
 
 function out = wordwrap (w)
   cols = terminal_size ()(2);
-  wc = strsplit (w, " ", false);
+  wc = ostrsplit (w, " ");
   out = "\n";
   i = 1;
   numwords = numel (wc);
--- a/scripts/miscellaneous/tar.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/tar.m	Thu Jun 06 10:06:12 2013 +0800
@@ -59,7 +59,7 @@
     if (output(end) == "\n")
       output(end) = [];
     endif
-    entries = strsplit (output, "\n", false);
+    entries = ostrsplit (output, "\n");
     entries = entries';
   endif
 
--- a/scripts/miscellaneous/unpack.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/unpack.m	Thu Jun 06 10:06:12 2013 +0800
@@ -194,7 +194,7 @@
     if (output(length (output)) == "\n")
       output(length (output)) = [];
     endif
-    files = parser (strsplit (output, "\n", false))';
+    files = parser (ostrsplit (output, "\n"))';
 
     ## Move files if necessary
     if (needmove)
--- a/scripts/miscellaneous/what.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/what.m	Thu Jun 06 10:06:12 2013 +0800
@@ -32,7 +32,7 @@
     d = pwd ();
   elseif (isempty (strfind (d, filesep ())))
     ## Find the appropriate directory on the path.
-    p = strtrim (strsplit (path (), pathsep (), false));
+    p = strtrim (ostrsplit (path (), pathsep ()));
     d = p{find (cellfun (@(x) ! isempty (strfind (x, d)), p))(end)};
   else
     [status, msg, msgid] = fileattrib (d);
--- a/scripts/miscellaneous/zip.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/miscellaneous/zip.m	Thu Jun 06 10:06:12 2013 +0800
@@ -62,7 +62,7 @@
     if (entries(end) == "\n")
       entries(end) = [];
     endif
-    entries = strsplit (entries, "\n", false);
+    entries = ostrsplit (entries, "\n");
   endif
 
 endfunction
--- a/scripts/pkg/private/configure_make.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/configure_make.m	Thu Jun 06 10:06:12 2013 +0800
@@ -91,7 +91,7 @@
       if (filenames(end) == "\n")
         filenames(end) = [];
       endif
-      filenames = strtrim (strsplit (filenames, "\n", false));
+      filenames = strtrim (ostrsplit (filenames, "\n"));
       delete_idx =  [];
       for i = 1:length (filenames)
         if (! all (isspace (filenames{i})))
--- a/scripts/pkg/private/fix_depends.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/fix_depends.m	Thu Jun 06 10:06:12 2013 +0800
@@ -26,7 +26,7 @@
 ## This function returns a cell of structures with the following fields:
 ##   package, version, operator
 function deps_cell = fix_depends (depends)
-  deps = strtrim (strsplit (tolower (depends), ",", false));
+  deps = strtrim (ostrsplit (tolower (depends), ","));
   deps_cell = cell (1, length (deps));
 
   ## For each dependency.
--- a/scripts/pkg/private/generate_lookfor_cache.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/generate_lookfor_cache.m	Thu Jun 06 10:06:12 2013 +0800
@@ -23,7 +23,7 @@
 ## @end deftypefn
 
 function generate_lookfor_cache (desc)
-  dirs = strtrim (strsplit (genpath (desc.dir), pathsep (), false));
+  dirs = strtrim (ostrsplit (genpath (desc.dir), pathsep ()));
   for i = 1 : length (dirs)
     gen_doc_cache (fullfile (dirs{i}, "doc-cache"), dirs{i});
   endfor
--- a/scripts/pkg/private/list_forge_packages.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/list_forge_packages.m	Thu Jun 06 10:06:12 2013 +0800
@@ -25,7 +25,7 @@
 function list = list_forge_packages ()
   [list, succ] = urlread ("http://packages.octave.org/list_packages.php");
   if (succ)
-    list = strsplit (list, " \n\t", true, "delimitertype", "legacy");
+    list = ostrsplit (list, " \n\t", true);
   else
     error ("pkg: could not read URL, please verify internet connection");
   endif
--- a/scripts/pkg/private/unload_packages.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/unload_packages.m	Thu Jun 06 10:06:12 2013 +0800
@@ -35,7 +35,7 @@
   endfor
 
   ## Get the current octave path.
-  p = strtrim (strsplit (path (), pathsep (), false));
+  p = strtrim (ostrsplit (path (), pathsep ()));
 
   if (length (files) == 1 && strcmp (files{1}, "all"))
     ## Unload all.
--- a/scripts/pkg/private/write_index.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/pkg/private/write_index.m	Thu Jun 06 10:06:12 2013 +0800
@@ -74,7 +74,7 @@
   if (! isfield (desc, "categories"))
     error ("the DESCRIPTION file must have a Categories field, when no INDEX file is given");
   endif
-  categories = strtrim (strsplit (desc.categories, ",", false));
+  categories = cstrtrim (strsplit (desc.categories, ","));
   if (length (categories) < 1)
     error ("the Category field is empty");
   endif
--- a/scripts/plot/private/__file_filter__.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/plot/private/__file_filter__.m	Thu Jun 06 10:06:12 2013 +0800
@@ -81,7 +81,7 @@
   endswitch
 
   if (isempty (name))
-    extlist = strsplit (filterext, ";", false);
+    extlist = ostrsplit (filterext, ";");
     extlist = strrep (extlist, "*.", "");
     extlist = toupper (extlist);
     extlist(end+1, :) = repmat ({","}, 1, length (extlist));
--- a/scripts/plot/private/__fltk_file_filter__.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/plot/private/__fltk_file_filter__.m	Thu Jun 06 10:06:12 2013 +0800
@@ -34,7 +34,7 @@
   for idx = 1 : r
 
     curr_ext = file_filter{idx, 1};
-    curr_ext = strsplit (curr_ext, ";", false);
+    curr_ext = ostrsplit (curr_ext, ";");
 
     if (length (curr_ext) > 1)
       curr_ext = regexprep (curr_ext, '\*\.', ',');
--- a/scripts/plot/private/__go_draw_axes__.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/plot/private/__go_draw_axes__.m	Thu Jun 06 10:06:12 2013 +0800
@@ -2229,7 +2229,7 @@
   endif
   if (ischar (ticklabel))
     if (rows (ticklabel) == 1 && any (ticklabel == "|"))
-      ticklabel = strsplit (ticklabel, "|", false);
+      ticklabel = ostrsplit (ticklabel, "|");
     else
       ticklabel = cellstr (ticklabel);
     endif
--- a/scripts/plot/private/__next_line_style__.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/plot/private/__next_line_style__.m	Thu Jun 06 10:06:12 2013 +0800
@@ -41,7 +41,7 @@
       elseif (reset || isempty (style_rotation))
         style_rotation = get (gca (), "linestyleorder");
         if (ischar (style_rotation))
-          style_rotation = strsplit (style_rotation, "|", false);
+          style_rotation = ostrsplit (style_rotation, "|");
         endif
         num_styles = length (style_rotation);
         style_index = 1;
--- a/scripts/testfun/rundemos.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/testfun/rundemos.m	Thu Jun 06 10:06:12 2013 +0800
@@ -30,7 +30,7 @@
 function rundemos (directory)
 
   if (nargin == 0)
-    dirs = strsplit (path (), pathsep (), false);
+    dirs = ostrsplit (path (), pathsep ());
   elseif (nargin == 1)
     if (is_absolute_filename (directory))
       dirs = {directory};
--- a/scripts/testfun/runtests.m	Wed Jun 05 20:45:41 2013 +0800
+++ b/scripts/testfun/runtests.m	Thu Jun 06 10:06:12 2013 +0800
@@ -30,7 +30,7 @@
 function runtests (directory)
 
   if (nargin == 0)
-    dirs = strsplit (path (), pathsep (), false);
+    dirs = ostrsplit (path (), pathsep ());
   elseif (nargin == 1)
     if (is_absolute_filename (directory))
       dirs = {directory};