Mercurial > octave-nkf
annotate src/ov-base.cc @ 9753:892e2aa7bc75
improve error messages by auto-prepending current function name
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 22 Oct 2009 08:56:58 +0200 |
parents | 5acd99c3e794 |
children | a5035bc7fbfb |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 2006, 2007, 2008, 2009 John W. Eaton |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
4254 | 28 #include <climits> |
29 | |
3503 | 30 #include <iostream> |
2901 | 31 |
2376 | 32 #include "lo-ieee.h" |
4732 | 33 #include "lo-mappers.h" |
2376 | 34 |
5759 | 35 #include "defun.h" |
2376 | 36 #include "gripes.h" |
37 #include "oct-map.h" | |
2974 | 38 #include "oct-obj.h" |
2979 | 39 #include "oct-lvalue.h" |
3340 | 40 #include "oct-stream.h" |
2376 | 41 #include "ops.h" |
42 #include "ov-base.h" | |
3928 | 43 #include "ov-cell.h" |
44 #include "ov-ch-mat.h" | |
2376 | 45 #include "ov-complex.h" |
46 #include "ov-cx-mat.h" | |
3928 | 47 #include "ov-list.h" |
48 #include "ov-range.h" | |
49 #include "ov-re-mat.h" | |
50 #include "ov-scalar.h" | |
2376 | 51 #include "ov-str-mat.h" |
4343 | 52 #include "ov-fcn-handle.h" |
5759 | 53 #include "parse.h" |
54 #include "utils.h" | |
2948 | 55 #include "variables.h" |
2376 | 56 |
4612 | 57 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, |
58 "<unknown type>", "unknown"); | |
2376 | 59 |
7193 | 60 // TRUE means to perform automatic sparse to real mutation if there |
61 // is memory to be saved | |
62 bool Vsparse_auto_mutate = false; | |
63 | |
2376 | 64 octave_value |
4532 | 65 octave_base_value::squeeze (void) const |
66 { | |
67 std::string nm = type_name (); | |
68 error ("squeeze: invalid operation for %s type", nm.c_str ()); | |
69 return octave_value (); | |
70 } | |
71 | |
72 octave_value | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
73 octave_base_value::full_value (void) const |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
74 { |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
75 gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ()); |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
76 return octave_value (); |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
77 } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
78 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
79 Matrix |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
80 octave_base_value::size (void) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
81 { |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
82 const dim_vector dv = dims (); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
83 Matrix mdv (1, dv.length ()); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
84 for (octave_idx_type i = 0; i < dv.length (); i++) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
85 mdv(i) = dv(i); |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
86 return mdv; |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
87 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
88 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
89 octave_idx_type |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
90 octave_base_value::numel (const octave_value_list& idx) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
91 { |
9705
5acd99c3e794
avoid recursive overloaded calls in builtin numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9689
diff
changeset
|
92 return dims_to_numel (dims (), idx); |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
93 } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9286
diff
changeset
|
94 |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
95 octave_value |
4247 | 96 octave_base_value::subsref (const std::string&, |
4219 | 97 const std::list<octave_value_list>&) |
3933 | 98 { |
99 std::string nm = type_name (); | |
100 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
101 return octave_value (); | |
102 } | |
103 | |
104 octave_value_list | |
4247 | 105 octave_base_value::subsref (const std::string&, |
4219 | 106 const std::list<octave_value_list>&, int) |
3933 | 107 { |
108 std::string nm = type_name (); | |
109 error ("can't perform indexing operations for %s type", nm.c_str ()); | |
110 return octave_value (); | |
111 } | |
112 | |
113 octave_value | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
114 octave_base_value::subsref (const std::string& type, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
115 const std::list<octave_value_list>& idx, |
8677
095ae5e0a831
eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
116 bool /* auto_add */) |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
117 { |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
118 // This way we may get a more meaningful error message. |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
119 return subsref (type, idx); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
120 } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
121 |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
122 octave_value |
5885 | 123 octave_base_value::do_index_op (const octave_value_list&, bool) |
2974 | 124 { |
3523 | 125 std::string nm = type_name (); |
2974 | 126 error ("can't perform indexing operations for %s type", nm.c_str ()); |
127 return octave_value (); | |
128 } | |
129 | |
130 octave_value_list | |
3544 | 131 octave_base_value::do_multi_index_op (int, const octave_value_list&) |
2376 | 132 { |
3523 | 133 std::string nm = type_name (); |
2376 | 134 error ("can't perform indexing operations for %s type", nm.c_str ()); |
135 return octave_value (); | |
136 } | |
137 | |
138 idx_vector | |
139 octave_base_value::index_vector (void) const | |
140 { | |
3523 | 141 std::string nm = type_name (); |
2376 | 142 error ("%s type invalid as index value", nm.c_str ()); |
143 return idx_vector (); | |
144 } | |
145 | |
5759 | 146 int |
147 octave_base_value::ndims (void) const | |
148 { | |
149 dim_vector dv = dims (); | |
150 | |
151 int n_dims = dv.length (); | |
152 | |
153 // Remove trailing singleton dimensions. | |
154 | |
155 for (int i = n_dims; i > 2; i--) | |
156 { | |
157 if (dv(i-1) == 1) | |
158 n_dims--; | |
159 else | |
160 break; | |
161 } | |
162 | |
163 // The result is always >= 2. | |
164 | |
165 if (n_dims < 2) | |
166 n_dims = 2; | |
167 | |
168 return n_dims; | |
169 } | |
170 | |
2376 | 171 octave_value |
4247 | 172 octave_base_value::subsasgn (const std::string& type, |
4219 | 173 const std::list<octave_value_list>& idx, |
3933 | 174 const octave_value& rhs) |
2376 | 175 { |
3933 | 176 octave_value retval; |
2376 | 177 |
3933 | 178 if (is_defined ()) |
179 { | |
4139 | 180 if (is_numeric_type ()) |
181 { | |
182 switch (type[0]) | |
183 { | |
184 case '(': | |
185 { | |
186 if (type.length () == 1) | |
187 retval = numeric_assign (type, idx, rhs); | |
4436 | 188 else if (is_empty ()) |
189 { | |
190 // Allow conversion of empty matrix to some other | |
191 // type in cases like | |
192 // | |
193 // x = []; x(i).f = rhs | |
194 | |
195 octave_value tmp = octave_value::empty_conv (type, rhs); | |
196 | |
197 retval = tmp.subsasgn (type, idx, rhs); | |
198 } | |
4139 | 199 else |
200 { | |
201 std::string nm = type_name (); | |
202 error ("in indexed assignment of %s, last rhs index must be ()", | |
203 nm.c_str ()); | |
204 } | |
205 } | |
206 break; | |
207 | |
208 case '{': | |
209 case '.': | |
210 { | |
211 std::string nm = type_name (); | |
212 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); | |
213 } | |
214 break; | |
215 | |
216 default: | |
217 panic_impossible (); | |
218 } | |
219 } | |
220 else | |
221 { | |
222 std::string nm = type_name (); | |
223 error ("can't perform indexed assignment for %s type", nm.c_str ()); | |
224 } | |
3933 | 225 } |
226 else | |
227 { | |
228 // Create new object of appropriate type for given index and rhs | |
229 // types and then call subsasgn again for that object. | |
230 | |
231 octave_value tmp = octave_value::empty_conv (type, rhs); | |
232 | |
233 retval = tmp.subsasgn (type, idx, rhs); | |
234 } | |
235 | |
236 return retval; | |
2376 | 237 } |
238 | |
5602 | 239 octave_idx_type |
240 octave_base_value::nnz (void) const | |
241 { | |
242 gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ()); | |
243 return -1; | |
244 } | |
245 | |
5604 | 246 octave_idx_type |
247 octave_base_value::nzmax (void) const | |
248 { | |
249 gripe_wrong_type_arg ("octave_base_value::nzmax ()", type_name ()); | |
250 return -1; | |
251 } | |
252 | |
5900 | 253 octave_idx_type |
254 octave_base_value::nfields (void) const | |
255 { | |
256 gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ()); | |
257 return -1; | |
258 } | |
259 | |
2376 | 260 octave_value |
4567 | 261 octave_base_value::reshape (const dim_vector&) const |
262 { | |
263 gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); | |
264 return octave_value (); | |
265 } | |
266 | |
267 octave_value | |
4593 | 268 octave_base_value::permute (const Array<int>&, bool) const |
269 { | |
270 gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ()); | |
271 return octave_value (); | |
272 } | |
273 | |
274 octave_value | |
5731 | 275 octave_base_value::resize (const dim_vector&, bool) const |
4915 | 276 { |
277 gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ()); | |
278 return octave_value (); | |
279 } | |
280 | |
5785 | 281 MatrixType |
282 octave_base_value::matrix_type (void) const | |
283 { | |
284 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); | |
285 return MatrixType (); | |
286 } | |
287 | |
288 MatrixType | |
289 octave_base_value::matrix_type (const MatrixType&) const | |
290 { | |
291 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); | |
292 return MatrixType (); | |
293 } | |
294 | |
4915 | 295 octave_value |
5759 | 296 octave_base_value::all (int) const |
297 { | |
298 return 0.0; | |
299 } | |
300 | |
301 octave_value | |
302 octave_base_value::any (int) const | |
303 { | |
304 return 0.0; | |
305 } | |
306 | |
307 octave_value | |
308 octave_base_value::convert_to_str (bool pad, bool force, char type) const | |
309 { | |
310 octave_value retval = convert_to_str_internal (pad, force, type); | |
311 | |
5781 | 312 if (! force && is_numeric_type ()) |
313 gripe_implicit_conversion ("Octave:num-to-str", | |
314 type_name (), retval.type_name ()); | |
5759 | 315 |
316 return retval; | |
317 } | |
318 | |
319 octave_value | |
5279 | 320 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376 | 321 { |
4452 | 322 gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", |
2376 | 323 type_name ()); |
324 return octave_value (); | |
325 } | |
326 | |
327 void | |
328 octave_base_value::convert_to_row_or_column_vector (void) | |
329 { | |
330 gripe_wrong_type_arg | |
331 ("octave_base_value::convert_to_row_or_column_vector ()", | |
332 type_name ()); | |
333 } | |
334 | |
335 void | |
3523 | 336 octave_base_value::print (std::ostream&, bool) const |
2376 | 337 { |
3195 | 338 gripe_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376 | 339 } |
340 | |
2901 | 341 void |
3523 | 342 octave_base_value::print_raw (std::ostream&, bool) const |
2901 | 343 { |
3195 | 344 gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); |
2901 | 345 } |
346 | |
347 bool | |
3523 | 348 octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const |
2901 | 349 { |
4604 | 350 bool retval = false; |
351 | |
2901 | 352 indent (os); |
4604 | 353 |
354 if (print_as_scalar ()) | |
355 os << name << " = "; | |
356 else | |
357 { | |
358 os << name << " ="; | |
359 newline (os); | |
360 newline (os); | |
361 retval = true; | |
362 } | |
363 | |
364 return retval; | |
2901 | 365 } |
366 | |
3933 | 367 void |
5759 | 368 octave_base_value::print_with_name (std::ostream& output_buf, |
369 const std::string& name, | |
9521 | 370 bool print_padding) |
5759 | 371 { |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
372 bool pad_after = print_name_tag (output_buf, name); |
5759 | 373 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
374 print (output_buf); |
5759 | 375 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
376 if (print_padding && pad_after) |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8551
diff
changeset
|
377 newline (output_buf); |
5759 | 378 } |
379 | |
380 void | |
3933 | 381 octave_base_value::print_info (std::ostream& os, |
4661 | 382 const std::string& /* prefix */) const |
3933 | 383 { |
384 os << "no info for type: " << type_name () << "\n"; | |
385 } | |
386 | |
4254 | 387 #define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \ |
388 T \ | |
389 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ | |
390 { \ | |
391 T retval = 0; \ | |
392 \ | |
393 double d = double_value (frc_str_conv); \ | |
394 \ | |
395 if (! error_state) \ | |
396 { \ | |
397 if (require_int && D_NINT (d) != d) \ | |
9753
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
9705
diff
changeset
|
398 error_with_cfn ("conversion of %g to " #T " value failed", d); \ |
5054 | 399 else if (d < MIN_LIMIT) \ |
400 retval = MIN_LIMIT; \ | |
401 else if (d > MAX_LIMIT) \ | |
402 retval = MAX_LIMIT; \ | |
4254 | 403 else \ |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
404 retval = static_cast<T> (::fix (d)); \ |
4254 | 405 } \ |
406 else \ | |
407 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \ | |
408 type_name ()); \ | |
409 \ | |
410 return retval; \ | |
411 } | |
3202 | 412 |
4254 | 413 INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX) |
414 INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX) | |
3202 | 415 |
4254 | 416 INT_CONV_METHOD (int, int, INT_MIN, INT_MAX) |
417 INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX) | |
3202 | 418 |
4254 | 419 INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX) |
420 INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX) | |
3202 | 421 |
422 int | |
423 octave_base_value::nint_value (bool frc_str_conv) const | |
424 { | |
425 int retval = 0; | |
426 | |
427 double d = double_value (frc_str_conv); | |
428 | |
429 if (! error_state) | |
430 { | |
431 if (xisnan (d)) | |
432 { | |
433 error ("conversion of NaN to integer value failed"); | |
434 return retval; | |
435 } | |
436 | |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
437 retval = static_cast<int> (::fix (d)); |
3202 | 438 } |
439 else | |
440 gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ()); | |
441 | |
442 return retval; | |
443 } | |
444 | |
2376 | 445 double |
446 octave_base_value::double_value (bool) const | |
447 { | |
4102 | 448 double retval = lo_ieee_nan_value (); |
2376 | 449 gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
450 return retval; | |
451 } | |
452 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
453 float |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
454 octave_base_value::float_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
455 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
456 float retval = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
457 gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
458 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
459 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
460 |
3351 | 461 Cell |
3539 | 462 octave_base_value::cell_value () const |
3351 | 463 { |
464 Cell retval; | |
465 gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); | |
466 return retval; | |
467 } | |
468 | |
2376 | 469 Matrix |
470 octave_base_value::matrix_value (bool) const | |
471 { | |
472 Matrix retval; | |
473 gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); | |
474 return retval; | |
475 } | |
476 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
477 FloatMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
478 octave_base_value::float_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
479 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
480 FloatMatrix retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
481 gripe_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
482 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
483 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
484 |
4507 | 485 NDArray |
4550 | 486 octave_base_value::array_value (bool) const |
4505 | 487 { |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
488 FloatNDArray retval; |
4550 | 489 gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505 | 490 return retval; |
491 } | |
492 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
493 FloatNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
494 octave_base_value::float_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
495 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
496 FloatNDArray retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
497 gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
498 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
499 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
500 |
2376 | 501 Complex |
502 octave_base_value::complex_value (bool) const | |
503 { | |
4102 | 504 double tmp = lo_ieee_nan_value (); |
505 Complex retval (tmp, tmp); | |
2376 | 506 gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
507 return retval; | |
508 } | |
509 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
510 FloatComplex |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
511 octave_base_value::float_complex_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
512 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
513 float tmp = lo_ieee_float_nan_value (); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
514 FloatComplex retval (tmp, tmp); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
515 gripe_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
516 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
517 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
518 |
2376 | 519 ComplexMatrix |
520 octave_base_value::complex_matrix_value (bool) const | |
521 { | |
522 ComplexMatrix retval; | |
523 gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()", | |
524 type_name ()); | |
525 return retval; | |
526 } | |
527 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
528 FloatComplexMatrix |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
529 octave_base_value::float_complex_matrix_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
530 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
531 FloatComplexMatrix retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
532 gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()", |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
533 type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
534 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
535 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
536 |
4550 | 537 ComplexNDArray |
538 octave_base_value::complex_array_value (bool) const | |
539 { | |
540 ComplexNDArray retval; | |
541 gripe_wrong_type_arg ("octave_base_value::complex_array_value()", | |
542 type_name ()); | |
543 return retval; | |
544 } | |
545 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
546 FloatComplexNDArray |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
547 octave_base_value::float_complex_array_value (bool) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
548 { |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
549 FloatComplexNDArray retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
550 gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()", |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
551 type_name ()); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
552 return retval; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
553 } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
554 |
4550 | 555 bool |
5943 | 556 octave_base_value::bool_value (bool) const |
4550 | 557 { |
558 bool retval = false; | |
559 gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); | |
560 return retval; | |
561 } | |
562 | |
563 boolMatrix | |
5943 | 564 octave_base_value::bool_matrix_value (bool) const |
4550 | 565 { |
566 boolMatrix retval; | |
567 gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", | |
568 type_name ()); | |
569 return retval; | |
570 } | |
571 | |
572 boolNDArray | |
5943 | 573 octave_base_value::bool_array_value (bool) const |
4550 | 574 { |
575 boolNDArray retval; | |
576 gripe_wrong_type_arg ("octave_base_value::bool_array_value()", | |
577 type_name ()); | |
578 return retval; | |
579 } | |
580 | |
2376 | 581 charMatrix |
4741 | 582 octave_base_value::char_matrix_value (bool force) const |
2376 | 583 { |
584 charMatrix retval; | |
4257 | 585 |
4741 | 586 octave_value tmp = convert_to_str (false, force); |
4257 | 587 |
4452 | 588 if (! error_state) |
589 retval = tmp.char_matrix_value (); | |
590 | |
2376 | 591 return retval; |
592 } | |
593 | |
4550 | 594 charNDArray |
595 octave_base_value::char_array_value (bool) const | |
596 { | |
597 charNDArray retval; | |
598 gripe_wrong_type_arg ("octave_base_value::char_array_value()", | |
599 type_name ()); | |
600 return retval; | |
601 } | |
602 | |
5164 | 603 SparseMatrix |
604 octave_base_value::sparse_matrix_value (bool) const | |
605 { | |
606 SparseMatrix retval; | |
607 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); | |
608 return retval; | |
609 } | |
610 | |
611 SparseComplexMatrix | |
612 octave_base_value::sparse_complex_matrix_value (bool) const | |
613 { | |
614 SparseComplexMatrix retval; | |
615 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ()); | |
616 return retval; | |
617 } | |
618 | |
619 SparseBoolMatrix | |
620 octave_base_value::sparse_bool_matrix_value (bool) const | |
621 { | |
622 SparseBoolMatrix retval; | |
623 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ()); | |
624 return retval; | |
625 } | |
626 | |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
627 DiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
628 octave_base_value::diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
629 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
630 DiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
631 gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
632 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
633 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
634 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
635 FloatDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
636 octave_base_value::float_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
637 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
638 FloatDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
639 gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
640 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
641 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
642 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
643 ComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
644 octave_base_value::complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
645 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
646 ComplexDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
647 gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
648 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
649 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
650 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
651 FloatComplexDiagMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
652 octave_base_value::float_complex_diag_matrix_value (bool) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
653 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
654 FloatComplexDiagMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
655 gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
656 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
657 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
658 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
659 PermMatrix |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
660 octave_base_value::perm_matrix_value (void) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
661 { |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
662 PermMatrix retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
663 gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ()); |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
664 return retval; |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
665 } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8734
diff
changeset
|
666 |
4910 | 667 octave_int8 |
668 octave_base_value::int8_scalar_value (void) const | |
669 { | |
670 octave_int8 retval; | |
671 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()", | |
672 type_name ()); | |
673 return retval; | |
674 } | |
675 | |
676 octave_int16 | |
677 octave_base_value::int16_scalar_value (void) const | |
678 { | |
679 octave_int16 retval; | |
680 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()", | |
681 type_name ()); | |
682 return retval; | |
683 } | |
684 | |
685 octave_int32 | |
686 octave_base_value::int32_scalar_value (void) const | |
687 { | |
688 octave_int32 retval; | |
689 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()", | |
690 type_name ()); | |
691 return retval; | |
692 } | |
693 | |
694 octave_int64 | |
695 octave_base_value::int64_scalar_value (void) const | |
696 { | |
697 octave_int64 retval; | |
698 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()", | |
699 type_name ()); | |
700 return retval; | |
701 } | |
702 | |
703 octave_uint8 | |
704 octave_base_value::uint8_scalar_value (void) const | |
705 { | |
706 octave_uint8 retval; | |
707 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()", | |
708 type_name ()); | |
709 return retval; | |
710 } | |
711 | |
712 octave_uint16 | |
713 octave_base_value::uint16_scalar_value (void) const | |
714 { | |
715 octave_uint16 retval; | |
716 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()", | |
717 type_name ()); | |
718 return retval; | |
719 } | |
720 | |
721 octave_uint32 | |
722 octave_base_value::uint32_scalar_value (void) const | |
723 { | |
724 octave_uint32 retval; | |
725 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()", | |
726 type_name ()); | |
727 return retval; | |
728 } | |
729 | |
730 octave_uint64 | |
731 octave_base_value::uint64_scalar_value (void) const | |
732 { | |
733 octave_uint64 retval; | |
734 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()", | |
735 type_name ()); | |
736 return retval; | |
737 } | |
738 | |
4906 | 739 int8NDArray |
740 octave_base_value::int8_array_value (void) const | |
741 { | |
742 int8NDArray retval; | |
743 gripe_wrong_type_arg ("octave_base_value::int8_array_value()", | |
744 type_name ()); | |
4910 | 745 return retval; |
4906 | 746 } |
747 | |
748 int16NDArray | |
749 octave_base_value::int16_array_value (void) const | |
750 { | |
751 int16NDArray retval; | |
752 gripe_wrong_type_arg ("octave_base_value::int16_array_value()", | |
753 type_name ()); | |
4910 | 754 return retval; |
4906 | 755 } |
756 | |
757 int32NDArray | |
758 octave_base_value::int32_array_value (void) const | |
759 { | |
760 int32NDArray retval; | |
761 gripe_wrong_type_arg ("octave_base_value::int32_array_value()", | |
762 type_name ()); | |
4910 | 763 return retval; |
4906 | 764 } |
765 | |
766 int64NDArray | |
767 octave_base_value::int64_array_value (void) const | |
768 { | |
769 int64NDArray retval; | |
770 gripe_wrong_type_arg ("octave_base_value::int64_array_value()", | |
771 type_name ()); | |
4910 | 772 return retval; |
4906 | 773 } |
774 | |
775 uint8NDArray | |
776 octave_base_value::uint8_array_value (void) const | |
777 { | |
778 uint8NDArray retval; | |
779 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()", | |
780 type_name ()); | |
4910 | 781 return retval; |
4906 | 782 } |
783 | |
784 uint16NDArray | |
785 octave_base_value::uint16_array_value (void) const | |
786 { | |
787 uint16NDArray retval; | |
788 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()", | |
789 type_name ()); | |
4910 | 790 return retval; |
4906 | 791 } |
792 | |
793 uint32NDArray | |
794 octave_base_value::uint32_array_value (void) const | |
795 { | |
796 uint32NDArray retval; | |
797 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()", | |
798 type_name ()); | |
4910 | 799 return retval; |
4906 | 800 } |
801 | |
802 uint64NDArray | |
803 octave_base_value::uint64_array_value (void) const | |
804 { | |
805 uint64NDArray retval; | |
806 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()", | |
807 type_name ()); | |
4910 | 808 return retval; |
4906 | 809 } |
810 | |
2493 | 811 string_vector |
5715 | 812 octave_base_value::all_strings (bool pad) const |
2376 | 813 { |
2493 | 814 string_vector retval; |
4257 | 815 |
5715 | 816 octave_value tmp = convert_to_str (pad, true); |
4257 | 817 |
4452 | 818 if (! error_state) |
819 retval = tmp.all_strings (); | |
4257 | 820 |
2376 | 821 return retval; |
822 } | |
823 | |
3536 | 824 std::string |
4457 | 825 octave_base_value::string_value (bool force) const |
2376 | 826 { |
3523 | 827 std::string retval; |
4257 | 828 |
4457 | 829 octave_value tmp = convert_to_str (force); |
4257 | 830 |
4452 | 831 if (! error_state) |
832 retval = tmp.string_value (); | |
4257 | 833 |
2376 | 834 return retval; |
835 } | |
836 | |
8732 | 837 Array<std::string> |
838 octave_base_value::cellstr_value (void) const | |
839 { | |
840 Array<std::string> retval; | |
841 gripe_wrong_type_arg ("octave_base_value::cellstry_value()", | |
842 type_name ()); | |
843 return retval; | |
844 } | |
845 | |
2376 | 846 Range |
847 octave_base_value::range_value (void) const | |
848 { | |
849 Range retval; | |
850 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ()); | |
851 return retval; | |
852 } | |
853 | |
854 Octave_map | |
855 octave_base_value::map_value (void) const | |
856 { | |
857 Octave_map retval; | |
858 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ()); | |
859 return retval; | |
860 } | |
861 | |
3933 | 862 string_vector |
863 octave_base_value::map_keys (void) const | |
864 { | |
865 string_vector retval; | |
866 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); | |
867 return retval; | |
868 } | |
869 | |
9151 | 870 size_t |
871 octave_base_value::nparents (void) const | |
872 { | |
873 size_t retval = 0; | |
874 gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ()); | |
875 return retval; | |
876 } | |
877 | |
878 std::list<std::string> | |
879 octave_base_value::parent_class_name_list (void) const | |
880 { | |
881 std::list<std::string> retval; | |
882 gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()", | |
883 type_name ()); | |
884 return retval; | |
885 } | |
886 | |
887 string_vector | |
888 octave_base_value::parent_class_names (void) const | |
889 { | |
890 string_vector retval; | |
891 gripe_wrong_type_arg ("octave_base_value::parent_class_names()", | |
892 type_name ()); | |
893 return retval; | |
894 } | |
895 | |
2974 | 896 octave_function * |
897 octave_base_value::function_value (bool silent) | |
898 { | |
899 octave_function *retval = 0; | |
900 | |
901 if (! silent) | |
902 gripe_wrong_type_arg ("octave_base_value::function_value()", | |
903 type_name ()); | |
904 return retval; | |
905 } | |
906 | |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
907 const octave_function * |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
908 octave_base_value::function_value (bool silent) const |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
909 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
910 const octave_function *retval = 0; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
911 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
912 if (! silent) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
913 gripe_wrong_type_arg ("octave_base_value::function_value()", |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
914 type_name ()); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
915 return retval; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
916 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
917 |
4700 | 918 octave_user_function * |
919 octave_base_value::user_function_value (bool silent) | |
920 { | |
921 octave_user_function *retval = 0; | |
922 | |
923 if (! silent) | |
924 gripe_wrong_type_arg ("octave_base_value::user_function_value()", | |
925 type_name ()); | |
926 return retval; | |
927 } | |
928 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
929 octave_user_script * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
930 octave_base_value::user_script_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
931 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
932 octave_user_script *retval = 0; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
933 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
934 if (! silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
935 gripe_wrong_type_arg ("octave_base_value::user_script_value()", |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
936 type_name ()); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
937 return retval; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
938 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
939 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
940 octave_user_code * |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
941 octave_base_value::user_code_value (bool silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
942 { |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
943 octave_user_code *retval = 0; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
944 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
945 if (! silent) |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
946 gripe_wrong_type_arg ("octave_base_value::user_code_value()", |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
947 type_name ()); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
948 return retval; |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
949 } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
950 |
4346 | 951 octave_fcn_handle * |
4343 | 952 octave_base_value::fcn_handle_value (bool silent) |
953 { | |
4346 | 954 octave_fcn_handle *retval = 0; |
4343 | 955 |
956 if (! silent) | |
957 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()", | |
958 type_name ()); | |
959 return retval; | |
960 } | |
961 | |
4933 | 962 octave_fcn_inline * |
963 octave_base_value::fcn_inline_value (bool silent) | |
964 { | |
965 octave_fcn_inline *retval = 0; | |
966 | |
967 if (! silent) | |
968 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()", | |
969 type_name ()); | |
970 return retval; | |
971 } | |
972 | |
2882 | 973 octave_value_list |
974 octave_base_value::list_value (void) const | |
975 { | |
976 octave_value_list retval; | |
977 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ()); | |
978 return retval; | |
979 } | |
980 | |
4687 | 981 bool |
6974 | 982 octave_base_value::save_ascii (std::ostream&) |
4687 | 983 { |
984 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); | |
985 return false; | |
986 } | |
987 | |
988 bool | |
989 octave_base_value::load_ascii (std::istream&) | |
990 { | |
991 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); | |
992 return false; | |
993 } | |
994 | |
995 bool | |
996 octave_base_value::save_binary (std::ostream&, bool&) | |
997 { | |
998 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); | |
999 return false; | |
1000 } | |
1001 | |
1002 bool | |
1003 octave_base_value::load_binary (std::istream&, bool, | |
1004 oct_mach_info::float_format) | |
1005 { | |
1006 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); | |
1007 return false; | |
1008 } | |
1009 | |
1010 #if defined (HAVE_HDF5) | |
4944 | 1011 |
4687 | 1012 bool |
1013 octave_base_value::save_hdf5 (hid_t, const char *, bool) | |
1014 { | |
1015 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); | |
1016 | |
1017 return false; | |
1018 } | |
1019 | |
1020 bool | |
1021 octave_base_value::load_hdf5 (hid_t, const char *, bool) | |
1022 { | |
1023 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); | |
1024 | |
1025 return false; | |
1026 } | |
4944 | 1027 |
4687 | 1028 #endif |
1029 | |
4944 | 1030 int |
1031 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type, | |
1032 int, oct_mach_info::float_format) const | |
1033 { | |
1034 gripe_wrong_type_arg ("octave_base_value::write()", type_name ()); | |
1035 | |
1036 return false; | |
1037 } | |
1038 | |
5900 | 1039 mxArray * |
1040 octave_base_value::as_mxArray (void) const | |
1041 { | |
1042 gripe_wrong_type_arg ("octave_base_value::as_mxArray ()", type_name ()); | |
1043 | |
1044 return 0; | |
1045 } | |
1046 | |
7433 | 1047 octave_value |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1048 octave_base_value::diag (octave_idx_type) const |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1049 { |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1050 gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ()); |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1051 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1052 return octave_value(); |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1053 } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1054 |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7528
diff
changeset
|
1055 octave_value |
7433 | 1056 octave_base_value::sort (octave_idx_type, sortmode) const |
1057 { | |
1058 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); | |
1059 | |
1060 return octave_value(); | |
1061 } | |
1062 | |
1063 octave_value | |
1064 octave_base_value::sort (Array<octave_idx_type> &, | |
1065 octave_idx_type, sortmode) const | |
1066 { | |
1067 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); | |
1068 | |
1069 return octave_value(); | |
1070 } | |
1071 | |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1072 sortmode |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1073 octave_base_value::is_sorted (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1074 { |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1075 gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1076 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1077 return UNSORTED; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1078 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1079 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1080 Array<octave_idx_type> |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1081 octave_base_value::sort_rows_idx (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1082 { |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1083 gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1084 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1085 return Array<octave_idx_type> (); |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1086 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1087 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1088 sortmode |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1089 octave_base_value::is_sorted_rows (sortmode) const |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1090 { |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1091 gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ()); |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1092 |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1093 return UNSORTED; |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1094 } |
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8677
diff
changeset
|
1095 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1096 #define UNDEFINED_MAPPER(F) \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1097 octave_value \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1098 octave_base_value::F (void) const \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1099 { \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1100 gripe_wrong_type_arg ("octave_base_value::" #F " ()", type_name ()); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1101 return octave_value (); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1102 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1103 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1104 UNDEFINED_MAPPER (abs) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1105 UNDEFINED_MAPPER (acos) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1106 UNDEFINED_MAPPER (acosh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1107 UNDEFINED_MAPPER (angle) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1108 UNDEFINED_MAPPER (arg) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1109 UNDEFINED_MAPPER (asin) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1110 UNDEFINED_MAPPER (asinh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1111 UNDEFINED_MAPPER (atan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1112 UNDEFINED_MAPPER (atanh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1113 UNDEFINED_MAPPER (ceil) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1114 UNDEFINED_MAPPER (conj) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1115 UNDEFINED_MAPPER (cos) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1116 UNDEFINED_MAPPER (cosh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1117 UNDEFINED_MAPPER (erf) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1118 UNDEFINED_MAPPER (erfc) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1119 UNDEFINED_MAPPER (exp) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1120 UNDEFINED_MAPPER (expm1) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1121 UNDEFINED_MAPPER (finite) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1122 UNDEFINED_MAPPER (fix) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1123 UNDEFINED_MAPPER (floor) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1124 UNDEFINED_MAPPER (gamma) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1125 UNDEFINED_MAPPER (imag) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1126 UNDEFINED_MAPPER (isinf) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1127 UNDEFINED_MAPPER (isna) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1128 UNDEFINED_MAPPER (isnan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1129 UNDEFINED_MAPPER (lgamma) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1130 UNDEFINED_MAPPER (log) |
7740 | 1131 UNDEFINED_MAPPER (log2) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1132 UNDEFINED_MAPPER (log10) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1133 UNDEFINED_MAPPER (log1p) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1134 UNDEFINED_MAPPER (real) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1135 UNDEFINED_MAPPER (round) |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
1136 UNDEFINED_MAPPER (roundb) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1137 UNDEFINED_MAPPER (signum) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1138 UNDEFINED_MAPPER (sin) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1139 UNDEFINED_MAPPER (sinh) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1140 UNDEFINED_MAPPER (sqrt) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1141 UNDEFINED_MAPPER (tan) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1142 UNDEFINED_MAPPER (tanh) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1143 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1144 // String mapper functions, convert to a string |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1145 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1146 #define STRING_MAPPER(F) \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1147 octave_value \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1148 octave_base_value::F (void) const \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1149 { \ |
9689
34d6f005db4b
eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents:
9521
diff
changeset
|
1150 octave_value tmp = char_array_value (true); \ |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1151 return error_state ? octave_value () : octave_value (tmp.F ()); \ |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1152 } |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1153 |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1154 STRING_MAPPER (xisalnum) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1155 STRING_MAPPER (xisalpha) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1156 STRING_MAPPER (xisascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1157 STRING_MAPPER (xiscntrl) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1158 STRING_MAPPER (xisdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1159 STRING_MAPPER (xisgraph) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1160 STRING_MAPPER (xislower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1161 STRING_MAPPER (xisprint) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1162 STRING_MAPPER (xispunct) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1163 STRING_MAPPER (xisspace) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1164 STRING_MAPPER (xisupper) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1165 STRING_MAPPER (xisxdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1166 STRING_MAPPER (xtoascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1167 STRING_MAPPER (xtolower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1168 STRING_MAPPER (xtoupper) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1169 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1170 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1171 octave_base_value::lock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1172 { |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1173 gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ()); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1174 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1175 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1176 void |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1177 octave_base_value::unlock (void) |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1178 { |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1179 gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ()); |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1180 } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1181 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1182 void |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1183 octave_base_value::dump (std::ostream& os) const |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1184 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1185 dim_vector dv = this->dims (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1186 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1187 os << "class: " << this->class_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1188 << " type: " << this->type_name () |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1189 << " dims: " << dv.str (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1190 } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1191 |
5759 | 1192 static void |
1193 gripe_indexed_assignment (const std::string& tn1, const std::string& tn2) | |
1194 { | |
1195 error ("assignment of `%s' to indexed `%s' not implemented", | |
1196 tn2.c_str (), tn1.c_str ()); | |
1197 } | |
1198 | |
1199 static void | |
1200 gripe_assign_conversion_failed (const std::string& tn1, | |
1201 const std::string& tn2) | |
1202 { | |
1203 error ("type conversion for assignment of `%s' to indexed `%s' failed", | |
1204 tn2.c_str (), tn1.c_str ()); | |
1205 } | |
1206 | |
1207 static void | |
1208 gripe_no_conversion (const std::string& on, const std::string& tn1, | |
1209 const std::string& tn2) | |
1210 { | |
1211 error ("operator %s: no conversion for assignment of `%s' to indexed `%s'", | |
1212 on.c_str (), tn2.c_str (), tn1.c_str ()); | |
1213 } | |
1214 | |
1215 octave_value | |
1216 octave_base_value::numeric_assign (const std::string& type, | |
1217 const std::list<octave_value_list>& idx, | |
1218 const octave_value& rhs) | |
1219 { | |
1220 octave_value retval; | |
1221 | |
9286
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1222 if (idx.front ().empty ()) |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1223 { |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1224 error ("missing index in indexed assignment"); |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1225 return retval; |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1226 } |
c2248cc4821a
don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
1227 |
5759 | 1228 int t_lhs = type_id (); |
1229 int t_rhs = rhs.type_id (); | |
1230 | |
1231 octave_value_typeinfo::assign_op_fcn f | |
1232 = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, | |
1233 t_lhs, t_rhs); | |
1234 | |
1235 bool done = false; | |
1236 | |
1237 if (f) | |
1238 { | |
1239 f (*this, idx.front (), rhs.get_rep ()); | |
1240 | |
1241 done = (! error_state); | |
1242 } | |
1243 | |
1244 if (done) | |
1245 { | |
1246 count++; | |
1247 retval = octave_value (this); | |
1248 } | |
1249 else | |
1250 { | |
1251 int t_result | |
1252 = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs); | |
1253 | |
1254 if (t_result >= 0) | |
1255 { | |
1256 octave_base_value::type_conv_fcn cf | |
1257 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result); | |
1258 | |
1259 if (cf) | |
1260 { | |
5874 | 1261 octave_base_value *tmp = cf (*this); |
5759 | 1262 |
1263 if (tmp) | |
1264 { | |
5874 | 1265 octave_value val (tmp); |
1266 | |
1267 retval = val.subsasgn (type, idx, rhs); | |
5759 | 1268 |
1269 done = (! error_state); | |
1270 } | |
1271 else | |
1272 gripe_assign_conversion_failed (type_name (), | |
1273 rhs.type_name ()); | |
1274 } | |
1275 else | |
1276 gripe_indexed_assignment (type_name (), rhs.type_name ()); | |
1277 } | |
1278 | |
1279 if (! (done || error_state)) | |
1280 { | |
1281 octave_value tmp_rhs; | |
1282 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1283 octave_base_value::type_conv_info cf_rhs |
5759 | 1284 = rhs.numeric_conversion_function (); |
1285 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1286 octave_base_value::type_conv_info cf_this |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1287 = numeric_conversion_function (); |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1288 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1289 // Try biased (one-sided) conversions first. |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1290 if (cf_rhs.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1291 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1292 t_lhs, cf_rhs.type_id ()) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1293 || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1294 cf_rhs.type_id ()) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1295 cf_this = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1296 else if (cf_this.type_id () >= 0 |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1297 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1298 cf_this.type_id (), t_rhs) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1299 || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (), |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1300 t_rhs) >= 0)) |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1301 cf_rhs = 0; |
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7885
diff
changeset
|
1302 |
5759 | 1303 if (cf_rhs) |
1304 { | |
1305 octave_base_value *tmp = cf_rhs (rhs.get_rep ()); | |
1306 | |
1307 if (tmp) | |
1308 tmp_rhs = octave_value (tmp); | |
1309 else | |
1310 { | |
1311 gripe_assign_conversion_failed (type_name (), | |
1312 rhs.type_name ()); | |
1313 return octave_value (); | |
1314 } | |
1315 } | |
1316 else | |
1317 tmp_rhs = rhs; | |
1318 | |
5897 | 1319 count++; |
1320 octave_value tmp_lhs = octave_value (this); | |
5759 | 1321 |
1322 if (cf_this) | |
1323 { | |
1324 octave_base_value *tmp = cf_this (*this); | |
1325 | |
1326 if (tmp) | |
5897 | 1327 tmp_lhs = octave_value (tmp); |
5759 | 1328 else |
1329 { | |
1330 gripe_assign_conversion_failed (type_name (), | |
1331 rhs.type_name ()); | |
1332 return octave_value (); | |
1333 } | |
1334 } | |
1335 | |
1336 if (cf_this || cf_rhs) | |
1337 { | |
5897 | 1338 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs); |
5759 | 1339 |
1340 done = (! error_state); | |
1341 } | |
1342 else | |
1343 gripe_no_conversion (octave_value::assign_op_as_string (octave_value::op_asn_eq), | |
1344 type_name (), rhs.type_name ()); | |
1345 } | |
1346 } | |
1347 | |
1348 // The assignment may have converted to a type that is wider than | |
1349 // necessary. | |
1350 | |
1351 retval.maybe_mutate (); | |
1352 | |
1353 return retval; | |
1354 } | |
1355 | |
1356 // Current indentation. | |
1357 int octave_base_value::curr_print_indent_level = 0; | |
1358 | |
1359 // TRUE means we are at the beginning of a line. | |
1360 bool octave_base_value::beginning_of_line = true; | |
1361 | |
1362 // Each print() function should call this before printing anything. | |
1363 // | |
1364 // This doesn't need to be fast, but isn't there a better way? | |
1365 | |
1366 void | |
1367 octave_base_value::indent (std::ostream& os) const | |
1368 { | |
1369 assert (curr_print_indent_level >= 0); | |
1370 | |
1371 if (beginning_of_line) | |
1372 { | |
5775 | 1373 // FIXME -- do we need this? |
5759 | 1374 // os << prefix; |
1375 | |
1376 for (int i = 0; i < curr_print_indent_level; i++) | |
1377 os << " "; | |
1378 | |
1379 beginning_of_line = false; | |
1380 } | |
1381 } | |
1382 | |
1383 // All print() functions should use this to print new lines. | |
1384 | |
1385 void | |
1386 octave_base_value::newline (std::ostream& os) const | |
1387 { | |
1388 os << "\n"; | |
1389 | |
1390 beginning_of_line = true; | |
1391 } | |
1392 | |
1393 // For ressetting print state. | |
1394 | |
1395 void | |
1396 octave_base_value::reset (void) const | |
1397 { | |
1398 beginning_of_line = true; | |
1399 curr_print_indent_level = 0; | |
1400 } | |
1401 | |
3203 | 1402 CONVDECLX (matrix_conv) |
2376 | 1403 { |
1404 return new octave_matrix (); | |
1405 } | |
1406 | |
3203 | 1407 CONVDECLX (complex_matrix_conv) |
2376 | 1408 { |
1409 return new octave_complex_matrix (); | |
1410 } | |
1411 | |
3203 | 1412 CONVDECLX (string_conv) |
2376 | 1413 { |
1414 return new octave_char_matrix_str (); | |
1415 } | |
1416 | |
3928 | 1417 CONVDECLX (cell_conv) |
1418 { | |
1419 return new octave_cell (); | |
1420 } | |
1421 | |
2376 | 1422 void |
1423 install_base_type_conversions (void) | |
1424 { | |
1425 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); | |
1426 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); | |
1427 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); | |
1428 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix); | |
1429 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); | |
1430 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str); | |
3928 | 1431 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376 | 1432 |
1433 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); | |
1434 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv); | |
1435 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); | |
3928 | 1436 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376 | 1437 } |
1438 | |
7193 | 1439 DEFUN (sparse_auto_mutate, args, nargout, |
1440 "-*- texinfo -*-\n\ | |
1441 @deftypefn {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\ | |
1442 @deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\ | |
1443 Query or set the internal variable that controls whether Octave will\n\ | |
1444 automatically mutate sparse matrices to real matrices to save memory.\n\ | |
1445 For example,\n\ | |
1446 \n\ | |
1447 @example\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
1448 @group\n\ |
7193 | 1449 s = speye(3);\n\ |
1450 sparse_auto_mutate (false)\n\ | |
1451 s (:, 1) = 1;\n\ | |
1452 typeinfo (s)\n\ | |
1453 @result{} sparse matrix\n\ | |
1454 sparse_auto_mutate (true)\n\ | |
1455 s (1, :) = 1;\n\ | |
1456 typeinfo (s)\n\ | |
1457 @result{} matrix\n\ | |
9064
7c02ec148a3c
Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
1458 @end group\n\ |
7193 | 1459 @end example\n\ |
1460 @end deftypefn") | |
1461 { | |
1462 return SET_INTERNAL_VARIABLE (sparse_auto_mutate); | |
1463 } | |
1464 | |
2376 | 1465 /* |
1466 ;;; Local Variables: *** | |
1467 ;;; mode: C++ *** | |
1468 ;;; End: *** | |
1469 */ |