changeset 12922:1322308fa83a

Merge in Daniel's changes
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Thu, 04 Aug 2011 23:35:13 -0500
parents 61906c0d1e9b (diff) 7820a12baadd (current diff)
children 1c71c9bf0570
files
diffstat 26 files changed, 435 insertions(+), 290 deletions(-) [+]
line wrap: on
line diff
--- a/doc/refcard/refcard.tex	Thu Aug 04 23:08:20 2011 -0500
+++ b/doc/refcard/refcard.tex	Thu Aug 04 23:35:13 2011 -0500
@@ -863,14 +863,14 @@
 gray2ind ({\it i}, {\it n})&convert gray scale to Octave image\cr
 image ({\it img}, {\it zoom})&display an Octave image matrix\cr
 imagesc ({\it img}, {\it zoom})&display scaled matrix as image\cr
+imread ({\it file})&load an image file\cr
 imshow ({\it img}, {\it map})&display Octave image\cr
 imshow ({\it i}, {\it n})&display gray scale image\cr
 imshow ({\it r}, {\it g}, {\it b})&display RGB image\cr
+imwrite ({\it img}, {\it file})&write images in various file formats\cr
 ind2gray ({\it img}, {\it map})&convert Octave image to gray scale\cr
 ind2rgb ({\it img}, {\it map})&convert indexed image to RGB\cr
-loadimage ({\it file})&load an image file\cr
 rgb2ind ({\it r}, {\it g}, {\it b})&convert RGB to Octave image\cr
-\omit\tt saveimage ({\it file}, {\it img}, {\it fmt}, {\it map})\quad\rm
 save a matrix to {\it file}\span\cr
 \endsec
 
--- a/liboctave/cmd-edit.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/liboctave/cmd-edit.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -765,7 +765,7 @@
 default_command_editor::do_readline (const std::string& prompt, bool& eof)
 {
   gnulib::fputs (prompt.c_str (), output_stream);
-  fflush (output_stream);
+  gnulib::fflush (output_stream);
 
   return octave_fgetl (input_stream, eof);
 }
--- a/liboctave/kpse.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/liboctave/kpse.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -212,7 +212,7 @@
 
 /* A printf for the debugging.  */
 #define DEBUGF_START() do { gnulib::fputs ("kdebug:", stderr)
-#define DEBUGF_END()        fflush (stderr); } while (0)
+#define DEBUGF_END()        gnulib::fflush (stderr); } while (0)
 
 #define DEBUGF(str)                                                     \
   DEBUGF_START (); gnulib::fputs (str, stderr); DEBUGF_END ()
@@ -432,7 +432,7 @@
             }
           gnulib::putc ('\n', stderr);
         }
-      fflush (stderr);
+      gnulib::fflush (stderr);
     }
 #endif
 
@@ -2428,7 +2428,7 @@
             gnulib::fprintf (stderr, " %s", (STR_LLIST (*e)).c_str ());
         }
       gnulib::putc ('\n', stderr);
-      fflush (stderr);
+      gnulib::fflush (stderr);
     }
 #endif /* KPSE_DEBUG */
 
--- a/liboctave/lo-utils.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/liboctave/lo-utils.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -124,7 +124,7 @@
 
   do
     {
-      if (fgets (bufptr, grow_size, f))
+      if (gnulib::fgets (bufptr, grow_size, f))
         {
           len = strlen (bufptr);
 
--- a/liboctave/sparse-util.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/liboctave/sparse-util.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -52,7 +52,7 @@
   va_list args;
   va_start (args, fmt);
   int ret = gnulib::vfprintf (stderr, fmt, args);
-  fflush (stderr);
+  gnulib::fflush (stderr);
   va_end (args);
   return ret;
 }
--- a/scripts/audio/playaudio.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/audio/playaudio.m	Thu Aug 04 23:35:13 2011 -0500
@@ -47,7 +47,10 @@
       num = fopen (file, "wb");
       c = fwrite (num, X, "uchar");
       fclose (num);
-      system (sprintf ("cat \"%s\" > /dev/dsp", file));
+      [status, out] = system (sprintf ("cat \"%s\" > /dev/dsp", file));
+      if (status != 0)
+        system (sprintf ("paplay --raw \"%s\"", file))
+      endif
     unwind_protect_cleanup
       unlink (file);
     end_unwind_protect
@@ -61,10 +64,16 @@
       print_usage ();
     endif
     if (strcmp (ext, "lin") || strcmp (ext, "raw"))
-      system (sprintf ("cat \"%s\" > /dev/dsp", name));
+      [status, out] = system (sprintf ("cat \"%s\" > /dev/dsp", name));
+      if (status != 0)
+        system (sprintf ("paplay --raw \"%s\"", name))
+      endif
     elseif (strcmp (ext, "mu") || strcmp (ext, "au")
             || strcmp (ext, "snd") || strcmp (ext, "ul"))
-      system (sprintf ("cat \"%s\" > /dev/audio", name));
+      [status, out] = system (sprintf ("cat \"%s\" > /dev/audio", name));
+      if (status != 0)
+        system (sprintf ("paplay \"%s\"", name))
+      endif
     else
       error ("playaudio: unsupported extension");
     endif
--- a/scripts/deprecated/saveimage.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/deprecated/saveimage.m	Thu Aug 04 23:35:13 2011 -0500
@@ -30,8 +30,7 @@
 ## Portable pixmap format.
 ##
 ## @item "ps"
-## PostScript format.  Note that images saved in PostScript format cannot
-## be read back into Octave with loadimage.
+## PostScript format.
 ## @end table
 ##
 ## If the fourth argument is supplied, the specified colormap will also be
@@ -42,7 +41,7 @@
 ## image is a gray scale image (the entries within each row of the colormap
 ## are equal) the gray scale ppm and PostScript image formats are used,
 ## otherwise the full color formats are used.
-## @seealso{loadimage, save, load, colormap}
+## @seealso{imread, save, load, colormap}
 ## @end deftypefn
 
 ## The conversion to PostScript is based on pbmtolps.c, which was
--- a/scripts/io/strread.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/io/strread.m	Thu Aug 04 23:35:13 2011 -0500
@@ -37,18 +37,20 @@
 ## @item %s
 ## The word is parsed as a string.
 ##
+## @itemx %f
+## @itemx %n
+## The word is parsed as a number and converted to double.
+##
 ## @item  %d
-## @itemx %f
 ## @itemx %u
-## @itemx %n
-## The word is parsed as a number (and converted to double).
+## The word is parsed as a number and converted to int32.
 ##
 ## @item %*', '%*f', '%*s
 ## The word is skipped.
 ##
 ## For %s and %d, %f, %n, %u and the associated %*s @dots{} specifiers an
 ## optional width can be specified as %Ns, etc. where N is an integer > 1.
-## For %f, formats like %N.Mf are allowed.
+## For %f, format specifiers like %N.Mf are allowed.
 ##
 ## @item literals
 ## In addition the format may contain literal character strings; these will be
@@ -354,10 +356,17 @@
     str = cell2mat (str);
     ## Remove leading & trailing space, but preserve delimiters.
     str = strtrim (str);
+    ## FIXME: Double strrep on str is enormously expensive of CPU time.
+    ## Can this be eliminated
+    ## Wipe leading and trailing whitespace on each line (it may be delimiter too)
+    if (! isempty (eol_char))
+      str = strrep (str, [eol_char " "], eol_char);
+      str = strrep (str, [" " eol_char], eol_char);
+    endif
   endif
 
   ## Split 'str' into words
-  words = split_by (str, delimiter_str, mult_dlms_s1);
+  words = split_by (str, delimiter_str, mult_dlms_s1, eol_char);
   if (! isempty (white_spaces))
     ## Trim leading and trailing white_spaces
     ## FIXME: Is this correct?  strtrim clears what matches isspace(), not
@@ -398,7 +407,8 @@
 
       ## 1. Assess "period" in the split-up words array ( < num_words_per_line).
       ## Could be done using EndOfLine but that prohibits EndOfLine = "" option.
-      ## Alternative below goes by simply parsing the first "line" of words:
+      ## Alternative below goes by simply parsing a first grab of words
+      ## and counting words until the fmt_words array is exhausted:
       iwrd = 1; iwrdp = 0; iwrdl = length (words{iwrd});
       for ii = 1:numel (fmt_words)
 
@@ -480,7 +490,7 @@
         if ((idf(ii) || idg(ii)) && (rows(words) < num_words_per_line))
           if (idf(ii))
             s = strfind (words(icol, 1), fmt_words{ii});
-            if (isempty (s))
+            if (isempty (s{:}))
               error ("strread: Literal '%s' not found in column %d", fmt_words{ii}, icol);
             endif
             s = s{:}(1);
@@ -585,6 +595,11 @@
           n = cellfun ("isempty", data);
           ### FIXME - erroneously formatted data lead to NaN, not an error
           data = str2double (data);
+          if (! isempty (regexp (fmt_words{m}, "%[du]")))
+            ## Cast to integer 
+            ## FIXME: NaNs will be transformed into zeros
+            data = int32 (data);
+          end
           data(n) = numeric_fill_value;
           if (pad_out)
             data(end+1:num_lines) = numeric_fill_value;
@@ -607,7 +622,11 @@
               if (numel (nfmt) > 1)
                 sprec = str2double (nfmt{2});
                 data = 10^-sprec * round (10^sprec * data);
-              endif
+              elseif (! isempty (regexp (fmt_words{m}, "[du]")))
+                ## Cast to integer 
+                ## FIXME: NaNs will be transformed into zeros
+                data = int32 (data);
+              end
               varargout{k} = data.';
               k++;
             case "s"
@@ -643,17 +662,16 @@
 
 endfunction
 
-function out = split_by (text, sep, mult_dlms_s1)
+function out = split_by (text, sep, mult_dlms_s1, eol_char)
 
   ## Check & if needed, process MultipleDelimsAsOne parameter
   if (mult_dlms_s1)
     mult_dlms_s1 = true;
+    ## FIXME: Should re-implement strsplit() function here in order
+    ## to avoid strrep on megabytes of data.
     ## If \n is in sep collection we need to enclose it in spaces in text
     ## to avoid it being included in consecutive delim series
-    ## FIXME: This only works if eol is LF or CRLF.  Won't work on Mac
-    ##        Should probably use eol_char in this case.
-    ##        Also unlikely to work if <space> is not in white_space
-    text = strrep (text, "\n", " \n ");
+    text = strrep (text, eol_char, [" " eol_char " "]);
   else
     mult_dlms_s1 = false;
   endif
@@ -661,7 +679,7 @@
   ## Split text string along delimiters
   out = strsplit (text, sep, mult_dlms_s1);
   ## In case of trailing delimiter, strip stray last empty word
-  if (any (sep == text(end)))
+  if (!isempty (out) && any (sep == text(end)))
     out(end) = [];
   endif
   
@@ -673,13 +691,8 @@
 
 %!test
 %! [a, b] = strread ("1 2", "%f%f");
-%! assert (a == 1 && b == 2);
-
-%!test
-%! str = "# comment\n# comment\n1 2 3";
-%! [a, b] = strread (str, '%d %s', 'commentstyle', 'shell', 'endofline', "\n");
-%! assert (a, [1; 3]);
-%! assert (b, {"2"});
+%! assert (a, 1);
+%! assert (b, 2);
 
 %!test
 %! str = '';
@@ -689,7 +702,7 @@
 %!   str = sprintf ('%s %.6f %s\n', str, a(k), b(k));
 %! endfor
 %! [aa, bb] = strread (str, '%f %s');
-%! assert (a, aa, 1e-5);
+%! assert (a, aa, 1e-6);
 %! assert (cellstr (b), bb);
 
 %!test
@@ -700,7 +713,7 @@
 %!   str = sprintf ('%s %.6f %s\n', str, a(k), b(k));
 %! endfor
 %! aa = strread (str, '%f %*s');
-%! assert (a, aa, 1e-5);
+%! assert (a, aa, 1e-6);
 
 %!test
 %! str = sprintf ('/* this is\nacomment*/ 1 2 3');
@@ -708,6 +721,12 @@
 %! assert (a, [1; 2; 3]);
 
 %!test
+%! str = "# comment\n# comment\n1 2 3";
+%! [a, b] = strread (str, '%n %s', 'commentstyle', 'shell', 'endofline', "\n");
+%! assert (a, [1; 3]);
+%! assert (b, {"2"});
+
+%!test
 %! str = sprintf ("Tom 100 miles/hr\nDick 90 miles/hr\nHarry 80 miles/hr");
 %! fmt = "%s %f miles/hr";
 %! c = cell (1, 2);
@@ -738,14 +757,14 @@
 %! assert (double (a{3}(end-5:end)), [32 110 97 109 101 62]);
 
 %!test
-%! [a, b, c, d] = strread ("1,2,3,,5,6", "%d%d%d%d", 'delimiter', ',');
-%! assert (c, 3);
+%! [a, b, c, d] = strread ("1,2,3,,5,6", "%d%f%d%f", 'delimiter', ',');
+%! assert (c, int32 (3));
 %! assert (d, NaN);
 
 %!test
-%! [a, b, c, d] = strread ("1,2,3,,5,6\n", "%d%d%d%d", 'delimiter', ',');
+%! [a, b, c, d] = strread ("1,2,3,,5,6\n", "%d%d%f%d", 'delimiter', ',');
 %! assert (c, [3; NaN]);
-%! assert (d, [NaN; NaN]);
+%! assert (d, int32 ([0; 0]));
 
 %!test
 %! # Default format (= %f)
@@ -760,24 +779,18 @@
 
 %!test
 %! # TreatAsEmpty
-%! [a, b, c, d] = strread ("1,2,3,NN,5,6\n", "%d%d%d%d", 'delimiter', ',', 'TreatAsEmpty', 'NN');
-%! assert (c, [3; NaN]);
+%! [a, b, c, d] = strread ("1,2,3,NN,5,6\n", "%d%d%d%f", 'delimiter', ',', 'TreatAsEmpty', 'NN');
+%! assert (c, int32 ([3; 0]));
 %! assert (d, [NaN; NaN]);
 
 %!test
 %! # No delimiters at all besides EOL.  Plain reading numbers & strings
 %! str = "Text1Text2Text\nText398Text4Text\nText57Text";
 %! c = textscan (str, "Text%dText%1sText");
-%! assert (c{1}, [1; 398; 57]);
+%! assert (c{1}, int32 ([1; 398; 57]));
 %! assert (c{2}(1:2), {'2'; '4'});
 %! assert (isempty (c{2}{3}), true);
 
-%!test
-%! # No delimiters at all besides EOL.  Skip fields, even empty fields
-%! str = "Text1Text2Text\nTextText4Text\nText57Text";
-%! c = textscan (str, "Text%*dText%dText");
-%! assert (c{1}, [2; 4; NaN]);
-
 %% MultipleDelimsAsOne
 %!test
 %! str = "11, 12, 13,, 15\n21,, 23, 24, 25\n,, 33, 34, 35";
--- a/scripts/io/textscan.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/io/textscan.m	Thu Aug 04 23:35:13 2011 -0500
@@ -34,13 +34,18 @@
 ## @code{strread}, this function supports a few more:
 ##
 ## @itemize
-## @item "headerlines":
-## The first @var{value} number of lines of @var{fid} are skipped.
+## @item "collectoutput":
+## A value of 1 or true instructs textscan to concatenate consecutive columns
+## of the same class in the output cell array.  A value of 0 or false (default)
+## leaves output in distinct columns.
 ##
 ## @item "endofline":
-## Specify a single character or "\r\n".  If no value is given, it will be
-## inferred from the file.  If set to "" (empty string) EOLs are ignored as
-## delimiters.
+## Specify "\r", "\n" or "\r\n" (for CR, LF, or CRLF).  If no value is given,
+## it will be inferred from the file.  If set to "" (empty string) EOLs are
+## ignored as delimiters and added to whitespace.
+##
+## @item "headerlines":
+## The first @var{value} number of lines of @var{fid} are skipped.
 ##
 ## @item "returnonerror":
 ## If set to numerical 1 or true (default), return normally when read errors
@@ -116,6 +121,20 @@
     args(end+1:end+2) = {'delimiter', ""};
   endif
 
+  collop = false;
+  ipos = find (strcmpi (args, "collectoutput"));
+  if (! isempty (ipos))
+    ## Search & concatenate consecutive columns of same class requested
+    if (isscalar (args{ipos+1})
+        && (islogical (args{ipos+1}) || isnumeric (args{ipos+1})))
+      collop = args{ipos+1};
+    else
+      warning ("textscan: illegal value for CollectOutput parameter - ignored");
+    endif
+    ## Remove argument before call to strread() below
+    args(ipos:ipos+1) = [];
+  endif
+
   if (any (strcmpi (args, "returnonerror")))
     ## Because of the way strread() reads data (columnwise) this parameter
     ## can't be neatly implemented.  strread() will pick it up anyway
@@ -143,9 +162,11 @@
       str = tmp_str = "";
       n = 0;
       ## FIXME: Can this be done without slow loop?
-      while (ischar (tmp_str) && n++ <= nlines)
-        str = strcat (str, tmp_str);
+      while (ischar (tmp_str) && n++ < nlines)
         tmp_str = fgets (fid);
+        if (ischar (tmp_str))
+          str = strcat (str, tmp_str);
+        endif
       endwhile
     else
       str = fread (fid, "char=>char").';
@@ -164,6 +185,9 @@
   if (! isempty (endofline))
     if (ischar (args{endofline + 1})) 
       eol_char = args{endofline + 1};
+      if (isempty (strmatch (eol_char, {"", "\n", "\r", "\r\n"}, 'exact')))
+        error ("textscan: illegal EndOfLine character value specified");
+      endif
     else
       error ("textscan: character value required for EndOfLine"); 
     endif
@@ -195,6 +219,11 @@
   ## Call strread to make it do the real work
   C = cell (1, num_fields);
   [C{:}] = strread (str, format, args{:});
+  
+  ## If requested, collect output columns of same class
+  if (collop)
+    C = colloutp (C);
+  endif
 
   if (nargout == 2)
     position = ftell (fid);
@@ -203,6 +232,32 @@
 endfunction
 
 
+## Collect consecutive columns of same class into one cell column
+function C = colloutp (C)
+
+  ## Start at rightmost column and work backwards to avoid ptr mixup
+  ii = numel (C);
+  while ii > 1
+    clss1 = class (C{ii});
+    jj = ii;
+    while  (jj > 1 && strcmp (clss1, class (C{jj - 1})))
+      ## Column to the left is still same class; check next column to the left
+      --jj;
+    endwhile
+    if (jj < ii)
+      ## Concatenate columns into current column
+      C{jj} = [C{jj : ii}];
+      ## Wipe concatenated columns to the right, resume search to the left
+      C(jj+1 : ii) = [];
+      ii = jj - 1;
+    else
+      ## No similar class in column to the left, search from there
+      --ii;
+    endif
+  endwhile
+
+endfunction
+
 %!test
 %! str = "1,  2,  3,  4\n 5,  ,  ,  8\n 9, 10, 11, 12";
 %! fmtstr = "%f %d %f %s";
@@ -218,13 +273,13 @@
 %! str = sprintf ("%g miles/hr = %g kilometers/hr\n", b);
 %! fmt = "%f miles/hr = %f kilometers/hr";
 %! c = textscan (str, fmt);
-%! assert (b(1,:)', c{1});
-%! assert (b(2,:)', c{2});
+%! assert (b(1,:)', c{1}, 1e-5);
+%! assert (b(2,:)', c{2}, 1e-5);
 
 #%!test
 #%! str = "13, 72, NA, str1, 25\r\n// Middle line\r\n36, na, 05, str3, 6";
 #%! a = textscan(str, '%d %n %f %s %n', 'delimiter', ',','treatAsEmpty', {'NA', 'na'},'commentStyle', '//');
-#%! assert (a{1}, [13; 36]);
+#%! assert (a{1}, int32([13; 36]));
 #%! assert (a{2}, [72; NaN]);
 #%! assert (a{3}, [NaN; 5]);
 #%! assert (a{4}, {"str1"; "str3"});
@@ -237,9 +292,9 @@
 %! str = [str "Km:25 = hhhZ\r\n"];
 %! fmt = "Km:%d = hhh%1sjjj miles%dhour";
 %! a = textscan (str, fmt, 'delimiter', ' ');
-%! assert (a{1}', [10 15 2 25], 1e-5);
+%! assert (a{1}', int32([10 15 2 25]));
 %! assert (a{2}', {'B' 'J' 'R' 'Z'});
-%! assert (a{3}', [16 241 3 NaN], 1e-5);
+%! assert (a{3}', int32([16 241 3 0]));
 
 %% Test with default endofline parameter
 %!test
@@ -251,6 +306,22 @@
 %! c = textscan ("L1\nL2", "%s", 'endofline', '');
 %! assert (int8(c{:}{:}), int8([ 76,  49,  10,  76,  50 ]));
 
+%!test
+%! # No delimiters at all besides EOL.  Skip fields, even empty fields
+%! str = "Text1Text2Text\nTextText4Text\nText57Text";
+%! c = textscan (str, "Text%*dText%dText");
+%! assert (c{1}, int32 ([2; 4; 0]));
+
+%!test
+%% CollectOutput test
+%! b = [10:10:100];
+%! b = [b; 8*b/5; 8*b*1000/5];
+%! str = sprintf ("%g miles/hr = %g (%g) kilometers (meters)/hr\n", b);
+%! fmt = "%f miles%s %s %f (%f) kilometers %*s";
+%! c = textscan (str, fmt, 'collectoutput', 1);
+%! assert (size(c{3}), [10, 2]);
+%! assert (size(c{2}), [10, 2]);
+
 %% Test input validation
 %!error textscan ()
 %!error textscan (single (4))
@@ -258,3 +329,4 @@
 %!error <must be a string> textscan ("Hello World", 2)
 %!error <cannot provide position information> [C, pos] = textscan ("Hello World")
 %!error <character value required> textscan ("Hello World", '%s', 'EndOfLine', 3)
+
--- a/scripts/linear-algebra/orth.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/linear-algebra/orth.m	Thu Aug 04 23:35:13 2011 -0500
@@ -39,6 +39,11 @@
 
   if (nargin == 1 || nargin == 2)
 
+    if (isempty (A))
+      retval = [];
+      return;
+    endif
+
     [U, S, V] = svd (A);
 
     [rows, cols] = size (A);
--- a/scripts/signal/unwrap.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/signal/unwrap.m	Thu Aug 04 23:35:13 2011 -0500
@@ -75,10 +75,10 @@
   idx{dim} = [1,1:m-1];
   d = x(idx{:}) - x;
 
-  ## Find only the peaks, and multiply them by the range so that there
-  ## are kronecker deltas at each wrap point multiplied by the range
-  ## value.
-  p =  rng * (((d > tol) > 0) - ((d < -tol) > 0));
+  ## Find only the peaks, and multiply them by the appropriate amount
+  ## of ranges so that there are kronecker deltas at each wrap point
+  ## multiplied by the appropriate amount of range values.
+  p =  ceil(abs(d)./rng) .* rng .* (((d > tol) > 0) - ((d < -tol) > 0));
 
   ## Now need to "integrate" this so that the deltas become steps.
   r = cumsum (p, dim);
@@ -128,4 +128,28 @@
 %! t(++i) = xassert(any(abs(r - unwrap(w,0.8)) > 100));
 %!
 %! assert(all(t));
-
+%!
+%!test
+%! A = [pi*(-4), pi*(-2+1/6), pi/4, pi*(2+1/3), pi*(4+1/2), pi*(8+2/3), pi*(16+1), pi*(32+3/2), pi*64];
+%! assert (unwrap(A), unwrap(A, pi));
+%! assert (unwrap(A, pi), unwrap(A, pi, 2));
+%! assert (unwrap(A', pi), unwrap(A', pi, 1));
+%!
+%!test
+%! A = [pi*(-4); pi*(2+1/3); pi*(16+1)];
+%! B = [pi*(-2+1/6); pi*(4+1/2); pi*(32+3/2)];
+%! C = [pi/4; pi*(8+2/3); pi*64];
+%! D = [pi*(-2+1/6); pi*(2+1/3); pi*(8+2/3)];
+%! E(:, :, 1) = [A, B, C, D];
+%! E(:, :, 2) = [A+B, B+C, C+D, D+A];
+%! F(:, :, 1) = [unwrap(A), unwrap(B), unwrap(C), unwrap(D)];
+%! F(:, :, 2) = [unwrap(A+B), unwrap(B+C), unwrap(C+D), unwrap(D+A)];
+%! assert (unwrap(E), F);
+%!
+%!test
+%! A = [0, 2*pi, 4*pi, 8*pi, 16*pi, 65536*pi];
+%! B = [pi*(-2+1/6), pi/4, pi*(2+1/3), pi*(4+1/2), pi*(8+2/3), pi*(16+1), pi*(32+3/2), pi*64];
+%! assert (unwrap(A), zeros(1, length(A)));
+%! assert (diff(unwrap(B), 1)<2*pi, true(1, length(B)-1));
+%!
+%!error unwrap()
--- a/scripts/strings/strsplit.m	Thu Aug 04 23:08:20 2011 -0500
+++ b/scripts/strings/strsplit.m	Thu Aug 04 23:35:13 2011 -0500
@@ -28,7 +28,7 @@
 function s = strsplit (p, sep, strip_empty = false)
 
   if (nargin < 2 || nargin > 3 || ! ischar (p) || rows (p) > 1
-      || ! ischar (sep) || ! islogical (strip_empty))
+      || ! ischar (sep) || ! isscalar (strip_empty))
     print_usage ();
   endif
 
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/DLD-FUNCTIONS/__init_fltk__.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -861,8 +861,11 @@
 
   void show_canvas (void)
   {
-    canvas->show ();
-    canvas->make_current ();
+    if (fp.is_visible ())
+      {
+        canvas->show ();
+        canvas->make_current ();
+      }
   }
 
   void hide_canvas (void)
--- a/src/DLD-FUNCTIONS/qr.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/DLD-FUNCTIONS/qr.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -76,6 +76,8 @@
   "-*- texinfo -*-\n\
 @deftypefn  {Loadable Function} {[@var{Q}, @var{R}, @var{P}] =} qr (@var{A})\n\
 @deftypefnx {Loadable Function} {[@var{Q}, @var{R}, @var{P}] =} qr (@var{A}, '0')\n\
+@deftypefnx {Loadable Function} {[@var{C}, @var{R}] =} qr (@var{A}, @var{B})\n\
+@deftypefnx {Loadable Function} {[@var{C}, @var{R}] =} qr (@var{A}, @var{B}, '0')\n\
 @cindex QR factorization\n\
 Compute the QR@tie{}factorization of @var{A}, using standard @sc{lapack}\n\
 subroutines.  For example, given the matrix @code{@var{A} = [1, 2; 3, 4]},\n\
@@ -188,7 +190,7 @@
 \n\
 @example\n\
 @group\n\
-[@var{C},@var{R}] = spqr (@var{A},@var{B})\n\
+[@var{C}, @var{R}] = qr (@var{A}, @var{B})\n\
 x = @var{R} \\ @var{C}\n\
 @end group\n\
 @end example\n\
--- a/src/DLD-FUNCTIONS/rand.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/DLD-FUNCTIONS/rand.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -179,18 +179,16 @@
                 octave_idx_type incr = NINTbig (r.inc ());
                 octave_idx_type lim = NINTbig (r.limit ());
 
-                if (base < 0 || lim < 0)
-                  error ("%s: all dimensions must be positive", fcn);
-                else
+                for (octave_idx_type i = 0; i < n; i++)
                   {
-                    for (octave_idx_type i = 0; i < n; i++)
-                      {
-                        dims(i) = base;
-                        base += incr;
-                      }
+                    //Negative dimensions are treated as zero for Matlab
+                    //compatibility
+                    dims(i) = base >= 0 ? base : 0;
+                    base += incr;
+                  }
 
-                    goto gen_matrix;
-                  }
+                goto gen_matrix;
+
               }
             else
               error ("%s: all elements of range must be integers",
@@ -208,15 +206,10 @@
 
                 for (octave_idx_type i = 0; i < len; i++)
                   {
+                    //Negative dimensions are treated as zero for Matlab
+                    //compatibility
                     octave_idx_type elt = iv(i);
-
-                    if (elt < 0)
-                      {
-                        error ("%s: all dimensions must be positive", fcn);
-                        goto done;
-                      }
-
-                    dims(i) = iv(i);
+                    dims(i) = elt >=0 ? elt : 0;
                   }
 
                 goto gen_matrix;
@@ -278,13 +271,14 @@
 
             for (int i = 0; i < nargin; i++)
               {
-                dims(i) = args(idx+i).int_value ();
-
+                octave_idx_type elt = args(idx+i).int_value ();
                 if (error_state)
                   {
                     error ("%s: expecting integer arguments", fcn);
                     goto done;
                   }
+                //Negative is zero for Matlab compatibility
+                dims(i) = elt >= 0 ? elt : 0;
               }
 
             goto gen_matrix;
--- a/src/DLD-FUNCTIONS/sqrtm.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/DLD-FUNCTIONS/sqrtm.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -49,22 +49,20 @@
 
   bool singular = false;
 
-  /*
-   * the following code is equivalent to this triple loop:
-   *
-   *  n = rows (T);
-   *  for j = 1:n
-   *    T(j,j) = sqrt (T(j,j));
-   *    for i = j-1:-1:1
-   *      T(i,j) /= (T(i,i) + T(j,j));
-   *      k = 1:i-1;
-   *      T(k,j) -= T(k,i) * T(i,j);
-   *    endfor
-   *  endfor
-   *
-   *  this is an in-place, cache-aligned variant of the code
-   *  given in Higham's paper.
-  */
+  // The following code is equivalent to this triple loop:
+  //
+  //   n = rows (T);
+  //   for j = 1:n
+  //     T(j,j) = sqrt (T(j,j));
+  //     for i = j-1:-1:1
+  //       T(i,j) /= (T(i,i) + T(j,j));
+  //       k = 1:i-1;
+  //       T(k,j) -= T(k,i) * T(i,j);
+  //     endfor
+  //   endfor
+  //
+  // this is an in-place, cache-aligned variant of the code
+  // given in Higham's paper.
 
   const octave_idx_type n = T.rows ();
   element_type *Tp = T.fortran_vec ();
@@ -117,38 +115,32 @@
         {
         case MatrixType::Upper:
         case MatrixType::Diagonal:
-            {
-              if (! x.diag ().any_element_is_negative ())
-                {
-                  // Do it in real arithmetic.
-                  sqrtm_utri_inplace (x);
-                  retval = x;
-                  retval.matrix_type (mt);
-                }
-              else
-                iscomplex = true;
-
-              break;
-            }
-        case MatrixType::Lower:
+          if (! x.diag ().any_element_is_negative ())
             {
-              if (! x.diag ().any_element_is_negative ())
-                {
-                  x = x.transpose ();
-                  sqrtm_utri_inplace (x);
-                  retval = x.transpose ();
-                  retval.matrix_type (mt);
-                }
-              else
-                iscomplex = true;
+              // Do it in real arithmetic.
+              sqrtm_utri_inplace (x);
+              retval = x;
+              retval.matrix_type (mt);
+            }
+          else
+            iscomplex = true;
+          break;
 
-              break;
+        case MatrixType::Lower:
+          if (! x.diag ().any_element_is_negative ())
+            {
+              x = x.transpose ();
+              sqrtm_utri_inplace (x);
+              retval = x.transpose ();
+              retval.matrix_type (mt);
             }
+          else
+            iscomplex = true;
+          break;
+
         default:
-          {
-            iscomplex = true;
-            break;
-          }
+          iscomplex = true;
+          break;
         }
 
       if (iscomplex)
@@ -166,46 +158,41 @@
         {
         case MatrixType::Upper:
         case MatrixType::Diagonal:
-            {
-              sqrtm_utri_inplace (x);
-              retval = x;
-              retval.matrix_type (mt);
+          sqrtm_utri_inplace (x);
+          retval = x;
+          retval.matrix_type (mt);
+          break;
 
-              break;
-            }
         case MatrixType::Lower:
-            {
-              x = x.transpose ();
-              sqrtm_utri_inplace (x);
-              retval = x.transpose ();
-              retval.matrix_type (mt);
+          x = x.transpose ();
+          sqrtm_utri_inplace (x);
+          retval = x.transpose ();
+          retval.matrix_type (mt);
+          break;
 
-              break;
-            }
         default:
-            {
-              ComplexMatrix u;
+          {
+            ComplexMatrix u;
 
-              do
-                {
-                  ComplexSCHUR schur (x, std::string (), true);
-                  x = schur.schur_matrix ();
-                  u = schur.unitary_matrix ();
-                }
-              while (0); // schur no longer needed.
+            do
+              {
+                ComplexSCHUR schur (x, std::string (), true);
+                x = schur.schur_matrix ();
+                u = schur.unitary_matrix ();
+              }
+            while (0); // schur no longer needed.
 
-              sqrtm_utri_inplace (x);
+            sqrtm_utri_inplace (x);
 
-              x = u * x; // original x no longer needed.
-              ComplexMatrix res = xgemm (x, u, blas_no_trans, blas_conj_trans);
+            x = u * x; // original x no longer needed.
+            ComplexMatrix res = xgemm (x, u, blas_no_trans, blas_conj_trans);
 
-              if (cutoff > 0 && xnorm (imag (res), one) <= cutoff)
-                retval = real (res);
-              else
-                retval = res;
-
-              break;
-            }
+            if (cutoff > 0 && xnorm (imag (res), one) <= cutoff)
+              retval = real (res);
+            else
+              retval = res;
+          }
+          break;
         }
     }
 
@@ -246,22 +233,17 @@
     }
 
   if (arg.is_diag_matrix ())
-    {
-      // sqrtm of a diagonal matrix is just sqrt.
-      retval(0) = arg.sqrt ();
-    }
+    // sqrtm of a diagonal matrix is just sqrt.
+    retval(0) = arg.sqrt ();
   else if (arg.is_single_type ())
-    {
-      retval(0) = do_sqrtm<FloatMatrix, FloatComplexMatrix, FloatComplexSCHUR> (arg);
-    }
+    retval(0) = do_sqrtm<FloatMatrix, FloatComplexMatrix, FloatComplexSCHUR> (arg);
   else if (arg.is_numeric_type ())
-    {
-      retval(0) = do_sqrtm<Matrix, ComplexMatrix, ComplexSCHUR> (arg);
-    }
+    retval(0) = do_sqrtm<Matrix, ComplexMatrix, ComplexSCHUR> (arg);
 
   if (nargout > 1 && ! error_state)
     {
       // This corresponds to generic code
+      //
       //   norm (s*s - x, "fro") / norm (x, "fro");
 
       octave_value s = retval(0);
@@ -277,13 +259,13 @@
 
 ## The following two tests are from the reference in the docstring above.
 
-%!assert (isnan (sqrtm ([0 1; 0 0])))
+%!assert (any (isnan (sqrtm (x))(:) ))
 
 %!test
 %! x = eye (4); x(2,2) = x(3,3) = 2^-26; x(1,4) = 1;
 %! z = eye (4); z(2,2) = z(3,3) = 2^-13; z(1,4) = 0.5;
 %! [y, err] = sqrtm(x);
 %! assert (y, z)
-%! assert (err, 0)## Yes, this one has to hold exactly
+%! assert (err, 0)   ## Yes, this one has to hold exactly
 
 */
--- a/src/c-file-ptr-stream.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/c-file-ptr-stream.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -68,7 +68,7 @@
 {
   if (f)
     {
-      int_type c = fgetc (f);
+      int_type c = gnulib::fgetc (f);
 
       if (! bump
 #if defined (CXX_ISO_COMPLIANT_LIBRARY)
@@ -112,7 +112,7 @@
 c_file_ptr_buf::xsgetn (char *s, std::streamsize n)
 {
   if (f)
-    return fread (s, 1, n, f);
+    return gnulib::fread (s, 1, n, f);
   else
     return 0;
 }
@@ -173,7 +173,7 @@
 int
 c_file_ptr_buf::flush (void)
 {
-  return f ? fflush (f) : EOF;
+  return f ? gnulib::fflush (f) : EOF;
 }
 
 int
--- a/src/c-file-ptr-stream.h	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/c-file-ptr-stream.h	Thu Aug 04 23:35:13 2011 -0500
@@ -75,9 +75,9 @@
   int file_number () const { return f ? fileno (f) : -1; }
 
   int seek (long offset, int origin)
-    { return f ? fseek (f, offset, origin) : -1; }
+    { return f ? gnulib::fseek (f, offset, origin) : -1; }
 
-  long tell (void) { return f ? ftell (f) : -1; }
+  long tell (void) { return f ? gnulib::ftell (f) : -1; }
 
   void clear (void) { if (f) clearerr (f); }
 
--- a/src/data.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/data.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -4187,8 +4187,8 @@
 @end example\n\
 \n\
 Calling @code{eye} with no arguments is equivalent to calling it\n\
-with an argument of 1.  This odd definition is for compatibility\n\
-with @sc{matlab}.\n\
+with an argument of 1.  Any negative dimensions are treated as zero. \n\
+These odd definitions are for compatibility with @sc{matlab}.\n\
 @seealso{speye}\n\
 @end deftypefn")
 {
--- a/src/file-io.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/file-io.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -1989,7 +1989,7 @@
           OCTAVE_LOCAL_BUFFER (char, tmp, tmpl8.size () + 1);
           strcpy (tmp, tmpl8.c_str ());
 
-          int fd = mkstemp (tmp);
+          int fd = gnulib::mkstemp (tmp);
 
           if (fd < 0)
             {
--- a/src/graphics.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/graphics.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -4330,15 +4330,22 @@
   update_title_position ();
 }
 
+static bool updating_xlabel_position = false;
+
 void
 axes::properties::update_xlabel_position (void)
 {
+  if (updating_xlabel_position)
+    return;
+
   text::properties& xlabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_xlabel ()).get_properties ());
 
   bool is_empty = xlabel_props.get_string ().empty ();
 
-  xlabel_props.set_autopos_tag ("none");
+  unwind_protect frame;
+  frame.protect_var (updating_xlabel_position);
+  updating_xlabel_position = true;
 
   if (! is_empty)
     {
@@ -4412,19 +4419,24 @@
           xlabel_props.set_rotationmode ("auto");
         }
     }
-
-  xlabel_props.set_autopos_tag ("xlabel");
-}
+}
+
+static bool updating_ylabel_position = false;
 
 void
 axes::properties::update_ylabel_position (void)
 {
+  if (updating_ylabel_position)
+    return;
+
   text::properties& ylabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_ylabel ()).get_properties ());
 
   bool is_empty = ylabel_props.get_string ().empty ();
 
-  ylabel_props.set_autopos_tag ("none");
+  unwind_protect frame;
+  frame.protect_var (updating_ylabel_position);
+  updating_ylabel_position = true;
 
   if (! is_empty)
     {
@@ -4498,20 +4510,25 @@
           ylabel_props.set_rotationmode ("auto");
         }
     }
-
-  ylabel_props.set_autopos_tag ("ylabel");
-}
+}
+
+static bool updating_zlabel_position = false;
 
 void
 axes::properties::update_zlabel_position (void)
 {
+  if (updating_zlabel_position)
+    return;
+
   text::properties& zlabel_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_zlabel ()).get_properties ());
 
   bool camAuto = cameraupvectormode_is ("auto");
   bool is_empty = zlabel_props.get_string ().empty ();
 
-  zlabel_props.set_autopos_tag ("none");
+  unwind_protect frame;
+  frame.protect_var (updating_zlabel_position);
+  updating_zlabel_position = true;
 
   if (! is_empty)
     {
@@ -4606,17 +4623,22 @@
           zlabel_props.set_rotationmode ("auto");
         }
     }
-
-  zlabel_props.set_autopos_tag ("zlabel");
-}
+}
+
+static bool updating_title_position = false;
 
 void
 axes::properties::update_title_position (void)
 {
+  if (updating_title_position)
+    return;
+
   text::properties& title_props = reinterpret_cast<text::properties&>
     (gh_manager::get_object (get_title ()).get_properties ());
 
-  title_props.set_autopos_tag ("none");
+  unwind_protect frame;
+  frame.protect_var (updating_title_position);
+  updating_title_position = true;
 
   if (title_props.positionmode_is ("auto"))
     {
@@ -4630,8 +4652,6 @@
       title_props.set_position (p.extract_n(0, 3).transpose ());
       title_props.set_positionmode ("auto");
     }
-
-  title_props.set_autopos_tag ("title");
 }
 
 void
--- a/src/help.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/help.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -749,6 +749,9 @@
   const string_vector bif = symbol_table::built_in_function_names ();
   const int bif_len = bif.length ();
 
+  const string_vector cfl = symbol_table::cmdline_function_names ();
+  const int cfl_len = cfl.length ();
+
   const string_vector lcl = symbol_table::variable_names ();
   const int lcl_len = lcl.length ();
 
@@ -758,7 +761,8 @@
   const string_vector afl = autoloaded_functions ();
   const int afl_len = afl.length ();
 
-  const int total_len = key_len + bif_len + lcl_len + ffl_len + afl_len;
+  const int total_len
+    = key_len + bif_len + cfl_len + lcl_len + ffl_len + afl_len;
 
   string_vector list (total_len);
 
@@ -772,6 +776,9 @@
   for (i = 0; i < bif_len; i++)
     list[j++] = bif[i];
 
+  for (i = 0; i < cfl_len; i++)
+    list[j++] = cfl[i];
+
   for (i = 0; i < lcl_len; i++)
     list[j++] = lcl[i];
 
--- a/src/input.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/input.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -213,7 +213,7 @@
           FILE *stream = command_editor::get_output_stream ();
 
           gnulib::fputs (s.c_str (), stream);
-          fflush (stream);
+          gnulib::fflush (stream);
         }
 
       FILE *curr_stream = command_editor::get_input_stream ();
@@ -686,93 +686,88 @@
   frame.protect_var (VPS1);
   VPS1 = prompt;
 
-  if (stdin_is_tty)
+  if (! (interactive || forced_interactive)
+      || (reading_fcn_file
+          || reading_classdef_file
+          || reading_script_file
+          || get_input_from_eval_string
+          || input_from_startup_file
+          || input_from_command_line_file))
     {
-      if (! (interactive || forced_interactive)
-          || (reading_fcn_file
-              || reading_classdef_file
-              || reading_script_file
-              || get_input_from_eval_string
-              || input_from_startup_file
-              || input_from_command_line_file))
-        {
-          frame.protect_var (forced_interactive);
-          forced_interactive = true;
+      frame.protect_var (forced_interactive);
+      forced_interactive = true;
+
+      frame.protect_var (reading_fcn_file);
+      reading_fcn_file = false;
+
+      frame.protect_var (reading_classdef_file);
+      reading_classdef_file = false;
+
+      frame.protect_var (reading_script_file);
+      reading_script_file = false;
 
-          frame.protect_var (reading_fcn_file);
-          reading_fcn_file = false;
+      frame.protect_var (input_from_startup_file);
+      input_from_startup_file = false;
+
+      frame.protect_var (input_from_command_line_file);
+      input_from_command_line_file = false;
 
-          frame.protect_var (reading_classdef_file);
-          reading_classdef_file = false;
+      frame.protect_var (get_input_from_eval_string);
+      get_input_from_eval_string = false;
+
+      YY_BUFFER_STATE old_buf = current_buffer ();
+      YY_BUFFER_STATE new_buf = create_buffer (get_input_from_stdin ());
+
+      // FIXME: are these safe?
+      frame.add_fcn (switch_to_buffer, old_buf);
+      frame.add_fcn (delete_buffer, new_buf);
 
-          frame.protect_var (reading_script_file);
-          reading_script_file = false;
+      switch_to_buffer (new_buf);
+    }
+
+  while (Vdebugging)
+    {
+      reset_error_handler ();
+
+      reset_parser ();
 
-          frame.protect_var (input_from_startup_file);
-          input_from_startup_file = false;
+      // Save current value of global_command.
+      frame.protect_var (global_command);
+
+      global_command = 0;
 
-          frame.protect_var (input_from_command_line_file);
-          input_from_command_line_file = false;
+      // Do this with an unwind-protect cleanup function so that the
+      // forced variables will be unmarked in the event of an interrupt.
+      symbol_table::scope_id scope = symbol_table::top_scope ();
+      frame.add_fcn (symbol_table::unmark_forced_variables, scope);
 
-          frame.protect_var (get_input_from_eval_string);
-          get_input_from_eval_string = false;
+      // This is the same as yyparse in parse.y.
+      int retval = octave_parse ();
 
-          YY_BUFFER_STATE old_buf = current_buffer ();
-          YY_BUFFER_STATE new_buf = create_buffer (get_input_from_stdin ());
+      if (retval == 0 && global_command)
+        {
+          global_command->accept (*current_evaluator);
 
-          // FIXME: are these safe?
-          frame.add_fcn (switch_to_buffer, old_buf);
-          frame.add_fcn (delete_buffer, new_buf);
+          // FIXME -- To avoid a memory leak, global_command should be
+          // deleted, I think.  But doing that here causes trouble if
+          // an error occurs while executing a debugging command
+          // (dbstep, for example). It's not clear to me why that
+          // happens.
+          //
+          // delete global_command;
+          //
+          // global_command = 0;
 
-          switch_to_buffer (new_buf);
+          if (octave_completion_matches_called)
+            octave_completion_matches_called = false;
         }
 
-      while (Vdebugging)
-        {
-          reset_error_handler ();
-
-          reset_parser ();
-
-          // Save current value of global_command.
-          frame.protect_var (global_command);
-
-          global_command = 0;
-
-          // Do this with an unwind-protect cleanup function so that the
-          // forced variables will be unmarked in the event of an interrupt.
-          symbol_table::scope_id scope = symbol_table::top_scope ();
-          frame.add_fcn (symbol_table::unmark_forced_variables, scope);
-
-          // This is the same as yyparse in parse.y.
-          int retval = octave_parse ();
-
-          if (retval == 0 && global_command)
-            {
-              global_command->accept (*current_evaluator);
+      // Unmark forced variables.
+      // Restore previous value of global_command.
+      frame.run_top (2);
 
-              // FIXME -- To avoid a memory leak, global_command should be
-              // deleted, I think.  But doing that here causes trouble if
-              // an error occurs while executing a debugging command
-              // (dbstep, for example). It's not clear to me why that
-              // happens.
-              //
-              // delete global_command;
-              //
-              // global_command = 0;
-
-              if (octave_completion_matches_called)
-                octave_completion_matches_called = false;
-            }
-
-          // Unmark forced variables.
-          // Restore previous value of global_command.
-          frame.run_top (2);
-
-          octave_quit ();
-        }
+      octave_quit ();
     }
-  else
-    warning ("invalid attempt to debug script read from stdin");
 }
 
 // If the user simply hits return, this will produce an empty matrix.
--- a/src/oct-parse.yy	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/oct-parse.yy	Thu Aug 04 23:35:13 2011 -0500
@@ -3280,13 +3280,13 @@
 static int
 text_getc (FILE *f)
 {
-  int c = getc (f);
+  int c = gnulib::getc (f);
 
   // Convert CRLF into just LF and single CR into LF.
 
   if (c == '\r')
     {
-      c = getc (f);
+      c = gnulib::getc (f);
 
       if (c != '\n')
         {
@@ -3360,16 +3360,16 @@
 {
   bool status = false;
 
-  long pos = ftell (ffile);
+  long pos = gnulib::ftell (ffile);
 
   char buf [10];
-  fgets (buf, 10, ffile);
+  gnulib::fgets (buf, 10, ffile);
   size_t len = strlen (buf);
   if (len > 8 && strncmp (buf, "classdef", 8) == 0
       && ! (isalnum (buf[8]) || buf[8] == '_'))
     status = true;
 
-  fseek (ffile, pos, SEEK_SET);
+  gnulib::fseek (ffile, pos, SEEK_SET);
 
   return status;
  }
@@ -3420,16 +3420,16 @@
 {
   bool status = false;
 
-  long pos = ftell (ffile);
+  long pos = gnulib::ftell (ffile);
 
   char buf [10];
-  fgets (buf, 10, ffile);
+  gnulib::fgets (buf, 10, ffile);
   size_t len = strlen (buf);
   if (len > 8 && strncmp (buf, "function", 8) == 0
       && ! (isalnum (buf[8]) || buf[8] == '_'))
     status = true;
 
-  fseek (ffile, pos, SEEK_SET);
+  gnulib::fseek (ffile, pos, SEEK_SET);
 
   return status;
 }
--- a/src/strfns.cc	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/strfns.cc	Thu Aug 04 23:35:13 2011 -0500
@@ -170,7 +170,6 @@
 @deftypefnx {Built-in Function} {} strvcat (@var{x}, @dots{})\n\
 @deftypefnx {Built-in Function} {} strvcat (@var{s1}, @var{s2}, @dots{})\n\
 @deftypefnx {Built-in Function} {} strvcat (@var{cell_array})\n\
-@deftypefnx {Built-in Function} {} strvcat ()\n\
 Create a character array from one or more numeric matrices, character\n\
 matrices, or cell arrays.  Arguments are concatenated vertically.\n\
 The returned values are padded with blanks as needed to make each row\n\
@@ -197,9 +196,6 @@
          \"half   \"]\n\
 @end group\n\
 @end example\n\
-\n\
-For compatibility with @sc{Matlab}, calling @code{strvcat} without arguments\n\
-returns the empty string.\n\
 @seealso{char, strcat, cstrcat}\n\
 @end deftypefn")
 {
@@ -277,7 +273,7 @@
       retval = octave_value (result, '\'');
     }
   else
-    retval = octave_value ("");
+    print_usage ();
 
   return retval;
 }
--- a/src/symtab.h	Thu Aug 04 23:08:20 2011 -0500
+++ b/src/symtab.h	Thu Aug 04 23:35:13 2011 -0500
@@ -790,6 +790,11 @@
       return rep->built_in_function;
     }
 
+    octave_value find_cmdline_function (void) const
+    {
+      return rep->cmdline_function;
+    }
+
     octave_value find_autoload (void)
     {
       return rep->find_autoload ();
@@ -1787,6 +1792,25 @@
     return retval;
   }
 
+  static std::list<std::string> cmdline_function_names (void)
+  {
+    std::list<std::string> retval;
+
+    for (fcn_table_const_iterator p = fcn_table.begin ();
+         p != fcn_table.end (); p++)
+      {
+        octave_value fcn = p->second.find_cmdline_function ();
+
+        if (fcn.is_defined ())
+          retval.push_back (p->first);
+      }
+
+    if (! retval.empty ())
+      retval.sort ();
+
+    return retval;
+  }
+
   static bool is_local_variable (const std::string& name)
   {
     if (xcurrent_scope == xglobal_scope)