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