GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-base.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <istream>
31 #include <limits>
32 #include <ostream>
33 
34 #include "lo-ieee.h"
35 #include "lo-mappers.h"
36 
37 #include "defun.h"
38 #include "errwarn.h"
39 #include "interpreter-private.h"
40 #include "interpreter.h"
41 #include "mxarray.h"
42 #include "oct-hdf5.h"
43 #include "oct-lvalue.h"
44 #include "oct-map.h"
45 #include "oct-stream.h"
46 #include "ops.h"
47 #include "ov-base.h"
48 #include "ov-cell.h"
49 #include "ov-ch-mat.h"
50 #include "ov-classdef.h"
51 #include "ov-complex.h"
52 #include "ov-cx-mat.h"
53 #include "ov-fcn-handle.h"
54 #include "ov-range.h"
55 #include "ov-re-mat.h"
56 #include "ov-scalar.h"
57 #include "ov-str-mat.h"
58 #include "ovl.h"
59 #include "parse.h"
60 #include "pr-flt-fmt.h"
61 #include "pr-output.h"
62 #include "utils.h"
63 #include "variables.h"
64 #include "ov-inline.h"
65 
68 {
70 
71  if (x == btyp_bool)
72  x = btyp_double;
73  if (y == btyp_bool)
75 
77  retval = static_cast<builtin_type_t> (x | y);
78  else if (x <= btyp_uint64 && y <= btyp_float)
79  retval = x;
80  else if (x <= btyp_float && y <= btyp_uint64)
81  retval = y;
82  else if ((x >= btyp_int8 && x <= btyp_int64
83  && y >= btyp_int8 && y <= btyp_int64)
84  || (x >= btyp_uint8 && x <= btyp_uint64
85  && y >= btyp_uint8 && y <= btyp_uint64))
86  retval = (x > y) ? x : y;
87 
88  return retval;
89 }
90 
92 {
93  "double", "single", "double", "single",
94  "int8", "int16", "int32", "int64",
95  "uint8", "uint16", "uint32", "uint64",
96  "logical", "char",
97  "struct", "cell", "function_handle", "unknown"
98 };
99 
101  "<unknown type>", "unknown");
102 
103 // DEPRECATED in Octave 8.
104 bool Vsparse_auto_mutate = false;
105 
106 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
107  // Disable this warning for the use of the "count" member variable in
108  // the default constructor. Push the current state so we can restore
109  // the warning state.
110 # pragma GCC diagnostic push
111 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
112 #endif
113 
114  octave_base_value::octave_base_value () : m_count (1), count (m_count) { }
115 
116 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
117 # pragma GCC diagnostic pop
118 #endif
119 
122 {
123  return resize (dim_vector ()).clone ();
124 }
125 
126 // FIXME: Unlike other virtual functions in the octave_base_value
127 // class, the storable_value and make_storable_value functions defined
128 // here are not used by the corresponding octave_value functions. This
129 // inconsistency is likely to cause some confusion.
132 {
133  return octave_value_factory::make_copy (this);
134 }
135 
138 {
139  return this;
140 }
141 
144 {
145  std::string nm = type_name ();
146  error ("squeeze: invalid operation for %s type", nm.c_str ());
147 }
148 
151 {
152  err_wrong_type_arg ("full: invalid operation for %s type", type_name ());
153 }
154 
157 {
158  err_invalid_conversion (type_name (), "double");
159 }
160 
163 {
164  const octave_base_value * cthis = this;
165  return cthis->as_double ();
166 }
167 
170 {
171  err_invalid_conversion (type_name (), "single");
172 }
173 
176 {
177  err_invalid_conversion (type_name (), "int8");
178 }
179 
182 {
183  err_invalid_conversion (type_name (), "int16");
184 }
185 
188 {
189  err_invalid_conversion (type_name (), "int32");
190 }
191 
194 {
195  err_invalid_conversion (type_name (), "int64");
196 }
197 
200 {
201  err_invalid_conversion (type_name (), "uint8");
202 }
203 
206 {
207  err_invalid_conversion (type_name (), "uint16");
208 }
209 
212 {
213  err_invalid_conversion (type_name (), "uint32");
214 }
215 
218 {
219  err_invalid_conversion (type_name (), "uint64");
220 }
221 
222 Matrix
224 {
225  const dim_vector dv = dims ();
226  Matrix mdv (1, dv.ndims ());
227  for (octave_idx_type i = 0; i < dv.ndims (); i++)
228  mdv(i) = dv(i);
229  return mdv;
230 }
231 
234 {
235  return octave::dims_to_numel (dims (), idx);
236 }
237 
240 simple_subsref (char type, octave_value_list& idx, int nargout)
241 {
242  std::list<octave_value_list> idx_list;
243  idx_list.push_back (idx);
244  return subsref (std::string {type}, idx_list, nargout);
245 }
246 
248 octave_base_value::subsref (const std::string&,
249  const std::list<octave_value_list>&)
250 {
251  std::string nm = type_name ();
252  error ("can't perform indexing operations for %s type", nm.c_str ());
253 }
254 
256 octave_base_value::subsref (const std::string&,
257  const std::list<octave_value_list>&, int)
258 {
259  std::string nm = type_name ();
260  error ("can't perform indexing operations for %s type", nm.c_str ());
261 }
262 
264 octave_base_value::subsref (const std::string& type,
265  const std::list<octave_value_list>& idx,
266  bool /* auto_add */)
267 {
268  // This way we may get a more meaningful error message.
269  return subsref (type, idx);
270 }
271 
274 {
275  std::string nm = type_name ();
276  error ("can't perform indexing operations for %s type", nm.c_str ());
277 }
278 
280 octave_base_value::index_vector (bool /* require_integers */) const
281 {
282  std::string nm = '<' + type_name () + '>';
283  octave::err_invalid_index (nm.c_str ());
284 }
285 
288  const octave_value& rhs)
289 {
290  std::list<octave_value_list> idx_list;
291  idx_list.push_back (idx);
292 
293  return subsasgn (std::string {type}, idx_list, rhs);
294 }
295 
297 octave_base_value::subsasgn (const std::string& type,
298  const std::list<octave_value_list>& idx,
299  const octave_value& rhs)
300 {
301  octave_value retval;
302 
303  if (is_defined ())
304  {
305  if (! isnumeric ())
306  {
307  std::string nm = type_name ();
308  error ("can't perform indexed assignment for %s type", nm.c_str ());
309  }
310 
311  switch (type[0])
312  {
313  case '(':
314  {
315  if (type.length () == 1)
316  retval = numeric_assign (type, idx, rhs);
317  else if (isempty ())
318  {
319  // Allow conversion of empty matrix to some other
320  // type in cases like
321  //
322  // x = []; x(i).f = rhs
323 
324  octave_value tmp = octave_value::empty_conv (type, rhs);
325 
326  retval = tmp.subsasgn (type, idx, rhs);
327  }
328  else
329  {
330  std::string nm = type_name ();
331  error ("in indexed assignment of %s, last rhs index must be ()",
332  nm.c_str ());
333  }
334  }
335  break;
336 
337  case '{':
338  case '.':
339  {
340  std::string nm = type_name ();
341  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
342  }
343  break;
344 
345  default:
346  panic_impossible ();
347  }
348  }
349  else
350  {
351  // Create new object of appropriate type for given index and rhs
352  // types and then call undef_subsasgn for that object.
353 
354  octave_value tmp = octave_value::empty_conv (type, rhs);
355 
356  retval = tmp.undef_subsasgn (type, idx, rhs);
357  }
358 
359  return retval;
360 }
361 
363 octave_base_value::undef_subsasgn (const std::string& type,
364  const std::list<octave_value_list>& idx,
365  const octave_value& rhs)
366 {
367  // In most cases, undef_subsasgn is handled the sams as subsasgn. One
368  // exception is octave_class objects.
369 
370  return subsasgn (type, idx, rhs);
371 }
372 
375 {
376  err_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
377 }
378 
381 {
382  return numel ();
383 }
384 
387 {
388  err_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
389 }
390 
393 {
394  err_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
395 }
396 
399 {
400  err_wrong_type_arg ("octave_base_value::permute ()", type_name ());
401 }
402 
405 {
406  err_wrong_type_arg ("octave_base_value::resize ()", type_name ());
407 }
408 
411 {
412  err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
413 }
414 
417 {
418  err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
419 }
420 
423 {
424  return 0.0;
425 }
426 
429 {
430  return 0.0;
431 }
432 
434 octave_base_value::convert_to_str (bool pad, bool force, char type) const
435 {
436  octave_value retval = convert_to_str_internal (pad, force, type);
437 
438  if (! force && isnumeric ())
439  warn_implicit_conversion ("Octave:num-to-str",
440  type_name (), retval.type_name ());
441 
442  return retval;
443 }
444 
447 {
448  err_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
449  type_name ());
450 }
451 
452 void
454 {
456  ("octave_base_value::convert_to_row_or_column_vector ()", type_name ());
457 }
458 
459 void
460 octave_base_value::print (std::ostream&, bool)
461 {
462  err_wrong_type_arg ("octave_base_value::print ()", type_name ());
463 }
464 
465 void
466 octave_base_value::print_raw (std::ostream&, bool) const
467 {
468  err_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
469 }
470 
471 bool
473  const std::string& name) const
474 {
475  indent (os);
476 
477  if (print_as_scalar ())
478  os << name << " = ";
479  else
480  {
481  os << name << " =";
482  newline (os);
483  if (! Vcompact_format)
484  newline (os);
485 
486  return true;
487  }
488 
489  return false;
490 }
491 
492 void
493 octave_base_value::print_with_name (std::ostream& output_buf,
494  const std::string& name,
495  bool print_padding)
496 {
497  bool pad_after = print_name_tag (output_buf, name);
498 
499  print (output_buf);
500 
501  if (print_padding && pad_after && ! Vcompact_format)
502  newline (output_buf);
503 }
504 
507 {
508  return float_display_format ();
509 }
510 
511 void
513  const std::string& /* prefix */) const
514 {
515  os << "no info for type: " << type_name () << "\n";
516 }
517 
518 #define INT_CONV_METHOD(T, F) \
519  T \
520  octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
521  { \
522  T retval = 0; \
523  \
524  double d = 0.0; \
525  \
526  try \
527  { \
528  d = double_value (frc_str_conv); \
529  } \
530  catch (octave::execution_exception& ee) \
531  { \
532  err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \
533  } \
534  \
535  static const double out_of_range_top \
536  = static_cast<double> (std::numeric_limits<T>::max ()) + 1.; \
537  if (require_int && octave::math::x_nint (d) != d) \
538  error_with_cfn ("conversion of %g to " #T " value failed", d); \
539  else if (d < std::numeric_limits<T>::min ()) \
540  retval = std::numeric_limits<T>::min (); \
541  else if (d >= out_of_range_top) \
542  retval = std::numeric_limits<T>::max (); \
543  else \
544  retval = static_cast<T> (octave::math::fix (d)); \
545  \
546  return retval; \
547  }
548 
549 INT_CONV_METHOD (short int, short)
550 INT_CONV_METHOD (unsigned short int, ushort)
551 
552 INT_CONV_METHOD (int, int)
553 INT_CONV_METHOD (unsigned int, uint)
554 
555 INT_CONV_METHOD (long int, long)
556 INT_CONV_METHOD (unsigned long int, ulong)
557 
558 INT_CONV_METHOD (int64_t, int64)
559 INT_CONV_METHOD (uint64_t, uint64)
560 
561 int
562 octave_base_value::nint_value (bool frc_str_conv) const
563 {
564  double d = 0.0;
565 
566  try
567  {
568  d = double_value (frc_str_conv);
569  }
570  catch (octave::execution_exception& ee)
571  {
572  err_wrong_type_arg (ee, "octave_base_value::nint_value ()", type_name ());
573  }
574 
575  if (octave::math::isnan (d))
576  error ("conversion of NaN to integer value failed");
577 
578  return static_cast<int> (octave::math::fix (d));
579 }
580 
581 double
583 {
584  err_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
585 }
586 
587 float
589 {
590  err_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
591 }
592 
593 Cell
595 {
596  err_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
597 }
598 
599 Matrix
601 {
602  err_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
603 }
604 
607 {
608  err_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ());
609 }
610 
611 NDArray
613 {
614  err_wrong_type_arg ("octave_base_value::array_value()", type_name ());
615 }
616 
619 {
620  err_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
621 }
622 
623 Complex
625 {
626  err_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
627 }
628 
631 {
632  err_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ());
633 }
634 
637 {
638  err_wrong_type_arg ("octave_base_value::complex_matrix_value()",
639  type_name ());
640 }
641 
644 {
645  err_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
646  type_name ());
647 }
648 
651 {
652  err_wrong_type_arg ("octave_base_value::complex_array_value()", type_name ());
653 }
654 
657 {
658  err_wrong_type_arg ("octave_base_value::float_complex_array_value()",
659  type_name ());
660 }
661 
662 bool
664 {
665  err_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
666 }
667 
670 {
671  err_wrong_type_arg ("octave_base_value::bool_matrix_value()", type_name ());
672 }
673 
676 {
677  err_wrong_type_arg ("octave_base_value::bool_array_value()", type_name ());
678 }
679 
682 {
683  octave_value tmp = convert_to_str (false, force);
684 
685  return tmp.char_matrix_value ();
686 }
687 
690 {
691  err_wrong_type_arg ("octave_base_value::char_array_value()", type_name ());
692 }
693 
696 {
697  err_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ());
698 }
699 
702 {
703  err_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()",
704  type_name ());
705 }
706 
709 {
710  err_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()",
711  type_name ());
712 }
713 
716 {
717  err_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
718 }
719 
722 {
723  err_wrong_type_arg ("octave_base_value::float_diag_matrix_value()",
724  type_name ());
725 }
726 
729 {
730  err_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()",
731  type_name ());
732 }
733 
736 {
737  err_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()",
738  type_name ());
739 }
740 
743 {
744  err_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
745 }
746 
749 {
750  err_wrong_type_arg ("octave_base_value::int8_scalar_value()", type_name ());
751 }
752 
755 {
756  err_wrong_type_arg ("octave_base_value::int16_scalar_value()", type_name ());
757 }
758 
761 {
762  err_wrong_type_arg ("octave_base_value::int32_scalar_value()", type_name ());
763 }
764 
767 {
768  err_wrong_type_arg ("octave_base_value::int64_scalar_value()", type_name ());
769 }
770 
773 {
774  err_wrong_type_arg ("octave_base_value::uint8_scalar_value()", type_name ());
775 }
776 
779 {
780  err_wrong_type_arg ("octave_base_value::uint16_scalar_value()", type_name ());
781 }
782 
785 {
786  err_wrong_type_arg ("octave_base_value::uint32_scalar_value()", type_name ());
787 }
788 
791 {
792  err_wrong_type_arg ("octave_base_value::uint64_scalar_value()", type_name ());
793 }
794 
797 {
798  err_wrong_type_arg ("octave_base_value::int8_array_value()", type_name ());
799 }
800 
803 {
804  err_wrong_type_arg ("octave_base_value::int16_array_value()", type_name ());
805 }
806 
809 {
810  err_wrong_type_arg ("octave_base_value::int32_array_value()", type_name ());
811 }
812 
815 {
816  err_wrong_type_arg ("octave_base_value::int64_array_value()", type_name ());
817 }
818 
821 {
822  err_wrong_type_arg ("octave_base_value::uint8_array_value()", type_name ());
823 }
824 
827 {
828  err_wrong_type_arg ("octave_base_value::uint16_array_value()", type_name ());
829 }
830 
833 {
834  err_wrong_type_arg ("octave_base_value::uint32_array_value()", type_name ());
835 }
836 
839 {
840  err_wrong_type_arg ("octave_base_value::uint64_array_value()", type_name ());
841 }
842 
845 {
846  octave_value tmp = convert_to_str (pad, true);
847 
848  return tmp.string_vector_value ();
849 }
850 
851 std::string
853 {
854  octave_value tmp = convert_to_str (force);
855 
856  return tmp.string_value ();
857 }
858 
859 std::string
861 {
862  wrong_type_arg_error ();
863 
864  return std::string ();
865 }
866 
869 {
870  err_wrong_type_arg ("octave_base_value::cellstr_value()", type_name ());
871 }
872 
873 octave::range<double>
875 {
876  err_wrong_type_arg ("octave_base_value::range_value()", type_name ());
877 }
878 
879 // For now, enable only range<double>.
880 
883 {
884  err_wrong_type_arg ("octave_base_value::map_value()", type_name ());
885 }
886 
889 {
890  octave_map tmp = map_value ();
891 
892  if (tmp.numel () != 1)
893  error ("invalid conversion of multi-dimensional struct to scalar struct");
894 
895  return octave_scalar_map (tmp.checkelem (0));
896 }
897 
900 {
901  err_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
902 }
903 
904 bool
905 octave_base_value::isfield (const std::string&) const
906 {
907  err_wrong_type_arg ("octave_base_value::isfield()", type_name ());
908 }
909 
910 std::size_t
912 {
913  err_wrong_type_arg ("octave_base_value::nparents()", type_name ());
914 }
915 
916 std::list<std::string>
918 {
919  err_wrong_type_arg ("octave_base_value::parent_class_name_list()",
920  type_name ());
921 }
922 
925 {
926  err_wrong_type_arg ("octave_base_value::parent_class_names()", type_name ());
927 }
928 
931 {
932  if (! silent)
933  err_wrong_type_arg ("octave_base_value::classdef_object_value()",
934  type_name ());
935 
936  return nullptr;
937 }
938 
941 {
942  if (! silent)
943  err_wrong_type_arg ("octave_base_value::function_value()", type_name ());
944 
945  return nullptr;
946 }
947 
950 {
951  if (! silent)
952  err_wrong_type_arg ("octave_base_value::user_function_value()",
953  type_name ());
954  return nullptr;
955 }
956 
959 {
960  if (! silent)
961  err_wrong_type_arg ("octave_base_value::user_script_value()", type_name ());
962 
963  return nullptr;
964 }
965 
968 {
969  if (! silent)
970  err_wrong_type_arg ("octave_base_value::user_code_value()", type_name ());
971 
972  return nullptr;
973 }
974 
977 {
978  if (! silent)
979  err_wrong_type_arg ("octave_base_value::fcn_handle_value()", type_name ());
980 
981  return nullptr;
982 }
983 
986 {
987  err_wrong_type_arg ("octave_base_value::list_value()", type_name ());
988 }
989 
990 bool
992 {
993  err_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
994 }
995 
996 bool
998 {
999  err_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
1000 }
1001 
1002 bool
1003 octave_base_value::save_binary (std::ostream&, bool)
1004 {
1005  err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
1006 }
1007 
1008 bool
1009 octave_base_value::load_binary (std::istream&, bool,
1011 {
1012  err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
1013 }
1014 
1015 bool
1017 {
1018  err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
1019 }
1020 
1021 bool
1023 {
1024  err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
1025 }
1026 
1027 int
1030 {
1031  err_wrong_type_arg ("octave_base_value::write()", type_name ());
1032 }
1033 
1034 mxArray *
1036 {
1037  return nullptr;
1038 }
1039 
1042 {
1043  err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
1044 }
1045 
1048 {
1049  err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
1050 }
1051 
1054 {
1055  err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
1056 }
1057 
1060  octave_idx_type, sortmode) const
1061 {
1062  err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
1063 }
1064 
1065 sortmode
1067 {
1068  err_wrong_type_arg ("octave_base_value::issorted ()", type_name ());
1069 }
1070 
1073 {
1074  err_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
1075 }
1076 
1077 sortmode
1079 {
1080  err_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
1081 }
1082 
1083 const char *
1085 {
1086  static const char *names[num_unary_mappers] =
1087  {
1088  "abs",
1089  "acos",
1090  "acosh",
1091  "angle",
1092  "arg",
1093  "asin",
1094  "asinh",
1095  "atan",
1096  "atanh",
1097  "cbrt",
1098  "ceil",
1099  "conj",
1100  "cos",
1101  "cosh",
1102  "erf",
1103  "erfinv",
1104  "erfcinv",
1105  "erfc",
1106  "erfcx",
1107  "erfi",
1108  "dawson",
1109  "exp",
1110  "expm1",
1111  "isfinite",
1112  "fix",
1113  "floor",
1114  "gamma",
1115  "imag",
1116  "isinf",
1117  "isna",
1118  "isnan",
1119  "lgamma",
1120  "log",
1121  "log2",
1122  "log10",
1123  "log1p",
1124  "real",
1125  "round",
1126  "roundb",
1127  "signum",
1128  "sin",
1129  "sinh",
1130  "sqrt",
1131  "tan",
1132  "tanh",
1133  "isalnum",
1134  "isalpha",
1135  "isascii",
1136  "iscntrl",
1137  "isdigit",
1138  "isgraph",
1139  "islower",
1140  "isprint",
1141  "ispunct",
1142  "isspace",
1143  "isupper",
1144  "isxdigit",
1145  "signbit",
1146  "tolower",
1147  "toupper"
1148  };
1149 
1150  if (umap < 0 || umap >= num_unary_mappers)
1151  return "unknown";
1152  else
1153  return names[umap];
1154 }
1155 
1156 void
1157 octave_base_value::warn_load (const char *type) const
1158 {
1160  ("Octave:load-save-unavailable",
1161  "%s: loading %s files not available in this version of Octave",
1162  s_t_name.c_str (), type);
1163 }
1164 
1165 void
1166 octave_base_value::warn_save (const char *type) const
1167 {
1169  ("Octave:load-save-unavailable",
1170  "%s: saving %s files not available in this version of Octave",
1171  s_t_name.c_str (), type);
1172 }
1173 
1174 void
1175 octave_base_value::wrong_type_arg_error () const
1176 {
1178 }
1179 
1182 {
1183  error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
1184 }
1185 
1186 void
1188 {
1189  err_wrong_type_arg ("octave_base_value::lock ()", type_name ());
1190 }
1191 
1192 void
1194 {
1195  err_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
1196 }
1197 
1200 {
1201  std::map<std::string, octave_value> m
1202  = {{ "class", this->class_name () },
1203  { "type", this->type_name () },
1204  { "dims", this->dims().as_array () }
1205  };
1206 
1207  return octave_value (m);
1208 }
1209 
1210 OCTAVE_NORETURN static
1211 void
1212 err_indexed_assignment (const std::string& tn1, const std::string& tn2)
1213 {
1214  error ("assignment of '%s' to indexed '%s' not implemented",
1215  tn2.c_str (), tn1.c_str ());
1216 }
1217 
1218 OCTAVE_NORETURN static
1219 void
1220 err_assign_conversion_failed (const std::string& tn1, const std::string& tn2)
1221 {
1222  error ("type conversion for assignment of '%s' to indexed '%s' failed",
1223  tn2.c_str (), tn1.c_str ());
1224 }
1225 
1226 OCTAVE_NORETURN static
1227 void
1228 err_no_conversion (const std::string& on, const std::string& tn1,
1229  const std::string& tn2)
1230 {
1231  error ("operator %s: no conversion for assignment of '%s' to indexed '%s'",
1232  on.c_str (), tn2.c_str (), tn1.c_str ());
1233 }
1234 
1236 octave_base_value::numeric_assign (const std::string& type,
1237  const std::list<octave_value_list>& idx,
1238  const octave_value& rhs)
1239 {
1240  octave_value retval;
1241 
1242  if (idx.front ().empty ())
1243  error ("missing index in indexed assignment");
1244 
1245  int t_lhs = type_id ();
1246  int t_rhs = rhs.type_id ();
1247 
1248  octave::type_info& ti = octave::__get_type_info__ ();
1249 
1251  = ti.lookup_assign_op (octave_value::op_asn_eq, t_lhs, t_rhs);
1252 
1253  bool done = false;
1254 
1255  if (f)
1256  {
1257  f (*this, idx.front (), rhs.get_rep ());
1258 
1259  done = true;
1260  }
1261 
1262  if (done)
1263  {
1264  m_count++;
1265  retval = octave_value (this);
1266  }
1267  else
1268  {
1269  int t_result = ti.lookup_pref_assign_conv (t_lhs, t_rhs);
1270 
1271  if (t_result >= 0)
1272  {
1274  = ti.lookup_widening_op (t_lhs, t_result);
1275 
1276  if (! cf)
1277  err_indexed_assignment (type_name (), rhs.type_name ());
1278 
1279  octave_base_value *tmp = cf (*this);
1280 
1281  if (! tmp)
1282  err_assign_conversion_failed (type_name (), rhs.type_name ());
1283 
1284  octave_value val (tmp);
1285 
1286  retval = val.subsasgn (type, idx, rhs);
1287 
1288  done = true;
1289  }
1290 
1291  if (! done)
1292  {
1293  octave_value tmp_rhs;
1294 
1296  = rhs.numeric_conversion_function ();
1297 
1300 
1301  // Try biased (one-sided) conversions first.
1302  if (cf_rhs.type_id () >= 0
1303  && (ti.lookup_assign_op (octave_value::op_asn_eq,
1304  t_lhs, cf_rhs.type_id ())
1305  || ti.lookup_pref_assign_conv (t_lhs,
1306  cf_rhs.type_id ()) >= 0))
1307  cf_this = nullptr;
1308  else if (cf_this.type_id () >= 0
1309  && (ti.lookup_assign_op (octave_value::op_asn_eq,
1310  cf_this.type_id (), t_rhs)
1311  || ti.lookup_pref_assign_conv (cf_this.type_id (),
1312  t_rhs) >= 0))
1313  cf_rhs = nullptr;
1314 
1315  if (cf_rhs)
1316  {
1317  octave_base_value *tmp = cf_rhs (rhs.get_rep ());
1318 
1319  if (! tmp)
1320  err_assign_conversion_failed (type_name (), rhs.type_name ());
1321 
1322  tmp_rhs = octave_value (tmp);
1323  }
1324  else
1325  tmp_rhs = rhs;
1326 
1327  m_count++;
1328  octave_value tmp_lhs = octave_value (this);
1329 
1330  if (cf_this)
1331  {
1332  octave_base_value *tmp = cf_this (*this);
1333 
1334  if (! tmp)
1335  err_assign_conversion_failed (type_name (), rhs.type_name ());
1336 
1337  tmp_lhs = octave_value (tmp);
1338  }
1339 
1340  if (! cf_this && ! cf_rhs)
1341  err_no_conversion (octave_value::assign_op_as_string
1343  type_name (), rhs.type_name ());
1344 
1345  retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
1346 
1347  done = true;
1348  }
1349  }
1350 
1351  // The assignment may have converted to a type that is wider than necessary.
1352 
1353  retval.maybe_mutate ();
1354 
1355  return retval;
1356 }
1357 
1358 // Current indentation.
1359 int octave_base_value::s_curr_print_indent_level = 0;
1360 
1361 // TRUE means we are at the beginning of a line.
1362 bool octave_base_value::s_beginning_of_line = true;
1363 
1364 // Each print() function should call this before printing anything.
1365 //
1366 // This doesn't need to be fast, but isn't there a better way?
1367 
1368 void
1369 octave_base_value::indent (std::ostream& os) const
1370 {
1371  panic_unless (s_curr_print_indent_level >= 0);
1372 
1373  if (s_beginning_of_line)
1374  {
1375  // FIXME: do we need this?
1376  // os << prefix;
1377 
1378  for (int i = 0; i < s_curr_print_indent_level; i++)
1379  os << ' ';
1380 
1381  s_beginning_of_line = false;
1382  }
1383 }
1384 
1385 // All print() functions should use this to print new lines.
1386 
1387 void
1388 octave_base_value::newline (std::ostream& os) const
1389 {
1390  os << "\n";
1391 
1392  s_beginning_of_line = true;
1393 }
1394 
1395 // For resetting print state.
1396 
1397 void
1399 {
1400  s_beginning_of_line = true;
1401  s_curr_print_indent_level = 0;
1402 }
1403 
1406 {
1407  return octave_value ();
1408 }
1409 
1410 bool
1412 {
1413  return false;
1414 }
1415 
1416 bool
1418 {
1419  return false;
1420 }
1421 
1422 static octave_base_value *
1423 oct_conv_matrix_conv (const octave_base_value&)
1424 {
1425  return new octave_matrix ();
1426 }
1427 
1428 static octave_base_value *
1429 oct_conv_complex_matrix_conv (const octave_base_value&)
1430 {
1431  return new octave_complex_matrix ();
1432 }
1433 
1434 static octave_base_value *
1435 oct_conv_string_conv (const octave_base_value&)
1436 {
1437  return new octave_char_matrix_str ();
1438 }
1439 
1440 static octave_base_value *
1441 oct_conv_cell_conv (const octave_base_value&)
1442 {
1443  return new octave_cell ();
1444 }
1445 
1446 static inline octave_value_list
1447 sanitize (const octave_value_list& ovl)
1448 {
1449  octave_value_list retval = ovl;
1450 
1451  for (octave_idx_type i = 0; i < ovl.length (); i++)
1452  {
1453  if (retval(i).is_magic_colon ())
1454  retval(i) = ":";
1455  }
1456 
1457  return retval;
1458 }
1459 
1461 make_idx_args (const std::string& type,
1462  const std::list<octave_value_list>& idx,
1463  const std::string& who)
1464 {
1465  std::size_t len = type.length ();
1466 
1467  if (len != idx.size ())
1468  error ("invalid index for %s", who.c_str ());
1469 
1470  Cell type_field (1, len);
1471  Cell subs_field (1, len);
1472 
1473  auto p = idx.begin ();
1474 
1475  for (std::size_t i = 0; i < len; i++)
1476  {
1477  char t = type[i];
1478 
1479  switch (t)
1480  {
1481  case '(':
1482  type_field(i) = "()";
1483  subs_field(i) = Cell (sanitize (*p++));
1484  break;
1485 
1486  case '{':
1487  type_field(i) = "{}";
1488  subs_field(i) = Cell (sanitize (*p++));
1489  break;
1490 
1491  case '.':
1492  {
1493  type_field(i) = ".";
1494 
1495  octave_value_list vlist = *p++;
1496 
1497  if (vlist.length () != 1)
1498  error ("only single argument permitted for '.' index");
1499 
1500  octave_value val = vlist(0);
1501 
1502  if (! val.is_string ())
1503  error ("string argument required for '.' index");
1504 
1505  subs_field(i) = val;
1506  }
1507  break;
1508 
1509  default:
1510  panic_impossible ();
1511  break;
1512  }
1513  }
1514 
1515  octave_map m;
1516 
1517  m.assign ("type", type_field);
1518  m.assign ("subs", subs_field);
1519 
1520  return m;
1521 }
1522 
1523 bool
1525 {
1526  octave::tree_evaluator& tw = octave::__get_evaluator__ ();
1527 
1528  octave_function *fcn = tw.caller_function ();
1529 
1530  // FIXME: we probably need a better check here, or some other
1531  // mechanism to avoid overloaded functions when builtin is used.
1532  // For example, what if someone overloads the builtin function?
1533  // Also, are there other places where using builtin is not properly
1534  // avoiding dispatch?
1535 
1536  return (fcn && fcn->name () == "builtin");
1537 }
1538 
1540 
1541 void
1542 install_base_type_conversions (octave::type_info& ti)
1543 {
1554 
1557  complex_matrix_conv);
1560 }
1561 
1562 OCTAVE_END_NAMESPACE(octave)
Definition: Cell.h:43
Definition: dMatrix.h:42
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
Array< octave_idx_type > as_array() const
Definition: dim-vector.cc:266
octave_idx_type ndims() const
Number of dimensions.
Definition: dim-vector.h:257
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-base.cc:1022
virtual SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-base.cc:695
virtual octave_value full_value() const
Definition: ov-base.cc:150
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-base.cc:248
virtual float float_value(bool=false) const
Definition: ov-base.cc:588
virtual octave_base_value * make_storable_value()
Definition: ov-base.cc:137
virtual bool save_ascii(std::ostream &os)
Definition: ov-base.cc:991
virtual octave_int16 int16_scalar_value() const
Definition: ov-base.cc:754
virtual octave::range< double > range_value() const
Definition: ov-base.cc:874
virtual octave_value as_double() const
Definition: ov-base.cc:156
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:735
virtual octave_idx_type numel() const
Definition: ov-base.h:391
virtual uint16NDArray uint16_array_value() const
Definition: ov-base.cc:826
virtual ComplexNDArray complex_array_value(bool=false) const
Definition: ov-base.cc:650
virtual void print_with_name(std::ostream &output_buf, const std::string &name, bool print_padding=true)
Definition: ov-base.cc:493
virtual octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-base.cc:1405
virtual boolNDArray bool_array_value(bool=false) const
Definition: ov-base.cc:675
virtual bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov-base.cc:472
virtual uint32NDArray uint32_array_value() const
Definition: ov-base.cc:832
virtual MatrixType matrix_type() const
Definition: ov-base.cc:410
virtual FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-base.cc:656
virtual octave_user_script * user_script_value(bool silent=false)
Definition: ov-base.cc:958
virtual octave_value as_uint8() const
Definition: ov-base.cc:199
virtual charNDArray char_array_value(bool=false) const
Definition: ov-base.cc:689
virtual string_vector parent_class_names() const
Definition: ov-base.cc:924
virtual octave_value_list simple_subsref(char type, octave_value_list &idx, int nargout)
Definition: ov-base.cc:240
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
Definition: ov-base.h:248
virtual octave_value diag(octave_idx_type k=0) const
Definition: ov-base.cc:1041
virtual octave_int8 int8_scalar_value() const
Definition: ov-base.cc:748
virtual Array< std::string > cellstr_value() const
Definition: ov-base.cc:868
virtual uint8NDArray uint8_array_value() const
Definition: ov-base.cc:820
void indent(std::ostream &os) const
Definition: ov-base.cc:1369
virtual octave_uint32 uint32_scalar_value() const
Definition: ov-base.cc:784
virtual Matrix size()
Definition: ov-base.cc:223
virtual octave_value permute(const Array< int > &vec, bool=false) const
Definition: ov-base.cc:398
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
Definition: ov-base.cc:976
virtual charMatrix char_matrix_value(bool force=false) const
Definition: ov-base.cc:681
virtual octave_value storable_value()
Definition: ov-base.cc:131
void newline(std::ostream &os) const
Definition: ov-base.cc:1388
virtual octave_classdef * classdef_object_value(bool silent=false)
Definition: ov-base.cc:930
virtual octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-base.cc:273
virtual float_display_format get_edit_display_format() const
Definition: ov-base.cc:506
virtual octave_value all(int=0) const
Definition: ov-base.cc:422
virtual bool isfield(const std::string &) const
Definition: ov-base.cc:905
virtual sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1078
virtual void unlock()
Definition: ov-base.cc:1193
virtual octave_value as_uint16() const
Definition: ov-base.cc:205
virtual boolMatrix bool_matrix_value(bool=false) const
Definition: ov-base.cc:669
virtual FloatComplex float_complex_value(bool=false) const
Definition: ov-base.cc:630
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1181
virtual octave_idx_type nzmax() const
Definition: ov-base.cc:380
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov-base.cc:446
virtual FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-base.cc:643
virtual ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-base.cc:636
virtual void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-base.cc:466
virtual octave_int32 int32_scalar_value() const
Definition: ov-base.cc:760
virtual octave_idx_type nnz() const
Definition: ov-base.cc:374
virtual int32NDArray int32_array_value() const
Definition: ov-base.cc:808
virtual octave_value dump() const
Definition: ov-base.cc:1199
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
Definition: ov-base.cc:434
virtual octave_value as_int32() const
Definition: ov-base.cc:187
virtual octave::idx_vector index_vector(bool require_integers=false) const
Definition: ov-base.cc:280
octave::refcount< octave_idx_type > m_count
Definition: ov-base.h:933
virtual octave_uint64 uint64_scalar_value() const
Definition: ov-base.cc:790
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
Definition: ov-base.cc:721
virtual bool save_binary(std::ostream &os, bool save_as_floats)
Definition: ov-base.cc:1003
virtual type_conv_info numeric_conversion_function() const
Definition: ov-base.h:294
octave_value numeric_assign(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:1236
void warn_load(const char *type) const
Definition: ov-base.cc:1157
virtual octave_value as_double_or_copy()
Definition: ov-base.cc:162
virtual int type_id() const
Definition: ov-base.h:954
virtual octave_value reshape(const dim_vector &) const
Definition: ov-base.cc:392
virtual mxArray * as_mxArray(bool interleaved) const
Definition: ov-base.cc:1035
virtual SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
Definition: ov-base.cc:708
virtual string_vector map_keys() const
Definition: ov-base.cc:899
virtual octave_value_list list_value() const
Definition: ov-base.cc:985
virtual uint64NDArray uint64_array_value() const
Definition: ov-base.cc:838
virtual void lock()
Definition: ov-base.cc:1187
static const char * get_umap_name(unary_mapper_t)
Definition: ov-base.cc:1084
virtual int16NDArray int16_array_value() const
Definition: ov-base.cc:802
virtual bool load_ascii(std::istream &is)
Definition: ov-base.cc:997
virtual bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-base.cc:1009
virtual dim_vector dims() const
Definition: ov-base.h:372
virtual FloatNDArray float_array_value(bool=false) const
Definition: ov-base.cc:618
virtual Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov-base.cc:1072
virtual FloatMatrix float_matrix_value(bool=false) const
Definition: ov-base.cc:606
virtual octave_value as_int64() const
Definition: ov-base.cc:193
virtual octave_idx_type xnumel(const octave_value_list &)
Definition: ov-base.cc:233
virtual DiagMatrix diag_matrix_value(bool=false) const
Definition: ov-base.cc:715
bool isempty() const
Definition: ov-base.h:417
virtual SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-base.cc:701
void reset() const
Definition: ov-base.cc:1398
virtual octave_idx_type nfields() const
Definition: ov-base.cc:386
virtual bool isnumeric() const
Definition: ov-base.h:513
virtual octave_uint8 uint8_scalar_value() const
Definition: ov-base.cc:772
virtual int64NDArray int64_array_value() const
Definition: ov-base.cc:814
virtual bool print_as_scalar() const
Definition: ov-base.h:728
virtual octave_value squeeze() const
Definition: ov-base.cc:143
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov-base.cc:1411
virtual octave_user_function * user_function_value(bool silent=false)
Definition: ov-base.cc:949
virtual bool bool_value(bool=false) const
Definition: ov-base.cc:663
virtual octave_value as_uint32() const
Definition: ov-base.cc:211
virtual octave_value as_int16() const
Definition: ov-base.cc:181
virtual int8NDArray int8_array_value() const
Definition: ov-base.cc:796
virtual void print_info(std::ostream &os, const std::string &prefix) const
Definition: ov-base.cc:512
virtual std::string xstring_value() const
Definition: ov-base.cc:860
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
Definition: ov-base.cc:1417
virtual ComplexDiagMatrix complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:728
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-base.cc:1016
virtual octave_value as_int8() const
Definition: ov-base.cc:175
virtual void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-base.cc:460
virtual octave_value resize(const dim_vector &, bool fill=false) const
Definition: ov-base.cc:404
virtual octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov-base.cc:1053
virtual int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
Definition: ov-base.cc:1028
virtual bool is_defined() const
Definition: ov-base.h:411
virtual octave_int64 int64_scalar_value() const
Definition: ov-base.cc:766
virtual octave_map map_value() const
Definition: ov-base.cc:882
virtual NDArray array_value(bool=false) const
Definition: ov-base.cc:612
virtual std::string string_value(bool force=false) const
Definition: ov-base.cc:852
virtual std::size_t nparents() const
Definition: ov-base.cc:911
virtual octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:297
virtual octave_user_code * user_code_value(bool silent=false)
Definition: ov-base.cc:967
virtual octave_scalar_map scalar_map_value() const
Definition: ov-base.cc:888
virtual double double_value(bool=false) const
Definition: ov-base.cc:582
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:363
virtual Matrix matrix_value(bool=false) const
Definition: ov-base.cc:600
virtual std::string type_name() const
Definition: ov-base.h:954
virtual std::string class_name() const
Definition: ov-base.h:954
virtual octave_value simple_subsasgn(char type, octave_value_list &idx, const octave_value &rhs)
Definition: ov-base.cc:287
virtual sortmode issorted(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1066
virtual octave_base_value * empty_clone() const
Definition: ov-base.cc:121
virtual octave_function * function_value(bool silent=false)
Definition: ov-base.cc:940
virtual octave_value as_single() const
Definition: ov-base.cc:169
virtual string_vector string_vector_value(bool pad=false) const
Definition: ov-base.cc:844
friend class octave_value
Definition: ov-base.h:269
virtual PermMatrix perm_matrix_value() const
Definition: ov-base.cc:742
virtual std::list< std::string > parent_class_name_list() const
Definition: ov-base.cc:917
virtual octave_value any(int=0) const
Definition: ov-base.cc:428
virtual Cell cell_value() const
Definition: ov-base.cc:594
virtual void convert_to_row_or_column_vector()
Definition: ov-base.cc:453
virtual octave_value as_uint64() const
Definition: ov-base.cc:217
virtual octave_uint16 uint16_scalar_value() const
Definition: ov-base.cc:778
virtual Complex complex_value(bool=false) const
Definition: ov-base.cc:624
void warn_save(const char *type) const
Definition: ov-base.cc:1166
std::string name() const
Definition: ov-fcn.h:206
octave_scalar_map checkelem(octave_idx_type n) const
Definition: oct-map.h:378
octave_idx_type numel() const
Definition: oct-map.h:368
static octave_value make_copy(octave_base_value *rep)
Definition: ov-inline.h:129
octave_idx_type length() const
Definition: ovl.h:113
octave_base_value * clone() const
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:894
bool is_string() const
Definition: ov.h:637
static std::string assign_op_as_string(assign_op)
Definition: ov.cc:355
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
int type_id() const
Definition: ov.h:1343
const octave_base_value & get_rep() const
Definition: ov.h:1359
@ op_asn_eq
Definition: ov.h:135
void maybe_mutate()
octave_base_value::type_conv_info numeric_conversion_function() const
Definition: ov.h:423
std::string string_value(bool force=false) const
Definition: ov.h:974
string_vector string_vector_value(bool pad=false) const
Definition: ov.h:977
std::string type_name() const
Definition: ov.h:1345
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:1078
void() error(const char *fmt,...)
Definition: error.cc:988
#define panic_impossible()
Definition: error.h:503
#define panic_unless(cond)
Definition: error.h:515
void err_wrong_type_arg(const char *name, const char *s)
Definition: errwarn.cc:166
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:71
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:344
octave::idx_vector idx_vector
Definition: idx-vector.h:1022
type_info & __get_type_info__()
tree_evaluator & __get_evaluator__()
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
bool isnan(bool)
Definition: lo-mappers.h:178
double fix(double x)
Definition: lo-mappers.h:118
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f
float_format
Definition: mach-info.h:38
T octave_idx_type m
Definition: mx-inlines.cc:781
octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx_arg)
Definition: utils.cc:1413
std::complex< double > Complex
Definition: oct-cmplx.h:33
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34
int64_t octave_hdf5_id
sortmode
Definition: oct-sort.h:97
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:88
#define INSTALL_WIDENOP_TI(ti, t1, t2, f)
Definition: ops.h:92
std::string btyp_class_name[btyp_num_types+1]
Definition: ov-base.cc:91
void install_base_type_conversions(octave::type_info &ti)
Definition: ov-base.cc:1542
bool Vsparse_auto_mutate
Definition: ov-base.cc:104
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1461
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Determine the resulting type for a possible mixed-type operation.
Definition: ov-base.cc:67
#define INT_CONV_METHOD(T, F)
Definition: ov-base.cc:518
bool called_from_builtin()
Definition: ov-base.cc:1524
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:235
builtin_type_t
Definition: ov-base.h:83
@ btyp_float_complex
Definition: ov-base.h:87
@ btyp_double
Definition: ov-base.h:84
@ btyp_float
Definition: ov-base.h:85
@ btyp_int64
Definition: ov-base.h:91
@ btyp_bool
Definition: ov-base.h:96
@ btyp_unknown
Definition: ov-base.h:101
@ btyp_uint64
Definition: ov-base.h:95
@ btyp_num_types
Definition: ov-base.h:102
@ btyp_uint8
Definition: ov-base.h:92
@ btyp_int8
Definition: ov-base.h:88
octave::type_info::assign_op_fcn assign_op_fcn
Definition: ov-typeinfo.h:283
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:219
bool Vcompact_format
Definition: pr-output.cc:102
F77_RET_T len
Definition: xerbla.cc:61