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