Mercurial > hg > octave-avbm
changeset 6732:4ba39e63b005
[project @ 2007-06-15 18:07:29 by jwe]
author | jwe |
---|---|
date | Fri, 15 Jun 2007 18:07:29 +0000 |
parents | aff0c76321aa |
children | d6e615183a80 |
files | ChangeLog run-octave.in src/ChangeLog src/graphics.cc |
diffstat | 4 files changed, 65 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-15 John W. Eaton <jwe@octave.org> + + * run-octave.in: Use simple string concatenation instead of + sprintf in AWK program. + 2007-06-13 Michael Goffioul <michael.goffioul@swing.be> * configure.in: Set NO_OCT_FILE_STRIP=true for msdosmsvc.
--- a/run-octave.in +++ b/run-octave.in @@ -22,10 +22,10 @@ d3_list=$(find "$d3" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';') d4_list=$(find "$d4" -type d -a ! \( \( -name CVS -o -name private \) -a -prune \) -exec echo '{}': ';') -d1_path=$(echo "$d1_list" | $AWK '{ s = sprintf ("%s%s", s, $0); } END { sub (/:$/, "", s); print s; }') -d2_path=$(echo "$d2_list" | $AWK '{ s = sprintf ("%s%s", s, $0); } END { sub (/:$/, "", s); print s; }') -d3_path=$(echo "$d3_list" | $AWK '{ s = sprintf ("%s%s", s, $0); } END { sub (/:$/, "", s); print s; }') -d4_path=$(echo "$d4_list" | $AWK '{ s = sprintf ("%s%s", s, $0); } END { sub (/:$/, "", s); print s; }') +d1_path=$(echo "$d1_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }') +d2_path=$(echo "$d2_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }') +d3_path=$(echo "$d3_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }') +d4_path=$(echo "$d4_list" | $AWK '{ t = (s $0); s = t; } END { sub (/:$/, "", s); print s; }') LOADPATH="$d1_path:$d2_path:$d3_path:$d4_path" IMAGEPATH="$top_srcdir/scripts/image"
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-06-15 Kai Habel <kai.habel@gmx.de> + + * graphics.cc (Fget, Fset): Handle vectors of handles. + 2007-06-14 John W. Eaton <jwe@octave.org> * sysdep.cc (octave_popen, octave_pclose): New functions.
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -2132,8 +2132,8 @@ DEFUN (set, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} set (@var{h}, @var{p}, @var{v}, @dots{})\n\ -Set the named property @var{p} to the value @var{v} in the graphics\n\ -handle @var{h}.\n\ +Set the named property value or vector @var{p} to the value @var{v}\n\ +in the graphics handle @var{h}.\n\ @end deftypefn") { octave_value retval; @@ -2142,23 +2142,26 @@ if (nargin > 0) { - double handle = args(0).double_value (); + ColumnVector hcv (args(0).vector_value ()); if (! error_state) - { - graphics_object obj = gh_manager::get_object (handle); + { + for (octave_idx_type n = 0; n < hcv.length (); n++) + { + graphics_object obj = gh_manager::get_object (hcv(n)); - if (obj) - { - obj.set (args.splice (0, 1)); + if (obj) + { + obj.set (args.splice (0, 1)); - feval ("__request_drawnow__"); - } - else - error ("set: invalid handle (= %g)", handle); - } + feval ("__request_drawnow__"); + } + else + error ("set: invalid handle (= %g)", hcv(n)); + } + } else - error ("set: expecting graphics handle as first argument"); + error ("set: expecting graphics handle as first argument"); } else print_usage (); @@ -2171,49 +2174,63 @@ @deftypefn {Built-in Function} {} get (@var{h}, @var{p})\n\ Return the named property @var{p} from the graphics handle @var{h}.\n\ If @var{p} is omitted, return the complete property list for @var{h}.\n\ +If @var{h} is a vector, return a cell array including the property\n\ +values or lists respectively.\n\ @end deftypefn") { octave_value retval; + octave_value_list vlist; int nargin = args.length (); if (nargin == 1 || nargin == 2) { - double handle = args(0).double_value (); + ColumnVector hcv (args(0).vector_value ()); if (! error_state) - { - graphics_object obj = gh_manager::get_object (handle); + { + for (octave_idx_type n = 0; n < hcv.length (); n++) + { + graphics_object obj = gh_manager::get_object (hcv(n)); - if (obj) - { - if (nargin == 1) - retval = obj.get (); - else - { - property_name property = args(1).string_value (); + if (obj) + { + if (nargin == 1) + vlist(n) = obj.get (); + else + { + property_name property = args(1).string_value (); - if (! error_state) - retval = obj.get (property); - else - error ("get: expecting property name as second argument"); - } - } - else - error ("get: invalid handle (= %g)", handle); - } + if (! error_state) + vlist(n) = obj.get (property); + else + error ("get: expecting property name as second argument"); + } + } + else + error ("get: invalid handle (= %g)", hcv(n)); + } + } else - error ("get: expecting graphics handle as first argument"); + error ("get: expecting graphics handle as first argument"); } else print_usage (); + if (vlist.length () > 1) + { + Cell c(vlist); + retval = c; + } + else + retval = vlist(0); + return retval; } static octave_value make_graphics_object (const std::string& go_name, - const octave_value_list& args) + const octave_value_list& args) { octave_value retval;