Mercurial > hg > octave-nkf
annotate src/oct-obj.cc @ 15536:2e8eb9ac43a5 stable rc-3-6-4-0
3.6.4-rc0 release candidate
* configure.ac (AC_INIT): Version is now 3.6.2-rc0.
(OCTAVE_RELEASE_DATE): Now 2012-05-11.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Oct 2012 10:05:44 -0400 |
parents | 72c96de7a403 |
children | f7afecdd87ef |
rev | line source |
---|---|
517 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13917
diff
changeset
|
3 Copyright (C) 1994-2012 John W. Eaton |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
4 Copyright (C) 2009 VZLU Prague |
517 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
517 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
517 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
1192 | 25 #include <config.h> |
517 | 26 #endif |
27 | |
1968 | 28 #include "error.h" |
1742 | 29 #include "oct-obj.h" |
8546
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
30 #include "Cell.h" |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
31 |
13917
826f008c829b
* oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
32 // We are likely to have a lot of octave_value_list objects to allocate, |
826f008c829b
* oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
33 // so make the grow_size large. |
826f008c829b
* oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
34 DEFINE_OCTAVE_ALLOCATOR2(octave_value_list, 1024); |
826f008c829b
* oct-obj.h, oct-obj.cc: Use macros to declare and define octave_allocator.
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
35 |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
36 octave_value_list::octave_value_list (const std::list<octave_value_list>& lst) |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
37 { |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
38 octave_idx_type n = 0, nel = 0; |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
39 |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
40 // Determine number. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
41 for (std::list<octave_value_list>::const_iterator p = lst.begin (); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
42 p != lst.end (); p++) |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
43 { |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
44 n++; |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
45 nel += p->length (); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
46 } |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
47 |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
48 // Optimize single-element case |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
49 if (n == 1) |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
50 data = lst.front ().data; |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
51 else if (nel > 0) |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
52 { |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11568
diff
changeset
|
53 data.resize (dim_vector (1, nel)); |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
54 octave_idx_type k = 0; |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
55 for (std::list<octave_value_list>::const_iterator p = lst.begin (); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
56 p != lst.end (); p++) |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
57 { |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
58 data.assign (idx_vector (k, k + p->length ()), p->data); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
59 k += p->length (); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
60 } |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
61 assert (k == nel); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
62 } |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
63 |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
64 } |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
65 |
2872 | 66 octave_value_list& |
67 octave_value_list::prepend (const octave_value& val) | |
68 { | |
5275 | 69 octave_idx_type n = length (); |
2872 | 70 |
71 resize (n + 1); | |
72 | |
73 while (n > 0) | |
74 { | |
75 elem (n) = elem (n - 1); | |
76 n--; | |
77 } | |
78 | |
79 elem (0) = val; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
80 |
2872 | 81 return *this; |
82 } | |
83 | |
84 octave_value_list& | |
85 octave_value_list::append (const octave_value& val) | |
86 { | |
5275 | 87 octave_idx_type n = length (); |
2872 | 88 |
89 resize (n + 1); | |
90 | |
91 elem (n) = val; | |
92 | |
93 return *this; | |
94 } | |
95 | |
96 octave_value_list& | |
97 octave_value_list::append (const octave_value_list& lst) | |
98 { | |
5275 | 99 octave_idx_type len = length (); |
100 octave_idx_type lst_len = lst.length (); | |
2872 | 101 |
102 resize (len + lst_len); | |
103 | |
5275 | 104 for (octave_idx_type i = 0; i < lst_len; i++) |
2872 | 105 elem (len + i) = lst (i); |
106 | |
107 return *this; | |
108 } | |
109 | |
110 octave_value_list& | |
111 octave_value_list::reverse (void) | |
112 { | |
5275 | 113 octave_idx_type n = length (); |
2872 | 114 |
5275 | 115 for (octave_idx_type i = 0; i < n / 2; i++) |
2872 | 116 { |
117 octave_value tmp = elem (i); | |
118 elem (i) = elem (n - i - 1); | |
119 elem (n - i - 1) = tmp; | |
120 } | |
121 | |
122 return *this; | |
123 } | |
124 | |
3195 | 125 octave_value_list |
5275 | 126 octave_value_list::splice (octave_idx_type offset, octave_idx_type rep_length, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
127 const octave_value_list& lst) const |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
128 { |
3195 | 129 octave_value_list retval; |
130 | |
5275 | 131 octave_idx_type len = length (); |
3195 | 132 |
133 if (offset < 0 || offset >= len) | |
134 { | |
3219 | 135 if (! (rep_length == 0 && offset == len)) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
136 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
137 error ("octave_value_list::splice: invalid OFFSET"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
138 return retval; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
139 } |
3195 | 140 } |
141 | |
142 if (rep_length < 0 || rep_length + offset > len) | |
143 { | |
144 error ("octave_value_list::splice: invalid LENGTH"); | |
145 return retval; | |
146 } | |
147 | |
5275 | 148 octave_idx_type lst_len = lst.length (); |
3195 | 149 |
5275 | 150 octave_idx_type new_len = len - rep_length + lst_len; |
3195 | 151 |
152 retval.resize (new_len); | |
153 | |
5275 | 154 octave_idx_type k = 0; |
3195 | 155 |
5275 | 156 for (octave_idx_type i = 0; i < offset; i++) |
3195 | 157 retval(k++) = elem (i); |
158 | |
5275 | 159 for (octave_idx_type i = 0; i < lst_len; i++) |
3195 | 160 retval(k++) = lst(i); |
161 | |
5275 | 162 for (octave_idx_type i = offset + rep_length; i < len; i++) |
3195 | 163 retval(k++) = elem (i); |
164 | |
165 return retval; | |
166 } | |
167 | |
2872 | 168 bool |
169 octave_value_list::all_strings_p (void) const | |
1968 | 170 { |
5275 | 171 octave_idx_type n = length (); |
517 | 172 |
5275 | 173 for (octave_idx_type i = 0; i < n; i++) |
1968 | 174 if (! elem(i).is_string ()) |
5846 | 175 return false; |
176 | |
177 return true; | |
178 } | |
1746 | 179 |
5846 | 180 bool |
8455
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
181 octave_value_list::all_scalars (void) const |
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
182 { |
11568
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
183 octave_idx_type n = length (); |
8455
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
184 |
11568
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
185 for (octave_idx_type i = 0; i < n; i++) |
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
186 { |
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
187 dim_vector dv = elem(i).dims (); |
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
188 if (! dv.all_ones ()) |
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
189 return false; |
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
190 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
191 |
11568
de5fba8337c5
octave_value_list::all_scalars: test for scalars, not strings
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
192 return true; |
8455
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
193 } |
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
194 |
fd11a08a9b31
disallow invalid {}-indexed assigments
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
195 bool |
10086
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
196 octave_value_list::any_cell (void) const |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
197 { |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
198 octave_idx_type n = length (); |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
199 |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
200 for (octave_idx_type i = 0; i < n; i++) |
10099
29959c705df2
avoid assignment in condition of if statement
John W. Eaton <jwe@octave.org>
parents:
10086
diff
changeset
|
201 if (elem (i).is_cell ()) |
29959c705df2
avoid assignment in condition of if statement
John W. Eaton <jwe@octave.org>
parents:
10086
diff
changeset
|
202 return true; |
29959c705df2
avoid assignment in condition of if statement
John W. Eaton <jwe@octave.org>
parents:
10086
diff
changeset
|
203 |
29959c705df2
avoid assignment in condition of if statement
John W. Eaton <jwe@octave.org>
parents:
10086
diff
changeset
|
204 return false; |
10086
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
205 } |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
206 |
76df75b10c80
allow more cells in strfind/strrep + supply a general mechanism
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
207 bool |
5846 | 208 octave_value_list::has_magic_colon (void) const |
209 { | |
210 octave_idx_type n = length (); | |
211 | |
212 for (octave_idx_type i = 0; i < n; i++) | |
213 if (elem(i).is_magic_colon ()) | |
214 return true; | |
215 | |
216 return false; | |
517 | 217 } |
218 | |
1968 | 219 string_vector |
3523 | 220 octave_value_list::make_argv (const std::string& fcn_name) const |
517 | 221 { |
1968 | 222 string_vector argv; |
223 | |
2872 | 224 if (all_strings_p ()) |
1968 | 225 { |
5275 | 226 octave_idx_type len = length (); |
3180 | 227 |
5275 | 228 octave_idx_type total_nr = 0; |
3180 | 229 |
5275 | 230 for (octave_idx_type i = 0; i < len; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
231 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
232 // An empty std::string ("") has zero columns and zero rows (a |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
233 // change that was made for Matlab contemptibility. |
3264 | 234 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
235 octave_idx_type n = elem(i).rows (); |
3264 | 236 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
237 total_nr += n ? n : 1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
238 } |
3180 | 239 |
8034
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
240 octave_idx_type k = 0; |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
241 if (! fcn_name.empty ()) |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
242 { |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
243 argv.resize (total_nr+1); |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
244 argv[0] = fcn_name; |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
245 k = 1; |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
246 } |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
247 else |
f61bd8e0d682
fix default_save_options parsing and allow mixing options with other arguments.
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
248 argv.resize (total_nr); |
3180 | 249 |
5275 | 250 for (octave_idx_type i = 0; i < len; i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
251 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
252 octave_idx_type nr = elem(i).rows (); |
3180 | 253 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
254 if (nr < 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
255 argv[k++] = elem(i).string_value (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
256 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
257 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
258 string_vector tmp = elem(i).all_strings (); |
3180 | 259 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
260 for (octave_idx_type j = 0; j < nr; j++) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
261 argv[k++] = tmp[j]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
262 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
263 } |
1968 | 264 } |
265 else | |
266 error ("%s: expecting all arguments to be strings", fcn_name.c_str ()); | |
517 | 267 |
1968 | 268 return argv; |
517 | 269 } |
270 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8034
diff
changeset
|
271 void |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8455
diff
changeset
|
272 octave_value_list::make_storable_values (void) |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8034
diff
changeset
|
273 { |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8034
diff
changeset
|
274 octave_idx_type len = length (); |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
275 const Array<octave_value>& cdata = data; |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
276 |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8034
diff
changeset
|
277 for (octave_idx_type i = 0; i < len; i++) |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
278 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
279 // This is optimized so that we don't force a copy unless necessary. |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
280 octave_value tmp = cdata(i).storable_value (); |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
281 if (! tmp.is_copy_of (cdata (i))) |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
282 data(i) = tmp; |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
283 } |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8034
diff
changeset
|
284 } |