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