Mercurial > octave
annotate libinterp/octave-value/ov-base.cc @ 33634:4a70f390c85e default tip @
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 28 May 2024 15:25:54 +0200 |
parents | 7ea909c9818a |
children | 662938d6b684 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
32589
diff
changeset
|
3 // Copyright (C) 1996-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
2376 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
2376 | 28 #endif |
29 | |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
30 #include <istream> |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
31 #include <limits> |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
32 #include <ostream> |
2901 | 33 |
2376 | 34 #include "lo-ieee.h" |
4732 | 35 #include "lo-mappers.h" |
2376 | 36 |
5759 | 37 #include "defun.h" |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
38 #include "errwarn.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23502
diff
changeset
|
39 #include "interpreter-private.h" |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23502
diff
changeset
|
40 #include "interpreter.h" |
15149
62a35ae7d6a2
use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents:
15057
diff
changeset
|
41 #include "mxarray.h" |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
42 #include "oct-hdf5.h" |
2979 | 43 #include "oct-lvalue.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23502
diff
changeset
|
44 #include "oct-map.h" |
3340 | 45 #include "oct-stream.h" |
2376 | 46 #include "ops.h" |
47 #include "ov-base.h" | |
3928 | 48 #include "ov-cell.h" |
49 #include "ov-ch-mat.h" | |
23881
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
50 #include "ov-classdef.h" |
2376 | 51 #include "ov-complex.h" |
52 #include "ov-cx-mat.h" | |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23502
diff
changeset
|
53 #include "ov-fcn-handle.h" |
3928 | 54 #include "ov-range.h" |
55 #include "ov-re-mat.h" | |
56 #include "ov-scalar.h" | |
2376 | 57 #include "ov-str-mat.h" |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23502
diff
changeset
|
58 #include "ovl.h" |
5759 | 59 #include "parse.h" |
24668
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
60 #include "pr-flt-fmt.h" |
13112
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
61 #include "pr-output.h" |
5759 | 62 #include "utils.h" |
2948 | 63 #include "variables.h" |
32136
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
64 #include "ov-inline.h" |
2376 | 65 |
32589
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32546
diff
changeset
|
66 builtin_type_t |
05b4479c29d8
maint: C++ style check for libinterp/ before 9.1 release.
Rik <rik@octave.org>
parents:
32546
diff
changeset
|
67 btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
68 { |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
69 builtin_type_t retval = btyp_unknown; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
70 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
71 if (x == btyp_bool) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
72 x = btyp_double; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
73 if (y == btyp_bool) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
74 y = btyp_double; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
75 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
76 if (x <= btyp_float_complex && y <= btyp_float_complex) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
77 retval = static_cast<builtin_type_t> (x | y); |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
78 else if (x <= btyp_uint64 && y <= btyp_float) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
79 retval = x; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
80 else if (x <= btyp_float && y <= btyp_uint64) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
81 retval = y; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
82 else if ((x >= btyp_int8 && x <= btyp_int64 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
83 && y >= btyp_int8 && y <= btyp_int64) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
84 || (x >= btyp_uint8 && x <= btyp_uint64 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
85 && y >= btyp_uint8 && y <= btyp_uint64)) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
86 retval = (x > y) ? x : y; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
87 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
88 return retval; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
89 } |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
90 |
28632
6aa0808d2ed6
also provide builtin type to class traits
John W. Eaton <jwe@octave.org>
parents:
28444
diff
changeset
|
91 std::string btyp_class_name[btyp_num_types+1] = |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
92 { |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
93 "double", "single", "double", "single", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
94 "int8", "int16", "int32", "int64", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
95 "uint8", "uint16", "uint32", "uint64", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
96 "logical", "char", |
28632
6aa0808d2ed6
also provide builtin type to class traits
John W. Eaton <jwe@octave.org>
parents:
28444
diff
changeset
|
97 "struct", "cell", "function_handle", "unknown" |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
98 }; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
99 |
4612 | 100 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
101 "<unknown type>", "unknown"); |
2376 | 102 |
31856
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
103 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
104 // Disable this warning for the use of the "count" member variable in |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
105 // the default constructor. Push the current state so we can restore |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
106 // the warning state. |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
107 # pragma GCC diagnostic push |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
108 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
109 #endif |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
110 |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
111 octave_base_value::octave_base_value () : m_count (1), count (m_count) { } |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
112 |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
113 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
114 # pragma GCC diagnostic pop |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
115 #endif |
c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
John W. Eaton <jwe@octave.org>
parents:
31845
diff
changeset
|
116 |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
117 octave_base_value * |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
118 octave_base_value::empty_clone () const |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
119 { |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
120 return resize (dim_vector ()).clone (); |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
121 } |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
122 |
32136
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
123 // FIXME: Unlike other virtual functions in the octave_base_value |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
124 // class, the storable_value and make_storable_value functions defined |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
125 // here are not used by the corresponding octave_value functions. This |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
126 // inconsistency is likely to cause some confusion. |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
127 octave_value |
32511
0cafa72d1408
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32508
diff
changeset
|
128 octave_base_value::storable_value () |
32136
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
129 { |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
130 return octave_value_factory::make_copy (this); |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
131 } |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
132 |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
133 octave_base_value * |
32511
0cafa72d1408
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32508
diff
changeset
|
134 octave_base_value::make_storable_value () |
32136
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
135 { |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
136 return this; |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
137 } |
bd26d9693501
new octave_base_value functions to create storable values
Petter T. <petter.vilhelm@gmail.com>
parents:
32133
diff
changeset
|
138 |
2376 | 139 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
140 octave_base_value::squeeze () const |
4532 | 141 { |
142 std::string nm = type_name (); | |
143 error ("squeeze: invalid operation for %s type", nm.c_str ()); | |
144 } | |
145 | |
146 octave_value | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
147 octave_base_value::full_value () const |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
148 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
149 err_wrong_type_arg ("full: invalid operation for %s type", type_name ()); |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
150 } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
151 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
152 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
153 octave_base_value::as_double () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
154 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
155 err_invalid_conversion (type_name (), "double"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
156 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
157 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
158 octave_value |
32511
0cafa72d1408
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Markus Mützel <markus.muetzel@gmx.de>
parents:
32508
diff
changeset
|
159 octave_base_value::as_double_or_copy () |
32138
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
160 { |
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
161 const octave_base_value * cthis = this; |
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
162 return cthis->as_double (); |
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
163 } |
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
164 |
45d89e3bebfd
new functions for accessing double values
Petter T. <petter.vilhelm@gmail.com>
parents:
32136
diff
changeset
|
165 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
166 octave_base_value::as_single () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
167 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
168 err_invalid_conversion (type_name (), "single"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
169 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
170 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
171 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
172 octave_base_value::as_int8 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
173 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
174 err_invalid_conversion (type_name (), "int8"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
175 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
176 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
177 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
178 octave_base_value::as_int16 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
179 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
180 err_invalid_conversion (type_name (), "int16"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
181 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
182 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
183 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
184 octave_base_value::as_int32 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
185 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
186 err_invalid_conversion (type_name (), "int32"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
187 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
188 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
189 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
190 octave_base_value::as_int64 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
191 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
192 err_invalid_conversion (type_name (), "int64"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
193 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
194 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
195 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
196 octave_base_value::as_uint8 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
197 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
198 err_invalid_conversion (type_name (), "uint8"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
199 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
200 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
201 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
202 octave_base_value::as_uint16 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
203 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
204 err_invalid_conversion (type_name (), "uint16"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
205 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
206 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
207 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
208 octave_base_value::as_uint32 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
209 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
210 err_invalid_conversion (type_name (), "uint32"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
211 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
212 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
213 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
214 octave_base_value::as_uint64 () const |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
215 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
216 err_invalid_conversion (type_name (), "uint64"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
217 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
218 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
219 Matrix |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
220 octave_base_value::size () |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
221 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
222 const dim_vector dv = dims (); |
21660
53728df3e4c9
maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
223 Matrix mdv (1, dv.ndims ()); |
53728df3e4c9
maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
224 for (octave_idx_type i = 0; i < dv.ndims (); i++) |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
225 mdv(i) = dv(i); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
226 return mdv; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
227 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
228 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
229 octave_idx_type |
26922
072d0610cc56
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26527
diff
changeset
|
230 octave_base_value::xnumel (const octave_value_list& idx) |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
231 { |
25646
4d565baa475e
move libinterp/utils functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
25438
diff
changeset
|
232 return octave::dims_to_numel (dims (), idx); |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
233 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
234 |
32126
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
235 octave_value_list |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
236 octave_base_value:: |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
237 simple_subsref (char type, octave_value_list& idx, int nargout) |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
238 { |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
239 std::list<octave_value_list> idx_list; |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
240 idx_list.push_back (idx); |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
241 return subsref (std::string {type}, idx_list, nargout); |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
242 } |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
243 |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
244 octave_value |
4247 | 245 octave_base_value::subsref (const std::string&, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
246 const std::list<octave_value_list>&) |
3933 | 247 { |
248 std::string nm = type_name (); | |
249 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
250 } | |
251 | |
252 octave_value_list | |
4247 | 253 octave_base_value::subsref (const std::string&, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
254 const std::list<octave_value_list>&, int) |
3933 | 255 { |
256 std::string nm = type_name (); | |
257 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
258 } | |
259 | |
260 octave_value | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
261 octave_base_value::subsref (const std::string& type, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
262 const std::list<octave_value_list>& idx, |
8677
095ae5e0a831
eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
263 bool /* auto_add */) |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
264 { |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
265 // This way we may get a more meaningful error message. |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
266 return subsref (type, idx); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
267 } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
268 |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
269 octave_value |
5885 | 270 octave_base_value::do_index_op (const octave_value_list&, bool) |
2974 | 271 { |
3523 | 272 std::string nm = type_name (); |
2974 | 273 error ("can't perform indexing operations for %s type", nm.c_str ()); |
274 } | |
275 | |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
276 octave::idx_vector |
18130
e473c4853afc
enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
277 octave_base_value::index_vector (bool /* require_integers */) const |
2376 | 278 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
279 std::string nm = '<' + type_name () + '>'; |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
280 octave::err_invalid_index (nm.c_str ()); |
2376 | 281 } |
282 | |
283 octave_value | |
32126
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
284 octave_base_value::simple_subsasgn (char type, octave_value_list& idx, |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
285 const octave_value& rhs) |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
286 { |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
287 std::list<octave_value_list> idx_list; |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
288 idx_list.push_back (idx); |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
289 |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
290 return subsasgn (std::string {type}, idx_list, rhs); |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
291 } |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
292 |
b1e1830e2cff
new subsref and subsasgn functions to handle simple case
Petter T. <petter.vilhelm@gmail.com>
parents:
31856
diff
changeset
|
293 octave_value |
4247 | 294 octave_base_value::subsasgn (const std::string& type, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
295 const std::list<octave_value_list>& idx, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
296 const octave_value& rhs) |
2376 | 297 { |
3933 | 298 octave_value retval; |
2376 | 299 |
3933 | 300 if (is_defined ()) |
301 { | |
23586
f6c5db0a02e7
maint: Deprecate is_numeric_type and replace with isnumeric.
Rik <rik@octave.org>
parents:
23577
diff
changeset
|
302 if (! isnumeric ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
303 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
304 std::string nm = type_name (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
305 error ("can't perform indexed assignment for %s type", nm.c_str ()); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
306 } |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
307 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
308 switch (type[0]) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
309 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
310 case '(': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
311 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
312 if (type.length () == 1) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
313 retval = numeric_assign (type, idx, rhs); |
23577
80c42f4cca13
maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents:
23553
diff
changeset
|
314 else if (isempty ()) |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
315 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
316 // Allow conversion of empty matrix to some other |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
317 // type in cases like |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
318 // |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
319 // x = []; x(i).f = rhs |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
320 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
321 octave_value tmp = octave_value::empty_conv (type, rhs); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
322 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
323 retval = tmp.subsasgn (type, idx, rhs); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
324 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
325 else |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
326 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
327 std::string nm = type_name (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
328 error ("in indexed assignment of %s, last rhs index must be ()", |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
329 nm.c_str ()); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
330 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
331 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
332 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
333 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
334 case '{': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
335 case '.': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
336 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
337 std::string nm = type_name (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
338 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
339 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
340 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
341 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
342 default: |
33362
2949b89f9711
replace most uses of panic_impossible with error in octave_value classes
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
343 error ("unexpected: index not '(', '{', or '.' in octave_base_value::subsasgn - please report this bug"); |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
344 } |
3933 | 345 } |
346 else | |
347 { | |
348 // Create new object of appropriate type for given index and rhs | |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
349 // types and then call undef_subsasgn for that object. |
3933 | 350 |
351 octave_value tmp = octave_value::empty_conv (type, rhs); | |
352 | |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
353 retval = tmp.undef_subsasgn (type, idx, rhs); |
3933 | 354 } |
355 | |
356 return retval; | |
2376 | 357 } |
358 | |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
359 octave_value |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
360 octave_base_value::undef_subsasgn (const std::string& type, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
361 const std::list<octave_value_list>& idx, |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
362 const octave_value& rhs) |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
363 { |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
364 // In most cases, undef_subsasgn is handled the sams as subsasgn. One |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
365 // exception is octave_class objects. |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
366 |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
367 return subsasgn (type, idx, rhs); |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
368 } |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
369 |
5602 | 370 octave_idx_type |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
371 octave_base_value::nnz () const |
5602 | 372 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
373 err_wrong_type_arg ("octave_base_value::nnz ()", type_name ()); |
5602 | 374 } |
375 | |
5604 | 376 octave_idx_type |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
377 octave_base_value::nzmax () const |
5604 | 378 { |
10513
c5005bc2b7a9
implement working spalloc
Jaroslav Hajek <highegg@gmail.com>
parents:
10414
diff
changeset
|
379 return numel (); |
5604 | 380 } |
381 | |
5900 | 382 octave_idx_type |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
383 octave_base_value::nfields () const |
5900 | 384 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
385 err_wrong_type_arg ("octave_base_value::nfields ()", type_name ()); |
5900 | 386 } |
387 | |
2376 | 388 octave_value |
4567 | 389 octave_base_value::reshape (const dim_vector&) const |
390 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
391 err_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); |
4567 | 392 } |
393 | |
394 octave_value | |
4593 | 395 octave_base_value::permute (const Array<int>&, bool) const |
396 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
397 err_wrong_type_arg ("octave_base_value::permute ()", type_name ()); |
4593 | 398 } |
399 | |
400 octave_value | |
5731 | 401 octave_base_value::resize (const dim_vector&, bool) const |
4915 | 402 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
403 err_wrong_type_arg ("octave_base_value::resize ()", type_name ()); |
4915 | 404 } |
405 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
406 MatrixType |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
407 octave_base_value::matrix_type () const |
5785 | 408 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
409 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); |
5785 | 410 } |
411 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
412 MatrixType |
5785 | 413 octave_base_value::matrix_type (const MatrixType&) const |
414 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
415 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); |
5785 | 416 } |
417 | |
4915 | 418 octave_value |
5759 | 419 octave_base_value::all (int) const |
420 { | |
421 return 0.0; | |
422 } | |
423 | |
424 octave_value | |
425 octave_base_value::any (int) const | |
426 { | |
427 return 0.0; | |
428 } | |
429 | |
430 octave_value | |
431 octave_base_value::convert_to_str (bool pad, bool force, char type) const | |
432 { | |
433 octave_value retval = convert_to_str_internal (pad, force, type); | |
434 | |
23586
f6c5db0a02e7
maint: Deprecate is_numeric_type and replace with isnumeric.
Rik <rik@octave.org>
parents:
23577
diff
changeset
|
435 if (! force && isnumeric ()) |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
436 warn_implicit_conversion ("Octave:num-to-str", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
437 type_name (), retval.type_name ()); |
5759 | 438 |
439 return retval; | |
440 } | |
441 | |
442 octave_value | |
5279 | 443 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376 | 444 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
445 err_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
446 type_name ()); |
2376 | 447 } |
448 | |
449 void | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
450 octave_base_value::convert_to_row_or_column_vector () |
2376 | 451 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
452 err_wrong_type_arg |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
453 ("octave_base_value::convert_to_row_or_column_vector ()", type_name ()); |
2376 | 454 } |
455 | |
456 void | |
18416
bcd71a2531d3
Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18316
diff
changeset
|
457 octave_base_value::print (std::ostream&, bool) |
2376 | 458 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
459 err_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376 | 460 } |
461 | |
2901 | 462 void |
3523 | 463 octave_base_value::print_raw (std::ostream&, bool) const |
2901 | 464 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
465 err_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); |
2901 | 466 } |
467 | |
468 bool | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
469 octave_base_value::print_name_tag (std::ostream& os, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
470 const std::string& name) const |
2901 | 471 { |
472 indent (os); | |
4604 | 473 |
474 if (print_as_scalar ()) | |
475 os << name << " = "; | |
476 else | |
477 { | |
478 os << name << " ="; | |
479 newline (os); | |
13112
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
480 if (! Vcompact_format) |
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
481 newline (os); |
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
482 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
483 return true; |
4604 | 484 } |
485 | |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
486 return false; |
2901 | 487 } |
488 | |
3933 | 489 void |
5759 | 490 octave_base_value::print_with_name (std::ostream& output_buf, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
491 const std::string& name, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
492 bool print_padding) |
5759 | 493 { |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
494 bool pad_after = print_name_tag (output_buf, name); |
5759 | 495 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
496 print (output_buf); |
5759 | 497 |
20792
d0991cbd6141
maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
498 if (print_padding && pad_after && ! Vcompact_format) |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
499 newline (output_buf); |
5759 | 500 } |
501 | |
24668
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
502 float_display_format |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
503 octave_base_value::get_edit_display_format () const |
24668
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
504 { |
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
505 return float_display_format (); |
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
506 } |
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24620
diff
changeset
|
507 |
5759 | 508 void |
3933 | 509 octave_base_value::print_info (std::ostream& os, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
510 const std::string& /* prefix */) const |
3933 | 511 { |
512 os << "no info for type: " << type_name () << "\n"; | |
513 } | |
514 | |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
515 #define INT_CONV_METHOD(T, F) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
516 T \ |
4254 | 517 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
518 { \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
519 T retval = 0; \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
520 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
521 double d = 0.0; \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
522 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
523 try \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
524 { \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
525 d = double_value (frc_str_conv); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
526 } \ |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28646
diff
changeset
|
527 catch (octave::execution_exception& ee) \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
528 { \ |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28646
diff
changeset
|
529 err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
530 } \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
531 \ |
32626
395ab2ffb0c2
maint: Use constexpr where possible for performance.
Rik <rik@octave.org>
parents:
32592
diff
changeset
|
532 static constexpr double out_of_range_top \ |
395ab2ffb0c2
maint: Use constexpr where possible for performance.
Rik <rik@octave.org>
parents:
32592
diff
changeset
|
533 = static_cast<double> (std::numeric_limits<T>::max ()) + 1.0; \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
534 if (require_int && octave::math::x_nint (d) != d) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
535 error_with_cfn ("conversion of %g to " #T " value failed", d); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
536 else if (d < std::numeric_limits<T>::min ()) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
537 retval = std::numeric_limits<T>::min (); \ |
30867
014030798d5e
Avoid issues when converting large integers to floating point (bug #62212).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30835
diff
changeset
|
538 else if (d >= out_of_range_top) \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
539 retval = std::numeric_limits<T>::max (); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
540 else \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
541 retval = static_cast<T> (octave::math::fix (d)); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
542 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
543 return retval; \ |
4254 | 544 } |
3202 | 545 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
546 INT_CONV_METHOD (short int, short) |
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
547 INT_CONV_METHOD (unsigned short int, ushort) |
3202 | 548 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
549 INT_CONV_METHOD (int, int) |
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
550 INT_CONV_METHOD (unsigned int, uint) |
3202 | 551 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
552 INT_CONV_METHOD (long int, long) |
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
553 INT_CONV_METHOD (unsigned long int, ulong) |
3202 | 554 |
16323
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
555 INT_CONV_METHOD (int64_t, int64) |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
556 INT_CONV_METHOD (uint64_t, uint64) |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
557 |
3202 | 558 int |
559 octave_base_value::nint_value (bool frc_str_conv) const | |
560 { | |
20747
ee2743bd07a8
eliminate various compiler warnings
John W. Eaton <jwe@octave.org>
parents:
20741
diff
changeset
|
561 double d = 0.0; |
3202 | 562 |
20741
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
563 try |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
564 { |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
565 d = double_value (frc_str_conv); |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
566 } |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28646
diff
changeset
|
567 catch (octave::execution_exception& ee) |
3202 | 568 { |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28646
diff
changeset
|
569 err_wrong_type_arg (ee, "octave_base_value::nint_value ()", type_name ()); |
20741
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
570 } |
3202 | 571 |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21739
diff
changeset
|
572 if (octave::math::isnan (d)) |
20741
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
573 error ("conversion of NaN to integer value failed"); |
3202 | 574 |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21739
diff
changeset
|
575 return static_cast<int> (octave::math::fix (d)); |
3202 | 576 } |
577 | |
2376 | 578 double |
579 octave_base_value::double_value (bool) const | |
580 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
581 err_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
2376 | 582 } |
583 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
584 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
585 octave_base_value::float_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
586 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
587 err_wrong_type_arg ("octave_base_value::float_value ()", type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
588 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
589 |
3351 | 590 Cell |
3539 | 591 octave_base_value::cell_value () const |
3351 | 592 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
593 err_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); |
3351 | 594 } |
595 | |
2376 | 596 Matrix |
597 octave_base_value::matrix_value (bool) const | |
598 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
599 err_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); |
2376 | 600 } |
601 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
602 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
603 octave_base_value::float_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
604 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
605 err_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
606 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
607 |
4507 | 608 NDArray |
4550 | 609 octave_base_value::array_value (bool) const |
4505 | 610 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
611 err_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505 | 612 } |
613 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
614 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
615 octave_base_value::float_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
616 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
617 err_wrong_type_arg ("octave_base_value::float_array_value()", type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
618 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
619 |
2376 | 620 Complex |
621 octave_base_value::complex_value (bool) const | |
622 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
623 err_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
2376 | 624 } |
625 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
626 FloatComplex |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
627 octave_base_value::float_complex_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
628 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
629 err_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
630 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
631 |
2376 | 632 ComplexMatrix |
633 octave_base_value::complex_matrix_value (bool) const | |
634 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
635 err_wrong_type_arg ("octave_base_value::complex_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
636 type_name ()); |
2376 | 637 } |
638 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
639 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
640 octave_base_value::float_complex_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
641 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
642 err_wrong_type_arg ("octave_base_value::float_complex_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
643 type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
644 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
645 |
4550 | 646 ComplexNDArray |
647 octave_base_value::complex_array_value (bool) const | |
648 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
649 err_wrong_type_arg ("octave_base_value::complex_array_value()", type_name ()); |
4550 | 650 } |
651 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
652 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
653 octave_base_value::float_complex_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
654 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
655 err_wrong_type_arg ("octave_base_value::float_complex_array_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
656 type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
657 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
658 |
4550 | 659 bool |
5943 | 660 octave_base_value::bool_value (bool) const |
4550 | 661 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
662 err_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); |
4550 | 663 } |
664 | |
665 boolMatrix | |
5943 | 666 octave_base_value::bool_matrix_value (bool) const |
4550 | 667 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
668 err_wrong_type_arg ("octave_base_value::bool_matrix_value()", type_name ()); |
4550 | 669 } |
670 | |
671 boolNDArray | |
5943 | 672 octave_base_value::bool_array_value (bool) const |
4550 | 673 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
674 err_wrong_type_arg ("octave_base_value::bool_array_value()", type_name ()); |
4550 | 675 } |
676 | |
2376 | 677 charMatrix |
4741 | 678 octave_base_value::char_matrix_value (bool force) const |
2376 | 679 { |
4741 | 680 octave_value tmp = convert_to_str (false, force); |
4257 | 681 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
682 return tmp.char_matrix_value (); |
2376 | 683 } |
684 | |
4550 | 685 charNDArray |
686 octave_base_value::char_array_value (bool) const | |
687 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
688 err_wrong_type_arg ("octave_base_value::char_array_value()", type_name ()); |
4550 | 689 } |
690 | |
5164 | 691 SparseMatrix |
692 octave_base_value::sparse_matrix_value (bool) const | |
693 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
694 err_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); |
5164 | 695 } |
696 | |
697 SparseComplexMatrix | |
698 octave_base_value::sparse_complex_matrix_value (bool) const | |
699 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
700 err_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
701 type_name ()); |
5164 | 702 } |
703 | |
704 SparseBoolMatrix | |
705 octave_base_value::sparse_bool_matrix_value (bool) const | |
706 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
707 err_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
708 type_name ()); |
5164 | 709 } |
710 | |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
711 DiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
712 octave_base_value::diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
713 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
714 err_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
715 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
716 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
717 FloatDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
718 octave_base_value::float_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
719 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
720 err_wrong_type_arg ("octave_base_value::float_diag_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
721 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
722 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
723 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
724 ComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
725 octave_base_value::complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
726 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
727 err_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
728 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
729 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
730 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
731 FloatComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
732 octave_base_value::float_complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
733 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
734 err_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
735 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
736 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
737 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
738 PermMatrix |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
739 octave_base_value::perm_matrix_value () const |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
740 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
741 err_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
742 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
743 |
4910 | 744 octave_int8 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
745 octave_base_value::int8_scalar_value () const |
4910 | 746 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
747 err_wrong_type_arg ("octave_base_value::int8_scalar_value()", type_name ()); |
4910 | 748 } |
749 | |
750 octave_int16 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
751 octave_base_value::int16_scalar_value () const |
4910 | 752 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
753 err_wrong_type_arg ("octave_base_value::int16_scalar_value()", type_name ()); |
4910 | 754 } |
755 | |
756 octave_int32 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
757 octave_base_value::int32_scalar_value () const |
4910 | 758 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
759 err_wrong_type_arg ("octave_base_value::int32_scalar_value()", type_name ()); |
4910 | 760 } |
761 | |
762 octave_int64 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
763 octave_base_value::int64_scalar_value () const |
4910 | 764 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
765 err_wrong_type_arg ("octave_base_value::int64_scalar_value()", type_name ()); |
4910 | 766 } |
767 | |
768 octave_uint8 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
769 octave_base_value::uint8_scalar_value () const |
4910 | 770 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
771 err_wrong_type_arg ("octave_base_value::uint8_scalar_value()", type_name ()); |
4910 | 772 } |
773 | |
774 octave_uint16 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
775 octave_base_value::uint16_scalar_value () const |
4910 | 776 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
777 err_wrong_type_arg ("octave_base_value::uint16_scalar_value()", type_name ()); |
4910 | 778 } |
779 | |
780 octave_uint32 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
781 octave_base_value::uint32_scalar_value () const |
4910 | 782 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
783 err_wrong_type_arg ("octave_base_value::uint32_scalar_value()", type_name ()); |
4910 | 784 } |
785 | |
786 octave_uint64 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
787 octave_base_value::uint64_scalar_value () const |
4910 | 788 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
789 err_wrong_type_arg ("octave_base_value::uint64_scalar_value()", type_name ()); |
4910 | 790 } |
791 | |
4906 | 792 int8NDArray |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
793 octave_base_value::int8_array_value () const |
4906 | 794 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
795 err_wrong_type_arg ("octave_base_value::int8_array_value()", type_name ()); |
4906 | 796 } |
797 | |
798 int16NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
799 octave_base_value::int16_array_value () const |
4906 | 800 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
801 err_wrong_type_arg ("octave_base_value::int16_array_value()", type_name ()); |
4906 | 802 } |
803 | |
804 int32NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
805 octave_base_value::int32_array_value () const |
4906 | 806 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
807 err_wrong_type_arg ("octave_base_value::int32_array_value()", type_name ()); |
4906 | 808 } |
809 | |
810 int64NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
811 octave_base_value::int64_array_value () const |
4906 | 812 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
813 err_wrong_type_arg ("octave_base_value::int64_array_value()", type_name ()); |
4906 | 814 } |
815 | |
816 uint8NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
817 octave_base_value::uint8_array_value () const |
4906 | 818 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
819 err_wrong_type_arg ("octave_base_value::uint8_array_value()", type_name ()); |
4906 | 820 } |
821 | |
822 uint16NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
823 octave_base_value::uint16_array_value () const |
4906 | 824 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
825 err_wrong_type_arg ("octave_base_value::uint16_array_value()", type_name ()); |
4906 | 826 } |
827 | |
828 uint32NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
829 octave_base_value::uint32_array_value () const |
4906 | 830 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
831 err_wrong_type_arg ("octave_base_value::uint32_array_value()", type_name ()); |
4906 | 832 } |
833 | |
834 uint64NDArray | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
835 octave_base_value::uint64_array_value () const |
4906 | 836 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
837 err_wrong_type_arg ("octave_base_value::uint64_array_value()", type_name ()); |
4906 | 838 } |
839 | |
2493 | 840 string_vector |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20978
diff
changeset
|
841 octave_base_value::string_vector_value (bool pad) const |
2376 | 842 { |
5715 | 843 octave_value tmp = convert_to_str (pad, true); |
4257 | 844 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
845 return tmp.string_vector_value (); |
2376 | 846 } |
847 | |
3536 | 848 std::string |
4457 | 849 octave_base_value::string_value (bool force) const |
2376 | 850 { |
4457 | 851 octave_value tmp = convert_to_str (force); |
4257 | 852 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
853 return tmp.string_value (); |
2376 | 854 } |
855 | |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
856 std::string |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
857 octave_base_value::xstring_value () const |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
858 { |
33447
7ea909c9818a
remove unnecessary private function in octave_base_value class
John W. Eaton <jwe@octave.org>
parents:
33362
diff
changeset
|
859 err_wrong_type_arg ("octave_base_value::xstring_value()", type_name ()); |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
860 } |
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
861 |
8732 | 862 Array<std::string> |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
863 octave_base_value::cellstr_value () const |
8732 | 864 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
865 err_wrong_type_arg ("octave_base_value::cellstr_value()", type_name ()); |
8732 | 866 } |
867 | |
30835
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
868 octave::range<double> |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
869 octave_base_value::range_value () const |
30835
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
870 { |
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
871 err_wrong_type_arg ("octave_base_value::range_value()", type_name ()); |
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
872 } |
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
873 |
31827
c8dd3da44e83
maint: Remove `#if 0` commented-out code from the codebase.
Arun Giridhar <arungiridhar@gmail.com>
parents:
31814
diff
changeset
|
874 // For now, enable only range<double>. |
30835
2989202f92f8
only allow range<FLOAT> to be instantiated
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
875 |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
876 octave_map |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
877 octave_base_value::map_value () const |
2376 | 878 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
879 err_wrong_type_arg ("octave_base_value::map_value()", type_name ()); |
2376 | 880 } |
881 | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
882 octave_scalar_map |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
883 octave_base_value::scalar_map_value () const |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
884 { |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
885 octave_map tmp = map_value (); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
886 |
20879
5357423bca0a
Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents:
20853
diff
changeset
|
887 if (tmp.numel () != 1) |
20678
4b00afb5e9c3
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
888 error ("invalid conversion of multi-dimensional struct to scalar struct"); |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
889 |
20879
5357423bca0a
Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents:
20853
diff
changeset
|
890 return octave_scalar_map (tmp.checkelem (0)); |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
891 } |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
892 |
3933 | 893 string_vector |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
894 octave_base_value::map_keys () const |
3933 | 895 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
896 err_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); |
3933 | 897 } |
898 | |
31260
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
899 bool |
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
900 octave_base_value::isfield (const std::string&) const |
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
901 { |
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
902 err_wrong_type_arg ("octave_base_value::isfield()", type_name ()); |
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
903 } |
c5c8bf50449c
Improve performance of isfield from linear time to constant time (bug #58105)
Arun Giridhar <arungiridhar@gmail.com>
parents:
31105
diff
changeset
|
904 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
905 std::size_t |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
906 octave_base_value::nparents () const |
9151 | 907 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
908 err_wrong_type_arg ("octave_base_value::nparents()", type_name ()); |
9151 | 909 } |
910 | |
911 std::list<std::string> | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
912 octave_base_value::parent_class_name_list () const |
9151 | 913 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
914 err_wrong_type_arg ("octave_base_value::parent_class_name_list()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
915 type_name ()); |
9151 | 916 } |
917 | |
918 string_vector | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
919 octave_base_value::parent_class_names () const |
9151 | 920 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
921 err_wrong_type_arg ("octave_base_value::parent_class_names()", type_name ()); |
9151 | 922 } |
923 | |
23881
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
924 octave_classdef * |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
925 octave_base_value::classdef_object_value (bool silent) |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
926 { |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
927 if (! silent) |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
928 err_wrong_type_arg ("octave_base_value::classdef_object_value()", |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
929 type_name ()); |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
930 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
931 return nullptr; |
23881
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
932 } |
5aec653c88e7
new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
933 |
2974 | 934 octave_function * |
935 octave_base_value::function_value (bool silent) | |
936 { | |
937 if (! silent) | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
938 err_wrong_type_arg ("octave_base_value::function_value()", type_name ()); |
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
939 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
940 return nullptr; |
2974 | 941 } |
942 | |
4700 | 943 octave_user_function * |
944 octave_base_value::user_function_value (bool silent) | |
945 { | |
946 if (! silent) | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
947 err_wrong_type_arg ("octave_base_value::user_function_value()", |
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
948 type_name ()); |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
949 return nullptr; |
4700 | 950 } |
951 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
952 octave_user_script * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
953 octave_base_value::user_script_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
954 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
955 if (! silent) |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
956 err_wrong_type_arg ("octave_base_value::user_script_value()", type_name ()); |
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
957 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
958 return nullptr; |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
959 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
960 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
961 octave_user_code * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
962 octave_base_value::user_code_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
963 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
964 if (! silent) |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
965 err_wrong_type_arg ("octave_base_value::user_code_value()", type_name ()); |
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
966 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
967 return nullptr; |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
968 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
969 |
4346 | 970 octave_fcn_handle * |
4343 | 971 octave_base_value::fcn_handle_value (bool silent) |
972 { | |
973 if (! silent) | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
974 err_wrong_type_arg ("octave_base_value::fcn_handle_value()", type_name ()); |
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
975 |
23882
8e61b91f2e24
* ov-base.cc: Eliminate unecessary uses of retval.
John W. Eaton <jwe@octave.org>
parents:
23881
diff
changeset
|
976 return nullptr; |
4343 | 977 } |
978 | |
2882 | 979 octave_value_list |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
980 octave_base_value::list_value () const |
2882 | 981 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
982 err_wrong_type_arg ("octave_base_value::list_value()", type_name ()); |
2882 | 983 } |
984 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
985 bool |
6974 | 986 octave_base_value::save_ascii (std::ostream&) |
4687 | 987 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
988 err_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); |
4687 | 989 } |
990 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
991 bool |
4687 | 992 octave_base_value::load_ascii (std::istream&) |
993 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
994 err_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); |
4687 | 995 } |
996 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
997 bool |
26399
586413770c7f
pass save_as_floats by value in octave_value save_binary functions
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
998 octave_base_value::save_binary (std::ostream&, bool) |
4687 | 999 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1000 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
4687 | 1001 } |
1002 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1003 bool |
4687 | 1004 octave_base_value::load_binary (std::istream&, bool, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
1005 octave::mach_info::float_format) |
4687 | 1006 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1007 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
4687 | 1008 } |
1009 | |
1010 bool | |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1011 octave_base_value::save_hdf5 (octave_hdf5_id, const char *, bool) |
4687 | 1012 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1013 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
4687 | 1014 } |
1015 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1016 bool |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1017 octave_base_value::load_hdf5 (octave_hdf5_id, const char *) |
4687 | 1018 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1019 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
4687 | 1020 } |
4944 | 1021 |
1022 int | |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23052
diff
changeset
|
1023 octave_base_value::write (octave::stream&, int, oct_data_conv::data_type, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
1024 int, octave::mach_info::float_format) const |
4944 | 1025 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1026 err_wrong_type_arg ("octave_base_value::write()", type_name ()); |
4944 | 1027 } |
1028 | |
5900 | 1029 mxArray * |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
1030 octave_base_value::as_mxArray (bool) const |
5900 | 1031 { |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23718
diff
changeset
|
1032 return nullptr; |
5900 | 1033 } |
1034 | |
7433 | 1035 octave_value |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1036 octave_base_value::diag (octave_idx_type) const |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1037 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1038 err_wrong_type_arg ("octave_base_value::diag ()", type_name ()); |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1039 } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1040 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1041 octave_value |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1042 octave_base_value::diag (octave_idx_type, octave_idx_type) const |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1043 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1044 err_wrong_type_arg ("octave_base_value::diag ()", type_name ()); |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1045 } |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1046 |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1047 octave_value |
7433 | 1048 octave_base_value::sort (octave_idx_type, sortmode) const |
1049 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1050 err_wrong_type_arg ("octave_base_value::sort ()", type_name ()); |
7433 | 1051 } |
1052 | |
1053 octave_value | |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1054 octave_base_value::sort (Array<octave_idx_type>&, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1055 octave_idx_type, sortmode) const |
7433 | 1056 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1057 err_wrong_type_arg ("octave_base_value::sort ()", type_name ()); |
7433 | 1058 } |
1059 | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1060 sortmode |
23588
0549061d35b9
maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents:
23586
diff
changeset
|
1061 octave_base_value::issorted (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1062 { |
23588
0549061d35b9
maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents:
23586
diff
changeset
|
1063 err_wrong_type_arg ("octave_base_value::issorted ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1064 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1065 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1066 Array<octave_idx_type> |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1067 octave_base_value::sort_rows_idx (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1068 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1069 err_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1070 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1071 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1072 sortmode |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1073 octave_base_value::is_sorted_rows (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1074 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1075 err_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1076 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1077 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1078 const char * |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1079 octave_base_value::get_umap_name (unary_mapper_t umap) |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1080 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1081 static const char *names[num_unary_mappers] = |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1082 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1083 "abs", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1084 "acos", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1085 "acosh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1086 "angle", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1087 "arg", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1088 "asin", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1089 "asinh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1090 "atan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1091 "atanh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1092 "cbrt", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1093 "ceil", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1094 "conj", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1095 "cos", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1096 "cosh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1097 "erf", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1098 "erfinv", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1099 "erfcinv", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1100 "erfc", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1101 "erfcx", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1102 "erfi", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1103 "dawson", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1104 "exp", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1105 "expm1", |
21013
7f4c6d594e3d
Finish renaming mapper function finite to isfinite.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
1106 "isfinite", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1107 "fix", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1108 "floor", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1109 "gamma", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1110 "imag", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1111 "isinf", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1112 "isna", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1113 "isnan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1114 "lgamma", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1115 "log", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1116 "log2", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1117 "log10", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1118 "log1p", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1119 "real", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1120 "round", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1121 "roundb", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1122 "signum", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1123 "sin", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1124 "sinh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1125 "sqrt", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1126 "tan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1127 "tanh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1128 "isalnum", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1129 "isalpha", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1130 "isascii", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1131 "iscntrl", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1132 "isdigit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1133 "isgraph", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1134 "islower", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1135 "isprint", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1136 "ispunct", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1137 "isspace", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1138 "isupper", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1139 "isxdigit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1140 "signbit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1141 "tolower", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1142 "toupper" |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1143 }; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1144 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1145 if (umap < 0 || umap >= num_unary_mappers) |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1146 return "unknown"; |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1147 else |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1148 return names[umap]; |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1149 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1150 |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1151 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1152 octave_base_value::warn_load (const char *type) const |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1153 { |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1154 warning_with_id |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1155 ("Octave:load-save-unavailable", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1156 "%s: loading %s files not available in this version of Octave", |
31845
2da025d5e98d
maint: Use 's_' prefix for static private class variables.
Rik <rik@octave.org>
parents:
31827
diff
changeset
|
1157 s_t_name.c_str (), type); |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1158 } |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1159 |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1160 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1161 octave_base_value::warn_save (const char *type) const |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1162 { |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1163 warning_with_id |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1164 ("Octave:load-save-unavailable", |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1165 "%s: saving %s files not available in this version of Octave", |
31845
2da025d5e98d
maint: Use 's_' prefix for static private class variables.
Rik <rik@octave.org>
parents:
31827
diff
changeset
|
1166 s_t_name.c_str (), type); |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1167 } |
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
1168 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1169 octave_value |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1170 octave_base_value::map (unary_mapper_t umap) const |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1171 { |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1172 error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ()); |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1173 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1174 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1175 void |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
1176 octave_base_value::lock () |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1177 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1178 err_wrong_type_arg ("octave_base_value::lock ()", type_name ()); |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1179 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1180 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1181 void |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
1182 octave_base_value::unlock () |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1183 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1184 err_wrong_type_arg ("octave_base_value::unlock ()", type_name ()); |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1185 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1186 |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23588
diff
changeset
|
1187 octave_value |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
1188 octave_base_value::dump () const |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1189 { |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23588
diff
changeset
|
1190 std::map<std::string, octave_value> m |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1191 = {{ "class", this->class_name () }, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1192 { "type", this->type_name () }, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1193 { "dims", this->dims().as_array () } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1194 }; |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1195 |
23680
ef71711f6d64
rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents:
23588
diff
changeset
|
1196 return octave_value (m); |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1197 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1198 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1199 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1200 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1201 err_indexed_assignment (const std::string& tn1, const std::string& tn2) |
5759 | 1202 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1203 error ("assignment of '%s' to indexed '%s' not implemented", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1204 tn2.c_str (), tn1.c_str ()); |
5759 | 1205 } |
1206 | |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1207 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1208 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1209 err_assign_conversion_failed (const std::string& tn1, const std::string& tn2) |
5759 | 1210 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1211 error ("type conversion for assignment of '%s' to indexed '%s' failed", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1212 tn2.c_str (), tn1.c_str ()); |
5759 | 1213 } |
1214 | |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1215 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1216 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1217 err_no_conversion (const std::string& on, const std::string& tn1, |
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1218 const std::string& tn2) |
5759 | 1219 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1220 error ("operator %s: no conversion for assignment of '%s' to indexed '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1221 on.c_str (), tn2.c_str (), tn1.c_str ()); |
5759 | 1222 } |
1223 | |
1224 octave_value | |
1225 octave_base_value::numeric_assign (const std::string& type, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1226 const std::list<octave_value_list>& idx, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1227 const octave_value& rhs) |
5759 | 1228 { |
1229 octave_value retval; | |
1230 | |
9286
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1231 if (idx.front ().empty ()) |
20879
5357423bca0a
Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents:
20853
diff
changeset
|
1232 error ("missing index in indexed assignment"); |
9286
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1233 |
5759 | 1234 int t_lhs = type_id (); |
1235 int t_rhs = rhs.type_id (); | |
1236 | |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30868
diff
changeset
|
1237 octave::type_info& ti = octave::__get_type_info__ (); |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1238 |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1239 octave::type_info::assign_op_fcn f |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1240 = ti.lookup_assign_op (octave_value::op_asn_eq, t_lhs, t_rhs); |
5759 | 1241 |
1242 bool done = false; | |
1243 | |
1244 if (f) | |
1245 { | |
1246 f (*this, idx.front (), rhs.get_rep ()); | |
1247 | |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
1248 done = true; |
5759 | 1249 } |
1250 | |
1251 if (done) | |
1252 { | |
31814
53c10d69a9be
maint: use "m_" prefix for member variables in class octave_value.
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
1253 m_count++; |
5759 | 1254 retval = octave_value (this); |
1255 } | |
1256 else | |
1257 { | |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1258 int t_result = ti.lookup_pref_assign_conv (t_lhs, t_rhs); |
5759 | 1259 |
1260 if (t_result >= 0) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1261 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1262 octave_base_value::type_conv_fcn cf |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1263 = ti.lookup_widening_op (t_lhs, t_result); |
5759 | 1264 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1265 if (! cf) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1266 err_indexed_assignment (type_name (), rhs.type_name ()); |
5759 | 1267 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1268 octave_base_value *tmp = cf (*this); |
5874 | 1269 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1270 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1271 err_assign_conversion_failed (type_name (), rhs.type_name ()); |
5759 | 1272 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1273 octave_value val (tmp); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1274 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1275 retval = val.subsasgn (type, idx, rhs); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1276 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1277 done = true; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1278 } |
5759 | 1279 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
1280 if (! done) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1281 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1282 octave_value tmp_rhs; |
5759 | 1283 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1284 octave_base_value::type_conv_info cf_rhs |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1285 = rhs.numeric_conversion_function (); |
5759 | 1286 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1287 octave_base_value::type_conv_info cf_this |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1288 = numeric_conversion_function (); |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1289 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1290 // Try biased (one-sided) conversions first. |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1291 if (cf_rhs.type_id () >= 0 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1292 && (ti.lookup_assign_op (octave_value::op_asn_eq, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1293 t_lhs, cf_rhs.type_id ()) |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1294 || ti.lookup_pref_assign_conv (t_lhs, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1295 cf_rhs.type_id ()) >= 0)) |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23718
diff
changeset
|
1296 cf_this = nullptr; |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1297 else if (cf_this.type_id () >= 0 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1298 && (ti.lookup_assign_op (octave_value::op_asn_eq, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1299 cf_this.type_id (), t_rhs) |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1300 || ti.lookup_pref_assign_conv (cf_this.type_id (), |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
1301 t_rhs) >= 0)) |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23718
diff
changeset
|
1302 cf_rhs = nullptr; |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1303 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1304 if (cf_rhs) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1305 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1306 octave_base_value *tmp = cf_rhs (rhs.get_rep ()); |
5759 | 1307 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1308 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1309 err_assign_conversion_failed (type_name (), rhs.type_name ()); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1310 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1311 tmp_rhs = octave_value (tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1312 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1313 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1314 tmp_rhs = rhs; |
5759 | 1315 |
31814
53c10d69a9be
maint: use "m_" prefix for member variables in class octave_value.
Rik <rik@octave.org>
parents:
31771
diff
changeset
|
1316 m_count++; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1317 octave_value tmp_lhs = octave_value (this); |
5759 | 1318 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1319 if (cf_this) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1320 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1321 octave_base_value *tmp = cf_this (*this); |
5759 | 1322 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1323 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1324 err_assign_conversion_failed (type_name (), rhs.type_name ()); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1325 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1326 tmp_lhs = octave_value (tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1327 } |
5759 | 1328 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1329 if (! cf_this && ! cf_rhs) |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1330 err_no_conversion (octave_value::assign_op_as_string |
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1331 (octave_value::op_asn_eq), |
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1332 type_name (), rhs.type_name ()); |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1333 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1334 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs); |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1335 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1336 done = true; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1337 } |
5759 | 1338 } |
1339 | |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1340 // The assignment may have converted to a type that is wider than necessary. |
5759 | 1341 |
1342 retval.maybe_mutate (); | |
1343 | |
1344 return retval; | |
1345 } | |
1346 | |
1347 // Current indentation. | |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1348 int octave_base_value::s_curr_print_indent_level = 0; |
5759 | 1349 |
1350 // TRUE means we are at the beginning of a line. | |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1351 bool octave_base_value::s_beginning_of_line = true; |
5759 | 1352 |
1353 // Each print() function should call this before printing anything. | |
1354 // | |
1355 // This doesn't need to be fast, but isn't there a better way? | |
1356 | |
1357 void | |
1358 octave_base_value::indent (std::ostream& os) const | |
1359 { | |
30723
08b08b7f05b2
Replace direct calls to C library assert() with Octave specialty functions in libinterp/ (bug #61753)
Arun Giridhar <arungiridhar@gmail.com> and Rik <rik@octave.org>
parents:
30588
diff
changeset
|
1360 panic_unless (s_curr_print_indent_level >= 0); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1361 |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1362 if (s_beginning_of_line) |
5759 | 1363 { |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1364 // FIXME: do we need this? |
5759 | 1365 // os << prefix; |
1366 | |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1367 for (int i = 0; i < s_curr_print_indent_level; i++) |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23795
diff
changeset
|
1368 os << ' '; |
5759 | 1369 |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1370 s_beginning_of_line = false; |
5759 | 1371 } |
1372 } | |
1373 | |
1374 // All print() functions should use this to print new lines. | |
1375 | |
1376 void | |
1377 octave_base_value::newline (std::ostream& os) const | |
1378 { | |
1379 os << "\n"; | |
1380 | |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1381 s_beginning_of_line = true; |
5759 | 1382 } |
1383 | |
21024
6176560b03d9
maint: Remove return stmts after gripe function calls.
Rik <rik@octave.org>
parents:
21013
diff
changeset
|
1384 // For resetting print state. |
5759 | 1385 |
1386 void | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
1387 octave_base_value::reset () const |
5759 | 1388 { |
30148
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1389 s_beginning_of_line = true; |
870687a59e96
maint: use "s_" prefix for static variables in class octave_base_value.
Rik <rik@octave.org>
parents:
30139
diff
changeset
|
1390 s_curr_print_indent_level = 0; |
5759 | 1391 } |
1392 | |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1393 octave_value |
10893
61a5ba82cfbb
omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
1394 octave_base_value::fast_elem_extract (octave_idx_type) const |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1395 { |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1396 return octave_value (); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1397 } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1398 |
32531
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1399 bool |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1400 octave_base_value::fast_elem_insert (octave_idx_type, const octave_value&) |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1401 { |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1402 return false; |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1403 } |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1404 |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1405 bool |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1406 octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1407 { |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1408 return false; |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1409 } |
435cfe35e3c6
disable building bytecode evaluator by default (bug #64977)
John W. Eaton <jwe@octave.org>
parents:
32513
diff
changeset
|
1410 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1411 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1412 oct_conv_matrix_conv (const octave_base_value&) |
2376 | 1413 { |
1414 return new octave_matrix (); | |
1415 } | |
1416 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1417 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1418 oct_conv_complex_matrix_conv (const octave_base_value&) |
2376 | 1419 { |
1420 return new octave_complex_matrix (); | |
1421 } | |
1422 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1423 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1424 oct_conv_string_conv (const octave_base_value&) |
2376 | 1425 { |
1426 return new octave_char_matrix_str (); | |
1427 } | |
1428 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1429 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1430 oct_conv_cell_conv (const octave_base_value&) |
3928 | 1431 { |
1432 return new octave_cell (); | |
1433 } | |
1434 | |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1435 static inline octave_value_list |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1436 sanitize (const octave_value_list& ovl) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1437 { |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1438 octave_value_list retval = ovl; |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1439 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1440 for (octave_idx_type i = 0; i < ovl.length (); i++) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1441 { |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1442 if (retval(i).is_magic_colon ()) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1443 retval(i) = ":"; |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1444 } |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1445 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1446 return retval; |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1447 } |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1448 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1449 octave_value |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1450 make_idx_args (const std::string& type, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1451 const std::list<octave_value_list>& idx, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1452 const std::string& who) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1453 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1454 std::size_t len = type.length (); |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1455 |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1456 if (len != idx.size ()) |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1457 error ("invalid index for %s", who.c_str ()); |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1458 |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1459 Cell type_field (1, len); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1460 Cell subs_field (1, len); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1461 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
1462 auto p = idx.begin (); |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1463 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
1464 for (std::size_t i = 0; i < len; i++) |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1465 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1466 char t = type[i]; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1467 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1468 switch (t) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1469 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1470 case '(': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1471 type_field(i) = "()"; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1472 subs_field(i) = Cell (sanitize (*p++)); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1473 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1474 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1475 case '{': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1476 type_field(i) = "{}"; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1477 subs_field(i) = Cell (sanitize (*p++)); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1478 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1479 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1480 case '.': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1481 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1482 type_field(i) = "."; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1483 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1484 octave_value_list vlist = *p++; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1485 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1486 if (vlist.length () != 1) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1487 error ("only single argument permitted for '.' index"); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1488 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1489 octave_value val = vlist(0); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1490 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1491 if (! val.is_string ()) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1492 error ("string argument required for '.' index"); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1493 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1494 subs_field(i) = val; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1495 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1496 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1497 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1498 default: |
33362
2949b89f9711
replace most uses of panic_impossible with error in octave_value classes
John W. Eaton <jwe@octave.org>
parents:
32633
diff
changeset
|
1499 error ("unexpected: index not '(', '{', or '.' in make_idx_args - please report this bug"); |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1500 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1501 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1502 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1503 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1504 octave_map m; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1505 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1506 m.assign ("type", type_field); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1507 m.assign ("subs", subs_field); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1508 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1509 return m; |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1510 } |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1511 |
26525
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1512 bool |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
1513 called_from_builtin () |
26525
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1514 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30868
diff
changeset
|
1515 octave::tree_evaluator& tw = octave::__get_evaluator__ (); |
26525
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1516 |
27209
ac92aa74fa1a
eliminate some direct access to call stack in gui and octave_base_value
John W. Eaton <jwe@octave.org>
parents:
26922
diff
changeset
|
1517 octave_function *fcn = tw.caller_function (); |
26525
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1518 |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1519 // FIXME: we probably need a better check here, or some other |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1520 // mechanism to avoid overloaded functions when builtin is used. |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1521 // For example, what if someone overloads the builtin function? |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1522 // Also, are there other places where using builtin is not properly |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1523 // avoiding dispatch? |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1524 |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1525 return (fcn && fcn->name () == "builtin"); |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1526 } |
0d3eca5955dc
Backed out changeset 920a4ad8043b (bug #54995)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
1527 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31260
diff
changeset
|
1528 OCTAVE_BEGIN_NAMESPACE(octave) |
29989
b260322f6730
move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
1529 |
2376 | 1530 void |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1531 install_base_type_conversions (octave::type_info& ti) |
2376 | 1532 { |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1533 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_scalar, octave_matrix); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1534 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_matrix, octave_matrix); |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1535 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_complex, |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1536 octave_complex_matrix); |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1537 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_complex_matrix, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1538 octave_complex_matrix); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1539 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_range, octave_matrix); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1540 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_char_matrix_str, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1541 octave_char_matrix_str); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1542 INSTALL_ASSIGNCONV_TI (ti, octave_base_value, octave_cell, octave_cell); |
2376 | 1543 |
24540
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1544 INSTALL_WIDENOP_TI (ti, octave_base_value, octave_matrix, matrix_conv); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1545 INSTALL_WIDENOP_TI (ti, octave_base_value, octave_complex_matrix, |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1546 complex_matrix_conv); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1547 INSTALL_WIDENOP_TI (ti, octave_base_value, octave_char_matrix_str, string_conv); |
46440078d73b
don't use singleton for octave_value_typeinfo
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
1548 INSTALL_WIDENOP_TI (ti, octave_base_value, octave_cell, cell_conv); |
2376 | 1549 } |
1550 | |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31260
diff
changeset
|
1551 OCTAVE_END_NAMESPACE(octave) |