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