annotate src/share/vm/utilities/array.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 275a3b7ff0d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // correct linkage required to compile w/o warnings
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // (must be on file level - cannot be local)
a61af66fc99e Initial load
duke
parents:
diff changeset
27 extern "C" { typedef int (*ftype)(const void*, const void*); }
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class ResourceArray: public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 int _length; // the number of array elements
a61af66fc99e Initial load
duke
parents:
diff changeset
33 void* _data; // the array memory
a61af66fc99e Initial load
duke
parents:
diff changeset
34 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
35 int _nesting; // the resource area nesting level
a61af66fc99e Initial load
duke
parents:
diff changeset
36 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
39 ResourceArray() {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 _length = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 _data = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 DEBUG_ONLY(init_nesting();)
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ResourceArray(size_t esize, int length) {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 assert(length >= 0, "illegal length");
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _length = length;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _data = resource_allocate_bytes(esize * length);
a61af66fc99e Initial load
duke
parents:
diff changeset
50 DEBUG_ONLY(init_nesting();)
a61af66fc99e Initial load
duke
parents:
diff changeset
51 }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
54 void init_nesting();
a61af66fc99e Initial load
duke
parents:
diff changeset
55 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
58 void sort (size_t esize, ftype f); // sort the array
a61af66fc99e Initial load
duke
parents:
diff changeset
59 void expand (size_t esize, int i, int& size);// expand the array to include slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
60 void remove_at(size_t esize, int i); // remove the element in slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // standard operations
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 bool is_empty() const { return length() == 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 };
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 class CHeapArray: public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
71 int _length; // the number of array elements
a61af66fc99e Initial load
duke
parents:
diff changeset
72 void* _data; // the array memory
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
75 CHeapArray() {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 _length = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 _data = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 CHeapArray(size_t esize, int length) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 assert(length >= 0, "illegal length");
a61af66fc99e Initial load
duke
parents:
diff changeset
83 _length = length;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 _data = (void*) NEW_C_HEAP_ARRAY(char *, esize * length);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void init_nesting();
a61af66fc99e Initial load
duke
parents:
diff changeset
89 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // helper functions
a61af66fc99e Initial load
duke
parents:
diff changeset
92 void sort (size_t esize, ftype f); // sort the array
a61af66fc99e Initial load
duke
parents:
diff changeset
93 void expand (size_t esize, int i, int& size);// expand the array to include slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
94 void remove_at(size_t esize, int i); // remove the element in slot i
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // standard operations
a61af66fc99e Initial load
duke
parents:
diff changeset
98 int length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool is_empty() const { return length() == 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 };
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #define define_generic_array(array_name,element_type, base_class) \
a61af66fc99e Initial load
duke
parents:
diff changeset
103 class array_name: public base_class { \
a61af66fc99e Initial load
duke
parents:
diff changeset
104 protected: \
a61af66fc99e Initial load
duke
parents:
diff changeset
105 typedef element_type etype; \
a61af66fc99e Initial load
duke
parents:
diff changeset
106 enum { esize = sizeof(etype) }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
107 \
a61af66fc99e Initial load
duke
parents:
diff changeset
108 void base_remove_at(size_t size, int i) { base_class::remove_at(size, i); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
109 \
a61af66fc99e Initial load
duke
parents:
diff changeset
110 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
111 /* creation */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
112 array_name() : base_class() {} \
a61af66fc99e Initial load
duke
parents:
diff changeset
113 array_name(const int length) : base_class(esize, length) {} \
a61af66fc99e Initial load
duke
parents:
diff changeset
114 array_name(const int length, const etype fx) : base_class(esize, length) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
115 for (int i = 0; i < length; i++) ((etype*)_data)[i] = fx; \
a61af66fc99e Initial load
duke
parents:
diff changeset
116 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
117 \
a61af66fc99e Initial load
duke
parents:
diff changeset
118 /* standard operations */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
119 etype& operator [] (const int i) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
120 assert(0 <= i && i < length(), "index out of bounds"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
121 return ((etype*)_data)[i]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
122 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
123 \
a61af66fc99e Initial load
duke
parents:
diff changeset
124 int index_of(const etype x) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
125 int i = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
126 while (i-- > 0 && ((etype*)_data)[i] != x) ; \
a61af66fc99e Initial load
duke
parents:
diff changeset
127 /* i < 0 || ((etype*)_data)_data[i] == x */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return i; \
a61af66fc99e Initial load
duke
parents:
diff changeset
129 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
130 \
a61af66fc99e Initial load
duke
parents:
diff changeset
131 void sort(int f(etype*, etype*)) { base_class::sort(esize, (ftype)f); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
132 bool contains(const etype x) const { return index_of(x) >= 0; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
133 \
a61af66fc99e Initial load
duke
parents:
diff changeset
134 /* deprecated operations - for compatibility with GrowableArray only */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
135 etype at(const int i) const { return (*this)[i]; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
136 void at_put(const int i, const etype x) { (*this)[i] = x; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
137 etype* adr_at(const int i) { return &(*this)[i]; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
138 int find(const etype x) { return index_of(x); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 #define define_array(array_name,element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
143 define_generic_array(array_name, element_type, ResourceArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 #define define_stack(stack_name,array_name) \
a61af66fc99e Initial load
duke
parents:
diff changeset
147 class stack_name: public array_name { \
a61af66fc99e Initial load
duke
parents:
diff changeset
148 protected: \
a61af66fc99e Initial load
duke
parents:
diff changeset
149 int _size; \
a61af66fc99e Initial load
duke
parents:
diff changeset
150 \
a61af66fc99e Initial load
duke
parents:
diff changeset
151 void grow(const int i, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
152 assert(i >= length(), "index too small"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
153 if (i >= size()) expand(esize, i, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
154 for (int j = length(); j <= i; j++) ((etype*)_data)[j] = fx; \
a61af66fc99e Initial load
duke
parents:
diff changeset
155 _length = i+1; \
a61af66fc99e Initial load
duke
parents:
diff changeset
156 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
157 \
a61af66fc99e Initial load
duke
parents:
diff changeset
158 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
159 /* creation */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
160 stack_name() : array_name() { _size = 0; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
161 stack_name(const int size) : array_name(size){ _length = 0; _size = size; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
162 stack_name(const int size, const etype fx) : array_name(size, fx) { _size = size; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
163 \
a61af66fc99e Initial load
duke
parents:
diff changeset
164 /* standard operations */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
165 int size() const { return _size; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
166 \
a61af66fc99e Initial load
duke
parents:
diff changeset
167 void push(const etype x) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
168 if (length() >= size()) expand(esize, length(), _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
169 ((etype*)_data)[_length++] = x; \
a61af66fc99e Initial load
duke
parents:
diff changeset
170 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
171 \
a61af66fc99e Initial load
duke
parents:
diff changeset
172 etype pop() { \
a61af66fc99e Initial load
duke
parents:
diff changeset
173 assert(!is_empty(), "stack is empty"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
174 return ((etype*)_data)[--_length]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
175 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
176 \
a61af66fc99e Initial load
duke
parents:
diff changeset
177 etype top() const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
178 assert(!is_empty(), "stack is empty"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
179 return ((etype*)_data)[length() - 1]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
180 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
181 \
a61af66fc99e Initial load
duke
parents:
diff changeset
182 void push_all(const stack_name* stack) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
183 const int l = stack->length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
184 for (int i = 0; i < l; i++) push(((etype*)(stack->_data))[i]); \
a61af66fc99e Initial load
duke
parents:
diff changeset
185 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
186 \
a61af66fc99e Initial load
duke
parents:
diff changeset
187 etype at_grow(const int i, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if (i >= length()) grow(i, fx); \
a61af66fc99e Initial load
duke
parents:
diff changeset
189 return ((etype*)_data)[i]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
190 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
191 \
a61af66fc99e Initial load
duke
parents:
diff changeset
192 void at_put_grow(const int i, const etype x, const etype fx) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
193 if (i >= length()) grow(i, fx); \
a61af66fc99e Initial load
duke
parents:
diff changeset
194 ((etype*)_data)[i] = x; \
a61af66fc99e Initial load
duke
parents:
diff changeset
195 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
196 \
a61af66fc99e Initial load
duke
parents:
diff changeset
197 void truncate(const int length) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
198 assert(0 <= length && length <= this->length(), "illegal length"); \
a61af66fc99e Initial load
duke
parents:
diff changeset
199 _length = length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
200 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
201 \
a61af66fc99e Initial load
duke
parents:
diff changeset
202 void remove_at(int i) { base_remove_at(esize, i); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
203 void remove(etype x) { remove_at(index_of(x)); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
204 \
a61af66fc99e Initial load
duke
parents:
diff changeset
205 /* inserts the given element before the element at index i */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
206 void insert_before(const int i, const etype el) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
207 int len = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
208 int new_length = len + 1; \
a61af66fc99e Initial load
duke
parents:
diff changeset
209 if (new_length >= size()) expand(esize, new_length, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
210 for (int j = len - 1; j >= i; j--) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
211 ((etype*)_data)[j + 1] = ((etype*)_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
212 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
213 _length = new_length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
214 at_put(i, el); \
a61af66fc99e Initial load
duke
parents:
diff changeset
215 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
216 \
a61af66fc99e Initial load
duke
parents:
diff changeset
217 /* inserts contents of the given stack before the element at index i */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
218 void insert_before(const int i, const stack_name *st) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
219 if (st->length() == 0) return; \
a61af66fc99e Initial load
duke
parents:
diff changeset
220 int len = length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
221 int st_len = st->length(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
222 int new_length = len + st_len; \
a61af66fc99e Initial load
duke
parents:
diff changeset
223 if (new_length >= size()) expand(esize, new_length, _size); \
a61af66fc99e Initial load
duke
parents:
diff changeset
224 int j; \
a61af66fc99e Initial load
duke
parents:
diff changeset
225 for (j = len - 1; j >= i; j--) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
226 ((etype*)_data)[j + st_len] = ((etype*)_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
227 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
228 for (j = 0; j < st_len; j++) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
229 ((etype*)_data)[i + j] = ((etype*)st->_data)[j]; \
a61af66fc99e Initial load
duke
parents:
diff changeset
230 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
231 _length = new_length; \
a61af66fc99e Initial load
duke
parents:
diff changeset
232 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
233 \
a61af66fc99e Initial load
duke
parents:
diff changeset
234 /* deprecated operations - for compatibility with GrowableArray only */ \
a61af66fc99e Initial load
duke
parents:
diff changeset
235 int capacity() const { return size(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
236 void clear() { truncate(0); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
237 void trunc_to(const int length) { truncate(length); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
238 void append(const etype x) { push(x); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
239 void appendAll(const stack_name* stack) { push_all(stack); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
240 etype last() const { return top(); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }; \
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 #define define_resource_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
245 define_generic_array(element_type##Array, element_type, ResourceArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
246 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 #define define_resource_pointer_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
249 define_generic_array(element_type##Array, element_type *, ResourceArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
250 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
251
a61af66fc99e Initial load
duke
parents:
diff changeset
252 #define define_c_heap_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
253 define_generic_array(element_type##Array, element_type, CHeapArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
254 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 #define define_c_heap_pointer_list(element_type) \
a61af66fc99e Initial load
duke
parents:
diff changeset
257 define_generic_array(element_type##Array, element_type *, CHeapArray) \
a61af66fc99e Initial load
duke
parents:
diff changeset
258 define_stack(element_type##List, element_type##Array)
a61af66fc99e Initial load
duke
parents:
diff changeset
259
a61af66fc99e Initial load
duke
parents:
diff changeset
260
a61af66fc99e Initial load
duke
parents:
diff changeset
261 // Arrays for basic types
a61af66fc99e Initial load
duke
parents:
diff changeset
262
a61af66fc99e Initial load
duke
parents:
diff changeset
263 define_array(boolArray, bool) define_stack(boolStack, boolArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
264 define_array(intArray , int ) define_stack(intStack , intArray )