changeset 23587:0c468af9dc00

maint: Deprecate is_object and replace with isobject. * ov.h (is_object): Use OCTAVE_DEPRECATED macro around function. * ov.h (isobject): New function. * bsxfun.cc, cellfun.cc, data.cc, ls-mat5.cc, oct-stream.cc, symtab.h, variables.cc, ov-base.h, ov-class.cc, ov-class.h, ov-classdef.h, ov-oncleanup.h, ov-struct.cc, ov.cc, ov.h, op-class.cc, pt-arg-list.cc, pt-eval.cc, pt-tm-const.cc: Replace instances of is_object with isobject.
author Rik <rik@octave.org>
date Tue, 13 Jun 2017 11:25:31 -0700
parents f6c5db0a02e7
children 0549061d35b9
files libinterp/corefcn/bsxfun.cc libinterp/corefcn/cellfun.cc libinterp/corefcn/data.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/oct-stream.cc libinterp/corefcn/symtab.h libinterp/corefcn/variables.cc libinterp/octave-value/ov-base.h libinterp/octave-value/ov-class.cc libinterp/octave-value/ov-class.h libinterp/octave-value/ov-classdef.h libinterp/octave-value/ov-oncleanup.h libinterp/octave-value/ov-struct.cc libinterp/octave-value/ov.cc libinterp/octave-value/ov.h libinterp/operators/op-class.cc libinterp/parse-tree/pt-arg-list.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-tm-const.cc
diffstat 19 files changed, 47 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/bsxfun.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/bsxfun.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -355,7 +355,7 @@
   const octave_value B = args(2);
 
   if (func.is_builtin_function ()
-      || (func.is_function_handle () && ! A.is_object () && ! B.is_object ()))
+      || (func.is_function_handle () && ! A.isobject () && ! B.isobject ()))
     {
       // This may break if the default behavior is overridden.  But if you
       // override arithmetic operators for builtin classes, you should expect
--- a/libinterp/corefcn/cellfun.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/cellfun.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -1822,7 +1822,7 @@
             retval = do_num2cell (array.array_value (), dimv);
         }
     }
-  else if (array.is_object ())
+  else if (array.isobject ())
     retval = do_object2cell (array, dimv);
   else if (array.isstruct ())
     retval = do_num2cell (array.map_value (), dimv);
--- a/libinterp/corefcn/data.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/data.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -1733,7 +1733,7 @@
 
           if (t1_type == dtype)
             tmp(j++) = elt;
-          else if (elt.is_object () || ! elt.isempty ())
+          else if (elt.isobject () || ! elt.isempty ())
             tmp(j++) = attempt_type_conversion (elt, dtype);
         }
 
@@ -1807,7 +1807,7 @@
             any_sparse_p = true;
           if (! any_cell_p && args(i).iscell ())
             any_cell_p = true;
-          if (! any_class_p && args(i).is_object ())
+          if (! any_class_p && args(i).isobject ())
             any_class_p = true;
         }
 
--- a/libinterp/corefcn/ls-mat5.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/ls-mat5.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -2166,7 +2166,7 @@
                                          save_as_floats);
         }
     }
-  else if (tc.isstruct () || tc.is_inline_function () || tc.is_object ())
+  else if (tc.isstruct () || tc.is_inline_function () || tc.isobject ())
     {
       int fieldcnt = 0;
       const octave_map m = tc.map_value ();
@@ -2175,7 +2175,7 @@
       if (tc.is_inline_function ())
         // length of "inline" is 6
         ret += 8 + PAD (6 > max_namelen ? max_namelen : 6);
-      else if (tc.is_object ())
+      else if (tc.isobject ())
         {
           size_t classlen = tc.class_name ().length ();
 
@@ -2378,7 +2378,7 @@
     flags |= MAT_FILE_STRUCT_CLASS;
   else if (tc.iscell ())
     flags |= MAT_FILE_CELL_CLASS;
-  else if (tc.is_inline_function () || tc.is_object ())
+  else if (tc.is_inline_function () || tc.isobject ())
     flags |= MAT_FILE_OBJECT_CLASS;
   else
     {
@@ -2583,11 +2583,11 @@
           write_mat5_array (os, ::imag (m_cmplx), save_as_floats);
         }
     }
-  else if (tc.isstruct () || tc.is_inline_function () || tc.is_object ())
+  else if (tc.isstruct () || tc.is_inline_function () || tc.isobject ())
     {
-      if (tc.is_inline_function () || tc.is_object ())
+      if (tc.is_inline_function () || tc.isobject ())
         {
-          std::string classname = (tc.is_object () ? tc.class_name () : "inline");
+          std::string classname = (tc.isobject () ? tc.class_name () : "inline");
           size_t namelen = classname.length ();
 
           if (namelen > max_namelen)
@@ -2606,7 +2606,7 @@
 
       octave::load_path& lp = octave::__get_load_path__ ("read_mat5_binary_element");
 
-      if (tc.is_object ()
+      if (tc.isobject ()
           && lp.find_method (tc.class_name (), "saveobj") != "")
         {
           try
--- a/libinterp/corefcn/oct-stream.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/oct-stream.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -5300,7 +5300,7 @@
         {
           octave_value val = values(i);
 
-          if (val.isstruct () || val.iscell () || val.is_object ())
+          if (val.isstruct () || val.iscell () || val.isobject ())
             err_wrong_type_arg (who, val);
         }
     }
--- a/libinterp/corefcn/symtab.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/symtab.h	Tue Jun 13 11:25:31 2017 -0700
@@ -2644,7 +2644,7 @@
       {
         symbol_record& sr = nm_sr.second;
         octave_value val = sr.varval ();
-        if (val.is_object ())
+        if (val.isobject ())
           nm_sr.second.clear (my_scope);
       }
   }
--- a/libinterp/corefcn/variables.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/corefcn/variables.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -400,7 +400,7 @@
     {
       octave_value val = symbol_table::varval (name);
 
-      if (val.is_constant () || val.is_object ()
+      if (val.is_constant () || val.isobject ()
           || val.is_function_handle ()
           || val.is_anonymous_function ()
           || val.is_inline_function ())
--- a/libinterp/octave-value/ov-base.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-base.h	Tue Jun 13 11:25:31 2017 -0700
@@ -369,7 +369,7 @@
 
   virtual bool isstruct (void) const { return false; }
 
-  virtual bool is_object (void) const { return false; }
+  virtual bool isobject (void) const { return false; }
 
   virtual bool is_classdef_object (void) const { return false; }
 
--- a/libinterp/octave-value/ov-class.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-class.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -80,7 +80,7 @@
     {
       octave_value parent = parents(idx);
 
-      if (! parent.is_object ())
+      if (! parent.isobject ())
         error ("parents must be objects");
 
       std::string pcnm = parent.class_name ();
@@ -729,7 +729,7 @@
           }
         else
           {
-            if (t_rhs.is_object () || t_rhs.isstruct ())
+            if (t_rhs.isobject () || t_rhs.isstruct ())
               {
                 octave_map rhs_map = t_rhs.xmap_value ("invalid class assignment");
 
@@ -810,7 +810,7 @@
 
   octave_value_list tmp = octave::feval (meth.function_value (), args, 1);
 
-  if (tmp(0).is_object ())
+  if (tmp(0).isobject ())
     error ("subsindex function must return a valid index vector");
 
   // Index vector returned by subsindex is zero based
@@ -1101,7 +1101,7 @@
     {
       std::string key = map.key (it);
       Cell        val = map.contents (it);
-      if (val(0).is_object ())
+      if (val(0).isobject ())
         {
           dbgstr = "blork";
           if (key == val(0).class_name ())
@@ -1643,7 +1643,7 @@
 octave_class::exemplar_info::exemplar_info (const octave_value& obj)
   : field_names (), parent_class_names ()
 {
-  if (! obj.is_object ())
+  if (! obj.isobject ())
     error ("invalid call to exemplar_info constructor");
 
   octave_map m = obj.map_value ();
@@ -1659,7 +1659,7 @@
 octave_class::exemplar_info::compare (const octave_value& obj) const
 {
 
-  if (! obj.is_object ())
+  if (! obj.isobject ())
     error ("invalid comparison of class exemplar to non-class object");
 
   if (nfields () != obj.nfields ())
@@ -1890,7 +1890,7 @@
 
   octave_value arg = args(0);
 
-  if (arg.is_object ())
+  if (arg.isobject ())
     return ovl (Cell (arg.parent_class_names ()));
   else
     return ovl (Cell ());
@@ -1906,7 +1906,7 @@
   if (args.length () != 1)
     print_usage ();
 
-  return ovl (args(0).is_object ());
+  return ovl (args(0).isobject ());
 }
 
 DEFMETHOD (ismethod, interp, args, ,
@@ -1925,7 +1925,7 @@
 
   std::string class_name;
 
-  if (arg.is_object ())
+  if (arg.isobject ())
     class_name = arg.class_name ();
   else if (arg.is_string ())
     class_name = arg.string_value ();
@@ -1957,7 +1957,7 @@
 
   std::string class_name;
 
-  if (arg.is_object ())
+  if (arg.isobject ())
     class_name = arg.class_name ();
   else if (arg.is_string ())
     class_name = arg.string_value ();
--- a/libinterp/octave-value/ov-class.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-class.h	Tue Jun 13 11:25:31 2017 -0700
@@ -144,7 +144,7 @@
 
   bool isstruct (void) const { return false; }
 
-  bool is_object (void) const { return true; }
+  bool isobject (void) const { return true; }
 
   bool is_true (void) const;
 
--- a/libinterp/octave-value/ov-classdef.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-classdef.h	Tue Jun 13 11:25:31 2017 -0700
@@ -1417,7 +1417,7 @@
 
   bool isstruct (void) const { return false; }
 
-  bool is_object (void) const { return true; }
+  bool isobject (void) const { return true; }
 
   bool is_classdef_object (void) const { return true; }
 
--- a/libinterp/octave-value/ov-oncleanup.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-oncleanup.h	Tue Jun 13 11:25:31 2017 -0700
@@ -56,7 +56,7 @@
 
   bool is_defined (void) const { return true; }
 
-  bool is_object (void) const { return true; } // do we want this?
+  bool isobject (void) const { return true; } // do we want this?
 
   octave_map map_value (void) const { return scalar_map_value (); }
 
--- a/libinterp/octave-value/ov-struct.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov-struct.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -463,7 +463,7 @@
           }
         else
           {
-            if (t_rhs.isstruct () || t_rhs.is_object ())
+            if (t_rhs.isstruct () || t_rhs.isobject ())
               {
                 octave_map rhs_map = t_rhs.xmap_value ("invalid structure assignment");
 
@@ -1704,7 +1704,7 @@
   if (nargin == 1 && args(0).isstruct ())
     return ovl (args(0));
 
-  if (nargin == 1 && args(0).is_object ())
+  if (nargin == 1 && args(0).isobject ())
     return ovl (args(0).map_value ());
 
   if ((nargin == 1 || nargin == 2)
--- a/libinterp/octave-value/ov.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -2486,13 +2486,13 @@
 {
   octave_value retval;
 
-  if (base.is_object () || increment.is_object () || limit.is_object ())
+  if (base.isobject () || increment.isobject () || limit.isobject ())
     {
       std::string dispatch_type;
 
-      if (base.is_object ())
+      if (base.isobject ())
         dispatch_type = base.class_name ();
-      else if (increment.is_defined () && increment.is_object ())
+      else if (increment.is_defined () && increment.isobject ())
         dispatch_type = increment.class_name ();
       else
         dispatch_type = limit.class_name ();
--- a/libinterp/octave-value/ov.h	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/octave-value/ov.h	Tue Jun 13 11:25:31 2017 -0700
@@ -592,12 +592,16 @@
   bool is_map (void) const
   { return isstruct (); }
 
-  bool is_object (void) const
-  { return rep->is_object (); }
-
   bool is_classdef_object (void) const
   { return rep->is_classdef_object (); }
 
+  bool isobject (void) const
+  { return rep->isobject (); }
+
+  OCTAVE_DEPRECATED ("use 'isobject' instead")
+  bool is_object (void) const
+  { return isobject (); }
+
   bool isjava (void) const
   { return rep->isjava (); }
 
--- a/libinterp/operators/op-class.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/operators/op-class.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -79,7 +79,7 @@
     octave_value retval;                                                \
                                                                         \
     std::string dispatch_type                                           \
-      = (a1.is_object () ? a1.class_name () : a2.class_name ());        \
+      = (a1.isobject () ? a1.class_name () : a2.class_name ());        \
                                                                         \
     octave_value meth = symbol_table::find_method (#name, dispatch_type); \
                                                                         \
--- a/libinterp/parse-tree/pt-arg-list.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/parse-tree/pt-arg-list.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -155,7 +155,7 @@
   if (! indexed_object)
     error ("invalid use of end");
 
-  if (indexed_object->is_object ())
+  if (indexed_object->isobject ())
     {
       octave_value_list args;
 
--- a/libinterp/parse-tree/pt-eval.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/parse-tree/pt-eval.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -342,7 +342,7 @@
 
     tree_expression *op_increment = expr.increment ();
 
-    if (ov_base.is_object () || ov_limit.is_object ())
+    if (ov_base.isobject () || ov_limit.isobject ())
       {
         octave_value_list tmp1;
 
@@ -1254,7 +1254,7 @@
     if (base_expr_val.is_undefined ())
       base_expr_val = evaluate (expr);
 
-    bool indexing_object = base_expr_val.is_object ();
+    bool indexing_object = base_expr_val.isobject ();
 
     std::list<octave_value_list> idx;
 
@@ -1292,7 +1292,7 @@
                         beg = i;
                         idx.clear ();
 
-                        if (partial_expr_val.is_object ())
+                        if (partial_expr_val.isobject ())
                           {
                             // Found an object, so now we'll build up
                             // complete index list for one big subsref
--- a/libinterp/parse-tree/pt-tm-const.cc	Tue Jun 13 10:20:55 2017 -0700
+++ b/libinterp/parse-tree/pt-tm-const.cc	Tue Jun 13 11:25:31 2017 -0700
@@ -64,7 +64,7 @@
                                                    bool& first_elem)
   {
     std::string this_elt_class_nm
-      = val.is_object () ? std::string ("class") : val.class_name ();
+      = val.isobject () ? std::string ("class") : val.class_name ();
 
     class_nm = get_concat_class (class_nm, this_elt_class_nm);
 
@@ -111,7 +111,7 @@
     if (! any_sparse && val.issparse ())
       any_sparse = true;
 
-    if (! any_class && val.is_object ())
+    if (! any_class && val.isobject ())
       any_class = true;
 
     // Special treatment of sparse matrices to avoid out-of-memory error