6257
|
1 ## Copyright (C) 2005 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __uiobject_grow_list__ () |
|
22 ## Create or increase the size of @code{__uiobject_list__}. |
|
23 ## @end deftypefn |
|
24 |
|
25 ## Author: jwe |
|
26 |
|
27 function __uiobject_grow_list__ () |
|
28 |
|
29 __uiobject_globals__; |
|
30 |
|
31 if (nargin == 0) |
|
32 static grow_size = 100; |
|
33 curr_size = length (__uiobject_list__); |
|
34 new_size = curr_size + grow_size; |
|
35 __uiobject_list__(new_size).next = 0; |
|
36 __uiobject_list__(new_size).in_use = false; |
|
37 __uiobject_list__(new_size).handle = NaN; |
|
38 __uiobject_list__(new_size).object = NaN; |
|
39 if (curr_size) |
|
40 __uiobject_list__(curr_size).next = curr_size+1; |
|
41 __uiobject_list__(curr_size).in_use = false; |
|
42 __uiobject_list__(curr_size).handle = NaN; |
|
43 __uiobject_list__(curr_size).object = NaN; |
|
44 endif |
|
45 for i = new_size-1:-1:curr_size+1 |
|
46 __uiobject_list__(i).next = i+1; |
|
47 __uiobject_list__(i).in_use = false; |
|
48 __uiobject_list__(i).handle = NaN; |
|
49 __uiobject_list__(i).object = NaN; |
|
50 endfor |
|
51 __uiobject_head__ = curr_size+1; |
|
52 else |
|
53 print_usage (); |
|
54 endif |
|
55 endfunction |