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 |
5164
|
416 SparseMatrix |
|
417 octave_base_value::sparse_matrix_value (bool) const |
|
418 { |
|
419 SparseMatrix retval; |
|
420 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ()); |
|
421 return retval; |
|
422 } |
|
423 |
|
424 SparseComplexMatrix |
|
425 octave_base_value::sparse_complex_matrix_value (bool) const |
|
426 { |
|
427 SparseComplexMatrix retval; |
|
428 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ()); |
|
429 return retval; |
|
430 } |
|
431 |
|
432 SparseBoolMatrix |
|
433 octave_base_value::sparse_bool_matrix_value (bool) const |
|
434 { |
|
435 SparseBoolMatrix retval; |
|
436 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ()); |
|
437 return retval; |
|
438 } |
|
439 |
4910
|
440 octave_int8 |
|
441 octave_base_value::int8_scalar_value (void) const |
|
442 { |
|
443 octave_int8 retval; |
|
444 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()", |
|
445 type_name ()); |
|
446 return retval; |
|
447 } |
|
448 |
|
449 octave_int16 |
|
450 octave_base_value::int16_scalar_value (void) const |
|
451 { |
|
452 octave_int16 retval; |
|
453 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()", |
|
454 type_name ()); |
|
455 return retval; |
|
456 } |
|
457 |
|
458 octave_int32 |
|
459 octave_base_value::int32_scalar_value (void) const |
|
460 { |
|
461 octave_int32 retval; |
|
462 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()", |
|
463 type_name ()); |
|
464 return retval; |
|
465 } |
|
466 |
|
467 octave_int64 |
|
468 octave_base_value::int64_scalar_value (void) const |
|
469 { |
|
470 octave_int64 retval; |
|
471 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()", |
|
472 type_name ()); |
|
473 return retval; |
|
474 } |
|
475 |
|
476 octave_uint8 |
|
477 octave_base_value::uint8_scalar_value (void) const |
|
478 { |
|
479 octave_uint8 retval; |
|
480 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()", |
|
481 type_name ()); |
|
482 return retval; |
|
483 } |
|
484 |
|
485 octave_uint16 |
|
486 octave_base_value::uint16_scalar_value (void) const |
|
487 { |
|
488 octave_uint16 retval; |
|
489 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()", |
|
490 type_name ()); |
|
491 return retval; |
|
492 } |
|
493 |
|
494 octave_uint32 |
|
495 octave_base_value::uint32_scalar_value (void) const |
|
496 { |
|
497 octave_uint32 retval; |
|
498 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()", |
|
499 type_name ()); |
|
500 return retval; |
|
501 } |
|
502 |
|
503 octave_uint64 |
|
504 octave_base_value::uint64_scalar_value (void) const |
|
505 { |
|
506 octave_uint64 retval; |
|
507 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()", |
|
508 type_name ()); |
|
509 return retval; |
|
510 } |
|
511 |
4906
|
512 int8NDArray |
|
513 octave_base_value::int8_array_value (void) const |
|
514 { |
|
515 int8NDArray retval; |
|
516 gripe_wrong_type_arg ("octave_base_value::int8_array_value()", |
|
517 type_name ()); |
4910
|
518 return retval; |
4906
|
519 } |
|
520 |
|
521 int16NDArray |
|
522 octave_base_value::int16_array_value (void) const |
|
523 { |
|
524 int16NDArray retval; |
|
525 gripe_wrong_type_arg ("octave_base_value::int16_array_value()", |
|
526 type_name ()); |
4910
|
527 return retval; |
4906
|
528 } |
|
529 |
|
530 int32NDArray |
|
531 octave_base_value::int32_array_value (void) const |
|
532 { |
|
533 int32NDArray retval; |
|
534 gripe_wrong_type_arg ("octave_base_value::int32_array_value()", |
|
535 type_name ()); |
4910
|
536 return retval; |
4906
|
537 } |
|
538 |
|
539 int64NDArray |
|
540 octave_base_value::int64_array_value (void) const |
|
541 { |
|
542 int64NDArray retval; |
|
543 gripe_wrong_type_arg ("octave_base_value::int64_array_value()", |
|
544 type_name ()); |
4910
|
545 return retval; |
4906
|
546 } |
|
547 |
|
548 uint8NDArray |
|
549 octave_base_value::uint8_array_value (void) const |
|
550 { |
|
551 uint8NDArray retval; |
|
552 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()", |
|
553 type_name ()); |
4910
|
554 return retval; |
4906
|
555 } |
|
556 |
|
557 uint16NDArray |
|
558 octave_base_value::uint16_array_value (void) const |
|
559 { |
|
560 uint16NDArray retval; |
|
561 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()", |
|
562 type_name ()); |
4910
|
563 return retval; |
4906
|
564 } |
|
565 |
|
566 uint32NDArray |
|
567 octave_base_value::uint32_array_value (void) const |
|
568 { |
|
569 uint32NDArray retval; |
|
570 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()", |
|
571 type_name ()); |
4910
|
572 return retval; |
4906
|
573 } |
|
574 |
|
575 uint64NDArray |
|
576 octave_base_value::uint64_array_value (void) const |
|
577 { |
|
578 uint64NDArray retval; |
|
579 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()", |
|
580 type_name ()); |
4910
|
581 return retval; |
4906
|
582 } |
|
583 |
2493
|
584 string_vector |
4457
|
585 octave_base_value::all_strings (bool pad, bool force) const |
2376
|
586 { |
2493
|
587 string_vector retval; |
4257
|
588 |
4457
|
589 octave_value tmp = convert_to_str (pad, force); |
4257
|
590 |
4452
|
591 if (! error_state) |
|
592 retval = tmp.all_strings (); |
4257
|
593 |
2376
|
594 return retval; |
|
595 } |
|
596 |
3536
|
597 std::string |
4457
|
598 octave_base_value::string_value (bool force) const |
2376
|
599 { |
3523
|
600 std::string retval; |
4257
|
601 |
4457
|
602 octave_value tmp = convert_to_str (force); |
4257
|
603 |
4452
|
604 if (! error_state) |
|
605 retval = tmp.string_value (); |
4257
|
606 |
2376
|
607 return retval; |
|
608 } |
|
609 |
|
610 Range |
|
611 octave_base_value::range_value (void) const |
|
612 { |
|
613 Range retval; |
|
614 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ()); |
|
615 return retval; |
|
616 } |
|
617 |
|
618 Octave_map |
|
619 octave_base_value::map_value (void) const |
|
620 { |
|
621 Octave_map retval; |
|
622 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ()); |
|
623 return retval; |
|
624 } |
|
625 |
3933
|
626 string_vector |
|
627 octave_base_value::map_keys (void) const |
|
628 { |
|
629 string_vector retval; |
|
630 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ()); |
|
631 return retval; |
|
632 } |
|
633 |
3340
|
634 octave_stream |
2901
|
635 octave_base_value::stream_value (void) const |
|
636 { |
3340
|
637 octave_stream retval; |
2901
|
638 gripe_wrong_type_arg ("octave_base_value::stream_value()", 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 |
2901
|
659 int |
|
660 octave_base_value::stream_number (void) const |
|
661 { |
|
662 int retval = -1; |
|
663 gripe_wrong_type_arg ("octave_base_value::stream_number()", type_name ()); |
|
664 return retval; |
|
665 } |
|
666 |
2974
|
667 octave_function * |
|
668 octave_base_value::function_value (bool silent) |
|
669 { |
|
670 octave_function *retval = 0; |
|
671 |
|
672 if (! silent) |
|
673 gripe_wrong_type_arg ("octave_base_value::function_value()", |
|
674 type_name ()); |
|
675 return retval; |
|
676 } |
|
677 |
4700
|
678 octave_user_function * |
|
679 octave_base_value::user_function_value (bool silent) |
|
680 { |
|
681 octave_user_function *retval = 0; |
|
682 |
|
683 if (! silent) |
|
684 gripe_wrong_type_arg ("octave_base_value::user_function_value()", |
|
685 type_name ()); |
|
686 return retval; |
|
687 } |
|
688 |
4346
|
689 octave_fcn_handle * |
4343
|
690 octave_base_value::fcn_handle_value (bool silent) |
|
691 { |
4346
|
692 octave_fcn_handle *retval = 0; |
4343
|
693 |
|
694 if (! silent) |
|
695 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()", |
|
696 type_name ()); |
|
697 return retval; |
|
698 } |
|
699 |
4933
|
700 octave_fcn_inline * |
|
701 octave_base_value::fcn_inline_value (bool silent) |
|
702 { |
|
703 octave_fcn_inline *retval = 0; |
|
704 |
|
705 if (! silent) |
|
706 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()", |
|
707 type_name ()); |
|
708 return retval; |
|
709 } |
|
710 |
2882
|
711 octave_value_list |
|
712 octave_base_value::list_value (void) const |
|
713 { |
|
714 octave_value_list retval; |
|
715 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ()); |
|
716 return retval; |
|
717 } |
|
718 |
4687
|
719 bool |
|
720 octave_base_value::save_ascii (std::ostream&, bool&, bool) |
|
721 { |
|
722 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); |
|
723 return false; |
|
724 } |
|
725 |
|
726 bool |
|
727 octave_base_value::load_ascii (std::istream&) |
|
728 { |
|
729 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); |
|
730 return false; |
|
731 } |
|
732 |
|
733 bool |
|
734 octave_base_value::save_binary (std::ostream&, bool&) |
|
735 { |
|
736 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
737 return false; |
|
738 } |
|
739 |
|
740 bool |
|
741 octave_base_value::load_binary (std::istream&, bool, |
|
742 oct_mach_info::float_format) |
|
743 { |
|
744 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
745 return false; |
|
746 } |
|
747 |
|
748 #if defined (HAVE_HDF5) |
4944
|
749 |
4687
|
750 bool |
|
751 octave_base_value::save_hdf5 (hid_t, const char *, bool) |
|
752 { |
|
753 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); |
|
754 |
|
755 return false; |
|
756 } |
|
757 |
|
758 bool |
|
759 octave_base_value::load_hdf5 (hid_t, const char *, bool) |
|
760 { |
|
761 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); |
|
762 |
|
763 return false; |
|
764 } |
4944
|
765 |
4687
|
766 #endif |
|
767 |
4944
|
768 int |
|
769 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type, |
|
770 int, oct_mach_info::float_format) const |
|
771 { |
|
772 gripe_wrong_type_arg ("octave_base_value::write()", type_name ()); |
|
773 |
|
774 return false; |
|
775 } |
|
776 |
3203
|
777 CONVDECLX (matrix_conv) |
2376
|
778 { |
|
779 return new octave_matrix (); |
|
780 } |
|
781 |
3203
|
782 CONVDECLX (complex_matrix_conv) |
2376
|
783 { |
|
784 return new octave_complex_matrix (); |
|
785 } |
|
786 |
3203
|
787 CONVDECLX (string_conv) |
2376
|
788 { |
|
789 return new octave_char_matrix_str (); |
|
790 } |
|
791 |
3928
|
792 CONVDECLX (cell_conv) |
|
793 { |
|
794 return new octave_cell (); |
|
795 } |
|
796 |
2376
|
797 void |
|
798 install_base_type_conversions (void) |
|
799 { |
|
800 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix); |
|
801 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix); |
|
802 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix); |
|
803 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix); |
|
804 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix); |
|
805 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str); |
3928
|
806 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell); |
2376
|
807 |
|
808 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv); |
|
809 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv); |
|
810 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv); |
3928
|
811 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv); |
2376
|
812 } |
|
813 |
|
814 /* |
|
815 ;;; Local Variables: *** |
|
816 ;;; mode: C++ *** |
|
817 ;;; End: *** |
|
818 */ |