compiler/libec: (#18, #26, #439, #685) Fixed serious performance issues and warnings...
[sdk] / compiler / bootstrap / libec / bootstrap / pass3.c
1 /* Code generated from eC source file: pass3.ec */
2 #if defined(_WIN32)
3 #define __runtimePlatform 1
4 #elif defined(__APPLE__)
5 #define __runtimePlatform 3
6 #else
7 #define __runtimePlatform 2
8 #endif
9 #if defined(__GNUC__)
10 typedef long long int64;
11 typedef unsigned long long uint64;
12 #ifndef _WIN32
13 #define __declspec(x)
14 #endif
15 #elif defined(__TINYC__)
16 #include <stdarg.h>
17 #define __builtin_va_list va_list
18 #define __builtin_va_start va_start
19 #define __builtin_va_end va_end
20 #ifdef _WIN32
21 #define strcasecmp stricmp
22 #define strncasecmp strnicmp
23 #define __declspec(x) __attribute__((x))
24 #else
25 #define __declspec(x)
26 #endif
27 typedef long long int64;
28 typedef unsigned long long uint64;
29 #else
30 typedef __int64 int64;
31 typedef unsigned __int64 uint64;
32 #endif
33 #ifdef __BIG_ENDIAN__
34 #define __ENDIAN_PAD(x) (8 - (x))
35 #else
36 #define __ENDIAN_PAD(x) 0
37 #endif
38 #include <stdint.h>
39 #include <sys/types.h>
40 enum yytokentype
41 {
42 IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373
43 };
44
45 extern int targetPlatform;
46
47 extern struct __ecereNameSpace__ecere__com__Property * __ecereProp_Type_isPointerType;
48
49 struct __ecereNameSpace__ecere__sys__OldList
50 {
51 void *  first;
52 void *  last;
53 int count;
54 unsigned int offset;
55 unsigned int circ;
56 } __attribute__ ((gcc_struct));
57
58 struct __ecereNameSpace__ecere__sys__BTNode;
59
60 struct __ecereNameSpace__ecere__com__DataValue
61 {
62 union
63 {
64 char c;
65 unsigned char uc;
66 short s;
67 unsigned short us;
68 int i;
69 unsigned int ui;
70 void *  p;
71 float f;
72 double d;
73 long long i64;
74 uint64 ui64;
75 } __attribute__ ((gcc_struct)) __anon1;
76 } __attribute__ ((gcc_struct));
77
78 struct __ecereNameSpace__ecere__com__SerialBuffer
79 {
80 unsigned char *  _buffer;
81 unsigned int count;
82 unsigned int _size;
83 unsigned int pos;
84 } __attribute__ ((gcc_struct));
85
86 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
87
88 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
89
90 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
91
92 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
93
94 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
95
96 struct Context;
97
98 struct Attrib;
99
100 struct Attribute;
101
102 struct Instantiation;
103
104 struct MembersInit;
105
106 struct MemberInit;
107
108 struct ClassFunction;
109
110 struct ClassDefinition;
111
112 struct PropertyDef;
113
114 struct PropertyWatch;
115
116 struct TemplateArgument;
117
118 struct DBTableEntry;
119
120 struct DBIndexItem;
121
122 struct DBTableDef;
123
124 struct CodePosition
125 {
126 int line;
127 int charPos;
128 int pos;
129 int included;
130 } __attribute__ ((gcc_struct));
131
132 extern char *  __ecereNameSpace__ecere__sys__CopyString(const char *  string);
133
134 struct ModuleImport;
135
136 struct ClassImport;
137
138 extern void FullClassNameCat(char *  output, const char *  className, unsigned int includeTemplateParams);
139
140 extern int strcmp(const char * , const char * );
141
142 extern char *  strchr(const char * , int);
143
144 extern char *  strcpy(char * , const char * );
145
146 extern size_t strlen(const char * );
147
148 struct __ecereNameSpace__ecere__com__LinkList
149 {
150 void * first;
151 void * last;
152 int count;
153 } __attribute__ ((gcc_struct));
154
155 struct __ecereNameSpace__ecere__com__LinkElement
156 {
157 void * prev;
158 void * next;
159 } __attribute__ ((gcc_struct));
160
161 extern void Compiler_Error(const char *  format, ...);
162
163 struct __ecereNameSpace__ecere__com__GlobalFunction;
164
165 struct __ecereNameSpace__ecere__com__IteratorPointer;
166
167 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
168
169 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
170
171 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
172
173 extern struct __ecereNameSpace__ecere__sys__OldList *  ast;
174
175 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
176
177 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
178
179 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
180
181 extern struct Context * curContext;
182
183 extern struct Context * globalContext;
184
185 struct Location
186 {
187 struct CodePosition start;
188 struct CodePosition end;
189 } __attribute__ ((gcc_struct));
190
191 extern struct Location yylloc;
192
193 struct ExtDecl
194 {
195 struct Location loc;
196 int type;
197 union
198 {
199 char * s;
200 struct Attrib * attr;
201 } __attribute__ ((gcc_struct)) __anon1;
202 } __attribute__ ((gcc_struct));
203
204 extern struct ExtDecl * MkExtDeclString(char * s);
205
206 struct External;
207
208 extern struct External * curExternal;
209
210 extern struct External * DeclareStruct(struct External * neededBy, const char *  name, unsigned int skipNoHead, unsigned int needDereference);
211
212 extern void FreeExternal(struct External * external);
213
214 struct TopoEdge
215 {
216 struct __ecereNameSpace__ecere__com__LinkElement in;
217 struct __ecereNameSpace__ecere__com__LinkElement out;
218 struct External * from;
219 struct External * to;
220 unsigned int breakable;
221 } __attribute__ ((gcc_struct));
222
223 struct __ecereNameSpace__ecere__com__Class;
224
225 struct __ecereNameSpace__ecere__com__Instance
226 {
227 void * *  _vTbl;
228 struct __ecereNameSpace__ecere__com__Class * _class;
229 int _refCount;
230 } __attribute__ ((gcc_struct));
231
232 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
233
234 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
235
236 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
237
238 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
239
240 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
241
242 int __ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove;
243
244 int __ecereVMethodID___ecereNameSpace__ecere__com__Container_Add;
245
246 struct __ecereNameSpace__ecere__com__Property;
247
248 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
249
250 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);
251
252 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
253
254 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
255
256 struct Specifier;
257
258 extern struct Specifier * CopySpecifier(struct Specifier * spec);
259
260 extern void FreeSpecifier(struct Specifier * spec);
261
262 extern void FreeSpecifierContents(struct Specifier * spec);
263
264 extern struct Specifier * MkSpecifier(int specifier);
265
266 extern struct Specifier * MkSpecifierName(const char *  name);
267
268 struct Declarator;
269
270 extern struct Declarator * SpecDeclFromString(const char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
271
272 extern void FreeDeclarator(struct Declarator * decl);
273
274 struct TemplateDatatype
275 {
276 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
277 struct Declarator * decl;
278 } __attribute__ ((gcc_struct));
279
280 extern struct Declarator * QMkPtrDecl(const char *  id);
281
282 struct Symbol;
283
284 extern struct Symbol * FindClass(const char *  name);
285
286 struct Identifier;
287
288 extern struct Identifier * MkIdentifier(const char *  string);
289
290 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
291
292 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
293
294 struct Identifier
295 {
296 struct Identifier * prev;
297 struct Identifier * next;
298 struct Location loc;
299 struct Symbol * classSym;
300 struct Specifier * _class;
301 char *  string;
302 struct Identifier * badID;
303 } __attribute__ ((gcc_struct));
304
305 static void InstDeclPassIdentifier(struct Identifier * id)
306 {
307 if(strchr(id->string, ':'))
308 {
309 char newID[1024];
310 int c;
311 char ch;
312 int len;
313
314 strcpy(newID, "__ecereNameSpace__");
315 len = strlen(newID);
316 for(c = 0; (ch = id->string[c]); c++)
317 {
318 if(ch == ':')
319 ch = '_';
320 newID[len++] = ch;
321 }
322 newID[len] = (char)0;
323 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
324 id->string = __ecereNameSpace__ecere__sys__CopyString(newID);
325 }
326 }
327
328 struct Type;
329
330 struct __ecereNameSpace__ecere__com__Property
331 {
332 struct __ecereNameSpace__ecere__com__Property * prev;
333 struct __ecereNameSpace__ecere__com__Property * next;
334 const char *  name;
335 unsigned int isProperty;
336 int memberAccess;
337 int id;
338 struct __ecereNameSpace__ecere__com__Class * _class;
339 const char *  dataTypeString;
340 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
341 struct Type * dataType;
342 void (*  Set)(void * , int);
343 int (*  Get)(void * );
344 unsigned int (*  IsSet)(void * );
345 void *  data;
346 void *  symbol;
347 int vid;
348 unsigned int conversion;
349 unsigned int watcherOffset;
350 const char *  category;
351 unsigned int compiled;
352 unsigned int selfWatchable;
353 unsigned int isWatchable;
354 } __attribute__ ((gcc_struct));
355
356 extern struct Type * ProcessTypeString(const char *  string, unsigned int staticMethod);
357
358 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
359
360 extern void FreeType(struct Type * type);
361
362 struct Expression;
363
364 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
365
366 extern struct Expression * MoveExpContents(struct Expression * exp);
367
368 extern void FreeExpContents(struct Expression * exp);
369
370 struct TypeName;
371
372 struct TypeName
373 {
374 struct TypeName * prev;
375 struct TypeName * next;
376 struct Location loc;
377 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
378 struct Declarator * declarator;
379 int classObjectType;
380 struct Expression * bitCount;
381 } __attribute__ ((gcc_struct));
382
383 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
384
385 extern void FreeTypeName(struct TypeName * typeName);
386
387 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
388
389 struct Pointer;
390
391 struct Declarator
392 {
393 struct Declarator * prev;
394 struct Declarator * next;
395 struct Location loc;
396 int type;
397 struct Symbol * symbol;
398 struct Declarator * declarator;
399 union
400 {
401 struct Identifier * identifier;
402 struct
403 {
404 struct Expression * exp;
405 struct Expression * posExp;
406 struct Attrib * attrib;
407 } __attribute__ ((gcc_struct)) structDecl;
408 struct
409 {
410 struct Expression * exp;
411 struct Specifier * enumClass;
412 } __attribute__ ((gcc_struct)) array;
413 struct
414 {
415 struct __ecereNameSpace__ecere__sys__OldList * parameters;
416 } __attribute__ ((gcc_struct)) function;
417 struct
418 {
419 struct Pointer * pointer;
420 } __attribute__ ((gcc_struct)) pointer;
421 struct
422 {
423 struct ExtDecl * extended;
424 } __attribute__ ((gcc_struct)) extended;
425 } __attribute__ ((gcc_struct)) __anon1;
426 } __attribute__ ((gcc_struct));
427
428 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
429
430 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
431
432 struct Pointer
433 {
434 struct Pointer * prev;
435 struct Pointer * next;
436 struct Location loc;
437 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
438 struct Pointer * pointer;
439 } __attribute__ ((gcc_struct));
440
441 struct __ecereNameSpace__ecere__sys__BinaryTree;
442
443 struct __ecereNameSpace__ecere__sys__BinaryTree
444 {
445 struct __ecereNameSpace__ecere__sys__BTNode * root;
446 int count;
447 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
448 void (*  FreeKey)(void *  key);
449 } __attribute__ ((gcc_struct));
450
451 struct __ecereNameSpace__ecere__com__Module;
452
453 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);
454
455 struct __ecereNameSpace__ecere__com__DataMember;
456
457 struct __ecereNameSpace__ecere__com__DataMember
458 {
459 struct __ecereNameSpace__ecere__com__DataMember * prev;
460 struct __ecereNameSpace__ecere__com__DataMember * next;
461 const char *  name;
462 unsigned int isProperty;
463 int memberAccess;
464 int id;
465 struct __ecereNameSpace__ecere__com__Class * _class;
466 const char *  dataTypeString;
467 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
468 struct Type * dataType;
469 int type;
470 int offset;
471 int memberID;
472 struct __ecereNameSpace__ecere__sys__OldList members;
473 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
474 int memberOffset;
475 short structAlignment;
476 short pointerAlignment;
477 } __attribute__ ((gcc_struct));
478
479 struct InitDeclarator;
480
481 struct ClassDef;
482
483 struct FunctionDefinition;
484
485 struct __ecereNameSpace__ecere__com__Method;
486
487 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
488 {
489 union
490 {
491 struct
492 {
493 const char *  dataTypeString;
494 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
495 } __attribute__ ((gcc_struct)) __anon1;
496 struct __ecereNameSpace__ecere__com__DataValue expression;
497 struct
498 {
499 const char *  memberString;
500 union
501 {
502 struct __ecereNameSpace__ecere__com__DataMember * member;
503 struct __ecereNameSpace__ecere__com__Property * prop;
504 struct __ecereNameSpace__ecere__com__Method * method;
505 } __attribute__ ((gcc_struct)) __anon1;
506 } __attribute__ ((gcc_struct)) __anon2;
507 } __attribute__ ((gcc_struct)) __anon1;
508 } __attribute__ ((gcc_struct));
509
510 struct __ecereNameSpace__ecere__com__Method
511 {
512 const char *  name;
513 struct __ecereNameSpace__ecere__com__Method * parent;
514 struct __ecereNameSpace__ecere__com__Method * left;
515 struct __ecereNameSpace__ecere__com__Method * right;
516 int depth;
517 int (*  function)();
518 int vid;
519 int type;
520 struct __ecereNameSpace__ecere__com__Class * _class;
521 void *  symbol;
522 const char *  dataTypeString;
523 struct Type * dataType;
524 int memberAccess;
525 } __attribute__ ((gcc_struct));
526
527 struct Symbol
528 {
529 char *  string;
530 struct Symbol * parent;
531 struct Symbol * left;
532 struct Symbol * right;
533 int depth;
534 struct Type * type;
535 union
536 {
537 struct __ecereNameSpace__ecere__com__Method * method;
538 struct __ecereNameSpace__ecere__com__Property * _property;
539 struct __ecereNameSpace__ecere__com__Class * registered;
540 } __attribute__ ((gcc_struct)) __anon1;
541 unsigned int notYetDeclared;
542 union
543 {
544 struct
545 {
546 struct External * pointerExternal;
547 struct External * structExternal;
548 } __attribute__ ((gcc_struct)) __anon1;
549 struct
550 {
551 struct External * externalGet;
552 struct External * externalSet;
553 struct External * externalPtr;
554 struct External * externalIsSet;
555 } __attribute__ ((gcc_struct)) __anon2;
556 struct
557 {
558 struct External * methodExternal;
559 struct External * methodCodeExternal;
560 } __attribute__ ((gcc_struct)) __anon3;
561 } __attribute__ ((gcc_struct)) __anon2;
562 unsigned int imported;
563 unsigned int declaredStructSym;
564 struct __ecereNameSpace__ecere__com__Class * _class;
565 unsigned int declaredStruct;
566 unsigned int needConstructor;
567 unsigned int needDestructor;
568 char *  constructorName;
569 char *  structName;
570 char *  className;
571 char *  destructorName;
572 struct ModuleImport * module;
573 struct ClassImport * _import;
574 struct Location nameLoc;
575 unsigned int isParam;
576 unsigned int isRemote;
577 unsigned int isStruct;
578 unsigned int fireWatchersDone;
579 int declaring;
580 unsigned int classData;
581 unsigned int isStatic;
582 char *  shortName;
583 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
584 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
585 struct Context * ctx;
586 int isIterator;
587 struct Expression * propCategory;
588 } __attribute__ ((gcc_struct));
589
590 struct TemplateParameter;
591
592 struct Specifier
593 {
594 struct Specifier * prev;
595 struct Specifier * next;
596 struct Location loc;
597 int type;
598 union
599 {
600 int specifier;
601 struct
602 {
603 struct ExtDecl * extDecl;
604 char *  name;
605 struct Symbol * symbol;
606 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
607 } __attribute__ ((gcc_struct)) __anon1;
608 struct
609 {
610 struct Identifier * id;
611 struct __ecereNameSpace__ecere__sys__OldList *  list;
612 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
613 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
614 unsigned int addNameSpace;
615 struct Context * ctx;
616 struct ExtDecl * extDeclStruct;
617 } __attribute__ ((gcc_struct)) __anon2;
618 struct Expression * expression;
619 struct Specifier * _class;
620 struct TemplateParameter * templateParameter;
621 } __attribute__ ((gcc_struct)) __anon1;
622 } __attribute__ ((gcc_struct));
623
624 struct TemplateParameter
625 {
626 struct TemplateParameter * prev;
627 struct TemplateParameter * next;
628 struct Location loc;
629 int type;
630 struct Identifier * identifier;
631 union
632 {
633 struct TemplateDatatype * dataType;
634 int memberType;
635 } __attribute__ ((gcc_struct)) __anon1;
636 struct TemplateArgument * defaultArgument;
637 const char *  dataTypeString;
638 struct Type * baseType;
639 } __attribute__ ((gcc_struct));
640
641 struct Type
642 {
643 struct Type * prev;
644 struct Type * next;
645 int refCount;
646 union
647 {
648 struct Symbol * _class;
649 struct
650 {
651 struct __ecereNameSpace__ecere__sys__OldList members;
652 char *  enumName;
653 } __attribute__ ((gcc_struct)) __anon1;
654 struct
655 {
656 struct Type * returnType;
657 struct __ecereNameSpace__ecere__sys__OldList params;
658 struct Symbol * thisClass;
659 unsigned int staticMethod;
660 struct TemplateParameter * thisClassTemplate;
661 } __attribute__ ((gcc_struct)) __anon2;
662 struct
663 {
664 struct __ecereNameSpace__ecere__com__Method * method;
665 struct __ecereNameSpace__ecere__com__Class * methodClass;
666 struct __ecereNameSpace__ecere__com__Class * usedClass;
667 } __attribute__ ((gcc_struct)) __anon3;
668 struct
669 {
670 struct Type * arrayType;
671 int arraySize;
672 struct Expression * arraySizeExp;
673 unsigned int freeExp;
674 struct Symbol * enumClass;
675 } __attribute__ ((gcc_struct)) __anon4;
676 struct Type * type;
677 struct TemplateParameter * templateParameter;
678 } __attribute__ ((gcc_struct)) __anon1;
679 int kind;
680 unsigned int size;
681 char *  name;
682 char *  typeName;
683 int classObjectType;
684 int alignment;
685 unsigned int offset;
686 int bitFieldCount;
687 int count;
688 unsigned int isSigned : 1;
689 unsigned int constant : 1;
690 unsigned int truth : 1;
691 unsigned int byReference : 1;
692 unsigned int extraParam : 1;
693 unsigned int directClassAccess : 1;
694 unsigned int computing : 1;
695 unsigned int keepCast : 1;
696 unsigned int passAsTemplate : 1;
697 unsigned int dllExport : 1;
698 unsigned int attrStdcall : 1;
699 unsigned int declaredWithStruct : 1;
700 unsigned int typedByReference : 1;
701 unsigned int casted : 1;
702 unsigned int pointerAlignment : 1;
703 } __attribute__ ((gcc_struct));
704
705 unsigned int IsVoidPtrCast(struct TypeName * typeName)
706 {
707 unsigned int result = 0;
708 struct Declarator * d = typeName->declarator;
709
710 if(d && d->type == 5 && d->__anon1.pointer.pointer && !d->__anon1.pointer.pointer->pointer)
711 {
712 if(typeName->qualifiers)
713 {
714 struct Specifier * s;
715
716 for(s = (*typeName->qualifiers).first; s; s = s->next)
717 {
718 if(s->type == 0 && s->__anon1.specifier == VOID)
719 result = 1;
720 }
721 }
722 }
723 return result;
724 }
725
726 unsigned int __ecereProp_Type_Get_isPointerType(struct Type * this);
727
728 struct Enumerator;
729
730 struct Enumerator
731 {
732 struct Enumerator * prev;
733 struct Enumerator * next;
734 struct Location loc;
735 struct Identifier * id;
736 struct Expression * exp;
737 } __attribute__ ((gcc_struct));
738
739 struct Initializer;
740
741 struct Initializer
742 {
743 struct Initializer * prev;
744 struct Initializer * next;
745 struct Location loc;
746 int type;
747 union
748 {
749 struct Expression * exp;
750 struct __ecereNameSpace__ecere__sys__OldList *  list;
751 } __attribute__ ((gcc_struct)) __anon1;
752 unsigned int isConstant;
753 struct Identifier * id;
754 } __attribute__ ((gcc_struct));
755
756 struct InitDeclarator
757 {
758 struct InitDeclarator * prev;
759 struct InitDeclarator * next;
760 struct Location loc;
761 struct Declarator * declarator;
762 struct Initializer * initializer;
763 } __attribute__ ((gcc_struct));
764
765 struct Declaration;
766
767 struct ClassDef
768 {
769 struct ClassDef * prev;
770 struct ClassDef * next;
771 struct Location loc;
772 int type;
773 union
774 {
775 struct Declaration * decl;
776 struct ClassFunction * function;
777 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
778 struct PropertyDef * propertyDef;
779 struct PropertyWatch * propertyWatch;
780 char *  designer;
781 struct Identifier * defaultProperty;
782 struct
783 {
784 struct Identifier * id;
785 struct Initializer * initializer;
786 } __attribute__ ((gcc_struct)) __anon1;
787 } __attribute__ ((gcc_struct)) __anon1;
788 int memberAccess;
789 void *  object;
790 } __attribute__ ((gcc_struct));
791
792 struct Declaration
793 {
794 struct Declaration * prev;
795 struct Declaration * next;
796 struct Location loc;
797 int type;
798 union
799 {
800 struct
801 {
802 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
803 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
804 } __attribute__ ((gcc_struct)) __anon1;
805 struct Instantiation * inst;
806 struct
807 {
808 struct Identifier * id;
809 struct Expression * exp;
810 } __attribute__ ((gcc_struct)) __anon2;
811 } __attribute__ ((gcc_struct)) __anon1;
812 struct Specifier * extStorage;
813 struct Symbol * symbol;
814 int declMode;
815 } __attribute__ ((gcc_struct));
816
817 struct External
818 {
819 struct External * prev;
820 struct External * next;
821 struct Location loc;
822 int type;
823 struct Symbol * symbol;
824 union
825 {
826 struct FunctionDefinition * function;
827 struct ClassDefinition * _class;
828 struct Declaration * declaration;
829 char *  importString;
830 struct Identifier * id;
831 struct DBTableDef * table;
832 } __attribute__ ((gcc_struct)) __anon1;
833 int importType;
834 struct External * fwdDecl;
835 struct __ecereNameSpace__ecere__com__Instance * outgoing;
836 struct __ecereNameSpace__ecere__com__Instance * incoming;
837 int nonBreakableIncoming;
838 } __attribute__ ((gcc_struct));
839
840 struct External * __ecereMethod_External_ForwardDeclare();
841
842 struct AsmField;
843
844 struct AsmField
845 {
846 struct AsmField * prev;
847 struct AsmField * next;
848 struct Location loc;
849 char *  command;
850 struct Expression * expression;
851 struct Identifier * symbolic;
852 } __attribute__ ((gcc_struct));
853
854 struct __ecereNameSpace__ecere__com__NameSpace;
855
856 struct __ecereNameSpace__ecere__com__NameSpace
857 {
858 const char *  name;
859 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
860 struct __ecereNameSpace__ecere__com__NameSpace *  left;
861 struct __ecereNameSpace__ecere__com__NameSpace *  right;
862 int depth;
863 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
864 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
865 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
866 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
867 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
868 } __attribute__ ((gcc_struct));
869
870 struct __ecereNameSpace__ecere__com__Class
871 {
872 struct __ecereNameSpace__ecere__com__Class * prev;
873 struct __ecereNameSpace__ecere__com__Class * next;
874 const char *  name;
875 int offset;
876 int structSize;
877 void * *  _vTbl;
878 int vTblSize;
879 unsigned int (*  Constructor)(void * );
880 void (*  Destructor)(void * );
881 int offsetClass;
882 int sizeClass;
883 struct __ecereNameSpace__ecere__com__Class * base;
884 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
885 struct __ecereNameSpace__ecere__sys__BinaryTree members;
886 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
887 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
888 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
889 struct __ecereNameSpace__ecere__sys__OldList derivatives;
890 int memberID;
891 int startMemberID;
892 int type;
893 struct __ecereNameSpace__ecere__com__Instance * module;
894 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
895 const char *  dataTypeString;
896 struct Type * dataType;
897 int typeSize;
898 int defaultAlignment;
899 void (*  Initialize)();
900 int memberOffset;
901 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
902 const char *  designerClass;
903 unsigned int noExpansion;
904 const char *  defaultProperty;
905 unsigned int comRedefinition;
906 int count;
907 int isRemote;
908 unsigned int internalDecl;
909 void *  data;
910 unsigned int computeSize;
911 short structAlignment;
912 short pointerAlignment;
913 int destructionWatchOffset;
914 unsigned int fixed;
915 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
916 int inheritanceAccess;
917 const char *  fullName;
918 void *  symbol;
919 struct __ecereNameSpace__ecere__sys__OldList conversions;
920 struct __ecereNameSpace__ecere__sys__OldList templateParams;
921 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
922 struct __ecereNameSpace__ecere__com__Class * templateClass;
923 struct __ecereNameSpace__ecere__sys__OldList templatized;
924 int numParams;
925 unsigned int isInstanceClass;
926 unsigned int byValueSystemClass;
927 } __attribute__ ((gcc_struct));
928
929 struct __ecereNameSpace__ecere__com__Application
930 {
931 int argc;
932 const char * *  argv;
933 int exitCode;
934 unsigned int isGUIApp;
935 struct __ecereNameSpace__ecere__sys__OldList allModules;
936 char *  parsedCommand;
937 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
938 } __attribute__ ((gcc_struct));
939
940 extern void __ecereNameSpace__ecere__com__PrintLn(struct __ecereNameSpace__ecere__com__Class * class, const void * object, ...);
941
942 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
943
944 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
945
946 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
947
948 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
949
950 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__LinkList;
951
952 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_char__PTR_;
953
954 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TopoEdge;
955
956 struct __ecereNameSpace__ecere__com__Module
957 {
958 struct __ecereNameSpace__ecere__com__Instance * application;
959 struct __ecereNameSpace__ecere__sys__OldList classes;
960 struct __ecereNameSpace__ecere__sys__OldList defines;
961 struct __ecereNameSpace__ecere__sys__OldList functions;
962 struct __ecereNameSpace__ecere__sys__OldList modules;
963 struct __ecereNameSpace__ecere__com__Instance * prev;
964 struct __ecereNameSpace__ecere__com__Instance * next;
965 const char *  name;
966 void *  library;
967 void *  Unload;
968 int importType;
969 int origImportType;
970 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
971 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
972 } __attribute__ ((gcc_struct));
973
974 static void ReplaceByInstancePtr(struct Specifier * spec, struct Declarator ** declPtr, int type)
975 {
976 struct Declarator * decl = *declPtr;
977
978 if(decl && decl->type == 5)
979 {
980 if(type == 2)
981 ;
982 else
983 decl->__anon1.pointer.pointer = MkPointer((((void *)0)), decl->__anon1.pointer.pointer);
984 }
985 else
986 {
987 struct Declarator * newDecl = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Declarator);
988
989 if(decl)
990 {
991 *newDecl = *decl;
992 decl->declarator = newDecl;
993 }
994 else
995 decl = newDecl;
996 decl->type = 5;
997 decl->__anon1.pointer.pointer = MkPointer((((void *)0)), (((void *)0)));
998 *declPtr = decl;
999 }
1000 }
1001
1002 static int ReplaceClassSpec(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Specifier * spec, unsigned int param)
1003 {
1004 if(spec->type == 8)
1005 {
1006 struct TemplateParameter * parameter = spec->__anon1.templateParameter;
1007
1008 if(!param && parameter->dataTypeString)
1009 {
1010 struct __ecereNameSpace__ecere__sys__OldList * newSpecs = MkList();
1011 struct Declarator * decl = SpecDeclFromString(parameter->dataTypeString, newSpecs, (((void *)0)));
1012
1013 if((*newSpecs).first)
1014 {
1015 struct Specifier * newSpec = CopySpecifier((*newSpecs).first);
1016
1017 *spec = *newSpec;
1018 ((newSpec ? (__ecereClass_Specifier->Destructor ? __ecereClass_Specifier->Destructor((void *)newSpec) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newSpec)) : 0), newSpec = 0);
1019 }
1020 FreeList(newSpecs, (void *)(FreeSpecifier));
1021 if(decl)
1022 {
1023 unsigned int isPointer = decl->type == 5;
1024
1025 if(decl)
1026 FreeDeclarator(decl);
1027 if(isPointer)
1028 return 1;
1029 }
1030 }
1031 else if(!param && parameter->__anon1.dataType)
1032 {
1033 struct __ecereNameSpace__ecere__sys__OldList * newSpecs = parameter->__anon1.dataType->specifiers;
1034 struct Declarator * decl = parameter->__anon1.dataType->decl;
1035
1036 if((*newSpecs).first)
1037 {
1038 struct Specifier * newSpec = CopySpecifier((*newSpecs).first);
1039
1040 *spec = *newSpec;
1041 ((newSpec ? (__ecereClass_Specifier->Destructor ? __ecereClass_Specifier->Destructor((void *)newSpec) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newSpec)) : 0), newSpec = 0);
1042 }
1043 if(decl)
1044 {
1045 unsigned int isPointer = decl->type == 5;
1046
1047 if(isPointer)
1048 return 1;
1049 }
1050 }
1051 else
1052 {
1053 spec->type = 1;
1054 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString("uint64");
1055 spec->__anon1.__anon1.symbol = FindClass("uint64");
1056 }
1057 }
1058 if(spec->type == 1 || spec->type == 7)
1059 {
1060 struct Symbol * classSym = spec->__anon1.__anon1.symbol;
1061
1062 if(spec->type == 7)
1063 {
1064 classSym = FindClass("ecere::com::Class");
1065 }
1066 if(classSym)
1067 {
1068 struct __ecereNameSpace__ecere__com__Class * _class = classSym->__anon1.registered;
1069
1070 FreeSpecifierContents(spec);
1071 spec->type = 1;
1072 if(_class && _class->type == 1)
1073 {
1074 char name[1024];
1075
1076 name[0] = (char)0;
1077 FullClassNameCat(name, _class->fullName, 0);
1078 FreeSpecifierContents(spec);
1079 spec->type = 3;
1080 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1081 spec->__anon1.__anon2.id = MkIdentifier(name);
1082 spec->__anon1.__anon2.list = (((void *)0));
1083 spec->__anon1.__anon2.definitions = (((void *)0));
1084 spec->__anon1.__anon2.ctx = (((void *)0));
1085 spec->__anon1.__anon2.addNameSpace = 0;
1086 }
1087 else if(_class && _class->type == 5)
1088 {
1089 char name[1024] = "";
1090
1091 FullClassNameCat(name, _class->fullName, 0);
1092 spec->type = 3;
1093 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1094 spec->__anon1.__anon2.id = MkIdentifier(name);
1095 spec->__anon1.__anon2.list = (((void *)0));
1096 spec->__anon1.__anon2.definitions = (((void *)0));
1097 spec->__anon1.__anon2.ctx = (((void *)0));
1098 spec->__anon1.__anon2.addNameSpace = 0;
1099 }
1100 else if(_class)
1101 {
1102 if((_class->type != 1000 || !strcmp(_class->fullName, "enum") || (_class->dataTypeString && !strcmp(_class->dataTypeString, "char *")) || !strcmp(_class->fullName, "uint64") || !strcmp(_class->fullName, "uint32") || !strcmp(_class->fullName, "uint16") || !strcmp(_class->fullName, "uintptr") || !strcmp(_class->fullName, "intptr") || !strcmp(_class->fullName, "uintsize") || !strcmp(_class->fullName, "intsize") || !strcmp(_class->fullName, "uint") || !strcmp(_class->fullName, "byte")))
1103 {
1104 if(_class->dataTypeString)
1105 {
1106 if(!strcmp(_class->dataTypeString, "uint64") || !strcmp(_class->dataTypeString, "uint32") || !strcmp(_class->dataTypeString, "uint16") || !strcmp(_class->dataTypeString, "uintptr") || !strcmp(_class->dataTypeString, "intptr") || !strcmp(_class->dataTypeString, "uintsize") || !strcmp(_class->dataTypeString, "intsize") || !strcmp(_class->dataTypeString, "uint") || !strcmp(_class->dataTypeString, "byte"))
1107 {
1108 if(!_class->dataType)
1109 _class->dataType = ProcessTypeString(_class->dataTypeString, 0);
1110 if(_class->dataType && _class->dataType->kind == 8)
1111 classSym = _class->dataType->__anon1._class;
1112 else
1113 classSym = FindClass(_class->dataTypeString);
1114 _class = classSym ? classSym->__anon1.registered : (((void *)0));
1115 }
1116 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString(!strcmp(_class->dataTypeString, "char *") ? "char" : _class->dataTypeString);
1117 spec->__anon1.__anon1.symbol = (((void *)0));
1118 }
1119 else
1120 {
1121 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString((((void *)0)));
1122 spec->__anon1.__anon1.symbol = (((void *)0));
1123 }
1124 }
1125 else if(!_class->base)
1126 {
1127 spec->type = 0;
1128 spec->__anon1.specifier = VOID;
1129 return 1;
1130 }
1131 }
1132 else
1133 {
1134 spec->type = 3;
1135 spec->__anon1.__anon2.id = MkIdentifier("__ecereNameSpace__ecere__com__Instance");
1136 spec->__anon1.__anon2.list = (((void *)0));
1137 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1138 spec->__anon1.__anon2.definitions = (((void *)0));
1139 spec->__anon1.__anon2.ctx = (((void *)0));
1140 spec->__anon1.__anon2.addNameSpace = 0;
1141 }
1142 if(_class && _class->dataTypeString && !strcmp(_class->dataTypeString, "char *"))
1143 return 1;
1144 if(!_class || _class->type == 0 || _class->type == 5)
1145 return 1;
1146 else if(param && _class->type == 1)
1147 return 2;
1148 }
1149 }
1150 else if(spec->type == 0)
1151 {
1152 if(spec->__anon1.specifier == ANY_OBJECT || spec->__anon1.specifier == CLASS)
1153 {
1154 spec->__anon1.specifier = CONST;
1155 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(specs, MkSpecifier(VOID));
1156 return 1;
1157 }
1158 }
1159 return 0;
1160 }
1161
1162 void TopoSort(struct __ecereNameSpace__ecere__sys__OldList * input)
1163 {
1164 struct __ecereNameSpace__ecere__sys__OldList L =
1165 {
1166 0, 0, 0, 0, 0
1167 };
1168 struct __ecereNameSpace__ecere__sys__OldList S =
1169 {
1170 0, 0, 0, 0, 0
1171 };
1172 struct __ecereNameSpace__ecere__sys__OldList B =
1173 {
1174 0, 0, 0, 0, 0
1175 };
1176 struct External * n, * next;
1177
1178 for(n = (*input).first; n; n = next)
1179 {
1180 next = n->next;
1181 if(n->type == 1 && !n->__anon1.declaration)
1182 {
1183 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1184 if(n->symbol && n->symbol->__anon2.__anon1.structExternal == n)
1185 n->symbol->__anon2.__anon1.structExternal = (((void *)0));
1186 FreeExternal(n);
1187 }
1188 else if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)n->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1189 {
1190 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1191 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, n);
1192 }
1193 else if(!n->nonBreakableIncoming)
1194 {
1195 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, n);
1197 }
1198 }
1199 while(1)
1200 {
1201 struct TopoEdge * e, * ne;
1202
1203 if((n = S.first))
1204 {
1205 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&S, (struct __ecereNameSpace__ecere__com__IteratorPointer *)n);
1206 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&L, n);
1207 for(e = ((struct TopoEdge *)(uintptr_t)((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)n->outgoing + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first); e; e = ne)
1208 {
1209 struct External * m = e->to;
1210 struct __ecereNameSpace__ecere__sys__OldList * list;
1211
1212 if(m->nonBreakableIncoming)
1213 {
1214 list = input;
1215 }
1216 else
1217 {
1218 list = &B;
1219 }
1220 if(!(*list).count)
1221 __ecereNameSpace__ecere__com__PrintLn(__ecereClass_char__PTR_, "!!! Something's wrong !!!", (void *)0);
1222 ne = ((struct TopoEdge *)(uintptr_t)e->out.next);
1223 if(!e->breakable)
1224 {
1225 m->nonBreakableIncoming--;
1226 }
1227 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1228 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = n->outgoing;
1229
1230 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1231 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(n->outgoing, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e);
1232 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1233 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = m->incoming;
1234
1235 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1236 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(m->incoming, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e);
1237 ((e ? (__ecereClass_TopoEdge->Destructor ? __ecereClass_TopoEdge->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
1238 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)m->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1239 {
1240 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*list), m);
1241 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, m);
1242 }
1243 else if(!m->nonBreakableIncoming)
1244 {
1245 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*list), m);
1246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, m);
1247 }
1248 }
1249 }
1250 else if((n = B.first))
1251 {
1252 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&B, (struct __ecereNameSpace__ecere__com__IteratorPointer *)n);
1253 for(e = ((struct TopoEdge *)(uintptr_t)((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)n->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first); e; e = ne)
1254 {
1255 struct TopoEdge * e2, * n2;
1256 struct External * m = e->from;
1257 struct External * f;
1258
1259 f = __ecereMethod_External_ForwardDeclare(m);
1260 ne = ((struct TopoEdge *)(uintptr_t)e->in.next);
1261 {
1262 struct External * c, * next;
1263
1264 for(c = (*input).first; c; c = next)
1265 {
1266 next = c->next;
1267 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)c->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1268 {
1269 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), c);
1270 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, c);
1271 }
1272 else if(!c->nonBreakableIncoming)
1273 {
1274 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), c);
1275 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, c);
1276 }
1277 }
1278 }
1279 for(e2 = ((struct TopoEdge *)(uintptr_t)((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)m->outgoing + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first); e2; e2 = n2)
1280 {
1281 n2 = ((struct TopoEdge *)(uintptr_t)e2->out.next);
1282 if(e2->breakable)
1283 {
1284 struct External * to = e2->to;
1285
1286 if(e2 == e)
1287 ;
1288 else
1289 ;
1290 e2->breakable = 0;
1291 e2->from = f;
1292 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1293 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = m->outgoing;
1294
1295 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1296 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(m->outgoing, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e2);
1297 ((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, uint64 value))__extension__ ({
1298 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f->outgoing;
1299
1300 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1301 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Add])(f->outgoing, (uint64)(uintptr_t)(e2));
1302 to->nonBreakableIncoming++;
1303 if(e2 != e && to->nonBreakableIncoming == 1)
1304 {
1305 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&B, to);
1306 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), to);
1307 }
1308 }
1309 }
1310 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)f->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1311 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, f);
1312 else if(!f->nonBreakableIncoming)
1313 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, f);
1314 else
1315 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), f);
1316 if(S.first)
1317 break;
1318 }
1319 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), n);
1320 }
1321 else
1322 {
1323 if((*input).count)
1324 {
1325 Compiler_Error("declarations cycles found\n");
1326 }
1327 else
1328 *input = L;
1329 break;
1330 }
1331 }
1332 for(n = (*input).first; n; n = next)
1333 {
1334 next = n->next;
1335 if(n->type == 1 && (!n->__anon1.declaration || ((!n->__anon1.declaration->__anon1.__anon1.specifiers || !(*n->__anon1.declaration->__anon1.__anon1.specifiers).count) && (!n->__anon1.declaration->__anon1.__anon1.declarators || !(*n->__anon1.declaration->__anon1.__anon1.declarators).count))))
1336 {
1337 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1338 if(n->symbol && n->symbol->__anon2.__anon1.structExternal == n)
1339 n->symbol->__anon2.__anon1.structExternal = (((void *)0));
1340 FreeExternal(n);
1341 }
1342 }
1343 }
1344
1345 void __ecereUnregisterModule_pass3(struct __ecereNameSpace__ecere__com__Instance * module)
1346 {
1347
1348 }
1349
1350 struct Statement;
1351
1352 typedef union YYSTYPE
1353 {
1354 int specifierType;
1355 int i;
1356 int declMode;
1357 struct Identifier * id;
1358 struct Expression * exp;
1359 struct Specifier * specifier;
1360 struct __ecereNameSpace__ecere__sys__OldList * list;
1361 struct Enumerator * enumerator;
1362 struct Declarator * declarator;
1363 struct Pointer * pointer;
1364 struct Initializer * initializer;
1365 struct InitDeclarator * initDeclarator;
1366 struct TypeName * typeName;
1367 struct Declaration * declaration;
1368 struct Statement * stmt;
1369 struct FunctionDefinition * function;
1370 struct External * external;
1371 struct Context * context;
1372 struct AsmField * asmField;
1373 struct Attrib * attrib;
1374 struct ExtDecl * extDecl;
1375 struct Attribute * attribute;
1376 struct Instantiation * instance;
1377 struct MembersInit * membersInit;
1378 struct MemberInit * memberInit;
1379 struct ClassFunction * classFunction;
1380 struct ClassDefinition * _class;
1381 struct ClassDef * classDef;
1382 struct PropertyDef * prop;
1383 char * string;
1384 struct Symbol * symbol;
1385 struct PropertyWatch * propertyWatch;
1386 struct TemplateParameter * templateParameter;
1387 struct TemplateArgument * templateArgument;
1388 struct TemplateDatatype * templateDatatype;
1389 struct DBTableEntry * dbtableEntry;
1390 struct DBIndexItem * dbindexItem;
1391 struct DBTableDef * dbtableDef;
1392 } __attribute__ ((gcc_struct)) YYSTYPE;
1393
1394 extern YYSTYPE yylval;
1395
1396 struct Expression
1397 {
1398 struct Expression * prev;
1399 struct Expression * next;
1400 struct Location loc;
1401 int type;
1402 union
1403 {
1404 struct
1405 {
1406 char *  constant;
1407 struct Identifier * identifier;
1408 } __attribute__ ((gcc_struct)) __anon1;
1409 struct Statement * compound;
1410 struct Instantiation * instance;
1411 struct
1412 {
1413 char *  string;
1414 unsigned int intlString;
1415 unsigned int wideString;
1416 } __attribute__ ((gcc_struct)) __anon2;
1417 struct __ecereNameSpace__ecere__sys__OldList *  list;
1418 struct
1419 {
1420 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
1421 struct Declarator * decl;
1422 } __attribute__ ((gcc_struct)) _classExp;
1423 struct
1424 {
1425 struct Identifier * id;
1426 } __attribute__ ((gcc_struct)) classData;
1427 struct
1428 {
1429 struct Expression * exp;
1430 struct __ecereNameSpace__ecere__sys__OldList * arguments;
1431 struct Location argLoc;
1432 } __attribute__ ((gcc_struct)) call;
1433 struct
1434 {
1435 struct Expression * exp;
1436 struct __ecereNameSpace__ecere__sys__OldList * index;
1437 } __attribute__ ((gcc_struct)) index;
1438 struct
1439 {
1440 struct Expression * exp;
1441 struct Identifier * member;
1442 int memberType;
1443 unsigned int thisPtr;
1444 } __attribute__ ((gcc_struct)) member;
1445 struct
1446 {
1447 int op;
1448 struct Expression * exp1;
1449 struct Expression * exp2;
1450 } __attribute__ ((gcc_struct)) op;
1451 struct TypeName * typeName;
1452 struct Specifier * _class;
1453 struct
1454 {
1455 struct TypeName * typeName;
1456 struct Expression * exp;
1457 } __attribute__ ((gcc_struct)) cast;
1458 struct
1459 {
1460 struct Expression * cond;
1461 struct __ecereNameSpace__ecere__sys__OldList * exp;
1462 struct Expression * elseExp;
1463 } __attribute__ ((gcc_struct)) cond;
1464 struct
1465 {
1466 struct TypeName * typeName;
1467 struct Expression * size;
1468 } __attribute__ ((gcc_struct)) _new;
1469 struct
1470 {
1471 struct TypeName * typeName;
1472 struct Expression * size;
1473 struct Expression * exp;
1474 } __attribute__ ((gcc_struct)) _renew;
1475 struct
1476 {
1477 char * table;
1478 struct Identifier * id;
1479 } __attribute__ ((gcc_struct)) db;
1480 struct
1481 {
1482 struct Expression * ds;
1483 struct Expression * name;
1484 } __attribute__ ((gcc_struct)) dbopen;
1485 struct
1486 {
1487 struct TypeName * typeName;
1488 struct Initializer * initializer;
1489 } __attribute__ ((gcc_struct)) initializer;
1490 struct
1491 {
1492 struct Expression * exp;
1493 struct TypeName * typeName;
1494 } __attribute__ ((gcc_struct)) vaArg;
1495 } __attribute__ ((gcc_struct)) __anon1;
1496 unsigned int debugValue;
1497 struct __ecereNameSpace__ecere__com__DataValue val;
1498 uint64 address;
1499 unsigned int hasAddress;
1500 struct Type * expType;
1501 struct Type * destType;
1502 unsigned int usage;
1503 int tempCount;
1504 unsigned int byReference;
1505 unsigned int isConstant;
1506 unsigned int addedThis;
1507 unsigned int needCast;
1508 unsigned int thisPtr;
1509 unsigned int opDestType;
1510 unsigned int needTemplateCast;
1511 } __attribute__ ((gcc_struct));
1512
1513 struct Statement
1514 {
1515 struct Statement * prev;
1516 struct Statement * next;
1517 struct Location loc;
1518 int type;
1519 union
1520 {
1521 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
1522 struct
1523 {
1524 struct Identifier * id;
1525 struct Statement * stmt;
1526 } __attribute__ ((gcc_struct)) labeled;
1527 struct
1528 {
1529 struct Expression * exp;
1530 struct Statement * stmt;
1531 } __attribute__ ((gcc_struct)) caseStmt;
1532 struct
1533 {
1534 struct __ecereNameSpace__ecere__sys__OldList * declarations;
1535 struct __ecereNameSpace__ecere__sys__OldList * statements;
1536 struct Context * context;
1537 unsigned int isSwitch;
1538 } __attribute__ ((gcc_struct)) compound;
1539 struct
1540 {
1541 struct __ecereNameSpace__ecere__sys__OldList * exp;
1542 struct Statement * stmt;
1543 struct Statement * elseStmt;
1544 } __attribute__ ((gcc_struct)) ifStmt;
1545 struct
1546 {
1547 struct __ecereNameSpace__ecere__sys__OldList * exp;
1548 struct Statement * stmt;
1549 } __attribute__ ((gcc_struct)) switchStmt;
1550 struct
1551 {
1552 struct __ecereNameSpace__ecere__sys__OldList * exp;
1553 struct Statement * stmt;
1554 } __attribute__ ((gcc_struct)) whileStmt;
1555 struct
1556 {
1557 struct __ecereNameSpace__ecere__sys__OldList * exp;
1558 struct Statement * stmt;
1559 } __attribute__ ((gcc_struct)) doWhile;
1560 struct
1561 {
1562 struct Statement * init;
1563 struct Statement * check;
1564 struct __ecereNameSpace__ecere__sys__OldList * increment;
1565 struct Statement * stmt;
1566 } __attribute__ ((gcc_struct)) forStmt;
1567 struct
1568 {
1569 struct Identifier * id;
1570 } __attribute__ ((gcc_struct)) gotoStmt;
1571 struct
1572 {
1573 struct Specifier * spec;
1574 char * statements;
1575 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
1576 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
1577 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
1578 } __attribute__ ((gcc_struct)) asmStmt;
1579 struct
1580 {
1581 struct Expression * watcher;
1582 struct Expression * object;
1583 struct __ecereNameSpace__ecere__sys__OldList * watches;
1584 } __attribute__ ((gcc_struct)) _watch;
1585 struct
1586 {
1587 struct Identifier * id;
1588 struct __ecereNameSpace__ecere__sys__OldList * exp;
1589 struct __ecereNameSpace__ecere__sys__OldList * filter;
1590 struct Statement * stmt;
1591 } __attribute__ ((gcc_struct)) forEachStmt;
1592 struct Declaration * decl;
1593 } __attribute__ ((gcc_struct)) __anon1;
1594 } __attribute__ ((gcc_struct));
1595
1596 struct FunctionDefinition
1597 {
1598 struct FunctionDefinition * prev;
1599 struct FunctionDefinition * next;
1600 struct Location loc;
1601 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1602 struct Declarator * declarator;
1603 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1604 struct Statement * body;
1605 struct __ecereNameSpace__ecere__com__Class * _class;
1606 struct __ecereNameSpace__ecere__sys__OldList attached;
1607 int declMode;
1608 struct Type * type;
1609 struct Symbol * propSet;
1610 int tempCount;
1611 unsigned int propertyNoThis;
1612 } __attribute__ ((gcc_struct));
1613
1614 static void AddPointerCast(struct Expression * e)
1615 {
1616 struct Type * src = e->expType;
1617
1618 if(src && (src->kind == 20 || src->kind == 8))
1619 {
1620 if(e->type != 11 || !IsVoidPtrCast(e->__anon1.cast.typeName))
1621 {
1622 if(src)
1623 src->refCount++;
1624 if(src->kind == 20 && src->__anon1.templateParameter && src->__anon1.templateParameter->type == 0)
1625 {
1626 struct Type * newType = (((void *)0));
1627
1628 if(src->__anon1.templateParameter->dataTypeString)
1629 newType = ProcessTypeString(src->__anon1.templateParameter->dataTypeString, 0);
1630 else if(src->__anon1.templateParameter->__anon1.dataType)
1631 newType = ProcessType(src->__anon1.templateParameter->__anon1.dataType->specifiers, src->__anon1.templateParameter->__anon1.dataType->decl);
1632 if(newType)
1633 {
1634 FreeType(src);
1635 src = newType;
1636 }
1637 }
1638 if(src && src->kind == 8 && src->__anon1._class)
1639 {
1640 struct __ecereNameSpace__ecere__com__Class * sc = src->__anon1._class->__anon1.registered;
1641
1642 if(sc && (sc->type == 1 || sc->type == 5))
1643 {
1644 struct Type * dest = e->destType;
1645
1646 if(dest && (dest->kind == 20 || dest->kind == 8))
1647 {
1648 if(dest)
1649 dest->refCount++;
1650 if(dest->kind == 20 && dest->__anon1.templateParameter && dest->__anon1.templateParameter->type == 0)
1651 {
1652 struct Type * newType = (((void *)0));
1653
1654 if(dest->__anon1.templateParameter->dataTypeString)
1655 newType = ProcessTypeString(dest->__anon1.templateParameter->dataTypeString, 0);
1656 else if(dest->__anon1.templateParameter->__anon1.dataType)
1657 newType = ProcessType(dest->__anon1.templateParameter->__anon1.dataType->specifiers, dest->__anon1.templateParameter->__anon1.dataType->decl);
1658 if(newType)
1659 {
1660 FreeType(dest);
1661 dest = newType;
1662 }
1663 }
1664 if(!dest->passAsTemplate && dest->kind == 8 && dest->__anon1._class && dest->__anon1._class->__anon1.registered)
1665 {
1666 struct __ecereNameSpace__ecere__com__Class * dc = dest->__anon1._class->__anon1.registered;
1667
1668 if(sc->templateClass)
1669 sc = sc->templateClass;
1670 if(dc->templateClass)
1671 dc = dc->templateClass;
1672 if(dc->base && sc != dc)
1673 {
1674 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
1675 e->type = 11;
1676 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
1677 }
1678 }
1679 FreeType(dest);
1680 }
1681 }
1682 }
1683 FreeType(src);
1684 }
1685 }
1686 }
1687
1688 static void InstDeclPassDeclaration(struct Declaration *  decl);
1689
1690 static void InstDeclPassSpecifier(struct Specifier * spec, unsigned int byRefTypedObject)
1691 {
1692 switch(spec->type)
1693 {
1694 case 0:
1695 if(spec->__anon1.specifier == TYPED_OBJECT)
1696 {
1697 spec->type = 5;
1698 spec->__anon1.__anon1.extDecl = MkExtDeclString(__ecereNameSpace__ecere__sys__CopyString(byRefTypedObject ? "struct __ecereNameSpace__ecere__com__Class * class, void *" : "struct __ecereNameSpace__ecere__com__Class * class, const void *"));
1699 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1700 }
1701 break;
1702 case 1:
1703 break;
1704 case 2:
1705 {
1706 struct Enumerator * e;
1707
1708 if(spec->__anon1.__anon2.list)
1709 {
1710 for(e = (*spec->__anon1.__anon2.list).first; e; e = e->next)
1711 {
1712 }
1713 }
1714 break;
1715 }
1716 case 3:
1717 case 4:
1718 {
1719 if(spec->__anon1.__anon2.definitions)
1720 {
1721 struct ClassDef * def;
1722
1723 for(def = (*spec->__anon1.__anon2.definitions).first; def; def = def->next)
1724 if(def->__anon1.decl)
1725 InstDeclPassDeclaration(def->__anon1.decl);
1726 }
1727 if(spec->__anon1.__anon2.id)
1728 InstDeclPassIdentifier(spec->__anon1.__anon2.id);
1729 break;
1730 }
1731 case 5:
1732 if(spec->__anon1.__anon1.extDecl && spec->__anon1.__anon1.extDecl->type == 0 && spec->__anon1.__anon1.extDecl->__anon1.s)
1733 {
1734 if(!strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "dllexport"))
1735 {
1736 struct Specifier * prevSpec;
1737
1738 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1739 for(prevSpec = spec->prev; prevSpec; prevSpec = prevSpec->prev)
1740 if(prevSpec->type == 0 && prevSpec->__anon1.specifier == EXTERN)
1741 break;
1742 if(prevSpec)
1743 {
1744 if(targetPlatform == 1)
1745 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__declspec(dllexport)");
1746 else
1747 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__ ((visibility(\"default\")))");
1748 }
1749 else
1750 {
1751 if(targetPlatform == 1)
1752 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1753 else
1754 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1755 }
1756 }
1757 else if(!strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "stdcall") || !strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "_stdcall") || !strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "__stdcall") || !strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "__stdcall__"))
1758 {
1759 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1760 if(targetPlatform == 1)
1761 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1762 else
1763 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1764 }
1765 }
1766 break;
1767 }
1768 }
1769
1770 void InstDeclPassTypeName(struct TypeName *  type, unsigned int param);
1771
1772 static void InstDeclPassDeclarator(struct Declarator * decl)
1773 {
1774 switch(decl->type)
1775 {
1776 case 0:
1777 if(decl->declarator)
1778 InstDeclPassDeclarator(decl->declarator);
1779 break;
1780 case 1:
1781 {
1782 if(decl->__anon1.identifier)
1783 InstDeclPassIdentifier(decl->__anon1.identifier);
1784 break;
1785 }
1786 case 2:
1787 if(decl->declarator)
1788 InstDeclPassDeclarator(decl->declarator);
1789 break;
1790 case 3:
1791 if(decl->declarator)
1792 InstDeclPassDeclarator(decl->declarator);
1793 break;
1794 case 4:
1795 {
1796 if(decl->declarator)
1797 InstDeclPassDeclarator(decl->declarator);
1798 if(decl->__anon1.function.parameters)
1799 {
1800 struct TypeName * type;
1801
1802 if(decl->declarator)
1803 InstDeclPassDeclarator(decl->declarator);
1804 for(type = (*decl->__anon1.function.parameters).first; type; type = type->next)
1805 {
1806 unsigned int typedObject = 0;
1807 struct Specifier * spec = (((void *)0));
1808
1809 if(type->qualifiers)
1810 {
1811 spec = (struct Specifier *)(*type->qualifiers).first;
1812 if(spec && spec->type == 1 && !strcmp(spec->__anon1.__anon1.name, "class"))
1813 typedObject = 1;
1814 }
1815 InstDeclPassTypeName(type, 1);
1816 if(typedObject)
1817 {
1818 struct TypeName * _class = (_class = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), _class->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), _class->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), _class);
1819
1820 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1821 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->__anon1.function.parameters), spec->prev, _class);
1822 }
1823 }
1824 }
1825 break;
1826 }
1827 case 5:
1828 case 6:
1829 case 7:
1830 if((decl->type == 6 || decl->type == 7) && decl->__anon1.extended.extended)
1831 {
1832 if(decl->__anon1.extended.extended->type == 0 && decl->__anon1.extended.extended->__anon1.s && !strcmp(decl->__anon1.extended.extended->__anon1.s, "dllexport"))
1833 {
1834 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1835 if(targetPlatform == 1)
1836 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1837 else
1838 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1839 }
1840 else if(decl->__anon1.extended.extended->type == 0 && decl->__anon1.extended.extended->__anon1.s && (!strcmp(decl->__anon1.extended.extended->__anon1.s, "stdcall") || !strcmp(decl->__anon1.extended.extended->__anon1.s, "_stdcall") || !strcmp(decl->__anon1.extended.extended->__anon1.s, "__stdcall") || !strcmp(decl->__anon1.extended.extended->__anon1.s, "__stdcall__")))
1841 {
1842 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1843 if(targetPlatform == 1)
1844 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1845 else
1846 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1847 }
1848 }
1849 if(decl->declarator)
1850 InstDeclPassDeclarator(decl->declarator);
1851 break;
1852 }
1853 }
1854
1855 void InstDeclPassTypeName(struct TypeName * type, unsigned int param)
1856 {
1857 if(type->qualifiers)
1858 {
1859 struct Specifier * spec;
1860
1861 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1862 {
1863 int result;
1864
1865 if((result = ReplaceClassSpec(type->qualifiers, spec, param)))
1866 ReplaceByInstancePtr(spec, &type->declarator, result);
1867 else
1868 {
1869 struct Symbol * classSym = (spec->type == 1) ? spec->__anon1.__anon1.symbol : (((void *)0));
1870
1871 if(type->classObjectType && (!classSym || (classSym && classSym->__anon1.registered && (classSym->__anon1.registered->type == 4 || classSym->__anon1.registered->type == 2 || classSym->__anon1.registered->type == 3))))
1872 ReplaceByInstancePtr(spec, &type->declarator, 2);
1873 }
1874 InstDeclPassSpecifier(spec, type->declarator && type->declarator->type == 5);
1875 }
1876 }
1877 if(type->declarator)
1878 InstDeclPassDeclarator(type->declarator);
1879 }
1880
1881 static void InstDeclPassExpression(struct Expression *  exp);
1882
1883 static void InstDeclPassInitializer(struct Initializer * init)
1884 {
1885 switch(init->type)
1886 {
1887 case 0:
1888 if(init->__anon1.exp)
1889 {
1890 InstDeclPassExpression(init->__anon1.exp);
1891 AddPointerCast(init->__anon1.exp);
1892 }
1893 break;
1894 case 1:
1895 {
1896 struct Initializer * i;
1897
1898 for(i = (*init->__anon1.list).first; i; i = i->next)
1899 InstDeclPassInitializer(i);
1900 break;
1901 }
1902 }
1903 }
1904
1905 static void InstDeclPassStatement(struct Statement * stmt)
1906 {
1907 switch(stmt->type)
1908 {
1909 case 14:
1910 if(stmt->__anon1.decl)
1911 InstDeclPassDeclaration(stmt->__anon1.decl);
1912 break;
1913 case 0:
1914 InstDeclPassStatement(stmt->__anon1.labeled.stmt);
1915 break;
1916 case 1:
1917 if(stmt->__anon1.caseStmt.exp)
1918 InstDeclPassExpression(stmt->__anon1.caseStmt.exp);
1919 if(stmt->__anon1.caseStmt.stmt)
1920 InstDeclPassStatement(stmt->__anon1.caseStmt.stmt);
1921 break;
1922 case 2:
1923 {
1924 struct Declaration * decl;
1925 struct Statement * s;
1926 struct Context * prevContext = curContext;
1927
1928 if(!stmt->__anon1.compound.isSwitch)
1929 curContext = stmt->__anon1.compound.context;
1930 if(stmt->__anon1.compound.declarations)
1931 {
1932 for(decl = (*stmt->__anon1.compound.declarations).first; decl; decl = decl->next)
1933 InstDeclPassDeclaration(decl);
1934 }
1935 if(stmt->__anon1.compound.statements)
1936 {
1937 for(s = (*stmt->__anon1.compound.statements).first; s; s = s->next)
1938 InstDeclPassStatement(s);
1939 }
1940 curContext = prevContext;
1941 break;
1942 }
1943 case 3:
1944 {
1945 if(stmt->__anon1.expressions)
1946 {
1947 struct Expression * exp;
1948
1949 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
1950 InstDeclPassExpression(exp);
1951 }
1952 break;
1953 }
1954 case 4:
1955 {
1956 if(stmt->__anon1.ifStmt.exp)
1957 {
1958 struct Expression * exp;
1959
1960 for(exp = (*stmt->__anon1.ifStmt.exp).first; exp; exp = exp->next)
1961 InstDeclPassExpression(exp);
1962 }
1963 if(stmt->__anon1.ifStmt.stmt)
1964 InstDeclPassStatement(stmt->__anon1.ifStmt.stmt);
1965 if(stmt->__anon1.ifStmt.elseStmt)
1966 InstDeclPassStatement(stmt->__anon1.ifStmt.elseStmt);
1967 break;
1968 }
1969 case 5:
1970 {
1971 struct Expression * exp;
1972
1973 if(stmt->__anon1.switchStmt.exp)
1974 {
1975 for(exp = (*stmt->__anon1.switchStmt.exp).first; exp; exp = exp->next)
1976 InstDeclPassExpression(exp);
1977 }
1978 InstDeclPassStatement(stmt->__anon1.switchStmt.stmt);
1979 break;
1980 }
1981 case 6:
1982 {
1983 struct Expression * exp;
1984
1985 if(stmt->__anon1.whileStmt.exp)
1986 {
1987 for(exp = (*stmt->__anon1.whileStmt.exp).first; exp; exp = exp->next)
1988 InstDeclPassExpression(exp);
1989 }
1990 InstDeclPassStatement(stmt->__anon1.whileStmt.stmt);
1991 break;
1992 }
1993 case 7:
1994 {
1995 if(stmt->__anon1.doWhile.exp)
1996 {
1997 struct Expression * exp;
1998
1999 for(exp = (*stmt->__anon1.doWhile.exp).first; exp; exp = exp->next)
2000 InstDeclPassExpression(exp);
2001 }
2002 if(stmt->__anon1.doWhile.stmt)
2003 InstDeclPassStatement(stmt->__anon1.doWhile.stmt);
2004 break;
2005 }
2006 case 8:
2007 {
2008 struct Expression * exp;
2009
2010 if(stmt->__anon1.forStmt.init)
2011 InstDeclPassStatement(stmt->__anon1.forStmt.init);
2012 if(stmt->__anon1.forStmt.check)
2013 InstDeclPassStatement(stmt->__anon1.forStmt.check);
2014 if(stmt->__anon1.forStmt.increment)
2015 {
2016 for(exp = (*stmt->__anon1.forStmt.increment).first; exp; exp = exp->next)
2017 InstDeclPassExpression(exp);
2018 }
2019 if(stmt->__anon1.forStmt.stmt)
2020 InstDeclPassStatement(stmt->__anon1.forStmt.stmt);
2021 break;
2022 }
2023 case 9:
2024 break;
2025 case 10:
2026 break;
2027 case 11:
2028 break;
2029 case 12:
2030 {
2031 struct Expression * exp;
2032
2033 if(stmt->__anon1.expressions)
2034 {
2035 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
2036 InstDeclPassExpression(exp);
2037 AddPointerCast((*stmt->__anon1.expressions).last);
2038 }
2039 break;
2040 }
2041 case 13:
2042 {
2043 struct AsmField * field;
2044
2045 if(stmt->__anon1.asmStmt.inputFields)
2046 {
2047 for(field = (*stmt->__anon1.asmStmt.inputFields).first; field; field = field->next)
2048 if(field->expression)
2049 InstDeclPassExpression(field->expression);
2050 }
2051 if(stmt->__anon1.asmStmt.outputFields)
2052 {
2053 for(field = (*stmt->__anon1.asmStmt.outputFields).first; field; field = field->next)
2054 if(field->expression)
2055 InstDeclPassExpression(field->expression);
2056 }
2057 if(stmt->__anon1.asmStmt.clobberedFields)
2058 {
2059 for(field = (*stmt->__anon1.asmStmt.clobberedFields).first; field; field = field->next)
2060 if(field->expression)
2061 InstDeclPassExpression(field->expression);
2062 }
2063 break;
2064 }
2065 }
2066 }
2067
2068 static void InstDeclPassDeclaration(struct Declaration * decl)
2069 {
2070 switch(decl->type)
2071 {
2072 case 1:
2073 {
2074 if(decl->__anon1.__anon1.specifiers)
2075 {
2076 struct Specifier * spec;
2077
2078 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2079 {
2080 int type;
2081
2082 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2083 {
2084 struct InitDeclarator * d;
2085
2086 if(decl->__anon1.__anon1.declarators)
2087 {
2088 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2089 ReplaceByInstancePtr(spec, &d->declarator, type);
2090 }
2091 }
2092 InstDeclPassSpecifier(spec, 0);
2093 }
2094 }
2095 if(decl->__anon1.__anon1.declarators)
2096 {
2097 struct InitDeclarator * d;
2098
2099 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2100 {
2101 InstDeclPassDeclarator(d->declarator);
2102 if(d->initializer)
2103 InstDeclPassInitializer(d->initializer);
2104 }
2105 }
2106 break;
2107 }
2108 case 0:
2109 {
2110 if(decl->__anon1.__anon1.specifiers)
2111 {
2112 struct Specifier * spec;
2113
2114 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2115 {
2116 int type;
2117
2118 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2119 {
2120 if(decl->__anon1.__anon1.declarators)
2121 {
2122 struct Declarator * d;
2123
2124 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2125 ReplaceByInstancePtr(spec, &d, type);
2126 }
2127 }
2128 InstDeclPassSpecifier(spec, 0);
2129 }
2130 }
2131 if(decl->__anon1.__anon1.declarators)
2132 {
2133 struct Declarator * d;
2134
2135 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2136 InstDeclPassDeclarator(d);
2137 }
2138 break;
2139 }
2140 case 2:
2141 break;
2142 }
2143 }
2144
2145 static void InstDeclPassExpression(struct Expression * exp)
2146 {
2147 switch(exp->type)
2148 {
2149 case 0:
2150 {
2151 if(exp->__anon1.__anon1.identifier)
2152 InstDeclPassIdentifier(exp->__anon1.__anon1.identifier);
2153 break;
2154 }
2155 case 2:
2156 break;
2157 case 3:
2158 break;
2159 case 4:
2160 if(exp->__anon1.op.exp1)
2161 InstDeclPassExpression(exp->__anon1.op.exp1);
2162 if(exp->__anon1.op.exp2)
2163 {
2164 InstDeclPassExpression(exp->__anon1.op.exp2);
2165 if(exp->__anon1.op.op != '=' && exp->__anon1.op.exp1 && exp->__anon1.op.exp1->expType && exp->__anon1.op.exp1->expType->kind == 13 && exp->__anon1.op.exp1->expType->__anon1.type && exp->__anon1.op.exp1->expType->__anon1.type->kind == 20 && exp->__anon1.op.exp2->expType && exp->__anon1.op.exp2->expType->kind == 13 && exp->__anon1.op.exp2->expType->__anon1.type && exp->__anon1.op.exp2->expType->__anon1.type->kind == 20)
2166 {
2167 struct Expression * e = exp->__anon1.op.exp2;
2168
2169 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2170 e->type = 11;
2171 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2172 e = exp->__anon1.op.exp1;
2173 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2174 e->type = 11;
2175 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2176 }
2177 else if(exp->__anon1.op.exp1 && (exp->__anon1.op.op == '=' || exp->__anon1.op.op == EQ_OP || exp->__anon1.op.op == NE_OP))
2178 AddPointerCast(exp->__anon1.op.exp2);
2179 }
2180 break;
2181 case 32:
2182 case 5:
2183 {
2184 struct Expression * e;
2185
2186 for(e = (*exp->__anon1.list).first; e; e = e->next)
2187 InstDeclPassExpression(e);
2188 break;
2189 }
2190 case 6:
2191 {
2192 struct Expression * e;
2193
2194 InstDeclPassExpression(exp->__anon1.index.exp);
2195 for(e = (*exp->__anon1.index.index).first; e; e = e->next)
2196 InstDeclPassExpression(e);
2197 break;
2198 }
2199 case 7:
2200 {
2201 struct Expression * e;
2202
2203 InstDeclPassExpression(exp->__anon1.call.exp);
2204 if(exp->__anon1.call.arguments)
2205 {
2206 for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
2207 {
2208 InstDeclPassExpression(e);
2209 AddPointerCast(e);
2210 if(e->expType && e->expType->kind == 13 && e->expType->__anon1.type && (e->expType->__anon1.type->kind == 8 || (e->expType->__anon1.type->kind == 13 && e->expType->__anon1.type->__anon1.type && e->expType->__anon1.type->__anon1.type->kind != 0)) && e->destType && e->destType->kind == 13 && e->destType->__anon1.type && e->destType->__anon1.type->kind == 13 && e->destType->__anon1.type->__anon1.type && e->destType->__anon1.type->__anon1.type->kind == 0 && (e->type != 11 || !IsVoidPtrCast(e->__anon1.cast.typeName)))
2211 {
2212 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2213 e->type = 11;
2214 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2215 }
2216 }
2217 }
2218 break;
2219 }
2220 case 8:
2221 {
2222 if(exp->__anon1.member.exp)
2223 InstDeclPassExpression(exp->__anon1.member.exp);
2224 break;
2225 }
2226 case 9:
2227 {
2228 if(exp->__anon1.member.exp)
2229 InstDeclPassExpression(exp->__anon1.member.exp);
2230 break;
2231 }
2232 case 10:
2233 InstDeclPassTypeName(exp->__anon1.typeName, 0);
2234 break;
2235 case 11:
2236 {
2237 struct Type * type = exp->expType;
2238
2239 if(type && type->kind == 8 && type->__anon1._class->__anon1.registered && type->__anon1._class->__anon1.registered->type == 1 && !exp->needCast)
2240 {
2241 if(exp->destType && exp->destType->classObjectType == 2 && exp->destType->byReference)
2242 {
2243 FreeTypeName(exp->__anon1.cast.typeName);
2244 exp->__anon1.cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), MkPointer((((void *)0)), (((void *)0)))), (((void *)0))));
2245 }
2246 else
2247 {
2248 struct Expression * castExp = exp->__anon1.cast.exp;
2249 struct Expression * prev = exp->prev, * next = exp->next;
2250
2251 exp->__anon1.cast.exp = (((void *)0));
2252 FreeExpContents(exp);
2253 FreeType(exp->expType);
2254 FreeType(exp->destType);
2255 *exp = *castExp;
2256 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
2257 exp->prev = prev;
2258 exp->next = next;
2259 InstDeclPassExpression(exp);
2260 }
2261 }
2262 else
2263 {
2264 if(exp->expType && exp->expType->kind == 13)
2265 {
2266 if(exp->__anon1.cast.exp && exp->__anon1.cast.exp->expType && exp->__anon1.cast.exp->expType->kind == 20 && !__ecereProp_Type_Get_isPointerType(exp->__anon1.cast.exp->expType))
2267 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2268 }
2269 InstDeclPassTypeName(exp->__anon1.cast.typeName, ((unsigned int)((exp->usage & 0x4) >> 2)));
2270 if(exp->__anon1.cast.exp)
2271 {
2272 if(exp->expType && exp->expType->kind == 20 && exp->destType && (exp->destType->passAsTemplate || (!exp->destType->__anon1.templateParameter || (!exp->destType->__anon1.templateParameter->__anon1.dataType && !exp->destType->__anon1.templateParameter->dataTypeString))) && exp->__anon1.cast.exp->expType && !exp->__anon1.cast.exp->expType->passAsTemplate && __ecereProp_Type_Get_isPointerType(exp->__anon1.cast.exp->expType))
2273 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2274 InstDeclPassExpression(exp->__anon1.cast.exp);
2275 }
2276 }
2277 break;
2278 }
2279 case 12:
2280 {
2281 struct Expression * e;
2282
2283 InstDeclPassExpression(exp->__anon1.cond.cond);
2284 for(e = (*exp->__anon1.cond.exp).first; e; e = e->next)
2285 InstDeclPassExpression(e);
2286 InstDeclPassExpression(exp->__anon1.cond.elseExp);
2287 break;
2288 }
2289 case 23:
2290 {
2291 InstDeclPassStatement(exp->__anon1.compound);
2292 break;
2293 }
2294 case 34:
2295 {
2296 InstDeclPassExpression(exp->__anon1.vaArg.exp);
2297 break;
2298 }
2299 case 33:
2300 {
2301 InstDeclPassTypeName(exp->__anon1.initializer.typeName, 0);
2302 InstDeclPassInitializer(exp->__anon1.initializer.initializer);
2303 break;
2304 }
2305 }
2306 }
2307
2308 void ProcessInstanceDeclarations()
2309 {
2310 struct External * external;
2311
2312 curContext = globalContext;
2313 for(external = (*ast).first; external; external = external->next)
2314 {
2315 curExternal = external;
2316 if(external->type == 0)
2317 {
2318 struct FunctionDefinition * func = external->__anon1.function;
2319
2320 if(func->specifiers)
2321 {
2322 struct Specifier * spec;
2323
2324 for(spec = (*func->specifiers).first; spec; spec = spec->next)
2325 {
2326 int type;
2327
2328 if((type = ReplaceClassSpec(func->specifiers, spec, 0)))
2329 ReplaceByInstancePtr(spec, &func->declarator, type);
2330 InstDeclPassSpecifier(spec, 0);
2331 }
2332 }
2333 InstDeclPassDeclarator(func->declarator);
2334 if(func->body)
2335 InstDeclPassStatement(func->body);
2336 }
2337 else if(external->type == 1)
2338 {
2339 if(external->__anon1.declaration)
2340 InstDeclPassDeclaration(external->__anon1.declaration);
2341 }
2342 }
2343 TopoSort(ast);
2344 }
2345
2346 void __ecereRegisterModule_pass3(struct __ecereNameSpace__ecere__com__Instance * module)
2347 {
2348 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
2349
2350 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("InstDeclPassTypeName", "void InstDeclPassTypeName(TypeName type, bool param)", InstDeclPassTypeName, module, 2);
2351 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("IsVoidPtrCast", "bool IsVoidPtrCast(TypeName typeName)", IsVoidPtrCast, module, 2);
2352 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("TopoSort", "void TopoSort(ecere::sys::OldList * input)", TopoSort, module, 2);
2353 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstanceDeclarations", "void ProcessInstanceDeclarations(void)", ProcessInstanceDeclarations, module, 1);
2354 }
2355