# HG changeset patch # User Jaroslav Hajek # Date 1277448446 -7200 # Node ID d1b09c44d797cfd267fe3669d336fe19747abbf6 # Parent 717ba2c3eef1d1a2fab49024d2bb51d6d52bf308# Parent 9d95d8ab7c3accbe538411228e8786bf0864c5c9 merge with main repo diff --git a/liboctave/CMatrix.cc b/liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2665,10 +2665,6 @@ ps, rcon, rank, work.fortran_vec (), lwork, prwork, piwork, info)); - std::cerr << "work(0): " << work(0) << std::endl; - std::cerr << "rwork(0): " << rwork(0) << std::endl; - std::cerr << "iwork(0): " << iwork(0) << std::endl; - // The workspace query is broken in at least LAPACK 3.0.0 // through 3.1.1 when n >= mnthr. The obtuse formula below // should provide sufficient workspace for ZGELSD to operate @@ -2702,10 +2698,6 @@ lwork = static_cast (std::real (work(0))); work.resize (lwork, 1); - std::cerr << "work numel: " << work.numel () << std::endl; - std::cerr << "rwork numel: " << rwork.numel () << std::endl; - std::cerr << "iwork numel: " << iwork.numel () << std::endl; - F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, work.fortran_vec (), lwork, diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2010-06-24 John W. Eaton + + * plot/private/__plt__.m: Replace usage message with error. + * plot/loglog.m, plot/plot.m, plot/polar.m, plot/semilogx.m, + plot/semilogy.m: Call print_usage if no args are supplied. + Add additional calling forms to documentation. + 2010-06-24 Shai Ayal * plot/print.m: convert to wrapper for backend specific print functions diff --git a/scripts/plot/loglog.m b/scripts/plot/loglog.m --- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -18,9 +18,14 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} loglog (@var{args}) +## @deftypefn {Function File} {} loglog (@var{y}) +## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}) +## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) +## @deftypefnx {Function File} {} loglog (@var{x}, @var{y}, @var{fmt}) +## @deftypefnx {Function File} {} loglog (@var{h}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} loglog (@dots{}) ## Produce a two-dimensional plot using log scales for both axes. See -## the description of @code{plot} for a description of the arguments +## the documentation of @code{plot} for a description of the arguments ## that @code{loglog} will accept. ## @seealso{plot, semilogx, semilogy} ## @end deftypefn @@ -29,7 +34,11 @@ function retval = loglog (varargin) - [h, varargin] = __plt_get_axis_arg__ ("loglog", varargin{:}); + [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:}); + + if (nargs < 1) + print_usage(); + endif oldh = gca (); unwind_protect diff --git a/scripts/plot/plot.m b/scripts/plot/plot.m --- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -179,7 +179,11 @@ function retval = plot (varargin) - [h, varargin] = __plt_get_axis_arg__ ("plot", varargin{:}); + [h, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:}); + + if (nargs < 1) + print_usage(); + endif oldh = gca (); unwind_protect diff --git a/scripts/plot/polar.m b/scripts/plot/polar.m --- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -18,7 +18,10 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt}) +## @deftypefn {Function File} {} polar (@var{theta}, @var{rho}) +## @deftypefnx {Function File} {} polar (@var{theta}, @var{rho}, @var{fmt}) +## @deftypefnx {Function File} {} polar (@var{h}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} polar (@dots{}) ## Make a two-dimensional plot given the polar coordinates @var{theta} and ## @var{rho}. ## @@ -32,6 +35,10 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:}); + if (nargs < 1) + print_usage(); + endif + oldh = gca (); unwind_protect axes (h); diff --git a/scripts/plot/private/__plt__.m b/scripts/plot/private/__plt__.m --- a/scripts/plot/private/__plt__.m +++ b/scripts/plot/private/__plt__.m @@ -109,11 +109,7 @@ endwhile else - msg = sprintf ("%s (y)\n", caller); - msg = sprintf ("%s %s (x, y, ...)\n", msg, caller); - msg = sprintf ("%s %s (x, y, fmt, ...)\n", msg, caller); - msg = sprintf ("%s %s (x, y, property, value, ...)", msg, caller); - usage (msg); + error ("__plt__: invalid number of arguments"); endif endfunction diff --git a/scripts/plot/semilogx.m b/scripts/plot/semilogx.m --- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -18,9 +18,14 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} semilogx (@var{args}) +## @deftypefn {Function File} {} semilogx (@var{y}) +## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}) +## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) +## @deftypefnx {Function File} {} semilogx (@var{x}, @var{y}, @var{fmt}) +## @deftypefnx {Function File} {} semilogx (@var{h}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} semilogx (@dots{}) ## Produce a two-dimensional plot using a logarithmic scale for the @var{x} -## axis. See the description of @code{plot} for a description of the +## axis. See the documentation of @code{plot} for a description of the ## arguments that @code{semilogx} will accept. ## @seealso{plot, semilogy, loglog} ## @end deftypefn @@ -29,7 +34,11 @@ function retval = semilogx (varargin) - [h, varargin] = __plt_get_axis_arg__ ("semilogx", varargin{:}); + [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:}); + + if (nargs < 1) + print_usage(); + endif oldh = gca (); unwind_protect diff --git a/scripts/plot/semilogy.m b/scripts/plot/semilogy.m --- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -18,9 +18,14 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} semilogy (@var{args}) +## @deftypefn {Function File} {} semilogy (@var{y}) +## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}) +## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{property}, @var{value}, @dots{}) +## @deftypefnx {Function File} {} semilogy (@var{x}, @var{y}, @var{fmt}) +## @deftypefnx {Function File} {} semilogy (@var{h}, @dots{}) +## @deftypefnx {Function File} {@var{h} =} semilogy (@dots{}) ## Produce a two-dimensional plot using a logarithmic scale for the @var{y} -## axis. See the description of @code{plot} for a description of the +## axis. See the documentation of @code{plot} for a description of the ## arguments that @code{semilogy} will accept. ## @seealso{plot, semilogx, loglog} ## @end deftypefn @@ -29,7 +34,11 @@ function retval = semilogy (varargin) - [h, varargin] = __plt_get_axis_arg__ ("semilogy", varargin{:}); + [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:}); + + if (nargs < 1) + print_usage(); + endif oldh = gca (); unwind_protect diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,10 @@ * ov-struct.cc (Fcell2struct): Rewrite. +2010-06-24 Rik + + * octave.cc: Add [FILE] to octave usage string (bug #30258). + 2010-06-24 Jaroslav Hajek * oct-map.h (octave_map, octave_scalar_map): New classes. diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -467,7 +467,7 @@ { std::cout << OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY "\n\ \n\ -Usage: octave [options]\n\ +Usage: octave [options] [FILE]\n\ \n\ Options:\n\ \n\ diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -242,6 +242,25 @@ return retval; } +Array +octave_char_matrix_str::cellstr_value (void) const +{ + Array retval; + + if (matrix.ndims () == 2) + { + const charMatrix chm = matrix.matrix_value (); + octave_idx_type nr = chm.rows (); + retval.clear (nr, 1); + for (octave_idx_type i = 0; i < nr; i++) + retval.xelem(i) = chm.row_as_string (i); + } + else + error ("cellstr: cannot convert multidimensional arrays"); + + return retval; +} + void octave_char_matrix_str::print_raw (std::ostream& os, bool pr_as_read_syntax) const { diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -129,6 +129,8 @@ std::string string_value (bool force = false) const; + Array cellstr_value (void) const; + octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const { return octave_value (matrix.sort (dim, mode)); }