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