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 |
5604
|
183 octave_idx_type |
|
184 octave_base_value::nzmax (void) const |
|
185 { |
|
186 gripe_wrong_type_arg ("octave_base_value::nzmax ()", type_name ()); |
|
187 return -1; |
|
188 } |
|
189 |
2376
|
190 octave_value |
4567
|
191 octave_base_value::reshape (const dim_vector&) const |
|
192 { |
|
193 gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ()); |
|
194 return octave_value (); |
|
195 } |
|
196 |
|
197 octave_value |
4593
|
198 octave_base_value::permute (const Array<int>&, bool) const |
|
199 { |
|
200 gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ()); |
|
201 return octave_value (); |
|
202 } |
|
203 |
|
204 octave_value |
4933
|
205 octave_base_value::resize (const dim_vector&) const |
4915
|
206 { |
|
207 gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ()); |
|
208 return octave_value (); |
|
209 } |
|
210 |
|
211 octave_value |
5279
|
212 octave_base_value::convert_to_str_internal (bool, bool, char) const |
2376
|
213 { |
4452
|
214 gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", |
2376
|
215 type_name ()); |
|
216 return octave_value (); |
|
217 } |
|
218 |
|
219 void |
|
220 octave_base_value::convert_to_row_or_column_vector (void) |
|
221 { |
|
222 gripe_wrong_type_arg |
|
223 ("octave_base_value::convert_to_row_or_column_vector ()", |
|
224 type_name ()); |
|
225 } |
|
226 |
|
227 void |
3523
|
228 octave_base_value::print (std::ostream&, bool) const |
2376
|
229 { |
3195
|
230 gripe_wrong_type_arg ("octave_base_value::print ()", type_name ()); |
2376
|
231 } |
|
232 |
2901
|
233 void |
3523
|
234 octave_base_value::print_raw (std::ostream&, bool) const |
2901
|
235 { |
3195
|
236 gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); |
2901
|
237 } |
|
238 |
|
239 bool |
3523
|
240 octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const |
2901
|
241 { |
4604
|
242 bool retval = false; |
|
243 |
2901
|
244 indent (os); |
4604
|
245 |
|
246 if (print_as_scalar ()) |
|
247 os << name << " = "; |
|
248 else |
|
249 { |
|
250 os << name << " ="; |
|
251 newline (os); |
|
252 newline (os); |
|
253 retval = true; |
|
254 } |
|
255 |
|
256 return retval; |
2901
|
257 } |
|
258 |
3933
|
259 void |
|
260 octave_base_value::print_info (std::ostream& os, |
4661
|
261 const std::string& /* prefix */) const |
3933
|
262 { |
|
263 os << "no info for type: " << type_name () << "\n"; |
|
264 } |
|
265 |
4254
|
266 #define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \ |
|
267 T \ |
|
268 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ |
|
269 { \ |
|
270 T retval = 0; \ |
|
271 \ |
|
272 double d = double_value (frc_str_conv); \ |
|
273 \ |
|
274 if (! error_state) \ |
|
275 { \ |
|
276 if (require_int && D_NINT (d) != d) \ |
|
277 error ("conversion of %g to " #T " value failed", d); \ |
5054
|
278 else if (d < MIN_LIMIT) \ |
|
279 retval = MIN_LIMIT; \ |
|
280 else if (d > MAX_LIMIT) \ |
|
281 retval = MAX_LIMIT; \ |
4254
|
282 else \ |
4732
|
283 retval = static_cast<T> (fix (d)); \ |
4254
|
284 } \ |
|
285 else \ |
|
286 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \ |
|
287 type_name ()); \ |
|
288 \ |
|
289 return retval; \ |
|
290 } |
3202
|
291 |
4254
|
292 INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX) |
|
293 INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX) |
3202
|
294 |
4254
|
295 INT_CONV_METHOD (int, int, INT_MIN, INT_MAX) |
|
296 INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX) |
3202
|
297 |
4254
|
298 INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX) |
|
299 INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX) |
3202
|
300 |
|
301 int |
|
302 octave_base_value::nint_value (bool frc_str_conv) const |
|
303 { |
|
304 int retval = 0; |
|
305 |
|
306 double d = double_value (frc_str_conv); |
|
307 |
|
308 if (! error_state) |
|
309 { |
|
310 if (xisnan (d)) |
|
311 { |
|
312 error ("conversion of NaN to integer value failed"); |
|
313 return retval; |
|
314 } |
|
315 |
4732
|
316 retval = static_cast<int> (fix (d)); |
3202
|
317 } |
|
318 else |
|
319 gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ()); |
|
320 |
|
321 return retval; |
|
322 } |
|
323 |
2376
|
324 double |
|
325 octave_base_value::double_value (bool) const |
|
326 { |
4102
|
327 double retval = lo_ieee_nan_value (); |
2376
|
328 gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ()); |
|
329 return retval; |
|
330 } |
|
331 |
3351
|
332 Cell |
3539
|
333 octave_base_value::cell_value () const |
3351
|
334 { |
|
335 Cell retval; |
|
336 gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ()); |
|
337 return retval; |
|
338 } |
|
339 |
2376
|
340 Matrix |
|
341 octave_base_value::matrix_value (bool) const |
|
342 { |
|
343 Matrix retval; |
|
344 gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ()); |
|
345 return retval; |
|
346 } |
|
347 |
4507
|
348 NDArray |
4550
|
349 octave_base_value::array_value (bool) const |
4505
|
350 { |
4507
|
351 NDArray retval; |
4550
|
352 gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ()); |
4505
|
353 return retval; |
|
354 } |
|
355 |
2376
|
356 Complex |
|
357 octave_base_value::complex_value (bool) const |
|
358 { |
4102
|
359 double tmp = lo_ieee_nan_value (); |
|
360 Complex retval (tmp, tmp); |
2376
|
361 gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ()); |
|
362 return retval; |
|
363 } |
|
364 |
|
365 ComplexMatrix |
|
366 octave_base_value::complex_matrix_value (bool) const |
|
367 { |
|
368 ComplexMatrix retval; |
|
369 gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()", |
|
370 type_name ()); |
|
371 return retval; |
|
372 } |
|
373 |
4550
|
374 ComplexNDArray |
|
375 octave_base_value::complex_array_value (bool) const |
|
376 { |
|
377 ComplexNDArray retval; |
|
378 gripe_wrong_type_arg ("octave_base_value::complex_array_value()", |
|
379 type_name ()); |
|
380 return retval; |
|
381 } |
|
382 |
|
383 bool |
|
384 octave_base_value::bool_value (void) const |
|
385 { |
|
386 bool retval = false; |
|
387 gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); |
|
388 return retval; |
|
389 } |
|
390 |
|
391 boolMatrix |
|
392 octave_base_value::bool_matrix_value (void) const |
|
393 { |
|
394 boolMatrix retval; |
|
395 gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", |
|
396 type_name ()); |
|
397 return retval; |
|
398 } |
|
399 |
|
400 boolNDArray |
4580
|
401 octave_base_value::bool_array_value (void) const |
4550
|
402 { |
|
403 boolNDArray retval; |
|
404 gripe_wrong_type_arg ("octave_base_value::bool_array_value()", |
|
405 type_name ()); |
|
406 return retval; |
|
407 } |
|
408 |
2376
|
409 charMatrix |
4741
|
410 octave_base_value::char_matrix_value (bool force) const |
2376
|
411 { |
|
412 charMatrix retval; |
4257
|
413 |
4741
|
414 octave_value tmp = convert_to_str (false, force); |
4257
|
415 |
4452
|
416 if (! error_state) |
|
417 retval = tmp.char_matrix_value (); |
|
418 |
2376
|
419 return retval; |
|
420 } |
|
421 |
4550
|
422 charNDArray |
|
423 octave_base_value::char_array_value (bool) const |
|
424 { |
|
425 charNDArray retval; |
|
426 gripe_wrong_type_arg ("octave_base_value::char_array_value()", |
|
427 type_name ()); |
|
428 return retval; |
|
429 } |
|
430 |
5164
|
431 SparseMatrix |
|
432 octave_base_value::sparse_matrix_value (bool) const |
|
433 { |
|
434 SparseMatrix retval; |
|
435 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); |
|
436 return retval; |
|
437 } |
|
438 |
|
439 SparseComplexMatrix |
|
440 octave_base_value::sparse_complex_matrix_value (bool) const |
|
441 { |
|
442 SparseComplexMatrix retval; |
|
443 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ()); |
|
444 return retval; |
|
445 } |
|
446 |
|
447 SparseBoolMatrix |
|
448 octave_base_value::sparse_bool_matrix_value (bool) const |
|
449 { |
|
450 SparseBoolMatrix retval; |
|
451 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ()); |
|
452 return retval; |
|
453 } |
|
454 |
4910
|
455 octave_int8 |
|
456 octave_base_value::int8_scalar_value (void) const |
|
457 { |
|
458 octave_int8 retval; |
|
459 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()", |
|
460 type_name ()); |
|
461 return retval; |
|
462 } |
|
463 |
|
464 octave_int16 |
|
465 octave_base_value::int16_scalar_value (void) const |
|
466 { |
|
467 octave_int16 retval; |
|
468 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()", |
|
469 type_name ()); |
|
470 return retval; |
|
471 } |
|
472 |
|
473 octave_int32 |
|
474 octave_base_value::int32_scalar_value (void) const |
|
475 { |
|
476 octave_int32 retval; |
|
477 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()", |
|
478 type_name ()); |
|
479 return retval; |
|
480 } |
|
481 |
|
482 octave_int64 |
|
483 octave_base_value::int64_scalar_value (void) const |
|
484 { |
|
485 octave_int64 retval; |
|
486 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()", |
|
487 type_name ()); |
|
488 return retval; |
|
489 } |
|
490 |
|
491 octave_uint8 |
|
492 octave_base_value::uint8_scalar_value (void) const |
|
493 { |
|
494 octave_uint8 retval; |
|
495 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()", |
|
496 type_name ()); |
|
497 return retval; |
|
498 } |
|
499 |
|
500 octave_uint16 |
|
501 octave_base_value::uint16_scalar_value (void) const |
|
502 { |
|
503 octave_uint16 retval; |
|
504 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()", |
|
505 type_name ()); |
|
506 return retval; |
|
507 } |
|
508 |
|
509 octave_uint32 |
|
510 octave_base_value::uint32_scalar_value (void) const |
|
511 { |
|
512 octave_uint32 retval; |
|
513 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()", |
|
514 type_name ()); |
|
515 return retval; |
|
516 } |
|
517 |
|
518 octave_uint64 |
|
519 octave_base_value::uint64_scalar_value (void) const |
|
520 { |
|
521 octave_uint64 retval; |
|
522 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()", |
|
523 type_name ()); |
|
524 return retval; |
|
525 } |
|
526 |
4906
|
527 int8NDArray |
|
528 octave_base_value::int8_array_value (void) const |
|
529 { |
|
530 int8NDArray retval; |
|
531 gripe_wrong_type_arg ("octave_base_value::int8_array_value()", |
|
532 type_name ()); |
4910
|
533 return retval; |
4906
|
534 } |
|
535 |
|
536 int16NDArray |
|
537 octave_base_value::int16_array_value (void) const |
|
538 { |
|
539 int16NDArray retval; |
|
540 gripe_wrong_type_arg ("octave_base_value::int16_array_value()", |
|
541 type_name ()); |
4910
|
542 return retval; |
4906
|
543 } |
|
544 |
|
545 int32NDArray |
|
546 octave_base_value::int32_array_value (void) const |
|
547 { |
|
548 int32NDArray retval; |
|
549 gripe_wrong_type_arg ("octave_base_value::int32_array_value()", |
|
550 type_name ()); |
4910
|
551 return retval; |
4906
|
552 } |
|
553 |
|
554 int64NDArray |
|
555 octave_base_value::int64_array_value (void) const |
|
556 { |
|
557 int64NDArray retval; |
|
558 gripe_wrong_type_arg ("octave_base_value::int64_array_value()", |
|
559 type_name ()); |
4910
|
560 return retval; |
4906
|
561 } |
|
562 |
|
563 uint8NDArray |
|
564 octave_base_value::uint8_array_value (void) const |
|
565 { |
|
566 uint8NDArray retval; |
|
567 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()", |
|
568 type_name ()); |
4910
|
569 return retval; |
4906
|
570 } |
|
571 |
|
572 uint16NDArray |
|
573 octave_base_value::uint16_array_value (void) const |
|
574 { |
|
575 uint16NDArray retval; |
|
576 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()", |
|
577 type_name ()); |
4910
|
578 return retval; |
4906
|
579 } |
|
580 |
|
581 uint32NDArray |
|
582 octave_base_value::uint32_array_value (void) const |
|
583 { |
|
584 uint32NDArray retval; |
|
585 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()", |
|
586 type_name ()); |
4910
|
587 return retval; |
4906
|
588 } |
|
589 |
|
590 uint64NDArray |
|
591 octave_base_value::uint64_array_value (void) const |
|
592 { |
|
593 uint64NDArray retval; |
|
594 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()", |
|
595 type_name ()); |
4910
|
596 return retval; |
4906
|
597 } |
|
598 |
2493
|
599 string_vector |
5707
|
600 octave_base_value::all_strings (void) const |
2376
|
601 { |
2493
|
602 string_vector retval; |
4257
|
603 |
5707
|
604 octave_value tmp = convert_to_str (false, true); |
4257
|
605 |
4452
|
606 if (! error_state) |
|
607 retval = tmp.all_strings (); |
4257
|
608 |
2376
|
609 return retval; |
|
610 } |
|
611 |
3536
|
612 std::string |
4457
|
613 octave_base_value::string_value (bool force) const |
2376
|
614 { |
3523
|
615 std::string retval; |
4257
|
616 |
4457
|
617 octave_value tmp = convert_to_str (force); |
4257
|
618 |
4452
|
619 if (! error_state) |
|
620 retval = tmp.string_value (); |
4257
|
621 |
2376
|
622 return retval; |
|
623 } |
|
624 |
|
625 Range |
|
626 octave_base_value::range_value (void) const |
|
627 { |
|
628 Range retval; |
|
629 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ()); |
|
630 return retval; |
|
631 } |
|
632 |
|
633 Octave_map |
|
634 octave_base_value::map_value (void) const |
|
635 { |
|
636 Octave_map retval; |
|
637 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ()); |
|
638 return retval; |
|
639 } |
|
640 |
3933
|
641 string_vector |
|
642 octave_base_value::map_keys (void) const |
|
643 { |
|
644 string_vector retval; |
|
645 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); |
|
646 return retval; |
|
647 } |
|
648 |
4645
|
649 std::streamoff |
4643
|
650 octave_base_value::streamoff_value (void) const |
|
651 { |
4649
|
652 std::streamoff retval (-1); |
4645
|
653 gripe_wrong_type_arg ("octave_base_value::streamoff_value()", type_name ()); |
|
654 return retval; |
|
655 } |
|
656 |
|
657 streamoff_array |
|
658 octave_base_value::streamoff_array_value (void) const |
|
659 { |
4643
|
660 streamoff_array retval; |
4645
|
661 gripe_wrong_type_arg ("octave_base_value::streamoff_array_value()", |
|
662 type_name ()); |
4643
|
663 return retval; |
|
664 } |
|
665 |
2974
|
666 octave_function * |
|
667 octave_base_value::function_value (bool silent) |
|
668 { |
|
669 octave_function *retval = 0; |
|
670 |
|
671 if (! silent) |
|
672 gripe_wrong_type_arg ("octave_base_value::function_value()", |
|
673 type_name ()); |
|
674 return retval; |
|
675 } |
|
676 |
4700
|
677 octave_user_function * |
|
678 octave_base_value::user_function_value (bool silent) |
|
679 { |
|
680 octave_user_function *retval = 0; |
|
681 |
|
682 if (! silent) |
|
683 gripe_wrong_type_arg ("octave_base_value::user_function_value()", |
|
684 type_name ()); |
|
685 return retval; |
|
686 } |
|
687 |
4346
|
688 octave_fcn_handle * |
4343
|
689 octave_base_value::fcn_handle_value (bool silent) |
|
690 { |
4346
|
691 octave_fcn_handle *retval = 0; |
4343
|
692 |
|
693 if (! silent) |
|
694 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()", |
|
695 type_name ()); |
|
696 return retval; |
|
697 } |
|
698 |
4933
|
699 octave_fcn_inline * |
|
700 octave_base_value::fcn_inline_value (bool silent) |
|
701 { |
|
702 octave_fcn_inline *retval = 0; |
|
703 |
|
704 if (! silent) |
|
705 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()", |
|
706 type_name ()); |
|
707 return retval; |
|
708 } |
|
709 |
2882
|
710 octave_value_list |
|
711 octave_base_value::list_value (void) const |
|
712 { |
|
713 octave_value_list retval; |
|
714 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ()); |
|
715 return retval; |
|
716 } |
|
717 |
4687
|
718 bool |
|
719 octave_base_value::save_ascii (std::ostream&, bool&, bool) |
|
720 { |
|
721 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); |
|
722 return false; |
|
723 } |
|
724 |
|
725 bool |
|
726 octave_base_value::load_ascii (std::istream&) |
|
727 { |
|
728 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); |
|
729 return false; |
|
730 } |
|
731 |
|
732 bool |
|
733 octave_base_value::save_binary (std::ostream&, bool&) |
|
734 { |
|
735 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
736 return false; |
|
737 } |
|
738 |
|
739 bool |
|
740 octave_base_value::load_binary (std::istream&, bool, |
|
741 oct_mach_info::float_format) |
|
742 { |
|
743 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
744 return false; |
|
745 } |
|
746 |
|
747 #if defined (HAVE_HDF5) |
4944
|
748 |
4687
|
749 bool |
|
750 octave_base_value::save_hdf5 (hid_t, const char *, bool) |
|
751 { |
|
752 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
753 |
|
754 return false; |
|
755 } |
|
756 |
|
757 bool |
|
758 octave_base_value::load_hdf5 (hid_t, const char *, bool) |
|
759 { |
|
760 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
761 |
|
762 return false; |
|
763 } |
4944
|
764 |
4687
|
765 #endif |
|
766 |
4944
|
767 int |
|
768 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type, |
|
769 int, oct_mach_info::float_format) const |
|
770 { |
|
771 gripe_wrong_type_arg ("octave_base_value::write()", type_name ()); |
|
772 |
|
773 return false; |
|
774 } |
|
775 |
3203
|
776 CONVDECLX (matrix_conv) |
2376
|
777 { |
|
778 return new octave_matrix (); |
|
779 } |
|
780 |
3203
|
781 CONVDECLX (complex_matrix_conv) |
2376
|
782 { |
|
783 return new octave_complex_matrix (); |
|
784 } |
|
785 |
3203
|
786 CONVDECLX (string_conv) |
2376
|
787 { |
|
788 return new octave_char_matrix_str (); |
|
789 } |
|
790 |
3928
|
791 CONVDECLX (cell_conv) |
|
792 { |
|
793 return new octave_cell (); |
|
794 } |
|
795 |
2376
|
796 void |
|
797 install_base_type_conversions (void) |
|
798 { |
|
799 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); |
|
800 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); |
|
801 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); |
|
802 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix); |
|
803 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); |
|
804 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str); |
3928
|
805 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376
|
806 |
|
807 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); |
|
808 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv); |
|
809 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); |
3928
|
810 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376
|
811 } |
|
812 |
|
813 /* |
|
814 ;;; Local Variables: *** |
|
815 ;;; mode: C++ *** |
|
816 ;;; End: *** |
|
817 */ |