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