2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
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" |
4649
|
34 #include "so-array.h" |
2376
|
35 |
|
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" |
2948
|
53 #include "variables.h" |
2376
|
54 |
4612
|
55 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, |
|
56 "<unknown type>", "unknown"); |
2376
|
57 |
|
58 octave_value |
4532
|
59 octave_base_value::squeeze (void) const |
|
60 { |
|
61 std::string nm = type_name (); |
|
62 error ("squeeze: invalid operation for %s type", nm.c_str ()); |
|
63 return octave_value (); |
|
64 } |
|
65 |
|
66 octave_value |
4247
|
67 octave_base_value::subsref (const std::string&, |
4219
|
68 const std::list<octave_value_list>&) |
3933
|
69 { |
|
70 std::string nm = type_name (); |
|
71 error ("can't perform indexing operations for %s type", nm.c_str ()); |
|
72 return octave_value (); |
|
73 } |
|
74 |
|
75 octave_value_list |
4247
|
76 octave_base_value::subsref (const std::string&, |
4219
|
77 const std::list<octave_value_list>&, int) |
3933
|
78 { |
|
79 std::string nm = type_name (); |
|
80 error ("can't perform indexing operations for %s type", nm.c_str ()); |
|
81 return octave_value (); |
|
82 } |
|
83 |
|
84 octave_value |
|
85 octave_base_value::do_index_op (const octave_value_list&, int) |
2974
|
86 { |
3523
|
87 std::string nm = type_name (); |
2974
|
88 error ("can't perform indexing operations for %s type", nm.c_str ()); |
|
89 return octave_value (); |
|
90 } |
|
91 |
|
92 octave_value_list |
3544
|
93 octave_base_value::do_multi_index_op (int, const octave_value_list&) |
2376
|
94 { |
3523
|
95 std::string nm = type_name (); |
2376
|
96 error ("can't perform indexing operations for %s type", nm.c_str ()); |
|
97 return octave_value (); |
|
98 } |
|
99 |
|
100 idx_vector |
|
101 octave_base_value::index_vector (void) const |
|
102 { |
3523
|
103 std::string nm = type_name (); |
2376
|
104 error ("%s type invalid as index value", nm.c_str ()); |
|
105 return idx_vector (); |
|
106 } |
|
107 |
|
108 octave_value |
4247
|
109 octave_base_value::subsasgn (const std::string& type, |
4219
|
110 const std::list<octave_value_list>& idx, |
3933
|
111 const octave_value& rhs) |
2376
|
112 { |
3933
|
113 octave_value retval; |
2376
|
114 |
3933
|
115 if (is_defined ()) |
|
116 { |
4139
|
117 if (is_numeric_type ()) |
|
118 { |
|
119 switch (type[0]) |
|
120 { |
|
121 case '(': |
|
122 { |
|
123 if (type.length () == 1) |
|
124 retval = numeric_assign (type, idx, rhs); |
4436
|
125 else if (is_empty ()) |
|
126 { |
|
127 // Allow conversion of empty matrix to some other |
|
128 // type in cases like |
|
129 // |
|
130 // x = []; x(i).f = rhs |
|
131 |
|
132 octave_value tmp = octave_value::empty_conv (type, rhs); |
|
133 |
|
134 retval = tmp.subsasgn (type, idx, rhs); |
|
135 } |
4139
|
136 else |
|
137 { |
|
138 std::string nm = type_name (); |
|
139 error ("in indexed assignment of %s, last rhs index must be ()", |
|
140 nm.c_str ()); |
|
141 } |
|
142 } |
|
143 break; |
|
144 |
|
145 case '{': |
|
146 case '.': |
|
147 { |
|
148 std::string nm = type_name (); |
|
149 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
|
150 } |
|
151 break; |
|
152 |
|
153 default: |
|
154 panic_impossible (); |
|
155 } |
|
156 } |
|
157 else |
|
158 { |
|
159 std::string nm = type_name (); |
|
160 error ("can't perform indexed assignment for %s type", nm.c_str ()); |
|
161 } |
3933
|
162 } |
|
163 else |
|
164 { |
|
165 // Create new object of appropriate type for given index and rhs |
|
166 // types and then call subsasgn again for that object. |
|
167 |
|
168 octave_value tmp = octave_value::empty_conv (type, rhs); |
|
169 |
|
170 retval = tmp.subsasgn (type, idx, rhs); |
|
171 } |
|
172 |
|
173 return retval; |
2376
|
174 } |
|
175 |
5602
|
176 octave_idx_type |
|
177 octave_base_value::nnz (void) const |
|
178 { |
|
179 gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ()); |
|
180 return -1; |
|
181 } |
|
182 |
2376
|
183 octave_value |
4567
|
184 octave_base_value::reshape (const dim_vector&) const |
|
185 { |
|
186 gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); |
|
187 return octave_value (); |
|
188 } |
|
189 |
|
190 octave_value |
4593
|
191 octave_base_value::permute (const Array<int>&, bool) const |
|
192 { |
|
193 gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ()); |
|
194 return octave_value (); |
|
195 } |
|
196 |
|
197 octave_value |
4933
|
198 octave_base_value::resize (const dim_vector&) const |
4915
|
199 { |
|
200 gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ()); |
|
201 return octave_value (); |
|
202 } |
|
203 |
|
204 octave_value |
5279
|
205 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376
|
206 { |
4452
|
207 gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", |
2376
|
208 type_name ()); |
|
209 return octave_value (); |
|
210 } |
|
211 |
|
212 void |
|
213 octave_base_value::convert_to_row_or_column_vector (void) |
|
214 { |
|
215 gripe_wrong_type_arg |
|
216 ("octave_base_value::convert_to_row_or_column_vector ()", |
|
217 type_name ()); |
|
218 } |
|
219 |
|
220 void |
3523
|
221 octave_base_value::print (std::ostream&, bool) const |
2376
|
222 { |
3195
|
223 gripe_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376
|
224 } |
|
225 |
2901
|
226 void |
3523
|
227 octave_base_value::print_raw (std::ostream&, bool) const |
2901
|
228 { |
3195
|
229 gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); |
2901
|
230 } |
|
231 |
|
232 bool |
3523
|
233 octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const |
2901
|
234 { |
4604
|
235 bool retval = false; |
|
236 |
2901
|
237 indent (os); |
4604
|
238 |
|
239 if (print_as_scalar ()) |
|
240 os << name << " = "; |
|
241 else |
|
242 { |
|
243 os << name << " ="; |
|
244 newline (os); |
|
245 newline (os); |
|
246 retval = true; |
|
247 } |
|
248 |
|
249 return retval; |
2901
|
250 } |
|
251 |
3933
|
252 void |
|
253 octave_base_value::print_info (std::ostream& os, |
4661
|
254 const std::string& /* prefix */) const |
3933
|
255 { |
|
256 os << "no info for type: " << type_name () << "\n"; |
|
257 } |
|
258 |
4254
|
259 #define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \ |
|
260 T \ |
|
261 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ |
|
262 { \ |
|
263 T retval = 0; \ |
|
264 \ |
|
265 double d = double_value (frc_str_conv); \ |
|
266 \ |
|
267 if (! error_state) \ |
|
268 { \ |
|
269 if (require_int && D_NINT (d) != d) \ |
|
270 error ("conversion of %g to " #T " value failed", d); \ |
5054
|
271 else if (d < MIN_LIMIT) \ |
|
272 retval = MIN_LIMIT; \ |
|
273 else if (d > MAX_LIMIT) \ |
|
274 retval = MAX_LIMIT; \ |
4254
|
275 else \ |
4732
|
276 retval = static_cast<T> (fix (d)); \ |
4254
|
277 } \ |
|
278 else \ |
|
279 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \ |
|
280 type_name ()); \ |
|
281 \ |
|
282 return retval; \ |
|
283 } |
3202
|
284 |
4254
|
285 INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX) |
|
286 INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX) |
3202
|
287 |
4254
|
288 INT_CONV_METHOD (int, int, INT_MIN, INT_MAX) |
|
289 INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX) |
3202
|
290 |
4254
|
291 INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX) |
|
292 INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX) |
3202
|
293 |
|
294 int |
|
295 octave_base_value::nint_value (bool frc_str_conv) const |
|
296 { |
|
297 int retval = 0; |
|
298 |
|
299 double d = double_value (frc_str_conv); |
|
300 |
|
301 if (! error_state) |
|
302 { |
|
303 if (xisnan (d)) |
|
304 { |
|
305 error ("conversion of NaN to integer value failed"); |
|
306 return retval; |
|
307 } |
|
308 |
4732
|
309 retval = static_cast<int> (fix (d)); |
3202
|
310 } |
|
311 else |
|
312 gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ()); |
|
313 |
|
314 return retval; |
|
315 } |
|
316 |
2376
|
317 double |
|
318 octave_base_value::double_value (bool) const |
|
319 { |
4102
|
320 double retval = lo_ieee_nan_value (); |
2376
|
321 gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
|
322 return retval; |
|
323 } |
|
324 |
3351
|
325 Cell |
3539
|
326 octave_base_value::cell_value () const |
3351
|
327 { |
|
328 Cell retval; |
|
329 gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); |
|
330 return retval; |
|
331 } |
|
332 |
2376
|
333 Matrix |
|
334 octave_base_value::matrix_value (bool) const |
|
335 { |
|
336 Matrix retval; |
|
337 gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); |
|
338 return retval; |
|
339 } |
|
340 |
4507
|
341 NDArray |
4550
|
342 octave_base_value::array_value (bool) const |
4505
|
343 { |
4507
|
344 NDArray retval; |
4550
|
345 gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505
|
346 return retval; |
|
347 } |
|
348 |
2376
|
349 Complex |
|
350 octave_base_value::complex_value (bool) const |
|
351 { |
4102
|
352 double tmp = lo_ieee_nan_value (); |
|
353 Complex retval (tmp, tmp); |
2376
|
354 gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
|
355 return retval; |
|
356 } |
|
357 |
|
358 ComplexMatrix |
|
359 octave_base_value::complex_matrix_value (bool) const |
|
360 { |
|
361 ComplexMatrix retval; |
|
362 gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()", |
|
363 type_name ()); |
|
364 return retval; |
|
365 } |
|
366 |
4550
|
367 ComplexNDArray |
|
368 octave_base_value::complex_array_value (bool) const |
|
369 { |
|
370 ComplexNDArray retval; |
|
371 gripe_wrong_type_arg ("octave_base_value::complex_array_value()", |
|
372 type_name ()); |
|
373 return retval; |
|
374 } |
|
375 |
|
376 bool |
|
377 octave_base_value::bool_value (void) const |
|
378 { |
|
379 bool retval = false; |
|
380 gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); |
|
381 return retval; |
|
382 } |
|
383 |
|
384 boolMatrix |
|
385 octave_base_value::bool_matrix_value (void) const |
|
386 { |
|
387 boolMatrix retval; |
|
388 gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", |
|
389 type_name ()); |
|
390 return retval; |
|
391 } |
|
392 |
|
393 boolNDArray |
4580
|
394 octave_base_value::bool_array_value (void) const |
4550
|
395 { |
|
396 boolNDArray retval; |
|
397 gripe_wrong_type_arg ("octave_base_value::bool_array_value()", |
|
398 type_name ()); |
|
399 return retval; |
|
400 } |
|
401 |
2376
|
402 charMatrix |
4741
|
403 octave_base_value::char_matrix_value (bool force) const |
2376
|
404 { |
|
405 charMatrix retval; |
4257
|
406 |
4741
|
407 octave_value tmp = convert_to_str (false, force); |
4257
|
408 |
4452
|
409 if (! error_state) |
|
410 retval = tmp.char_matrix_value (); |
|
411 |
2376
|
412 return retval; |
|
413 } |
|
414 |
4550
|
415 charNDArray |
|
416 octave_base_value::char_array_value (bool) const |
|
417 { |
|
418 charNDArray retval; |
|
419 gripe_wrong_type_arg ("octave_base_value::char_array_value()", |
|
420 type_name ()); |
|
421 return retval; |
|
422 } |
|
423 |
5164
|
424 SparseMatrix |
|
425 octave_base_value::sparse_matrix_value (bool) const |
|
426 { |
|
427 SparseMatrix retval; |
|
428 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); |
|
429 return retval; |
|
430 } |
|
431 |
|
432 SparseComplexMatrix |
|
433 octave_base_value::sparse_complex_matrix_value (bool) const |
|
434 { |
|
435 SparseComplexMatrix retval; |
|
436 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ()); |
|
437 return retval; |
|
438 } |
|
439 |
|
440 SparseBoolMatrix |
|
441 octave_base_value::sparse_bool_matrix_value (bool) const |
|
442 { |
|
443 SparseBoolMatrix retval; |
|
444 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ()); |
|
445 return retval; |
|
446 } |
|
447 |
4910
|
448 octave_int8 |
|
449 octave_base_value::int8_scalar_value (void) const |
|
450 { |
|
451 octave_int8 retval; |
|
452 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()", |
|
453 type_name ()); |
|
454 return retval; |
|
455 } |
|
456 |
|
457 octave_int16 |
|
458 octave_base_value::int16_scalar_value (void) const |
|
459 { |
|
460 octave_int16 retval; |
|
461 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()", |
|
462 type_name ()); |
|
463 return retval; |
|
464 } |
|
465 |
|
466 octave_int32 |
|
467 octave_base_value::int32_scalar_value (void) const |
|
468 { |
|
469 octave_int32 retval; |
|
470 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()", |
|
471 type_name ()); |
|
472 return retval; |
|
473 } |
|
474 |
|
475 octave_int64 |
|
476 octave_base_value::int64_scalar_value (void) const |
|
477 { |
|
478 octave_int64 retval; |
|
479 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()", |
|
480 type_name ()); |
|
481 return retval; |
|
482 } |
|
483 |
|
484 octave_uint8 |
|
485 octave_base_value::uint8_scalar_value (void) const |
|
486 { |
|
487 octave_uint8 retval; |
|
488 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()", |
|
489 type_name ()); |
|
490 return retval; |
|
491 } |
|
492 |
|
493 octave_uint16 |
|
494 octave_base_value::uint16_scalar_value (void) const |
|
495 { |
|
496 octave_uint16 retval; |
|
497 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()", |
|
498 type_name ()); |
|
499 return retval; |
|
500 } |
|
501 |
|
502 octave_uint32 |
|
503 octave_base_value::uint32_scalar_value (void) const |
|
504 { |
|
505 octave_uint32 retval; |
|
506 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()", |
|
507 type_name ()); |
|
508 return retval; |
|
509 } |
|
510 |
|
511 octave_uint64 |
|
512 octave_base_value::uint64_scalar_value (void) const |
|
513 { |
|
514 octave_uint64 retval; |
|
515 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()", |
|
516 type_name ()); |
|
517 return retval; |
|
518 } |
|
519 |
4906
|
520 int8NDArray |
|
521 octave_base_value::int8_array_value (void) const |
|
522 { |
|
523 int8NDArray retval; |
|
524 gripe_wrong_type_arg ("octave_base_value::int8_array_value()", |
|
525 type_name ()); |
4910
|
526 return retval; |
4906
|
527 } |
|
528 |
|
529 int16NDArray |
|
530 octave_base_value::int16_array_value (void) const |
|
531 { |
|
532 int16NDArray retval; |
|
533 gripe_wrong_type_arg ("octave_base_value::int16_array_value()", |
|
534 type_name ()); |
4910
|
535 return retval; |
4906
|
536 } |
|
537 |
|
538 int32NDArray |
|
539 octave_base_value::int32_array_value (void) const |
|
540 { |
|
541 int32NDArray retval; |
|
542 gripe_wrong_type_arg ("octave_base_value::int32_array_value()", |
|
543 type_name ()); |
4910
|
544 return retval; |
4906
|
545 } |
|
546 |
|
547 int64NDArray |
|
548 octave_base_value::int64_array_value (void) const |
|
549 { |
|
550 int64NDArray retval; |
|
551 gripe_wrong_type_arg ("octave_base_value::int64_array_value()", |
|
552 type_name ()); |
4910
|
553 return retval; |
4906
|
554 } |
|
555 |
|
556 uint8NDArray |
|
557 octave_base_value::uint8_array_value (void) const |
|
558 { |
|
559 uint8NDArray retval; |
|
560 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()", |
|
561 type_name ()); |
4910
|
562 return retval; |
4906
|
563 } |
|
564 |
|
565 uint16NDArray |
|
566 octave_base_value::uint16_array_value (void) const |
|
567 { |
|
568 uint16NDArray retval; |
|
569 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()", |
|
570 type_name ()); |
4910
|
571 return retval; |
4906
|
572 } |
|
573 |
|
574 uint32NDArray |
|
575 octave_base_value::uint32_array_value (void) const |
|
576 { |
|
577 uint32NDArray retval; |
|
578 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()", |
|
579 type_name ()); |
4910
|
580 return retval; |
4906
|
581 } |
|
582 |
|
583 uint64NDArray |
|
584 octave_base_value::uint64_array_value (void) const |
|
585 { |
|
586 uint64NDArray retval; |
|
587 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()", |
|
588 type_name ()); |
4910
|
589 return retval; |
4906
|
590 } |
|
591 |
2493
|
592 string_vector |
4457
|
593 octave_base_value::all_strings (bool pad, bool force) const |
2376
|
594 { |
2493
|
595 string_vector retval; |
4257
|
596 |
4457
|
597 octave_value tmp = convert_to_str (pad, force); |
4257
|
598 |
4452
|
599 if (! error_state) |
|
600 retval = tmp.all_strings (); |
4257
|
601 |
2376
|
602 return retval; |
|
603 } |
|
604 |
3536
|
605 std::string |
4457
|
606 octave_base_value::string_value (bool force) const |
2376
|
607 { |
3523
|
608 std::string retval; |
4257
|
609 |
4457
|
610 octave_value tmp = convert_to_str (force); |
4257
|
611 |
4452
|
612 if (! error_state) |
|
613 retval = tmp.string_value (); |
4257
|
614 |
2376
|
615 return retval; |
|
616 } |
|
617 |
|
618 Range |
|
619 octave_base_value::range_value (void) const |
|
620 { |
|
621 Range retval; |
|
622 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ()); |
|
623 return retval; |
|
624 } |
|
625 |
|
626 Octave_map |
|
627 octave_base_value::map_value (void) const |
|
628 { |
|
629 Octave_map retval; |
|
630 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ()); |
|
631 return retval; |
|
632 } |
|
633 |
3933
|
634 string_vector |
|
635 octave_base_value::map_keys (void) const |
|
636 { |
|
637 string_vector retval; |
|
638 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); |
|
639 return retval; |
|
640 } |
|
641 |
4645
|
642 std::streamoff |
4643
|
643 octave_base_value::streamoff_value (void) const |
|
644 { |
4649
|
645 std::streamoff retval (-1); |
4645
|
646 gripe_wrong_type_arg ("octave_base_value::streamoff_value()", type_name ()); |
|
647 return retval; |
|
648 } |
|
649 |
|
650 streamoff_array |
|
651 octave_base_value::streamoff_array_value (void) const |
|
652 { |
4643
|
653 streamoff_array retval; |
4645
|
654 gripe_wrong_type_arg ("octave_base_value::streamoff_array_value()", |
|
655 type_name ()); |
4643
|
656 return retval; |
|
657 } |
|
658 |
2974
|
659 octave_function * |
|
660 octave_base_value::function_value (bool silent) |
|
661 { |
|
662 octave_function *retval = 0; |
|
663 |
|
664 if (! silent) |
|
665 gripe_wrong_type_arg ("octave_base_value::function_value()", |
|
666 type_name ()); |
|
667 return retval; |
|
668 } |
|
669 |
4700
|
670 octave_user_function * |
|
671 octave_base_value::user_function_value (bool silent) |
|
672 { |
|
673 octave_user_function *retval = 0; |
|
674 |
|
675 if (! silent) |
|
676 gripe_wrong_type_arg ("octave_base_value::user_function_value()", |
|
677 type_name ()); |
|
678 return retval; |
|
679 } |
|
680 |
4346
|
681 octave_fcn_handle * |
4343
|
682 octave_base_value::fcn_handle_value (bool silent) |
|
683 { |
4346
|
684 octave_fcn_handle *retval = 0; |
4343
|
685 |
|
686 if (! silent) |
|
687 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()", |
|
688 type_name ()); |
|
689 return retval; |
|
690 } |
|
691 |
4933
|
692 octave_fcn_inline * |
|
693 octave_base_value::fcn_inline_value (bool silent) |
|
694 { |
|
695 octave_fcn_inline *retval = 0; |
|
696 |
|
697 if (! silent) |
|
698 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()", |
|
699 type_name ()); |
|
700 return retval; |
|
701 } |
|
702 |
2882
|
703 octave_value_list |
|
704 octave_base_value::list_value (void) const |
|
705 { |
|
706 octave_value_list retval; |
|
707 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ()); |
|
708 return retval; |
|
709 } |
|
710 |
4687
|
711 bool |
|
712 octave_base_value::save_ascii (std::ostream&, bool&, bool) |
|
713 { |
|
714 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); |
|
715 return false; |
|
716 } |
|
717 |
|
718 bool |
|
719 octave_base_value::load_ascii (std::istream&) |
|
720 { |
|
721 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); |
|
722 return false; |
|
723 } |
|
724 |
|
725 bool |
|
726 octave_base_value::save_binary (std::ostream&, bool&) |
|
727 { |
|
728 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
729 return false; |
|
730 } |
|
731 |
|
732 bool |
|
733 octave_base_value::load_binary (std::istream&, bool, |
|
734 oct_mach_info::float_format) |
|
735 { |
|
736 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
737 return false; |
|
738 } |
|
739 |
|
740 #if defined (HAVE_HDF5) |
4944
|
741 |
4687
|
742 bool |
|
743 octave_base_value::save_hdf5 (hid_t, const char *, bool) |
|
744 { |
|
745 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
746 |
|
747 return false; |
|
748 } |
|
749 |
|
750 bool |
|
751 octave_base_value::load_hdf5 (hid_t, const char *, bool) |
|
752 { |
|
753 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
754 |
|
755 return false; |
|
756 } |
4944
|
757 |
4687
|
758 #endif |
|
759 |
4944
|
760 int |
|
761 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type, |
|
762 int, oct_mach_info::float_format) const |
|
763 { |
|
764 gripe_wrong_type_arg ("octave_base_value::write()", type_name ()); |
|
765 |
|
766 return false; |
|
767 } |
|
768 |
3203
|
769 CONVDECLX (matrix_conv) |
2376
|
770 { |
|
771 return new octave_matrix (); |
|
772 } |
|
773 |
3203
|
774 CONVDECLX (complex_matrix_conv) |
2376
|
775 { |
|
776 return new octave_complex_matrix (); |
|
777 } |
|
778 |
3203
|
779 CONVDECLX (string_conv) |
2376
|
780 { |
|
781 return new octave_char_matrix_str (); |
|
782 } |
|
783 |
3928
|
784 CONVDECLX (cell_conv) |
|
785 { |
|
786 return new octave_cell (); |
|
787 } |
|
788 |
2376
|
789 void |
|
790 install_base_type_conversions (void) |
|
791 { |
|
792 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); |
|
793 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); |
|
794 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); |
|
795 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix); |
|
796 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); |
|
797 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str); |
3928
|
798 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376
|
799 |
|
800 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); |
|
801 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv); |
|
802 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); |
3928
|
803 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376
|
804 } |
|
805 |
|
806 /* |
|
807 ;;; Local Variables: *** |
|
808 ;;; mode: C++ *** |
|
809 ;;; End: *** |
|
810 */ |