@@ -36,28 +36,28 @@ void ArrayBase::EnsureSize(int inSize) const
36
36
{
37
37
mBase = (char *)hx::GCRealloc (mBase , bytes );
38
38
// atomic data not cleared by gc lib ...
39
- #ifndef GC_CLEARS_ALL
40
- #ifndef GC_CLEARS_OBJECTS
39
+ #ifndef GC_CLEARS_ALL
40
+ #ifndef GC_CLEARS_OBJECTS
41
41
if (AllocAtomic ())
42
- #endif
43
- memset (mBase + obytes, 0 , bytes-obytes);
44
- #endif
42
+ #endif
43
+ memset (mBase + obytes, 0 , bytes-obytes);
44
+ #endif
45
45
}
46
46
else if (AllocAtomic ())
47
47
{
48
48
mBase = (char *)hx::NewGCPrivate (0 ,bytes);
49
49
// atomic data not cleared ...
50
- #ifndef GC_CLEARS_ALL
51
- memset (mBase ,0 ,bytes);
52
- #endif
50
+ #ifndef GC_CLEARS_ALL
51
+ memset (mBase ,0 ,bytes);
52
+ #endif
53
53
}
54
54
else
55
- {
55
+ {
56
56
mBase = (char *)hx::NewGCBytes (0 ,bytes);
57
- #ifndef GC_CLEARS_OBJECTS
58
- memset (mBase ,0 ,bytes);
59
- #endif
60
- }
57
+ #ifndef GC_CLEARS_OBJECTS
58
+ memset (mBase ,0 ,bytes);
59
+ #endif
60
+ }
61
61
}
62
62
length = s;
63
63
}
@@ -69,22 +69,13 @@ void ArrayBase::EnsureSize(int inSize) const
69
69
String ArrayBase::__ToString () const { return " Array" ; }
70
70
String ArrayBase::toString ()
71
71
{
72
- // Byte-array
73
- if (GetElementSize ()== 1 )
72
+ // Byte-array (not bool!)
73
+ if (IsByteArray () )
74
74
{
75
75
return String ( (const char *) mBase , length);
76
76
}
77
77
78
- int n = __length ();
79
- String result (L" [" ,1 );
80
- for (int i=0 ;i<n;i++)
81
- {
82
- result+=(String)__GetItem (i);
83
- if (i+1 <n)
84
- result+=String (L" , " ,1 );
85
- }
86
- result+=String (L" ]" ,1 );
87
- return result;
78
+ return HX_STR (L" [" ) + join (HX_STR (L" , " )) + HX_STR (L" ]" );
88
79
}
89
80
90
81
void ArrayBase::__SetSize (int inSize)
@@ -122,14 +113,14 @@ void ArrayBase::Splice(ArrayBase *outResult,int inPos,int inLen)
122
113
outResult->__SetSize (0 );
123
114
return ;
124
115
}
125
- else if (inPos<0 )
126
- {
127
- inPos += length;
128
- if (inPos<0 )
129
- inPos =0 ;
130
- }
131
- if (inLen<0 )
132
- return ;
116
+ else if (inPos<0 )
117
+ {
118
+ inPos += length;
119
+ if (inPos<0 )
120
+ inPos =0 ;
121
+ }
122
+ if (inLen<0 )
123
+ return ;
133
124
if (inPos+inLen>length)
134
125
inLen = length - inPos;
135
126
@@ -143,15 +134,15 @@ void ArrayBase::Splice(ArrayBase *outResult,int inPos,int inLen)
143
134
void ArrayBase::Slice (ArrayBase *outResult,int inPos,int inEnd)
144
135
{
145
136
if (inPos<0 )
146
- {
147
- inPos += length;
148
- if (inPos<0 )
149
- inPos =0 ;
150
- }
137
+ {
138
+ inPos += length;
139
+ if (inPos<0 )
140
+ inPos =0 ;
141
+ }
151
142
if (inEnd<0 )
152
- inEnd += length;
153
- if (inEnd>length)
154
- inEnd = length;
143
+ inEnd += length;
144
+ if (inEnd>length)
145
+ inEnd = length;
155
146
int n = inEnd - inPos;
156
147
if (n<=0 )
157
148
outResult->__SetSize (0 );
@@ -222,10 +213,10 @@ struct ArrayBase_##func : public hx::Object \
222
213
ArrayBase_##func(ArrayBase *inThis) : mThis (inThis) { } \
223
214
String toString () const { return L###func ; } \
224
215
String __ToString () const { return L###func ; } \
225
- int __GetType () const { return vtFunction; } \
226
- void *__GetHandle () const { return mThis ; } \
227
- int __ArgCount () const { return ARG_C; } \
228
- void __Mark () { MarkMember (mThis ); } \
216
+ int __GetType () const { return vtFunction; } \
217
+ void *__GetHandle () const { return mThis ; } \
218
+ int __ArgCount () const { return ARG_C; } \
219
+ void __Mark () { MarkMember (mThis ); } \
229
220
Dynamic __Run (const Array<Dynamic> &inArgs) \
230
221
{ \
231
222
return mThis ->__ ##func (array_list); return Dynamic (); \
@@ -282,23 +273,23 @@ Dynamic ArrayBase::__Field(const String &inString)
282
273
283
274
284
275
static String sArrayFields [] = {
285
- HX_STRING (L" length" ,6 ),
286
- HX_STRING (L" concat" ,6 ),
287
- HX_STRING (L" insert" ,6 ),
288
- HX_STRING (L" iterator" ,8 ),
289
- HX_STRING (L" join" ,4 ),
290
- HX_STRING (L" copy" ,4 ),
291
- HX_STRING (L" pop" ,3 ),
292
- HX_STRING (L" push" ,4 ),
293
- HX_STRING (L" remove" ,6 ),
294
- HX_STRING (L" reverse" ,7 ),
295
- HX_STRING (L" shift" ,5 ),
296
- HX_STRING (L" slice" ,5 ),
297
- HX_STRING (L" splice" ,6 ),
298
- HX_STRING (L" sort" ,4 ),
299
- HX_STRING (L" toString" ,8 ),
300
- HX_STRING (L" unshift" ,7 ),
301
- String (null ())
276
+ HX_STRING (L" length" ,6 ),
277
+ HX_STRING (L" concat" ,6 ),
278
+ HX_STRING (L" insert" ,6 ),
279
+ HX_STRING (L" iterator" ,8 ),
280
+ HX_STRING (L" join" ,4 ),
281
+ HX_STRING (L" copy" ,4 ),
282
+ HX_STRING (L" pop" ,3 ),
283
+ HX_STRING (L" push" ,4 ),
284
+ HX_STRING (L" remove" ,6 ),
285
+ HX_STRING (L" reverse" ,7 ),
286
+ HX_STRING (L" shift" ,5 ),
287
+ HX_STRING (L" slice" ,5 ),
288
+ HX_STRING (L" splice" ,6 ),
289
+ HX_STRING (L" sort" ,4 ),
290
+ HX_STRING (L" toString" ,8 ),
291
+ HX_STRING (L" unshift" ,7 ),
292
+ String (null ())
302
293
};
303
294
304
295
@@ -309,13 +300,13 @@ Class ArrayBase::__mClass;
309
300
Dynamic ArrayCreateEmpty () { return new Array<Dynamic>(0 ,0 ); }
310
301
Dynamic ArrayCreateArgs (DynamicArray inArgs)
311
302
{
312
- return inArgs->__copy ();
303
+ return inArgs->__copy ();
313
304
}
314
305
315
306
void ArrayBase::__boot ()
316
307
{
317
308
Static (__mClass) = RegisterClass (HX_STRING (L" Array" ,5 ),TCanCast<ArrayBase>,sNone ,sArrayFields ,
318
- ArrayCreateEmpty,ArrayCreateArgs,0 ,0 );
309
+ ArrayCreateEmpty,ArrayCreateArgs,0 ,0 );
319
310
}
320
311
321
312
@@ -336,7 +327,7 @@ Dynamic ArrayIterator::__Field(const String &inString)
336
327
337
328
void ArrayIterator::__Mark ()
338
329
{
339
- MarkMember (mArray );
330
+ MarkMember (mArray );
340
331
}
341
332
342
333
0 commit comments