ecere/com/containers; sys/File: Fixed refCount of deserialized containers, Files
[sdk] / compiler / bootstrap / ecere / bootstrap / BTNode.c
1 /* Code generated from eC source file: BTNode.ec */
2 #if defined(_WIN32)
3 #define __runtimePlatform 1
4 #elif defined(__APPLE__)
5 #define __runtimePlatform 3
6 #else
7 #define __runtimePlatform 2
8 #endif
9 #if defined(__GNUC__)
10 typedef long long int64;
11 typedef unsigned long long uint64;
12 #ifndef _WIN32
13 #define __declspec(x)
14 #endif
15 #elif defined(__TINYC__)
16 #include <stdarg.h>
17 #define __builtin_va_list va_list
18 #define __builtin_va_start va_start
19 #define __builtin_va_end va_end
20 #ifdef _WIN32
21 #define strcasecmp stricmp
22 #define strncasecmp strnicmp
23 #define __declspec(x) __attribute__((x))
24 #else
25 #define __declspec(x)
26 #endif
27 typedef long long int64;
28 typedef unsigned long long uint64;
29 #else
30 typedef __int64 int64;
31 typedef unsigned __int64 uint64;
32 #endif
33 #ifdef __BIG_ENDIAN__
34 #define __ENDIAN_PAD(x) (8 - (x))
35 #else
36 #define __ENDIAN_PAD(x) 0
37 #endif
38 #if defined(_WIN32)
39 #   if defined(__GNUC__) || defined(__TINYC__)
40 #      define ecere_stdcall __attribute__((__stdcall__))
41 #      define ecere_gcc_struct __attribute__((gcc_struct))
42 #   else
43 #      define ecere_stdcall __stdcall
44 #      define ecere_gcc_struct
45 #   endif
46 #else
47 #   define ecere_stdcall
48 #   define ecere_gcc_struct
49 #endif
50 #include <stdint.h>
51 #include <sys/types.h>
52 typedef __builtin_va_list va_list;
53
54 struct __ecereNameSpace__ecere__sys__OldList
55 {
56 void *  first;
57 void *  last;
58 int count;
59 unsigned int offset;
60 unsigned int circ;
61 } ecere_gcc_struct;
62
63 struct __ecereNameSpace__ecere__com__DataValue
64 {
65 union
66 {
67 char c;
68 unsigned char uc;
69 short s;
70 unsigned short us;
71 int i;
72 unsigned int ui;
73 void *  p;
74 float f;
75 double d;
76 long long i64;
77 uint64 ui64;
78 } ecere_gcc_struct __anon1;
79 } ecere_gcc_struct;
80
81 struct __ecereNameSpace__ecere__com__SerialBuffer
82 {
83 unsigned char *  _buffer;
84 unsigned int count;
85 unsigned int _size;
86 unsigned int pos;
87 } ecere_gcc_struct;
88
89 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
90
91 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
92
93 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
94
95 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
96
97 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
98
99 extern int vsprintf(char * , const char * , __builtin_va_list);
100
101 extern size_t strlen(const char * );
102
103 extern int strcmp(const char * , const char * );
104
105 extern int strncmp(const char * , const char * , size_t n);
106
107 extern char *  strcat(char * , const char * );
108
109 extern int sprintf(char * , const char * , ...);
110
111 extern int printf(const char * , ...);
112
113 struct __ecereNameSpace__ecere__com__GlobalFunction;
114
115 void __ecereNameSpace__ecere__sys__strcatf(char * string, const char * format, ...)
116 {
117 va_list args;
118
119 __builtin_va_start(args, format);
120 vsprintf(string + strlen(string), format, args);
121 __builtin_va_end(args);
122 }
123
124 struct __ecereNameSpace__ecere__com__Property;
125
126 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
127
128 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_prev, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_prev;
129
130 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_next, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_next;
131
132 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_minimum, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_minimum;
133
134 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_maximum, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_maximum;
135
136 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_count, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_count;
137
138 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_depthProp, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_depthProp;
139
140 static __attribute__((unused)) struct __ecereNameSpace__ecere__com__Property * __ecereProp___ecereNameSpace__ecere__sys__BTNode_balanceFactor, * __ecerePropM___ecereNameSpace__ecere__sys__BTNode_balanceFactor;
141
142 struct __ecereNameSpace__ecere__sys__BTNode;
143
144 struct __ecereNameSpace__ecere__sys__BTNode
145 {
146 uintptr_t key;
147 struct __ecereNameSpace__ecere__sys__BTNode * parent, * left, * right;
148 int depth;
149 } ecere_gcc_struct;
150
151 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_minimum(struct __ecereNameSpace__ecere__sys__BTNode * this)
152 {
153 while(this->left)
154 this = this->left;
155 return this;
156 }
157
158 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_maximum(struct __ecereNameSpace__ecere__sys__BTNode * this)
159 {
160 while(this->right)
161 this = this->right;
162 return this;
163 }
164
165 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindString(struct __ecereNameSpace__ecere__sys__BTNode * this, const char * key)
166 {
167 while(this)
168 {
169 int result;
170
171 if(key && this->key)
172 result = strcmp(key, (const char *)this->key);
173 else if(key && !this->key)
174 result = 1;
175 else if(!key && this->key)
176 result = -1;
177 else
178 result = 0;
179 if(result < 0)
180 this = this->left;
181 else if(result > 0)
182 this = this->right;
183 else
184 break;
185 }
186 return this;
187 }
188
189 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindPrefix(struct __ecereNameSpace__ecere__sys__BTNode * this, const char * key)
190 {
191 struct __ecereNameSpace__ecere__sys__BTNode * subString = (((void *)0));
192 int len = key ? strlen(key) : 0;
193
194 while(this)
195 {
196 int result;
197
198 if(key && this->key)
199 result = strcmp(key, (const char *)this->key);
200 else if(key && !this->key)
201 result = 1;
202 else if(!key && this->key)
203 result = -1;
204 else
205 result = 0;
206 if(result < 0)
207 {
208 if(!strncmp(key, (const char *)this->key, len))
209 subString = this;
210 this = this->left;
211 }
212 else if(result > 0)
213 this = this->right;
214 else
215 {
216 subString = this;
217 break;
218 }
219 }
220 return subString;
221 }
222
223 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_RemoveSwap(struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__sys__BTNode * swap)
224 {
225 if(swap->left)
226 {
227 swap->left->parent = swap->parent;
228 if(swap == swap->parent->left)
229 swap->parent->left = swap->left;
230 else if(swap == swap->parent->right)
231 swap->parent->right = swap->left;
232 swap->left = (((void *)0));
233 }
234 if(swap->right)
235 {
236 swap->right->parent = swap->parent;
237 if(swap == swap->parent->left)
238 swap->parent->left = swap->right;
239 else if(swap == swap->parent->right)
240 swap->parent->right = swap->right;
241 swap->right = (((void *)0));
242 }
243 if(swap == swap->parent->left)
244 swap->parent->left = (((void *)0));
245 else if(swap == swap->parent->right)
246 swap->parent->right = (((void *)0));
247 {
248 struct __ecereNameSpace__ecere__sys__BTNode * n;
249
250 for(n = swap->parent; n; n = n->parent)
251 {
252 int __simpleStruct0, __simpleStruct1;
253 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
254
255 if(newDepth == n->depth)
256 break;
257 n->depth = newDepth;
258 if(n == this)
259 break;
260 }
261 }
262 {
263 swap->left = this->left;
264 if(this->left)
265 this->left->parent = swap;
266 }
267 {
268 swap->right = this->right;
269 if(this->right)
270 this->right->parent = swap;
271 }
272 swap->parent = this->parent;
273 this->left = (((void *)0));
274 this->right = (((void *)0));
275 if(this->parent)
276 {
277 if(this == this->parent->left)
278 this->parent->left = swap;
279 else if(this == this->parent->right)
280 this->parent->right = swap;
281 }
282 }
283
284 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(struct __ecereNameSpace__ecere__sys__BTNode * this)
285 {
286 int leftDepth = this->left ? (this->left->depth + 1) : 0;
287 int rightDepth = this->right ? (this->right->depth + 1) : 0;
288
289 return rightDepth - leftDepth;
290 }
291
292 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateRight(struct __ecereNameSpace__ecere__sys__BTNode * this)
293 {
294 int __simpleStruct2, __simpleStruct3;
295 int __simpleStruct0, __simpleStruct1;
296
297 if(this->parent)
298 {
299 if(this == this->parent->left)
300 this->parent->left = this->left;
301 else if(this == this->parent->right)
302 this->parent->right = this->left;
303 }
304 this->left->parent = this->parent;
305 this->parent = this->left;
306 this->left = this->parent->right;
307 if(this->left)
308 this->left->parent = this;
309 this->parent->right = this;
310 this->depth = (__simpleStruct0 = this->left ? (this->left->depth + 1) : 0, __simpleStruct1 = this->right ? (this->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
311 this->parent->depth = (__simpleStruct2 = this->parent->left ? (this->parent->left->depth + 1) : 0, __simpleStruct3 = this->parent->right ? (this->parent->right->depth + 1) : 0, (__simpleStruct2 > __simpleStruct3) ? __simpleStruct2 : __simpleStruct3);
312 {
313 struct __ecereNameSpace__ecere__sys__BTNode * n;
314
315 for(n = this->parent->parent; n; n = n->parent)
316 {
317 int __simpleStruct0, __simpleStruct1;
318 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
319
320 if(newDepth == n->depth)
321 break;
322 n->depth = newDepth;
323 }
324 }
325 }
326
327 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateLeft(struct __ecereNameSpace__ecere__sys__BTNode * this)
328 {
329 int __simpleStruct2, __simpleStruct3;
330 int __simpleStruct0, __simpleStruct1;
331
332 if(this->parent)
333 {
334 if(this == this->parent->right)
335 this->parent->right = this->right;
336 else if(this == this->parent->left)
337 this->parent->left = this->right;
338 }
339 this->right->parent = this->parent;
340 this->parent = this->right;
341 this->right = this->parent->left;
342 if(this->right)
343 this->right->parent = this;
344 this->parent->left = this;
345 this->depth = (__simpleStruct0 = this->left ? (this->left->depth + 1) : 0, __simpleStruct1 = this->right ? (this->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
346 this->parent->depth = (__simpleStruct2 = this->parent->left ? (this->parent->left->depth + 1) : 0, __simpleStruct3 = this->parent->right ? (this->parent->right->depth + 1) : 0, (__simpleStruct2 > __simpleStruct3) ? __simpleStruct2 : __simpleStruct3);
347 {
348 struct __ecereNameSpace__ecere__sys__BTNode * n;
349
350 for(n = this->parent->parent; n; n = n->parent)
351 {
352 int __simpleStruct0, __simpleStruct1;
353 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
354
355 if(newDepth == n->depth)
356 break;
357 n->depth = newDepth;
358 }
359 }
360 }
361
362 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(struct __ecereNameSpace__ecere__sys__BTNode * this);
363
364 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_maximum(struct __ecereNameSpace__ecere__sys__BTNode * this);
365
366 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_minimum(struct __ecereNameSpace__ecere__sys__BTNode * this);
367
368 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_count(struct __ecereNameSpace__ecere__sys__BTNode * this);
369
370 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(struct __ecereNameSpace__ecere__sys__BTNode * this);
371
372 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_DoubleRotateRight(struct __ecereNameSpace__ecere__sys__BTNode * this)
373 {
374 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateLeft(this->left);
375 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateRight(this);
376 }
377
378 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_DoubleRotateLeft(struct __ecereNameSpace__ecere__sys__BTNode * this)
379 {
380 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateRight(this->right);
381 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateLeft(this);
382 }
383
384 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(struct __ecereNameSpace__ecere__sys__BTNode * this)
385 {
386 int leftDepth = this->left ? (__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this->left) + 1) : 0;
387 int rightDepth = this->right ? (__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this->right) + 1) : 0;
388
389 return ((leftDepth > rightDepth) ? leftDepth : rightDepth);
390 }
391
392 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_prev(struct __ecereNameSpace__ecere__sys__BTNode * this)
393 {
394 if(this->left)
395 return __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_maximum(this->left);
396 while(this)
397 {
398 if(this->parent && this == this->parent->right)
399 return this->parent;
400 else
401 this = this->parent;
402 }
403 return this;
404 }
405
406 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this)
407 {
408 struct __ecereNameSpace__ecere__sys__BTNode * right = this->right;
409
410 if(right)
411 return __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_minimum(right);
412 while(this)
413 {
414 struct __ecereNameSpace__ecere__sys__BTNode * parent = this->parent;
415
416 if(parent && this == parent->left)
417 return parent;
418 else
419 this = parent;
420 }
421 return (((void *)0));
422 }
423
424 int __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_count(struct __ecereNameSpace__ecere__sys__BTNode * this)
425 {
426 return 1 + (this->left ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_count(this->left) : 0) + (this->right ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_count(this->right) : 0);
427 }
428
429 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(struct __ecereNameSpace__ecere__sys__BTNode * this)
430 {
431 while(1)
432 {
433 int factor = __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(this);
434
435 if(factor < -1)
436 {
437 if(__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(this->left) == 1)
438 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_DoubleRotateRight(this);
439 else
440 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateRight(this);
441 }
442 else if(factor > 1)
443 {
444 if(__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(this->right) == -1)
445 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_DoubleRotateLeft(this);
446 else
447 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_SingleRotateLeft(this);
448 }
449 if(this->parent)
450 this = this->parent;
451 else
452 return this;
453 }
454 }
455
456 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_RemoveSwapLeft(struct __ecereNameSpace__ecere__sys__BTNode * this)
457 {
458 struct __ecereNameSpace__ecere__sys__BTNode * swap = this->left ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_maximum(this->left) : this->right;
459 struct __ecereNameSpace__ecere__sys__BTNode * swapParent = (((void *)0));
460
461 if(swap)
462 {
463 swapParent = swap->parent;
464 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_RemoveSwap(this, swap);
465 }
466 if(this->parent)
467 {
468 if(this == this->parent->left)
469 this->parent->left = (((void *)0));
470 else if(this == this->parent->right)
471 this->parent->right = (((void *)0));
472 }
473 {
474 struct __ecereNameSpace__ecere__sys__BTNode * n;
475
476 for(n = swap ? swap : this->parent; n; n = n->parent)
477 {
478 int __simpleStruct0, __simpleStruct1;
479 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
480
481 if(newDepth == n->depth && n != swap)
482 break;
483 n->depth = newDepth;
484 }
485 }
486 if(swapParent && swapParent != this)
487 return __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(swapParent);
488 else if(swap)
489 return __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(swap);
490 else if(this->parent)
491 return __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(this->parent);
492 else
493 return (((void *)0));
494 }
495
496 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_RemoveSwapRight(struct __ecereNameSpace__ecere__sys__BTNode * this)
497 {
498 struct __ecereNameSpace__ecere__sys__BTNode * result;
499 struct __ecereNameSpace__ecere__sys__BTNode * swap = this->right ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_minimum(this->right) : this->left;
500 struct __ecereNameSpace__ecere__sys__BTNode * swapParent = (((void *)0));
501
502 if(swap)
503 {
504 swapParent = swap->parent;
505 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_RemoveSwap(this, swap);
506 }
507 if(this->parent)
508 {
509 if(this == this->parent->left)
510 this->parent->left = (((void *)0));
511 else if(this == this->parent->right)
512 this->parent->right = (((void *)0));
513 }
514 {
515 struct __ecereNameSpace__ecere__sys__BTNode * n;
516
517 for(n = swap ? swap : this->parent; n; n = n->parent)
518 {
519 int __simpleStruct0, __simpleStruct1;
520 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
521
522 if(newDepth == n->depth && n != swap)
523 break;
524 n->depth = newDepth;
525 }
526 }
527 if(swapParent && swapParent != this)
528 result = __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(swapParent);
529 else if(swap)
530 result = __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(swap);
531 else if(this->parent)
532 result = __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Rebalance(this->parent);
533 else
534 result = (((void *)0));
535 return result;
536 }
537
538 struct __ecereNameSpace__ecere__com__Class;
539
540 struct __ecereNameSpace__ecere__com__Instance
541 {
542 void * *  _vTbl;
543 struct __ecereNameSpace__ecere__com__Class * _class;
544 int _refCount;
545 } ecere_gcc_struct;
546
547 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
548
549 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
550
551 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
552
553 extern void __ecereNameSpace__ecere__com__eEnum_AddFixedValue(struct __ecereNameSpace__ecere__com__Class * _class, const char *  string, long long value);
554
555 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_AddProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  dataType, void *  setStmt, void *  getStmt, int declMode);
556
557 struct __ecereNameSpace__ecere__com__Property
558 {
559 struct __ecereNameSpace__ecere__com__Property * prev;
560 struct __ecereNameSpace__ecere__com__Property * next;
561 const char *  name;
562 unsigned int isProperty;
563 int memberAccess;
564 int id;
565 struct __ecereNameSpace__ecere__com__Class * _class;
566 const char *  dataTypeString;
567 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
568 struct __ecereNameSpace__ecere__com__Instance * dataType;
569 void (*  Set)(void * , int);
570 int (*  Get)(void * );
571 unsigned int (*  IsSet)(void * );
572 void *  data;
573 void *  symbol;
574 int vid;
575 unsigned int conversion;
576 unsigned int watcherOffset;
577 const char *  category;
578 unsigned int compiled;
579 unsigned int selfWatchable;
580 unsigned int isWatchable;
581 } ecere_gcc_struct;
582
583 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
584
585 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
586
587 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
588
589 extern void __ecereNameSpace__ecere__com__eInstance_StopWatching(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, struct __ecereNameSpace__ecere__com__Instance * object);
590
591 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
592
593 void __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Class * class, const void * data);
594
595 void __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__Class * class, void * *  data);
596
597 struct __ecereNameSpace__ecere__sys__StringBTNode;
598
599 struct __ecereNameSpace__ecere__sys__StringBTNode
600 {
601 char * key;
602 struct __ecereNameSpace__ecere__sys__StringBTNode * parent, * left, * right;
603 int depth;
604 } ecere_gcc_struct;
605
606 struct __ecereNameSpace__ecere__sys__BinaryTree;
607
608 struct __ecereNameSpace__ecere__sys__BinaryTree
609 {
610 struct __ecereNameSpace__ecere__sys__BTNode * root;
611 int count;
612 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
613 void (*  FreeKey)(void *  key);
614 } ecere_gcc_struct;
615
616 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Add(struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__sys__BinaryTree * tree, struct __ecereNameSpace__ecere__sys__BTNode * node)
617 {
618 uintptr_t newKey = node->key;
619
620 while(1)
621 {
622 int result = tree->CompareKey(tree, newKey, this->key);
623
624 if(!result)
625 {
626 return 0;
627 }
628 else if(result > 0)
629 {
630 if(this->right)
631 this = this->right;
632 else
633 {
634 node->parent = this;
635 this->right = node;
636 node->depth = 0;
637 {
638 struct __ecereNameSpace__ecere__sys__BTNode * n;
639
640 for(n = this; n; n = n->parent)
641 {
642 int __simpleStruct0, __simpleStruct1;
643 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
644
645 if(newDepth == n->depth)
646 break;
647 n->depth = newDepth;
648 }
649 }
650 return 1;
651 }
652 }
653 else
654 {
655 if(this->left)
656 this = this->left;
657 else
658 {
659 node->parent = this;
660 this->left = node;
661 node->depth = 0;
662 {
663 struct __ecereNameSpace__ecere__sys__BTNode * n;
664
665 for(n = this; n; n = n->parent)
666 {
667 int __simpleStruct0, __simpleStruct1;
668 int newDepth = (__simpleStruct0 = n->left ? (n->left->depth + 1) : 0, __simpleStruct1 = n->right ? (n->right->depth + 1) : 0, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
669
670 if(newDepth == n->depth)
671 break;
672 n->depth = newDepth;
673 }
674 }
675 return 1;
676 }
677 }
678 }
679 }
680
681 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Find(struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t key)
682 {
683 while(this)
684 {
685 int result = tree->CompareKey(tree, key, this->key);
686
687 if(result < 0)
688 this = this->left;
689 else if(result > 0)
690 this = this->right;
691 else
692 break;
693 }
694 return this;
695 }
696
697 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindNode(struct __ecereNameSpace__ecere__sys__BTNode *  this, struct __ecereNameSpace__ecere__sys__BTNode *  node);
698
699 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindNode(struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__sys__BTNode * node)
700 {
701 if(this == node)
702 return 1;
703 else if(this->left && __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindNode(this->left, node))
704 return 1;
705 else if(this->right && __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindNode(this->right, node))
706 return 1;
707 return 0;
708 }
709
710 struct __ecereNameSpace__ecere__sys__BTNode *  __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindAll(struct __ecereNameSpace__ecere__sys__BTNode *  this, uintptr_t key);
711
712 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindAll(struct __ecereNameSpace__ecere__sys__BTNode * this, uintptr_t key)
713 {
714 struct __ecereNameSpace__ecere__sys__BTNode * result = (((void *)0));
715
716 if(this->key == key)
717 result = this;
718 if(!result && this->left)
719 result = __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindAll(this->left, key);
720 if(!result && this->right)
721 result = __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindAll(this->right, key);
722 return result;
723 }
724
725 char *  __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Print(struct __ecereNameSpace__ecere__sys__BTNode *  this, char *  output, int tps);
726
727 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_PrintDepth(struct __ecereNameSpace__ecere__sys__BTNode *  this, char *  output, int wantedDepth, int curDepth, int maxDepth, unsigned int last);
728
729 char * __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Print(struct __ecereNameSpace__ecere__sys__BTNode * this, char * output, int tps)
730 {
731 switch(tps)
732 {
733 case 0:
734 case 2:
735 case 1:
736 {
737 if(tps == 2)
738 __ecereNameSpace__ecere__sys__strcatf(output, "%d ", this->key);
739 if(this->left)
740 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Print(this->left, output, tps);
741 if(tps == 0)
742 __ecereNameSpace__ecere__sys__strcatf(output, "%d ", this->key);
743 if(this->right)
744 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Print(this->right, output, tps);
745 if(tps == 1)
746 __ecereNameSpace__ecere__sys__strcatf(output, "%d ", this->key);
747 return output;
748 }
749 case 3:
750 {
751 int maxDepth = this->depth;
752 int curDepth;
753
754 for(curDepth = 0; curDepth <= maxDepth; curDepth++)
755 {
756 int c;
757
758 for(c = 0; c < ((1 << (maxDepth - curDepth)) - 1) * 4 / 2; c++)
759 strcat(output, " ");
760 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_PrintDepth(this, output, curDepth, 0, maxDepth, 1);
761 strcat(output, "\n");
762 }
763 return output;
764 }
765 }
766 return (((void *)0));
767 }
768
769 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_PrintDepth(struct __ecereNameSpace__ecere__sys__BTNode * this, char * output, int wantedDepth, int curDepth, int maxDepth, unsigned int last)
770 {
771 int c;
772
773 if(wantedDepth == curDepth)
774 {
775 char nodeString[10] = "";
776 int len;
777
778 if(this)
779 sprintf(nodeString, "%d", (int)this->key);
780 len = strlen(nodeString);
781 for(c = 0; c < (4 - len) / 2; c++)
782 strcat(output, " ");
783 len += c;
784 strcat(output, nodeString);
785 for(c = len; c < 4; c++)
786 strcat(output, " ");
787 if(curDepth && !last)
788 {
789 for(c = 0; c < ((1 << (maxDepth - curDepth)) - 1) * 4; c++)
790 strcat(output, " ");
791 }
792 }
793 else if(curDepth <= maxDepth)
794 {
795 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_PrintDepth((this ? this->left : (struct __ecereNameSpace__ecere__sys__BTNode *)(((void *)0))), output, wantedDepth, curDepth + 1, maxDepth, last && this && !this->right);
796 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_PrintDepth((this ? this->right : (struct __ecereNameSpace__ecere__sys__BTNode *)(((void *)0))), output, wantedDepth, curDepth + 1, maxDepth, last);
797 }
798 }
799
800 struct __ecereNameSpace__ecere__com__DataMember;
801
802 struct __ecereNameSpace__ecere__com__DataMember
803 {
804 struct __ecereNameSpace__ecere__com__DataMember * prev;
805 struct __ecereNameSpace__ecere__com__DataMember * next;
806 const char *  name;
807 unsigned int isProperty;
808 int memberAccess;
809 int id;
810 struct __ecereNameSpace__ecere__com__Class * _class;
811 const char *  dataTypeString;
812 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
813 struct __ecereNameSpace__ecere__com__Instance * dataType;
814 int type;
815 int offset;
816 int memberID;
817 struct __ecereNameSpace__ecere__sys__OldList members;
818 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
819 int memberOffset;
820 short structAlignment;
821 short pointerAlignment;
822 } ecere_gcc_struct;
823
824 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_AddDataMember(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  type, unsigned int size, unsigned int alignment, int declMode);
825
826 struct __ecereNameSpace__ecere__com__Method;
827
828 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
829 {
830 union
831 {
832 struct
833 {
834 const char *  dataTypeString;
835 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
836 } ecere_gcc_struct __anon1;
837 struct __ecereNameSpace__ecere__com__DataValue expression;
838 struct
839 {
840 const char *  memberString;
841 union
842 {
843 struct __ecereNameSpace__ecere__com__DataMember * member;
844 struct __ecereNameSpace__ecere__com__Property * prop;
845 struct __ecereNameSpace__ecere__com__Method * method;
846 } ecere_gcc_struct __anon1;
847 } ecere_gcc_struct __anon2;
848 } ecere_gcc_struct __anon1;
849 } ecere_gcc_struct;
850
851 struct __ecereNameSpace__ecere__com__Method
852 {
853 const char *  name;
854 struct __ecereNameSpace__ecere__com__Method * parent;
855 struct __ecereNameSpace__ecere__com__Method * left;
856 struct __ecereNameSpace__ecere__com__Method * right;
857 int depth;
858 int (*  function)();
859 int vid;
860 int type;
861 struct __ecereNameSpace__ecere__com__Class * _class;
862 void *  symbol;
863 const char *  dataTypeString;
864 struct __ecereNameSpace__ecere__com__Instance * dataType;
865 int memberAccess;
866 } ecere_gcc_struct;
867
868 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_AddMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, const char *  type, void *  function, int declMode);
869
870 struct __ecereNameSpace__ecere__com__Module;
871
872 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, const char *  name, const char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
873
874 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
875
876 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(const char *  name, const char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
877
878 struct __ecereNameSpace__ecere__com__NameSpace;
879
880 struct __ecereNameSpace__ecere__com__NameSpace
881 {
882 const char *  name;
883 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
884 struct __ecereNameSpace__ecere__com__NameSpace *  left;
885 struct __ecereNameSpace__ecere__com__NameSpace *  right;
886 int depth;
887 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
888 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
889 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
890 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
891 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
892 } ecere_gcc_struct;
893
894 struct __ecereNameSpace__ecere__com__Class
895 {
896 struct __ecereNameSpace__ecere__com__Class * prev;
897 struct __ecereNameSpace__ecere__com__Class * next;
898 const char *  name;
899 int offset;
900 int structSize;
901 void * *  _vTbl;
902 int vTblSize;
903 unsigned int (*  Constructor)(void * );
904 void (*  Destructor)(void * );
905 int offsetClass;
906 int sizeClass;
907 struct __ecereNameSpace__ecere__com__Class * base;
908 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
909 struct __ecereNameSpace__ecere__sys__BinaryTree members;
910 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
911 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
912 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
913 struct __ecereNameSpace__ecere__sys__OldList derivatives;
914 int memberID;
915 int startMemberID;
916 int type;
917 struct __ecereNameSpace__ecere__com__Instance * module;
918 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
919 const char *  dataTypeString;
920 struct __ecereNameSpace__ecere__com__Instance * dataType;
921 int typeSize;
922 int defaultAlignment;
923 void (*  Initialize)();
924 int memberOffset;
925 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
926 const char *  designerClass;
927 unsigned int noExpansion;
928 const char *  defaultProperty;
929 unsigned int comRedefinition;
930 int count;
931 int isRemote;
932 unsigned int internalDecl;
933 void *  data;
934 unsigned int computeSize;
935 short structAlignment;
936 short pointerAlignment;
937 int destructionWatchOffset;
938 unsigned int fixed;
939 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
940 int inheritanceAccess;
941 const char *  fullName;
942 void *  symbol;
943 struct __ecereNameSpace__ecere__sys__OldList conversions;
944 struct __ecereNameSpace__ecere__sys__OldList templateParams;
945 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
946 struct __ecereNameSpace__ecere__com__Class * templateClass;
947 struct __ecereNameSpace__ecere__sys__OldList templatized;
948 int numParams;
949 unsigned int isInstanceClass;
950 unsigned int byValueSystemClass;
951 } ecere_gcc_struct;
952
953 struct __ecereNameSpace__ecere__com__Application
954 {
955 int argc;
956 const char * *  argv;
957 int exitCode;
958 unsigned int isGUIApp;
959 struct __ecereNameSpace__ecere__sys__OldList allModules;
960 char *  parsedCommand;
961 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
962 } ecere_gcc_struct;
963
964 static struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TreePrintStyle;
965
966 static struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
967
968 static struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__StringBTNode;
969
970 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_bool;
971
972 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_uint;
973
974 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_String;
975
976 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
977
978 struct __ecereNameSpace__ecere__com__Module
979 {
980 struct __ecereNameSpace__ecere__com__Instance * application;
981 struct __ecereNameSpace__ecere__sys__OldList classes;
982 struct __ecereNameSpace__ecere__sys__OldList defines;
983 struct __ecereNameSpace__ecere__sys__OldList functions;
984 struct __ecereNameSpace__ecere__sys__OldList modules;
985 struct __ecereNameSpace__ecere__com__Instance * prev;
986 struct __ecereNameSpace__ecere__com__Instance * next;
987 const char *  name;
988 void *  library;
989 void *  Unload;
990 int importType;
991 int origImportType;
992 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
993 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
994 } ecere_gcc_struct;
995
996 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_OnSerialize(struct __ecereNameSpace__ecere__com__Class * class, struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__com__Instance * channel)
997 {
998 if((struct __ecereNameSpace__ecere__sys__BTNode *)this)
999 {
1000 unsigned int __internalValue000;
1001 unsigned int truth = 1;
1002
1003 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_bool, (void *)&truth);
1004 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_uint, __extension__ ({
1005 __internalValue000 = (unsigned int)this->key;
1006 (void *)&__internalValue000;
1007 }));
1008 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, this->left);
1009 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, this->right);
1010 }
1011 else
1012 {
1013 unsigned int nothing = 0;
1014
1015 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_uint, (void *)&nothing);
1016 }
1017 }
1018
1019 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_OnUnserialize(struct __ecereNameSpace__ecere__com__Class * class, struct __ecereNameSpace__ecere__sys__BTNode ** this, struct __ecereNameSpace__ecere__com__Instance * channel)
1020 {
1021 unsigned int truth;
1022
1023 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_bool, (void *)&truth);
1024 if(truth)
1025 {
1026 (*this) = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__BTNode);
1027 {
1028 unsigned int k;
1029
1030 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_uint, (void *)&k);
1031 (*this)->key = k;
1032 }
1033 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, (void *)&(*this)->left);
1034 if((*this)->left)
1035 {
1036 (*this)->left->parent = *(struct __ecereNameSpace__ecere__sys__BTNode **)this;
1037 }
1038 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass___ecereNameSpace__ecere__sys__BTNode, (void *)&(*this)->right);
1039 if((*this)->right)
1040 {
1041 (*this)->right->parent = *(struct __ecereNameSpace__ecere__sys__BTNode **)this;
1042 }
1043 (*this)->depth = __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp((*(struct __ecereNameSpace__ecere__sys__BTNode **)this));
1044 }
1045 else
1046 (*this) = (((void *)0));
1047 }
1048
1049 void __ecereMethod___ecereNameSpace__ecere__sys__StringBTNode_OnSerialize(struct __ecereNameSpace__ecere__com__Class * class, struct __ecereNameSpace__ecere__sys__StringBTNode * this, struct __ecereNameSpace__ecere__com__Instance * channel)
1050 {
1051 if((struct __ecereNameSpace__ecere__sys__StringBTNode *)this)
1052 {
1053 unsigned int truth = 1;
1054
1055 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_bool, (void *)&truth);
1056 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_String, this->key);
1057 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__StringBTNode, this->left);
1058 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass___ecereNameSpace__ecere__sys__StringBTNode, this->right);
1059 }
1060 else
1061 {
1062 unsigned int nothing = 0;
1063
1064 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Serialize(channel, __ecereClass_uint, (void *)&nothing);
1065 }
1066 }
1067
1068 void __ecereMethod___ecereNameSpace__ecere__sys__StringBTNode_OnUnserialize(struct __ecereNameSpace__ecere__com__Class * class, struct __ecereNameSpace__ecere__sys__StringBTNode ** this, struct __ecereNameSpace__ecere__com__Instance * channel)
1069 {
1070 unsigned int truth;
1071
1072 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_bool, (void *)&truth);
1073 if(truth)
1074 {
1075 (*this) = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(struct __ecereNameSpace__ecere__sys__StringBTNode));
1076 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass_String, (void *)&(*this)->key);
1077 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass___ecereNameSpace__ecere__sys__StringBTNode, (void *)&(*this)->left);
1078 if((*this)->left)
1079 {
1080 (*this)->left->parent = *(struct __ecereNameSpace__ecere__sys__StringBTNode **)this;
1081 }
1082 __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Unserialize(channel, __ecereClass___ecereNameSpace__ecere__sys__StringBTNode, (void *)&(*this)->right);
1083 if((*this)->right)
1084 {
1085 (*this)->right->parent = *(struct __ecereNameSpace__ecere__sys__StringBTNode **)this;
1086 }
1087 (*this)->depth = __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(((struct __ecereNameSpace__ecere__sys__BTNode *)*(struct __ecereNameSpace__ecere__sys__StringBTNode **)this));
1088 }
1089 else
1090 (*this) = (((void *)0));
1091 }
1092
1093 void __ecereUnregisterModule_BTNode(struct __ecereNameSpace__ecere__com__Instance * module)
1094 {
1095
1096 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_prev = (void *)0;
1097 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_next = (void *)0;
1098 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_minimum = (void *)0;
1099 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_maximum = (void *)0;
1100 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_count = (void *)0;
1101 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_depthProp = (void *)0;
1102 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_balanceFactor = (void *)0;
1103 }
1104
1105 void __ecereRegisterModule_BTNode(struct __ecereNameSpace__ecere__com__Instance * module)
1106 {
1107 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
1108
1109 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(4, "ecere::sys::TreePrintStyle", 0, 0, 0, (void *)0, (void *)0, module, 4, 1);
1110 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application && class)
1111 __ecereClass___ecereNameSpace__ecere__sys__TreePrintStyle = class;
1112 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "inOrder", 0);
1113 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "postOrder", 1);
1114 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "preOrder", 2);
1115 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "depthOrder", 3);
1116 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::strcatf", "void ecere::sys::strcatf(char * string, const char * format, ...)", __ecereNameSpace__ecere__sys__strcatf, module, 4);
1117 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "ecere::sys::BTNode", 0, sizeof(struct __ecereNameSpace__ecere__sys__BTNode), 0, (void *)0, (void *)0, module, 4, 1);
1118 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application && class)
1119 __ecereClass___ecereNameSpace__ecere__sys__BTNode = class;
1120 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "OnSerialize", 0, __ecereMethod___ecereNameSpace__ecere__sys__BTNode_OnSerialize, 1);
1121 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "OnUnserialize", 0, __ecereMethod___ecereNameSpace__ecere__sys__BTNode_OnUnserialize, 1);
1122 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "FindPrefix", "ecere::sys::BTNode FindPrefix(const char * key)", __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindPrefix, 1);
1123 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "FindString", "ecere::sys::BTNode FindString(const char * key)", __ecereMethod___ecereNameSpace__ecere__sys__BTNode_FindString, 1);
1124 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "key", "uintptr", sizeof(void *), 0xF000F000, 1);
1125 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "parent", "ecere::sys::BTNode", sizeof(void *), 0xF000F000, 1);
1126 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "left", "ecere::sys::BTNode", sizeof(void *), 0xF000F000, 1);
1127 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "right", "ecere::sys::BTNode", sizeof(void *), 0xF000F000, 1);
1128 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "depth", "int", 4, 4, 1);
1129 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_prev = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "prev", "ecere::sys::BTNode", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_prev, 1);
1130 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1131 __ecereProp___ecereNameSpace__ecere__sys__BTNode_prev = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_prev, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_prev = (void *)0;
1132 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_next = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "next", "ecere::sys::BTNode", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next, 1);
1133 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1134 __ecereProp___ecereNameSpace__ecere__sys__BTNode_next = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_next, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_next = (void *)0;
1135 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_minimum = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "minimum", "ecere::sys::BTNode", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_minimum, 1);
1136 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1137 __ecereProp___ecereNameSpace__ecere__sys__BTNode_minimum = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_minimum, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_minimum = (void *)0;
1138 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_maximum = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "maximum", "ecere::sys::BTNode", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_maximum, 1);
1139 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1140 __ecereProp___ecereNameSpace__ecere__sys__BTNode_maximum = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_maximum, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_maximum = (void *)0;
1141 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_count = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "count", "int", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_count, 1);
1142 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1143 __ecereProp___ecereNameSpace__ecere__sys__BTNode_count = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_count, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_count = (void *)0;
1144 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_depthProp = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "depthProp", "int", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp, 1);
1145 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1146 __ecereProp___ecereNameSpace__ecere__sys__BTNode_depthProp = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_depthProp, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_depthProp = (void *)0;
1147 __ecerePropM___ecereNameSpace__ecere__sys__BTNode_balanceFactor = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "balanceFactor", "int", 0, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor, 2);
1148 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application)
1149 __ecereProp___ecereNameSpace__ecere__sys__BTNode_balanceFactor = __ecerePropM___ecereNameSpace__ecere__sys__BTNode_balanceFactor, __ecerePropM___ecereNameSpace__ecere__sys__BTNode_balanceFactor = (void *)0;
1150 if(class)
1151 class->fixed = (unsigned int)1;
1152 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "ecere::sys::StringBTNode", 0, sizeof(struct __ecereNameSpace__ecere__sys__StringBTNode), 0, (void *)0, (void *)0, module, 4, 1);
1153 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application && class)
1154 __ecereClass___ecereNameSpace__ecere__sys__StringBTNode = class;
1155 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "OnSerialize", 0, __ecereMethod___ecereNameSpace__ecere__sys__StringBTNode_OnSerialize, 1);
1156 __ecereNameSpace__ecere__com__eClass_AddMethod(class, "OnUnserialize", 0, __ecereMethod___ecereNameSpace__ecere__sys__StringBTNode_OnUnserialize, 1);
1157 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "key", "String", sizeof(void *), 0xF000F000, 1);
1158 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "parent", "ecere::sys::StringBTNode", sizeof(void *), 0xF000F000, 1);
1159 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "left", "ecere::sys::StringBTNode", sizeof(void *), 0xF000F000, 1);
1160 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "right", "ecere::sys::StringBTNode", sizeof(void *), 0xF000F000, 1);
1161 __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "depth", "int", 4, 4, 1);
1162 if(class)
1163 class->fixed = (unsigned int)1;
1164 }
1165
1166 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Check(struct __ecereNameSpace__ecere__sys__BTNode *  this, struct __ecereNameSpace__ecere__sys__BinaryTree *  tree);
1167
1168 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Check(struct __ecereNameSpace__ecere__sys__BTNode * this, struct __ecereNameSpace__ecere__sys__BinaryTree * tree)
1169 {
1170 unsigned int valid = 1;
1171 int leftHeight = this->left ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this->left) + 1 : 0;
1172 int rightHeight = this->right ? __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this->right) + 1 : 0;
1173 int diffHeight = rightHeight - leftHeight;
1174
1175 if(this->left)
1176 {
1177 if(this->left->parent != this)
1178 {
1179 printf("Parent not set properly at node %d\n", (int)this->left->key);
1180 valid = 0;
1181 }
1182 valid *= __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Check(this->left, tree);
1183 }
1184 if(this->right)
1185 {
1186 if(this->right->parent != this)
1187 {
1188 printf("Parent not set properly at node %d\n", (int)this->right->key);
1189 valid = 0;
1190 }
1191 valid *= __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Check(this->right, tree);
1192 }
1193 if(this->depth != __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this))
1194 {
1195 printf("Depth value at node %d (%d) doesn't match depth property (%d)\n", (int)this->key, this->depth, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_depthProp(this));
1196 valid = (unsigned int)0;
1197 }
1198 if(diffHeight < -1 || diffHeight > 1)
1199 {
1200 valid = (unsigned int)0;
1201 printf("Height difference is %d at node %d\n", diffHeight, (int)this->key);
1202 }
1203 if(diffHeight != __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(this))
1204 {
1205 valid = (unsigned int)0;
1206 printf("Height difference %d doesn't match balance-factor of %d at node %d\n", diffHeight, __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_balanceFactor(this), (int)this->key);
1207 }
1208 if(this->left && tree->CompareKey(tree, this->left->key, this->key) > 0)
1209 {
1210 valid = 0;
1211 printf("Node %d is *smaller* than left subtree %d\n", (int)this->key, (int)this->left->key);
1212 }
1213 if(this->right && tree->CompareKey(tree, this->right->key, this->key) < 0)
1214 {
1215 valid = 0;
1216 printf("Node %d is *greater* than right subtree %d\n", (int)this->key, (int)this->right->key);
1217 }
1218 return valid;
1219 }
1220
1221 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Free(struct __ecereNameSpace__ecere__sys__BTNode *  this, void (*  FreeKey)(void *  key));
1222
1223 void __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Free(struct __ecereNameSpace__ecere__sys__BTNode * this, void (* FreeKey)(void * key))
1224 {
1225 if(this->left)
1226 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Free(this->left, FreeKey);
1227 if(this->right)
1228 __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Free(this->right, FreeKey);
1229 if(FreeKey)
1230 FreeKey((void *)this->key);
1231 ((this ? __extension__ ({
1232 void * __ecerePtrToDelete = (this);
1233
1234 __ecereClass___ecereNameSpace__ecere__sys__BTNode->Destructor ? __ecereClass___ecereNameSpace__ecere__sys__BTNode->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
1235 }) : 0), this = 0);
1236 }
1237