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