Mercurial > octave
annotate libinterp/octave-value/ov-typeinfo.cc @ 23405:32ec90068be5
use %!testif runtime tests to properly skip java tests
* ov-class.cc, ov-java.cc, ov-typeinfo.cc, fieldnames.m, methods.m,
javachk.m, usejava.m: Use runtime test in %!testif line to skip if
JVM is not available instead of checking inside the test itself. This
way the test will be properly reported as skipped instead of passed.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Apr 2017 17:44:56 -0400 |
parents | 092078913d54 |
children | e4fca7cc471c |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1996-2017 John W. Eaton |
2376 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
10 (at your option) any later version. |
2376 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22497
diff
changeset
|
15 GNU General Public License for more details. |
2376 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2376 | 20 |
21 */ | |
22 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
24 # include "config.h" |
2376 | 25 #endif |
26 | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
27 #include "Array.h" |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
28 #include "singleton-cleanup.h" |
2376 | 29 |
30 #include "defun.h" | |
31 #include "error.h" | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
32 #include "ov-typeinfo.h" |
2376 | 33 |
2479 | 34 const int |
35 octave_value_typeinfo::init_tab_sz (16); | |
36 | |
37 octave_value_typeinfo * | |
38 octave_value_typeinfo::instance (0); | |
2376 | 39 |
2926 | 40 bool |
41 octave_value_typeinfo::instance_ok (void) | |
42 { | |
43 bool retval = true; | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
44 |
2926 | 45 if (! instance) |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
46 { |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
47 instance = new octave_value_typeinfo (); |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
48 |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
49 if (instance) |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
50 singleton_cleanup_list::add (cleanup_instance); |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13095
diff
changeset
|
51 } |
2926 | 52 |
53 if (! instance) | |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20939
diff
changeset
|
54 error ("unable to create value type info object!"); |
2926 | 55 |
56 return retval; | |
57 } | |
58 | |
2376 | 59 int |
4612 | 60 octave_value_typeinfo::register_type (const std::string& t_name, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
61 const std::string& c_name, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
62 const octave_value& val) |
2376 | 63 { |
2926 | 64 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 ? instance->do_register_type (t_name, c_name, val) : -1; |
2376 | 66 } |
67 | |
68 bool | |
7336 | 69 octave_value_typeinfo::register_unary_class_op (octave_value::unary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
70 octave_value_typeinfo::unary_class_op_fcn f) |
7336 | 71 { |
72 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 ? instance->do_register_unary_class_op (op, f) : false; |
7336 | 74 } |
75 | |
76 bool | |
3203 | 77 octave_value_typeinfo::register_unary_op (octave_value::unary_op op, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
78 int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
79 octave_value_typeinfo::unary_op_fcn f) |
3203 | 80 { |
81 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
82 ? instance->do_register_unary_op (op, t, f) : false; |
3203 | 83 } |
84 | |
85 bool | |
86 octave_value_typeinfo::register_non_const_unary_op (octave_value::unary_op op, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
87 int t, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
88 octave_value_typeinfo::non_const_unary_op_fcn f) |
3203 | 89 { |
90 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
91 ? instance->do_register_non_const_unary_op (op, t, f) : false; |
3203 | 92 } |
93 | |
94 bool | |
7336 | 95 octave_value_typeinfo::register_binary_class_op (octave_value::binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
96 octave_value_typeinfo::binary_class_op_fcn f) |
7336 | 97 { |
98 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
99 ? instance->do_register_binary_class_op (op, f) : false; |
7336 | 100 } |
101 | |
102 bool | |
2376 | 103 octave_value_typeinfo::register_binary_op (octave_value::binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
104 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
105 octave_value_typeinfo::binary_op_fcn f) |
2376 | 106 { |
2926 | 107 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 ? instance->do_register_binary_op (op, t1, t2, f) : false; |
2376 | 109 } |
110 | |
111 bool | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
112 octave_value_typeinfo::register_binary_class_op (octave_value::compound_binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
113 octave_value_typeinfo::binary_class_op_fcn f) |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
114 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
115 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
116 ? instance->do_register_binary_class_op (op, f) : false; |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
117 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
118 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
119 bool |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
120 octave_value_typeinfo::register_binary_op (octave_value::compound_binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
121 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
122 octave_value_typeinfo::binary_op_fcn f) |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
123 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
124 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 ? instance->do_register_binary_op (op, t1, t2, f) : false; |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
126 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
127 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
128 bool |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 octave_value_typeinfo::register_cat_op (int t1, int t2, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
130 octave_value_typeinfo::cat_op_fcn f) |
4915 | 131 { |
132 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 ? instance->do_register_cat_op (t1, t2, f) : false; |
4915 | 134 } |
135 | |
136 bool | |
2882 | 137 octave_value_typeinfo::register_assign_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
138 int t_lhs, int t_rhs, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
139 octave_value_typeinfo::assign_op_fcn f) |
2376 | 140 { |
2926 | 141 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
142 ? instance->do_register_assign_op (op, t_lhs, t_rhs, f) : -1; |
2376 | 143 } |
144 | |
145 bool | |
3196 | 146 octave_value_typeinfo::register_assignany_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
147 int t_lhs, octave_value_typeinfo::assignany_op_fcn f) |
3196 | 148 { |
149 return (instance_ok ()) | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
150 ? instance->do_register_assignany_op (op, t_lhs, f) : -1; |
3196 | 151 } |
152 | |
153 bool | |
2376 | 154 octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
155 int t_result) |
2376 | 156 { |
2926 | 157 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
158 ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 : false; |
2376 | 160 } |
161 | |
162 bool | |
163 octave_value_typeinfo::register_widening_op (int t, int t_result, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
164 octave_base_value::type_conv_fcn f) |
2376 | 165 { |
2926 | 166 return (instance_ok ()) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
167 ? instance->do_register_widening_op (t, t_result, f) : false; |
2376 | 168 } |
169 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 // FIXME: we should also store all class names and provide a |
4687 | 171 // way to list them (calling class with nargin == 0?). |
172 | |
2376 | 173 int |
4612 | 174 octave_value_typeinfo::do_register_type (const std::string& t_name, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
175 const std::string& /* c_name */, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
176 const octave_value& val) |
2376 | 177 { |
178 int i = 0; | |
179 | |
180 for (i = 0; i < num_types; i++) | |
4612 | 181 if (t_name == types (i)) |
2376 | 182 return i; |
183 | |
20232
a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents:
20163
diff
changeset
|
184 int len = types.numel (); |
2376 | 185 |
186 if (i == len) | |
187 { | |
188 len *= 2; | |
189 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
190 types.resize (dim_vector (len, 1), ""); |
2376 | 191 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
192 vals.resize (dim_vector (len, 1), octave_value ()); |
4640 | 193 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
194 unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0); |
3203 | 195 |
196 non_const_unary_ops.resize | |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
197 (dim_vector (octave_value::num_unary_ops, len), 0); |
3203 | 198 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
199 binary_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
200 (dim_vector (octave_value::num_binary_ops, len, len), 0); |
2376 | 201 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
202 compound_binary_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
203 (dim_vector (octave_value::num_compound_binary_ops, len, len), 0); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
204 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
205 cat_ops.resize (dim_vector (len, len), 0); |
4915 | 206 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
207 assign_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
208 (dim_vector (octave_value::num_assign_ops, len, len), 0); |
2376 | 209 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
210 assignany_ops.resize |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
211 (dim_vector (octave_value::num_assign_ops, len), 0); |
3196 | 212 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
213 pref_assign_conv.resize (dim_vector (len, len), -1); |
2376 | 214 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
215 widening_ops.resize (dim_vector (len, len), 0); |
2376 | 216 } |
217 | |
4612 | 218 types (i) = t_name; |
2376 | 219 |
4640 | 220 vals (i) = val; |
221 | |
2376 | 222 num_types++; |
223 | |
224 return i; | |
225 } | |
226 | |
227 bool | |
7336 | 228 octave_value_typeinfo::do_register_unary_class_op (octave_value::unary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
229 octave_value_typeinfo::unary_class_op_fcn f) |
7336 | 230 { |
231 if (lookup_unary_class_op (op)) | |
232 { | |
233 std::string op_name = octave_value::unary_op_as_string (op); | |
234 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
235 warning ("duplicate unary operator '%s' for class dispatch", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
236 op_name.c_str ()); |
7336 | 237 } |
238 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
239 unary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 = reinterpret_cast<void *> (f); |
7336 | 241 |
242 return false; | |
243 } | |
244 | |
245 bool | |
3203 | 246 octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
247 int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
248 octave_value_typeinfo::unary_op_fcn f) |
3203 | 249 { |
4508 | 250 if (lookup_unary_op (op, t)) |
251 { | |
252 std::string op_name = octave_value::unary_op_as_string (op); | |
253 std::string type_name = types(t); | |
254 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
255 warning ("duplicate unary operator '%s' for type '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
256 op_name.c_str (), type_name.c_str ()); |
4508 | 257 } |
258 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
259 unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f); |
3203 | 260 |
261 return false; | |
262 } | |
263 | |
264 bool | |
265 octave_value_typeinfo::do_register_non_const_unary_op | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
266 (octave_value::unary_op op, int t, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
267 octave_value_typeinfo::non_const_unary_op_fcn f) |
3203 | 268 { |
4508 | 269 if (lookup_non_const_unary_op (op, t)) |
270 { | |
271 std::string op_name = octave_value::unary_op_as_string (op); | |
272 std::string type_name = types(t); | |
273 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
274 warning ("duplicate unary operator '%s' for type '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
275 op_name.c_str (), type_name.c_str ()); |
4508 | 276 } |
277 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
278 non_const_unary_ops.checkelem (static_cast<int> (op), t) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
279 = reinterpret_cast<void *> (f); |
3203 | 280 |
281 return false; | |
282 } | |
283 | |
284 bool | |
7336 | 285 octave_value_typeinfo::do_register_binary_class_op (octave_value::binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
286 octave_value_typeinfo::binary_class_op_fcn f) |
7336 | 287 { |
288 if (lookup_binary_class_op (op)) | |
289 { | |
290 std::string op_name = octave_value::binary_op_as_string (op); | |
291 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
292 warning ("duplicate binary operator '%s' for class dispatch", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
293 op_name.c_str ()); |
7336 | 294 } |
295 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
296 binary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
297 = reinterpret_cast<void *> (f); |
7336 | 298 |
299 return false; | |
300 } | |
301 | |
302 bool | |
2376 | 303 octave_value_typeinfo::do_register_binary_op (octave_value::binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
304 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
305 octave_value_typeinfo::binary_op_fcn f) |
2376 | 306 { |
4508 | 307 if (lookup_binary_op (op, t1, t2)) |
308 { | |
309 std::string op_name = octave_value::binary_op_as_string (op); | |
310 std::string t1_name = types(t1); | |
311 std::string t2_name = types(t2); | |
312 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
313 warning ("duplicate binary operator '%s' for types '%s' and '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
314 op_name.c_str (), t1_name.c_str (), t1_name.c_str ()); |
4508 | 315 } |
316 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
317 binary_ops.checkelem (static_cast<int> (op), t1, t2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
318 = reinterpret_cast<void *> (f); |
2376 | 319 |
320 return false; | |
321 } | |
322 | |
323 bool | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
324 octave_value_typeinfo::do_register_binary_class_op (octave_value::compound_binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
325 octave_value_typeinfo::binary_class_op_fcn f) |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
326 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
327 if (lookup_binary_class_op (op)) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
328 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
329 std::string op_name = octave_value::binary_op_fcn_name (op); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
330 |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
331 warning ("duplicate compound binary operator '%s' for class dispatch", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
332 op_name.c_str ()); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
333 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
334 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
335 compound_binary_class_ops.checkelem (static_cast<int> (op)) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
336 = reinterpret_cast<void *> (f); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
337 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
338 return false; |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
339 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
340 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
341 bool |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
342 octave_value_typeinfo::do_register_binary_op (octave_value::compound_binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
343 int t1, int t2, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
344 octave_value_typeinfo::binary_op_fcn f) |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
345 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
346 if (lookup_binary_op (op, t1, t2)) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
347 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
348 std::string op_name = octave_value::binary_op_fcn_name (op); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
349 std::string t1_name = types(t1); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
350 std::string t2_name = types(t2); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
351 |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
352 warning ("duplicate compound binary operator '%s' for types '%s' and '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
353 op_name.c_str (), t1_name.c_str (), t1_name.c_str ()); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
354 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
355 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
356 compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
357 = reinterpret_cast<void *> (f); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
358 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
359 return false; |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
360 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
361 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
362 bool |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
363 octave_value_typeinfo::do_register_cat_op (int t1, int t2, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
364 octave_value_typeinfo::cat_op_fcn f) |
4915 | 365 { |
366 if (lookup_cat_op (t1, t2)) | |
367 { | |
368 std::string t1_name = types(t1); | |
369 std::string t2_name = types(t2); | |
370 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
371 warning ("duplicate concatenation operator for types '%s' and '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
372 t1_name.c_str (), t1_name.c_str ()); |
4915 | 373 } |
374 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
375 cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f); |
4915 | 376 |
377 return false; | |
378 } | |
379 | |
380 bool | |
2882 | 381 octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
382 int t_lhs, int t_rhs, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
383 octave_value_typeinfo::assign_op_fcn f) |
2376 | 384 { |
4508 | 385 if (lookup_assign_op (op, t_lhs, t_rhs)) |
386 { | |
387 std::string op_name = octave_value::assign_op_as_string (op); | |
388 std::string t_lhs_name = types(t_lhs); | |
389 std::string t_rhs_name = types(t_rhs); | |
390 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
391 warning ("duplicate assignment operator '%s' for types '%s' and '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
392 op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ()); |
4508 | 393 } |
394 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
395 assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
396 = reinterpret_cast<void *> (f); |
2376 | 397 |
398 return false; | |
399 } | |
400 | |
401 bool | |
3196 | 402 octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
403 int t_lhs, octave_value_typeinfo::assignany_op_fcn f) |
3196 | 404 { |
4508 | 405 if (lookup_assignany_op (op, t_lhs)) |
406 { | |
407 std::string op_name = octave_value::assign_op_as_string (op); | |
408 std::string t_lhs_name = types(t_lhs); | |
409 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
410 warning ("duplicate assignment operator '%s' for types '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
411 op_name.c_str (), t_lhs_name.c_str ()); |
4508 | 412 } |
413 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
414 assignany_ops.checkelem (static_cast<int> (op), t_lhs) |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
415 = reinterpret_cast<void *> (f); |
3196 | 416 |
417 return false; | |
418 } | |
419 | |
420 bool | |
2376 | 421 octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs, |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
422 int t_result) |
2376 | 423 { |
4508 | 424 if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0) |
425 { | |
426 std::string t_lhs_name = types(t_lhs); | |
427 std::string t_rhs_name = types(t_rhs); | |
428 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
429 warning ("overriding assignment conversion for types '%s' and '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
430 t_lhs_name.c_str (), t_rhs_name.c_str ()); |
4508 | 431 } |
432 | |
2376 | 433 pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result; |
434 | |
435 return false; | |
436 } | |
437 | |
438 bool | |
439 octave_value_typeinfo::do_register_widening_op | |
5759 | 440 (int t, int t_result, octave_base_value::type_conv_fcn f) |
2376 | 441 { |
4508 | 442 if (lookup_widening_op (t, t_result)) |
443 { | |
444 std::string t_name = types(t); | |
445 std::string t_result_name = types(t_result); | |
446 | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
447 warning ("overriding widening op for '%s' to '%s'", |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
448 t_name.c_str (), t_result_name.c_str ()); |
4508 | 449 } |
450 | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
451 widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f); |
2376 | 452 |
453 return false; | |
454 } | |
455 | |
4640 | 456 octave_value |
457 octave_value_typeinfo::do_lookup_type (const std::string& nm) | |
458 { | |
459 octave_value retval; | |
460 | |
461 for (int i = 0; i < num_types; i++) | |
462 { | |
463 if (nm == types(i)) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
464 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
465 retval = vals(i); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
466 retval.make_unique (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
467 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
468 } |
4640 | 469 } |
470 | |
471 return retval; | |
472 } | |
473 | |
7336 | 474 octave_value_typeinfo::unary_class_op_fcn |
475 octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op) | |
476 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
477 void *f = unary_class_ops.checkelem (static_cast<int> (op)); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
478 return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f); |
7336 | 479 } |
480 | |
5759 | 481 octave_value_typeinfo::unary_op_fcn |
3203 | 482 octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t) |
483 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
484 void *f = unary_ops.checkelem (static_cast<int> (op), t); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
485 return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f); |
3203 | 486 } |
487 | |
5759 | 488 octave_value_typeinfo::non_const_unary_op_fcn |
3203 | 489 octave_value_typeinfo::do_lookup_non_const_unary_op |
490 (octave_value::unary_op op, int t) | |
491 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
492 void *f = non_const_unary_ops.checkelem (static_cast<int> (op), t); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
493 return reinterpret_cast<octave_value_typeinfo::non_const_unary_op_fcn> (f); |
3203 | 494 } |
495 | |
7336 | 496 octave_value_typeinfo::binary_class_op_fcn |
497 octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op) | |
498 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
499 void *f = binary_class_ops.checkelem (static_cast<int> (op)); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
500 return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f); |
7336 | 501 } |
502 | |
5759 | 503 octave_value_typeinfo::binary_op_fcn |
2376 | 504 octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
505 int t1, int t2) |
2376 | 506 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
507 void *f = binary_ops.checkelem (static_cast<int> (op), t1, t2); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
508 return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f); |
2376 | 509 } |
510 | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
511 octave_value_typeinfo::binary_class_op_fcn |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
512 octave_value_typeinfo::do_lookup_binary_class_op (octave_value::compound_binary_op op) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
513 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
514 void *f = compound_binary_class_ops.checkelem (static_cast<int> (op)); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
515 return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
516 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
517 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
518 octave_value_typeinfo::binary_op_fcn |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
519 octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
520 int t1, int t2) |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
521 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
522 void *f = compound_binary_ops.checkelem (static_cast<int> (op), t1, t2); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
523 return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f); |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
524 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7433
diff
changeset
|
525 |
5759 | 526 octave_value_typeinfo::cat_op_fcn |
4915 | 527 octave_value_typeinfo::do_lookup_cat_op (int t1, int t2) |
528 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
529 void *f = cat_ops.checkelem (t1, t2); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
530 return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f); |
4915 | 531 } |
532 | |
5759 | 533 octave_value_typeinfo::assign_op_fcn |
2882 | 534 octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
535 int t_lhs, int t_rhs) |
2376 | 536 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
537 void *f = assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
538 return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f); |
2376 | 539 } |
540 | |
5759 | 541 octave_value_typeinfo::assignany_op_fcn |
3196 | 542 octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
543 int t_lhs) |
3196 | 544 { |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
545 void *f = assignany_ops.checkelem (static_cast<int> (op), t_lhs); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
546 return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f); |
3196 | 547 } |
548 | |
2376 | 549 int |
550 octave_value_typeinfo::do_lookup_pref_assign_conv (int t_lhs, int t_rhs) | |
551 { | |
552 return pref_assign_conv.checkelem (t_lhs, t_rhs); | |
553 } | |
554 | |
5759 | 555 octave_base_value::type_conv_fcn |
2376 | 556 octave_value_typeinfo::do_lookup_widening_op (int t, int t_result) |
557 { | |
9223
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
558 void *f = widening_ops.checkelem (t, t_result); |
902a4597dce8
use Array<void *> in ov-typeinfo.h
Jaroslav Hajek <highegg@gmail.com>
parents:
9219
diff
changeset
|
559 return reinterpret_cast<octave_base_value::type_conv_fcn> (f); |
2376 | 560 } |
561 | |
562 string_vector | |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
563 octave_value_typeinfo::do_installed_type_names (void) const |
2376 | 564 { |
565 string_vector retval (num_types); | |
566 | |
11438
9e8497537319
typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents:
10352
diff
changeset
|
567 for (int i = 0; i < num_types; i++) |
9e8497537319
typeinfo: return cellstr, not char array
John W. Eaton <jwe@octave.org>
parents:
10352
diff
changeset
|
568 retval(i) = types(i); |
2376 | 569 |
570 return retval; | |
571 } | |
572 | |
2457 | 573 DEFUN (typeinfo, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
574 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
575 @deftypefn {} {} typeinfo () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
576 @deftypefnx {} {} typeinfo (@var{expr}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
577 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
578 Return the type of the expression @var{expr}, as a string. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
579 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
580 If @var{expr} is omitted, return a cell array of strings containing all the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
581 currently installed data types. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
582 @seealso{class, isa} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
583 @end deftypefn */) |
2376 | 584 { |
585 int nargin = args.length (); | |
586 | |
20797
492738d32c60
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
587 if (nargin > 1) |
492738d32c60
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
588 print_usage (); |
492738d32c60
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
589 |
2376 | 590 if (nargin == 0) |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
591 return ovl (Cell (octave_value_typeinfo::installed_type_names ())); |
20797
492738d32c60
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20428
diff
changeset
|
592 else |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
593 return ovl (args(0).type_name ()); |
2376 | 594 } |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
595 |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
596 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
597 %!assert (iscellstr (typeinfo ())) |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
598 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
599 %!assert (typeinfo ({"cell"}), "cell") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
600 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
601 %!assert (typeinfo (1), "scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
602 %!assert (typeinfo (double (1)), "scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
603 %!assert (typeinfo (i), "complex scalar") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
604 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
605 %!assert (typeinfo ([1, 2]), "matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
606 %!assert (typeinfo (double ([1, 2])), "matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
607 %!assert (typeinfo (diag ([1, 2])), "diagonal matrix") |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
608 %!assert (typeinfo ([i, 2]), "complex matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
609 %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix") |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
610 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
611 %!assert (typeinfo (1:2), "range") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
612 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
613 %!assert (typeinfo (false), "bool") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
614 %!assert (typeinfo ([true, false]), "bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
615 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
616 %!assert (typeinfo ("string"), "string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
617 %!assert (typeinfo ('string'), "sq_string") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
618 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
619 %!assert (typeinfo (int8 (1)), "int8 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
620 %!assert (typeinfo (int16 (1)), "int16 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
621 %!assert (typeinfo (int32 (1)), "int32 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
622 %!assert (typeinfo (int64 (1)), "int64 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
623 %!assert (typeinfo (uint8 (1)), "uint8 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
624 %!assert (typeinfo (uint16 (1)), "uint16 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
625 %!assert (typeinfo (uint32 (1)), "uint32 scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
626 %!assert (typeinfo (uint64 (1)), "uint64 scalar") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
627 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
628 %!assert (typeinfo (int8 ([1,2])), "int8 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
629 %!assert (typeinfo (int16 ([1,2])), "int16 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
630 %!assert (typeinfo (int32 ([1,2])), "int32 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
631 %!assert (typeinfo (int64 ([1,2])), "int64 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
632 %!assert (typeinfo (uint8 ([1,2])), "uint8 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
633 %!assert (typeinfo (uint16 ([1,2])), "uint16 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
634 %!assert (typeinfo (uint32 ([1,2])), "uint32 matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
635 %!assert (typeinfo (uint64 ([1,2])), "uint64 matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
636 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
637 %!assert (typeinfo (sparse ([true, false])), "sparse bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
638 %!assert (typeinfo (logical (sparse (i * eye (10)))), "sparse bool matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
639 %!assert (typeinfo (sparse ([1,2])), "sparse matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
640 %!assert (typeinfo (sparse (eye (10))), "sparse matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
641 %!assert (typeinfo (sparse ([i,2])), "sparse complex matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
642 %!assert (typeinfo (sparse (i * eye (10))), "sparse complex matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
643 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
644 %!test |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
645 %! s(2).a = 1; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
646 %! assert (typeinfo (s), "struct"); |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
647 |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
648 %!test |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
649 %! s.a = 1; |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
650 %! assert (typeinfo (s), "scalar struct"); |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
651 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
652 ## FIXME: This doesn't work as a test for comma-separated list |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
653 %!#test |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
654 %! clist = {1, 2, 3}; |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
655 %! assert (typeinfo (clist{:}), "cs-list"); |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
656 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
657 %!assert (typeinfo (@sin), "function handle") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
658 %!assert (typeinfo (@(x) x), "function handle") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
659 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
660 %!assert (typeinfo (inline ("x^2")), "inline function") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
661 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
662 %!assert (typeinfo (single (1)), "float scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
663 %!assert (typeinfo (single (i)), "float complex scalar") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
664 %!assert (typeinfo (single ([1, 2])), "float matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
665 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
666 %!assert (typeinfo (single (diag ([1, 2]))), "float diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
667 %!assert (typeinfo (diag (single ([1, 2]))), "float diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
668 %!assert (typeinfo (single (diag ([i, 2]))), "float complex diagonal matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
669 %!assert (typeinfo (diag (single ([i, 2]))), "float complex diagonal matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
670 |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
671 %!assert (typeinfo (eye(3)(:,[1 3 2])), "permutation matrix") |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
672 %!test |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
673 %! [l, u, p] = lu (rand (3)); |
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
674 %! assert (typeinfo (p), "permutation matrix"); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
675 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
676 %!assert (typeinfo ([]), "null_matrix") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
677 %!assert (typeinfo (""), "null_string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
678 %!assert (typeinfo (''), "null_sq_string") |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
679 |
15810
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
680 %!test |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
681 %! cvar = onCleanup (@() ""); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
682 %! assert (typeinfo (cvar), "onCleanup"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
683 |
23405
32ec90068be5
use %!testif runtime tests to properly skip java tests
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
684 %!testif HAVE_JAVA; usejava ("jvm") |
15810
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
685 %! x = javaObject ("java.lang.StringBuffer"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
686 %! assert (typeinfo (x), "octave_java"); |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
687 |
87a61a4d8fd2
Add typeinfo %!tests for onCleanup and octave_java types.
Rik <rik@octave.org>
parents:
15467
diff
changeset
|
688 ## Test input validation |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
689 %!error typeinfo ("foo", 1) |
13095
32fdd834c09a
tests for typeinfo function
John W. Eaton <jwe@octave.org>
parents:
12546
diff
changeset
|
690 */ |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
691 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
692 static boolNDArray |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
693 as_bool_nd_array (const Array<void *>& x) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
694 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
695 boolNDArray retval (x.dims ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
696 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
697 for (octave_idx_type i = 0; i < x.numel (); i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
698 retval.xelem (i) = x(i); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
699 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
700 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
701 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
702 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
703 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
704 octave_value_typeinfo::unary_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
705 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
706 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
707 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
708 int len = std::min (static_cast<int> (non_const_unary_ops.columns ()), |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
709 num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
710 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
711 dim_vector tab_dims (1, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
712 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
713 for (int j = 0; j < octave_value::num_unary_ops; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
714 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
715 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
716 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
717 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
718 tab.xelem (i) = (unary_ops(j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
719 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
720 octave_value::unary_op op_id = static_cast<octave_value::unary_op> (j); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
721 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
722 retval.setfield (octave_value::unary_op_as_string (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
723 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
724 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
725 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
726 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
727 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
728 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
729 octave_value_typeinfo::non_const_unary_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
730 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
731 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
732 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
733 int len = std::min (static_cast<int> (non_const_unary_ops.columns ()), |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
734 num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
735 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
736 dim_vector tab_dims (1, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
737 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
738 for (int j = 0; j < octave_value::num_unary_ops; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
739 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
740 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
741 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
742 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
743 tab.xelem (i) = (non_const_unary_ops(j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
744 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
745 octave_value::unary_op op_id = static_cast<octave_value::unary_op> (j); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
746 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
747 retval.setfield (octave_value::unary_op_as_string (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
748 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
749 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
750 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
751 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
752 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
753 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
754 octave_value_typeinfo::binary_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
755 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
756 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
757 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
758 int len = std::min (static_cast<int> (binary_ops.columns ()), num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
759 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
760 dim_vector tab_dims (len, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
761 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
762 for (int k = 0; k < octave_value::num_binary_ops; k++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
763 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
764 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
765 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
766 for (int j = 0; j < len; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
767 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
768 tab.xelem (j,i) = (binary_ops(k,j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
769 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
770 octave_value::binary_op op_id = static_cast<octave_value::binary_op> (k); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
771 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
772 retval.setfield (octave_value::binary_op_as_string (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
773 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
774 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
775 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
776 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
777 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
778 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
779 octave_value_typeinfo::compound_binary_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
780 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
781 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
782 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
783 int len = std::min (static_cast<int> (compound_binary_ops.columns ()), |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
784 num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
785 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
786 dim_vector tab_dims (len, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
787 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
788 for (int k = 0; k < octave_value::num_compound_binary_ops; k++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
789 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
790 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
791 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
792 for (int j = 0; j < len; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
793 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
794 tab.xelem (j,i) = (compound_binary_ops(k,j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
795 |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
796 octave_value::compound_binary_op op_id |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
797 = static_cast<octave_value::compound_binary_op> (k); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
798 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
799 retval.setfield (octave_value::binary_op_fcn_name (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
800 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
801 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
802 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
803 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
804 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
805 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
806 octave_value_typeinfo::assign_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
807 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
808 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
809 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
810 int len = std::min (static_cast<int> (assign_ops.columns ()), num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
811 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
812 dim_vector tab_dims (len, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
813 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
814 for (int k = 0; k < octave_value::num_assign_ops; k++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
815 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
816 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
817 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
818 for (int j = 0; j < len; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
819 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
820 tab.xelem (j,i) = (assign_ops(k,j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
821 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
822 octave_value::assign_op op_id = static_cast<octave_value::assign_op> (k); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
823 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
824 retval.setfield (octave_value::assign_op_as_string (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
825 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
826 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
827 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
828 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
829 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
830 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
831 octave_value_typeinfo::assignany_ops_map (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
832 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
833 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
834 |
22297
bc2a5db96754
Resolve compile time issues, when octave_idx_type is long int.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
22296
diff
changeset
|
835 int len = std::min (static_cast<int> (assignany_ops.columns ()), num_types); |
22281
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
836 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
837 dim_vector tab_dims (1, len); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
838 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
839 for (int j = 0; j < octave_value::num_assign_ops; j++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
840 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
841 boolNDArray tab (tab_dims); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
842 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
843 for (int i = 0; i < len; i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
844 tab.xelem (i) = (assignany_ops(j,i) != 0); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
845 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
846 octave_value::assign_op op_id = static_cast<octave_value::assign_op> (j); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
847 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
848 retval.setfield (octave_value::assign_op_as_string (op_id), tab); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
849 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
850 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
851 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
852 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
853 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
854 static NDArray |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
855 as_nd_array (const Array<int>& x) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
856 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
857 NDArray retval (x.dims ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
858 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
859 for (int i = 0; i < x.numel (); i++) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
860 retval.xelem(i) = x(i); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
861 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
862 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
863 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
864 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
865 octave_scalar_map |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
866 octave_value_typeinfo::do_installed_type_info (void) const |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
867 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
868 octave_scalar_map retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
869 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
870 retval.setfield ("types", octave_value (Cell (do_installed_type_names ()))); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
871 retval.setfield ("unary_ops", unary_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
872 retval.setfield ("non_const_unary_ops", non_const_unary_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
873 retval.setfield ("binary_ops", binary_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
874 retval.setfield ("compound_unary_ops", compound_binary_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
875 retval.setfield ("cat_ops", as_bool_nd_array (cat_ops)); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
876 retval.setfield ("assign_ops", assign_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
877 retval.setfield ("assignany_ops", assignany_ops_map ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
878 retval.setfield ("pref_assign_conv", as_nd_array (pref_assign_conv)); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
879 retval.setfield ("widening_ops", as_bool_nd_array (widening_ops)); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
880 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
881 return retval; |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
882 } |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
883 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
884 DEFUN (__dump_typeinfo__, args, , |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
885 doc: /* -*- texinfo -*- |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
886 @deftypefn {} {} __dump_typeinfo__ () |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
887 Undocumented internal function. |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
888 @end deftypefn */) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
889 { |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
890 if (args.length () > 0) |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
891 print_usage (); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
892 |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
893 return ovl (octave_value_typeinfo::installed_type_info ()); |
0f9ab4f1f4b3
new function __dump_typeinfo__
John W. Eaton <jwe@octave.org>
parents:
21966
diff
changeset
|
894 } |