octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Changeset]: Re: cla() ?


From: David Bateman
Subject: [Changeset]: Re: cla() ?
Date: Mon, 06 Oct 2008 10:32:03 +0100
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

Ben Abbott wrote:

There's a few functions, that rely upon the current ishandle() behavior, which will need to be changed as well.

Once ishandle works correctly I'll submit change sets for those I've found.

So far my list includes __plt_get_axis_arg__.m, axes.m, hold.m, and orient.m.

Ok, I suppose you mean that ishandle('ij') should return "false(1,2)", and that the code needs to be adapted to handle that. If you want to make these changes then I'll let you do it.. I suggest the updated changeset attached to get a behavior that special cases strings that are passed to ishandle.

D.

--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary

# HG changeset patch
# User David Bateman <address@hidden>
# Date 1223283901 -3600
# Node ID 8eef4d0469250e678c877c8a2259f6c8b0d781f9
# Parent  04a45d7107359f26fc7570bac682b006c20936d0
Handle arrays of  handles in the Fishandle function

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-04  David Bateman  <address@hidden>
+
+       * graphics.cc (static bool is_handle (const octave_value&)): Delete.
+       (static octave_value is_handle (const octave_value&)): New function.
+
 2008-09-27  David Bateman  <address@hidden>
 
        * symtab.cc (octave_value symbol_table::find_function 
diff --git a/src/graphics.cc b/src/graphics.cc
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -1424,10 +1424,34 @@
   return h.ok ();
 }
 
-static bool
+static octave_value
 is_handle (const octave_value& val)
 {
-  return val.is_real_scalar () && is_handle (val.double_value ());
+  octave_value retval = false;
+
+  if (val.is_real_scalar () && is_handle (val.double_value ()))
+    retval = true;
+  else if (val.is_real_matrix ())
+    {
+      if (val.is_string ())
+       retval = boolNDArray (val.dims (), false);
+      else
+       {
+         const NDArray handles = val.array_value ();
+
+         if (! error_state)
+           {
+             boolNDArray result (handles.dims ());
+
+             for (octave_idx_type i = 0; i < handles.numel (); i++)
+               result.xelem (i) = is_handle (handles (i));
+
+             retval = result;
+           }
+       }
+    }
+
+  return retval;
 }
 
 static bool

reply via email to

[Prev in Thread] Current Thread [Next in Thread]