annotate src/ov.cc @ 4944:44046bbaa52c

[project @ 2004-08-31 05:30:46 by jwe]
author jwe
date Tue, 31 Aug 2004 05:30:47 +0000
parents cd58733c326b
children c0d8e8afa82f
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
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2830
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
4
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
10 later version.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
11
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
15 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
16
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
20
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
4192
5719210fff4c [project @ 2002-11-20 16:56:47 by jwe]
jwe
parents: 4153
diff changeset
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
24 #pragma implementation
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27 #ifdef HAVE_CONFIG_H
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
28 #include <config.h>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
29 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
30
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
31 #include "Array-flags.h"
2942
026f342c2019 [project @ 1997-05-08 02:20:57 by jwe]
jwe
parents: 2909
diff changeset
32 #include "str-vec.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
33 #include "quit.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
34
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
35 #include "oct-obj.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
36 #include "oct-stream.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
37 #include "ov.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
38 #include "ov-base.h"
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
39 #include "ov-bool.h"
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
40 #include "ov-bool-mat.h"
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
41 #include "ov-cell.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
42 #include "ov-scalar.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
43 #include "ov-re-mat.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
44 #include "ov-int8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
45 #include "ov-int16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
46 #include "ov-int32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
47 #include "ov-int64.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
48 #include "ov-uint8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
49 #include "ov-uint16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
50 #include "ov-uint32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
51 #include "ov-uint64.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
52 #include "ov-complex.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
53 #include "ov-cx-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
54 #include "ov-ch-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
55 #include "ov-str-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
56 #include "ov-range.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
57 #include "ov-struct.h"
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
58 #include "ov-file.h"
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
59 #include "ov-streamoff.h"
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
60 #include "ov-list.h"
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
61 #include "ov-cs-list.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
62 #include "ov-colon.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
63 #include "ov-va-args.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
64 #include "ov-builtin.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
65 #include "ov-mapper.h"
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
66 #include "ov-dld-fcn.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
67 #include "ov-usr-fcn.h"
4342
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4276
diff changeset
68 #include "ov-fcn-handle.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
69 #include "ov-typeinfo.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
70
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
71 #include "defun.h"
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
72 #include "error.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
73 #include "gripes.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
74 #include "pager.h"
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
75 #include "parse.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
76 #include "pr-output.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
77 #include "utils.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
78 #include "variables.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
79
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
80 // We are likely to have a lot of octave_value objects to allocate, so
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
81 // make the grow_size large.
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3205
diff changeset
82 DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024);
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
83
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
84 // If TRUE, turn off printing of results in functions (as if a
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
85 // semicolon has been appended to each statement).
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
86 static bool Vsilent_functions;
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
87
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
88 // If TRUE, print a warning for assignments like
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
89 //
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
90 // octave> A(1) = 3; A(2) = 5
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
91 //
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
92 // for A already defined and a matrix type.
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
93 bool Vwarn_fortran_indexing;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
94
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
95 // Should we warn about conversions from complex to real?
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
96 int Vwarn_imag_to_real;
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
97
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
98 // Should we print a warning when converting `[97, 98, 99, "123"]'
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
99 // to a character string?
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
100 bool Vwarn_num_to_str;
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
101
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
102 // If TRUE, warn for operations like
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
103 //
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
104 // octave> 'abc' + 0
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
105 // 97 98 99
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
106 //
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
107 int Vwarn_str_to_num;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
108
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
109 // If TRUE, print the name along with the value.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
110 bool Vprint_answer_id_name;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
111
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
112 // How many levels of structure elements should we print?
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
113 int Vstruct_levels_to_print;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
114
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
115 // Allow divide by zero errors to be suppressed.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
116 bool Vwarn_divide_by_zero;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
117
4461
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
118 // If TRUE, print a warning when a matrix is resized by an indexed
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
119 // assignment with indices outside the current bounds.
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
120 bool Vwarn_resize_on_range_error;
2948
56be458e237f [project @ 1997-05-09 13:37:35 by jwe]
jwe
parents: 2942
diff changeset
121
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
122 // XXX FIXME XXX
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
123
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
124 // Octave's value type.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
125
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
126 std::string
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
127 octave_value::unary_op_as_string (unary_op op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
128 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
129 std::string retval;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
130
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
131 switch (op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
132 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
133 case op_not:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
134 retval = "!";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
135 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
136
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
137 case op_uminus:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
138 retval = "-";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
139 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
140
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
141 case op_transpose:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
142 retval = ".'";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
143 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
144
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
145 case op_hermitian:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
146 retval = "'";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
147 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
148
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
149 case op_incr:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
150 retval = "++";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
151 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
152
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
153 case op_decr:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
154 retval = "--";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
155 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
156
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
157 default:
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
158 retval = "<unknown>";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
159 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
160
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
161 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
162 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
163
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
164 std::string
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
165 octave_value::binary_op_as_string (binary_op op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
166 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
167 std::string retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
168
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
169 switch (op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
170 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
171 case op_add:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
172 retval = "+";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
173 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
174
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
175 case op_sub:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
176 retval = "-";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
177 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
178
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
179 case op_mul:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
180 retval = "*";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
181 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
182
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
183 case op_div:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
184 retval = "/";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
185 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
186
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
187 case op_pow:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
188 retval = "^";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
189 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
190
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
191 case op_ldiv:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
192 retval = "\\";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
193 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
194
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
195 case op_lshift:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
196 retval = "<<";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
197 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
198
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
199 case op_rshift:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
200 retval = ">>";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
201 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
202
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
203 case op_lt:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
204 retval = "<";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
205 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
206
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
207 case op_le:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
208 retval = "<=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
209 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
210
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
211 case op_eq:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
212 retval = "==";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
213 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
214
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
215 case op_ge:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
216 retval = ">=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
217 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
219 case op_gt:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
220 retval = ">";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
221 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
222
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
223 case op_ne:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
224 retval = "!=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
225 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
226
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
227 case op_el_mul:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
228 retval = ".*";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
229 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
230
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
231 case op_el_div:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
232 retval = "./";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
233 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
234
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
235 case op_el_pow:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
236 retval = ".^";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
237 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
238
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
239 case op_el_ldiv:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
240 retval = ".\\";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
241 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
242
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
243 case op_el_and:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
244 retval = "&";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
245 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
246
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
247 case op_el_or:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
248 retval = "|";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
249 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
250
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
251 case op_struct_ref:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
252 retval = ".";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
253 break;
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 default:
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
256 retval = "<unknown>";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
257 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
258
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
259 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
260 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
261
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
262 std::string
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
263 octave_value::assign_op_as_string (assign_op op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
264 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
265 std::string retval;
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
266
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
267 switch (op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
268 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
269 case op_asn_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
270 retval = "=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
271 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
272
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
273 case op_add_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
274 retval = "+=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
275 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
276
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
277 case op_sub_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
278 retval = "-=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
279 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
280
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
281 case op_mul_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
282 retval = "*=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
283 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
284
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
285 case op_div_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
286 retval = "/=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
287 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
288
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
289 case op_ldiv_eq:
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
290 retval = "\\=";
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
291 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
292
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
293 case op_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
294 retval = "^=";
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
295 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
296
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
297 case op_lshift_eq:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
298 retval = "<<=";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
299 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
300
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
301 case op_rshift_eq:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
302 retval = ">>=";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
303 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
304
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
305 case op_el_mul_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
306 retval = ".*=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
307 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
308
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
309 case op_el_div_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
310 retval = "./=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
311 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
312
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
313 case op_el_ldiv_eq:
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
314 retval = ".\\=";
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
315 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
316
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
317 case op_el_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
318 retval = ".^=";
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
319 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
320
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
321 case op_el_and_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
322 retval = "&=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
323 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
324
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
325 case op_el_or_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
326 retval = "|=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
327 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
328
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
329 default:
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
330 retval = "<unknown>";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
331 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
332
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
333 return retval;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
334 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
335
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
336 octave_value *
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
337 octave_value::nil_rep (void) const
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
338 {
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
339 static octave_base_value *nr = new octave_base_value ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
340 return nr;
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
341 }
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
342
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
343 octave_value::octave_value (void)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
344 : rep (nil_rep ())
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
345 {
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
346 rep->count++;
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
347 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
348
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
349 octave_value::octave_value (short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
350 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
351 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
352 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
353 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
354
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
355 octave_value::octave_value (unsigned short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
356 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
357 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
358 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
359 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
360
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
361 octave_value::octave_value (int i)
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
362 : rep (new octave_scalar (i))
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
363 {
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
364 rep->count = 1;
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
365 }
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
366
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
367 octave_value::octave_value (unsigned int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
368 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
369 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
370 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
371 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
372
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
373 octave_value::octave_value (long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
374 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
375 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
376 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
377 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
378
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
379 octave_value::octave_value (unsigned long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
380 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
381 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
382 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
383 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
384
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
385 #if defined (HAVE_LONG_LONG_INT)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
386 octave_value::octave_value (long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
387 : rep (new octave_scalar (i))
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
388 {
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
389 rep->count = 1;
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
390 }
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
391 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
392
4355
6fa0c2306ef6 [project @ 2003-02-22 00:37:10 by jwe]
jwe
parents: 4353
diff changeset
393 #if defined (HAVE_UNSIGNED_LONG_LONG_INT)
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
394 octave_value::octave_value (unsigned long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
395 : rep (new octave_scalar (i))
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
396 {
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
397 rep->count = 1;
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
398 }
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
399 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
400
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
401 octave_value::octave_value (octave_time t)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
402 : rep (new octave_scalar (t))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
403 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
404 rep->count = 1;
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
405 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
406
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
407 octave_value::octave_value (double d)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
408 : rep (new octave_scalar (d))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
409 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
410 rep->count = 1;
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
411 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
412
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
413 octave_value::octave_value (const Cell& c, bool is_csl)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
414 : rep (0)
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
415 {
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
416 if (is_csl)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
417 rep = new octave_cs_list (c);
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
418 else
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
419 rep = new octave_cell (c);
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
420
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
421 rep->count = 1;
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
422 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
423
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
424 octave_value::octave_value (const ArrayN<octave_value>& a, bool is_csl)
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
425 : rep (0)
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
426 {
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
427 Cell c (a);
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
428
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
429 if (is_csl)
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
430 rep = new octave_cs_list (c);
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
431 else
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
432 rep = new octave_cell (c);
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
433
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
434 rep->count = 1;
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
435 }
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4516
diff changeset
436
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
437 octave_value::octave_value (const Matrix& m)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
438 : rep (new octave_matrix (m))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
439 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
440 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
441 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
442 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
443
4507
65f47f8a92a2 [project @ 2003-09-10 15:48:02 by jwe]
jwe
parents: 4505
diff changeset
444 octave_value::octave_value (const NDArray& a)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
445 : rep (new octave_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
446 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
447 rep->count = 1;
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
448 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
449 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
450
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
451 octave_value::octave_value (const ArrayN<double>& a)
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
452 : rep (new octave_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
453 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
454 rep->count = 1;
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
455 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
456 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
457
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
458 octave_value::octave_value (const DiagMatrix& d)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
459 : rep (new octave_matrix (d))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
460 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
461 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
462 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
463 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
464
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
465 octave_value::octave_value (const RowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
466 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
467 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
468 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
469 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
470 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
471
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
472 octave_value::octave_value (const ColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
473 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
474 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
475 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
476 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
477 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
478
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
479 octave_value::octave_value (const Complex& C)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
480 : rep (new octave_complex (C))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
481 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
482 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
483 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
484 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
485
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
486 octave_value::octave_value (const ComplexMatrix& m)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
487 : rep (new octave_complex_matrix (m))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
488 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
489 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
490 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
491 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
492
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
493 octave_value::octave_value (const ComplexNDArray& a)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
494 : rep (new octave_complex_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
495 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
496 rep->count = 1;
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
497 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
498 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
499
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
500 octave_value::octave_value (const ArrayN<Complex>& a)
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
501 : rep (new octave_complex_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
502 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
503 rep->count = 1;
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
504 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
505 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
506
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
507 octave_value::octave_value (const ComplexDiagMatrix& d)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
508 : rep (new octave_complex_matrix (d))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
509 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
510 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
511 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
512 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
513
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
514 octave_value::octave_value (const ComplexRowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
515 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
516 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
517 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
518 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
519 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
520
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
521 octave_value::octave_value (const ComplexColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
522 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
523 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
524 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
525 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
526 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
527
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
528 octave_value::octave_value (bool b)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
529 : rep (new octave_bool (b))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
530 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
531 rep->count = 1;
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
532 }
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
533
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
534 octave_value::octave_value (const boolMatrix& bm)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
535 : rep (new octave_bool_matrix (bm))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
536 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
537 rep->count = 1;
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
538 maybe_mutate ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
539 }
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
540
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
541 octave_value::octave_value (const boolNDArray& bnda)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
542 : rep (new octave_bool_matrix (bnda))
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
543 {
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
544 rep->count = 1;
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
545 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
546 }
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
547
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
548 octave_value::octave_value (char c)
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
549 : rep (new octave_char_matrix_str (c))
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
550 {
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
551 rep->count = 1;
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
552 maybe_mutate ();
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
553 }
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
554
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
555 octave_value::octave_value (const char *s)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
556 : rep (new octave_char_matrix_str (s))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
557 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
558 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
559 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
560 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
561
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
562 octave_value::octave_value (const std::string& s)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
563 : rep (new octave_char_matrix_str (s))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
564 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
565 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
566 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
567 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
568
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
569 octave_value::octave_value (const string_vector& s)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
570 : rep (new octave_char_matrix_str (s))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
571 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
572 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
573 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
574 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
575
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
576 octave_value::octave_value (const charMatrix& chm, bool is_str)
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
577 : rep (is_str
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
578 ? new octave_char_matrix_str (chm)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
579 : new octave_char_matrix (chm))
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
580 {
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
581 rep->count = 1;
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
582 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
583 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
584
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
585 octave_value::octave_value (const charNDArray& chm, bool is_str)
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
586 : rep (is_str
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
587 ? new octave_char_matrix_str (chm)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
588 : new octave_char_matrix (chm))
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
589 {
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
590 rep->count = 1;
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
591 maybe_mutate ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
592 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
593
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
594 octave_value::octave_value (const octave_int8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
595 : rep (new octave_int8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
596 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
597 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
598 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
599 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
600
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
601 octave_value::octave_value (const octave_uint8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
602 : rep (new octave_uint8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
603 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
604 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
605 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
606 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
607
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
608 octave_value::octave_value (const octave_int16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
609 : rep (new octave_int16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
610 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
611 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
612 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
613 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
614
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
615 octave_value::octave_value (const octave_uint16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
616 : rep (new octave_uint16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
617 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
618 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
619 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
620 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
621
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
622 octave_value::octave_value (const octave_int32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
623 : rep (new octave_int32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
624 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
625 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
626 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
627 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
628
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
629 octave_value::octave_value (const octave_uint32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
630 : rep (new octave_uint32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
631 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
632 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
633 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
634 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
635
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
636 octave_value::octave_value (const octave_int64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
637 : rep (new octave_int64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
638 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
639 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
640 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
641 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
642
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
643 octave_value::octave_value (const octave_uint64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
644 : rep (new octave_uint64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
645 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
646 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
647 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
648 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
649
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
650 octave_value::octave_value (const int8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
651 : rep (new octave_int8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
652 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
653 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
654 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
655 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
656
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
657 octave_value::octave_value (const uint8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
658 : rep (new octave_uint8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
659 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
660 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
661 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
662 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
663
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
664 octave_value::octave_value (const int16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
665 : rep (new octave_int16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
666 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
667 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
668 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
669 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
670
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
671 octave_value::octave_value (const uint16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
672 : rep (new octave_uint16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
673 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
674 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
675 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
676 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
677
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
678 octave_value::octave_value (const int32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
679 : rep (new octave_int32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
680 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
681 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
682 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
683 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
684
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
685 octave_value::octave_value (const uint32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
686 : rep (new octave_uint32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
687 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
688 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
689 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
690 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
691
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
692 octave_value::octave_value (const int64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
693 : rep (new octave_int64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
694 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
695 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
696 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
697 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
698
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
699 octave_value::octave_value (const uint64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
700 : rep (new octave_uint64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
701 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
702 rep->count = 1;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
703 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
704 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
705
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
706 octave_value::octave_value (double base, double limit, double inc)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
707 : rep (new octave_range (base, limit, inc))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
708 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
709 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
710 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
711 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
712
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
713 octave_value::octave_value (const Range& r)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
714 : rep (new octave_range (r))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
715 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
716 rep->count = 1;
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
717 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
718 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
719
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
720 octave_value::octave_value (const Octave_map& m)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
721 : rep (new octave_struct (m))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
722 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
723 rep->count = 1;
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
724 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
725
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 3333
diff changeset
726 octave_value::octave_value (const octave_stream& s, int n)
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
727 : rep (new octave_file (s, n))
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
728 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
729 rep->count = 1;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
730 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
731
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
732 octave_value::octave_value (const streamoff_array& off)
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
733 : rep (new octave_streamoff (off))
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
734 {
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
735 rep->count = 1;
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
736 }
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
737
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
738 octave_value::octave_value (const octave_value_list& l, bool is_csl)
4591
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
739 : rep (0)
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
740 {
4591
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
741 if (is_csl)
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
742 rep = new octave_cs_list (l);
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
743 else
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
744 rep = new octave_list (l);
2c9de1be042a [project @ 2003-11-11 00:23:35 by jwe]
jwe
parents: 4587
diff changeset
745
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
746 rep->count = 1;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
747 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
748
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
749 octave_value::octave_value (octave_value::magic_colon)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
750 : rep (new octave_magic_colon ())
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
751 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
752 rep->count = 1;
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
753 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
754
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
755 octave_value::octave_value (octave_value::all_va_args)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
756 : rep (new octave_all_va_args ())
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
757 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
758 rep->count = 1;
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
759 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
760
4276
8724cf60d51d [project @ 2003-01-03 23:03:02 by jwe]
jwe
parents: 4271
diff changeset
761 octave_value::octave_value (octave_value *new_rep, int cnt)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
762 : rep (new_rep)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
763 {
4276
8724cf60d51d [project @ 2003-01-03 23:03:02 by jwe]
jwe
parents: 4271
diff changeset
764 rep->count = cnt;
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
765 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
766
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
767 octave_value::~octave_value (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
768 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
769 #if defined (MDEBUG)
3531
97cf542676e1 [project @ 2000-02-02 11:30:40 by jwe]
jwe
parents: 3523
diff changeset
770 std::cerr << "~octave_value: rep: " << rep
97cf542676e1 [project @ 2000-02-02 11:30:40 by jwe]
jwe
parents: 3523
diff changeset
771 << " rep->count: " << rep->count << "\n";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
772 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
773
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
774 if (rep && --rep->count == 0)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
775 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
776 delete rep;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
777 rep = 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
778 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
779 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
780
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
781 octave_value *
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
782 octave_value::clone (void) const
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
783 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
784 panic_impossible ();
3546
6dfdded73a7e [project @ 2000-02-02 22:45:39 by jwe]
jwe
parents: 3544
diff changeset
785 return 0;
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
786 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
787
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
788 void
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
789 octave_value::maybe_mutate (void)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
790 {
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2409
diff changeset
791 octave_value *tmp = rep->try_narrowing_conversion ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
792
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
793 if (tmp && tmp != rep)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
794 {
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
795 if (--rep->count == 0)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
796 delete rep;
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
797
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
798 rep = tmp;
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
799 rep->count = 1;
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
800 }
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
801 }
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
802
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
803 octave_value
4271
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4257
diff changeset
804 octave_value::single_subsref (const std::string& type,
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4257
diff changeset
805 const octave_value_list& idx)
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
806 {
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
807 std::list<octave_value_list> i;
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
808
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
809 i.push_back (idx);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
810
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
811 return rep->subsref (type, i);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
812 }
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
813
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
814 octave_value_list
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
815 octave_value::subsref (const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
816 const std::list<octave_value_list>& idx, int nargout)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
817 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
818 if (is_constant ())
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
819 return rep->subsref (type, idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
820 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
821 return rep->subsref (type, idx, nargout);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
822 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
823
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
824 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
825 octave_value::next_subsref (const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
826 const std::list<octave_value_list>& idx,
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
827 size_t skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
828 {
4582
db5a24d54915 [project @ 2003-10-31 15:11:45 by jwe]
jwe
parents: 4567
diff changeset
829 if (! error_state && idx.size () > skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
830 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
831 std::list<octave_value_list> new_idx (idx);
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
832 for (size_t i = 0; i < skip; i++)
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
833 new_idx.erase (new_idx.begin ());
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
834 return subsref (type.substr (skip), new_idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
835 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
836 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
837 return *this;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
838 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
839
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
840 octave_value_list
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3536
diff changeset
841 octave_value::do_multi_index_op (int nargout, const octave_value_list& idx)
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
842 {
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3536
diff changeset
843 return rep->do_multi_index_op (nargout, idx);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
844 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
845
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
846 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
847 gripe_no_conversion (const std::string& on, const std::string& tn1,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
848 const std::string& tn2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
849 {
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
850 error ("operator %s: no conversion for assignment of `%s' to indexed `%s'",
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
851 on.c_str (), tn2.c_str (), tn1.c_str ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
852 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
853
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
854 #if 0
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
855 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
856 gripe_assign_failed (const std::string& on, const std::string& tn1,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
857 const std::string& tn2)
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
858 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
859 error ("assignment failed for `%s %s %s'",
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
860 tn1.c_str (), on.c_str (), tn2.c_str ());
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
861 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
862 #endif
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
863
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
864 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
865 gripe_assign_failed_or_no_method (const std::string& on,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
866 const std::string& tn1,
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
867 const std::string& tn2)
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
868 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
869 error ("assignment failed, or no method for `%s %s %s'",
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
870 tn1.c_str (), on.c_str (), tn2.c_str ());
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
871 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
872
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
873 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
874 octave_value::subsasgn (const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
875 const std::list<octave_value_list>& idx,
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
876 const octave_value& rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
877 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
878 return rep->subsasgn (type, idx, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
879 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
880
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
881 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
882 octave_value::assign (assign_op op, const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
883 const std::list<octave_value_list>& idx,
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
884 const octave_value& rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
885 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
886 octave_value retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
887
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
888 make_unique ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
889
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
890 octave_value t_rhs = rhs;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
891
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
892 if (op != op_asn_eq)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
893 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
894 // XXX FIXME XXX -- only do the following stuff if we can't find
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
895 // a specific function to call to handle the op= operation for
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
896 // the types we have.
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
897
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
898 octave_value t = subsref (type, idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
899
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
900 if (! error_state)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
901 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
902 binary_op binop = op_eq_to_binary_op (op);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
903
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
904 if (! error_state)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
905 t_rhs = do_binary_op (binop, t, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
906 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
907 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
908
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
909 if (! error_state)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
910 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
911 if (type[0] == '.' && ! is_map ())
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
912 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
913 octave_value tmp = Octave_map ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
914 retval = tmp.subsasgn (type, idx, t_rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
915 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
916 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
917 retval = subsasgn (type, idx, t_rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
918 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
919
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
920 if (error_state)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
921 gripe_assign_failed_or_no_method (assign_op_as_string (op),
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
922 type_name (), rhs.type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
923
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
924 return retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
925 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
926
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
927 const octave_value&
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
928 octave_value::assign (assign_op op, const octave_value& rhs)
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
929 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
930 if (op == op_asn_eq)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
931 operator = (rhs);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
932 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
933 {
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
934 // XXX FIXME XXX -- only do the following stuff if we can't find
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
935 // a specific function to call to handle the op= operation for
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
936 // the types we have.
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
937
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
938 binary_op binop = op_eq_to_binary_op (op);
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
939
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
940 if (! error_state)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
941 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
942 octave_value t = do_binary_op (binop, *this, rhs);
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
943
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
944 if (! error_state)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
945 operator = (t);
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
946 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
947
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
948 if (error_state)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
949 gripe_assign_failed_or_no_method (assign_op_as_string (op),
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
950 type_name (), rhs.type_name ());
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
951 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
952
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
953 return *this;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
954 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
955
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
956 int
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
957 octave_value::rows (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
958 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
959 dim_vector dv = dims ();
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
960
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
961 return (dv.length () > 0) ? dv(0) : -1;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
962 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
963
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
964 int
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
965 octave_value::columns (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
966 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
967 dim_vector dv = dims ();
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
968
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
969 return (dv.length () > 1) ? dv(1) : -1;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
970 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
971
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
972 int
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
973 octave_value::length (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
974 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
975 int retval = 0;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
976
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
977 dim_vector dv = dims ();
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
978
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
979 for (int i = 0; i < dv.length (); i++)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
980 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
981 if (dv(i) < 0)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
982 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
983 retval = -1;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
984 break;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
985 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
986
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
987 if (dv(i) == 0)
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
988 {
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
989 retval = 0;
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
990 break;
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
991 }
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
992
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
993 if (dv(i) > retval)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
994 retval = dv(i);
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
995 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
996
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
997 return retval;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
998 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
999
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1000 int
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1001 octave_value::ndims (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1002 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1003 dim_vector dv = dims ();
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1004
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1005 int n_dims = dv.length ();
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1006
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1007 // Remove trailing singleton dimensions.
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1008
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1009 for (int i = n_dims; i > 2; i--)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1010 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1011 if (dv(i-1) == 1)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1012 n_dims--;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1013 else
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1014 break;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1015 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1016
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1017 // The result is always >= 2.
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1018
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1019 if (n_dims < 2)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1020 n_dims = 2;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1021
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1022 return n_dims;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1023 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1024
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1025 int
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1026 octave_value::numel (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1027 {
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1028 dim_vector dv = dims ();
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1029
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4563
diff changeset
1030 return dv.numel ();
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1031 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1032
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1033 Cell
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1034 octave_value::cell_value (void) const
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1035 {
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1036 return rep->cell_value ();
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1037 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1038
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1039 Octave_map
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1040 octave_value::map_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1041 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1042 return rep->map_value ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1043 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1044
3340
585a8809fd9b [project @ 1999-11-05 07:02:30 by jwe]
jwe
parents: 3333
diff changeset
1045 octave_stream
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1046 octave_value::stream_value (void) const
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1047 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1048 return rep->stream_value ();
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1049 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1050
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1051 int
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1052 octave_value::stream_number (void) const
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1053 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1054 return rep->stream_number ();
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1055 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1056
4645
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1057 std::streamoff
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
1058 octave_value::streamoff_value (void) const
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
1059 {
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
1060 return rep->streamoff_value ();
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
1061 }
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
1062
4645
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1063 streamoff_array
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1064 octave_value::streamoff_array_value (void) const
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1065 {
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1066 return rep->streamoff_array_value ();
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1067 }
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4643
diff changeset
1068
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1069 octave_function *
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1070 octave_value::function_value (bool silent)
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1071 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1072 return rep->function_value (silent);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1073 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1074
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1075 octave_user_function *
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1076 octave_value::user_function_value (bool silent)
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1077 {
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1078 return rep->user_function_value (silent);
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1079 }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1080
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
1081 octave_fcn_handle *
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1082 octave_value::fcn_handle_value (bool silent)
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1083 {
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1084 return rep->fcn_handle_value (silent);
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1085 }
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1086
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1087 octave_fcn_inline *
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1088 octave_value::fcn_inline_value (bool silent)
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1089 {
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1090 return rep->fcn_inline_value (silent);
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1091 }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1092
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1093 octave_value_list
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1094 octave_value::list_value (void) const
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1095 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1096 return rep->list_value ();
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1097 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1098
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1099 ColumnVector
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1100 octave_value::column_vector_value (bool force_string_conv,
4661
12b6fbd57436 [project @ 2003-11-25 05:41:35 by jwe]
jwe
parents: 4654
diff changeset
1101 bool /* frc_vec_conv */) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1102 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1103 ColumnVector retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1104
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1105 Matrix m = matrix_value (force_string_conv);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1106
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1107 if (error_state)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1108 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1109
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1110 int nr = m.rows ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1111 int nc = m.columns ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1112
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1113 if (nc == 1)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1114 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1115 retval.resize (nr);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1116 for (int i = 0; i < nr; i++)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1117 retval (i) = m (i, 0);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1118 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1119 else
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1120 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1121 std::string tn = type_name ();
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1122 gripe_invalid_conversion (tn.c_str (), "real column vector");
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1123 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1124
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1125 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1126 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1127
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1128 ComplexColumnVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1129 octave_value::complex_column_vector_value (bool force_string_conv,
4661
12b6fbd57436 [project @ 2003-11-25 05:41:35 by jwe]
jwe
parents: 4654
diff changeset
1130 bool /* frc_vec_conv */) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1131 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1132 ComplexColumnVector retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1133
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1134 ComplexMatrix m = complex_matrix_value (force_string_conv);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1135
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1136 if (error_state)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1137 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1138
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1139 int nr = m.rows ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1140 int nc = m.columns ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1141
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1142 if (nc == 1)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1143 {
3465
996bb7ea4507 [project @ 2000-01-21 07:48:25 by jwe]
jwe
parents: 3419
diff changeset
1144 retval.resize (nr);
996bb7ea4507 [project @ 2000-01-21 07:48:25 by jwe]
jwe
parents: 3419
diff changeset
1145 for (int i = 0; i < nr; i++)
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1146 retval (i) = m (i, 0);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1147 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1148 else
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1149 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1150 std::string tn = type_name ();
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1151 gripe_invalid_conversion (tn.c_str (), "complex column vector");
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1152 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1153
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1154 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1155 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1156
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1157 RowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1158 octave_value::row_vector_value (bool force_string_conv,
4661
12b6fbd57436 [project @ 2003-11-25 05:41:35 by jwe]
jwe
parents: 4654
diff changeset
1159 bool /* frc_vec_conv */) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1160 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1161 RowVector retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1162
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1163 Matrix m = matrix_value (force_string_conv);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1164
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1165 if (error_state)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1166 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1167
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1168 int nr = m.rows ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1169 int nc = m.columns ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1170
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1171 if (nr == 1)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1172 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1173 retval.resize (nc);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1174 for (int i = 0; i < nc; i++)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1175 retval (i) = m (0, i);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1176 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1177 else
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1178 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1179 std::string tn = type_name ();
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1180 gripe_invalid_conversion (tn.c_str (), "real row vector");
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1181 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1182
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1183 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1184 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1185
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1186 ComplexRowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1187 octave_value::complex_row_vector_value (bool force_string_conv,
4661
12b6fbd57436 [project @ 2003-11-25 05:41:35 by jwe]
jwe
parents: 4654
diff changeset
1188 bool /* frc_vec_conv */) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1189 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1190 ComplexRowVector retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1191
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1192 ComplexMatrix m = complex_matrix_value (force_string_conv);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1193
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1194 if (error_state)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1195 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1196
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1197 int nr = m.rows ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1198 int nc = m.columns ();
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1199
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1200 if (nr == 1)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1201 {
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1202 retval.resize (nc);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1203 for (int i = 0; i < nc; i++)
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1204 retval (i) = m (0, i);
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1205 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1206 else
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1207 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1208 std::string tn = type_name ();
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1209 gripe_invalid_conversion (tn.c_str (), "complex row vector");
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1210 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1211
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1212 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1213 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1214
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1215 // Sloppy...
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1216
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1217 Array<double>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1218 octave_value::vector_value (bool force_string_conv,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1219 bool force_vector_conversion) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1220 {
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1221 Array<double> retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1222
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1223 Matrix m = matrix_value (force_string_conv);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1224
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1225 if (error_state)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1226 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1227
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1228 int nr = m.rows ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1229 int nc = m.columns ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1230
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1231 if (nr == 1)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1232 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1233 retval.resize (nc);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1234 for (int i = 0; i < nc; i++)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1235 retval (i) = m (0, i);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1236 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1237 else if (nc == 1)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1238 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1239 retval.resize (nr);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1240 for (int i = 0; i < nr; i++)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1241 retval (i) = m (i, 0);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1242 }
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1243 else if (nr > 0 && nc > 0)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1244 {
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1245 // XXX FIXME XXX -- is warn_fortran_indexing the right variable here?
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1246 if (! force_vector_conversion && Vwarn_fortran_indexing)
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1247 gripe_implicit_conversion (type_name (), "real vector");
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1248
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1249 retval.resize (nr * nc);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1250 int k = 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1251 for (int j = 0; j < nc; j++)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1252 for (int i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1253 {
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1254 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1255
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1256 retval (k++) = m (i, j);
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1257 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1258 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1259 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1260 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1261 std::string tn = type_name ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1262 gripe_invalid_conversion (tn.c_str (), "real vector");
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1263 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1264
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1265 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1266 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1267
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1268 Array<int>
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1269 octave_value::int_vector_value (bool force_string_conv, bool require_int,
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1270 bool force_vector_conversion) const
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1271 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1272 Array<int> retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1273
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1274 Matrix m = matrix_value (force_string_conv);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1275
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1276 if (error_state)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1277 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1278
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1279 int nr = m.rows ();
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1280 int nc = m.columns ();
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1281
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1282 if (nr == 1)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1283 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1284 retval.resize (nc);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1285 for (int i = 0; i < nc; i++)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1286 {
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1287 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1288
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1289 double d = m (0, i);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1290
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1291 if (require_int && D_NINT (d) != d)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1292 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1293 error ("conversion to integer value failed");
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1294 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1295 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1296
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1297 retval (i) = static_cast<int> (d);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1298 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1299 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1300 else if (nc == 1)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1301 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1302 retval.resize (nr);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1303 for (int i = 0; i < nr; i++)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1304 {
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1305 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1306
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1307 double d = m (i, 0);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1308
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1309 if (require_int && D_NINT (d) != d)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1310 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1311 error ("conversion to integer value failed");
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1312 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1313 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1314
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1315 retval (i) = static_cast<int> (d);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1316 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1317 }
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1318 else if (nr > 0 && nc > 0)
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1319 {
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1320 // XXX FIXME XXX -- is warn_fortran_indexing the right variable here?
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1321 if (! force_vector_conversion && Vwarn_fortran_indexing)
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1322 gripe_implicit_conversion (type_name (), "real vector");
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1323
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1324 retval.resize (nr * nc);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1325 int k = 0;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1326 for (int j = 0; j < nc; j++)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1327 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1328 for (int i = 0; i < nr; i++)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1329 {
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1330 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1331
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1332 double d = m (i, j);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1333
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1334 if (require_int && D_NINT (d) != d)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1335 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1336 error ("conversion to integer value failed");
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1337 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1338 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1339
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1340 retval (k++) = static_cast<int> (d);
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1341 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1342 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1343 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1344 else
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1345 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1346 std::string tn = type_name ();
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1347 gripe_invalid_conversion (tn.c_str (), "real vector");
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1348 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1349
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1350 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1351 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1352
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1353 Array<Complex>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1354 octave_value::complex_vector_value (bool force_string_conv,
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1355 bool force_vector_conversion) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1356 {
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1357 Array<Complex> retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1358
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1359 ComplexMatrix m = complex_matrix_value (force_string_conv);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1360
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1361 if (error_state)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1362 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1363
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1364 int nr = m.rows ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1365 int nc = m.columns ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1366
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1367 if (nr == 1)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1368 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1369 retval.resize (nc);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1370 for (int i = 0; i < nc; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1371 {
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1372 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1373 retval (i) = m (0, i);
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1374 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1375 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1376 else if (nc == 1)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1377 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1378 retval.resize (nr);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1379 for (int i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1380 {
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1381 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1382 retval (i) = m (i, 0);
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1383 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1384 }
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1385 else if (nr > 0 && nc > 0)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1386 {
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1387 // XXX FIXME XXX -- is warn_fortran_indexing the right variable here?
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1388 if (! force_vector_conversion && Vwarn_fortran_indexing)
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1389 gripe_implicit_conversion (type_name (), "complex vector");
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
1390
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1391 retval.resize (nr * nc);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1392 int k = 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1393 for (int j = 0; j < nc; j++)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1394 for (int i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1395 {
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1396 OCTAVE_QUIT;
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1397 retval (k++) = m (i, j);
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4066
diff changeset
1398 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1399 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1400 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1401 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1402 std::string tn = type_name ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1403 gripe_invalid_conversion (tn.c_str (), "complex vector");
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
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1406 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1407 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1408
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1409 octave_value
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4455
diff changeset
1410 octave_value::convert_to_str (bool pad, bool force) const
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1411 {
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4455
diff changeset
1412 octave_value retval = convert_to_str_internal (pad, force);
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1413
4457
d7d9ca19960a [project @ 2003-07-11 03:05:38 by jwe]
jwe
parents: 4455
diff changeset
1414 if (! force && is_numeric_type () && Vwarn_num_to_str)
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1415 gripe_implicit_conversion (type_name (), retval.type_name ());
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1416
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1417 return retval;
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1418 }
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
1419
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1420 void
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1421 octave_value::print_with_name (std::ostream& output_buf,
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1422 const std::string& name,
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1423 bool print_padding) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1424 {
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1425 if (! (evaluating_function_body && Vsilent_functions))
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1426 {
4894
ab5870f984d9 [project @ 2004-06-03 19:32:02 by jwe]
jwe
parents: 4858
diff changeset
1427 bool pad_after = false;
ab5870f984d9 [project @ 2004-06-03 19:32:02 by jwe]
jwe
parents: 4858
diff changeset
1428
ab5870f984d9 [project @ 2004-06-03 19:32:02 by jwe]
jwe
parents: 4858
diff changeset
1429 if (Vprint_answer_id_name)
ab5870f984d9 [project @ 2004-06-03 19:32:02 by jwe]
jwe
parents: 4858
diff changeset
1430 pad_after = print_name_tag (output_buf, name);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1431
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1432 print (output_buf);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1433
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1434 if (print_padding && pad_after)
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1435 newline (output_buf);
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
1436 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1437 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1438
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1439 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1440 gripe_indexed_assignment (const std::string& tn1, const std::string& tn2)
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1441 {
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1442 error ("assignment of `%s' to indexed `%s' not implemented",
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1443 tn2.c_str (), tn1.c_str ());
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1444 }
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1445
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1446 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1447 gripe_assign_conversion_failed (const std::string& tn1,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1448 const std::string& tn2)
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1449 {
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1450 error ("type conversion for assignment of `%s' to indexed `%s' failed",
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1451 tn2.c_str (), tn1.c_str ());
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1452 }
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1453
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1454 int
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1455 octave_value::write (octave_stream& os, int block_size,
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1456 oct_data_conv::data_type output_type, int skip,
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1457 oct_mach_info::float_format flt_fmt) const
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1458 {
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1459 return rep->write (os, block_size, output_type, skip, flt_fmt);
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1460 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1461
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1462 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1463 octave_value::numeric_assign (const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
1464 const std::list<octave_value_list>& idx,
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1465 const octave_value& rhs)
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1466 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1467 octave_value retval;
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1468
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1469 int t_lhs = type_id ();
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1470 int t_rhs = rhs.type_id ();
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1471
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1472 assign_op_fcn f
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1473 = octave_value_typeinfo::lookup_assign_op (op_asn_eq, t_lhs, t_rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1474
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1475 bool done = false;
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1476
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1477 if (f)
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1478 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1479 f (*this, idx.front (), rhs.get_rep ());
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1480
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1481 done = (! error_state);
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1482 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1483
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1484 if (done)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1485 retval = octave_value (this, count + 1);
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1486 else
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1487 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1488 int t_result
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1489 = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1490
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1491 if (t_result >= 0)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1492 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1493 type_conv_fcn cf
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1494 = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1495
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1496 if (cf)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1497 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1498 octave_value *tmp (cf (*this));
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1499
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1500 if (tmp)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1501 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1502 retval = tmp->subsasgn (type, idx, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1503
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1504 done = (! error_state);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1505 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1506 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1507 gripe_assign_conversion_failed (type_name (),
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1508 rhs.type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1509 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1510 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1511 gripe_indexed_assignment (type_name (), rhs.type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1512 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1513
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1514 if (! (done || error_state))
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1515 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1516 octave_value tmp_rhs;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1517 type_conv_fcn cf_rhs = rhs.numeric_conversion_function ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1518
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1519 if (cf_rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1520 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1521 octave_value *tmp = cf_rhs (rhs.get_rep ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1522
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1523 if (tmp)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1524 tmp_rhs = octave_value (tmp);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1525 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1526 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1527 gripe_assign_conversion_failed (type_name (),
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1528 rhs.type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1529 return octave_value ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1530 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1531 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1532 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1533 tmp_rhs = rhs;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1534
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1535 type_conv_fcn cf_this = numeric_conversion_function ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1536
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1537 octave_value *tmp_lhs = this;
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1538
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1539 if (cf_this)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1540 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1541 octave_value *tmp = cf_this (*this);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1542
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1543 if (tmp)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1544 tmp_lhs = tmp;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1545 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1546 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1547 gripe_assign_conversion_failed (type_name (),
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1548 rhs.type_name ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1549 return octave_value ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1550 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1551 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1552
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1553 if (cf_this || cf_rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1554 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1555 retval = tmp_lhs->subsasgn (type, idx, tmp_rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1556
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1557 done = (! error_state);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1558 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1559 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1560 gripe_no_conversion (assign_op_as_string (op_asn_eq),
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1561 type_name (), rhs.type_name ());
3196
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1562 }
3ac3e8edc258 [project @ 1998-10-28 23:04:39 by jwe]
jwe
parents: 3189
diff changeset
1563 }
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1564
4858
499d2ca46982 [project @ 2004-04-08 18:00:43 by jwe]
jwe
parents: 4791
diff changeset
1565 // The assignment may have converted to a type that is wider than
499d2ca46982 [project @ 2004-04-08 18:00:43 by jwe]
jwe
parents: 4791
diff changeset
1566 // necessary.
499d2ca46982 [project @ 2004-04-08 18:00:43 by jwe]
jwe
parents: 4791
diff changeset
1567
499d2ca46982 [project @ 2004-04-08 18:00:43 by jwe]
jwe
parents: 4791
diff changeset
1568 retval.maybe_mutate ();
499d2ca46982 [project @ 2004-04-08 18:00:43 by jwe]
jwe
parents: 4791
diff changeset
1569
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1570 return retval;
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1571 }
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1572
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1573 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1574 gripe_binary_op (const std::string& on, const std::string& tn1,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1575 const std::string& tn2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1576 {
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1577 error ("binary operator `%s' not implemented for `%s' by `%s' operations",
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1578 on.c_str (), tn1.c_str (), tn2.c_str ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1579 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1580
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1581 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1582 gripe_binary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1583 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1584 error ("type conversion failed for binary operator `%s'", on.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1585 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1586
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1587 octave_value
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1588 do_binary_op (octave_value::binary_op op,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1589 const octave_value& v1, const octave_value& v2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1590 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1591 octave_value retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1592
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1593 int t1 = v1.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1594 int t2 = v2.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1595
2427
2f50b24ce84f [project @ 1996-10-25 06:15:28 by jwe]
jwe
parents: 2423
diff changeset
1596 binary_op_fcn f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1597
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1598 if (f)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1599 retval = f (*v1.rep, *v2.rep);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1600 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1601 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1602 octave_value tv1;
2427
2f50b24ce84f [project @ 1996-10-25 06:15:28 by jwe]
jwe
parents: 2423
diff changeset
1603 type_conv_fcn cf1 = v1.numeric_conversion_function ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1604
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1605 if (cf1)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1606 {
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1607 octave_value *tmp = cf1 (*v1.rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1608
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1609 if (tmp)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1610 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1611 tv1 = octave_value (tmp);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1612 t1 = tv1.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1613 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1614 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1615 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1616 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1617 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1618 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1619 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1620 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1621 tv1 = v1;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1622
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1623 octave_value tv2;
2427
2f50b24ce84f [project @ 1996-10-25 06:15:28 by jwe]
jwe
parents: 2423
diff changeset
1624 type_conv_fcn cf2 = v2.numeric_conversion_function ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1625
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1626 if (cf2)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1627 {
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1628 octave_value *tmp = cf2 (*v2.rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1629
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1630 if (tmp)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1631 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1632 tv2 = octave_value (tmp);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1633 t2 = tv2.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1634 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1635 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1636 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1637 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1638 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1639 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1640 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1641 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1642 tv2 = v2;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1643
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1644 if (cf1 || cf2)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1645 {
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
1646 f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1647
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1648 if (f)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1649 retval = f (*tv1.rep, *tv2.rep);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1650 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1651 gripe_binary_op (octave_value::binary_op_as_string (op),
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1652 v1.type_name (), v2.type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1653 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1654 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1655 gripe_binary_op (octave_value::binary_op_as_string (op),
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1656 v1.type_name (), v2.type_name ());
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1657 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1658
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1659 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1660 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1661
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1662 static void
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1663 gripe_cat_op (const std::string& tn1, const std::string& tn2)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1664 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1665 error ("concatenation operator not implemented for `%s' by `%s' operations",
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1666 tn1.c_str (), tn2.c_str ());
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1667 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1668
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1669 static void
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1670 gripe_cat_op_conv (void)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1671 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1672 error ("type conversion failed for concatenation operator");
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1673 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1674
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1675 octave_value
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1676 do_cat_op (const octave_value& v1, const octave_value& v2,
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1677 const Array<int>& ra_idx)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1678 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1679 octave_value retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1680
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1681 int t1 = v1.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1682 int t2 = v2.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1683
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1684 cat_op_fcn f = octave_value_typeinfo::lookup_cat_op (t1, t2);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1685
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1686 if (f)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1687 retval = f (*v1.rep, *v2.rep, ra_idx);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1688 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1689 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1690 octave_value tv1;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1691 type_conv_fcn cf1 = v1.numeric_conversion_function ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1692
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1693 if (cf1)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1694 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1695 octave_value *tmp = cf1 (*v1.rep);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1696
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1697 if (tmp)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1698 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1699 tv1 = octave_value (tmp);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1700 t1 = tv1.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1701 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1702 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1703 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1704 gripe_cat_op_conv ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1705 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1706 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1707 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1708 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1709 tv1 = v1;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1710
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1711 octave_value tv2;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1712 type_conv_fcn cf2 = v2.numeric_conversion_function ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1713
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1714 if (cf2)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1715 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1716 octave_value *tmp = cf2 (*v2.rep);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1717
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1718 if (tmp)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1719 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1720 tv2 = octave_value (tmp);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1721 t2 = tv2.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1722 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1723 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1724 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1725 gripe_cat_op_conv ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1726 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1727 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1728 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1729 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1730 tv2 = v2;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1731
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1732 if (cf1 || cf2)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1733 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1734 f = octave_value_typeinfo::lookup_cat_op (t1, t2);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1735
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1736 if (f)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1737 retval = f (*tv1.rep, *tv2.rep, ra_idx);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1738 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1739 gripe_cat_op (v1.type_name (), v2.type_name ());
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1740 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1741 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1742 gripe_cat_op (v1.type_name (), v2.type_name ());
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1743 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1744
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1745 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1746 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
1747
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1748 void
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1749 octave_value::print_info (std::ostream& os, const std::string& prefix) const
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1750 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1751 os << prefix << "type_name: " << type_name () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1752 << prefix << "count: " << get_count () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1753 << prefix << "rep info: ";
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1754
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1755 rep->print_info (os, prefix + " ");
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1756 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1757
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1758 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1759 gripe_unary_op (const std::string& on, const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1760 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1761 error ("unary operator `%s' not implemented for `%s' operands",
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1762 on.c_str (), tn.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1763 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1764
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1765 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1766 gripe_unary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1767 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1768 error ("type conversion failed for unary operator `%s'", on.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1769 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1770
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1771 octave_value
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1772 do_unary_op (octave_value::unary_op op, const octave_value& v)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1773 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1774 octave_value retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1775
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1776 int t = v.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1777
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1778 unary_op_fcn f = octave_value_typeinfo::lookup_unary_op (op, t);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1779
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1780 if (f)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1781 retval = f (*v.rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1782 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1783 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1784 octave_value tv;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1785 type_conv_fcn cf = v.numeric_conversion_function ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1786
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1787 if (cf)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1788 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1789 octave_value *tmp = cf (*v.rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1790
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1791 if (tmp)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1792 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1793 tv = octave_value (tmp);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1794 t = tv.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1795
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
1796 f = octave_value_typeinfo::lookup_unary_op (op, t);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1797
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1798 if (f)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1799 retval = f (*tv.rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1800 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1801 gripe_unary_op (octave_value::unary_op_as_string (op),
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1802 v.type_name ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1803 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1804 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1805 gripe_unary_op_conv (octave_value::unary_op_as_string (op));
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1806 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1807 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1808 gripe_unary_op (octave_value::unary_op_as_string (op),
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1809 v.type_name ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1810 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1811
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1812 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1813 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1814
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1815 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1816 gripe_unary_op_conversion_failed (const std::string& op,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1817 const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1818 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1819 error ("operator %s: type conversion for `%s' failed",
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1820 op.c_str (), tn.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1821 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1822
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1823 const octave_value&
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1824 octave_value::do_non_const_unary_op (unary_op op)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1825 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1826 octave_value retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1827
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1828 int t = type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1829
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1830 non_const_unary_op_fcn f
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1831 = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1832
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1833 if (f)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1834 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1835 make_unique ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1836
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1837 f (*rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1838 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1839 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1840 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1841 type_conv_fcn cf = numeric_conversion_function ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1842
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1843 if (cf)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1844 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1845 octave_value *tmp = cf (*rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1846
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1847 if (tmp)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1848 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1849 octave_value *old_rep = rep;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1850 rep = tmp;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1851 rep->count = 1;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1852
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1853 t = type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1854
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1855 f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1856
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1857 if (f)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1858 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1859 f (*rep);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1860
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1861 if (old_rep && --old_rep->count == 0)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1862 delete old_rep;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1863 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1864 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1865 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1866 if (old_rep)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1867 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1868 if (--rep->count == 0)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1869 delete rep;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1870
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1871 rep = old_rep;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1872 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1873
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1874 gripe_unary_op (octave_value::unary_op_as_string (op),
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1875 type_name ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1876 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1877 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1878 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1879 gripe_unary_op_conversion_failed
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1880 (octave_value::unary_op_as_string (op), type_name ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1881 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1882 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1883 gripe_unary_op (octave_value::unary_op_as_string (op), type_name ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1884 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1885
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1886 return *this;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1887 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1888
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1889 #if 0
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1890 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1891 gripe_unary_op_failed_or_no_method (const std::string& on,
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1892 const std::string& tn)
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1893 {
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1894 error ("operator %s: no method, or unable to evaluate for %s operand",
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1895 on.c_str (), tn.c_str ());
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1896 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1897 #endif
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1898
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1899 void
4661
12b6fbd57436 [project @ 2003-11-25 05:41:35 by jwe]
jwe
parents: 4654
diff changeset
1900 octave_value::do_non_const_unary_op (unary_op, const octave_value_list&)
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1901 {
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1902 abort ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1903 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1904
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1905 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1906 octave_value::do_non_const_unary_op (unary_op op, const std::string& type,
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
1907 const std::list<octave_value_list>& idx)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1908 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1909 octave_value retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1910
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1911 if (idx.empty ())
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1912 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1913 do_non_const_unary_op (op);
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1914
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1915 retval = *this;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1916 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1917 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1918 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1919 // XXX FIXME XXX -- only do the following stuff if we can't find a
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1920 // specific function to call to handle the op= operation for the
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1921 // types we have.
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1922
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1923 assign_op assop = unary_op_to_assign_op (op);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1924
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1925 retval = assign (assop, type, idx, 1.0);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1926 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1927
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1928 return retval;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1929 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1930
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1931 // Current indentation.
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1932 int octave_value::curr_print_indent_level = 0;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1933
3018
5708b8bb4f06 [project @ 1997-06-03 21:48:05 by jwe]
jwe
parents: 2979
diff changeset
1934 // TRUE means we are at the beginning of a line.
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1935 bool octave_value::beginning_of_line = true;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1936
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1937 // Each print() function should call this before printing anything.
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1938 //
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1939 // This doesn't need to be fast, but isn't there a better way?
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1940
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1941 void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1942 octave_value::indent (std::ostream& os) const
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1943 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1944 assert (curr_print_indent_level >= 0);
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1945
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1946 if (beginning_of_line)
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1947 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1948 // XXX FIXME XXX -- do we need this?
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1949 // os << prefix;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1950
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1951 for (int i = 0; i < curr_print_indent_level; i++)
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1952 os << " ";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1953
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1954 beginning_of_line = false;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1955 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1956 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1957
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1958 // All print() functions should use this to print new lines.
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1959
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1960 void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1961 octave_value::newline (std::ostream& os) const
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1962 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1963 os << "\n";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1964
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1965 beginning_of_line = true;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1966 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1967
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1968 // For ressetting print state.
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1969
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1970 void
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1971 octave_value::reset (void) const
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1972 {
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1973 beginning_of_line = true;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1974 curr_print_indent_level = 0;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1975 }
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1976
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1977 octave_value::assign_op
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1978 octave_value::unary_op_to_assign_op (unary_op op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1979 {
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1980 assign_op binop = unknown_assign_op;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1981
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1982 switch (op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1983 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1984 case op_incr:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1985 binop = op_add_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1986 break;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1987
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1988 case op_decr:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1989 binop = op_sub_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1990 break;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1991
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1992 default:
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1993 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1994 std::string on = unary_op_as_string (op);
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1995 error ("operator %s: no assign operator found", on.c_str ());
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1996 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1997 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1998
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
1999 return binop;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2000 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2001
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2002 octave_value::binary_op
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2003 octave_value::op_eq_to_binary_op (assign_op op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2004 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2005 binary_op binop = unknown_binary_op;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2006
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2007 switch (op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2008 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2009 case op_add_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2010 binop = op_add;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2011 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2012
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2013 case op_sub_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2014 binop = op_sub;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2015 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2016
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2017 case op_mul_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2018 binop = op_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2019 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2020
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2021 case op_div_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2022 binop = op_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2023 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2024
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2025 case op_ldiv_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2026 binop = op_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2027 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2028
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2029 case op_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2030 binop = op_pow;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2031 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2032
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2033 case op_lshift_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2034 binop = op_lshift;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2035 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2036
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2037 case op_rshift_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2038 binop = op_rshift;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2039 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2040
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2041 case op_el_mul_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2042 binop = op_el_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2043 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2044
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2045 case op_el_div_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2046 binop = op_el_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2047 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2048
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2049 case op_el_ldiv_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2050 binop = op_el_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2051 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2052
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2053 case op_el_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2054 binop = op_el_pow;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2055 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2056
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2057 case op_el_and_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2058 binop = op_el_and;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2059 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2060
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2061 case op_el_or_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2062 binop = op_el_or;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2063 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2064
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2065 default:
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2066 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
2067 std::string on = assign_op_as_string (op);
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2068 error ("operator %s: no binary operator found", on.c_str ());
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2069 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2070 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2071
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2072 return binop;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2073 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2074
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2075 octave_value
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2076 octave_value::empty_conv (const std::string& type, const octave_value& rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2077 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2078 octave_value retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2079
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2080 if (type.length () > 0)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2081 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2082 switch (type[0])
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2083 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2084 case '(':
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2085 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2086 if (type.length () > 1 && type[1] == '.')
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2087 retval = Octave_map ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2088 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2089 retval = octave_value (rhs.empty_clone ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2090 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2091 break;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2092
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2093 case '{':
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2094 retval = Cell ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2095 break;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2096
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2097 case '.':
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2098 retval = Octave_map ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2099 break;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2100
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2101 default:
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2102 panic_impossible ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2103 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2104 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2105 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2106 retval = octave_value (rhs.empty_clone ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2107
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2108 return retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2109 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2110
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2111 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2112 install_types (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2113 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2114 octave_base_value::register_type ();
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3546
diff changeset
2115 octave_cell::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2116 octave_scalar::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2117 octave_complex::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2118 octave_matrix::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2119 octave_complex_matrix::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2120 octave_range::register_type ();
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2121 octave_bool::register_type ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2122 octave_bool_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2123 octave_char_matrix::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2124 octave_char_matrix_str::register_type ();
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2125 octave_int8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2126 octave_int16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2127 octave_int32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2128 octave_int64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2129 octave_uint8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2130 octave_uint16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2131 octave_uint32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2132 octave_uint64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2133 octave_int8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2134 octave_int16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2135 octave_int32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2136 octave_int64_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2137 octave_uint8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2138 octave_uint16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2139 octave_uint32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2140 octave_uint64_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2141 octave_struct::register_type ();
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
2142 octave_file::register_type ();
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
2143 octave_list::register_type ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
2144 octave_cs_list::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2145 octave_all_va_args::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2146 octave_magic_colon::register_type ();
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2147 octave_builtin::register_type ();
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2148 octave_mapper::register_type ();
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2149 octave_user_function::register_type ();
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
2150 octave_dld_function::register_type ();
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
2151 octave_fcn_handle::register_type ();
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
2152 octave_streamoff::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2153 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2154
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2155 DEFUN (sizeof, args, ,
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2156 "-*- texinfo -*-\n\
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2157 @deftypefn {Built-in Function} {} sizeof (@var{val})\n\
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2158 Return the size of @var{val} in bytes\n\
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2159 @end deftypefn")
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2160 {
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2161 octave_value retval;
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2162
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2163 if (args.length () == 1)
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2164 retval = args(0).byte_size ();
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2165 else
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2166 print_usage ("sizeof");
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2167
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2168 return retval;
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2169 }
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2170
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2171 static int
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2172 warn_fortran_indexing (void)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2173 {
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2174 Vwarn_fortran_indexing = check_preference ("warn_fortran_indexing");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2175
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2176 liboctave_wfi_flag = Vwarn_fortran_indexing;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2177
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2178 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2179 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2180
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2181 static int
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2182 warn_imag_to_real (void)
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2183 {
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2184 Vwarn_imag_to_real = check_preference ("warn_imag_to_real");
4257
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2185
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2186 return 0;
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2187 }
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2188
e556870ce8f0 [project @ 2003-01-02 03:14:41 by jwe]
jwe
parents: 4254
diff changeset
2189 static int
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2190 warn_num_to_str (void)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2191 {
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2192 Vwarn_num_to_str = check_preference ("warn_num_to_str");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2193
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2194 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2195 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2196
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2197 static int
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2198 warn_str_to_num (void)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2199 {
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2200 Vwarn_str_to_num = check_preference ("warn_str_to_num");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2201
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2202 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2203 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2204
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2205 static int
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2206 print_answer_id_name (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2207 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2208 Vprint_answer_id_name = check_preference ("print_answer_id_name");
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2209
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2210 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2211 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2212
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2213 static int
4461
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2214 warn_resize_on_range_error (void)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2215 {
4461
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2216 Vwarn_resize_on_range_error
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2217 = check_preference ("warn_resize_on_range_error");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2218
4461
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2219 liboctave_wrore_flag = Vwarn_resize_on_range_error;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2220
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2221 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2222 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2223
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2224 static int
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2225 silent_functions (void)
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2226 {
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2227 Vsilent_functions = check_preference ("silent_functions");
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2228
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2229 return 0;
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2230 }
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2231
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2232 static int
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2233 struct_levels_to_print (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2234 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2235 double val;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2236 if (builtin_real_scalar_variable ("struct_levels_to_print", val)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2237 && ! xisnan (val))
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2238 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2239 int ival = NINT (val);
3961
635209a37bf4 [project @ 2002-06-03 18:15:47 by jwe]
jwe
parents: 3933
diff changeset
2240 if (ival == val)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2241 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2242 Vstruct_levels_to_print = ival;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2243 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2244 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2245 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2246 gripe_invalid_value_specified ("struct_levels_to_print");
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2247 return -1;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2248 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2249
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2250 static int
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2251 warn_divide_by_zero (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2252 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2253 Vwarn_divide_by_zero = check_preference ("warn_divide_by_zero");
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2254
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2255 return 0;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2256 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2257
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2258 void
2909
057273789b87 [project @ 1997-04-30 06:34:32 by jwe]
jwe
parents: 2903
diff changeset
2259 symbols_of_ov (void)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2260 {
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
2261 DEFVAR (print_answer_id_name, true, print_answer_id_name,
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2262 "-*- texinfo -*-\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2263 @defvr {Built-in Variable} print_answer_id_name\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2264 If the value of @code{print_answer_id_name} is nonzero, variable\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2265 names are printed along with the result. Otherwise, only the result\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2266 values are printed. The default value is 1.\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3371
diff changeset
2267 @end defvr");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2268
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
2269 DEFVAR (silent_functions, false, silent_functions,
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2270 "-*- texinfo -*-\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2271 @defvr {Built-in Variable} silent_functions\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2272 If the value of @code{silent_functions} is nonzero, internal output\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2273 from a function is suppressed. Otherwise, the results of expressions\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2274 within a function body that are not terminated with a semicolon will\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2275 have their values printed. The default value is 0.\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2276 \n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2277 For example, if the function\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2278 \n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2279 @example\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2280 function f ()\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2281 2 + 2\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2282 endfunction\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2283 @end example\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2284 \n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2285 @noindent\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2286 is executed, Octave will either print @samp{ans = 4} or nothing\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2287 depending on the value of @code{silent_functions}.\n\
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2288 @end defvr");
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
2289
3258
4964d5391acc [project @ 1999-07-21 21:51:33 by jwe]
jwe
parents: 3219
diff changeset
2290 DEFVAR (struct_levels_to_print, 2.0, struct_levels_to_print,
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3351
diff changeset
2291 "-*- texinfo -*-\n\
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3351
diff changeset
2292 @defvr {Built-in Variable} struct_levels_to_print\n\
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3351
diff changeset
2293 You can tell Octave how many structure levels to display by setting the\n\
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3351
diff changeset
2294 built-in variable @code{struct_levels_to_print}. The default value is 2.\n\
3363
9db3ff0b6913 [project @ 1999-11-19 21:57:35 by jwe]
jwe
parents: 3361
diff changeset
2295 @end defvr");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2296
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
2297 DEFVAR (warn_divide_by_zero, true, warn_divide_by_zero,
3371
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2298 "-*- texinfo -*-\n\
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2299 @defvr {Built-in Variable} warn_divide_by_zero\n\
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2300 If the value of @code{warn_divide_by_zero} is nonzero, a warning\n\
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2301 is issued when Octave encounters a division by zero. If the value is\n\
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2302 0, the warning is omitted. The default value is 1.\n\
86873384cd10 [project @ 1999-11-21 17:31:07 by jwe]
jwe
parents: 3370
diff changeset
2303 @end defvr");
4451
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2304
4455
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2305 DEFVAR (warn_fortran_indexing, false, warn_fortran_indexing,
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2306 "-*- texinfo -*-\n\
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2307 @defvr {Built-in Variable} warn_fortran_indexing\n\
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2308 If the value of @code{warn_fortran_indexing} is nonzero, a warning is\n\
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2309 printed for expressions which select elements of a two-dimensional matrix\n\
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2310 using a single index. The default value is 0.\n\
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2311 @end defvr");
abbf63293766 [project @ 2003-07-11 01:01:16 by jwe]
jwe
parents: 4452
diff changeset
2312
4451
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2313 DEFVAR (warn_imag_to_real, false, warn_imag_to_real,
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2314 "-*- texinfo -*-\n\
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2315 @defvr {Built-in Variable} warn_imag_to_real\n\
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2316 If the value of @code{warn_imag_to_real} is nonzero, a warning is\n\
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2317 printed for implicit conversions of complex numbers to real numbers.\n\
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2318 The default value is 0.\n\
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4434
diff changeset
2319 @end defvr");
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2320
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2321 DEFVAR (warn_num_to_str, true, warn_num_to_str,
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2322 "-*- texinfo -*-\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2323 @defvr {Built-in Variable} warn_num_to_str\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2324 If the value of @code{warn_num_to_str} is nonzero, a warning is\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2325 printed for implicit conversions of numbers to their ASCII character\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2326 equivalents when strings are constructed using a mixture of strings and\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2327 numbers in matrix notation. For example,\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2328 \n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2329 @example\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2330 @group\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2331 [ \"f\", 111, 111 ]\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2332 @result{} \"foo\"\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2333 @end group\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2334 @end example\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2335 elicits a warning if @code{warn_num_to_str} is nonzero. The default\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2336 value is 1.\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2337 @end defvr");
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2338
4461
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2339 DEFVAR (warn_resize_on_range_error, false, warn_resize_on_range_error,
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2340 "-*- texinfo -*-\n\
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2341 @defvr {Built-in Variable} warn_resize_on_range_error\n\
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2342 If the value of @code{warn_resize_on_range_error} is nonzero, print a\n\
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2343 warning when a matrix is resized by an indexed assignment with\n\
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2344 indices outside the current bounds. The default value is 0.\n\
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2345 @end defvr");
af308ca1a354 [project @ 2003-07-11 22:21:17 by jwe]
jwe
parents: 4457
diff changeset
2346
4452
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2347 DEFVAR (warn_str_to_num, false, warn_str_to_num,
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2348 "-*- texinfo -*-\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2349 @defvr {Built-in Variable} warn_str_to_num\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2350 If the value of @code{warn_str_to_num} is nonzero, a warning is printed\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2351 for implicit conversions of strings to their numeric ASCII equivalents.\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2352 For example,\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2353 @example\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2354 @group\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2355 \"abc\" + 0\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2356 @result{} 97 98 99\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2357 @end group\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2358 @end example\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2359 elicits a warning if @code{warn_str_to_num} is nonzero. The default\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2360 value is 0.\n\
f3c21a1d1c62 [project @ 2003-07-09 23:20:18 by jwe]
jwe
parents: 4451
diff changeset
2361 @end defvr");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2362 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2363
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2364 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2365 ;;; Local Variables: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2366 ;;; mode: C++ ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2367 ;;; End: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2368 */