[CHANGESET] STRCAT is not compatible

Ben Abbott bpabbott at mac.com
Mon Feb 25 13:19:36 CST 2008


I've attached rather large changeset that (1) renames strcat.m to cstrcat.m, (2) modifies all calls to strcat to respect cstrcat, and (3) adds the new strcat.m which is compatible with Matlab's.

I wrote a shell script to handle the entire process, so if something needs to be done differently it should be a rather simple matter to take care of it.

Ben


-------------- next part --------------
# HG changeset patch
# User Ben Abbott <bpabbott at mac.com>
# Date 1203966406 18000
# Node ID 844ec13207223293808ca8f42f1760886bfe3214
# Parent  d219e712c20e97cf1d426dfdfb89075abf3581c1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.

diff -r d219e712c20e -r 844ec1320722 doc/ChangeLog
--- a/doc/ChangeLog	Mon Feb 25 04:59:17 2008 -0500
+++ b/doc/ChangeLog	Mon Feb 25 14:06:46 2008 -0500
@@ -1,3 +1,11 @@ 2008-02-22  David Bateman  <dbateman at fre
+2008-02-25  Ben Abbott <bpabbott at mac.com>
+
+	* Various files modified to call cstrcat which rather than strcat
+	  which has been modified to respect Matlab compatibility. The 
+	  modified files include: doc/interpreter/geometryimages.m,
+	  doc/interpreter/interpimages.m, doc/interpreter/plotimages.m,
+	  doc/interpreter/sparseimages.m.
+
 2008-02-22  David Bateman  <dbateman at free.fr>
 
 	* interpreter/sparse.txi: Remove refernces to spdiag, spcumprod,
diff -r d219e712c20e -r 844ec1320722 doc/interpreter/geometryimages.m
--- a/doc/interpreter/geometryimages.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/doc/interpreter/geometryimages.m	Mon Feb 25 14:06:46 2008 -0500
@@ -44,14 +44,14 @@ function geometryimages (nm, typ)
     plot (xc, yc, "g-", "LineWidth", 3);
     axis([0, 1, 0, 1]);
     legend ("Delaunay Triangulation", "Voronoi Diagram");
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "triplot"))
     rand ("state", 2)
     x = rand (20, 1);
     y = rand (20, 1);
     tri = delaunay (x, y);
     triplot (tri, x, y);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "griddata"))
     rand("state",1);
     x=2*rand(1000,1)-1;
@@ -59,14 +59,14 @@ function geometryimages (nm, typ)
     z=sin(2*(x.^2+y.^2));
     [xx,yy]=meshgrid(linspace(-1,1,32));
     griddata(x,y,z,xx,yy);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "convhull"))
     x = -3:0.05:3;
     y = abs (sin (x));
     k = convhull (x, y);
     plot (x(k),y(k),'r-',x,y,'b+');
     axis ([-3.05, 3.05, -0.05, 1.05]);
-    print (strcat (nm, ".", typ), strcat ("-d", typ)) 
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) 
   elseif (strcmp (nm, "delaunay"))
     rand ("state", 1);
     x = rand (1, 10);
@@ -76,7 +76,7 @@ function geometryimages (nm, typ)
     Y = [ y(T(:,1)); y(T(:,2)); y(T(:,3)); y(T(:,1)) ];
     axis ([0, 1, 0, 1]);
     plot(X, Y, "b", x, y, "r*");
-    print (strcat (nm, ".", typ), strcat ("-d", typ)) 
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) 
   elseif (strcmp (nm, "inpolygon"))
     randn ("state", 2);
     x = randn (100, 1);
@@ -86,7 +86,7 @@ function geometryimages (nm, typ)
     in = inpolygon (x, y, vx, vy);
     plot(vx, vy, x(in), y(in), "r+", x(!in), y(!in), "bo");
     axis ([-2, 2, -2, 2]);
-    print (strcat (nm, ".", typ), strcat ("-d", typ)) 
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) 
   else
     error ("unrecognized plot requested");
   endif
@@ -129,14 +129,14 @@ function geometryimages (nm, typ)
     plot (xc, yc, "g-", "LineWidth", 3);
     axis([0, 1, 0, 1]);
     legend ("Delaunay Triangulation", "Voronoi Diagram");
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "triplot"))
     rand ("state", 2)
     x = rand (20, 1);
     y = rand (20, 1);
     tri = delaunay (x, y);
     triplot (tri, x, y);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "griddata"))
     rand("state",1);
     x=2*rand(1000,1)-1;
@@ -144,7 +144,7 @@ function geometryimages (nm, typ)
     z=sin(2*(x.^2+y.^2));
     [xx,yy]=meshgrid(linspace(-1,1,32));
     griddata(x,y,z,xx,yy);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   else
     error ("unrecognized plot requested");
   endif
@@ -191,7 +191,7 @@ function sombreroimage (nm, typ)
       mesh (x, y, z);
       title ("Sorry, graphics not available because octave was\\ncompiled without the QHULL library.");
     unwind_protect_cleanup
-      print (strcat (nm, ".", typ), strcat ("-d", typ));
+      print (cstrcat (nm, ".", typ), cstrcat ("-d", typ));
       bury_output ();
     end_unwind_protect
   endif
diff -r d219e712c20e -r 844ec1320722 doc/interpreter/interpimages.m
--- a/doc/interpreter/interpimages.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/doc/interpreter/interpimages.m	Mon Feb 25 14:06:46 2008 -0500
@@ -32,7 +32,7 @@ function interpimages (nm, typ)
     plot (ti, yp, 'g', ti, interp1(t, y, ti, 'spline'), 'b', ...
 	  ti, interpft (y, k), 'c', t, y, 'r+');
     legend ('sin(4t+0.3)cos(3t-0.1','spline','interpft','data');
-    print (strcat (nm, ".", typ), strcat ("-d", typ))
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   elseif (strcmp (nm, "interpn"))
     x = y = z = -1:1;
     f = @(x,y,z) x.^2 - y - z.^2;
@@ -42,7 +42,7 @@ function interpimages (nm, typ)
     [xxi, yyi, zzi] = ndgrid (xi, yi, zi);
     vi = interpn(x, y, z, v, xxi, yyi, zzi, 'spline');
     mesh (zi, yi, squeeze (vi(1,:,:)));
-    print (strcat (nm, ".", typ), strcat ("-d", typ))
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   elseif (strcmp (nm, "interpderiv1"))
     t = -2:2;
     dt = 1;
@@ -53,7 +53,7 @@ function interpimages (nm, typ)
     yp = interp1(t,y,ti,'pchip');
     plot (ti, ys,'r-', ti, yp,'g-');
     legend('spline','pchip', 4);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   elseif (strcmp (nm, "interpderiv2"))
     t = -2:2;
     dt = 1;
@@ -64,7 +64,7 @@ function interpimages (nm, typ)
     ddyp = diff(diff(interp1(t,y,ti,'pchip'))./dti)./dti;
     plot (ti(2:end-1),ddys,'r*', ti(2:end-1),ddyp,'g+');
     legend('spline','pchip');
-    print (strcat (nm, ".", typ), strcat ("-d", typ))
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   endif
   bury_output ();  
 endfunction
diff -r d219e712c20e -r 844ec1320722 doc/interpreter/plotimages.m
--- a/doc/interpreter/plotimages.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/doc/interpreter/plotimages.m	Mon Feb 25 14:06:46 2008 -0500
@@ -26,42 +26,42 @@ function plotimages (nm, typ)
   elseif (strcmp (nm, "plot"))
     x = -10:0.1:10;
     plot (x, sin (x));
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "hist"))
     hist (randn (10000, 1), 30);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "errorbar"))
     x = 0:0.1:10;
     y = sin (x);
     yp =  0.1 .* randn (size (x));
     ym = -0.1 .* randn (size (x));
     errorbar (x, sin (x), ym, yp);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "polar"))
     polar (0:0.1:10*pi, 0:0.1:10*pi);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "mesh"))
     tx = ty = linspace (-8, 8, 41)';
     [xx, yy] = meshgrid (tx, ty);
     r = sqrt (xx .^ 2 + yy .^ 2) + eps;
     tz = sin (r) ./ r;
     mesh (tx, ty, tz);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "plot3"))
     t = 0:0.1:10*pi;
     r = linspace (0, 1, numel (t));
     z = linspace (0, 1, numel (t));
     plot3 (r.*sin(t), r.*cos(t), z);
-    print (strcat (nm, ".", typ), strcat ("-d", typ))    
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))    
   elseif (strcmp (nm, "extended"))
     x = 0:0.01:3;
     plot(x,erf(x));
     hold on;
     plot(x,x,"r");
     axis([0, 3, 0, 1]);
-    text(0.65, 0.6175, strcat('\leftarrow x = {2/\surd\pi {\fontsize{16}',
+    text(0.65, 0.6175, cstrcat('\leftarrow x = {2/\surd\pi {\fontsize{16}',
       '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175'))
-    print (strcat (nm, ".", typ), strcat ("-d", typ))
+    print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   else
     error ("unrecognized plot requested");
   endif
diff -r d219e712c20e -r 844ec1320722 doc/interpreter/sparseimages.m
--- a/doc/interpreter/sparseimages.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/doc/interpreter/sparseimages.m	Mon Feb 25 14:06:46 2008 -0500
@@ -51,7 +51,7 @@ function gplotimages (nm, typ)
 	      [1,1,2,2,3,3,4,4,5,5,6,6], 1, 6, 6);
   xy = [0,4,8,6,4,2;5,0,5,7,5,7]';
   gplot (A, xy)
-  print (strcat (nm, ".", typ), strcat ("-d", typ))
+  print (cstrcat (nm, ".", typ), cstrcat ("-d", typ))
   bury_output ();
 endfunction
 
@@ -66,16 +66,16 @@ function txtimages(nm,n,typ)
     fputs (fid, "+---------------------------------+\n");
     fclose (fid);
   elseif (strcmp (nm, "spmatrix"))
-    printsparse(a,strcat("spmatrix.",typ));
+    printsparse(a,cstrcat("spmatrix.",typ));
   else
     if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) &&
 	!isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD")))
       if (strcmp (nm, "spchol"))
 	r1 = chol(a);
-	printsparse(r1,strcat("spchol.",typ));
+	printsparse(r1,cstrcat("spchol.",typ));
       elseif (strcmp (nm, "spcholperm"))
 	[r2,p2,q2]=chol(a);
-	printsparse(r2,strcat("spcholperm.",typ));
+	printsparse(r2,cstrcat("spcholperm.",typ));
       endif
       ## printf("Text NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2));
     endif
@@ -89,7 +89,7 @@ function otherimages(nm,n,typ)
   if (strcmp (nm, "spmatrix"))
     spy(a);
     axis("ij")
-    print(strcat("spmatrix.",typ),strcat("-d",typ))
+    print(cstrcat("spmatrix.",typ),cstrcat("-d",typ))
     bury_output ();
   else
     if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) &&
@@ -98,13 +98,13 @@ function otherimages(nm,n,typ)
 	r1 = chol(a);
 	spy(r1);
 	axis("ij")
-	print(strcat("spchol.",typ),strcat("-d",typ))
+	print(cstrcat("spchol.",typ),cstrcat("-d",typ))
 	bury_output ();
       elseif (strcmp (nm, "spcholperm"))
 	[r2,p2,q2]=chol(a);
 	spy(r2);
 	axis("ij")
-	print(strcat("spcholperm.",typ),strcat("-d",typ))
+	print(cstrcat("spcholperm.",typ),cstrcat("-d",typ))
 	bury_output ();
       endif
       ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2));
@@ -227,7 +227,7 @@ function femimages (nm,typ)
 
     plot3 (xelems, yelems, velems);
     view (10, 10);
-    print(strcat(nm,".",typ),strcat("-d",typ))
+    print(cstrcat(nm,".",typ),cstrcat("-d",typ))
     bury_output ();
   endif
 endfunction
@@ -257,7 +257,7 @@ function sombreroimage (nm, typ)
       mesh (x, y, z);
       title ("Sorry, graphics not available because octave was\\ncompiled without the sparse matrix implementation.");
     unwind_protect_cleanup
-      print (strcat (nm, ".", typ), strcat ("-d", typ));
+      print (cstrcat (nm, ".", typ), cstrcat ("-d", typ));
       bury_output ();
     end_unwind_protect
   endif
diff -r d219e712c20e -r 844ec1320722 scripts/ChangeLog
--- a/scripts/ChangeLog	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/ChangeLog	Mon Feb 25 14:06:46 2008 -0500
@@ -1,3 +1,29 @@ 2008-02-25  Ryan Hinton  <rwh4s at virginia
+2008-02-25  Ben Abbott <bpabbott at mac.com>
+
+	* strings/strcat.m: Modified for matlab compatibility.
+	* strings/cstrcat.m: Conventional strcat.m renamed to support
+	  existing calls which require conventional the operation.
+	* Various files that called strcat have been modified to call
+	  cstrcat instead. Those files include: doc/interpreter/geometryimages.m,
+	  doc/interpreter/interpimages.m, doc/interpreter/plotimages.m,
+	  doc/interpreter/sparseimages.m, scripts/ChangeLog,
+	  scripts/control/system/zpout.m, scripts/finance/irr.m,
+	  scripts/general/int2str.m, scripts/general/num2str.m,
+	  scripts/miscellaneous/bug_report.m, scripts/miscellaneous/copyfile.m,
+	  scripts/miscellaneous/dir.m, scripts/miscellaneous/edit.m,
+	  scripts/miscellaneous/fullfile.m, scripts/miscellaneous/mkoctfile.m,
+	  scripts/miscellaneous/movefile.m, scripts/miscellaneous/tempdir.m,
+	  scripts/miscellaneous/unpack.m, scripts/path/__extractpath__.m,
+	  scripts/pkg/pkg.m, scripts/plot/__ezplot__.m,
+	  scripts/plot/__go_draw_axes__.m, scripts/plot/legend.m,
+	  scripts/plot/print.m, scripts/signal/spectral_adf.m,
+	  scripts/signal/spectral_xdf.m, scripts/statistics/tests/z_test.m,
+	  scripts/statistics/tests/z_test_2.m, scripts/strings/Makefile.in,
+	  scripts/strings/strcat.m, scripts/strings/strvcat.m,
+	  scripts/testfun/assert.m, scripts/testfun/demo.m,
+	  scripts/testfun/speed.m, scripts/testfun/test.m,
+	  test/test_eval-catch.m, test/test_io.m, test/test_try.m
+
 2008-02-25  Ryan Hinton  <rwh4s at virginia.edu>
 
 	* miscellaneous/unpack.m: Use "-f -" args for tar.
diff -r d219e712c20e -r 844ec1320722 scripts/control/system/zpout.m
--- a/scripts/control/system/zpout.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/control/system/zpout.m	Mon Feb 25 14:06:46 2008 -0500
@@ -58,7 +58,7 @@ function zpout (zer, pol, k, x)
       if (nzr > 1)
 	numstring = sprintf ("%s %s^%d", numstring, x, nzr);
       else
-	numstring = strcat (numstring, x);
+	numstring = cstrcat (numstring, x);
       endif
     endif
     zer = sortcom (-zer);
diff -r d219e712c20e -r 844ec1320722 scripts/finance/irr.m
--- a/scripts/finance/irr.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/finance/irr.m	Mon Feb 25 14:06:46 2008 -0500
@@ -40,7 +40,7 @@ function r = irr (p, i)
   if (! (isvector (p)))
     error ("irr: p must be a vector");
   else
-    p_string = strcat ("[", sprintf ("%.15f, ", p), "]");
+    p_string = cstrcat ("[", sprintf ("%.15f, ", p), "]");
   endif
 
   if (! isscalar (i))
diff -r d219e712c20e -r 844ec1320722 scripts/general/int2str.m
--- a/scripts/general/int2str.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/general/int2str.m	Mon Feb 25 14:06:46 2008 -0500
@@ -43,9 +43,9 @@ function retval = int2str (x)
       ifmt = get_fmt (x(idx{:}), 0);
       idx(2) = 2:sz(2);
       rfmt = get_fmt (x(idx{:}), 2);
-      fmt = strcat (ifmt, repmat (rfmt, 1, nc-1), "\n")
+      fmt = cstrcat (ifmt, repmat (rfmt, 1, nc-1), "\n")
     else
-      fmt = strcat (get_fmt (x, 0), "\n");
+      fmt = cstrcat (get_fmt (x, 0), "\n");
     endif
     tmp = sprintf (fmt, permute (x, [2, 1, 3 : nd]));
     tmp(end) = "";
diff -r d219e712c20e -r 844ec1320722 scripts/general/num2str.m
--- a/scripts/general/num2str.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/general/num2str.m	Mon Feb 25 14:06:46 2008 -0500
@@ -42,7 +42,7 @@ function retval = num2str (x, arg)
   elseif (iscomplex (x))
     if (nargin == 2)
       if (ischar (arg))
-	fmt = strcat (arg, "%-+", arg(2:end), "i");
+	fmt = cstrcat (arg, "%-+", arg(2:end), "i");
       else
 	if (isnumeric (x) && round (x) == x && abs (x) < (10 .^ arg))
 	  fmt = sprintf ("%%%dd%%-+%ddi  ", arg, arg);
@@ -88,7 +88,7 @@ function retval = num2str (x, arg)
     x = horzcat (real (x), imag (x));
     x = x(idx{:});
 
-    fmt = strcat (deblank (repmat (fmt, 1, nc)), "\n");
+    fmt = cstrcat (deblank (repmat (fmt, 1, nc)), "\n");
     tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
 
     ## Put the "i"'s where they are supposed to be.
@@ -140,7 +140,7 @@ function retval = num2str (x, arg)
 	fmt = "%11.5g";
       endif
     endif
-    fmt = strcat (deblank (repmat (fmt, 1, columns (x))), "\n");
+    fmt = cstrcat (deblank (repmat (fmt, 1, columns (x))), "\n");
     nd = ndims (x);
     tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
     tmp(length (tmp)) = "";
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/bug_report.m
--- a/scripts/miscellaneous/bug_report.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/bug_report.m	Mon Feb 25 14:06:46 2008 -0500
@@ -50,7 +50,7 @@ function bug_report ()
       endif
     endif
 
-    cmd = strcat ("octave-bug-", OCTAVE_VERSION);
+    cmd = cstrcat ("octave-bug-", OCTAVE_VERSION);
 
     if (length (subject) > 0)
       cmd = sprintf ("%s -s \"%s\"", cmd, subject);
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/copyfile.m
--- a/scripts/miscellaneous/copyfile.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/copyfile.m	Mon Feb 25 14:06:46 2008 -0500
@@ -60,7 +60,7 @@ function [status, msg, msgid] = copyfile
     endif
 
     if (nargin == 3 && strcmp (force, "f"))
-      cmd = strcat (cmd, " ", cmd_force_flag);
+      cmd = cstrcat (cmd, " ", cmd_force_flag);
     endif
 
     ## If f1 isn't a cellstr convert it to one.
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/dir.m
--- a/scripts/miscellaneous/dir.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/dir.m	Mon Feb 25 14:06:46 2008 -0500
@@ -113,7 +113,7 @@ function retval = dir (file)
 	    endif
 	  endif
 	  [dummy, fn, ext] = fileparts (fn);
-	  fn = strcat (fn, ext);
+	  fn = cstrcat (fn, ext);
 	  info(i,1).name = fn;
 	  lt = localtime (st.mtime);
 	  info(i,1).date = strftime ("%d-%b-%Y %T", lt);
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/edit.m
--- a/scripts/miscellaneous/edit.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/edit.m	Mon Feb 25 14:06:46 2008 -0500
@@ -140,7 +140,7 @@ function ret = edit (file, state)
 
   ## Pick up globals or default them.
 
-  persistent FUNCTION = struct ("EDITOR", strcat (EDITOR (), " %s"),
+  persistent FUNCTION = struct ("EDITOR", cstrcat (EDITOR (), " %s"),
   				"HOME", fullfile (default_home, "octave"),
   				"AUTHOR", default_user(1),
   				"EMAIL",  [],
@@ -197,7 +197,7 @@ function ret = edit (file, state)
   ## Start the editor without a file if no file is given.
   if (nargin < 1)
     if (exist (FUNCTION.HOME, "dir") == 7 && (isunix () || ! ispc ()))
-      system (strcat ("cd \"", FUNCTION.HOME, "\" ; ",
+      system (cstrcat ("cd \"", FUNCTION.HOME, "\" ; ",
 		      sprintf (FUNCTION.EDITOR, "")),
 	      [], FUNCTION.MODE);
     else
@@ -271,7 +271,7 @@ function ret = edit (file, state)
     ## If the file exists, then edit it.
     if (FUNCTION.EDITINPLACE)
       ## Edit in place even if it is protected.
-      system (sprintf (FUNCTION.EDITOR, strcat ("\"", fileandpath, "\"")),
+      system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
               [], FUNCTION.MODE);
       return;
     else
@@ -280,7 +280,7 @@ function ret = edit (file, state)
       fid = fopen (fileandpath, "r+t");
       if (fid < 0)
         from = fileandpath;
-        fileandpath = strcat (FUNCTION.HOME, from (rindex (from, filesep):end));
+        fileandpath = cstrcat (FUNCTION.HOME, from (rindex (from, filesep):end));
         [status, msg] = copyfile (from, fileandpath, 1);
         if (status == 0)
           error (msg);
@@ -288,7 +288,7 @@ function ret = edit (file, state)
       else
         fclose (fid);
       endif
-      system (sprintf (FUNCTION.EDITOR, strcat ("\"", fileandpath, "\"")),
+      system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
               [], FUNCTION.MODE);
       return;
     endif
@@ -304,7 +304,7 @@ function ret = edit (file, state)
     case {"cc", "m"}
       0;
     otherwise
-      system (sprintf (FUNCTION.EDITOR, strcat ("\"", fileandpath, "\"")),
+      system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
 	      [], FUNCTION.MODE);
       return;
   endswitch
@@ -328,25 +328,25 @@ function ret = edit (file, state)
     if (isempty (host))
       FUNCTION.EMAIL = " ";
     else
-      FUNCTION.EMAIL = strcat ("<", default_user(0), "@", host, ">");
+      FUNCTION.EMAIL = cstrcat ("<", default_user(0), "@", host, ">");
     endif
   endif
 
   ## Fill in the revision string.
   now = localtime (time);
-  revs = strcat ("Created: ", strftime ("%Y-%m-%d", now));
+  revs = cstrcat ("Created: ", strftime ("%Y-%m-%d", now));
 
   ## Fill in the copyright string.
-  copyright = strcat (strftime ("Copyright (C) %Y ", now), FUNCTION.AUTHOR);
+  copyright = cstrcat (strftime ("Copyright (C) %Y ", now), FUNCTION.AUTHOR);
 
   ## Fill in the author tag field.
-  author = strcat ("Author: ", FUNCTION.AUTHOR, " ", FUNCTION.EMAIL);
+  author = cstrcat ("Author: ", FUNCTION.AUTHOR, " ", FUNCTION.EMAIL);
 
   ## Fill in the header.
   uclicense = toupper (FUNCTION.LICENSE);
   switch (uclicense)
     case "GPL"
-      head = strcat (copyright, "\n\n", "\
+      head = cstrcat (copyright, "\n\n", "\
 This program is free software; you can redistribute it and/or modify\n\
 it under the terms of the GNU General Public License as published by\n\
 the Free Software Foundation; either version 2 of the License, or\n\
@@ -361,10 +361,10 @@ along with Octave; see the file COPYING.
 along with Octave; see the file COPYING.  If not, see\n\
 <http://www.gnu.org/licenses/>.\
 ");
-      tail = strcat (author, "\n", revs);
+      tail = cstrcat (author, "\n", revs);
 
     case "BSD"
-      head = strcat (copyright, "\n\n", "\
+      head = cstrcat (copyright, "\n\n", "\
 This program is free software; redistribution and use in source and\n\
 binary forms, with or without modification, are permitted provided that\n\
 the following conditions are met:\n\
@@ -387,16 +387,16 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n\
 SUCH DAMAGE.\
 ");
-      tail = strcat (author, "\n", revs);
+      tail = cstrcat (author, "\n", revs);
 
     case "PD"
       head = "";
-      tail = strcat (author, "\n", revs, "\n\n",
+      tail = cstrcat (author, "\n", revs, "\n\n",
 		     "This program is granted to the public domain.");
 
     otherwise
       head = "";
-      tail = strcat (copyright, "\n\n", FUNCTION.LICENSE, "\n",
+      tail = cstrcat (copyright, "\n\n", FUNCTION.LICENSE, "\n",
 		     author, "\n", revs);
   endswitch
 
@@ -405,41 +405,41 @@ SUCH DAMAGE.\
   switch (ext)
     case {"cc", "C", "cpp"}
       if (isempty (head))
-	comment = strcat ("/*\n", tail, "\n\n*/\n\n");
+	comment = cstrcat ("/*\n", tail, "\n\n*/\n\n");
       else
-	comment = strcat ("/*\n", head, "\n\n", tail, "\n\n*/\n\n");
+	comment = cstrcat ("/*\n", head, "\n\n", tail, "\n\n*/\n\n");
       endif
       ## If we are shadowing an m-file, paste the code for the m-file.
       if (any (exists == [2, 103]))
-	code = strcat ("\\ ", strrep (type (name), "\n", "\n// "));
+	code = cstrcat ("\\ ", strrep (type (name), "\n", "\n// "));
       else
 	code = " ";
       endif
-      body = strcat ("#include <octave/oct.h>\n\n",
+      body = cstrcat ("#include <octave/oct.h>\n\n",
                      "DEFUN_DLD(", name, ",args,nargout,\"\\\n",
 		     name, "\\n\\\n\")\n{\n",
 		     "  octave_value_list retval;\n",
 		     "  int nargin = args.length();\n\n",
 		     code, "\n  return retval;\n}\n");
 
-      text = strcat (comment, body);
+      text = cstrcat (comment, body);
     case "m"
       ## If we are editing a function defined on the fly, paste the
       ## code.
       if (any (exists == [2, 103]))
 	body = type (name);
       else
-	body = strcat ("function [ ret ] = ", name, " ()\n\nendfunction\n");
+	body = cstrcat ("function [ ret ] = ", name, " ()\n\nendfunction\n");
       endif
       if (isempty (head))
-	comment = strcat ("## ", name, "\n\n",
+	comment = cstrcat ("## ", name, "\n\n",
 			  "## ", strrep (tail, "\n", "\n## "), "\n\n");
       else
-	comment = strcat ("## ", strrep(head,"\n","\n## "), "\n\n", ...
+	comment = cstrcat ("## ", strrep(head,"\n","\n## "), "\n\n", ...
 			  "## ", name, "\n\n", ...
 			  "## ", strrep (tail, "\n", "\n## "), "\n\n");
       endif
-      text = strcat (comment, body);
+      text = cstrcat (comment, body);
   endswitch
 
   ## Write the initial file (if there is anything to write)
@@ -451,7 +451,7 @@ SUCH DAMAGE.\
   fclose (fid);
 
   ## Finally we are ready to edit it!
-  system (sprintf (FUNCTION.EDITOR, strcat ("\"", fileandpath, "\"")),
+  system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
 	  [], FUNCTION.MODE);
 
 endfunction
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/fullfile.m
--- a/scripts/miscellaneous/fullfile.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/fullfile.m	Mon Feb 25 14:06:46 2008 -0500
@@ -40,7 +40,7 @@ function filename = fullfile (varargin)
 	elseif (i == nargs && strcmp (tmp, filesep))
 	  tmp = "";
 	endif
-	filename = strcat (filename, filesep, tmp);
+	filename = cstrcat (filename, filesep, tmp);
       endfor
     elseif (nargs == 1)
       filename = varargin{1};
@@ -55,10 +55,10 @@ endfunction
 
 %!shared fs, fsx, xfs, fsxfs, xfsy
 %! fs = filesep ();
-%! fsx = strcat (fs, "x");
-%! xfs = strcat ("x", fs);
-%! fsxfs = strcat (fs, "x", fs);
-%! xfsy = strcat ("x", fs, "y");
+%! fsx = cstrcat (fs, "x");
+%! xfs = cstrcat ("x", fs);
+%! fsxfs = cstrcat (fs, "x", fs);
+%! xfsy = cstrcat ("x", fs, "y");
 %!assert (fullfile (""), "")
 %!assert (fullfile (fs), fs)
 %!assert (fullfile ("", fs), fs)
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/mkoctfile.m
--- a/scripts/miscellaneous/mkoctfile.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/mkoctfile.m	Mon Feb 25 14:06:46 2008 -0500
@@ -125,9 +125,9 @@ function mkoctfile (varargin)
 
   shell_script = fullfile (bindir, sprintf ("mkoctfile-%s", OCTAVE_VERSION));
 
-  cmd = strcat ("\"", shell_script, "\"");
+  cmd = cstrcat ("\"", shell_script, "\"");
   for i = 1:nargin
-    cmd = strcat (cmd, " \"", varargin{i}, "\"");
+    cmd = cstrcat (cmd, " \"", varargin{i}, "\"");
   endfor
   
   status = system (cmd);
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/movefile.m
--- a/scripts/miscellaneous/movefile.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/movefile.m	Mon Feb 25 14:06:46 2008 -0500
@@ -59,7 +59,7 @@ function [status, msg, msgid] = movefile
     endif
 
     if (nargin == 3 && strcmp (force, "f"))
-      cmd = strcat (cmd, " ", cmd_force_flag);
+      cmd = cstrcat (cmd, " ", cmd_force_flag);
     endif
 
     ## If f1 isn't a cellstr convert it to one.
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/tempdir.m
--- a/scripts/miscellaneous/tempdir.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/tempdir.m	Mon Feb 25 14:06:46 2008 -0500
@@ -29,7 +29,7 @@ function dirname = tempdir ()
   endif
 
   if (! strcmp (dirname(end), filesep))
-    strcat (dirname, filesep);
+    cstrcat (dirname, filesep);
   endif
 
   if (! isdir (dirname))
diff -r d219e712c20e -r 844ec1320722 scripts/miscellaneous/unpack.m
--- a/scripts/miscellaneous/unpack.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/miscellaneous/unpack.m	Mon Feb 25 14:06:46 2008 -0500
@@ -60,7 +60,7 @@ function filelist = unpack (file, direct
 	[tmppathstr, tmpname, tmpext] = fileparts (name);
 	if (strcmpi (tmpext, ".tar"))
 	  name = tmpname;
-	  ext = strcat (tmpext, ext);
+	  ext = cstrcat (tmpext, ext);
 	endif
       endif
 
@@ -71,7 +71,7 @@ function filelist = unpack (file, direct
 	urlfile = file;
 	## FIXME -- should we name the file that we download with the
 	## same file name as the url requests?
-	tmpfile = strcat (tmpnam (), ext);
+	tmpfile = cstrcat (tmpnam (), ext);
 	[file, success, msg] = urlwrite (urlfile, tmpfile);
 	if (! success)
 	  error ("unpack: could not get \"%s\": %s", urlfile, msg);
@@ -172,7 +172,7 @@ function filelist = unpack (file, direct
 
   unwind_protect
     cd (directory);
-    [status, output] = system (sprintf (strcat (command, " 2>&1"), file));
+    [status, output] = system (sprintf (cstrcat (command, " 2>&1"), file));
   unwind_protect_cleanup
     cd (origdir);
   end_unwind_protect
diff -r d219e712c20e -r 844ec1320722 scripts/path/__extractpath__.m
--- a/scripts/path/__extractpath__.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/path/__extractpath__.m	Mon Feb 25 14:06:46 2008 -0500
@@ -84,7 +84,7 @@ function specifiedpath = __extractpath__
     error ("savepath: unable to parse file, %s", savefile);
   elseif (startline > 0)
     ## Undo doubling of single quote characters performed by savepath.
-    specifiedpath = strrep (regexprep (strcat (filelines(startline:endline){:}),
+    specifiedpath = strrep (regexprep (cstrcat (filelines(startline:endline){:}),
 				       " *path *\\('(.*)'\\); *", "$1"),
 			    "''", "'");
   else
diff -r d219e712c20e -r 844ec1320722 scripts/pkg/pkg.m
--- a/scripts/pkg/pkg.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/pkg/pkg.m	Mon Feb 25 14:06:46 2008 -0500
@@ -431,7 +431,7 @@ function descriptions = rebuild (prefix,
     wd = pwd ();
     unwind_protect
       cd (prefix);
-      dirlist = glob (cellfun(@(x) strcat(x, '-*'), files, 'UniformOutput', 0));
+      dirlist = glob (cellfun(@(x) cstrcat(x, '-*'), files, 'UniformOutput', 0));
     unwind_protect_cleanup
       cd (wd);
     end_unwind_protect
@@ -445,7 +445,7 @@ function descriptions = rebuild (prefix,
     if (exist (descfile, "file"))
       desc = get_description (descfile);
       desc.dir = fullfile (prefix, dirlist{k});
-      desc.archprefix = fullfile (archprefix, strcat (desc.name, "-",
+      desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
 				  desc.version));
       if (auto != 0)
 	if (exist (fullfile (desc.dir, "packinfo", ".autoload"), "file"))
@@ -621,10 +621,10 @@ function install (files, handle_deps, au
 	  endif
 
 	  ## Set default installation directory
-	  desc.dir = fullfile (prefix, strcat (desc.name, "-", desc.version));
+	  desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version));
 
 	  ## Set default architectire dependent installation directory
-	  desc.archprefix = fullfile (archprefix, strcat (desc.name, "-",
+	  desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
 							  desc.version));
 
 	  ## Save desc
@@ -675,7 +675,7 @@ function install (files, handle_deps, au
 	ok = false;
 	for i = 1:length (bad_deps)
 	  dep = bad_deps{i};
-	  error_text = strcat (error_text, " ", desc.name, " needs ",
+	  error_text = cstrcat (error_text, " ", desc.name, " needs ",
 			       dep.package, " ", dep.operator, " ",
 			       dep.version, "\n");
 	endfor
@@ -883,7 +883,7 @@ function uninstall (pkgnames, handle_dep
       if (! isempty (bad_deps))
 	for i = 1:length (bad_deps)
 	  dep = bad_deps{i};
-	  error_text = strcat (error_text, " ", desc.name, " needs ",
+	  error_text = cstrcat (error_text, " ", desc.name, " needs ",
 			       dep.package, " ", dep.operator, " ",
 			       dep.version, "\n");
 	endfor
@@ -1113,7 +1113,7 @@ function repackage (builddir, buildlist)
       if (exist (fullfile (pack.name, "inst", "bin"), "dir"))
 	movefile (fullfile (pack.name, "inst", "bin"), pack.name);
       endif
-      archdir = fullfile (pack.archprefix, strcat (pack.name, "-",
+      archdir = fullfile (pack.archprefix, cstrcat (pack.name, "-",
 			  pack.version), getarch ());
       if (exist (archdir, "dir"))
 	if (exist (fullfile (pack.name, "inst", "PKG_ADD"), "file"))
@@ -1140,7 +1140,7 @@ function repackage (builddir, buildlist)
 		    fullfile (pack.name, "PKG_DEL")); 
 	endif	
       endif	
-      tfile = strcat (pack.name, "-", pack.version, ".tar");
+      tfile = cstrcat (pack.name, "-", pack.version, ".tar");
       tar (tfile, pack.name);
       try 
 	gzip (tfile);
@@ -1205,18 +1205,18 @@ function configure_make (desc, packdir, 
     if (exist (fullfile (src, "configure"), "file"))
       flags = "";
       if (isempty (getenv ("CC")))
-        flags = strcat (flags, " CC=\"", octave_config_info ("CC"), "\"");
+        flags = cstrcat (flags, " CC=\"", octave_config_info ("CC"), "\"");
       endif
       if (isempty (getenv ("CXX")))
-        flags = strcat (flags, " CXX=\"", octave_config_info ("CXX"), "\"");
+        flags = cstrcat (flags, " CXX=\"", octave_config_info ("CXX"), "\"");
       endif
       if (isempty (getenv ("AR")))
-        flags = strcat (flags, " AR=\"", octave_config_info ("AR"), "\"");
+        flags = cstrcat (flags, " AR=\"", octave_config_info ("AR"), "\"");
       endif
       if (isempty (getenv ("RANLIB")))
-        flags = strcat (flags, " RANLIB=\"", octave_config_info ("RANLIB"), "\"");
+        flags = cstrcat (flags, " RANLIB=\"", octave_config_info ("RANLIB"), "\"");
       endif
-      [status, output] = shell (strcat ("cd ", src, "; ./configure --prefix=\"",
+      [status, output] = shell (cstrcat ("cd ", src, "; ./configure --prefix=\"",
                                         desc.dir, "\"", flags));
       if (status != 0)
 	rm_rf (desc.dir);
@@ -1229,7 +1229,7 @@ function configure_make (desc, packdir, 
 
     ## make
     if (exist (fullfile (src, "Makefile"), "file"))
-      [status, output] = shell (strcat ("export INSTALLDIR=\"", desc.dir,
+      [status, output] = shell (cstrcat ("export INSTALLDIR=\"", desc.dir,
 					 "\"; make -C ", src));
       if (status != 0)
 	rm_rf (desc.dir);
@@ -1276,11 +1276,11 @@ function configure_make (desc, packdir, 
 	filenames = sprintf (fullfile (src, "%s "), m.name);
       endif
       if (length (oct) > 0)
-	filenames = strcat (filenames, " ",
+	filenames = cstrcat (filenames, " ",
 			    sprintf (fullfile (src, "%s "), oct.name));
       endif
       if (length (mex) > 0)
-	filenames = strcat (filenames, " ",
+	filenames = cstrcat (filenames, " ",
 			    sprintf (fullfile (src, "%s "), mex.name));
       endif
       filenames = split_by (filenames, " ");
@@ -1340,12 +1340,12 @@ function pkg = extract_pkg (nm, pat)
       if (ln > 0)
 	t = regexp (ln, pat, "tokens");
 	if (! isempty (t))
-          pkg = strcat (pkg, "\n", t{1}{1});
+          pkg = cstrcat (pkg, "\n", t{1}{1});
 	endif
       endif
     endwhile
     if (! isempty (pkg))
-      pkg = strcat (pkg, "\n");
+      pkg = cstrcat (pkg, "\n");
     endif
     fclose (fid);
   endif
@@ -1358,7 +1358,7 @@ function create_pkgadddel (desc, packdir
   ## architecture dependent directory so that the autoload/mfilename 
   ## commands work as expected. The only part that doesn't is the
   ## part in the main directory.
-  archdir = fullfile (getarchprefix (desc), strcat (desc.name, "-",
+  archdir = fullfile (getarchprefix (desc), cstrcat (desc.name, "-",
 		      desc.version), getarch ());
   if (exist (getarchdir (desc, global_install), "dir"))
     archpkg = fullfile (getarchdir (desc, global_install), nm);
@@ -1611,7 +1611,7 @@ function desc = get_description (filenam
     elseif (isspace(line(1)))
       ## Continuation lines
       if (exist ("keyword", "var") && isfield (desc, keyword))
-	desc.(keyword) = strcat (desc.(keyword), " ", rstrip(line));
+	desc.(keyword) = cstrcat (desc.(keyword), " ", rstrip(line));
       endif
     else
       ## Keyword/value pair
@@ -1956,10 +1956,10 @@ function [out1, out2] = installed_packag
       first_char = length (cur_dir) - max_dir_length + 4;
       first_filesep = strfind (cur_dir(first_char:end), filesep());
       if (! isempty (first_filesep))
-        cur_dir = strcat ("...", 
+        cur_dir = cstrcat ("...", 
 			  cur_dir((first_char + first_filesep(1) - 1):end));
       else
-        cur_dir = strcat ("...", cur_dir(first_char:end));
+        cur_dir = cstrcat ("...", cur_dir(first_char:end));
       endif
     endif
     if (installed_pkgs_lst{idx(i)}.loaded)
@@ -2114,7 +2114,7 @@ endfunction
 endfunction
 
 function arch = getarch ()
-  persistent _arch = strcat (octave_config_info("canonical_host_type"), ...
+  persistent _arch = cstrcat (octave_config_info("canonical_host_type"), ...
 			     "-", octave_config_info("api_version"));
   arch = _arch;
 endfunction
@@ -2122,7 +2122,7 @@ function archprefix = getarchprefix (des
 function archprefix = getarchprefix (desc, global_install)
   if ((nargin == 2 && global_install) || (nargin < 2 && issuperuser ()))
     archprefix = fullfile (octave_config_info ("libexecdir"), "octave", 
-			   "packages", strcat(desc.name, "-", desc.version));
+			   "packages", cstrcat(desc.name, "-", desc.version));
   else
     archprefix = desc.dir;
   endif
@@ -2153,7 +2153,7 @@ function [status, output] = shell (cmd)
       endif
     endif
     if (have_sh)
-      [status, output] = system (strcat ("sh.exe -c \"", cmd, "\""));
+      [status, output] = system (cstrcat ("sh.exe -c \"", cmd, "\""));
     else
       error ("Can not find the command shell")
     endif
@@ -2207,13 +2207,13 @@ function load_packages_and_dependencies 
     ndir = installed_pkgs_lst{i}.dir;
     dirs{end+1} = ndir;
     if (exist (fullfile (dirs{end}, "bin"), "dir"))
-      execpath = strcat (fullfile (dirs{end}, "bin"), ":", execpath);
+      execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath);
     endif
     tmpdir = getarchdir (installed_pkgs_lst{i});
     if (exist (tmpdir, "dir"))
       dirs{end + 1} = tmpdir;
       if (exist (fullfile (dirs{end}, "bin"), "dir"))
-        execpath = strcat (fullfile (dirs{end}, "bin"), ":", execpath);
+        execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath);
       endif
     endif
   endfor
diff -r d219e712c20e -r 844ec1320722 scripts/plot/__ezplot__.m
--- a/scripts/plot/__ezplot__.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/plot/__ezplot__.m	Mon Feb 25 14:06:46 2008 -0500
@@ -20,7 +20,7 @@
 
 function [h, needusage] = __ezplot__ (pfunc, varargin)
 
-  func = strcat ("ez", pfunc);
+  func = cstrcat ("ez", pfunc);
   if (strncmp (pfunc, "contour", 7))
     iscontour = true;
   else
@@ -254,7 +254,7 @@ function [h, needusage] = __ezplot__ (pf
 		      '\./', '/'), '[\.]*\*', '');
     fstrz = regexprep (regexprep (regexprep (fstrz,'\.\^\s*','^'), 
 		      '\./', '/'), '[\.]*\*', '');
-    fstr = strcat ("[",fstrx,",",fstry,",",fstrz,"]");
+    fstr = cstrcat ("[",fstrx,",",fstry,",",fstrz,"]");
   else
     if (isplot3)
       needusage = true;
diff -r d219e712c20e -r 844ec1320722 scripts/plot/__go_draw_axes__.m
--- a/scripts/plot/__go_draw_axes__.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/plot/__go_draw_axes__.m	Mon Feb 25 14:06:46 2008 -0500
@@ -395,7 +395,7 @@ function __go_draw_axes__ (h, plot_strea
 	    titlespec{data_idx} = "title \"\"";
 	  else
 	    tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel", have_newer_gnuplot));
-	    titlespec{data_idx} = strcat ("title \"", tmp, "\"");
+	    titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
 	  endif
 	  usingclause{data_idx} = "";
 	  errbars = "";
@@ -547,7 +547,7 @@ function __go_draw_axes__ (h, plot_strea
 		 titlespec{data_idx} = "title \"\"";
 	       else
 		 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel", have_newer_gnuplot));
-		 titlespec{data_idx} = strcat ("title \"", tmp, "\"");
+		 titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
 	       endif
 	       usingclause{data_idx} = "";
                if (isfield (obj, "facecolor"))
@@ -849,7 +849,7 @@ function __go_draw_axes__ (h, plot_strea
 	      titlespec{data_idx} = "title \"\"";
 	    else
 	      tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, "keylabel", have_newer_gnuplot));
-	      titlespec{data_idx} = strcat ("title \"", tmp, "\"");
+	      titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
 	    endif
 	    usingclause{data_idx} = "";
 	    if (have_newer_gnuplot || isnan (typ))
@@ -1474,7 +1474,7 @@ function __gnuplot_write_data__ (plot_st
 
   if (nd == 2)
     nan_elts = find (sum (isnan (data)));
-    fmt = strcat (repmat ("%.15g ", 1, rows (data)), "\n");
+    fmt = cstrcat (repmat ("%.15g ", 1, rows (data)), "\n");
     if (isempty (nan_elts))
       fprintf (plot_stream, fmt, data);
     else
@@ -1654,17 +1654,17 @@ function [f, s, fnt, it, bld] = get_font
     if (! isempty(t.fontangle)
 	&& (strcmpi (t.fontangle, "italic")
 	    || strcmpi (t.fontangle, "oblique")))
-      f = strcat (f, "-bolditalic");
+      f = cstrcat (f, "-bolditalic");
       it = true;
       bld = true;
     else
-      f = strcat (f, "-bold");
+      f = cstrcat (f, "-bold");
       bld = true;
     endif
   elseif (! isempty(t.fontangle)
 	  && (strcmpi (t.fontangle, "italic")
 	      || strcmpi (t.fontangle, "oblique")))
-    f = strcat (f, "-italic");
+    f = cstrcat (f, "-italic");
     it = true;
   endif
   if (isempty (t.fontsize))
@@ -1694,7 +1694,7 @@ function [str, f, s] = __maybe_munge_tex
       str = __tex2enhanced__ (str, fnt, it, bld);
       if (! have_newer_gnuplot)
 	## Set the font to work around gnuplot 4.0 X11 enhanced terminal bug
-	str = strcat ('{/', f, ' ', str, ' }'); 
+	str = cstrcat ('{/', f, ' ', str, ' }'); 
       endif
     elseif (strcmp (obj.interpreter, "latex"))
       if (! warned_latex)
@@ -1714,7 +1714,7 @@ function str = __tex2enhanced__ (str, fn
   for i = length (s) : -1 : 1
     ## special case for "\0"  and replace with "{/Symbol \306}'
     if (strncmp (m{i}, '\0', 2))
-      str = strcat (str(1:s(i) - 1), '{/Symbol \306}', str(s(i) + 2:end));
+      str = cstrcat (str(1:s(i) - 1), '{/Symbol \306}', str(s(i) + 2:end));
     else
       f = m{i}(2:end);
       if (isfield (sym, f))
@@ -1729,27 +1729,27 @@ function str = __tex2enhanced__ (str, fn
 	##elseif (it)
 	##  g = regexprep (g, '/Symbol', '/Symbol-italic');
 	##endif
-        str = strcat (str(1:s(i) - 1), g, str(e(i) + 1:end));
+        str = cstrcat (str(1:s(i) - 1), g, str(e(i) + 1:end));
       elseif (strncmp (f, "rm", 2))
 	bld = false;
 	it = false;
-        str = strcat (str(1:s(i) - 1), '/', fnt, ' ', str(s(i) + 3:end));
+        str = cstrcat (str(1:s(i) - 1), '/', fnt, ' ', str(s(i) + 3:end));
       elseif (strncmp (f, "it", 2) || strncmp (f, "sl", 2))
 	it = true;
 	if (bld)
-          str = strcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', 
+          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', 
 			str(s(i) + 3:end));
         else
-          str = strcat (str(1:s(i) - 1), '/', fnt, '-italic ', 
+          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', 
 			str(s(i) + 3:end));
         endif
       elseif (strncmp (f, "bf", 2))
 	bld = true;
 	if (it)
-          str = strcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', 
+          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', 
 			str(2(i) + 3:end));
         else
-          str = strcat (str(1:s(i) - 1), '/', fnt, '-bold ', 
+          str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', 
 			str(s(i) + 3:end));
         endif
       elseif (strcmp (f, "color"))
@@ -1758,7 +1758,7 @@ function str = __tex2enhanced__ (str, fn
         if (isempty (d))
 	  warning ('syntax error in \color argument');
 	else
-	  str = strcat (str(1:s(i) - 1), str(e(i) + d + 1:end));
+	  str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end));
         endif
       elseif(strcmp (f, "fontname"))
 	b1 = strfind(str(e(i) + 1:end),'{');
@@ -1766,7 +1766,7 @@ function str = __tex2enhanced__ (str, fn
         if (isempty(b1) || isempty(b2))
 	  warning ('syntax error in \fontname argument');
 	else
-          str = strcat (str(1:s(i) - 1), '/', 
+          str = cstrcat (str(1:s(i) - 1), '/', 
 			str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}',
 			str(e(i) + b2(1) + 1:end));
         endif
@@ -1776,7 +1776,7 @@ function str = __tex2enhanced__ (str, fn
         if (isempty(b1) || isempty(b2))
 	  warning ('syntax error in \fontname argument');
 	else
-          str = strcat (str(1:s(i) - 1), '/=', 
+          str = cstrcat (str(1:s(i) - 1), '/=', 
 			str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}',
 			str(e(i) + b2(1) + 1:end));
         endif
@@ -1796,7 +1796,7 @@ function str = __tex2enhanced__ (str, fn
 	    ##elseif (it)
 	    ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
 	    ##endif
-            str = strcat (str(1:s(i) - 1), g, 
+            str = cstrcat (str(1:s(i) - 1), g, 
 	    		  str(s(i) + length (flds{j}) + 1:end));
 	    break;
 	  endif
@@ -1854,15 +1854,15 @@ function str = __tex2enhanced__ (str, fn
 	    if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
 		length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1)))
 	      ## shortest already first!
-	      str = strcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
+	      str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
 	    else
 	      ## Have to swap sub/super-script to get shortest first
-	      str = strcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2),
+	      str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2),
 			    str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end));
 	    endif
 	  else
 	    ## Have to swap sub/super-script to get shortest first
-	    str = strcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1),
+	    str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1),
 			  str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end));
 	  endif
           i += 2;
@@ -1873,7 +1873,7 @@ function str = __tex2enhanced__ (str, fn
       else
 	if (s(i+1) == s(i) + 2)
 	  ## shortest already first!
-	  str = strcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
+	  str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
 	  p ++;
           i += 2;
 	else
diff -r d219e712c20e -r 844ec1320722 scripts/plot/legend.m
--- a/scripts/plot/legend.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/plot/legend.m	Mon Feb 25 14:06:46 2008 -0500
@@ -210,7 +210,7 @@ endfunction
 %! labels = {};
 %! for i = 1:5
 %!     plot(1:100, i + rand(100,1)); hold on;
-%!     labels = {labels{:}, strcat("Signal ", num2str(i))};
+%!     labels = {labels{:}, cstrcat("Signal ", num2str(i))};
 %! endfor; hold off;
 %! title("Signals with random offset and uniform noise")
 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]");
diff -r d219e712c20e -r 844ec1320722 scripts/plot/print.m
--- a/scripts/plot/print.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/plot/print.m	Mon Feb 25 14:06:46 2008 -0500
@@ -187,9 +187,9 @@ function print (varargin)
   doprint = isempty (name);
   if (doprint)
     if (isempty (devopt))
-      printname = strcat (tmpnam, ".ps");
+      printname = cstrcat (tmpnam, ".ps");
     else
-      printname = strcat (tmpnam, ".", devopt);
+      printname = cstrcat (tmpnam, ".", devopt);
     endif
     name = printname;
   endif
@@ -209,7 +209,7 @@ function print (varargin)
     dev = "epslatex";
     ## gnuplot 4.0 wants ".eps" in the output name    
     if (compare_versions (__gnuplot_version__, "4.2", "<"))
-      name = strcat (name(1:dot), "eps");
+      name = cstrcat (name(1:dot), "eps");
     endif
   elseif (strcmp (dev, "ill"))
     dev = "aifm";
@@ -226,12 +226,12 @@ function print (varargin)
   [idx, errmsg] = cellidx (dev_list, dev);
   if (! idx)
     if (! isempty (devopt))
-      convertname = strcat (devopt, ":", name);
+      convertname = cstrcat (devopt, ":", name);
     else
       convertname = name;
     endif
     dev = "epsc";
-    name = strcat (tmpnam, ".eps");
+    name = cstrcat (tmpnam, ".eps");
   endif
 
   if (strcmp (dev, "ps") || strcmp (dev, "ps2") ...
@@ -257,33 +257,33 @@ function print (varargin)
       if (dev(1) == "e")
 	options = "eps ";
       else
-	options = strcat (orientation, " ");
+	options = cstrcat (orientation, " ");
       endif
       termn = "postscript";
     endif
     
     if (any (dev == "c") || use_color > 0)
       if (force_solid < 0)
-	options = strcat (options, "color dashed ");
+	options = cstrcat (options, "color dashed ");
       else
-	options = strcat (options, "color solid ");
+	options = cstrcat (options, "color solid ");
       endif
     else
       if (force_solid > 0)
-	options = strcat (options, "mono solid ");
+	options = cstrcat (options, "mono solid ");
       else
-	options = strcat (options, "mono dashed ");
+	options = cstrcat (options, "mono dashed ");
       endif
     endif
 
     if (! isempty (font))
-      options = strcat (options, "\"", font, "\" ");
+      options = cstrcat (options, "\"", font, "\" ");
     endif
     if (! isempty (fontsize))
-      options = strcat (options, " ", fontsize);
+      options = cstrcat (options, " ", fontsize);
     endif
     
-    new_terminal = strcat (termn, " ", options);
+    new_terminal = cstrcat (termn, " ", options);
     
   elseif (strcmp (dev, "aifm") || strcmp (dev, "corel"))
     ## Adobe Illustrator, CorelDraw
@@ -293,13 +293,13 @@ function print (varargin)
       options = " mono";
     endif
     if (! isempty (font))
-      options = strcat (options, " \"", font, "\"");
+      options = cstrcat (options, " \"", font, "\"");
     endif
     if (! isempty (fontsize))
-      options = strcat (options, " ", fontsize);
+      options = cstrcat (options, " ", fontsize);
     endif
 
-    new_terminal = strcat (dev, " ", options);
+    new_terminal = cstrcat (dev, " ", options);
 
   elseif (strcmp (dev, "fig"))
     ## XFig
@@ -309,12 +309,12 @@ function print (varargin)
     else
       options = " mono";
     endif
-    options = strcat (options, " ", special_flag);
+    options = cstrcat (options, " ", special_flag);
     if (! isempty (fontsize))
-      options = strcat (options, " fontsize ", fontsize);
+      options = cstrcat (options, " fontsize ", fontsize);
     endif
 
-    new_terminal = strcat ("fig ", options);
+    new_terminal = cstrcat ("fig ", options);
 
 
   elseif (strcmp (dev, "emf"))
@@ -326,16 +326,16 @@ function print (varargin)
       options = " mono";
     endif
     if (force_solid >= 0)
-      options = strcat (options, " solid");
+      options = cstrcat (options, " solid");
     endif
     if (! isempty (font))
-      options = strcat (options, " \"", font, "\"");
+      options = cstrcat (options, " \"", font, "\"");
     endif
     if (! isempty (fontsize))
-      options = strcat (options, " ", fontsize);
+      options = cstrcat (options, " ", fontsize);
     endif
 
-    new_terminal = strcat ("emf ", options);
+    new_terminal = cstrcat ("emf ", options);
 
   elseif (strcmp (dev, "png") || strcmp (dev, "pbm"))
     ## Portable network graphics, PBMplus
@@ -356,9 +356,9 @@ function print (varargin)
     if (isempty (size))
       options = " large";
     else
-      options = strcat (" size ", size);
+      options = cstrcat (" size ", size);
     endif
-    new_terminal = strcat (dev, options);
+    new_terminal = cstrcat (dev, options);
 
   elseif (strcmp (dev, "dxf") || strcmp (dev, "mf") || strcmp (dev, "hpgl"))
     ## AutoCad DXF, METAFONT, HPGL
@@ -368,9 +368,9 @@ function print (varargin)
     ## SVG
     options = "";
     if (! isempty (size))
-      options = strcat (" size ", size);
+      options = cstrcat (" size ", size);
     endif
-    new_terminal = strcat ("svg", options);
+    new_terminal = cstrcat ("svg", options);
     
   elseif (strcmp (dev, "pdf"))
     ## Portable Document format
@@ -381,18 +381,18 @@ function print (varargin)
       options = "mono";
     endif
     if (force_solid > 0)
-       options = strcat (options, " solid");
+       options = cstrcat (options, " solid");
     elseif (force_solid < 0)
-      options = strcat (options, " dashed");
+      options = cstrcat (options, " dashed");
     endif
     if (! isempty (font))
-      options = strcat (options, "\"", font, "\" ");
+      options = cstrcat (options, "\"", font, "\" ");
     endif
     if (! isempty (fontsize))
-      options = strcat (options, " ", fontsize);
+      options = cstrcat (options, " ", fontsize);
     endif
 
-    new_terminal = strcat ("pdf ", options);
+    new_terminal = cstrcat ("pdf ", options);
 
   endif
 
diff -r d219e712c20e -r 844ec1320722 scripts/signal/spectral_adf.m
--- a/scripts/signal/spectral_adf.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/signal/spectral_adf.m	Mon Feb 25 14:06:46 2008 -0500
@@ -48,7 +48,7 @@ function retval = spectral_adf (c, win, 
   if (nargin == 1)
     w = triangle_lw (cr, b);
   else
-    win = str2func (strcat (win, "_lw"));
+    win = str2func (cstrcat (win, "_lw"));
     w = feval (win, cr, b);
   endif
 
diff -r d219e712c20e -r 844ec1320722 scripts/signal/spectral_xdf.m
--- a/scripts/signal/spectral_xdf.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/signal/spectral_xdf.m	Mon Feb 25 14:06:46 2008 -0500
@@ -47,7 +47,7 @@ function retval = spectral_xdf (X, win, 
   if (nargin == 1)
     w = triangle_sw (xr, b);
   else
-    win = str2func (strcat (win, "_sw"));
+    win = str2func (cstrcat (win, "_sw"));
     w = feval (win, xr, b);
   endif
 
diff -r d219e712c20e -r 844ec1320722 scripts/statistics/tests/z_test.m
--- a/scripts/statistics/tests/z_test.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/statistics/tests/z_test.m	Mon Feb 25 14:06:46 2008 -0500
@@ -79,7 +79,7 @@ function [pval, z] = z_test (x, m, v, al
   endif
 
   if (nargout == 0)
-    s = strcat ("Z-test of mean(x) == %g against mean(x) %s %g,\n",
+    s = cstrcat ("Z-test of mean(x) == %g against mean(x) %s %g,\n",
                 "with known var(x) == %g:\n",
                 "  pval = %g\n");
     printf (s, m, alt, m, v, pval);
diff -r d219e712c20e -r 844ec1320722 scripts/statistics/tests/z_test_2.m
--- a/scripts/statistics/tests/z_test_2.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/statistics/tests/z_test_2.m	Mon Feb 25 14:06:46 2008 -0500
@@ -79,7 +79,7 @@ function [pval, z] = z_test_2 (x, y, v_x
   endif
 
   if (nargout == 0)
-    s = strcat ("Two-sample Z-test of mean(x) == mean(y) against ",
+    s = cstrcat ("Two-sample Z-test of mean(x) == mean(y) against ",
                 "mean(x) %s mean(y),\n",
                 "with known var(x) == %g and var(y) == %g:\n",
                 "  pval = %g\n");
diff -r d219e712c20e -r 844ec1320722 scripts/strings/Makefile.in
--- a/scripts/strings/Makefile.in	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/strings/Makefile.in	Mon Feb 25 14:06:46 2008 -0500
@@ -36,7 +36,7 @@ SOURCES = base2dec.m bin2dec.m blanks.m 
 SOURCES = base2dec.m bin2dec.m blanks.m deblank.m dec2base.m \
   dec2bin.m dec2hex.m findstr.m hex2dec.m index.m isletter.m \
   lower.m mat2str.m rindex.m split.m str2double.m str2mat.m \
-  str2num.m strcat.m strcmpi.m strfind.m strjust.m strmatch.m \
+  str2num.m strcat.m cstrcat.m strcmpi.m strfind.m strjust.m strmatch.m \
   strncmpi.m strrep.m strtok.m strtrim.m strtrunc.m strvcat.m \
   substr.m upper.m
 
diff -r d219e712c20e -r 844ec1320722 scripts/strings/cstrcat.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/strings/cstrcat.m	Mon Feb 25 14:06:46 2008 -0500
@@ -0,0 +1,85 @@
+## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003,
+##               2005, 2006, 2007 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave 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.
+##
+## Octave 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 Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} cstrcat (@var{s1}, @var{s2}, @dots{})
+## Return a string containing all the arguments concatenated.  For example,
+##
+## @example
+## @group
+## s = [ "ab"; "cde" ];
+## cstrcat (s, s, s)
+##      @result{} "ab ab ab "
+##         "cdecdecde"
+## @end group
+## @end example
+## @end deftypefn
+
+## Author: jwe
+
+function st = cstrcat (varargin)
+
+  if (nargin > 0)
+
+    if (iscellstr (varargin))
+      ## All arguments are character strings.
+      unwind_protect
+	tmp = warning ("query", "Octave:empty-list-elements");
+	warning ("off", "Octave:empty-list-elements");
+	st = [varargin{:}];
+      unwind_protect_cleanup
+	warning (tmp.state, "Octave:empty-list-elements");
+      end_unwind_protect
+    else
+      for i = 1:nargin
+	tmp = varargin{i};
+	if (! (iscellstr (tmp) || ischar (tmp)))
+	  error ("cstrcat: all arguments must be strings or cell arrays of strings");
+	endif
+      endfor
+      st = cstrcat_cell (varargin);
+    endif
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+function st = cstrcat_cell (varargin)
+  ## All args must be same size or scalars.
+  ## See the xtest below for expected behavior.
+  error ("cstrcat: concatenating cell arrays of strings not implemented");
+endfunction
+
+## test the dimensionality
+## 1d
+%!assert(cstrcat("ab ", "ab "), "ab ab ")
+## 2d
+%!assert(cstrcat(["ab ";"cde"], ["ab ";"cde"]), ["ab ab ";"cdecde"])
+
+%!assert((strcmp (cstrcat ("foo", "bar"), "foobar")
+%! && strcmp (cstrcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"])));
+
+%!xtest
+%! assert(all (strcmp (cstrcat ("a", {"bc", "de"}, "f"), {"abcf", "adef"})))
+
+%!error cstrcat ();
+
+%!error cstrcat (1, 2);
+
diff -r d219e712c20e -r 844ec1320722 scripts/strings/strcat.m
--- a/scripts/strings/strcat.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/strings/strcat.m	Mon Feb 25 14:06:46 2008 -0500
@@ -33,51 +33,106 @@
 
 ## Author: jwe
 
+## Prior version worked differently.
+##
+##   strcat("foo ","bar")
+##   ans = "foo bar"
+##
+## Present version
+##
+##   strcat("foo ","bar")
+##   ans = "foobar"
+##
+## Proposed work around
+##
+##   strcat({"foo "},{"bar"}){1}
+##   ans = "foo bar"
+
 function st = strcat (varargin)
 
   if (nargin > 0)
 
-    if (iscellstr (varargin))
-      ## All arguments are character strings.
-      unwind_protect
-	tmp = warning ("query", "Octave:empty-list-elements");
-	warning ("off", "Octave:empty-list-elements");
-	st = [varargin{:}];
-      unwind_protect_cleanup
-	warning (tmp.state, "Octave:empty-list-elements");
-      end_unwind_protect
-    else
-      for i = 1:nargin
-	tmp = varargin{i};
-	if (! (iscellstr (tmp) || ischar (tmp)))
-	  error ("strcat: all arguments must be strings or cell arrays of strings");
-	endif
+    if (nargin == 1)
+
+      st = varargin{1};
+
+    elseif (nargin > 1)
+
+      ## Convert to cells of strings
+      numstrs(nargin) = 0;
+      dims{nargin} = [];
+      allchar = true;
+      for nv = 1:nargin
+        if (ischar(varargin{nv}))
+          varargin{nv} = cellstr(varargin{nv});
+        elseif iscell(varargin{nv})
+          allchar = false;
+        else
+          error ("strcat: inputs must be strings or cells of strings.")
+        endif
+        dims{nv} = size (varargin{nv});
+        numstrs(nv) = numel (varargin{nv});
       endfor
-      st = strcat_cell (varargin);
+
+      ## Set all cells to a common size
+      n = find (numstrs == max (numstrs), 1);
+      maxstrs = numstrs (n);
+      dim = dims{n};
+      for nv = find (numstrs == 1)
+        str = varargin{nv}{1};
+        varargin{nv} = cell (dim);
+        varargin{nv}{:} = str;
+      endfor
+
+      ## Concatenate the strings
+      st = varargin{1};
+      for ns = 1:maxstrs
+        for nv = 2:nargin
+          if (size_equal (st, varargin{nv}))
+            st{ns} = [st{ns}, varargin{nv}{ns}];
+          else
+            error ("strcat: arguments must be the same size, or be scalars.");
+          endif
+        endfor
+      endfor
+
+      if (allchar)
+        ## If all inputs were strings, return strings.
+        st = char (st);
+      endif
+
     endif
+
   else
+
     print_usage ();
+
   endif
 
 endfunction
 
-function st = strcat_cell (varargin)
-  ## All args must be same size or scalars.
-  ## See the xtest below for expected behavior.
-  error ("strcat: concatenating cell arrays of strings not implemented");
-endfunction
-
 ## test the dimensionality
 ## 1d
-%!assert(strcat("ab ", "ab "), "ab ab ")
+%!assert(strcat("ab ", "ab "), "abab")
+%!assert(strcat({"ab "}, "ab "), {"ab ab"})
+%!assert(strcat("ab ", {"ab "}), {"abab "})
+%!assert(strcat({"ab "}, {"ab "}), {"ab ab "})
 ## 2d
-%!assert(strcat(["ab ";"cde"], ["ab ";"cde"]), ["ab ab ";"cdecde"])
+%!assert(strcat(["ab ";"cde"], ["ab ";"cde"]), ["abab  ";"cdecde"])
 
-%!assert((strcmp (strcat ("foo", "bar"), "foobar")
-%! && strcmp (strcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"])));
+## test for deblanking implied trailing spaces of character input
+%!assert((strcmp (strcat ("foo", "bar"), "foobar") &&
+%!        strcmp (strcat (["a"; "bb"], ["foo"; "bar"]), ["afoo "; "bbbar"])));
 
-%!xtest
-%! assert(all (strcmp (strcat ("a", {"bc", "de"}, "f"), {"abcf", "adef"})))
+## test for mixing character and cell inputs
+%!assert(all (strcmp (strcat ("a", {"bc", "de"}, "f"), {"abcf", "adef"})))
+
+## test for scalar strings with vector strings
+%!assert(all (strcmp (strcat (["a"; "b"], "c"), ["ac"; "bc"])))
+
+## test with cells with strings of differing lengths
+%!assert(all (strcmp (strcat ({"a", "bb"}, "ccc"), {"accc", "bbccc"})))
+%!assert(all (strcmp (strcat ("a", {"bb", "ccc"}), {"abb", "accc"})))
 
 %!error strcat ();
 
diff -r d219e712c20e -r 844ec1320722 scripts/strings/strvcat.m
--- a/scripts/strings/strvcat.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/strings/strvcat.m	Mon Feb 25 14:06:46 2008 -0500
@@ -22,7 +22,7 @@
 ## @var{s_1}, @dots{}, @var{s_n} as
 ## its rows.  Each string is padded with blanks in order to form a valid
 ## matrix.  Unlike @var{str2mat}, empty strings are ignored.
-## @seealso{strcat, str2mat}
+## @seealso{cstrcat, str2mat}
 ## @end deftypefn
 
 ## Author: Kurt Hornik <Kurt.Hornik at ci.tuwien.ac.at>
diff -r d219e712c20e -r 844ec1320722 scripts/testfun/assert.m
--- a/scripts/testfun/assert.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/testfun/assert.m	Mon Feb 25 14:06:46 2008 -0500
@@ -66,9 +66,9 @@ function assert (cond, expected, tol)
 
   in = deblank (argn(1,:));
   for i = 2:rows (argn)
-    in = strcat (in, ",", deblank (argn(i,:)));
+    in = cstrcat (in, ",", deblank (argn(i,:)));
   endfor
-  in = strcat ("(", in, ")");
+  in = cstrcat ("(", in, ")");
 
   coda = "";
   iserror = 0;
@@ -140,7 +140,7 @@ function assert (cond, expected, tol)
 
   elseif (tol == 0 && ! strcmp (typeinfo (cond), typeinfo (expected)))
     iserror = 1;
-    coda = strcat ("Type ", typeinfo (cond), " != ", typeinfo (expected));
+    coda = cstrcat ("Type ", typeinfo (cond), " != ", typeinfo (expected));
 
   else # numeric
     A = cond(:);
@@ -198,9 +198,9 @@ function assert (cond, expected, tol)
   if (! isempty (idx))
     str2 = str2 (idx(1):idx(end));
   endif
-  msg = strcat ("assert ", in, " expected\n", str, "\nbut got\n", str2);
+  msg = cstrcat ("assert ", in, " expected\n", str, "\nbut got\n", str2);
   if (! isempty (coda))
-    msg = strcat (msg, "\n", coda);
+    msg = cstrcat (msg, "\n", coda);
   endif
   error ("%s", msg);
   ## disp (msg);
diff -r d219e712c20e -r 844ec1320722 scripts/testfun/demo.m
--- a/scripts/testfun/demo.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/testfun/demo.m	Mon Feb 25 14:06:46 2008 -0500
@@ -111,7 +111,7 @@ function demo (name, n)
     try
       block = code(idx(doidx(i)):idx(doidx(i)+1)-1);
       ## Use an environment without variables
-      eval (strcat ("function __demo__()\n", block, "\nendfunction"));
+      eval (cstrcat ("function __demo__()\n", block, "\nendfunction"));
       ## Display the code that will be executed before executing it
       printf ("%s example %d:%s\n\n", name, doidx(i), block);
       __demo__;
diff -r d219e712c20e -r 844ec1320722 scripts/testfun/speed.m
--- a/scripts/testfun/speed.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/testfun/speed.m	Mon Feb 25 14:06:46 2008 -0500
@@ -187,38 +187,38 @@ function [__order, __test_n, __tnew, __t
 
   __torig = __tnew = zeros (size (__test_n));
 
-  disp (strcat ("testing ", __f1, "\ninit: ", __init));
+  disp (cstrcat ("testing ", __f1, "\ninit: ", __init));
 
   ## make sure the functions are freshly loaded by evaluating them at
   ## test_n(1); first have to initialize the args though.
   n = 1;
   k = 0;
-  eval (strcat (__init, ";"));
+  eval (cstrcat (__init, ";"));
   if (! isempty (__f2))
-    eval (strcat (__f2, ";"));
+    eval (cstrcat (__f2, ";"));
   endif
-  eval (strcat (__f1, ";"));
+  eval (cstrcat (__f1, ";"));
 
   ## run the tests
   for k = 1:length (__test_n)
     n = __test_n(k);
-    eval (strcat (__init, ";"));
+    eval (cstrcat (__init, ";"));
     
     printf ("n%i=%i  ",k, n);
     fflush (stdout);
-    eval (strcat ("__t=time();", __f1, "; __v1=ans; __t = time()-__t;"));
+    eval (cstrcat ("__t=time();", __f1, "; __v1=ans; __t = time()-__t;"));
     if (__t < 0.25)
-      eval (strcat ("__t2=time();", __f1, "; __t2 = time()-__t2;"));
-      eval (strcat ("__t3=time();", __f1, "; __t3 = time()-__t3;"));
+      eval (cstrcat ("__t2=time();", __f1, "; __t2 = time()-__t2;"));
+      eval (cstrcat ("__t3=time();", __f1, "; __t3 = time()-__t3;"));
       __t = min ([__t, __t2, __t3]);
     endif
     __tnew(k) = __t;
 
     if (! isempty (__f2))
-      eval (strcat ("__t=time();", __f2, "; __v2=ans; __t = time()-__t;"));
+      eval (cstrcat ("__t=time();", __f2, "; __v2=ans; __t = time()-__t;"));
       if (__t < 0.25)
-      	eval (strcat ("__t2=time();", __f2, "; __t2 = time()-__t2;"));
-      	eval (strcat ("__t3=time();", __f2, "; __t3 = time()-__t3;"));
+      	eval (cstrcat ("__t2=time();", __f2, "; __t2 = time()-__t2;"));
+      	eval (cstrcat ("__t3=time();", __f2, "; __t3 = time()-__t3;"));
       endif
       __torig(k) = __t;
       if (! isinf(__tol))
@@ -257,10 +257,10 @@ function [__order, __test_n, __tnew, __t
   if (doplot && ! isempty (__f2))
     subplot (1, 2, 1);
     semilogx (__test_n, __torig./__tnew, 
-	      strcat ("-*r;", strrep (__f1, ";", "."), "/",
+	      cstrcat ("-*r;", strrep (__f1, ";", "."), "/",
 		      strrep (__f2, ";", "."), ";"),
 	       __test_n, __tnew./__torig,
-	      strcat ("-*g;", strrep (__f2, ";", "."), "/",
+	      cstrcat ("-*g;", strrep (__f2, ";", "."), "/",
 		      strrep (__f1, ";", "."), ";"));
     xlabel ("test length");
     title (__f1);
@@ -268,13 +268,13 @@ function [__order, __test_n, __tnew, __t
 
     subplot (1, 2, 2);
     loglog (__test_n, __tnew*1000,
-	    strcat ("*-g;", strrep (__f1, ";", "."), ";" ), 
+	    cstrcat ("*-g;", strrep (__f1, ";", "."), ";" ), 
 	    __test_n, __torig*1000,
-	    strcat ("*-r;", strrep (__f2,";","."), ";"));
+	    cstrcat ("*-r;", strrep (__f2,";","."), ";"));
   
     xlabel ("test length");
     ylabel ("best execution time (ms)");
-    title (strcat ("init: ", __init));
+    title (cstrcat ("init: ", __init));
 
     ratio = mean (__torig ./ __tnew);
     printf ("\n\nMean runtime ratio = %.3g for '%s' vs '%s'\n",
@@ -285,7 +285,7 @@ function [__order, __test_n, __tnew, __t
     loglog (__test_n, __tnew*1000, "*-g;execution time;");
     xlabel ("test length");
     ylabel ("best execution time (ms)");
-    title (strcat (__f1, "  init: ", __init));
+    title (cstrcat (__f1, "  init: ", __init));
 
   endif
 
diff -r d219e712c20e -r 844ec1320722 scripts/testfun/test.m
--- a/scripts/testfun/test.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/scripts/testfun/test.m	Mon Feb 25 14:06:46 2008 -0500
@@ -157,10 +157,10 @@ function [__ret1, __ret2, __ret3, __ret4
   ## locate the file to test
   __file = file_in_loadpath (__name, "all");
   if (isempty (__file))
-    __file = file_in_loadpath (strcat (__name, ".m"), "all");
+    __file = file_in_loadpath (cstrcat (__name, ".m"), "all");
   endif
   if (isempty (__file))
-    __file = file_in_loadpath (strcat (__name, ".cc"), "all");
+    __file = file_in_loadpath (cstrcat (__name, ".cc"), "all");
   endif
   if (iscell (__file))
       ## If repeats, return first in path.
@@ -220,7 +220,7 @@ function [__ret1, __ret2, __ret3, __ret4
 
   ## ready to start tests ... if in batch mode, tell us what is happening
   if (__verbose)
-    disp (strcat ( __signal_file, __file));
+    disp (cstrcat ( __signal_file, __file));
   endif
 
   ## assume all tests will pass
@@ -270,7 +270,7 @@ function [__ret1, __ret2, __ret3, __ret4
 	  __demo_code = __code;
 	  __demo_idx = [1, length(__demo_code)+1];
 	else
-	  __demo_code = strcat(__demo_code, __code);
+	  __demo_code = cstrcat(__demo_code, __code);
 	  __demo_idx = [__demo_idx, length(__demo_code)+1];
 	endif
 
@@ -313,9 +313,9 @@ function [__ret1, __ret2, __ret3, __ret4
       try
 	__vars = deblank (__vars);
 	if (! isempty (__vars))
-	  eval (strcat (strrep (__vars, ",", "=[];"), "=[];"));
+	  eval (cstrcat (strrep (__vars, ",", "=[];"), "=[];"));
 	  __shared = __vars;
-	  __shared_r = strcat ("[ ", __vars, "] = ");
+	  __shared_r = cstrcat ("[ ", __vars, "] = ");
       	else
 	  __shared = " ";
 	  __shared_r = " ";
@@ -574,7 +574,7 @@ endfunction
 
 ## strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks
 function msg = trimerr (msg, prefix)
-  idx = index (msg, strcat (prefix, ":"));
+  idx = index (msg, cstrcat (prefix, ":"));
   if (idx > 0)
     msg(1:idx+length(prefix)) = [];
   endif
@@ -607,7 +607,7 @@ function body = __extract_test_code (nm)
       if (length (ln) >= 2 && strcmp (ln(1:2), "%!"))
         body = [body, "\n"];
         if (length(ln) > 2)
-          body = strcat (body, ln(3:end));
+          body = cstrcat (body, ln(3:end));
         endif
       endif
     endwhile
diff -r d219e712c20e -r 844ec1320722 test/ChangeLog
--- a/test/ChangeLog	Mon Feb 25 04:59:17 2008 -0500
+++ b/test/ChangeLog	Mon Feb 25 14:06:46 2008 -0500
@@ -1,3 +1,9 @@ 2008-02-22  David Bateman  <dbateman at fre
+2008-02-25  Ben Abbott <bpabbott at mac.com>
+
+	* Various files modified to call cstrcat which rather than strcat
+	  which has been modified to respect Matlab compatibility. The 
+	  modified files include: test/test_eval-catch.m, test/test_io.m,
+	  & test/test_try.m.
 2008-02-22  David Bateman  <dbateman at free.fr>
 
 	* build_sparse_tests.sh: Replaced removed sparse functions like
diff -r d219e712c20e -r 844ec1320722 test/test_eval-catch.m
--- a/test/test_eval-catch.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/test/test_eval-catch.m	Mon Feb 25 14:06:46 2008 -0500
@@ -49,7 +49,7 @@
 %% test/octave.test/eval-catch/eval-catch-7.m
 %!function ms = mangle (s)
 %!  ## Wrap angle brackets around S.
-%!  ms = strcat ("<", s, ">");
+%!  ms = cstrcat ("<", s, ">");
 %!test
 %! eval ("clear a; a; str='';", "str = mangle (lasterr);");
 %! assert(mangle(lasterr)(1:21),"<error: `a' undefined");
@@ -71,6 +71,6 @@
 
 %% test/octave.test/eval-catch/eval-catch-10.m
 %!test
-%! eval ("eval (\"clear a; a; str='';\",\"error (strcat (\\\"rethrow: \\\", lasterr));str='';\");",
+%! eval ("eval (\"clear a; a; str='';\",\"error (cstrcat (\\\"rethrow: \\\", lasterr));str='';\");",
 %! "str=lasterr;");
 %! assert(str(1:36),"error: rethrow: error: `a' undefined");
diff -r d219e712c20e -r 844ec1320722 test/test_io.m
--- a/test/test_io.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/test/test_io.m	Mon Feb 25 14:06:46 2008 -0500
@@ -284,7 +284,7 @@
 %!       else
 %!         fclose (id);
 %!       endif
-%!       tmp_mode = strcat (mode, "b");
+%!       tmp_mode = cstrcat (mode, "b");
 %!       [id, err] = fopen (nm, tmp_mode, arch);
 %!       if (id < 0)
 %!         printf_assert ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
@@ -293,7 +293,7 @@
 %!       else
 %!         fclose (id);
 %!       endif
-%!       tmp_mode = strcat (mode, "t");
+%!       tmp_mode = cstrcat (mode, "t");
 %!       [id, err] = fopen (nm, tmp_mode, arch);
 %!       if (id < 0)
 %!         printf_assert ("open failed: %s (%s, %s): %s\n", nm, tmp_mode, arch, err);
diff -r d219e712c20e -r 844ec1320722 test/test_try.m
--- a/test/test_try.m	Mon Feb 25 04:59:17 2008 -0500
+++ b/test/test_try.m	Mon Feb 25 14:06:46 2008 -0500
@@ -80,7 +80,7 @@
 %% test/octave.test/try/try-7.m
 %!function ms = mangle (s)
 %!  ## Wrap angle brackets around S.
-%!  ms = strcat ("<", s, ">");
+%!  ms = cstrcat ("<", s, ">");
 %!test
 %! try
 %!   clear a
@@ -133,7 +133,7 @@
 %!     a;
 %!     error("Shoudn't get here");
 %!   catch
-%!     error(strcat("rethrow: ",lasterr));
+%!     error(cstrcat("rethrow: ",lasterr));
 %!   end_try_catch
 %! catch
 %!   assert(strcmp(lasterr()(1:36), "error: rethrow: error: `a' undefined"))


More information about the Bug-octave mailing list