changeset 8884:579de77acd90

strsplit.m: style fixes
author John W. Eaton <jwe@octave.org>
date Fri, 27 Feb 2009 03:31:41 -0500
parents 7de0992eb123
children 47fb59095191
files scripts/ChangeLog scripts/strings/strsplit.m src/symtab.h
diffstat 3 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Feb 27 08:06:25 2009 +0100
+++ b/scripts/ChangeLog	Fri Feb 27 03:31:41 2009 -0500
@@ -1,3 +1,7 @@
+2009-02-27  John W. Eaton  <jwe@octave.org>
+
+	* strings/strsplit.m: Style fixes.
+
 2009-02-27  Jaroslav Hajek  <highegg@gmail.com>
 
 	* strings/strsplit.m: Check also nargin.
--- a/scripts/strings/strsplit.m	Fri Feb 27 08:06:25 2009 +0100
+++ b/scripts/strings/strsplit.m	Fri Feb 27 03:31:41 2009 -0500
@@ -16,45 +16,48 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {[@var{s}] =} strsplit (@var{p}, @var{sep}, @var{strip_empty})
-## Splits a single string using one or more delimiters.
-## The result is returned as a cell array of strings. Consecutive delimiters
-## and delimiters at boundaries result in empty strings, unless @var{strip_empty} is true.
+## Split a single string using one or more delimiters and return a cell
+## array of strings.  Consecutive delimiters and delimiters at
+## boundaries result in empty strings, unless @var{strip_empty} is true.
 ## The default value of @var{strip_empty} is false.
+## @seealso{strtok}
 ## @end deftypefn
 
 function s = strsplit (p, sep, strip_empty = false)
-  if (nargin < 2 || nargin > 3 || ! ischar (p) || rows (p) > 1 \
-    || ! ischar (sep) || ! islogical (strip_empty))
+
+  if (nargin < 2 || nargin > 3 || ! ischar (p) || rows (p) > 1
+      || ! ischar (sep) || ! islogical (strip_empty))
     print_usage ();
   endif
 
   if (isempty (p))
     s = cell (size (p));
   else
-    ## split p according to delimiter.
+    ## Split p according to delimiter.
     if (isscalar (sep))
-      ## single separator
+      ## Single separator.
       idx = find (p == sep);
     else
-      ## multiple separators
+      ## Multiple separators.
       idx = strchr (p, sep);
     endif
 
-    ## get substring sizes.
+    ## Get substring sizes.
     if (isempty (idx))
       sizes = numel (p);
     else
       sizes = [idx(1)-1, diff(idx)-1, numel(p)-idx(end)];
     endif
-    ## remove separators.
+    ## Remove separators.
     p(idx) = []; 
     if (strip_empty)
-      ## omit zero lengths.
+      ## Omit zero lengths.
       sizes = sizes (sizes != 0); 
     endif
-    ## convert!
+    ## Convert!
     s = mat2cell (p, 1, sizes);
   endif
+
 endfunction
 
 %!assert (all (strcmp (strsplit ("road to hell", " "), {"road", "to", "hell"})))
--- a/src/symtab.h	Fri Feb 27 08:06:25 2009 +0100
+++ b/src/symtab.h	Fri Feb 27 03:31:41 2009 -0500
@@ -2064,6 +2064,8 @@
 
 	sr.force_variable (context);
       }
+    else
+      p->second.force_variable (context);
   }
 
   octave_value& do_varref (const std::string& name, context_id context)