diff libinterp/octave-value/ov-base.cc @ 23680:ef71711f6d64

rework __dump_symbol_table__ function * symtab.h, symtab.cc (F__dump_symtab_info__): Instead of printing results, return a struct containing all the info. (symbol_table::symbol_record::symbol_record_rep::dump, symbol_table::fcn_info::fcn_info_rep::dump, symbol_table::dump, symbol_table::scope::dump): Update interface. Create and return struct. (dump_container_map, symbol_table::dump_fcn_table_map, symbol_table::scope::dump_symbols_map): New functions. (fcn_file_name): Delete static function. (symbol_table::dump_global, symbol_table::dump_functions): Delete. * ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_function::dump): Update interface. Create and return struct. (octave_user_function::ctor_type_str): New function. * ov-base.h, ov-base.cc (octave_base_value::dump): Update interface. Create and return struct. * ov.h (octave_value::dump): Update interface.
author John W. Eaton <jwe@octave.org>
date Thu, 22 Jun 2017 16:23:36 -0400
parents 0549061d35b9
children b89b86d741e6
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc	Thu Jun 22 15:20:46 2017 -0400
+++ b/libinterp/octave-value/ov-base.cc	Thu Jun 22 16:23:36 2017 -0400
@@ -1165,14 +1165,15 @@
   err_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
 }
 
-void
-octave_base_value::dump (std::ostream& os) const
+octave_value
+octave_base_value::dump (void) const
 {
-  dim_vector dv = this->dims ();
+  std::map<std::string, octave_value> m
+    = {{"class", octave_value (this->class_name ())},
+       {"type", octave_value (this->type_name ())},
+       {"dims", octave_value (this->dims().as_array ())}};
 
-  os << "class: " << this->class_name ()
-     << " type: " << this->type_name ()
-     << " dims: " << dv.str ();
+  return octave_value (m);
 }
 
 OCTAVE_NORETURN static