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