Mercurial > octave
annotate libinterp/octave-value/ov-base.cc @ 23059:b98ebcd7f11c
move some octave stream classes into octave namespace
* oct-stream.h, oct-stream.cc (base_stream, stream, stream_list):
Move inside octave namespace and rename without octave_ prefix.
Change all uses.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 Jan 2017 13:56:16 -0500 |
parents | f97e22a9012a |
children | ef4d915df748 |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22296
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
11523 | 4 Copyright (C) 2009-2010 VZLU Prague |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
11 (at your option) any later version. |
2376 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
16 GNU General Public License for more details. |
2376 | 17 |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21660
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
25 # include "config.h" |
2376 | 26 #endif |
27 | |
3503 | 28 #include <iostream> |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
29 #include <limits> |
2901 | 30 |
2376 | 31 #include "lo-ieee.h" |
4732 | 32 #include "lo-mappers.h" |
2376 | 33 |
22091
0f6fc2ec3b1a
move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
34 #include "call-stack.h" |
5759 | 35 #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
|
36 #include "errwarn.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
|
37 #include "mxarray.h" |
2376 | 38 #include "oct-map.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20879
diff
changeset
|
39 #include "ovl.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
|
40 #include "oct-hdf5.h" |
2979 | 41 #include "oct-lvalue.h" |
3340 | 42 #include "oct-stream.h" |
2376 | 43 #include "ops.h" |
44 #include "ov-base.h" | |
3928 | 45 #include "ov-cell.h" |
46 #include "ov-ch-mat.h" | |
2376 | 47 #include "ov-complex.h" |
48 #include "ov-cx-mat.h" | |
3928 | 49 #include "ov-range.h" |
50 #include "ov-re-mat.h" | |
51 #include "ov-scalar.h" | |
2376 | 52 #include "ov-str-mat.h" |
4343 | 53 #include "ov-fcn-handle.h" |
5759 | 54 #include "parse.h" |
13112
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
55 #include "pr-output.h" |
5759 | 56 #include "utils.h" |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
22091
diff
changeset
|
57 #include "interpreter.h" |
2948 | 58 #include "variables.h" |
2376 | 59 |
9790
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
60 builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
61 { |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
62 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
|
63 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
64 if (x == btyp_bool) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
65 x = btyp_double; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
66 if (y == btyp_bool) |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
67 y = btyp_double; |
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 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
|
70 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
|
71 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
|
72 retval = x; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
73 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
|
74 retval = y; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
75 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
|
76 && 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
|
77 || (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
|
78 && 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
|
79 retval = (x > y) ? x : y; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
80 |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
81 return retval; |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
82 } |
a5035bc7fbfb
rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents:
9753
diff
changeset
|
83 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
84 std::string btyp_class_name[btyp_num_types] = |
10087
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
85 { |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
86 "double", "single", "double", "single", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
87 "int8", "int16", "int32", "int64", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
88 "uint8", "uint16", "uint32", "uint64", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
89 "logical", "char", |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
90 "struct", "cell", "function_handle" |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
91 }; |
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 string_vector |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
94 get_builtin_classes (void) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
95 { |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
96 static string_vector retval; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
97 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
98 if (retval.is_empty ()) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
99 { |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
100 int n = btyp_num_types - 2; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
101 retval = string_vector (n); |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
102 int j = 0; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
103 for (int i = 0; i < btyp_num_types; i++) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
104 { |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
105 builtin_type_t ityp = static_cast<builtin_type_t> (i); |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
106 if (ityp != btyp_complex && ityp != btyp_float_complex) |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
107 retval(j++) = btyp_class_name[i]; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
108 } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
109 } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
110 |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
111 return retval; |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
112 } |
090173f2db40
improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents:
10075
diff
changeset
|
113 |
4612 | 114 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
|
115 "<unknown type>", "unknown"); |
2376 | 116 |
7193 | 117 // TRUE means to perform automatic sparse to real mutation if there |
118 // is memory to be saved | |
119 bool Vsparse_auto_mutate = false; | |
120 | |
10544
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
121 octave_base_value * |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
122 octave_base_value::empty_clone (void) const |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
123 { |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
124 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
|
125 } |
9961fc022d9d
fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents:
10521
diff
changeset
|
126 |
2376 | 127 octave_value |
4532 | 128 octave_base_value::squeeze (void) const |
129 { | |
130 std::string nm = type_name (); | |
131 error ("squeeze: invalid operation for %s type", nm.c_str ()); | |
132 } | |
133 | |
134 octave_value | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
135 octave_base_value::full_value (void) const |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
136 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
137 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
|
138 } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
139 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
140 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
141 octave_base_value::as_double (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
142 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
143 err_invalid_conversion (type_name (), "double"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
144 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
145 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
146 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
147 octave_base_value::as_single (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
148 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
149 err_invalid_conversion (type_name (), "single"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
150 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
151 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
152 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
153 octave_base_value::as_int8 (void) const |
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 (), "int8"); |
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 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
159 octave_base_value::as_int16 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
160 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
161 err_invalid_conversion (type_name (), "int16"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
162 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
163 |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
164 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
165 octave_base_value::as_int32 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
166 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
167 err_invalid_conversion (type_name (), "int32"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
168 } |
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 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
171 octave_base_value::as_int64 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
172 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
173 err_invalid_conversion (type_name (), "int64"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
174 } |
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 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
177 octave_base_value::as_uint8 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
178 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
179 err_invalid_conversion (type_name (), "uint8"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
180 } |
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 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
183 octave_base_value::as_uint16 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
184 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
185 err_invalid_conversion (type_name (), "uint16"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
186 } |
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 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
189 octave_base_value::as_uint32 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
190 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
191 err_invalid_conversion (type_name (), "uint32"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
192 } |
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 octave_value |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
195 octave_base_value::as_uint64 (void) const |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
196 { |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
197 err_invalid_conversion (type_name (), "uint64"); |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
198 } |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
199 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
200 Matrix |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
201 octave_base_value::size (void) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
202 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 mdv(i) = dv(i); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
207 return mdv; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
208 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
209 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
210 octave_idx_type |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
211 octave_base_value::numel (const octave_value_list& idx) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
212 { |
9705
5acd99c3e794
avoid recursive overloaded calls in builtin numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
213 return dims_to_numel (dims (), idx); |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
214 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
215 |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
216 octave_value |
4247 | 217 octave_base_value::subsref (const std::string&, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
218 const std::list<octave_value_list>&) |
3933 | 219 { |
220 std::string nm = type_name (); | |
221 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
222 } | |
223 | |
224 octave_value_list | |
4247 | 225 octave_base_value::subsref (const std::string&, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
226 const std::list<octave_value_list>&, int) |
3933 | 227 { |
228 std::string nm = type_name (); | |
229 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
230 } | |
231 | |
232 octave_value | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
233 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
|
234 const std::list<octave_value_list>& idx, |
8677
095ae5e0a831
eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
235 bool /* auto_add */) |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
236 { |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
237 // 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
|
238 return subsref (type, idx); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
239 } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
240 |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
241 octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
242 octave_base_value::subsref (const std::string& type, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
243 const std::list<octave_value_list>& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
244 int nargout, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
245 const std::list<octave_lvalue> *) |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
246 { |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
247 // Fall back to call without passing lvalue list. |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
248 return subsref (type, idx, nargout); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
249 } |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
250 |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
251 octave_value |
5885 | 252 octave_base_value::do_index_op (const octave_value_list&, bool) |
2974 | 253 { |
3523 | 254 std::string nm = type_name (); |
2974 | 255 error ("can't perform indexing operations for %s type", nm.c_str ()); |
256 } | |
257 | |
258 octave_value_list | |
3544 | 259 octave_base_value::do_multi_index_op (int, const octave_value_list&) |
2376 | 260 { |
3523 | 261 std::string nm = type_name (); |
2376 | 262 error ("can't perform indexing operations for %s type", nm.c_str ()); |
263 } | |
264 | |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
265 octave_value_list |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
266 octave_base_value::do_multi_index_op (int nargout, const octave_value_list& idx, |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
267 const std::list<octave_lvalue> *) |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
268 { |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
269 // Fall back. |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
270 return do_multi_index_op (nargout, idx); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
271 } |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10768
diff
changeset
|
272 |
2376 | 273 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
|
274 octave_base_value::index_vector (bool /* require_integers */) const |
2376 | 275 { |
20542
dd6345fd8a97
use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
20163
diff
changeset
|
276 std::string nm = "<" + type_name () + ">"; |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
277 octave::err_invalid_index (nm.c_str ()); |
2376 | 278 } |
279 | |
280 octave_value | |
4247 | 281 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
|
282 const std::list<octave_value_list>& idx, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
283 const octave_value& rhs) |
2376 | 284 { |
3933 | 285 octave_value retval; |
2376 | 286 |
3933 | 287 if (is_defined ()) |
288 { | |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
289 if (! is_numeric_type ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
290 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
291 std::string nm = type_name (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
292 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
|
293 } |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
294 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
295 switch (type[0]) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
296 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
297 case '(': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
298 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
299 if (type.length () == 1) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
300 retval = numeric_assign (type, idx, rhs); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
301 else if (is_empty ()) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
302 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
303 // 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
|
304 // type in cases like |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
305 // |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
306 // x = []; x(i).f = rhs |
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 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
|
309 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
310 retval = tmp.subsasgn (type, idx, rhs); |
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 else |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
313 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
314 std::string nm = type_name (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
315 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
|
316 nm.c_str ()); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
317 } |
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 break; |
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 case '{': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
322 case '.': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
323 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
324 std::string nm = type_name (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
325 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
|
326 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
327 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
328 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
329 default: |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
330 panic_impossible (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
331 } |
3933 | 332 } |
333 else | |
334 { | |
335 // 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
|
336 // types and then call undef_subsasgn for that object. |
3933 | 337 |
338 octave_value tmp = octave_value::empty_conv (type, rhs); | |
339 | |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
340 retval = tmp.undef_subsasgn (type, idx, rhs); |
3933 | 341 } |
342 | |
343 return retval; | |
2376 | 344 } |
345 | |
12171
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
346 octave_value |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
347 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
|
348 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
|
349 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
|
350 { |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
351 // 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
|
352 // 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
|
353 |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
354 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
|
355 } |
d08901c05c1b
fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
356 |
5602 | 357 octave_idx_type |
358 octave_base_value::nnz (void) const | |
359 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
360 err_wrong_type_arg ("octave_base_value::nnz ()", type_name ()); |
5602 | 361 } |
362 | |
5604 | 363 octave_idx_type |
364 octave_base_value::nzmax (void) const | |
365 { | |
10513
c5005bc2b7a9
implement working spalloc
Jaroslav Hajek <highegg@gmail.com>
parents:
10414
diff
changeset
|
366 return numel (); |
5604 | 367 } |
368 | |
5900 | 369 octave_idx_type |
370 octave_base_value::nfields (void) const | |
371 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
372 err_wrong_type_arg ("octave_base_value::nfields ()", type_name ()); |
5900 | 373 } |
374 | |
2376 | 375 octave_value |
4567 | 376 octave_base_value::reshape (const dim_vector&) const |
377 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
378 err_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); |
4567 | 379 } |
380 | |
381 octave_value | |
4593 | 382 octave_base_value::permute (const Array<int>&, bool) const |
383 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
384 err_wrong_type_arg ("octave_base_value::permute ()", type_name ()); |
4593 | 385 } |
386 | |
387 octave_value | |
5731 | 388 octave_base_value::resize (const dim_vector&, bool) const |
4915 | 389 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
390 err_wrong_type_arg ("octave_base_value::resize ()", type_name ()); |
4915 | 391 } |
392 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
393 MatrixType |
5785 | 394 octave_base_value::matrix_type (void) const |
395 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
396 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); |
5785 | 397 } |
398 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
399 MatrixType |
5785 | 400 octave_base_value::matrix_type (const MatrixType&) const |
401 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
402 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); |
5785 | 403 } |
404 | |
4915 | 405 octave_value |
5759 | 406 octave_base_value::all (int) const |
407 { | |
408 return 0.0; | |
409 } | |
410 | |
411 octave_value | |
412 octave_base_value::any (int) const | |
413 { | |
414 return 0.0; | |
415 } | |
416 | |
417 octave_value | |
418 octave_base_value::convert_to_str (bool pad, bool force, char type) const | |
419 { | |
420 octave_value retval = convert_to_str_internal (pad, force, type); | |
421 | |
5781 | 422 if (! force && is_numeric_type ()) |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
423 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
|
424 type_name (), retval.type_name ()); |
5759 | 425 |
426 return retval; | |
427 } | |
428 | |
429 octave_value | |
5279 | 430 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376 | 431 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
432 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
|
433 type_name ()); |
2376 | 434 } |
435 | |
436 void | |
437 octave_base_value::convert_to_row_or_column_vector (void) | |
438 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
439 err_wrong_type_arg |
21024
6176560b03d9
maint: Remove return stmts after gripe function calls.
Rik <rik@octave.org>
parents:
21013
diff
changeset
|
440 ("octave_base_value::convert_to_row_or_column_vector ()", type_name ()); |
2376 | 441 } |
442 | |
443 void | |
18416
bcd71a2531d3
Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18316
diff
changeset
|
444 octave_base_value::print (std::ostream&, bool) |
2376 | 445 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
446 err_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376 | 447 } |
448 | |
2901 | 449 void |
3523 | 450 octave_base_value::print_raw (std::ostream&, bool) const |
2901 | 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 ("octave_base_value::print_raw ()", type_name ()); |
2901 | 453 } |
454 | |
455 bool | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
456 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
|
457 const std::string& name) const |
2901 | 458 { |
4604 | 459 bool retval = false; |
460 | |
2901 | 461 indent (os); |
4604 | 462 |
463 if (print_as_scalar ()) | |
464 os << name << " = "; | |
465 else | |
466 { | |
467 os << name << " ="; | |
468 newline (os); | |
13112
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
469 if (! Vcompact_format) |
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
470 newline (os); |
969ed305dde5
Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
12820
diff
changeset
|
471 |
4604 | 472 retval = true; |
473 } | |
474 | |
475 return retval; | |
2901 | 476 } |
477 | |
3933 | 478 void |
5759 | 479 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
|
480 const std::string& name, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
481 bool print_padding) |
5759 | 482 { |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
483 bool pad_after = print_name_tag (output_buf, name); |
5759 | 484 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
485 print (output_buf); |
5759 | 486 |
20792
d0991cbd6141
maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents:
20785
diff
changeset
|
487 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
|
488 newline (output_buf); |
5759 | 489 } |
490 | |
491 void | |
3933 | 492 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
|
493 const std::string& /* prefix */) const |
3933 | 494 { |
495 os << "no info for type: " << type_name () << "\n"; | |
496 } | |
497 | |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
498 #define INT_CONV_METHOD(T, F) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
499 T \ |
4254 | 500 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
|
501 { \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
502 T retval = 0; \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
503 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
504 double d = 0.0; \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
505 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
506 try \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
507 { \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
508 d = double_value (frc_str_conv); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
509 } \ |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
510 catch (octave::execution_exception& e) \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
511 { \ |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
512 err_wrong_type_arg (e, "octave_base_value::" #F "_value ()", type_name ()); \ |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
513 } \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
514 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
515 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
|
516 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
|
517 else if (d < std::numeric_limits<T>::min ()) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
518 retval = std::numeric_limits<T>::min (); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
519 else if (d > std::numeric_limits<T>::max ()) \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
520 retval = std::numeric_limits<T>::max (); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
521 else \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
522 retval = static_cast<T> (octave::math::fix (d)); \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
523 \ |
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22094
diff
changeset
|
524 return retval; \ |
4254 | 525 } |
3202 | 526 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
527 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
|
528 INT_CONV_METHOD (unsigned short int, ushort) |
3202 | 529 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
530 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
|
531 INT_CONV_METHOD (unsigned int, uint) |
3202 | 532 |
15215
9020dddc925a
use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
533 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
|
534 INT_CONV_METHOD (unsigned long int, ulong) |
3202 | 535 |
16323
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
536 INT_CONV_METHOD (int64_t, int64) |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
537 INT_CONV_METHOD (uint64_t, uint64) |
e769440b39db
provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents:
15696
diff
changeset
|
538 |
3202 | 539 int |
540 octave_base_value::nint_value (bool frc_str_conv) const | |
541 { | |
20747
ee2743bd07a8
eliminate various compiler warnings
John W. Eaton <jwe@octave.org>
parents:
20741
diff
changeset
|
542 double d = 0.0; |
3202 | 543 |
20741
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
544 try |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
545 { |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
546 d = double_value (frc_str_conv); |
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
547 } |
22327
d0562b3159c7
move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
548 catch (octave::execution_exception& e) |
3202 | 549 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
550 err_wrong_type_arg (e, "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
|
551 } |
3202 | 552 |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21739
diff
changeset
|
553 if (octave::math::isnan (d)) |
20741
a5ab31b52ae8
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20700
diff
changeset
|
554 error ("conversion of NaN to integer value failed"); |
3202 | 555 |
21782
2aef506f3fec
use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents:
21739
diff
changeset
|
556 return static_cast<int> (octave::math::fix (d)); |
3202 | 557 } |
558 | |
2376 | 559 double |
560 octave_base_value::double_value (bool) const | |
561 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
562 err_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
2376 | 563 } |
564 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
565 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
566 octave_base_value::float_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
567 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
568 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
|
569 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
570 |
3351 | 571 Cell |
3539 | 572 octave_base_value::cell_value () const |
3351 | 573 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
574 err_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); |
3351 | 575 } |
576 | |
2376 | 577 Matrix |
578 octave_base_value::matrix_value (bool) const | |
579 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
580 err_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); |
2376 | 581 } |
582 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
583 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
584 octave_base_value::float_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
585 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
586 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
|
587 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
588 |
4507 | 589 NDArray |
4550 | 590 octave_base_value::array_value (bool) const |
4505 | 591 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
592 err_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505 | 593 } |
594 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
595 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
596 octave_base_value::float_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
597 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
598 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
|
599 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
600 |
2376 | 601 Complex |
602 octave_base_value::complex_value (bool) const | |
603 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
604 err_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
2376 | 605 } |
606 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
607 FloatComplex |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
608 octave_base_value::float_complex_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
609 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
610 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
|
611 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
612 |
2376 | 613 ComplexMatrix |
614 octave_base_value::complex_matrix_value (bool) const | |
615 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
616 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
|
617 type_name ()); |
2376 | 618 } |
619 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
620 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
621 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
|
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::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
|
624 type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
625 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
626 |
4550 | 627 ComplexNDArray |
628 octave_base_value::complex_array_value (bool) const | |
629 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
630 err_wrong_type_arg ("octave_base_value::complex_array_value()", type_name ()); |
4550 | 631 } |
632 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
633 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
634 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
|
635 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
636 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
|
637 type_name ()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
638 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
639 |
4550 | 640 bool |
5943 | 641 octave_base_value::bool_value (bool) const |
4550 | 642 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
643 err_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); |
4550 | 644 } |
645 | |
646 boolMatrix | |
5943 | 647 octave_base_value::bool_matrix_value (bool) const |
4550 | 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::bool_matrix_value()", type_name ()); |
4550 | 650 } |
651 | |
652 boolNDArray | |
5943 | 653 octave_base_value::bool_array_value (bool) const |
4550 | 654 { |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
655 err_wrong_type_arg ("octave_base_value::bool_array_value()", type_name ()); |
4550 | 656 } |
657 | |
2376 | 658 charMatrix |
4741 | 659 octave_base_value::char_matrix_value (bool force) const |
2376 | 660 { |
661 charMatrix retval; | |
4257 | 662 |
4741 | 663 octave_value tmp = convert_to_str (false, force); |
4257 | 664 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
665 retval = tmp.char_matrix_value (); |
4452 | 666 |
2376 | 667 return retval; |
668 } | |
669 | |
4550 | 670 charNDArray |
671 octave_base_value::char_array_value (bool) const | |
672 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
673 err_wrong_type_arg ("octave_base_value::char_array_value()", type_name ()); |
4550 | 674 } |
675 | |
5164 | 676 SparseMatrix |
677 octave_base_value::sparse_matrix_value (bool) const | |
678 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
679 err_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); |
5164 | 680 } |
681 | |
682 SparseComplexMatrix | |
683 octave_base_value::sparse_complex_matrix_value (bool) const | |
684 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
685 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
|
686 type_name ()); |
5164 | 687 } |
688 | |
689 SparseBoolMatrix | |
690 octave_base_value::sparse_bool_matrix_value (bool) const | |
691 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
692 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
|
693 type_name ()); |
5164 | 694 } |
695 | |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
696 DiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
697 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
|
698 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
699 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
|
700 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
701 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
702 FloatDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
703 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
|
704 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
705 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
|
706 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
707 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
708 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
709 ComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
710 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
|
711 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
712 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
|
713 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
714 } |
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 FloatComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
717 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
|
718 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
719 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
|
720 type_name ()); |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
721 } |
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 PermMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
724 octave_base_value::perm_matrix_value (void) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
725 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
726 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
|
727 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
728 |
4910 | 729 octave_int8 |
730 octave_base_value::int8_scalar_value (void) const | |
731 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
732 err_wrong_type_arg ("octave_base_value::int8_scalar_value()", type_name ()); |
4910 | 733 } |
734 | |
735 octave_int16 | |
736 octave_base_value::int16_scalar_value (void) const | |
737 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
738 err_wrong_type_arg ("octave_base_value::int16_scalar_value()", type_name ()); |
4910 | 739 } |
740 | |
741 octave_int32 | |
742 octave_base_value::int32_scalar_value (void) const | |
743 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
744 err_wrong_type_arg ("octave_base_value::int32_scalar_value()", type_name ()); |
4910 | 745 } |
746 | |
747 octave_int64 | |
748 octave_base_value::int64_scalar_value (void) const | |
749 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
750 err_wrong_type_arg ("octave_base_value::int64_scalar_value()", type_name ()); |
4910 | 751 } |
752 | |
753 octave_uint8 | |
754 octave_base_value::uint8_scalar_value (void) const | |
755 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
756 err_wrong_type_arg ("octave_base_value::uint8_scalar_value()", type_name ()); |
4910 | 757 } |
758 | |
759 octave_uint16 | |
760 octave_base_value::uint16_scalar_value (void) const | |
761 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
762 err_wrong_type_arg ("octave_base_value::uint16_scalar_value()", type_name ()); |
4910 | 763 } |
764 | |
765 octave_uint32 | |
766 octave_base_value::uint32_scalar_value (void) const | |
767 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
768 err_wrong_type_arg ("octave_base_value::uint32_scalar_value()", type_name ()); |
4910 | 769 } |
770 | |
771 octave_uint64 | |
772 octave_base_value::uint64_scalar_value (void) const | |
773 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
774 err_wrong_type_arg ("octave_base_value::uint64_scalar_value()", type_name ()); |
4910 | 775 } |
776 | |
4906 | 777 int8NDArray |
778 octave_base_value::int8_array_value (void) const | |
779 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
780 err_wrong_type_arg ("octave_base_value::int8_array_value()", type_name ()); |
4906 | 781 } |
782 | |
783 int16NDArray | |
784 octave_base_value::int16_array_value (void) const | |
785 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
786 err_wrong_type_arg ("octave_base_value::int16_array_value()", type_name ()); |
4906 | 787 } |
788 | |
789 int32NDArray | |
790 octave_base_value::int32_array_value (void) const | |
791 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
792 err_wrong_type_arg ("octave_base_value::int32_array_value()", type_name ()); |
4906 | 793 } |
794 | |
795 int64NDArray | |
796 octave_base_value::int64_array_value (void) const | |
797 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
798 err_wrong_type_arg ("octave_base_value::int64_array_value()", type_name ()); |
4906 | 799 } |
800 | |
801 uint8NDArray | |
802 octave_base_value::uint8_array_value (void) const | |
803 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
804 err_wrong_type_arg ("octave_base_value::uint8_array_value()", type_name ()); |
4906 | 805 } |
806 | |
807 uint16NDArray | |
808 octave_base_value::uint16_array_value (void) const | |
809 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
810 err_wrong_type_arg ("octave_base_value::uint16_array_value()", type_name ()); |
4906 | 811 } |
812 | |
813 uint32NDArray | |
814 octave_base_value::uint32_array_value (void) const | |
815 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
816 err_wrong_type_arg ("octave_base_value::uint32_array_value()", type_name ()); |
4906 | 817 } |
818 | |
819 uint64NDArray | |
820 octave_base_value::uint64_array_value (void) const | |
821 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
822 err_wrong_type_arg ("octave_base_value::uint64_array_value()", type_name ()); |
4906 | 823 } |
824 | |
2493 | 825 string_vector |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20978
diff
changeset
|
826 octave_base_value::string_vector_value (bool pad) const |
2376 | 827 { |
2493 | 828 string_vector retval; |
4257 | 829 |
5715 | 830 octave_value tmp = convert_to_str (pad, true); |
4257 | 831 |
20990
fc9cca99b2de
Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents:
20978
diff
changeset
|
832 retval = tmp.string_vector_value (); |
4257 | 833 |
2376 | 834 return retval; |
835 } | |
836 | |
3536 | 837 std::string |
4457 | 838 octave_base_value::string_value (bool force) const |
2376 | 839 { |
3523 | 840 std::string retval; |
4257 | 841 |
4457 | 842 octave_value tmp = convert_to_str (force); |
4257 | 843 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
844 retval = tmp.string_value (); |
4257 | 845 |
2376 | 846 return retval; |
847 } | |
848 | |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
849 std::string |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
850 octave_base_value::xstring_value (void) const |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
851 { |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
852 std::string retval; |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
853 wrong_type_arg_error (); |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
854 return retval; |
20576
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
855 } |
40ed9b46a800
new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents:
20555
diff
changeset
|
856 |
8732 | 857 Array<std::string> |
858 octave_base_value::cellstr_value (void) const | |
859 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
860 err_wrong_type_arg ("octave_base_value::cellstr_value()", type_name ()); |
8732 | 861 } |
862 | |
2376 | 863 Range |
864 octave_base_value::range_value (void) const | |
865 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
866 err_wrong_type_arg ("octave_base_value::range_value()", type_name ()); |
2376 | 867 } |
868 | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
869 octave_map |
2376 | 870 octave_base_value::map_value (void) const |
871 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
872 err_wrong_type_arg ("octave_base_value::map_value()", type_name ()); |
2376 | 873 } |
874 | |
10742
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
875 octave_scalar_map |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
876 octave_base_value::scalar_map_value (void) const |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
877 { |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
878 octave_map tmp = map_value (); |
604e13a89c7f
initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
10670
diff
changeset
|
879 |
20879
5357423bca0a
Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents:
20853
diff
changeset
|
880 if (tmp.numel () != 1) |
20678
4b00afb5e9c3
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20666
diff
changeset
|
881 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
|
882 |
20879
5357423bca0a
Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents:
20853
diff
changeset
|
883 return octave_scalar_map (tmp.checkelem (0)); |
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 |
3933 | 886 string_vector |
887 octave_base_value::map_keys (void) const | |
888 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
889 err_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); |
3933 | 890 } |
891 | |
9151 | 892 size_t |
893 octave_base_value::nparents (void) const | |
894 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
895 err_wrong_type_arg ("octave_base_value::nparents()", type_name ()); |
9151 | 896 } |
897 | |
898 std::list<std::string> | |
899 octave_base_value::parent_class_name_list (void) const | |
900 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
901 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
|
902 type_name ()); |
9151 | 903 } |
904 | |
905 string_vector | |
906 octave_base_value::parent_class_names (void) const | |
907 { | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
908 err_wrong_type_arg ("octave_base_value::parent_class_names()", type_name ()); |
9151 | 909 } |
910 | |
2974 | 911 octave_function * |
912 octave_base_value::function_value (bool silent) | |
913 { | |
914 octave_function *retval = 0; | |
915 | |
916 if (! silent) | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
917 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
|
918 |
2974 | 919 return retval; |
920 } | |
921 | |
4700 | 922 octave_user_function * |
923 octave_base_value::user_function_value (bool silent) | |
924 { | |
925 octave_user_function *retval = 0; | |
926 | |
927 if (! silent) | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
928 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
|
929 type_name ()); |
4700 | 930 return retval; |
931 } | |
932 | |
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
|
933 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
|
934 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
|
935 { |
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
|
936 octave_user_script *retval = 0; |
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
|
937 |
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
|
938 if (! silent) |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
939 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
|
940 |
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
|
941 return retval; |
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
|
942 } |
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
|
943 |
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
|
944 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
|
945 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
|
946 { |
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
|
947 octave_user_code *retval = 0; |
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
|
948 |
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
|
949 if (! silent) |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
950 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
|
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 return retval; |
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 } |
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 |
4346 | 955 octave_fcn_handle * |
4343 | 956 octave_base_value::fcn_handle_value (bool silent) |
957 { | |
4346 | 958 octave_fcn_handle *retval = 0; |
4343 | 959 |
960 if (! silent) | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
961 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
|
962 |
4343 | 963 return retval; |
964 } | |
965 | |
4933 | 966 octave_fcn_inline * |
967 octave_base_value::fcn_inline_value (bool silent) | |
968 { | |
969 octave_fcn_inline *retval = 0; | |
970 | |
971 if (! silent) | |
21129
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
972 err_wrong_type_arg ("octave_base_value::fcn_inline_value()", type_name ()); |
228b65504557
maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents:
21118
diff
changeset
|
973 |
4933 | 974 return retval; |
975 } | |
976 | |
2882 | 977 octave_value_list |
978 octave_base_value::list_value (void) const | |
979 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
980 err_wrong_type_arg ("octave_base_value::list_value()", type_name ()); |
2882 | 981 } |
982 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
983 bool |
6974 | 984 octave_base_value::save_ascii (std::ostream&) |
4687 | 985 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
986 err_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); |
4687 | 987 } |
988 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
989 bool |
4687 | 990 octave_base_value::load_ascii (std::istream&) |
991 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
992 err_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); |
4687 | 993 } |
994 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
995 bool |
4687 | 996 octave_base_value::save_binary (std::ostream&, bool&) |
997 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
998 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
4687 | 999 } |
1000 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1001 bool |
4687 | 1002 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
|
1003 octave::mach_info::float_format) |
4687 | 1004 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1005 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
4687 | 1006 } |
1007 | |
1008 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
|
1009 octave_base_value::save_hdf5 (octave_hdf5_id, const char *, bool) |
4687 | 1010 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1011 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
4687 | 1012 } |
1013 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1014 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
|
1015 octave_base_value::load_hdf5 (octave_hdf5_id, const char *) |
4687 | 1016 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1017 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
4687 | 1018 } |
4944 | 1019 |
1020 int | |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
23052
diff
changeset
|
1021 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
|
1022 int, octave::mach_info::float_format) const |
4944 | 1023 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1024 err_wrong_type_arg ("octave_base_value::write()", type_name ()); |
4944 | 1025 } |
1026 | |
5900 | 1027 mxArray * |
1028 octave_base_value::as_mxArray (void) const | |
1029 { | |
1030 return 0; | |
1031 } | |
1032 | |
7433 | 1033 octave_value |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1034 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
|
1035 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1036 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
|
1037 } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1038 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1039 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
|
1040 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
|
1041 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1042 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
|
1043 } |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
1044 |
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 octave_value |
7433 | 1046 octave_base_value::sort (octave_idx_type, sortmode) const |
1047 { | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1048 err_wrong_type_arg ("octave_base_value::sort ()", type_name ()); |
7433 | 1049 } |
1050 | |
1051 octave_value | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1052 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
|
1053 octave_idx_type, sortmode) const |
7433 | 1054 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1055 err_wrong_type_arg ("octave_base_value::sort ()", type_name ()); |
7433 | 1056 } |
1057 | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1058 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
|
1059 octave_base_value::is_sorted (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1060 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1061 err_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1062 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1063 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1064 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
|
1065 octave_base_value::sort_rows_idx (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1066 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1067 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
|
1068 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1069 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1070 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
|
1071 octave_base_value::is_sorted_rows (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1072 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1073 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
|
1074 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1075 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1076 const char * |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
1077 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
|
1078 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1079 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
|
1080 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1081 "abs", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1082 "acos", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1083 "acosh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1084 "angle", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1085 "arg", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1086 "asin", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1087 "asinh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1088 "atan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1089 "atanh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1090 "cbrt", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1091 "ceil", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1092 "conj", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1093 "cos", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1094 "cosh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1095 "erf", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1096 "erfinv", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1097 "erfcinv", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1098 "erfc", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1099 "erfcx", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1100 "erfi", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1101 "dawson", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1102 "exp", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1103 "expm1", |
21013
7f4c6d594e3d
Finish renaming mapper function finite to isfinite.
Rik <rik@octave.org>
parents:
20990
diff
changeset
|
1104 "isfinite", |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1105 "fix", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1106 "floor", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1107 "gamma", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1108 "imag", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1109 "isinf", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1110 "isna", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1111 "isnan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1112 "lgamma", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1113 "log", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1114 "log2", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1115 "log10", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1116 "log1p", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1117 "real", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1118 "round", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1119 "roundb", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1120 "signum", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1121 "sin", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1122 "sinh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1123 "sqrt", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1124 "tan", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1125 "tanh", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1126 "isalnum", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1127 "isalpha", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1128 "isascii", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1129 "iscntrl", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1130 "isdigit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1131 "isgraph", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1132 "islower", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1133 "isprint", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1134 "ispunct", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1135 "isspace", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1136 "isupper", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1137 "isxdigit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1138 "signbit", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1139 "toascii", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1140 "tolower", |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1141 "toupper" |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1142 }; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1143 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1144 if (umap < 0 || umap >= num_unary_mappers) |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1145 return "unknown"; |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1146 else |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1147 return names[umap]; |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1148 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1149 |
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
|
1150 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1151 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
|
1152 { |
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 warning_with_id |
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 ("Octave:load-save-unavailable", |
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
|
1155 "%s: loading %s files not available in this version of Octave", |
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
|
1156 t_name.c_str (), type); |
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
|
1157 } |
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 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1160 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
|
1161 { |
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 warning_with_id |
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 ("Octave:load-save-unavailable", |
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
|
1164 "%s: saving %s files not available in this version of Octave", |
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
|
1165 t_name.c_str (), type); |
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
|
1166 } |
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 |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
1168 void |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
1169 octave_base_value::wrong_type_arg_error (void) const |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
1170 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1171 err_wrong_type_arg (type_name ()); |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
1172 } |
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20681
diff
changeset
|
1173 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1174 octave_value |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1175 octave_base_value::map (unary_mapper_t umap) const |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1176 { |
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9790
diff
changeset
|
1177 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
|
1178 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1179 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1180 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1181 octave_base_value::lock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1182 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1183 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
|
1184 } |
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 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1187 octave_base_value::unlock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1188 { |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21040
diff
changeset
|
1189 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
|
1190 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1191 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1192 void |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1193 octave_base_value::dump (std::ostream& os) const |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1194 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1195 dim_vector dv = this->dims (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1196 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1197 os << "class: " << this->class_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1198 << " type: " << this->type_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1199 << " dims: " << dv.str (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1200 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1201 |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1202 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1203 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1204 err_indexed_assignment (const std::string& tn1, const std::string& tn2) |
5759 | 1205 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1206 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
|
1207 tn2.c_str (), tn1.c_str ()); |
5759 | 1208 } |
1209 | |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1210 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1211 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1212 err_assign_conversion_failed (const std::string& tn1, const std::string& tn2) |
5759 | 1213 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1214 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
|
1215 tn2.c_str (), tn1.c_str ()); |
5759 | 1216 } |
1217 | |
21040
3e7cfee5f786
maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents:
21029
diff
changeset
|
1218 OCTAVE_NORETURN static |
21029
e3b3bb522d62
maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents:
21024
diff
changeset
|
1219 void |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1220 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
|
1221 const std::string& tn2) |
5759 | 1222 { |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
1223 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
|
1224 on.c_str (), tn2.c_str (), tn1.c_str ()); |
5759 | 1225 } |
1226 | |
1227 octave_value | |
1228 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
|
1229 const std::list<octave_value_list>& idx, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1230 const octave_value& rhs) |
5759 | 1231 { |
1232 octave_value retval; | |
1233 | |
9286
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1234 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
|
1235 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
|
1236 |
5759 | 1237 int t_lhs = type_id (); |
1238 int t_rhs = rhs.type_id (); | |
1239 | |
1240 octave_value_typeinfo::assign_op_fcn f | |
1241 = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1242 t_lhs, t_rhs); |
5759 | 1243 |
1244 bool done = false; | |
1245 | |
1246 if (f) | |
1247 { | |
1248 f (*this, idx.front (), rhs.get_rep ()); | |
1249 | |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
1250 done = true; |
5759 | 1251 } |
1252 | |
1253 if (done) | |
1254 { | |
1255 count++; | |
1256 retval = octave_value (this); | |
1257 } | |
1258 else | |
1259 { | |
1260 int t_result | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1261 = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs); |
5759 | 1262 |
1263 if (t_result >= 0) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1264 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1265 octave_base_value::type_conv_fcn cf |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1266 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result); |
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 if (! cf) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1269 err_indexed_assignment (type_name (), rhs.type_name ()); |
5759 | 1270 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1271 octave_base_value *tmp = cf (*this); |
5874 | 1272 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1273 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1274 err_assign_conversion_failed (type_name (), rhs.type_name ()); |
5759 | 1275 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1276 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
|
1277 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1278 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
|
1279 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1280 done = true; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1281 } |
5759 | 1282 |
20555
f90c8372b7ba
eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20542
diff
changeset
|
1283 if (! done) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1284 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1285 octave_value tmp_rhs; |
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_rhs |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1288 = rhs.numeric_conversion_function (); |
5759 | 1289 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1290 octave_base_value::type_conv_info cf_this |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1291 = numeric_conversion_function (); |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1292 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1293 // Try biased (one-sided) conversions first. |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1294 if (cf_rhs.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1295 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1296 t_lhs, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1297 cf_rhs.type_id ()) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1298 || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1299 cf_rhs.type_id ()) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1300 cf_this = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1301 else if (cf_this.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1302 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1303 cf_this.type_id (), t_rhs) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1304 || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (), |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1305 t_rhs) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1306 cf_rhs = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1307 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1308 if (cf_rhs) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1309 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1310 octave_base_value *tmp = cf_rhs (rhs.get_rep ()); |
5759 | 1311 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1312 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1313 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
|
1314 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1315 tmp_rhs = octave_value (tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1316 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1317 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1318 tmp_rhs = rhs; |
5759 | 1319 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1320 count++; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1321 octave_value tmp_lhs = octave_value (this); |
5759 | 1322 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1323 if (cf_this) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1324 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1325 octave_base_value *tmp = cf_this (*this); |
5759 | 1326 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1327 if (! tmp) |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1328 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
|
1329 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1330 tmp_lhs = octave_value (tmp); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1331 } |
5759 | 1332 |
21118
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1333 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
|
1334 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
|
1335 (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
|
1336 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
|
1337 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1338 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
|
1339 |
3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents:
21102
diff
changeset
|
1340 done = true; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1341 } |
5759 | 1342 } |
1343 | |
21102
dfcb9d74b253
Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
1344 // The assignment may have converted to a type that is wider than necessary. |
5759 | 1345 |
1346 retval.maybe_mutate (); | |
1347 | |
1348 return retval; | |
1349 } | |
1350 | |
1351 // Current indentation. | |
1352 int octave_base_value::curr_print_indent_level = 0; | |
1353 | |
1354 // TRUE means we are at the beginning of a line. | |
1355 bool octave_base_value::beginning_of_line = true; | |
1356 | |
1357 // Each print() function should call this before printing anything. | |
1358 // | |
1359 // This doesn't need to be fast, but isn't there a better way? | |
1360 | |
1361 void | |
1362 octave_base_value::indent (std::ostream& os) const | |
1363 { | |
1364 assert (curr_print_indent_level >= 0); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1365 |
5759 | 1366 if (beginning_of_line) |
1367 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1368 // FIXME: do we need this? |
5759 | 1369 // os << prefix; |
1370 | |
1371 for (int i = 0; i < curr_print_indent_level; i++) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10232
diff
changeset
|
1372 os << " "; |
5759 | 1373 |
1374 beginning_of_line = false; | |
1375 } | |
1376 } | |
1377 | |
1378 // All print() functions should use this to print new lines. | |
1379 | |
1380 void | |
1381 octave_base_value::newline (std::ostream& os) const | |
1382 { | |
1383 os << "\n"; | |
1384 | |
1385 beginning_of_line = true; | |
1386 } | |
1387 | |
21024
6176560b03d9
maint: Remove return stmts after gripe function calls.
Rik <rik@octave.org>
parents:
21013
diff
changeset
|
1388 // For resetting print state. |
5759 | 1389 |
1390 void | |
1391 octave_base_value::reset (void) const | |
1392 { | |
1393 beginning_of_line = true; | |
1394 curr_print_indent_level = 0; | |
1395 } | |
1396 | |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1397 octave_value |
10893
61a5ba82cfbb
omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
1398 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
|
1399 { |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1400 return octave_value (); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1401 } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1402 |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1403 bool |
10893
61a5ba82cfbb
omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
1404 octave_base_value::fast_elem_insert (octave_idx_type, const octave_value&) |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1405 { |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1406 return false; |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1407 } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1408 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
1409 bool |
10893
61a5ba82cfbb
omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents:
10840
diff
changeset
|
1410 octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1411 { |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1412 return false; |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1413 } |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10652
diff
changeset
|
1414 |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1415 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1416 oct_conv_matrix_conv (const octave_base_value&) |
2376 | 1417 { |
1418 return new octave_matrix (); | |
1419 } | |
1420 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1421 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1422 oct_conv_complex_matrix_conv (const octave_base_value&) |
2376 | 1423 { |
1424 return new octave_complex_matrix (); | |
1425 } | |
1426 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1427 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1428 oct_conv_string_conv (const octave_base_value&) |
2376 | 1429 { |
1430 return new octave_char_matrix_str (); | |
1431 } | |
1432 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1433 static octave_base_value * |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22197
diff
changeset
|
1434 oct_conv_cell_conv (const octave_base_value&) |
3928 | 1435 { |
1436 return new octave_cell (); | |
1437 } | |
1438 | |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1439 static inline octave_value_list |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1440 sanitize (const octave_value_list& ovl) |
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 octave_value_list retval = ovl; |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1443 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1444 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
|
1445 { |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1446 if (retval(i).is_magic_colon ()) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1447 retval(i) = ":"; |
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 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1450 return retval; |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1451 } |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1452 |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1453 octave_value |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1454 make_idx_args (const std::string& type, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1455 const std::list<octave_value_list>& idx, |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1456 const std::string& who) |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1457 { |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1458 size_t len = type.length (); |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1459 |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1460 if (len != idx.size ()) |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1461 error ("invalid index for %s", who.c_str ()); |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1462 |
20978
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1463 Cell type_field (1, len); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1464 Cell subs_field (1, len); |
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 std::list<octave_value_list>::const_iterator p = idx.begin (); |
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 for (size_t i = 0; i < len; i++) |
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 char t = type[i]; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1471 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1472 switch (t) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1473 { |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1474 case '(': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1475 type_field(i) = "()"; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1476 subs_field(i) = Cell (sanitize (*p++)); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1477 break; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1478 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1479 case '{': |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1480 type_field(i) = "{}"; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1481 subs_field(i) = Cell (sanitize (*p++)); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1482 break; |
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 case '.': |
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 type_field(i) = "."; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1487 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1488 octave_value_list vlist = *p++; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1489 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1490 if (vlist.length () != 1) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1491 error ("only single argument permitted for '.' index"); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1492 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1493 octave_value val = vlist(0); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1494 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1495 if (! val.is_string ()) |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1496 error ("string argument required for '.' index"); |
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 subs_field(i) = val; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1499 } |
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 default: |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1503 panic_impossible (); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1504 break; |
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 } |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1507 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1508 octave_map m; |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1509 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1510 m.assign ("type", type_field); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1511 m.assign ("subs", subs_field); |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1512 |
a5b500efca9f
maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
1513 return m; |
18314
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1514 } |
06eb893b9db6
Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18130
diff
changeset
|
1515 |
18316
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1516 bool |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1517 called_from_builtin (void) |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1518 { |
23052
f97e22a9012a
move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1519 octave_function *fcn = octave::call_stack::caller (); |
18316
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1520 |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1521 // FIXME: we probably need a better check here, or some other |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1522 // mechanism to avoid overloaded functions when builtin is used. |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1523 // For example, what if someone overloads the builtin function? |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1524 // Also, are there other places where using builtin is not properly |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1525 // avoiding dispatch? |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1526 |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1527 return (fcn && fcn->name () == "builtin"); |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1528 } |
ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
18314
diff
changeset
|
1529 |
2376 | 1530 void |
1531 install_base_type_conversions (void) | |
1532 { | |
1533 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); | |
1534 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); | |
1535 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1536 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1537 octave_complex_matrix); |
2376 | 1538 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1539 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1540 octave_char_matrix_str); |
3928 | 1541 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376 | 1542 |
1543 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1544 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
1545 complex_matrix_conv); |
2376 | 1546 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); |
3928 | 1547 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376 | 1548 } |
1549 | |
7193 | 1550 DEFUN (sparse_auto_mutate, args, nargout, |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1551 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1552 @deftypefn {} {@var{val} =} sparse_auto_mutate () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1553 @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1554 @deftypefnx {} {} sparse_auto_mutate (@var{new_val}, "local") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1555 Query or set the internal variable that controls whether Octave will |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1556 automatically mutate sparse matrices to full matrices to save memory. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1557 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1558 For example: |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1559 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1560 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1561 @group |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1562 s = speye (3); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1563 sparse_auto_mutate (false); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1564 s(:, 1) = 1; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1565 typeinfo (s) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1566 @result{} sparse matrix |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1567 sparse_auto_mutate (true); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1568 s(1, :) = 1; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1569 typeinfo (s) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1570 @result{} matrix |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1571 @end group |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1572 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1573 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1574 When called from inside a function with the @qcode{"local"} option, the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1575 variable is changed locally for the function and any subroutines it calls. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1576 The original variable value is restored when exiting the function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21782
diff
changeset
|
1577 @end deftypefn */) |
7193 | 1578 { |
1579 return SET_INTERNAL_VARIABLE (sparse_auto_mutate); | |
1580 } | |
12820
efd924e19ff7
codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1581 |
efd924e19ff7
codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1582 /* |
efd924e19ff7
codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1583 %!test |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1584 %! s = speye (3); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1585 %! sparse_auto_mutate (false); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1586 %! s(:, 1) = 1; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1587 %! assert (typeinfo (s), "sparse matrix"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1588 %! sparse_auto_mutate (true); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1589 %! s(1, :) = 1; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1590 %! assert (typeinfo (s), "matrix"); |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
1591 %! sparse_auto_mutate (false); |
12820
efd924e19ff7
codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents:
12483
diff
changeset
|
1592 */ |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
1593 |