annotate libinterp/octave-value/ov-base.cc @ 23502:c6714ae1c06c

eliminate remaining do_multi_index_op methods For function (and function-like) objects, define a call meethod instead of do_multi_index_op. For data value objects, remove do_multi_index_op as it is no longer used for indexing operations. * ov-fcn.h (octave_function::call): New pure virtual function. * ov-builtin.cc, ov-builtin.h (octave_builtin::call): Rename from do_multi_index_op. Change all uses. * ov-mex-fcn.cc, ov-mex-fcn.h (octave_mex_function::call): Rename from do_multi_index_op. Change all uses. * ov-usr-fcn.cc, ov-usr-fcn.h (octave_user_script::call): Rename from do_multi_index_op. Change all uses. (octave_user_fcn::call): Likewise. * ov-classdef.cc (octave_classdef_meta::call): Rename from do_multi_index_op. Change all uses. (octave_classdef_superclass_ref::call): Likewise. * ov-fcn-handle.cc, ov-fcn-handle.h (octave_fcn_handle::call): Rename from do_multi_index_op. Now a protected virtual function. (octave_fcn_binder::call): Rename from do_multi_index_op. Now a protected function. * ov-class.h (octave_class::do_multi_index_op): Delete. * ov-base-mat.h (octave_base_matrix::do_multi_index_op): Delete. * ov-base-scalar.h (octave_base_scalar::do_multi_index_op): Delete. * ov-base.cc, ov-base.h (octave_base_value::do_multi_index_op): Delete. * ov.cc, ov.h (octave_value::do_multi_index_op): Delete. * oct-parse.in.yy (source_file): Use call instead of do_multi_index_op. (feval (const std::string&, const octave_value_list&, int)): Likewise. (feval (octave_function *, const octave_value_list&, int)): Likewise. (feval (octave_value&, const octave_value_list&, int)): Instead of do_multi_index_op, use call for function objects and subsref for function_handle objects. Also handle named functions. (feval (const octave_value_list&, int)): Simply extract first argument and forward to feval (octave_value&, const octave_value_list&, int). * pt-eval.cc (tree_evaluator::visit_identifier, tree_evaluator::visit_index_expression, tree_evaluator::visit_funcall): Use call instead of do_multi_index_op.
author John W. Eaton <jwe@octave.org>
date Wed, 17 May 2017 14:34:05 -0400
parents 73558a835b64
children 14723784b9f2
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
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1996-2017 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
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
11 (at your option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
16 GNU General Public License for more details.
2376
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
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
24 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
25 # include "config.h"
2376
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
22091
0f6fc2ec3b1a move call_stack class to a separate file
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
34 #include "call-stack.h"
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
35 #include "defun.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
36 #include "errwarn.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
37 #include "mxarray.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
38 #include "oct-map.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20879
diff changeset
39 #include "ovl.h"
19863
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: 19697
diff changeset
40 #include "oct-hdf5.h"
2979
a3556d2adec9 [project @ 1997-05-15 22:35:37 by jwe]
jwe
parents: 2974
diff changeset
41 #include "oct-lvalue.h"
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 3219
diff changeset
42 #include "oct-stream.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
43 #include "ops.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
44 #include "ov-base.h"
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
45 #include "ov-cell.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
46 #include "ov-ch-mat.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
47 #include "ov-complex.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
48 #include "ov-cx-mat.h"
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
49 #include "ov-range.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
50 #include "ov-re-mat.h"
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
51 #include "ov-scalar.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
52 #include "ov-str-mat.h"
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
53 #include "ov-fcn-handle.h"
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
54 #include "parse.h"
13112
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
55 #include "pr-output.h"
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
56 #include "utils.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents: 22091
diff changeset
57 #include "interpreter.h"
2948
56be458e237f [project @ 1997-05-09 13:37:35 by jwe]
jwe
parents: 2901
diff changeset
58 #include "variables.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
59
9790
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
60 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
61 {
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
62 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
63
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
64 if (x == btyp_bool)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
65 x = btyp_double;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
66 if (y == btyp_bool)
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
67 y = btyp_double;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
68
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
69 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
70 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
71 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
72 retval = x;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
73 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
74 retval = y;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
75 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
76 && 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
77 || (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
78 && 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
79 retval = (x > y) ? x : y;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
80
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
81 return retval;
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
82 }
a5035bc7fbfb rewrite dispatch part & slightly improve min,max,cummin,cummax
Jaroslav Hajek <highegg@gmail.com>
parents: 9753
diff changeset
83
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
84 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
85 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
86 "double", "single", "double", "single",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
87 "int8", "int16", "int32", "int64",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
88 "uint8", "uint16", "uint32", "uint64",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
89 "logical", "char",
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
90 "struct", "cell", "function_handle"
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
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
93 string_vector
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
94 get_builtin_classes (void)
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
95 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
96 static string_vector retval;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
97
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
98 if (retval.is_empty ())
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
99 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
100 int n = btyp_num_types - 2;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
101 retval = string_vector (n);
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
102 int j = 0;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
103 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
104 {
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
105 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
106 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
107 retval(j++) = btyp_class_name[i];
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
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
111 return retval;
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
112 }
090173f2db40 improve overload dispatching of built-in classes
Jaroslav Hajek <highegg@gmail.com>
parents: 10075
diff changeset
113
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4604
diff changeset
114 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
115 "<unknown type>", "unknown");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
116
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
117 // 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
118 // is memory to be saved
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
119 bool Vsparse_auto_mutate = false;
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
120
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
121 octave_base_value *
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
122 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
123 {
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
124 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
125 }
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
126
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
127 octave_value
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
128 octave_base_value::squeeze (void) const
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
129 {
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
130 std::string nm = type_name ();
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4507
diff changeset
131 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
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 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
137 err_wrong_type_arg ("full: invalid operation for %s type", type_name ());
8458
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
138 }
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
139
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
140 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
141 octave_base_value::as_double (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
142 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
143 err_invalid_conversion (type_name (), "double");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
144 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
145
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
146 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
147 octave_base_value::as_single (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
148 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
149 err_invalid_conversion (type_name (), "single");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
150 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
151
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
152 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
153 octave_base_value::as_int8 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
154 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
155 err_invalid_conversion (type_name (), "int8");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
156 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
157
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
158 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
159 octave_base_value::as_int16 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
160 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
161 err_invalid_conversion (type_name (), "int16");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
162 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
163
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
164 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
165 octave_base_value::as_int32 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
166 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
167 err_invalid_conversion (type_name (), "int32");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
168 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
169
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
170 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
171 octave_base_value::as_int64 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
172 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
173 err_invalid_conversion (type_name (), "int64");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
174 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
175
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
176 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
177 octave_base_value::as_uint8 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
178 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
179 err_invalid_conversion (type_name (), "uint8");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
180 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
181
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
182 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
183 octave_base_value::as_uint16 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
184 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
185 err_invalid_conversion (type_name (), "uint16");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
186 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
187
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
188 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
189 octave_base_value::as_uint32 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
190 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
191 err_invalid_conversion (type_name (), "uint32");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
192 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
193
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
194 octave_value
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
195 octave_base_value::as_uint64 (void) const
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
196 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
197 err_invalid_conversion (type_name (), "uint64");
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
198 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
199
9329
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
200 Matrix
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
201 octave_base_value::size (void)
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
202 {
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
203 const dim_vector dv = dims ();
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21301
diff changeset
204 Matrix mdv (1, dv.ndims ());
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21301
diff changeset
205 for (octave_idx_type i = 0; i < dv.ndims (); i++)
9329
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
206 mdv(i) = dv(i);
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
207 return mdv;
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
208 }
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
209
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
210 octave_idx_type
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
211 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
212 {
9705
5acd99c3e794 avoid recursive overloaded calls in builtin numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9689
diff changeset
213 return dims_to_numel (dims (), idx);
9329
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
214 }
67fc970dad7d improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents: 9286
diff changeset
215
8458
d254a21e0120 reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
216 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
217 octave_base_value::subsref (const std::string&,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
218 const std::list<octave_value_list>&)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
219 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
220 std::string nm = type_name ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
221 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
222 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
223
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
224 octave_value_list
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
225 octave_base_value::subsref (const std::string&,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
226 const std::list<octave_value_list>&, int)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
227 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
228 std::string nm = type_name ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
229 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
230 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
231
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
232 octave_value
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
233 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
234 const std::list<octave_value_list>& idx,
8677
095ae5e0a831 eliminte some compiler warnings
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
235 bool /* auto_add */)
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
236 {
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
237 // 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
238 return subsref (type, idx);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
239 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
240
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8458
diff changeset
241 octave_value
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5874
diff changeset
242 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
243 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
244 std::string nm = type_name ();
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
245 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
246 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
247
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
248 idx_vector
18130
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
249 octave_base_value::index_vector (bool /* require_integers */) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
250 {
20542
dd6345fd8a97 use exceptions for better invalid index error reporting (bug #45957)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 20163
diff changeset
251 std::string nm = "<" + type_name () + ">";
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
252 octave::err_invalid_index (nm.c_str ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
253 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
254
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
255 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4219
diff changeset
256 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
257 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
258 const octave_value& rhs)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
259 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
260 octave_value retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
261
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
262 if (is_defined ())
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
263 {
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
264 if (! is_numeric_type ())
10315
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 ("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
268 }
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
269
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
270 switch (type[0])
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
271 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
272 case '(':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
273 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
274 if (type.length () == 1)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
275 retval = numeric_assign (type, idx, rhs);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
276 else if (is_empty ())
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
277 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
278 // Allow conversion of empty matrix to some other
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
279 // type in cases like
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
280 //
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
281 // x = []; x(i).f = rhs
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
282
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
283 octave_value tmp = octave_value::empty_conv (type, rhs);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
284
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
285 retval = tmp.subsasgn (type, idx, rhs);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
286 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
287 else
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
288 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
289 std::string nm = type_name ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
290 error ("in indexed assignment of %s, last rhs index must be ()",
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
291 nm.c_str ());
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
292 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
293 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
294 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
295
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
296 case '{':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
297 case '.':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
298 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
299 std::string nm = type_name ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
300 error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
301 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
302 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
303
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
304 default:
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
305 panic_impossible ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
306 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
307 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
308 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
309 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
310 // 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
311 // 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
312
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
313 octave_value tmp = octave_value::empty_conv (type, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
314
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
315 retval = tmp.undef_subsasgn (type, idx, rhs);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
316 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
317
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
318 return retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
319 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
320
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
321 octave_value
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
322 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
323 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
324 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
325 {
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
326 // 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
327 // 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
328
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
329 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
330 }
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
331
5602
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
332 octave_idx_type
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
333 octave_base_value::nnz (void) const
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
334 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
335 err_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
5602
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
336 }
dfa2da0563e5 [project @ 2006-01-31 03:43:40 by jwe]
jwe
parents: 5353
diff changeset
337
5604
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
338 octave_idx_type
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
339 octave_base_value::nzmax (void) const
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
340 {
10513
c5005bc2b7a9 implement working spalloc
Jaroslav Hajek <highegg@gmail.com>
parents: 10414
diff changeset
341 return numel ();
5604
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
342 }
2857357f9d3c [project @ 2006-01-31 18:22:59 by jwe]
jwe
parents: 5602
diff changeset
343
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
344 octave_idx_type
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
345 octave_base_value::nfields (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
346 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
347 err_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
348 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
349
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
350 octave_value
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
351 octave_base_value::reshape (const dim_vector&) const
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
352 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
353 err_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
354 }
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
355
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4550
diff changeset
356 octave_value
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
357 octave_base_value::permute (const Array<int>&, bool) const
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
358 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
359 err_wrong_type_arg ("octave_base_value::permute ()", type_name ());
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
360 }
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
361
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4580
diff changeset
362 octave_value
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5715
diff changeset
363 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
364 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
365 err_wrong_type_arg ("octave_base_value::resize ()", type_name ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
366 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
367
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
368 MatrixType
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
369 octave_base_value::matrix_type (void) const
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
370 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
371 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
372 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
373
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
374 MatrixType
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
375 octave_base_value::matrix_type (const MatrixType&) const
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
376 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
377 err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
378 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
379
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
380 octave_value
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
381 octave_base_value::all (int) const
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 return 0.0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
384 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
385
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
386 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
387 octave_base_value::any (int) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
388 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
389 return 0.0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
390 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
391
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
392 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
393 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
394 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
395 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
396
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
397 if (! force && is_numeric_type ())
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
398 warn_implicit_conversion ("Octave:num-to-str",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
399 type_name (), retval.type_name ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
400
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
401 return retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
402 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
403
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
404 octave_value
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5164
diff changeset
405 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
406 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
407 err_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
408 type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
409 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
410
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
411 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
412 octave_base_value::convert_to_row_or_column_vector (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
413 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
414 err_wrong_type_arg
21024
6176560b03d9 maint: Remove return stmts after gripe function calls.
Rik <rik@octave.org>
parents: 21013
diff changeset
415 ("octave_base_value::convert_to_row_or_column_vector ()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
416 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
417
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
418 void
18416
bcd71a2531d3 Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18316
diff changeset
419 octave_base_value::print (std::ostream&, bool)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
420 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
421 err_wrong_type_arg ("octave_base_value::print ()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
422 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
423
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
424 void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
425 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
426 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
427 err_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
428 }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
429
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
430 bool
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
431 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
432 const std::string& name) const
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
433 {
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
434 bool retval = false;
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
435
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
436 indent (os);
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
437
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
438 if (print_as_scalar ())
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
439 os << name << " = ";
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
440 else
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
441 {
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
442 os << name << " =";
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
443 newline (os);
13112
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
444 if (! Vcompact_format)
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
445 newline (os);
969ed305dde5 Remove all blank lines with "format compact"
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12820
diff changeset
446
4604
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
447 retval = true;
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
448 }
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
449
cba347c642e2 [project @ 2003-11-13 04:38:05 by jwe]
jwe
parents: 4593
diff changeset
450 return retval;
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
451 }
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2882
diff changeset
452
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
453 void
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
454 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
455 const std::string& name,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
456 bool print_padding)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
457 {
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
458 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
459
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
460 print (output_buf);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
461
20792
d0991cbd6141 maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents: 20785
diff changeset
462 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
463 newline (output_buf);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
464 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
465
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
466 void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
467 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
468 const std::string& /* prefix */) const
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
469 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
470 os << "no info for type: " << type_name () << "\n";
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
471 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
472
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
473 #define INT_CONV_METHOD(T, F) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
474 T \
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
475 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
476 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
477 T retval = 0; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
478 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
479 double d = 0.0; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
480 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
481 try \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
482 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
483 d = double_value (frc_str_conv); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
484 } \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
485 catch (octave::execution_exception& e) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
486 { \
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
487 err_wrong_type_arg (e, "octave_base_value::" #F "_value ()", type_name ()); \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
488 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
489 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
490 if (require_int && octave::math::x_nint (d) != d) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
491 error_with_cfn ("conversion of %g to " #T " value failed", d); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
492 else if (d < std::numeric_limits<T>::min ()) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
493 retval = std::numeric_limits<T>::min (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
494 else if (d > std::numeric_limits<T>::max ()) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
495 retval = std::numeric_limits<T>::max (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
496 else \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
497 retval = static_cast<T> (octave::math::fix (d)); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
498 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
499 return retval; \
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
500 }
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
501
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
502 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
503 INT_CONV_METHOD (unsigned short int, ushort)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
504
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
505 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
506 INT_CONV_METHOD (unsigned int, uint)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
507
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
508 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
509 INT_CONV_METHOD (unsigned long int, ulong)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
510
16323
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
511 INT_CONV_METHOD (int64_t, int64)
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
512 INT_CONV_METHOD (uint64_t, uint64)
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 15696
diff changeset
513
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
514 int
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
515 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
516 {
20747
ee2743bd07a8 eliminate various compiler warnings
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
517 double d = 0.0;
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
518
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
519 try
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
520 {
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
521 d = double_value (frc_str_conv);
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
522 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
523 catch (octave::execution_exception& e)
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
524 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
525 err_wrong_type_arg (e, "octave_base_value::nint_value ()", type_name ());
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
526 }
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
527
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
528 if (octave::math::isnan (d))
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
529 error ("conversion of NaN to integer value failed");
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
530
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
531 return static_cast<int> (octave::math::fix (d));
3202
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
532 }
44d82b369c78 [project @ 1998-10-29 20:27:57 by jwe]
jwe
parents: 3195
diff changeset
533
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
534 double
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
535 octave_base_value::double_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
536 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
537 err_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
538 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
539
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
540 float
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
541 octave_base_value::float_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
542 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
543 err_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
544 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
545
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
546 Cell
3539
ea583bc68959 [project @ 2000-02-02 12:48:09 by jwe]
jwe
parents: 3536
diff changeset
547 octave_base_value::cell_value () const
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
548 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
549 err_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
550 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
551
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
552 Matrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
553 octave_base_value::matrix_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
554 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
555 err_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
556 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
557
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
558 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
559 octave_base_value::float_matrix_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
560 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
561 err_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
562 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
563
4507
65f47f8a92a2 [project @ 2003-09-10 15:48:02 by jwe]
jwe
parents: 4505
diff changeset
564 NDArray
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
565 octave_base_value::array_value (bool) const
4505
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
566 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
567 err_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
568 }
e944fbe3fff2 [project @ 2003-09-09 19:14:06 by jwe]
jwe
parents: 4457
diff changeset
569
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
570 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
571 octave_base_value::float_array_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
572 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
573 err_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
574 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
575
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
576 Complex
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
577 octave_base_value::complex_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
578 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
579 err_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
2376
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 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
585 err_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
586 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
587
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
588 ComplexMatrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
589 octave_base_value::complex_matrix_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
590 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
591 err_wrong_type_arg ("octave_base_value::complex_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
592 type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
593 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
594
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
595 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
596 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
597 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
598 err_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
599 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
600 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
601
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
602 ComplexNDArray
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
603 octave_base_value::complex_array_value (bool) const
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
604 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
605 err_wrong_type_arg ("octave_base_value::complex_array_value()", type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
606 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
607
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
608 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
609 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
610 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
611 err_wrong_type_arg ("octave_base_value::float_complex_array_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
612 type_name ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
613 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
614
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
615 bool
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
616 octave_base_value::bool_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
617 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
618 err_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
619 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
620
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
621 boolMatrix
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
622 octave_base_value::bool_matrix_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
623 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
624 err_wrong_type_arg ("octave_base_value::bool_matrix_value()", type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
625 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
626
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
627 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
628 octave_base_value::bool_array_value (bool) const
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
629 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
630 err_wrong_type_arg ("octave_base_value::bool_array_value()", type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
631 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
632
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
633 charMatrix
4741
e44d0ac643a5 [project @ 2004-02-05 21:57:50 by jwe]
jwe
parents: 4732
diff changeset
634 octave_base_value::char_matrix_value (bool force) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
635 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
636 charMatrix retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
637
4741
e44d0ac643a5 [project @ 2004-02-05 21:57:50 by jwe]
jwe
parents: 4732
diff changeset
638 octave_value tmp = convert_to_str (false, force);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
639
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
640 retval = tmp.char_matrix_value ();
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4436
diff changeset
641
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
642 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
643 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
644
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
645 charNDArray
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
646 octave_base_value::char_array_value (bool) const
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
647 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
648 err_wrong_type_arg ("octave_base_value::char_array_value()", type_name ());
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
649 }
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4532
diff changeset
650
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
651 SparseMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
652 octave_base_value::sparse_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
653 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
654 err_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
655 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
656
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
657 SparseComplexMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
658 octave_base_value::sparse_complex_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
659 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
660 err_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
661 type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
662 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
663
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
664 SparseBoolMatrix
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
665 octave_base_value::sparse_bool_matrix_value (bool) const
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
666 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
667 err_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
668 type_name ());
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
669 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5105
diff changeset
670
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
671 DiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
672 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
673 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
674 err_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
675 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
676
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
677 FloatDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
678 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
679 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
680 err_wrong_type_arg ("octave_base_value::float_diag_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
681 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
682 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
683
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
684 ComplexDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
685 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
686 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
687 err_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
688 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
689 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
690
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
691 FloatComplexDiagMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
692 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
693 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
694 err_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
695 type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
696 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
697
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
698 PermMatrix
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
699 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
700 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
701 err_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
8916
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
702 }
a2878ba31a9e add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents: 8734
diff changeset
703
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
704 octave_int8
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
705 octave_base_value::int8_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
706 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
707 err_wrong_type_arg ("octave_base_value::int8_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
708 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
709
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
710 octave_int16
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
711 octave_base_value::int16_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
712 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
713 err_wrong_type_arg ("octave_base_value::int16_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
714 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
715
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
716 octave_int32
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
717 octave_base_value::int32_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
718 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
719 err_wrong_type_arg ("octave_base_value::int32_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
720 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
721
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
722 octave_int64
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
723 octave_base_value::int64_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
724 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
725 err_wrong_type_arg ("octave_base_value::int64_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
726 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
727
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
728 octave_uint8
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
729 octave_base_value::uint8_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
730 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
731 err_wrong_type_arg ("octave_base_value::uint8_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
732 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
733
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
734 octave_uint16
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
735 octave_base_value::uint16_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
736 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
737 err_wrong_type_arg ("octave_base_value::uint16_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
738 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
739
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
740 octave_uint32
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
741 octave_base_value::uint32_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
742 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
743 err_wrong_type_arg ("octave_base_value::uint32_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
744 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
745
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
746 octave_uint64
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
747 octave_base_value::uint64_scalar_value (void) const
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
748 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
749 err_wrong_type_arg ("octave_base_value::uint64_scalar_value()", type_name ());
4910
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
750 }
1242acab4246 [project @ 2004-07-12 17:14:13 by jwe]
jwe
parents: 4906
diff changeset
751
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
752 int8NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
753 octave_base_value::int8_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
754 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
755 err_wrong_type_arg ("octave_base_value::int8_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
756 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
757
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
758 int16NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
759 octave_base_value::int16_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
760 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
761 err_wrong_type_arg ("octave_base_value::int16_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
762 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
763
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
764 int32NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
765 octave_base_value::int32_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
766 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
767 err_wrong_type_arg ("octave_base_value::int32_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
768 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
769
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
770 int64NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
771 octave_base_value::int64_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
772 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
773 err_wrong_type_arg ("octave_base_value::int64_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
774 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
775
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
776 uint8NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
777 octave_base_value::uint8_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
778 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
779 err_wrong_type_arg ("octave_base_value::uint8_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
780 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
781
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
782 uint16NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
783 octave_base_value::uint16_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
784 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
785 err_wrong_type_arg ("octave_base_value::uint16_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
786 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
787
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
788 uint32NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
789 octave_base_value::uint32_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
790 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
791 err_wrong_type_arg ("octave_base_value::uint32_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
792 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
793
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
794 uint64NDArray
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
795 octave_base_value::uint64_array_value (void) const
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
796 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
797 err_wrong_type_arg ("octave_base_value::uint64_array_value()", type_name ());
4906
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
798 }
6754342ef7ad [project @ 2004-06-23 11:11:50 by jwe]
jwe
parents: 4741
diff changeset
799
2493
8ed4362aa0d6 [project @ 1996-11-11 02:35:04 by jwe]
jwe
parents: 2466
diff changeset
800 string_vector
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20978
diff changeset
801 octave_base_value::string_vector_value (bool pad) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
802 {
2493
8ed4362aa0d6 [project @ 1996-11-11 02:35:04 by jwe]
jwe
parents: 2466
diff changeset
803 string_vector retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
804
5715
edf82d02be75 [project @ 2006-03-24 16:42:43 by jwe]
jwe
parents: 5707
diff changeset
805 octave_value tmp = convert_to_str (pad, true);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
806
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20978
diff changeset
807 retval = tmp.string_vector_value ();
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
808
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
809 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
810 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
811
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
812 std::string
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4452
diff changeset
813 octave_base_value::string_value (bool force) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
814 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
815 std::string retval;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
816
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4452
diff changeset
817 octave_value tmp = convert_to_str (force);
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
818
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
819 retval = tmp.string_value ();
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
820
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
821 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
822 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
823
20576
40ed9b46a800 new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
824 std::string
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
825 octave_base_value::xstring_value (void) const
20576
40ed9b46a800 new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
826 {
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
827 std::string retval;
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
828 wrong_type_arg_error ();
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
829 return retval;
20576
40ed9b46a800 new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
830 }
40ed9b46a800 new octave_value::string_value method with optional error message
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
831
8732
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
832 Array<std::string>
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
833 octave_base_value::cellstr_value (void) const
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
834 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
835 err_wrong_type_arg ("octave_base_value::cellstr_value()", type_name ());
8732
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
836 }
a669df7beb73 [mq]: x
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
837
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
838 Range
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
839 octave_base_value::range_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
840 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
841 err_wrong_type_arg ("octave_base_value::range_value()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
842 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
843
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
844 octave_map
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
845 octave_base_value::map_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
846 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
847 err_wrong_type_arg ("octave_base_value::map_value()", type_name ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
848 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
849
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
850 octave_scalar_map
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
851 octave_base_value::scalar_map_value (void) const
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
852 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
853 octave_map tmp = map_value ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
854
20879
5357423bca0a Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20853
diff changeset
855 if (tmp.numel () != 1)
20678
4b00afb5e9c3 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20666
diff changeset
856 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
857
20879
5357423bca0a Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20853
diff changeset
858 return octave_scalar_map (tmp.checkelem (0));
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
859 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10670
diff changeset
860
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
861 string_vector
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
862 octave_base_value::map_keys (void) const
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
863 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
864 err_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
865 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
866
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
867 size_t
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
868 octave_base_value::nparents (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
869 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
870 err_wrong_type_arg ("octave_base_value::nparents()", type_name ());
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
871 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
872
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
873 std::list<std::string>
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
874 octave_base_value::parent_class_name_list (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
875 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
876 err_wrong_type_arg ("octave_base_value::parent_class_name_list()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
877 type_name ());
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
878 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
879
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
880 string_vector
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
881 octave_base_value::parent_class_names (void) const
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
882 {
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
883 err_wrong_type_arg ("octave_base_value::parent_class_names()", type_name ());
9151
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
884 }
d8f9588c6ba1 object exemplars
John W. Eaton <jwe@octave.org>
parents: 9064
diff changeset
885
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
886 octave_function *
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
887 octave_base_value::function_value (bool silent)
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
888 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
889 octave_function *retval = nullptr;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
890
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
891 if (! silent)
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
892 err_wrong_type_arg ("octave_base_value::function_value()", type_name ());
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
893
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
894 return retval;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
895 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2962
diff changeset
896
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
897 octave_user_function *
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
898 octave_base_value::user_function_value (bool silent)
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
899 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
900 octave_user_function *retval = nullptr;
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
901
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
902 if (! silent)
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
903 err_wrong_type_arg ("octave_base_value::user_function_value()",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
904 type_name ());
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
905 return retval;
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
906 }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4687
diff changeset
907
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
908 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
909 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
910 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
911 octave_user_script *retval = nullptr;
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
912
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
913 if (! silent)
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
914 err_wrong_type_arg ("octave_base_value::user_script_value()", type_name ());
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
915
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
916 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
917 }
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
918
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
919 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
920 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
921 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
922 octave_user_code *retval = nullptr;
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
923
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
924 if (! silent)
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
925 err_wrong_type_arg ("octave_base_value::user_code_value()", type_name ());
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
926
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
927 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
928 }
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
929
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
930 octave_fcn_handle *
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
931 octave_base_value::fcn_handle_value (bool silent)
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
932 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
933 octave_fcn_handle *retval = nullptr;
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
934
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
935 if (! silent)
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
936 err_wrong_type_arg ("octave_base_value::fcn_handle_value()", type_name ());
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
937
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
938 return retval;
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
939 }
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4257
diff changeset
940
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
941 octave_fcn_inline *
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
942 octave_base_value::fcn_inline_value (bool silent)
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
943 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23220
diff changeset
944 octave_fcn_inline *retval = nullptr;
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
945
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
946 if (! silent)
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
947 err_wrong_type_arg ("octave_base_value::fcn_inline_value()", type_name ());
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21118
diff changeset
948
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
949 return retval;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
950 }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4915
diff changeset
951
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
952 octave_value_list
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
953 octave_base_value::list_value (void) const
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
954 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
955 err_wrong_type_arg ("octave_base_value::list_value()", type_name ());
2882
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
956 }
05926e1b367d [project @ 1997-04-24 09:48:59 by jwe]
jwe
parents: 2847
diff changeset
957
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
958 bool
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 5958
diff changeset
959 octave_base_value::save_ascii (std::ostream&)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
960 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
961 err_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
962 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
963
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
964 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
965 octave_base_value::load_ascii (std::istream&)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
966 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
967 err_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
968 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
969
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
970 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
971 octave_base_value::save_binary (std::ostream&, bool&)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
972 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
973 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
974 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
975
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
976 bool
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
977 octave_base_value::load_binary (std::istream&, bool,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
978 octave::mach_info::float_format)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
979 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
980 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
981 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
982
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
983 bool
19863
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: 19697
diff changeset
984 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
985 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
986 err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
987 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
988
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
989 bool
19863
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: 19697
diff changeset
990 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
991 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
992 err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4661
diff changeset
993 }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
994
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
995 int
23059
b98ebcd7f11c move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23052
diff changeset
996 octave_base_value::write (octave::stream&, int, oct_data_conv::data_type,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
997 int, octave::mach_info::float_format) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
998 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
999 err_wrong_type_arg ("octave_base_value::write()", type_name ());
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1000 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1001
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1002 mxArray *
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1003 octave_base_value::as_mxArray (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1004 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1005 return 0;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1006 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5897
diff changeset
1007
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1008 octave_value
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1009 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
1010 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1011 err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1012 }
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1013
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7528
diff changeset
1014 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
1015 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
1016 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1017 err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
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
1018 }
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1019
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14429
diff changeset
1020 octave_value
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1021 octave_base_value::sort (octave_idx_type, sortmode) const
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1022 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1023 err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1024 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1025
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1026 octave_value
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1027 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
1028 octave_idx_type, sortmode) const
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1029 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1030 err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1031 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
1032
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1033 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
1034 octave_base_value::is_sorted (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1035 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1036 err_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
1037 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1038
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1039 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
1040 octave_base_value::sort_rows_idx (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1041 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1042 err_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
1043 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1044
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1045 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
1046 octave_base_value::is_sorted_rows (sortmode) const
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1047 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1048 err_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
1049 }
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8677
diff changeset
1050
9813
8fa32b527d9a improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
1051 const char *
8fa32b527d9a improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
1052 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
1053 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1054 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
1055 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1056 "abs",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1057 "acos",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1058 "acosh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1059 "angle",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1060 "arg",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1061 "asin",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1062 "asinh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1063 "atan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1064 "atanh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1065 "cbrt",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1066 "ceil",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1067 "conj",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1068 "cos",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1069 "cosh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1070 "erf",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1071 "erfinv",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1072 "erfcinv",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1073 "erfc",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1074 "erfcx",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1075 "erfi",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1076 "dawson",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1077 "exp",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1078 "expm1",
21013
7f4c6d594e3d Finish renaming mapper function finite to isfinite.
Rik <rik@octave.org>
parents: 20990
diff changeset
1079 "isfinite",
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1080 "fix",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1081 "floor",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1082 "gamma",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1083 "imag",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1084 "isinf",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1085 "isna",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1086 "isnan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1087 "lgamma",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1088 "log",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1089 "log2",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1090 "log10",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1091 "log1p",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1092 "real",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1093 "round",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1094 "roundb",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1095 "signum",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1096 "sin",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1097 "sinh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1098 "sqrt",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1099 "tan",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1100 "tanh",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1101 "isalnum",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1102 "isalpha",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1103 "isascii",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1104 "iscntrl",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1105 "isdigit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1106 "isgraph",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1107 "islower",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1108 "isprint",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1109 "ispunct",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1110 "isspace",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1111 "isupper",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1112 "isxdigit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1113 "signbit",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1114 "toascii",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1115 "tolower",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1116 "toupper"
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1117 };
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1118
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1119 if (umap < 0 || umap >= num_unary_mappers)
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1120 return "unknown";
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1121 else
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1122 return names[umap];
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1123 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1124
19863
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: 19697
diff changeset
1125 void
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1126 octave_base_value::warn_load (const char *type) const
19863
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: 19697
diff changeset
1127 {
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: 19697
diff changeset
1128 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: 19697
diff changeset
1129 ("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: 19697
diff changeset
1130 "%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: 19697
diff changeset
1131 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: 19697
diff changeset
1132 }
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: 19697
diff changeset
1133
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: 19697
diff changeset
1134 void
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1135 octave_base_value::warn_save (const char *type) const
19863
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: 19697
diff changeset
1136 {
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: 19697
diff changeset
1137 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: 19697
diff changeset
1138 ("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: 19697
diff changeset
1139 "%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: 19697
diff changeset
1140 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: 19697
diff changeset
1141 }
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: 19697
diff changeset
1142
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
1143 void
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
1144 octave_base_value::wrong_type_arg_error (void) const
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
1145 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1146 err_wrong_type_arg (type_name ());
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
1147 }
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20681
diff changeset
1148
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1149 octave_value
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1150 octave_base_value::map (unary_mapper_t umap) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1151 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9790
diff changeset
1152 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
1153 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7489
diff changeset
1154
7489
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1155 void
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1156 octave_base_value::lock (void)
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1157 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1158 err_wrong_type_arg ("octave_base_value::lock ()", type_name ());
7489
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1159 }
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1160
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1161 void
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1162 octave_base_value::unlock (void)
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1163 {
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21040
diff changeset
1164 err_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
7489
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1165 }
8e4592e49fa7 don't clear locked functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
1166
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1167 void
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1168 octave_base_value::dump (std::ostream& os) const
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1169 {
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1170 dim_vector dv = this->dims ();
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1171
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1172 os << "class: " << this->class_name ()
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1173 << " type: " << this->type_name ()
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1174 << " dims: " << dv.str ();
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1175 }
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7740
diff changeset
1176
21040
3e7cfee5f786 maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents: 21029
diff changeset
1177 OCTAVE_NORETURN static
21029
e3b3bb522d62 maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents: 21024
diff changeset
1178 void
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1179 err_indexed_assignment (const std::string& tn1, const std::string& tn2)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1180 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1181 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
1182 tn2.c_str (), tn1.c_str ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1183 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1184
21040
3e7cfee5f786 maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents: 21029
diff changeset
1185 OCTAVE_NORETURN static
21029
e3b3bb522d62 maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents: 21024
diff changeset
1186 void
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1187 err_assign_conversion_failed (const std::string& tn1, const std::string& tn2)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1188 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1189 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
1190 tn2.c_str (), tn1.c_str ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1191 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1192
21040
3e7cfee5f786 maint: Rename attributes GCC_ATTR_XXX to OCTAVE_XXX.
Rik <rik@octave.org>
parents: 21029
diff changeset
1193 OCTAVE_NORETURN static
21029
e3b3bb522d62 maint: Move GCC_ attributes to start of declaration for future compatibility.
Rik <rik@octave.org>
parents: 21024
diff changeset
1194 void
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1195 err_no_conversion (const std::string& on, const std::string& tn1,
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1196 const std::string& tn2)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1197 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
1198 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
1199 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
1200 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1201
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1202 octave_value
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1203 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
1204 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1205 const octave_value& rhs)
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1206 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1207 octave_value retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1208
9286
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1209 if (idx.front ().empty ())
20879
5357423bca0a Code Sprint 2015: remove return/break/goto after error
Andreas Weber <andy.weber.aw@gmail.com>
parents: 20853
diff changeset
1210 error ("missing index in indexed assignment");
9286
c2248cc4821a don't crash on assignments like a() = 1
Jaroslav Hajek <highegg@gmail.com>
parents: 9151
diff changeset
1211
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1212 int t_lhs = type_id ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1213 int t_rhs = rhs.type_id ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1214
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1215 octave_value_typeinfo::assign_op_fcn f
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1216 = 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
1217 t_lhs, t_rhs);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1218
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1219 bool done = false;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1220
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1221 if (f)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1222 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1223 f (*this, idx.front (), rhs.get_rep ());
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1224
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
1225 done = true;
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1226 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1227
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1228 if (done)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1229 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1230 count++;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1231 retval = octave_value (this);
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1232 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1233 else
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1234 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1235 int t_result
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1236 = 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
1237
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1238 if (t_result >= 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1239 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1240 octave_base_value::type_conv_fcn cf
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1241 = 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
1242
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1243 if (! cf)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1244 err_indexed_assignment (type_name (), rhs.type_name ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1245
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1246 octave_base_value *tmp = cf (*this);
5874
210c5c98c403 [project @ 2006-07-01 02:33:45 by jwe]
jwe
parents: 5851
diff changeset
1247
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1248 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1249 err_assign_conversion_failed (type_name (), rhs.type_name ());
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1250
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1251 octave_value val (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1252
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1253 retval = val.subsasgn (type, idx, rhs);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1254
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1255 done = true;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1256 }
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1257
20555
f90c8372b7ba eliminate many more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20542
diff changeset
1258 if (! done)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1259 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1260 octave_value tmp_rhs;
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1261
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1262 octave_base_value::type_conv_info cf_rhs
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1263 = rhs.numeric_conversion_function ();
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1264
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1265 octave_base_value::type_conv_info cf_this
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1266 = numeric_conversion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1267
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1268 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1269 if (cf_rhs.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1270 && (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
1271 t_lhs,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1272 cf_rhs.type_id ())
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1273 || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs,
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1274 cf_rhs.type_id ()) >= 0))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1275 cf_this = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1276 else if (cf_this.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1277 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1278 cf_this.type_id (), t_rhs)
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1279 || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (),
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1280 t_rhs) >= 0))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1281 cf_rhs = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1282
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1283 if (cf_rhs)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1284 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1285 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
1286
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1287 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1288 err_assign_conversion_failed (type_name (), rhs.type_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1289
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1290 tmp_rhs = octave_value (tmp);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1291 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1292 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1293 tmp_rhs = rhs;
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1294
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1295 count++;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1296 octave_value tmp_lhs = octave_value (this);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1297
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1298 if (cf_this)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1299 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1300 octave_base_value *tmp = cf_this (*this);
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1301
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1302 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1303 err_assign_conversion_failed (type_name (), rhs.type_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1304
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1305 tmp_lhs = octave_value (tmp);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1306 }
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1307
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1308 if (! cf_this && ! cf_rhs)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1309 err_no_conversion (octave_value::assign_op_as_string
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1310 (octave_value::op_asn_eq),
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1311 type_name (), rhs.type_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1312
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1313 retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1314
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
1315 done = true;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1316 }
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
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
1319 // The assignment may have converted to a type that is wider than necessary.
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1320
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1321 retval.maybe_mutate ();
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1322
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1323 return retval;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1324 }
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 // Current indentation.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1327 int octave_base_value::curr_print_indent_level = 0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1328
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1329 // 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
1330 bool octave_base_value::beginning_of_line = true;
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 // Each print() function should call this before printing anything.
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1333 //
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1334 // 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
1335
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1336 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1337 octave_base_value::indent (std::ostream& os) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1338 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1339 assert (curr_print_indent_level >= 0);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1340
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1341 if (beginning_of_line)
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1342 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1343 // FIXME: do we need this?
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1344 // os << prefix;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1345
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1346 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
1347 os << " ";
5759
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 beginning_of_line = false;
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 }
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 // 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
1354
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1355 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1356 octave_base_value::newline (std::ostream& os) const
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 os << "\n";
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1359
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1360 beginning_of_line = true;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1361 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1362
21024
6176560b03d9 maint: Remove return stmts after gripe function calls.
Rik <rik@octave.org>
parents: 21013
diff changeset
1363 // For resetting print state.
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1364
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1365 void
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1366 octave_base_value::reset (void) const
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1367 {
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1368 beginning_of_line = true;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1369 curr_print_indent_level = 0;
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1370 }
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
1371
10670
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1372 octave_value
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1373 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
1374 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1375 return octave_value ();
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1376 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1377
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1378 bool
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1379 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
1380 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1381 return false;
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1382 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1383
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1384 bool
10893
61a5ba82cfbb omit some unused named parameters to avoid warning
Jaroslav Hajek <highegg@gmail.com>
parents: 10840
diff changeset
1385 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
1386 {
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1387 return false;
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1388 }
654fbde5dceb make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents: 10652
diff changeset
1389
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1390 static octave_base_value *
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1391 oct_conv_matrix_conv (const octave_base_value&)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1392 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1393 return new octave_matrix ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1394 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1395
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1396 static octave_base_value *
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1397 oct_conv_complex_matrix_conv (const octave_base_value&)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1398 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1399 return new octave_complex_matrix ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1400 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1401
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1402 static octave_base_value *
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1403 oct_conv_string_conv (const octave_base_value&)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1404 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1405 return new octave_char_matrix_str ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1406 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1407
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1408 static octave_base_value *
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1409 oct_conv_cell_conv (const octave_base_value&)
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1410 {
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1411 return new octave_cell ();
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1412 }
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1413
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1414 static inline octave_value_list
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1415 sanitize (const octave_value_list& ovl)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1416 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1417 octave_value_list retval = ovl;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1418
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1419 for (octave_idx_type i = 0; i < ovl.length (); i++)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1420 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1421 if (retval(i).is_magic_colon ())
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1422 retval(i) = ":";
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1423 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1424
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1425 return retval;
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1426 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1427
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1428 octave_value
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1429 make_idx_args (const std::string& type,
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1430 const std::list<octave_value_list>& idx,
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1431 const std::string& who)
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1432 {
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1433 size_t len = type.length ();
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1434
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1435 if (len != idx.size ())
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1436 error ("invalid index for %s", who.c_str ());
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1437
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1438 Cell type_field (1, len);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1439 Cell subs_field (1, len);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1440
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1441 std::list<octave_value_list>::const_iterator p = idx.begin ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1442
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1443 for (size_t i = 0; i < len; i++)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1444 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1445 char t = type[i];
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1446
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1447 switch (t)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1448 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1449 case '(':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1450 type_field(i) = "()";
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1451 subs_field(i) = Cell (sanitize (*p++));
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1452 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1453
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1454 case '{':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1455 type_field(i) = "{}";
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1456 subs_field(i) = Cell (sanitize (*p++));
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1457 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1458
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1459 case '.':
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1460 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1461 type_field(i) = ".";
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1462
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1463 octave_value_list vlist = *p++;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1464
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1465 if (vlist.length () != 1)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1466 error ("only single argument permitted for '.' index");
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1467
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1468 octave_value val = vlist(0);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1469
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1470 if (! val.is_string ())
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1471 error ("string argument required for '.' index");
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1472
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1473 subs_field(i) = val;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1474 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1475 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1476
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1477 default:
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1478 panic_impossible ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1479 break;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1480 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1481 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1482
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1483 octave_map m;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1484
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1485 m.assign ("type", type_field);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1486 m.assign ("subs", subs_field);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1487
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
1488 return m;
18314
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1489 }
06eb893b9db6 Implement subsref overloading in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18130
diff changeset
1490
18316
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1491 bool
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1492 called_from_builtin (void)
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1493 {
23052
f97e22a9012a move octave_call_stack inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
1494 octave_function *fcn = octave::call_stack::caller ();
18316
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1495
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1496 // 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
1497 // 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
1498 // 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
1499 // 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
1500 // avoiding dispatch?
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1501
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1502 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
1503 }
ff311e5ff6d8 Don't call classdef-overloaded subsref from builtin calls.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 18314
diff changeset
1504
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1505 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1506 install_base_type_conversions (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1507 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1508 INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1509 INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1510 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
1511 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
1512 octave_complex_matrix);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1513 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
1514 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
1515 octave_char_matrix_str);
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3544
diff changeset
1516 INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1517
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1518 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
1519 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
1520 complex_matrix_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1521 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
1522 INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1523 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1524
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1525 DEFUN (sparse_auto_mutate, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1526 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1527 @deftypefn {} {@var{val} =} sparse_auto_mutate ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1528 @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1529 @deftypefnx {} {} sparse_auto_mutate (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1530 Query or set the internal variable that controls whether Octave will
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1531 automatically mutate sparse matrices to full matrices to save memory.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1532
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1533 For example:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1534
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1535 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1536 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1537 s = speye (3);
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1538 sparse_auto_mutate (false);
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1539 s(:, 1) = 1;
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1540 typeinfo (s)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1541 @result{} sparse matrix
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1542 sparse_auto_mutate (true);
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1543 s(1, :) = 1;
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1544 typeinfo (s)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1545 @result{} matrix
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1546 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1547 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1548
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1549 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1550 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1551 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21782
diff changeset
1552 @end deftypefn */)
7193
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1553 {
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1554 return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
cbdee3da62bd [project @ 2007-11-26 22:20:25 by dbateman]
dbateman
parents: 7017
diff changeset
1555 }
12820
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1556
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1557 /*
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1558 %!test
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1559 %! s = speye (3);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1560 %! sparse_auto_mutate (false);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1561 %! s(:, 1) = 1;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1562 %! assert (typeinfo (s), "sparse matrix");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1563 %! sparse_auto_mutate (true);
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1564 %! s(1, :) = 1;
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1565 %! assert (typeinfo (s), "matrix");
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
1566 %! sparse_auto_mutate (false);
12820
efd924e19ff7 codesprint: Add tests for sparse_auto_mutate()
Rik <octave@nomad.inbox5.com>
parents: 12483
diff changeset
1567 */