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