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