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