Mercurial > octave
changeset 29466:7c8a70e4daad
use "m_" prefix for class members in a few more classes
* ov-builtin.h, ov-builtin.cc, ov-class.h, ov-class.cc, ov-classdef.h,
ov-classdef.cc, ov-usr-fcn.h, ov-usr-fcn.cc: Use "m_" prefix for class
data members.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 28 Mar 2021 15:35:05 -0400 |
parents | 0e9319d40977 |
children | 80457383d5e1 |
files | libinterp/octave-value/ov-builtin.cc libinterp/octave-value/ov-builtin.h libinterp/octave-value/ov-class.cc libinterp/octave-value/ov-class.h libinterp/octave-value/ov-classdef.cc libinterp/octave-value/ov-classdef.h libinterp/octave-value/ov-usr-fcn.cc libinterp/octave-value/ov-usr-fcn.h |
diffstat | 8 files changed, 282 insertions(+), 277 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-builtin.cc Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-builtin.cc Sun Mar 28 15:35:05 2021 -0400 @@ -55,14 +55,14 @@ octave::profiler::enter<octave_builtin> block (profiler, *this); - if (f) - retval = (*f) (args, nargout); + if (m_fcn) + retval = (*m_fcn) (args, nargout); else { octave::interpreter& interp = octave::__get_interpreter__ ("octave_builtin::call"); - retval = (*m) (interp, args, nargout); + retval = (*m_meth) (interp, args, nargout); } // Do not allow null values to be returned from functions. @@ -90,35 +90,35 @@ octave::jit_type * octave_builtin::to_jit (void) const { - return jtype; + return m_jtype; } void octave_builtin::stash_jit (octave::jit_type& type) { - jtype = &type; + m_jtype = &type; } octave_builtin::fcn octave_builtin::function (void) const { - return f; + return m_fcn; } octave_builtin::meth octave_builtin::method (void) const { - return m; + return m_meth; } void octave_builtin::push_dispatch_class (const std::string& dispatch_type) { - dispatch_classes.insert (dispatch_type); + m_dispatch_classes.insert (dispatch_type); } bool octave_builtin::handles_dispatch_class (const std::string& dispatch_type) const { - return dispatch_classes.find (dispatch_type) != dispatch_classes.end (); + return m_dispatch_classes.find (dispatch_type) != m_dispatch_classes.end (); }
--- a/libinterp/octave-value/ov-builtin.h Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-builtin.h Sun Mar 28 15:35:05 2021 -0400 @@ -53,8 +53,9 @@ { public: - octave_builtin (void) : octave_function (), f (nullptr), m (nullptr), - file (), jtype (nullptr) + octave_builtin (void) + : octave_function (), m_fcn (nullptr), m_meth (nullptr), m_file (), + m_jtype (nullptr) { } typedef octave_value_list (*meth) (octave::interpreter&, @@ -64,22 +65,26 @@ octave_builtin (fcn ff, const std::string& nm = "", const std::string& ds = "") - : octave_function (nm, ds), f (ff), m (nullptr), file (), jtype (nullptr) + : octave_function (nm, ds), m_fcn (ff), m_meth (nullptr), m_file (), + m_jtype (nullptr) { } octave_builtin (meth mm, const std::string& nm = "", const std::string& ds = "") - : octave_function (nm, ds), f (nullptr), m (mm), file (), jtype (nullptr) + : octave_function (nm, ds), m_fcn (nullptr), m_meth (mm), m_file (), + m_jtype (nullptr) { } octave_builtin (fcn ff, const std::string& nm, const std::string& fnm, const std::string& ds) - : octave_function (nm, ds), f (ff), m (nullptr), file (fnm), jtype (nullptr) + : octave_function (nm, ds), m_fcn (ff), m_meth (nullptr), m_file (fnm), + m_jtype (nullptr) { } octave_builtin (meth mm, const std::string& nm, const std::string& fnm, const std::string& ds) - : octave_function (nm, ds), f (nullptr), m (mm), file (fnm), jtype (nullptr) + : octave_function (nm, ds), m_fcn (nullptr), m_meth (mm), m_file (fnm), + m_jtype (nullptr) { } // No copying! @@ -90,7 +95,7 @@ ~octave_builtin (void) = default; - std::string src_file_name (void) const { return file; } + std::string src_file_name (void) const { return m_file; } octave_function * function_value (bool = false) { return this; } @@ -115,17 +120,17 @@ protected: // A pointer to the actual function. - fcn f; - meth m; + fcn m_fcn; + meth m_meth; // The name of the file where this function was defined. - std::string file; + std::string m_file; // The types this function has been declared to handle (if any). - std::set<std::string> dispatch_classes; + std::set<std::string> m_dispatch_classes; // A pointer to the jit type that represents the function. - octave::jit_type *jtype; + octave::jit_type *m_jtype; private:
--- a/libinterp/octave-value/ov-class.cc Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-class.cc Sun Mar 28 15:35:05 2021 -0400 @@ -75,7 +75,7 @@ octave_class::octave_class (const octave_map& m, const std::string& id, const octave_value_list& parents) - : octave_base_value (), map (m), c_name (id), obsolete_copies (0) + : octave_base_value (), m_map (m), c_name (id), m_obsolete_copies (0) { octave_idx_type n = parents.length (); @@ -91,9 +91,9 @@ if (find_parent_class (pcnm)) error ("duplicate class in parent tree"); - parent_list.push_back (pcnm); - - octave_idx_type nel = map.numel (); + m_parent_list.push_back (pcnm); + + octave_idx_type nel = m_map.numel (); octave_idx_type p_nel = parent.numel (); if (nel == 0) @@ -103,20 +103,20 @@ // No elements in MAP or the parent class object, // so just add the field name. - map.assign (pcnm, Cell (map.dims ())); + m_map.assign (pcnm, Cell (m_map.dims ())); } else if (p_nel == 1) { - if (map.nfields () == 0) + if (m_map.nfields () == 0) { // No elements or fields in MAP, but the // parent is class object with one element. // Resize to match size of parent class and // make the parent a field in MAP. - map.resize (parent.dims ()); - - map.assign (pcnm, parent); + m_map.resize (parent.dims ()); + + m_map.assign (pcnm, parent); } else { @@ -124,10 +124,10 @@ // one field. So don't resize, just add the // field name. - map.assign (pcnm, Cell (map.dims ())); + m_map.assign (pcnm, Cell (m_map.dims ())); } } - else if (map.nfields () == 0) + else if (m_map.nfields () == 0) { // No elements or fields in MAP and more than one // element in the parent class object, so we can @@ -137,7 +137,7 @@ dim_vector parent_dims = parent.dims (); - map.resize (parent_dims); + m_map.resize (parent_dims); Cell c (parent_dims); @@ -149,7 +149,7 @@ for (octave_idx_type i = 0; i < p_nel; i++) c(i) = octave_value (pmap.index (i), pcnm, plist); - map.assign (pcnm, c); + m_map.assign (pcnm, c); } else error ("class: parent class dimension mismatch"); @@ -158,7 +158,7 @@ { // Simple assignment. - map.assign (pcnm, parent); + m_map.assign (pcnm, parent); } else { @@ -167,9 +167,9 @@ // Broadcast the scalar parent class object to // each element of MAP. - Cell pcell (map.dims (), parent); - - map.assign (pcnm, pcell); + Cell pcell (m_map.dims (), parent); + + m_map.assign (pcnm, pcell); } else if (nel == p_nel) { @@ -193,7 +193,7 @@ for (octave_idx_type i = 0; i < p_nel; i++) c(i) = octave_value (pmap.index (i), pcnm, plist); - map.assign (pcnm, c); + m_map.assign (pcnm, c); } else error ("class: parent class dimension mismatch"); @@ -202,13 +202,13 @@ octave::symbol_table& symtab = octave::__get_symbol_table__ ("octave_class"); - symtab.add_to_parent_map (id, parent_list); + symtab.add_to_parent_map (id, m_parent_list); } octave_base_value * octave_class::unique_clone (void) { - if (count == obsolete_copies) + if (count == m_obsolete_copies) { // All remaining copies are obsolete. We don't actually need to clone. count++; @@ -217,8 +217,8 @@ else { // In theory, this shouldn't be happening, but it's here just in case. - if (count < obsolete_copies) - obsolete_copies = 0; + if (count < m_obsolete_copies) + m_obsolete_copies = 0; return clone (); } @@ -281,7 +281,7 @@ if (obvp == nullptr) error ("malformed class"); - octave_map my_map = (obvp != this) ? obvp->map_value () : map; + octave_map my_map = (obvp != this) ? obvp->map_value () : m_map; std::string nm = idx(0).xstring_value ("invalid index for class"); @@ -405,14 +405,14 @@ skip++; } else - retval(0) = octave_value (map.index (idx.front ()), - c_name, parent_list); + retval(0) = octave_value (m_map.index (idx.front ()), + c_name, m_parent_list); } break; case '.': { - if (map.numel () > 0) + if (m_map.numel () > 0) { Cell t = dotref (idx.front ()); @@ -482,8 +482,8 @@ else { if (type.length () == 1 && type[0] == '(') - retval(0) = octave_value (map.index (idx.front ()), c_name, - parent_list); + retval(0) = octave_value (m_map.index (idx.front ()), c_name, + m_parent_list); else err_invalid_index1 (); } @@ -576,11 +576,11 @@ octave_value_list tmp; - if (obsolete_copies == 0 && meth.is_user_function () + if (m_obsolete_copies == 0 && meth.is_user_function () && meth.user_function_value ()->subsasgn_optimization_ok ()) { - octave::unwind_protect_var<int> restore_var (obsolete_copies); - obsolete_copies = 2; + octave::unwind_protect_var<int> restore_var (m_obsolete_copies); + m_obsolete_copies = 2; tmp = octave::feval (meth.function_value (), args); } @@ -648,11 +648,11 @@ octave_value u; - if (! map.contains (key)) + if (! m_map.contains (key)) u = octave_value::empty_conv (type.substr (2), rhs); else { - Cell map_val = map.contents (key); + Cell map_val = m_map.contents (key); Cell map_elt = map_val.index (idx.front (), true); @@ -691,11 +691,11 @@ std::string next_type = type.substr (1); Cell tmpc (1, 1); - auto pkey = map.seek (key); - if (pkey != map.end ()) + auto pkey = m_map.seek (key); + if (pkey != m_map.end ()) { - map.contents (pkey).make_unique (); - tmpc = map.contents (pkey); + m_map.contents (pkey).make_unique (); + tmpc = m_map.contents (pkey); } // FIXME: better code reuse? @@ -739,7 +739,7 @@ std::string key = key_idx(0).xstring_value ("assignment to class element failed"); - map.assign (idx.front (), key, t_rhs); + m_map.assign (idx.front (), key, t_rhs); count++; retval = octave_value (this); @@ -750,7 +750,7 @@ { octave_map rhs_map = t_rhs.xmap_value ("invalid class assignment"); - map.assign (idx.front (), rhs_map); + m_map.assign (idx.front (), rhs_map); count++; retval = octave_value (this); @@ -760,7 +760,7 @@ if (! t_rhs.isempty ()) error ("invalid class assignment"); - map.delete_elements (idx.front ()); + m_map.delete_elements (idx.front ()); count++; retval = octave_value (this); @@ -788,13 +788,13 @@ if (numel () == tmp_cell.numel ()) tmp_cell = tmp_cell.reshape (dims ()); - map.setfield (key, tmp_cell); + m_map.setfield (key, tmp_cell); } else { Cell tmp_cell(1, 1); tmp_cell(0) = t_rhs.storable_value (); - map.setfield (key, tmp_cell); + m_map.setfield (key, tmp_cell); } count++; @@ -826,7 +826,7 @@ class_name ().c_str ()); octave_value_list args; - args(0) = octave_value (new octave_class (map, c_name, parent_list)); + args(0) = octave_value (new octave_class (m_map, c_name, m_parent_list)); octave_value_list tmp = octave::feval (meth.function_value (), args, 1); @@ -848,11 +848,11 @@ size_t retval = 0; - for (auto it = map.cbegin (); it != map.cend (); it++) + for (auto it = m_map.cbegin (); it != m_map.cend (); it++) { - std::string key = map.key (it); - - octave_value val = octave_value (map.contents (it)); + std::string key = m_map.key (it); + + octave_value val = octave_value (m_map.contents (it)); retval += val.byte_size (); } @@ -896,11 +896,11 @@ retval = this; else { - for (auto& par : parent_list) + for (auto& par : m_parent_list) { - octave_map::const_iterator smap = map.seek (par); - - const Cell& tmp = map.contents (smap); + octave_map::const_iterator smap = m_map.seek (par); + + const Cell& tmp = m_map.contents (smap); octave_value vtmp = tmp(0); @@ -925,11 +925,11 @@ retval = this; else { - for (auto& par : parent_list) + for (auto& par : m_parent_list) { - auto smap = map.seek (par); - - Cell& tmp = map.contents (smap); + auto smap = m_map.seek (par); + + Cell& tmp = m_map.contents (smap); octave_value& vtmp = tmp(0); @@ -961,11 +961,11 @@ retval = true; else { - for (auto& par : parent_list) + for (auto& par : m_parent_list) { - octave_map::const_iterator smap = map.seek (par); - - const Cell& tmp = map.contents (smap); + octave_map::const_iterator smap = m_map.seek (par); + + const Cell& tmp = m_map.contents (smap); const octave_value& vtmp = tmp(0); @@ -993,7 +993,7 @@ error ("no char method defined for class %s", class_name ().c_str ()); octave_value_list args; - args(0) = octave_value (new octave_class (map, c_name, parent_list)); + args(0) = octave_value (new octave_class (m_map, c_name, m_parent_list)); octave_value_list tmp = octave::feval (meth.function_value (), args, 1); @@ -1113,10 +1113,10 @@ std::string dbgstr = "dork"; // First, check to see if there might be an issue with inheritance. - for (auto it = map.cbegin (); it != map.cend (); it++) + for (auto it = m_map.cbegin (); it != m_map.cend (); it++) { - std::string key = map.key (it); - Cell val = map.contents (it); + std::string key = m_map.key (it); + Cell val = m_map.contents (it); if (val(0).isobject ()) { dbgstr = "blork"; @@ -1139,11 +1139,11 @@ else { octave_class::exemplar_info exmplr = it->second; - parent_list = exmplr.parents (); - for (auto& par : parent_list) + m_parent_list = exmplr.parents (); + for (auto& par : m_parent_list) { dbgstr = par; - bool dbgbool = map.contains (par); + bool dbgbool = m_map.contains (par); if (! dbgbool) { retval = false; @@ -1179,7 +1179,7 @@ auto i = m.begin (); while (i != m.end ()) { - octave_value val = map.contents (i); + octave_value val = m_map.contents (i); bool b = save_text_data (os, val, m.key (i), false, 0); @@ -1206,7 +1206,7 @@ if (len > 0) { - octave_map m (map); + octave_map m (m_map); for (octave_idx_type j = 0; j < len; j++) { @@ -1231,7 +1231,7 @@ c_name = classname; reconstruct_exemplar (); - map = m; + m_map = m; if (! reconstruct_parents ()) warning ("load: unable to reconstruct object inheritance"); @@ -1243,12 +1243,12 @@ octave_value in = new octave_class (*this); octave_value_list tmp = octave::feval ("loadobj", in, 1); - map = tmp(0).map_value (); + m_map = tmp(0).map_value (); } } else if (len == 0) { - map = octave_map (dim_vector (1, 1)); + m_map = octave_map (dim_vector (1, 1)); c_name = classname; } else @@ -1285,7 +1285,7 @@ auto i = m.begin (); while (i != m.end ()) { - octave_value val = map.contents (i); + octave_value val = m_map.contents (i); bool b = save_binary_data (os, val, m.key (i), "", 0, save_as_floats); @@ -1329,7 +1329,7 @@ if (len > 0) { - octave_map m (map); + octave_map m (m_map); for (octave_idx_type j = 0; j < len; j++) { @@ -1351,7 +1351,7 @@ if (is) { - map = m; + m_map = m; if (! reconstruct_parents ()) warning ("load: unable to reconstruct object inheritance"); @@ -1363,7 +1363,7 @@ octave_value in = new octave_class (*this); octave_value_list tmp = octave::feval ("loadobj", in, 1); - map = tmp(0).map_value (); + m_map = tmp(0).map_value (); } } else @@ -1373,7 +1373,7 @@ } } else if (len == 0) - map = octave_map (dim_vector (1, 1)); + m_map = octave_map (dim_vector (1, 1)); else panic_impossible (); @@ -1451,7 +1451,7 @@ i = m.begin (); while (i != m.end ()) { - octave_value val = map.contents (i); + octave_value val = m_map.contents (i); bool retval2 = add_hdf5_data (data_hid, val, m.key (i), "", false, save_as_floats); @@ -1600,7 +1600,7 @@ if (retval2 >= 0) { - map = m; + m_map = m; if (! reconstruct_parents ()) warning ("load: unable to reconstruct object inheritance"); @@ -1612,7 +1612,7 @@ octave_value in = new octave_class (*this); octave_value_list tmp = octave::feval ("loadobj", in, 1); - map = tmp(0).map_value (); + m_map = tmp(0).map_value (); retval = true; } } @@ -1657,15 +1657,15 @@ } octave_class::exemplar_info::exemplar_info (const octave_value& obj) - : field_names (), parent_class_names () + : m_field_names (), m_parent_class_names () { if (! obj.isobject ()) error ("invalid call to exemplar_info constructor"); octave_map m = obj.map_value (); - field_names = m.keys (); - - parent_class_names = obj.parent_class_name_list (); + m_field_names = m.keys (); + + m_parent_class_names = obj.parent_class_name_list (); } // A map from class names to lists of fields.
--- a/libinterp/octave-value/ov-class.h Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-class.h Sun Mar 28 15:35:05 2021 -0400 @@ -55,27 +55,27 @@ public: octave_class (void) - : octave_base_value (), map (), c_name (), - parent_list (), obsolete_copies (0) + : octave_base_value (), m_map (), c_name (), + m_parent_list (), m_obsolete_copies (0) { } octave_class (const octave_map& m, const std::string& id) - : octave_base_value (), map (m), c_name (id), - parent_list (), obsolete_copies (0) + : octave_base_value (), m_map (m), c_name (id), + m_parent_list (), m_obsolete_copies (0) { } octave_class (const octave_map& m, const std::string& id, const std::list<std::string>& plist) - : octave_base_value (), map (m), c_name (id), - parent_list (plist), obsolete_copies (0) + : octave_base_value (), m_map (m), c_name (id), + m_parent_list (plist), m_obsolete_copies (0) { } octave_class (const octave_map& m, const std::string& id, const octave_value_list& parents); octave_class (const octave_class& s) - : octave_base_value (s), map (s.map), c_name (s.c_name), - parent_list (s.parent_list), obsolete_copies (0) { } + : octave_base_value (s), m_map (s.m_map), c_name (s.c_name), + m_parent_list (s.m_parent_list), m_obsolete_copies (0) { } ~octave_class (void) = default; @@ -85,7 +85,7 @@ octave_base_value * empty_clone (void) const { - return new octave_class (octave_map (map.keys ()), c_name, parent_list); + return new octave_class (octave_map (m_map.keys ()), c_name, m_parent_list); } OCTINTERP_API Cell dotref (const octave_value_list& idx); @@ -114,7 +114,7 @@ numeric_conv (const Cell& val, const std::string& type); void assign(const std::string& k, const octave_value& rhs) - { map.assign (k, rhs); }; + { m_map.assign (k, rhs); }; OCTINTERP_API octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, @@ -127,7 +127,7 @@ OCTINTERP_API idx_vector index_vector (bool require_integers = false) const; - dim_vector dims (void) const { return map.dims (); } + dim_vector dims (void) const { return m_map.dims (); } OCTINTERP_API size_t byte_size (void) const; @@ -139,21 +139,21 @@ return dv.numel (); } - octave_idx_type nfields (void) const { return map.nfields (); } + octave_idx_type nfields (void) const { return m_map.nfields (); } - size_t nparents (void) const { return parent_list.size (); } + size_t nparents (void) const { return m_parent_list.size (); } octave_value reshape (const dim_vector& new_dims) const { octave_class retval = octave_class (*this); - retval.map = retval.map_value ().reshape (new_dims); + retval.m_map = retval.map_value ().reshape (new_dims); return octave_value (new octave_class (retval)); } octave_value resize (const dim_vector& dv, bool = false) const { octave_class retval = octave_class (*this); - retval.map.resize (dv); + retval.m_map.resize (dv); return octave_value (new octave_class (retval)); } @@ -165,15 +165,15 @@ OCTINTERP_API bool is_true (void) const; - octave_map map_value (void) const { return map; } + octave_map map_value (void) const { return m_map; } OCTINTERP_API string_vector map_keys (void) const; std::list<std::string> parent_class_name_list (void) const - { return parent_list; } + { return m_parent_list; } string_vector parent_class_names (void) const - { return string_vector (parent_list); } + { return string_vector (m_parent_list); } OCTINTERP_API octave_base_value * find_parent_class (const std::string&); @@ -212,7 +212,7 @@ OCTINTERP_API mxArray * as_mxArray (bool interleaved) const; private: - octave_map map; + octave_map m_map; public: int type_id (void) const { return t_id; } @@ -229,7 +229,7 @@ static const std::string t_name; std::string c_name; - std::list<std::string> parent_list; + std::list<std::string> m_parent_list; OCTINTERP_API bool in_class_method (void); OCTINTERP_API std::string get_current_method_class (void); @@ -239,7 +239,7 @@ const std::list<octave_value_list>& idx, const octave_value& rhs); - int obsolete_copies; + int m_obsolete_copies; public: // The list of field names and parent classes defines a class. We @@ -248,38 +248,38 @@ { public: - exemplar_info (void) : field_names (), parent_class_names () { } + exemplar_info (void) : m_field_names (), m_parent_class_names () { } OCTINTERP_API exemplar_info (const octave_value& obj); exemplar_info (const exemplar_info& x) - : field_names (x.field_names), - parent_class_names (x.parent_class_names) { } + : m_field_names (x.m_field_names), + m_parent_class_names (x.m_parent_class_names) { } exemplar_info& operator = (const exemplar_info& x) { if (&x != this) { - field_names = x.field_names; - parent_class_names = x.parent_class_names; + m_field_names = x.m_field_names; + m_parent_class_names = x.m_parent_class_names; } return *this; } - octave_idx_type nfields (void) const { return field_names.numel (); } + octave_idx_type nfields (void) const { return m_field_names.numel (); } - size_t nparents (void) const { return parent_class_names.size (); } + size_t nparents (void) const { return m_parent_class_names.size (); } - string_vector fields (void) const { return field_names; } + string_vector fields (void) const { return m_field_names; } - std::list<std::string> parents (void) const { return parent_class_names; } + std::list<std::string> parents (void) const { return m_parent_class_names; } OCTINTERP_API bool compare (const octave_value& obj) const; private: - string_vector field_names; - std::list<std::string> parent_class_names; + string_vector m_field_names; + std::list<std::string> m_parent_class_names; }; // A map from class names to lists of fields.
--- a/libinterp/octave-value/ov-classdef.cc Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-classdef.cc Sun Mar 28 15:35:05 2021 -0400 @@ -76,7 +76,7 @@ size_t skip = 0; octave_value_list retval; - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (! in_class_method (cls) && ! called_from_builtin ()) { @@ -99,7 +99,7 @@ // At this point, the default subsref mechanism must be used. - retval = object.subsref (type, idx, nargout, skip, octave::cdef_class ()); + retval = m_object.subsref (type, idx, nargout, skip, octave::cdef_class ()); if (type.length () > skip && idx.size () > skip) retval = retval(0).next_subsref (nargout, type, idx, skip); @@ -119,7 +119,7 @@ // assignment with multi-level indexing. AFAIK this is only used for internal // purpose (not sure we should even implement this). - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (! in_class_method (cls)) { @@ -140,7 +140,7 @@ } } - retval = object.subsref (type, idx, 1, skip, octave::cdef_class (), auto_add); + retval = m_object.subsref (type, idx, 1, skip, octave::cdef_class (), auto_add); if (type.length () > skip && idx.size () > skip) retval = retval(0).next_subsref (1, type, idx, skip); @@ -155,7 +155,7 @@ { octave_value retval; - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (! in_class_method (cls) && ! called_from_builtin ()) { @@ -183,7 +183,7 @@ } if (! retval.is_defined ()) - retval = object.subsasgn (type, idx, rhs); + retval = m_object.subsasgn (type, idx, rhs); return retval; } @@ -195,7 +195,7 @@ { if (type.length () == 1 && type[0] == '(') { - object = object.make_array (); + m_object = m_object.make_array (); return subsasgn (type, idx, rhs); } @@ -208,7 +208,7 @@ Matrix octave_classdef::size (void) { - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (! in_class_method (cls) && ! called_from_builtin ()) { @@ -236,7 +236,7 @@ { octave_idx_type retval = -1; - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (! in_class_method (cls) && ! called_from_builtin ()) { @@ -287,16 +287,16 @@ void octave_classdef::print_raw (std::ostream& os, bool) const { - octave::cdef_class cls = object.get_class (); + octave::cdef_class cls = m_object.get_class (); if (cls.ok ()) { - bool is_array = object.is_array (); + bool is_array = m_object.is_array (); increment_indent_level (); indent (os); - os << class_name () << " object"; + os << class_name () << " m_object"; if (is_array) os << " array"; os << " with properties:"; @@ -357,7 +357,7 @@ os << " " << nm; else { - octave_value val = prop.get_value (object, false); + octave_value val = prop.get_value (m_object, false); dim_vector dims = val.dims (); os << std::setw (max_len+2) << nm << ": "; @@ -383,7 +383,7 @@ octave::cdef_class cls = octave::lookup_class (cls_name, false, false); if (cls.ok ()) - return is_superclass (cls, object.get_class ()); + return is_superclass (cls, m_object.get_class ()); return false; } @@ -405,13 +405,13 @@ { bool retval = false; - if (object.is_method ()) + if (m_object.is_method ()) { if (cname.empty ()) retval = true; else { - octave::cdef_method meth (object); + octave::cdef_method meth (m_object); return meth.is_defined_in_class (cname); } @@ -424,13 +424,13 @@ { bool retval = false; - if (object.is_class ()) + if (m_object.is_class ()) { if (cname.empty ()) retval = true; else { - octave::cdef_class cls (object); + octave::cdef_class cls (m_object); if (cls.get_name () == cname) retval = true; @@ -442,9 +442,9 @@ std::string octave_classdef_meta::doc_string (const std::string& meth_name) const { - if (object.is_class ()) + if (m_object.is_class ()) { - octave::cdef_class cls (object); + octave::cdef_class cls (m_object); if (meth_name.empty ()) return cls.doc_string ();
--- a/libinterp/octave-value/ov-classdef.h Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-classdef.h Sun Mar 28 15:35:05 2021 -0400 @@ -48,10 +48,10 @@ public: octave_classdef (void) - : octave_base_value (), object () { } + : octave_base_value (), m_object () { } octave_classdef (const octave::cdef_object& obj) - : octave_base_value (), object (obj) { } + : octave_base_value (), m_object (obj) { } octave_classdef (const octave_classdef&) = delete; @@ -61,19 +61,19 @@ octave_base_value * clone (void) const { - return new octave_classdef (object.clone ()); + return new octave_classdef (m_object.clone ()); } octave_base_value * empty_clone (void) const { - return new octave_classdef (object.empty_clone ()); + return new octave_classdef (m_object.empty_clone ()); } octave_classdef * classdef_object_value (bool = false) { return this; } - octave::cdef_object get_object (void) const { return object; } + octave::cdef_object get_object (void) const { return m_object; } - octave::cdef_object& get_object_ref (void) { return object; } + octave::cdef_object& get_object_ref (void) { return m_object; } bool is_defined (void) const { return true; } @@ -118,22 +118,22 @@ OCTINTERP_API octave_idx_type xnumel (const octave_value_list&); - string_vector map_keys (void) const { return object.map_keys (); } + string_vector map_keys (void) const { return m_object.map_keys (); } - octave_map map_value (void) const { return object.map_value (); } + octave_map map_value (void) const { return m_object.map_value (); } - dim_vector dims (void) const { return object.dims (); } + dim_vector dims (void) const { return m_object.dims (); } void set_property (octave_idx_type idx, const std::string& name, const octave_value& pval) { - object.set_property (idx, name, pval); + m_object.set_property (idx, name, pval); } octave_value get_property (octave_idx_type idx, const std::string& name) const { - return object.get_property (idx, name); + return m_object.get_property (idx, name); } static OCTINTERP_API octave_value @@ -145,7 +145,7 @@ int type_id (void) const { return t_id; } std::string type_name (void) const { return t_name; } - std::string class_name (void) const { return object.class_name (); } + std::string class_name (void) const { return m_object.class_name (); } static int static_type_id (void) { return t_id; } static std::string static_type_name (void) { return t_name; } @@ -154,7 +154,7 @@ private: - octave::cdef_object object; + octave::cdef_object m_object; static int t_id; @@ -168,18 +168,18 @@ public: octave_classdef_meta (const octave::cdef_meta_object& obj) - : object (obj) + : m_object (obj) { } octave_classdef_meta (const octave_classdef_meta&) = delete; octave_classdef_meta& operator = (const octave_classdef_meta&) = delete; - ~octave_classdef_meta (void) { object.meta_release (); } + ~octave_classdef_meta (void) { m_object.meta_release (); } bool is_classdef_meta (void) const { return true; } - bool is_package (void) const { return object.is_package(); } + bool is_package (void) const { return m_object.is_package(); } octave_function * function_value (bool = false) { return this; } @@ -193,7 +193,7 @@ const std::list<octave_value_list>& idx, int nargout) { - return object.meta_subsref (type, idx, nargout); + return m_object.meta_subsref (type, idx, nargout); } // Override default call method because we don't push a new stack @@ -217,7 +217,7 @@ } bool accepts_postfix_index (char type) const - { return object.meta_accepts_postfix_index (type); } + { return m_object.meta_accepts_postfix_index (type); } OCTINTERP_API bool is_classdef_method (const std::string& cname = "") const; @@ -228,7 +228,7 @@ private: - octave::cdef_meta_object object; + octave::cdef_meta_object m_object; }; class octave_classdef_superclass_ref : public octave_function
--- a/libinterp/octave-value/ov-usr-fcn.cc Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-usr-fcn.cc Sun Mar 28 15:35:05 2021 -0400 @@ -215,16 +215,16 @@ (const octave::symbol_scope& scope, octave::tree_parameter_list *pl, octave::tree_parameter_list *rl, octave::tree_statement_list *cl) : octave_user_code ("", "", scope, cl, ""), - param_list (pl), ret_list (rl), - lead_comm (), trail_comm (), - location_line (0), location_column (0), - parent_name (), system_fcn_file (false), - num_named_args (param_list ? param_list->length () : 0), - subfunction (false), inline_function (false), - anonymous_function (false), nested_function (false), - class_constructor (none), class_method (none) + m_param_list (pl), m_ret_list (rl), + m_lead_comm (), m_trail_comm (), + m_location_line (0), m_location_column (0), + m_parent_name (), m_system_fcn_file (false), + m_num_named_args (m_param_list ? m_param_list->length () : 0), + m_subfunction (false), m_inline_function (false), + m_anonymous_function (false), m_nested_function (false), + m_class_constructor (none), m_class_method (none) #if defined (HAVE_LLVM) - , jit_info (0) + , m_jit_info (0) #endif { if (cmd_list) @@ -233,20 +233,20 @@ octave_user_function::~octave_user_function (void) { - delete param_list; - delete ret_list; - delete lead_comm; - delete trail_comm; + delete m_param_list; + delete m_ret_list; + delete m_lead_comm; + delete m_trail_comm; #if defined (HAVE_LLVM) - delete jit_info; + delete m_jit_info; #endif } octave_user_function * octave_user_function::define_ret_list (octave::tree_parameter_list *t) { - ret_list = t; + m_ret_list = t; return this; } @@ -327,7 +327,7 @@ if (is_anonymous_function ()) result << "anonymous@" << fcn_file_name () - << ':' << location_line << ':' << location_column; + << ':' << m_location_line << ':' << m_location_column; else if (is_subfunction ()) result << parent_fcn_name () << '>' << name (); else if (is_class_method ()) @@ -336,7 +336,7 @@ result << '@' << name (); else if (is_inline_function ()) result << "inline@" << fcn_file_name () - << ':' << location_line << ':' << location_column; + << ':' << m_location_line << ':' << m_location_column; else result << name (); @@ -361,10 +361,10 @@ std::string fcn_file_dir = octave::config::fcn_file_dir (); if (fcn_file_dir == ff_name.substr (0, fcn_file_dir.length ())) - system_fcn_file = true; + m_system_fcn_file = true; } else - system_fcn_file = false; + m_system_fcn_file = false; } void @@ -376,13 +376,13 @@ bool octave_user_function::takes_varargs (void) const { - return (param_list && param_list->takes_varargs ()); + return (m_param_list && m_param_list->takes_varargs ()); } bool octave_user_function::takes_var_return (void) const { - return (ret_list && ret_list->takes_varargs ()); + return (m_ret_list && m_ret_list->takes_varargs ()); } void @@ -465,10 +465,10 @@ { octave_value_list retval; - octave_idx_type n = args.length () - num_named_args; + octave_idx_type n = args.length () - m_num_named_args; if (n > 0) - retval = args.slice (num_named_args, n); + retval = args.slice (m_num_named_args, n); return retval; } @@ -517,12 +517,12 @@ { bool retval = false; if (Voptimize_subsasgn_calls - && param_list && ret_list - && param_list->length () > 0 && ! param_list->varargs_only () - && ret_list->length () == 1 && ! ret_list->takes_varargs ()) + && m_param_list && m_ret_list + && m_param_list->length () > 0 && ! m_param_list->varargs_only () + && m_ret_list->length () == 1 && ! m_ret_list->takes_varargs ()) { - octave::tree_identifier *par1 = param_list->front ()->ident (); - octave::tree_identifier *ret1 = ret_list->front ()->ident (); + octave::tree_identifier *par1 = m_param_list->front ()->ident (); + octave::tree_identifier *ret1 = m_ret_list->front ()->ident (); retval = par1->name () == ret1->name (); } @@ -534,7 +534,7 @@ { std::string retval; - switch (class_constructor) + switch (m_class_constructor) { case none: retval = "none"; @@ -561,7 +561,7 @@ { std::string retval; - switch (class_method) + switch (m_class_method) { case none: retval = "none"; @@ -588,19 +588,19 @@ { std::map<std::string, octave_value> m = {{ "user_code", octave_user_code::dump () }, - { "line", location_line }, - { "col", location_column }, - { "end_line", end_location_line }, - { "end_col", end_location_column }, - { "parent_name", parent_name }, - { "system_fcn_file", system_fcn_file }, - { "num_named_args", num_named_args }, - { "subfunction", subfunction }, - { "inline_function", inline_function }, - { "anonymous_function", anonymous_function }, - { "nested_function", nested_function }, + { "line", m_location_line }, + { "col", m_location_column }, + { "end_line", m_end_location_line }, + { "end_col", m_end_location_column }, + { "parent_name", m_parent_name }, + { "system_fcn_file", m_system_fcn_file }, + { "num_named_args", m_num_named_args }, + { "subfunction", m_subfunction }, + { "inline_function", m_inline_function }, + { "anonymous_function", m_anonymous_function }, + { "nested_function", m_nested_function }, { "ctor_type", ctor_type_str () }, - { "class_method", class_method }}; + { "class_method", m_class_method }}; return octave_value (m); } @@ -720,9 +720,9 @@ type.c_str ()); } - octave::tree_parameter_list *param_list = fcn->parameter_list (); + octave::tree_parameter_list *m_param_list = fcn->parameter_list (); - retval = (param_list ? param_list->length () : 0); + retval = (m_param_list ? m_param_list->length () : 0); if (fcn->takes_varargs ()) retval = -1 - retval; } @@ -842,9 +842,9 @@ type.c_str ()); } - octave::tree_parameter_list *ret_list = fcn->return_list (); + octave::tree_parameter_list *m_ret_list = fcn->return_list (); - retval = (ret_list ? ret_list->length () : 0); + retval = (m_ret_list ? m_ret_list->length () : 0); if (fcn->takes_var_return ()) retval = -1 - retval;
--- a/libinterp/octave-value/ov-usr-fcn.h Sat Mar 27 09:26:12 2021 +0100 +++ b/libinterp/octave-value/ov-usr-fcn.h Sun Mar 28 15:35:05 2021 -0400 @@ -238,35 +238,35 @@ void stash_fcn_location (int line, int col) { - location_line = line; - location_column = col; + m_location_line = line; + m_location_column = col; } - int beginning_line (void) const { return location_line; } - int beginning_column (void) const { return location_column; } + int beginning_line (void) const { return m_location_line; } + int beginning_column (void) const { return m_location_column; } void stash_fcn_end_location (int line, int col) { - end_location_line = line; - end_location_column = col; + m_end_location_line = line; + m_end_location_column = col; } - int ending_line (void) const { return end_location_line; } - int ending_column (void) const { return end_location_column; } + int ending_line (void) const { return m_end_location_line; } + int ending_column (void) const { return m_end_location_column; } void maybe_relocate_end (void); - void stash_parent_fcn_name (const std::string& p) { parent_name = p; } + void stash_parent_fcn_name (const std::string& p) { m_parent_name = p; } void stash_parent_fcn_scope (const octave::symbol_scope& ps); - void stash_leading_comment (octave::comment_list *lc) { lead_comm = lc; } + void stash_leading_comment (octave::comment_list *lc) { m_lead_comm = lc; } - void stash_trailing_comment (octave::comment_list *tc) { trail_comm = tc; } + void stash_trailing_comment (octave::comment_list *tc) { m_trail_comm = tc; } std::string profiler_name (void) const; - std::string parent_fcn_name (void) const { return parent_name; } + std::string parent_fcn_name (void) const { return m_parent_name; } octave::symbol_scope parent_fcn_scope (void) const { @@ -280,7 +280,7 @@ void mark_as_system_fcn_file (void); - bool is_system_fcn_file (void) const { return system_fcn_file; } + bool is_system_fcn_file (void) const { return m_system_fcn_file; } bool is_user_function (void) const { return true; } @@ -310,22 +310,22 @@ void stash_function_name (const std::string& s) { my_name = s; } - void mark_as_subfunction (void) { subfunction = true; } + void mark_as_subfunction (void) { m_subfunction = true; } - bool is_subfunction (void) const { return subfunction; } + bool is_subfunction (void) const { return m_subfunction; } - void mark_as_inline_function (void) { inline_function = true; } + void mark_as_inline_function (void) { m_inline_function = true; } - bool is_inline_function (void) const { return inline_function; } + bool is_inline_function (void) const { return m_inline_function; } - void mark_as_anonymous_function (void) { anonymous_function = true; } + void mark_as_anonymous_function (void) { m_anonymous_function = true; } - bool is_anonymous_function (void) const { return anonymous_function; } + bool is_anonymous_function (void) const { return m_anonymous_function; } bool is_anonymous_function_of_class (const std::string& cname = "") const { - return anonymous_function + return m_anonymous_function ? (cname.empty () ? (! dispatch_class ().empty ()) : cname == dispatch_class ()) @@ -340,41 +340,41 @@ return is_inline_function () || is_anonymous_function (); } - void mark_as_nested_function (void) { nested_function = true; } + void mark_as_nested_function (void) { m_nested_function = true; } - bool is_nested_function (void) const { return nested_function; } + bool is_nested_function (void) const { return m_nested_function; } bool is_parent_function (void) const { return m_scope.is_parent (); } - void mark_as_legacy_constructor (void) { class_constructor = legacy; } + void mark_as_legacy_constructor (void) { m_class_constructor = legacy; } bool is_legacy_constructor (const std::string& cname = "") const { - return (class_constructor == legacy + return (m_class_constructor == legacy ? (cname.empty () ? true : cname == dispatch_class ()) : false); } - void mark_as_classdef_constructor (void) { class_constructor = classdef; } + void mark_as_classdef_constructor (void) { m_class_constructor = classdef; } bool is_classdef_constructor (const std::string& cname = "") const { - return (class_constructor == classdef + return (m_class_constructor == classdef ? (cname.empty () ? true : cname == dispatch_class ()) : false); } - void mark_as_legacy_method (void) { class_method = legacy; } + void mark_as_legacy_method (void) { m_class_method = legacy; } bool is_legacy_method (const std::string& cname = "") const { - return (class_method == legacy + return (m_class_method == legacy ? (cname.empty () ? true : cname == dispatch_class ()) : false); } - void mark_as_classdef_method (void) { class_method = classdef; } + void mark_as_classdef_method (void) { m_class_method = classdef; } bool is_classdef_method (const std::string& cname = "") const { - return (class_method == classdef + return (m_class_method == classdef ? (cname.empty () ? true : cname == dispatch_class ()) : false); } @@ -391,13 +391,13 @@ execute (octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list ()); - octave::tree_parameter_list * parameter_list (void) { return param_list; } + octave::tree_parameter_list * parameter_list (void) { return m_param_list; } - octave::tree_parameter_list * return_list (void) { return ret_list; } + octave::tree_parameter_list * return_list (void) { return m_ret_list; } - octave::comment_list * leading_comment (void) { return lead_comm; } + octave::comment_list * leading_comment (void) { return m_lead_comm; } - octave::comment_list * trailing_comment (void) { return trail_comm; } + octave::comment_list * trailing_comment (void) { return m_trail_comm; } // If is_special_expr is true, retrieve the sigular expression that forms the // body. May be null (even if is_special_expr is true). @@ -408,9 +408,9 @@ void accept (octave::tree_walker& tw); #if defined (HAVE_LLVM) - octave::jit_function_info * get_info (void) { return jit_info; } + octave::jit_function_info * get_info (void) { return m_jit_info; } - void stash_info (octave::jit_function_info *info) { jit_info = info; } + void stash_info (octave::jit_function_info *info) { m_jit_info = info; } #endif octave_value dump (void) const; @@ -428,58 +428,58 @@ std::string method_type_str (void) const; // List of arguments for this function. These are local variables. - octave::tree_parameter_list *param_list; + octave::tree_parameter_list *m_param_list; // List of parameters we return. These are also local variables in // this function. - octave::tree_parameter_list *ret_list; + octave::tree_parameter_list *m_ret_list; // The comments preceding the FUNCTION token. - octave::comment_list *lead_comm; + octave::comment_list *m_lead_comm; // The comments preceding the ENDFUNCTION token. - octave::comment_list *trail_comm; + octave::comment_list *m_trail_comm; // Location where this function was defined. - int location_line; - int location_column; - int end_location_line; - int end_location_column; + int m_location_line; + int m_location_column; + int m_end_location_line; + int m_end_location_column; // The name of the parent function, if any. - std::string parent_name; + std::string m_parent_name; // True if this function came from a file that is considered to be a // system function. This affects whether we check the time stamp // on the file to see if it has changed. - bool system_fcn_file; + bool m_system_fcn_file; // The number of arguments that have names. - int num_named_args; + int m_num_named_args; - // TRUE means this is a subfunction of a primary function. - bool subfunction; + // TRUE means this is a m_subfunction of a primary function. + bool m_subfunction; // TRUE means this is an inline function. - bool inline_function; + bool m_inline_function; // TRUE means this is an anonymous function. - bool anonymous_function; + bool m_anonymous_function; // TRUE means this is a nested function. - bool nested_function; + bool m_nested_function; // TRUE means this function contains a nested function. - bool parent_function; + bool m_parent_function; // Enum describing whether this function is the constructor for class object. - class_method_type class_constructor; + class_method_type m_class_constructor; // Enum describing whether this function is a method for a class. - class_method_type class_method; + class_method_type m_class_method; #if defined (HAVE_LLVM) - octave::jit_function_info *jit_info; + octave::jit_function_info *m_jit_info; #endif void maybe_relocate_end_internal (void);