annotate libinterp/octave-value/ov-base.cc @ 20574:dd6345fd8a97

use exceptions for better invalid index error reporting (bug #45957) * lo-array-gripes.h, lo-array-gripes.cc (index_exception): New base class for indexing errors. (invalid_index, out_of_range): New classes. (gripe_index_out_of_range): New overloaded function. (gripe_invalid_index): New overloaded functions. Delete version with no arguments. (gripe_invalid_assignment_size, gripe_assignment_dimension_mismatch): Delete. Change uses of gripe functions as needed. * Cell.cc (Cell::index, Cell::assign, Cell::delete_elements): Use exceptions to collect error info about and handle indexing errors. * data.cc (Fnth_element, do_accumarray_sum, F__accumarray_sum__, do_accumarray_minmax, do_accumarray_minmax_fun, F__accumdim_sum__): Likewise. * oct-map.cc (octave_map::index, octave_map::assign, octave_map::delete_elements): Likewise. * sparse.cc (Fsparse): Likewise. * sub2ind.cc (Fsub2ind, Find2sub): Likewise. New tests. * utils.cc (dims_to_numel): Likewise. * ov-base-diag.cc (octave_base_diag<DMT, MT>::do_index_op, octave_base_diag<DMT, MT>::subsasgn): Likewise. * ov-base-mat.cc (octave_base_matrix<MT>::subsref, octave_base_matrix<MT>::assign): Likewise. * ov-base-sparse.cc (octave_base_sparse<T>::do_index_op, octave_base_sparse<T>::assign, octave_base_sparse<MT>::delete_elements): Likewise. * ov-classdef.cc (cdef_object_array::subsref, cdef_object_array::subsasgn): Likewise. * ov-java.cc (make_java_index): Likewise. * ov-perm.cc (octave_perm_matrix::do_index_op): Likewise. * ov-range.cc (octave_range::do_index_op): Likewise. * ov-re-diag.cc (octave_diag_matrix::do_index_op): Likewise. * ov-str-mat.cc (octave_char_matrix_str::do_index_op_internal): Likewise. * pt-assign.cc (tree_simple_assignment::rvalue1): Likewise. * pt-idx.cc (tree_index_expression::rvalue, tree_index_expression::lvalue): Likewise. * Array-util.cc (sub2ind): Likewise. * toplev.cc (main_loop): Also catch unhandled index_exception exceptions. * ov-base.cc (octave_base_value::index_vector): Improve error message. * ov-re-sparse.cc (octave_sparse_matrix::index_vector): Likewise. * ov-complex.cc (complex_index): New class. (gripe_complex_index): New function. (octave_complex::index_vector): Use it. * pt-id.h, pt-id.cc (tree_identifier::is_variable, tree_black_hole::is_variable): Now const. * pt-idx.cc (final_index_error): New static function. (tree_index_expression::rvalue, tree_index_expression::lvalue): Use it. * index.tst: New tests.
author Lachlan Andrew <lachlanbis@gmail.com>
date Fri, 02 Oct 2015 15:07:37 -0400
parents 075a5e2e1ba5
children f90c8372b7ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19437
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10893
diff changeset
4 Copyright (C) 2009-2010 VZLU Prague
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
11 option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
16 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
20 <http://www.gnu.org/licenses/>.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
21
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
22 */
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
23
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3351
diff changeset
28 #include <iostream>
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
29 #include <limits>
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
30
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
31 #include "lo-ieee.h"
4732
b484cdca27be [project @ 2004-02-04 04:32:48 by jwe]
jwe
parents: 4700
diff changeset
32 #include "lo-mappers.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
33
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
34 #include "defun.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
35 #include "gripes.h"
15149
62a35ae7d6a2 use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents: 15057
diff changeset
36 #include "mxarray.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
37 #include "oct-map.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
38 #include "oct-obj.h"
19897
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
39 #include "oct-hdf5.h"
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents: 2974
diff changeset
40 #include "oct-lvalue.h"
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 3219
diff changeset
41 #include "oct-stream.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
42 #include "ops.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
43 #include "ov-base.h"
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
44 #include "ov-cell.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
45 #include "ov-ch-mat.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
46 #include "ov-complex.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
47 #include "ov-cx-mat.h"
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
48 #include "ov-range.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
49 #include "ov-re-mat.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
50 #include "ov-scalar.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
51 #include "ov-str-mat.h"
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
52 #include "ov-fcn-handle.h"
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
53 #include "parse.h"
13112
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
54 #include "pr-output.h"
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
55 #include "utils.h"
18316
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
56 #include "toplev.h"
2948
56be458e237f [project @ 1997-05-09 13:37:35 by jwe]
jwe
parents: 2901
diff changeset
57 #include "variables.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
58
9790
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
59 builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
60 {
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
61 builtin_type_t retval = btyp_unknown;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
62
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
63 if (x == btyp_bool)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
64 x = btyp_double;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
65 if (y == btyp_bool)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
66 y = btyp_double;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
67
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
68 if (x <= btyp_float_complex && y <= btyp_float_complex)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
69 retval = static_cast<builtin_type_t> (x | y);
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
70 else if (x <= btyp_uint64 && y <= btyp_float)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
71 retval = x;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
72 else if (x <= btyp_float && y <= btyp_uint64)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
73 retval = y;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
74 else if ((x >= btyp_int8 && x <= btyp_int64
9790
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
75 && y >= btyp_int8 && y <= btyp_int64)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
76 || (x >= btyp_uint8 && x <= btyp_uint64
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
77 && y >= btyp_uint8 && y <= btyp_uint64))
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
78 retval = (x > y) ? x : y;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
79
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
80 return retval;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
81 }
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
82
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
83 std::string btyp_class_name[btyp_num_types] =
10087
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
84 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
85 "double", "single", "double", "single",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
86 "int8", "int16", "int32", "int64",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
87 "uint8", "uint16", "uint32", "uint64",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
88 "logical", "char",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
89 "struct", "cell", "function_handle"
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
90 };
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
91
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
92 string_vector
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
93 get_builtin_classes (void)
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
94 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
95 static string_vector retval;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
96
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
97 if (retval.is_empty ())
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
98 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
99 int n = btyp_num_types - 2;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
100 retval = string_vector (n);
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
101 int j = 0;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
102 for (int i = 0; i < btyp_num_types; i++)
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
103 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
104 builtin_type_t ityp = static_cast<builtin_type_t> (i);
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
105 if (ityp != btyp_complex && ityp != btyp_float_complex)
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
106 retval(j++) = btyp_class_name[i];
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
107 }
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
108 }
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
109
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
110 return retval;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
111 }
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
112
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4604
diff changeset
113 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
114 "<unknown type>", "unknown");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
115
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
116 // TRUE means to perform automatic sparse to real mutation if there
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
117 // is memory to be saved
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
118 bool Vsparse_auto_mutate = false;
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
119
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
120 octave_base_value *
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
121 octave_base_value::empty_clone (void) const
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
122 {
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
123 return resize (dim_vector ()).clone ();
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
124 }
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
125
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
126 octave_value
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
127 octave_base_value::squeeze (void) const
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
128 {
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
129 std::string nm = type_name ();
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
130 error ("squeeze: invalid operation for %s type", nm.c_str ());
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
131 return octave_value ();
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
132 }
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
133
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
134 octave_value
8458
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
135 octave_base_value::full_value (void) const
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
136 {
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
137 gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ());
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
138 return octave_value ();
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
139 }
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
140
9329
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
141 Matrix
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
142 octave_base_value::size (void)
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
143 {
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
144 const dim_vector dv = dims ();
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
145 Matrix mdv (1, dv.length ());
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
146 for (octave_idx_type i = 0; i < dv.length (); i++)
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
147 mdv(i) = dv(i);
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
148 return mdv;
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
149 }
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
150
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
151 octave_idx_type
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
152 octave_base_value::numel (const octave_value_list& idx)
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
153 {
9705
5acd99c3e794 avoid recursive overloaded calls in builtin numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9689
diff changeset
154 return dims_to_numel (dims (), idx);
9329
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
155 }
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
156
8458
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
157 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
158 octave_base_value::subsref (const std::string&,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
159 const std::list<octave_value_list>&)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
160 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
161 std::string nm = type_name ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
162 error ("can't perform indexing operations for %s type", nm.c_str ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
163 return octave_value ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
164 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
165
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
166 octave_value_list
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
167 octave_base_value::subsref (const std::string&,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
168 const std::list<octave_value_list>&, int)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
169 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
170 std::string nm = type_name ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
171 error ("can't perform indexing operations for %s type", nm.c_str ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
172 return octave_value ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
173 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
174
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
175 octave_value
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
176 octave_base_value::subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
177 const std::list<octave_value_list>& idx,
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
178 bool /* auto_add */)
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
179 {
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
180 // This way we may get a more meaningful error message.
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
181 return subsref (type, idx);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
182 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
183
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
184 octave_value_list
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
185 octave_base_value::subsref (const std::string& type,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
186 const std::list<octave_value_list>& idx,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
187 int nargout,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
188 const std::list<octave_lvalue> *)
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
189 {
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
190 // Fall back to call without passing lvalue list.
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
191 return subsref (type, idx, nargout);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
192 }
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
193
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
194 octave_value
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5874
diff changeset
195 octave_base_value::do_index_op (const octave_value_list&, bool)
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
196 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
197 std::string nm = type_name ();
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
198 error ("can't perform indexing operations for %s type", nm.c_str ());
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
199 return octave_value ();
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
200 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
201
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
202 octave_value_list
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3539
diff changeset
203 octave_base_value::do_multi_index_op (int, const octave_value_list&)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
204 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
205 std::string nm = type_name ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
206 error ("can't perform indexing operations for %s type", nm.c_str ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
207 return octave_value ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
208 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
209
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
210 octave_value_list
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
211 octave_base_value::do_multi_index_op (int nargout, const octave_value_list& idx,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
212 const std::list<octave_lvalue> *)
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
213 {
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
214 // Fall back.
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
215 return do_multi_index_op (nargout, idx);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
216 }
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
217
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218 idx_vector
18129
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
219 octave_base_value::index_vector (bool /* require_integers */) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
220 {
20574
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20198
diff changeset
221 std::string nm = "<" + type_name () + ">";
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20198
diff changeset
222 gripe_invalid_index (nm.c_str ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
223 return idx_vector ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
224 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
225
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
226 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
227 octave_base_value::subsasgn (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
228 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
229 const octave_value& rhs)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
230 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
231 octave_value retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
232
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
233 if (is_defined ())
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
234 {
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4102
diff changeset
235 if (is_numeric_type ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
236 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
237 switch (type[0])
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
238 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
239 case '(':
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
240 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
241 if (type.length () == 1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
242 retval = numeric_assign (type, idx, rhs);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
243 else if (is_empty ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
244 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
245 // Allow conversion of empty matrix to some other
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
246 // type in cases like
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
247 //
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
248 // x = []; x(i).f = rhs
4436
689f730954b3 [project @ 2003-06-24 13:00:12 by jwe]
jwe
parents: 4358
diff changeset
249
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
250 octave_value tmp = octave_value::empty_conv (type, rhs);
4436
689f730954b3 [project @ 2003-06-24 13:00:12 by jwe]
jwe
parents: 4358
diff changeset
251
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
252 retval = tmp.subsasgn (type, idx, rhs);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
253 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
254 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
255 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
256 std::string nm = type_name ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
257 error ("in indexed assignment of %s, last rhs index must be ()",
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
258 nm.c_str ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
259 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
260 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
261 break;
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4102
diff changeset
262
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
263 case '{':
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
264 case '.':
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
265 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
266 std::string nm = type_name ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
267 error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
268 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
269 break;
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4102
diff changeset
270
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
271 default:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
272 panic_impossible ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
273 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
274 }
4139
02ca908056e9 [project @ 2002-11-01 00:49:13 by jwe]
jwe
parents: 4102
diff changeset
275 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
276 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
277 std::string nm = type_name ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
278 error ("can't perform indexed assignment for %s type", nm.c_str ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
279 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
280 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
281 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
282 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
283 // Create new object of appropriate type for given index and rhs
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
284 // types and then call undef_subsasgn for that object.
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
285
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
286 octave_value tmp = octave_value::empty_conv (type, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
287
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
288 retval = tmp.undef_subsasgn (type, idx, rhs);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
289 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
290
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
291 return retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
292 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
293
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
294 octave_value
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
295 octave_base_value::undef_subsasgn (const std::string& type,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
296 const std::list<octave_value_list>& idx,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
297 const octave_value& rhs)
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
298 {
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
299 // In most cases, undef_subsasgn is handled the sams as subsasgn. One
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
300 // exception is octave_class objects.
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
301
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
302 return subsasgn (type, idx, rhs);
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
303 }
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
304
5602
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
305 octave_idx_type
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
306 octave_base_value::nnz (void) const
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
307 {
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
308 gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
309 return -1;
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
310 }
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
311
5604
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
312 octave_idx_type
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
313 octave_base_value::nzmax (void) const
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
314 {
10513
c5005bc2b7a9 implement working spalloc
Jaroslav Hajek <highegg@gmail.com>
parents: 10414
diff changeset
315 return numel ();
5604
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
316 }
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
317
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
318 octave_idx_type
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
319 octave_base_value::nfields (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
320 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
321 gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
322 return -1;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
323 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
324
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
325 octave_value
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
326 octave_base_value::reshape (const dim_vector&) const
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
327 {
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
328 gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
329 return octave_value ();
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
330 }
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
331
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
332 octave_value
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
333 octave_base_value::permute (const Array<int>&, bool) const
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
334 {
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
335 gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ());
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
336 return octave_value ();
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
337 }
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
338
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
339 octave_value
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5715
diff changeset
340 octave_base_value::resize (const dim_vector&, bool) const
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
341 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
342 gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ());
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
343 return octave_value ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
344 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
345
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
346 MatrixType
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
347 octave_base_value::matrix_type (void) const
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
348 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
349 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
350 return MatrixType ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
351 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
352
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
353 MatrixType
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
354 octave_base_value::matrix_type (const MatrixType&) const
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
355 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
356 gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
357 return MatrixType ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
358 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
359
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
360 octave_value
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
361 octave_base_value::all (int) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
362 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
363 return 0.0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
364 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
365
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
366 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
367 octave_base_value::any (int) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
368 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
369 return 0.0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
370 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
371
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
372 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
373 octave_base_value::convert_to_str (bool pad, bool force, char type) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
374 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
375 octave_value retval = convert_to_str_internal (pad, force, type);
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
376
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
377 if (! force && is_numeric_type ())
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
378 gripe_implicit_conversion ("Octave:num-to-str",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
379 type_name (), retval.type_name ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
380
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
381 return retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
382 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
383
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
384 octave_value
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5164
diff changeset
385 octave_base_value::convert_to_str_internal (bool, bool, char) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
386 {
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
387 gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
388 type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
389 return octave_value ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
390 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
391
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
392 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
393 octave_base_value::convert_to_row_or_column_vector (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
394 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
395 gripe_wrong_type_arg
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
396 ("octave_base_value::convert_to_row_or_column_vector ()",
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
397 type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
398 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
399
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
400 void
18416
bcd71a2531d3 Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18316
diff changeset
401 octave_base_value::print (std::ostream&, bool)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
402 {
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 2979
diff changeset
403 gripe_wrong_type_arg ("octave_base_value::print ()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
404 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
405
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
406 void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
407 octave_base_value::print_raw (std::ostream&, bool) const
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
408 {
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 2979
diff changeset
409 gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
410 }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
411
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
412 bool
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
413 octave_base_value::print_name_tag (std::ostream& os,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
414 const std::string& name) const
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
415 {
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
416 bool retval = false;
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
417
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
418 indent (os);
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
419
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
420 if (print_as_scalar ())
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
421 os << name << " = ";
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
422 else
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
423 {
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
424 os << name << " =";
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
425 newline (os);
13112
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
426 if (! Vcompact_format)
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
427 newline (os);
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
428
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
429 retval = true;
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
430 }
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
431
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
432 return retval;
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
433 }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
434
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
435 void
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
436 octave_base_value::print_with_name (std::ostream& output_buf,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
437 const std::string& name,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
438 bool print_padding)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
439 {
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
440 bool pad_after = print_name_tag (output_buf, name);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
441
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
442 print (output_buf);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
443
13112
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
444 if (print_padding && pad_after && ! Vcompact_format)
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
445 newline (output_buf);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
446 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
447
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
448 void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
449 octave_base_value::print_info (std::ostream& os,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
450 const std::string& /* prefix */) const
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
451 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
452 os << "no info for type: " << type_name () << "\n";
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
453 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
454
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
455 #define INT_CONV_METHOD(T, F) \
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
456 T \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
457 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
458 { \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
459 T retval = 0; \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
460 \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
461 double d = double_value (frc_str_conv); \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
462 \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
463 if (! error_state) \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
464 { \
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
465 if (require_int && D_NINT (d) != d) \
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
466 error_with_cfn ("conversion of %g to " #T " value failed", d); \
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
467 else if (d < std::numeric_limits<T>::min ()) \
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
468 retval = std::numeric_limits<T>::min (); \
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
469 else if (d > std::numeric_limits<T>::max ()) \
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
470 retval = std::numeric_limits<T>::max (); \
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
471 else \
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
472 retval = static_cast<T> (::fix (d)); \
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
473 } \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
474 else \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
475 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
476 type_name ()); \
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
477 \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
478 return retval; \
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
479 }
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
480
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
481 INT_CONV_METHOD (short int, short)
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
482 INT_CONV_METHOD (unsigned short int, ushort)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
483
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
484 INT_CONV_METHOD (int, int)
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
485 INT_CONV_METHOD (unsigned int, uint)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
486
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
487 INT_CONV_METHOD (long int, long)
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
488 INT_CONV_METHOD (unsigned long int, ulong)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
489
16323
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
490 INT_CONV_METHOD (int64_t, int64)
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
491 INT_CONV_METHOD (uint64_t, uint64)
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
492
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
493 int
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
494 octave_base_value::nint_value (bool frc_str_conv) const
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
495 {
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
496 int retval = 0;
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
497
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
498 double d = double_value (frc_str_conv);
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
499
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
500 if (! error_state)
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
501 {
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
502 if (xisnan (d))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
503 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
504 error ("conversion of NaN to integer value failed");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
505 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
506 }
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
507
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
508 retval = static_cast<int> (::fix (d));
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
509 }
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
510 else
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
511 gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ());
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
512
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
513 return retval;
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
514 }
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
515
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
516 double
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
517 octave_base_value::double_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
518 {
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4066
diff changeset
519 double retval = lo_ieee_nan_value ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
520 gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
521 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
522 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
523
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
524 float
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
525 octave_base_value::float_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
526 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
527 float retval = lo_ieee_float_nan_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
528 gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
529 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
530 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
531
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
532 Cell
3539
ea583bc68959 [project @ 2000-02-02 12:48:09 by jwe]
jwe
parents: 3536
diff changeset
533 octave_base_value::cell_value () const
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
534 {
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
535 Cell retval;
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
536 gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
537 return retval;
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
538 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
539
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
540 Matrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
541 octave_base_value::matrix_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
542 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
543 Matrix retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
544 gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
545 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
546 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
547
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
548 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
549 octave_base_value::float_matrix_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
550 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
551 FloatMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
552 gripe_wrong_type_arg ("octave_base_value::float_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
553 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
554 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
555 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
556
4507
65f47f8a92a2 [project @ 2003-09-10 15:48:02 by jwe]
jwe
parents: 4505
diff changeset
557 NDArray
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
558 octave_base_value::array_value (bool) const
4505
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
559 {
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
560 FloatNDArray retval;
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
561 gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ());
4505
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
562 return retval;
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
563 }
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
564
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
565 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
566 octave_base_value::float_array_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
567 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
568 FloatNDArray retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
569 gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
570 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
571 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
572
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
573 Complex
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
574 octave_base_value::complex_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
575 {
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4066
diff changeset
576 double tmp = lo_ieee_nan_value ();
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4066
diff changeset
577 Complex retval (tmp, tmp);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
578 gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
579 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
580 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
581
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
582 FloatComplex
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
583 octave_base_value::float_complex_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
584 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
585 float tmp = lo_ieee_float_nan_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
586 FloatComplex retval (tmp, tmp);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
587 gripe_wrong_type_arg ("octave_base_value::float_complex_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
588 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
589 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
590 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
591
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
592 ComplexMatrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
593 octave_base_value::complex_matrix_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
594 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
595 ComplexMatrix retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
596 gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
597 type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
598 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
599 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
600
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
601 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
602 octave_base_value::float_complex_matrix_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
603 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
604 FloatComplexMatrix retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
605 gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
606 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
607 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
608 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
609
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
610 ComplexNDArray
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
611 octave_base_value::complex_array_value (bool) const
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
612 {
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
613 ComplexNDArray retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
614 gripe_wrong_type_arg ("octave_base_value::complex_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
615 type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
616 return retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
617 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
618
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
619 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
620 octave_base_value::float_complex_array_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
621 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
622 FloatComplexNDArray retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
623 gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
624 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
625 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
626 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
627
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
628 bool
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
629 octave_base_value::bool_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
630 {
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
631 bool retval = false;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
632 gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
633 return retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
634 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
635
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
636 boolMatrix
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
637 octave_base_value::bool_matrix_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
638 {
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
639 boolMatrix retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
640 gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
641 type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
642 return retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
643 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
644
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
645 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
646 octave_base_value::bool_array_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
647 {
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
648 boolNDArray retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
649 gripe_wrong_type_arg ("octave_base_value::bool_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
650 type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
651 return retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
652 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
653
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
654 charMatrix
4741
e44d0ac643a5 [project @ 2004-02-05 21:57:50 by jwe]
jwe
parents: 4732
diff changeset
655 octave_base_value::char_matrix_value (bool force) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
656 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
657 charMatrix retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
658
4741
e44d0ac643a5 [project @ 2004-02-05 21:57:50 by jwe]
jwe
parents: 4732
diff changeset
659 octave_value tmp = convert_to_str (false, force);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
660
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
661 if (! error_state)
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
662 retval = tmp.char_matrix_value ();
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
663
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
664 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
665 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
666
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
667 charNDArray
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
668 octave_base_value::char_array_value (bool) const
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
669 {
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
670 charNDArray retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
671 gripe_wrong_type_arg ("octave_base_value::char_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
672 type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
673 return retval;
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
674 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
675
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
676 SparseMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
677 octave_base_value::sparse_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
678 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
679 SparseMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
680 gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
681 type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
682 return retval;
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
683 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
684
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
685 SparseComplexMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
686 octave_base_value::sparse_complex_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
687 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
688 SparseComplexMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
689 gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
690 type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
691 return retval;
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
692 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
693
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
694 SparseBoolMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
695 octave_base_value::sparse_bool_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
696 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
697 SparseBoolMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
698 gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
699 type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
700 return retval;
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
701 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
702
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
703 DiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
704 octave_base_value::diag_matrix_value (bool) const
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
705 {
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
706 DiagMatrix retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
707 gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
708 return retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
709 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
710
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
711 FloatDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
712 octave_base_value::float_diag_matrix_value (bool) const
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
713 {
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
714 FloatDiagMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
715 gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
716 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
717 return retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
718 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
719
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
720 ComplexDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
721 octave_base_value::complex_diag_matrix_value (bool) const
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
722 {
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
723 ComplexDiagMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
724 gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
725 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
726 return retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
727 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
728
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
729 FloatComplexDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
730 octave_base_value::float_complex_diag_matrix_value (bool) const
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
731 {
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
732 FloatComplexDiagMatrix retval;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
733 gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
734 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
735 return retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
736 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
737
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
738 PermMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
739 octave_base_value::perm_matrix_value (void) const
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
740 {
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
741 PermMatrix retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
742 gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
743 return retval;
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
744 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
745
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
746 octave_int8
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
747 octave_base_value::int8_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
748 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
749 octave_int8 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
750 gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
751 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
752 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
753 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
754
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
755 octave_int16
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
756 octave_base_value::int16_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
757 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
758 octave_int16 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
759 gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
760 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
761 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
762 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
763
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
764 octave_int32
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
765 octave_base_value::int32_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
766 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
767 octave_int32 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
768 gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
769 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
770 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
771 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
772
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
773 octave_int64
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
774 octave_base_value::int64_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
775 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
776 octave_int64 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
777 gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
778 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
779 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
780 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
781
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
782 octave_uint8
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
783 octave_base_value::uint8_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
784 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
785 octave_uint8 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
786 gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
787 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
788 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
789 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
790
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
791 octave_uint16
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
792 octave_base_value::uint16_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
793 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
794 octave_uint16 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
795 gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
796 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
797 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
798 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
799
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
800 octave_uint32
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
801 octave_base_value::uint32_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
802 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
803 octave_uint32 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
804 gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
805 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
806 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
807 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
808
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
809 octave_uint64
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
810 octave_base_value::uint64_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
811 {
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
812 octave_uint64 retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
813 gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
814 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
815 return retval;
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
816 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
817
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
818 int8NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
819 octave_base_value::int8_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
820 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
821 int8NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
822 gripe_wrong_type_arg ("octave_base_value::int8_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
823 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
824 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
825 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
826
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
827 int16NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
828 octave_base_value::int16_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
829 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
830 int16NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
831 gripe_wrong_type_arg ("octave_base_value::int16_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
832 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
833 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
834 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
835
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
836 int32NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
837 octave_base_value::int32_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
838 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
839 int32NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
840 gripe_wrong_type_arg ("octave_base_value::int32_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
841 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
842 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
843 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
844
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
845 int64NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
846 octave_base_value::int64_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
847 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
848 int64NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
849 gripe_wrong_type_arg ("octave_base_value::int64_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
850 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
851 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
852 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
853
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
854 uint8NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
855 octave_base_value::uint8_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
856 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
857 uint8NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
858 gripe_wrong_type_arg ("octave_base_value::uint8_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
859 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
860 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
861 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
862
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
863 uint16NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
864 octave_base_value::uint16_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
865 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
866 uint16NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
867 gripe_wrong_type_arg ("octave_base_value::uint16_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
868 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
869 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
870 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
871
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
872 uint32NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
873 octave_base_value::uint32_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
874 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
875 uint32NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
876 gripe_wrong_type_arg ("octave_base_value::uint32_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
877 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
878 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
879 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
880
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
881 uint64NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
882 octave_base_value::uint64_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
883 {
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
884 uint64NDArray retval;
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
885 gripe_wrong_type_arg ("octave_base_value::uint64_array_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
886 type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
887 return retval;
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
888 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
889
2493
8ed4362aa0d6 [project @ 1996-11-11 02:35:04 by jwe]
jwe
parents: 2466
diff changeset
890 string_vector
5715
edf82d02be75 [project @ 2006-03-24 16:42:43 by jwe]
jwe
parents: 5707
diff changeset
891 octave_base_value::all_strings (bool pad) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
892 {
2493
8ed4362aa0d6 [project @ 1996-11-11 02:35:04 by jwe]
jwe
parents: 2466
diff changeset
893 string_vector retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
894
5715
edf82d02be75 [project @ 2006-03-24 16:42:43 by jwe]
jwe
parents: 5707
diff changeset
895 octave_value tmp = convert_to_str (pad, true);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
896
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
897 if (! error_state)
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
898 retval = tmp.all_strings ();
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
899
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
900 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
901 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
902
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
903 std::string
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4452
diff changeset
904 octave_base_value::string_value (bool force) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
905 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
906 std::string retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
907
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4452
diff changeset
908 octave_value tmp = convert_to_str (force);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
909
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
910 if (! error_state)
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
911 retval = tmp.string_value ();
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
912
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
913 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
914 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
915
8732
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
916 Array<std::string>
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
917 octave_base_value::cellstr_value (void) const
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
918 {
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
919 Array<std::string> retval;
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
920 gripe_wrong_type_arg ("octave_base_value::cellstry_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
921 type_name ());
8732
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
922 return retval;
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
923 }
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
924
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
925 Range
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
926 octave_base_value::range_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
927 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
928 Range retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
929 gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
930 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
931 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
932
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
933 octave_map
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
934 octave_base_value::map_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
935 {
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
936 octave_map retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
937 gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
938 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
939 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
940
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
941 octave_scalar_map
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
942 octave_base_value::scalar_map_value (void) const
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
943 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
944 octave_map tmp = map_value ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
945
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
946 if (tmp.numel () == 1)
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
947 return tmp.checkelem (0);
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
948 else
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
949 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
950 if (! error_state)
12483
7a5aacf65f81 Rewrite error strings in src/ to use variables named in documentation.
Rik <octave@nomad.inbox5.com>
parents: 12331
diff changeset
951 error ("invalid conversion of multi-dimensional struct to scalar struct");
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
952
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
953 return octave_scalar_map ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
954 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
955 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
956
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
957 string_vector
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
958 octave_base_value::map_keys (void) const
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
959 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
960 string_vector retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
961 gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
962 return retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
963 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
964
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
965 size_t
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
966 octave_base_value::nparents (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
967 {
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
968 size_t retval = 0;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
969 gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ());
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
970 return retval;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
971 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
972
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
973 std::list<std::string>
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
974 octave_base_value::parent_class_name_list (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
975 {
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
976 std::list<std::string> retval;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
977 gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
978 type_name ());
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
979 return retval;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
980 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
981
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
982 string_vector
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
983 octave_base_value::parent_class_names (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
984 {
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
985 string_vector retval;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
986 gripe_wrong_type_arg ("octave_base_value::parent_class_names()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
987 type_name ());
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
988 return retval;
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
989 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
990
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
991 octave_function *
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
992 octave_base_value::function_value (bool silent)
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
993 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
994 octave_function *retval = 0;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
995
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
996 if (! silent)
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
997 gripe_wrong_type_arg ("octave_base_value::function_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
998 type_name ());
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
999 return retval;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
1000 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
1001
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1002 octave_user_function *
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1003 octave_base_value::user_function_value (bool silent)
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1004 {
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1005 octave_user_function *retval = 0;
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1006
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1007 if (! silent)
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1008 gripe_wrong_type_arg ("octave_base_value::user_function_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1009 type_name ());
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1010 return retval;
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1011 }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
1012
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1013 octave_user_script *
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1014 octave_base_value::user_script_value (bool silent)
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1015 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1016 octave_user_script *retval = 0;
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1017
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1018 if (! silent)
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1019 gripe_wrong_type_arg ("octave_base_value::user_script_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1020 type_name ());
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1021 return retval;
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1022 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1023
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1024 octave_user_code *
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1025 octave_base_value::user_code_value (bool silent)
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1026 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1027 octave_user_code *retval = 0;
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1028
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1029 if (! silent)
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1030 gripe_wrong_type_arg ("octave_base_value::user_code_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1031 type_name ());
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1032 return retval;
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1033 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7638
diff changeset
1034
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
1035 octave_fcn_handle *
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1036 octave_base_value::fcn_handle_value (bool silent)
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1037 {
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
1038 octave_fcn_handle *retval = 0;
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1039
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1040 if (! silent)
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1041 gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1042 type_name ());
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1043 return retval;
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1044 }
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
1045
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1046 octave_fcn_inline *
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1047 octave_base_value::fcn_inline_value (bool silent)
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1048 {
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1049 octave_fcn_inline *retval = 0;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1050
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1051 if (! silent)
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1052 gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1053 type_name ());
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1054 return retval;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1055 }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
1056
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1057 octave_value_list
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1058 octave_base_value::list_value (void) const
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1059 {
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1060 octave_value_list retval;
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1061 gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ());
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1062 return retval;
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1063 }
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
1064
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1065 bool
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 5958
diff changeset
1066 octave_base_value::save_ascii (std::ostream&)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1067 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1068 gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1069 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1070 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1071
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1072 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1073 octave_base_value::load_ascii (std::istream&)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1074 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1075 gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1076 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1077 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1078
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1079 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1080 octave_base_value::save_binary (std::ostream&, bool&)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1081 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1082 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1083 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1084 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1085
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1086 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1087 octave_base_value::load_binary (std::istream&, bool,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1088 oct_mach_info::float_format)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1089 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1090 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1091 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1092 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1093
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1094 bool
19897
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1095 octave_base_value::save_hdf5 (octave_hdf5_id, const char *, bool)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1096 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1097 gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1098
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1099 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1100 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1101
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1102 bool
19897
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1103 octave_base_value::load_hdf5 (octave_hdf5_id, const char *)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1104 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1105 gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1106
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1107 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
1108 }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1109
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1110 int
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1111 octave_base_value::write (octave_stream&, int, oct_data_conv::data_type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1112 int, oct_mach_info::float_format) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1113 {
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1114 gripe_wrong_type_arg ("octave_base_value::write()", type_name ());
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1115
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1116 return false;
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1117 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1118
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1119 mxArray *
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1120 octave_base_value::as_mxArray (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1121 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1122 return 0;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1123 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1124
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1125 octave_value
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1126 octave_base_value::diag (octave_idx_type) const
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1127 {
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1128 gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1129
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14770
diff changeset
1130 return octave_value ();
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1131 }
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1132
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1133 octave_value
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1134 octave_base_value::diag (octave_idx_type, octave_idx_type) const
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1135 {
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1136 gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1137
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14770
diff changeset
1138 return octave_value ();
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1139 }
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1140
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1141 octave_value
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1142 octave_base_value::sort (octave_idx_type, sortmode) const
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1143 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1144 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1145
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14770
diff changeset
1146 return octave_value ();
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1147 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1148
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1149 octave_value
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1150 octave_base_value::sort (Array<octave_idx_type> &,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1151 octave_idx_type, sortmode) const
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1152 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1153 gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1154
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14770
diff changeset
1155 return octave_value ();
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1156 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1157
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1158 sortmode
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
1159 octave_base_value::is_sorted (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1160 {
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
1161 gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ());
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1162
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1163 return UNSORTED;
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1164 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1165
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1166 Array<octave_idx_type>
8733
3ef774603887 rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents: 8732
diff changeset
1167 octave_base_value::sort_rows_idx (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1168 {
8733
3ef774603887 rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents: 8732
diff changeset
1169 gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1170
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1171 return Array<octave_idx_type> ();
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1172 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1173
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1174 sortmode
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
1175 octave_base_value::is_sorted_rows (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1176 {
8734
767ed8cc6634 rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents: 8733
diff changeset
1177 gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1178
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1179 return UNSORTED;
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1180 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1181
9813
8fa32b527d9a improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
1182
8fa32b527d9a improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
1183 const char *
8fa32b527d9a improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
1184 octave_base_value::get_umap_name (unary_mapper_t umap)
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1185 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1186 static const char *names[num_unary_mappers] =
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1187 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1188 "abs",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1189 "acos",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1190 "acosh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1191 "angle",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1192 "arg",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1193 "asin",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1194 "asinh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1195 "atan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1196 "atanh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1197 "cbrt",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1198 "ceil",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1199 "conj",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1200 "cos",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1201 "cosh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1202 "erf",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1203 "erfinv",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1204 "erfcinv",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1205 "erfc",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1206 "erfcx",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1207 "erfi",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1208 "dawson",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1209 "exp",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1210 "expm1",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1211 "finite",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1212 "fix",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1213 "floor",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1214 "gamma",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1215 "imag",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1216 "isinf",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1217 "isna",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1218 "isnan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1219 "lgamma",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1220 "log",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1221 "log2",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1222 "log10",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1223 "log1p",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1224 "real",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1225 "round",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1226 "roundb",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1227 "signum",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1228 "sin",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1229 "sinh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1230 "sqrt",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1231 "tan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1232 "tanh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1233 "isalnum",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1234 "isalpha",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1235 "isascii",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1236 "iscntrl",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1237 "isdigit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1238 "isgraph",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1239 "islower",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1240 "isprint",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1241 "ispunct",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1242 "isspace",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1243 "isupper",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1244 "isxdigit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1245 "signbit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1246 "toascii",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1247 "tolower",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1248 "toupper"
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1249 };
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1250
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1251 if (umap < 0 || umap >= num_unary_mappers)
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1252 return "unknown";
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1253 else
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1254 return names[umap];
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1255 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1256
19897
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1257 void
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1258 octave_base_value::gripe_load (const char *type) const
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1259 {
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1260 warning_with_id
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1261 ("Octave:load-save-unavailable",
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1262 "%s: loading %s files not available in this version of Octave",
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1263 t_name.c_str (), type);
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1264 }
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1265
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1266 void
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1267 octave_base_value::gripe_save (const char *type) const
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1268 {
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1269 warning_with_id
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1270 ("Octave:load-save-unavailable",
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1271 "%s: saving %s files not available in this version of Octave",
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1272 t_name.c_str (), type);
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1273 }
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
1274
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1275 octave_value
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1276 octave_base_value::map (unary_mapper_t umap) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1277 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1278 error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1279 return octave_value ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1280 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1281
7489
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1282 void
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1283 octave_base_value::lock (void)
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1284 {
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1285 gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ());
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1286 }
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1287
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1288 void
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1289 octave_base_value::unlock (void)
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1290 {
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1291 gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1292 }
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1293
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1294 void
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1295 octave_base_value::dump (std::ostream& os) const
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1296 {
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1297 dim_vector dv = this->dims ();
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1298
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1299 os << "class: " << this->class_name ()
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1300 << " type: " << this->type_name ()
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1301 << " dims: " << dv.str ();
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1302 }
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1303
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1304 static void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1305 gripe_indexed_assignment (const std::string& tn1, const std::string& tn2)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1306 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1307 error ("assignment of '%s' to indexed '%s' not implemented",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1308 tn2.c_str (), tn1.c_str ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1309 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1310
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1311 static void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1312 gripe_assign_conversion_failed (const std::string& tn1,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1313 const std::string& tn2)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1314 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1315 error ("type conversion for assignment of '%s' to indexed '%s' failed",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1316 tn2.c_str (), tn1.c_str ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1317 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1318
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1319 static void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1320 gripe_no_conversion (const std::string& on, const std::string& tn1,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1321 const std::string& tn2)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1322 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1323 error ("operator %s: no conversion for assignment of '%s' to indexed '%s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1324 on.c_str (), tn2.c_str (), tn1.c_str ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1325 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1326
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1327 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1328 octave_base_value::numeric_assign (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1329 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1330 const octave_value& rhs)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1331 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1332 octave_value retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1333
9286
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1334 if (idx.front ().empty ())
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1335 {
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1336 error ("missing index in indexed assignment");
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1337 return retval;
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1338 }
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1339
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1340 int t_lhs = type_id ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1341 int t_rhs = rhs.type_id ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1342
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1343 octave_value_typeinfo::assign_op_fcn f
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1344 = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1345 t_lhs, t_rhs);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1346
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1347 bool done = false;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1348
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1349 if (f)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1350 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1351 f (*this, idx.front (), rhs.get_rep ());
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1352
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1353 done = (! error_state);
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1354 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1355
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1356 if (done)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1357 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1358 count++;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1359 retval = octave_value (this);
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1360 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1361 else
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1362 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1363 int t_result
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1364 = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1365
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1366 if (t_result >= 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1367 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1368 octave_base_value::type_conv_fcn cf
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1369 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1370
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1371 if (cf)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1372 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1373 octave_base_value *tmp = cf (*this);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1374
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1375 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1376 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1377 octave_value val (tmp);
5874
210c5c98c403 [project @ 2006-07-01 02:33:45 by jwe]
jwe
parents: 5851
diff changeset
1378
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1379 retval = val.subsasgn (type, idx, rhs);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1380
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1381 done = (! error_state);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1382 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1383 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1384 gripe_assign_conversion_failed (type_name (),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1385 rhs.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1386 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1387 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1388 gripe_indexed_assignment (type_name (), rhs.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1389 }
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1390
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1391 if (! (done || error_state))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1392 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1393 octave_value tmp_rhs;
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1394
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1395 octave_base_value::type_conv_info cf_rhs
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1396 = rhs.numeric_conversion_function ();
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1397
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1398 octave_base_value::type_conv_info cf_this
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1399 = numeric_conversion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1400
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1401 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1402 if (cf_rhs.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1403 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1404 t_lhs,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1405 cf_rhs.type_id ())
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1406 || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs,
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1407 cf_rhs.type_id ()) >= 0))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1408 cf_this = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1409 else if (cf_this.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1410 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1411 cf_this.type_id (), t_rhs)
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1412 || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (),
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1413 t_rhs) >= 0))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1414 cf_rhs = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1415
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1416 if (cf_rhs)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1417 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1418 octave_base_value *tmp = cf_rhs (rhs.get_rep ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1419
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1420 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1421 tmp_rhs = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1422 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1423 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1424 gripe_assign_conversion_failed (type_name (),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1425 rhs.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1426 return octave_value ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1427 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1428 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1429 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1430 tmp_rhs = rhs;
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1431
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1432 count++;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1433 octave_value tmp_lhs = octave_value (this);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1434
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1435 if (cf_this)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1436 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1437 octave_base_value *tmp = cf_this (*this);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1438
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1439 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1440 tmp_lhs = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1441 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1442 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1443 gripe_assign_conversion_failed (type_name (),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1444 rhs.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1445 return octave_value ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1446 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1447 }
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1448
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1449 if (cf_this || cf_rhs)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1450 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1451 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1452
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1453 done = (! error_state);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1454 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1455 else
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1456 gripe_no_conversion (octave_value::assign_op_as_string
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1457 (octave_value::op_asn_eq),
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1458 type_name (), rhs.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1459 }
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1460 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1461
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1462 // The assignment may have converted to a type that is wider than
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1463 // necessary.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1464
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1465 retval.maybe_mutate ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1466
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1467 return retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1468 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1469
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1470 // Current indentation.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1471 int octave_base_value::curr_print_indent_level = 0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1472
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1473 // TRUE means we are at the beginning of a line.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1474 bool octave_base_value::beginning_of_line = true;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1475
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1476 // Each print() function should call this before printing anything.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1477 //
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1478 // This doesn't need to be fast, but isn't there a better way?
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1479
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1480 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1481 octave_base_value::indent (std::ostream& os) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1482 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1483 assert (curr_print_indent_level >= 0);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1484
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1485 if (beginning_of_line)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1486 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1487 // FIXME: do we need this?
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1488 // os << prefix;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1489
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1490 for (int i = 0; i < curr_print_indent_level; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1491 os << " ";
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1492
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1493 beginning_of_line = false;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1494 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1495 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1496
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1497 // All print() functions should use this to print new lines.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1498
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1499 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1500 octave_base_value::newline (std::ostream& os) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1501 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1502 os << "\n";
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1503
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1504 beginning_of_line = true;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1505 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1506
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1507 // For ressetting print state.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1508
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1509 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1510 octave_base_value::reset (void) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1511 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1512 beginning_of_line = true;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1513 curr_print_indent_level = 0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1514 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1515
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1516
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1517 octave_value
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1518 octave_base_value::fast_elem_extract (octave_idx_type) const
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1519 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1520 return octave_value ();
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1521 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1522
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1523 bool
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1524 octave_base_value::fast_elem_insert (octave_idx_type, const octave_value&)
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1525 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1526 return false;
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1527 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1528
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1529 bool
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1530 octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1531 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1532 return false;
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1533 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1534
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3202
diff changeset
1535 CONVDECLX (matrix_conv)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1536 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1537 return new octave_matrix ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1538 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1539
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3202
diff changeset
1540 CONVDECLX (complex_matrix_conv)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1541 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1542 return new octave_complex_matrix ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1543 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1544
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3202
diff changeset
1545 CONVDECLX (string_conv)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1546 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1547 return new octave_char_matrix_str ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1548 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1549
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1550 CONVDECLX (cell_conv)
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1551 {
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1552 return new octave_cell ();
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1553 }
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1554
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1555 static inline octave_value_list
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1556 sanitize (const octave_value_list& ovl)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1557 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1558 octave_value_list retval = ovl;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1559
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1560 for (octave_idx_type i = 0; i < ovl.length (); i++)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1561 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1562 if (retval(i).is_magic_colon ())
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1563 retval(i) = ":";
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1564 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1565
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1566 return retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1567 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1568
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1569 octave_value
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1570 make_idx_args (const std::string& type,
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1571 const std::list<octave_value_list>& idx,
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1572 const std::string& who)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1573 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1574 octave_value retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1575
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1576 size_t len = type.length ();
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1577
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1578 if (len == idx.size ())
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1579 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1580 Cell type_field (1, len);
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1581 Cell subs_field (1, len);
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1582
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1583 std::list<octave_value_list>::const_iterator p = idx.begin ();
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1584
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1585 for (size_t i = 0; i < len; i++)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1586 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1587 char t = type[i];
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1588
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1589 switch (t)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1590 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1591 case '(':
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1592 type_field(i) = "()";
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1593 subs_field(i) = Cell (sanitize (*p++));
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1594 break;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1595
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1596 case '{':
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1597 type_field(i) = "{}";
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1598 subs_field(i) = Cell (sanitize (*p++));
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1599 break;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1600
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1601 case '.':
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1602 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1603 type_field(i) = ".";
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1604
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1605 octave_value_list vlist = *p++;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1606
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1607 if (vlist.length () == 1)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1608 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1609 octave_value val = vlist(0);
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1610
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1611 if (val.is_string ())
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1612 subs_field(i) = val;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1613 else
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1614 {
19437
03067dab10ca Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents: 18416
diff changeset
1615 error ("string argument required for '.' index");
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1616 return retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1617 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1618 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1619 else
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1620 {
19437
03067dab10ca Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents: 18416
diff changeset
1621 error ("only single argument permitted for '.' index");
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1622 return retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1623 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1624 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1625 break;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1626
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1627 default:
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1628 panic_impossible ();
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1629 break;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1630 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1631 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1632
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1633 octave_map m;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1634
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1635 m.assign ("type", type_field);
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1636 m.assign ("subs", subs_field);
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1637
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1638 retval = m;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1639 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1640 else
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1641 error ("invalid index for %s", who.c_str ());
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1642
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1643 return retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1644 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18129
diff changeset
1645
18316
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1646 bool
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1647 called_from_builtin (void)
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1648 {
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1649 octave_function *fcn = octave_call_stack::caller ();
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1650
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1651 // FIXME: we probably need a better check here, or some other
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1652 // mechanism to avoid overloaded functions when builtin is used.
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1653 // For example, what if someone overloads the builtin function?
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1654 // Also, are there other places where using builtin is not properly
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1655 // avoiding dispatch?
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1656
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1657 return (fcn && fcn->name () == "builtin");
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1658 }
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1659
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1660 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1661 install_base_type_conversions (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1662 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1663 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1664 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1665 INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1666 INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1667 octave_complex_matrix);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1668 INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1669 INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1670 octave_char_matrix_str);
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1671 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1672
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1673 INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1674 INSTALL_WIDENOP (octave_base_value, octave_complex_matrix,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1675 complex_matrix_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1676 INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv);
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1677 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1678 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1679
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1680 DEFUN (sparse_auto_mutate, args, nargout,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1681 "-*- texinfo -*-\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10832
diff changeset
1682 @deftypefn {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1683 @deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\
13951
79aa00a94e9e doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents: 13112
diff changeset
1684 @deftypefnx {Built-in Function} {} sparse_auto_mutate (@var{new_val}, \"local\")\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1685 Query or set the internal variable that controls whether Octave will\n\
14099
691649fbcde4 Improve docstring for sparse_auto_mutate.
Rik <octave@nomad.inbox5.com>
parents: 13951
diff changeset
1686 automatically mutate sparse matrices to full matrices to save memory.\n\
20198
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19897
diff changeset
1687 \n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10832
diff changeset
1688 For example:\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1689 \n\
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1690 @example\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
1691 @group\n\
14099
691649fbcde4 Improve docstring for sparse_auto_mutate.
Rik <octave@nomad.inbox5.com>
parents: 13951
diff changeset
1692 s = speye (3);\n\
14360
97883071e8e4 doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
1693 sparse_auto_mutate (false);\n\
14099
691649fbcde4 Improve docstring for sparse_auto_mutate.
Rik <octave@nomad.inbox5.com>
parents: 13951
diff changeset
1694 s(:, 1) = 1;\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1695 typeinfo (s)\n\
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1696 @result{} sparse matrix\n\
14360
97883071e8e4 doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
1697 sparse_auto_mutate (true);\n\
14099
691649fbcde4 Improve docstring for sparse_auto_mutate.
Rik <octave@nomad.inbox5.com>
parents: 13951
diff changeset
1698 s(1, :) = 1;\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1699 typeinfo (s)\n\
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1700 @result{} matrix\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
1701 @end group\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1702 @end example\n\
13951
79aa00a94e9e doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents: 13112
diff changeset
1703 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 16323
diff changeset
1704 When called from inside a function with the @qcode{\"local\"} option, the\n\
20198
075a5e2e1ba5 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19897
diff changeset
1705 variable is changed locally for the function and any subroutines it calls.\n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 16323
diff changeset
1706 The original variable value is restored when exiting the function.\n\
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1707 @end deftypefn")
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1708 {
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1709 return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1710 }
12820
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1711
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1712 /*
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1713 %!test
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1714 %! s = speye (3);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1715 %! sparse_auto_mutate (false);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1716 %! s(:, 1) = 1;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1717 %! assert (typeinfo (s), "sparse matrix");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1718 %! sparse_auto_mutate (true);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1719 %! s(1, :) = 1;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1720 %! assert (typeinfo (s), "matrix");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1721 %! sparse_auto_mutate (false);
12820
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1722 */