c43efd6411264d2803b9990905329295c8915857
[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 struct __ecereNameSpace__ecere__com__Class * thisClassFrom;
684 int classObjectType;
685 int alignment;
686 unsigned int offset;
687 int bitFieldCount;
688 int count;
689 unsigned int isSigned : 1;
690 unsigned int constant : 1;
691 unsigned int truth : 1;
692 unsigned int byReference : 1;
693 unsigned int extraParam : 1;
694 unsigned int directClassAccess : 1;
695 unsigned int computing : 1;
696 unsigned int keepCast : 1;
697 unsigned int passAsTemplate : 1;
698 unsigned int dllExport : 1;
699 unsigned int attrStdcall : 1;
700 unsigned int declaredWithStruct : 1;
701 unsigned int typedByReference : 1;
702 unsigned int casted : 1;
703 unsigned int pointerAlignment : 1;
704 } __attribute__ ((gcc_struct));
705
706 unsigned int IsVoidPtrCast(struct TypeName * typeName)
707 {
708 unsigned int result = 0;
709 struct Declarator * d = typeName->declarator;
710
711 if(d && d->type == 5 && d->__anon1.pointer.pointer && !d->__anon1.pointer.pointer->pointer)
712 {
713 if(typeName->qualifiers)
714 {
715 struct Specifier * s;
716
717 for(s = (*typeName->qualifiers).first; s; s = s->next)
718 {
719 if(s->type == 0 && s->__anon1.specifier == VOID)
720 result = 1;
721 }
722 }
723 }
724 return result;
725 }
726
727 unsigned int __ecereProp_Type_Get_isPointerType(struct Type * this);
728
729 struct Enumerator;
730
731 struct Enumerator
732 {
733 struct Enumerator * prev;
734 struct Enumerator * next;
735 struct Location loc;
736 struct Identifier * id;
737 struct Expression * exp;
738 } __attribute__ ((gcc_struct));
739
740 struct Initializer;
741
742 struct Initializer
743 {
744 struct Initializer * prev;
745 struct Initializer * next;
746 struct Location loc;
747 int type;
748 union
749 {
750 struct Expression * exp;
751 struct __ecereNameSpace__ecere__sys__OldList *  list;
752 } __attribute__ ((gcc_struct)) __anon1;
753 unsigned int isConstant;
754 struct Identifier * id;
755 } __attribute__ ((gcc_struct));
756
757 struct InitDeclarator
758 {
759 struct InitDeclarator * prev;
760 struct InitDeclarator * next;
761 struct Location loc;
762 struct Declarator * declarator;
763 struct Initializer * initializer;
764 } __attribute__ ((gcc_struct));
765
766 struct Declaration;
767
768 struct ClassDef
769 {
770 struct ClassDef * prev;
771 struct ClassDef * next;
772 struct Location loc;
773 int type;
774 union
775 {
776 struct Declaration * decl;
777 struct ClassFunction * function;
778 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
779 struct PropertyDef * propertyDef;
780 struct PropertyWatch * propertyWatch;
781 char *  designer;
782 struct Identifier * defaultProperty;
783 struct
784 {
785 struct Identifier * id;
786 struct Initializer * initializer;
787 } __attribute__ ((gcc_struct)) __anon1;
788 } __attribute__ ((gcc_struct)) __anon1;
789 int memberAccess;
790 void *  object;
791 } __attribute__ ((gcc_struct));
792
793 struct Declaration
794 {
795 struct Declaration * prev;
796 struct Declaration * next;
797 struct Location loc;
798 int type;
799 union
800 {
801 struct
802 {
803 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
804 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
805 } __attribute__ ((gcc_struct)) __anon1;
806 struct Instantiation * inst;
807 struct
808 {
809 struct Identifier * id;
810 struct Expression * exp;
811 } __attribute__ ((gcc_struct)) __anon2;
812 } __attribute__ ((gcc_struct)) __anon1;
813 struct Specifier * extStorage;
814 struct Symbol * symbol;
815 int declMode;
816 } __attribute__ ((gcc_struct));
817
818 struct External
819 {
820 struct External * prev;
821 struct External * next;
822 struct Location loc;
823 int type;
824 struct Symbol * symbol;
825 union
826 {
827 struct FunctionDefinition * function;
828 struct ClassDefinition * _class;
829 struct Declaration * declaration;
830 char *  importString;
831 struct Identifier * id;
832 struct DBTableDef * table;
833 } __attribute__ ((gcc_struct)) __anon1;
834 int importType;
835 struct External * fwdDecl;
836 struct __ecereNameSpace__ecere__com__Instance * outgoing;
837 struct __ecereNameSpace__ecere__com__Instance * incoming;
838 int nonBreakableIncoming;
839 } __attribute__ ((gcc_struct));
840
841 struct External * __ecereMethod_External_ForwardDeclare();
842
843 struct AsmField;
844
845 struct AsmField
846 {
847 struct AsmField * prev;
848 struct AsmField * next;
849 struct Location loc;
850 char *  command;
851 struct Expression * expression;
852 struct Identifier * symbolic;
853 } __attribute__ ((gcc_struct));
854
855 struct __ecereNameSpace__ecere__com__NameSpace;
856
857 struct __ecereNameSpace__ecere__com__NameSpace
858 {
859 const char *  name;
860 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
861 struct __ecereNameSpace__ecere__com__NameSpace *  left;
862 struct __ecereNameSpace__ecere__com__NameSpace *  right;
863 int depth;
864 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
865 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
866 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
867 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
868 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
869 } __attribute__ ((gcc_struct));
870
871 struct __ecereNameSpace__ecere__com__Class
872 {
873 struct __ecereNameSpace__ecere__com__Class * prev;
874 struct __ecereNameSpace__ecere__com__Class * next;
875 const char *  name;
876 int offset;
877 int structSize;
878 void * *  _vTbl;
879 int vTblSize;
880 unsigned int (*  Constructor)(void * );
881 void (*  Destructor)(void * );
882 int offsetClass;
883 int sizeClass;
884 struct __ecereNameSpace__ecere__com__Class * base;
885 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
886 struct __ecereNameSpace__ecere__sys__BinaryTree members;
887 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
888 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
889 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
890 struct __ecereNameSpace__ecere__sys__OldList derivatives;
891 int memberID;
892 int startMemberID;
893 int type;
894 struct __ecereNameSpace__ecere__com__Instance * module;
895 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
896 const char *  dataTypeString;
897 struct Type * dataType;
898 int typeSize;
899 int defaultAlignment;
900 void (*  Initialize)();
901 int memberOffset;
902 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
903 const char *  designerClass;
904 unsigned int noExpansion;
905 const char *  defaultProperty;
906 unsigned int comRedefinition;
907 int count;
908 int isRemote;
909 unsigned int internalDecl;
910 void *  data;
911 unsigned int computeSize;
912 short structAlignment;
913 short pointerAlignment;
914 int destructionWatchOffset;
915 unsigned int fixed;
916 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
917 int inheritanceAccess;
918 const char *  fullName;
919 void *  symbol;
920 struct __ecereNameSpace__ecere__sys__OldList conversions;
921 struct __ecereNameSpace__ecere__sys__OldList templateParams;
922 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
923 struct __ecereNameSpace__ecere__com__Class * templateClass;
924 struct __ecereNameSpace__ecere__sys__OldList templatized;
925 int numParams;
926 unsigned int isInstanceClass;
927 unsigned int byValueSystemClass;
928 } __attribute__ ((gcc_struct));
929
930 struct __ecereNameSpace__ecere__com__Application
931 {
932 int argc;
933 const char * *  argv;
934 int exitCode;
935 unsigned int isGUIApp;
936 struct __ecereNameSpace__ecere__sys__OldList allModules;
937 char *  parsedCommand;
938 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
939 } __attribute__ ((gcc_struct));
940
941 extern void __ecereNameSpace__ecere__com__PrintLn(struct __ecereNameSpace__ecere__com__Class * class, const void * object, ...);
942
943 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
944
945 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
946
947 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
948
949 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
950
951 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__LinkList;
952
953 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_char__PTR_;
954
955 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TopoEdge;
956
957 struct __ecereNameSpace__ecere__com__Module
958 {
959 struct __ecereNameSpace__ecere__com__Instance * application;
960 struct __ecereNameSpace__ecere__sys__OldList classes;
961 struct __ecereNameSpace__ecere__sys__OldList defines;
962 struct __ecereNameSpace__ecere__sys__OldList functions;
963 struct __ecereNameSpace__ecere__sys__OldList modules;
964 struct __ecereNameSpace__ecere__com__Instance * prev;
965 struct __ecereNameSpace__ecere__com__Instance * next;
966 const char *  name;
967 void *  library;
968 void *  Unload;
969 int importType;
970 int origImportType;
971 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
972 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
973 } __attribute__ ((gcc_struct));
974
975 static void ReplaceByInstancePtr(struct Specifier * spec, struct Declarator ** declPtr, int type)
976 {
977 struct Declarator * decl = *declPtr;
978
979 if(decl && decl->type == 5)
980 {
981 if(type == 2)
982 ;
983 else
984 decl->__anon1.pointer.pointer = MkPointer((((void *)0)), decl->__anon1.pointer.pointer);
985 }
986 else
987 {
988 struct Declarator * newDecl = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Declarator);
989
990 if(decl)
991 {
992 *newDecl = *decl;
993 decl->declarator = newDecl;
994 }
995 else
996 decl = newDecl;
997 decl->type = 5;
998 decl->__anon1.pointer.pointer = MkPointer((((void *)0)), (((void *)0)));
999 *declPtr = decl;
1000 }
1001 }
1002
1003 static int ReplaceClassSpec(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Specifier * spec, unsigned int param)
1004 {
1005 if(spec->type == 8)
1006 {
1007 struct TemplateParameter * parameter = spec->__anon1.templateParameter;
1008
1009 if(!param && parameter->dataTypeString)
1010 {
1011 struct __ecereNameSpace__ecere__sys__OldList * newSpecs = MkList();
1012 struct Declarator * decl = SpecDeclFromString(parameter->dataTypeString, newSpecs, (((void *)0)));
1013
1014 if((*newSpecs).first)
1015 {
1016 struct Specifier * newSpec = CopySpecifier((*newSpecs).first);
1017
1018 *spec = *newSpec;
1019 ((newSpec ? (__ecereClass_Specifier->Destructor ? __ecereClass_Specifier->Destructor((void *)newSpec) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newSpec)) : 0), newSpec = 0);
1020 }
1021 FreeList(newSpecs, (void *)(FreeSpecifier));
1022 if(decl)
1023 {
1024 unsigned int isPointer = decl->type == 5;
1025
1026 if(decl)
1027 FreeDeclarator(decl);
1028 if(isPointer)
1029 return 1;
1030 }
1031 }
1032 else if(!param && parameter->__anon1.dataType)
1033 {
1034 struct __ecereNameSpace__ecere__sys__OldList * newSpecs = parameter->__anon1.dataType->specifiers;
1035 struct Declarator * decl = parameter->__anon1.dataType->decl;
1036
1037 if((*newSpecs).first)
1038 {
1039 struct Specifier * newSpec = CopySpecifier((*newSpecs).first);
1040
1041 *spec = *newSpec;
1042 ((newSpec ? (__ecereClass_Specifier->Destructor ? __ecereClass_Specifier->Destructor((void *)newSpec) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newSpec)) : 0), newSpec = 0);
1043 }
1044 if(decl)
1045 {
1046 unsigned int isPointer = decl->type == 5;
1047
1048 if(isPointer)
1049 return 1;
1050 }
1051 }
1052 else
1053 {
1054 spec->type = 1;
1055 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString("uint64");
1056 spec->__anon1.__anon1.symbol = FindClass("uint64");
1057 }
1058 }
1059 if(spec->type == 1 || spec->type == 7)
1060 {
1061 struct Symbol * classSym = spec->__anon1.__anon1.symbol;
1062
1063 if(spec->type == 7)
1064 {
1065 classSym = FindClass("ecere::com::Class");
1066 }
1067 if(classSym)
1068 {
1069 struct __ecereNameSpace__ecere__com__Class * _class = classSym->__anon1.registered;
1070
1071 FreeSpecifierContents(spec);
1072 spec->type = 1;
1073 if(_class && _class->type == 1)
1074 {
1075 char name[1024];
1076
1077 name[0] = (char)0;
1078 FullClassNameCat(name, _class->fullName, 0);
1079 FreeSpecifierContents(spec);
1080 spec->type = 3;
1081 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1082 spec->__anon1.__anon2.id = MkIdentifier(name);
1083 spec->__anon1.__anon2.list = (((void *)0));
1084 spec->__anon1.__anon2.definitions = (((void *)0));
1085 spec->__anon1.__anon2.ctx = (((void *)0));
1086 spec->__anon1.__anon2.addNameSpace = 0;
1087 }
1088 else if(_class && _class->type == 5)
1089 {
1090 char name[1024] = "";
1091
1092 FullClassNameCat(name, _class->fullName, 0);
1093 spec->type = 3;
1094 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1095 spec->__anon1.__anon2.id = MkIdentifier(name);
1096 spec->__anon1.__anon2.list = (((void *)0));
1097 spec->__anon1.__anon2.definitions = (((void *)0));
1098 spec->__anon1.__anon2.ctx = (((void *)0));
1099 spec->__anon1.__anon2.addNameSpace = 0;
1100 }
1101 else if(_class)
1102 {
1103 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")))
1104 {
1105 if(_class->dataTypeString)
1106 {
1107 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"))
1108 {
1109 if(!_class->dataType)
1110 _class->dataType = ProcessTypeString(_class->dataTypeString, 0);
1111 if(_class->dataType && _class->dataType->kind == 8)
1112 classSym = _class->dataType->__anon1._class;
1113 else
1114 classSym = FindClass(_class->dataTypeString);
1115 _class = classSym ? classSym->__anon1.registered : (((void *)0));
1116 }
1117 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString(!strcmp(_class->dataTypeString, "char *") ? "char" : _class->dataTypeString);
1118 spec->__anon1.__anon1.symbol = (((void *)0));
1119 }
1120 else
1121 {
1122 spec->__anon1.__anon1.name = __ecereNameSpace__ecere__sys__CopyString((((void *)0)));
1123 spec->__anon1.__anon1.symbol = (((void *)0));
1124 }
1125 }
1126 else if(!_class->base)
1127 {
1128 spec->type = 0;
1129 spec->__anon1.specifier = VOID;
1130 return 1;
1131 }
1132 }
1133 else
1134 {
1135 spec->type = 3;
1136 spec->__anon1.__anon2.id = MkIdentifier("__ecereNameSpace__ecere__com__Instance");
1137 spec->__anon1.__anon2.list = (((void *)0));
1138 spec->__anon1.__anon2.baseSpecs = (((void *)0));
1139 spec->__anon1.__anon2.definitions = (((void *)0));
1140 spec->__anon1.__anon2.ctx = (((void *)0));
1141 spec->__anon1.__anon2.addNameSpace = 0;
1142 }
1143 if(_class && _class->dataTypeString && !strcmp(_class->dataTypeString, "char *"))
1144 return 1;
1145 if(!_class || _class->type == 0 || _class->type == 5)
1146 return 1;
1147 else if(param && _class->type == 1)
1148 return 2;
1149 }
1150 }
1151 else if(spec->type == 0)
1152 {
1153 if(spec->__anon1.specifier == ANY_OBJECT || spec->__anon1.specifier == CLASS)
1154 {
1155 spec->__anon1.specifier = CONST;
1156 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(specs, MkSpecifier(VOID));
1157 return 1;
1158 }
1159 }
1160 return 0;
1161 }
1162
1163 void TopoSort(struct __ecereNameSpace__ecere__sys__OldList * input)
1164 {
1165 struct __ecereNameSpace__ecere__sys__OldList L =
1166 {
1167 0, 0, 0, 0, 0
1168 };
1169 struct __ecereNameSpace__ecere__sys__OldList S =
1170 {
1171 0, 0, 0, 0, 0
1172 };
1173 struct __ecereNameSpace__ecere__sys__OldList B =
1174 {
1175 0, 0, 0, 0, 0
1176 };
1177 struct External * n, * next;
1178
1179 for(n = (*input).first; n; n = next)
1180 {
1181 next = n->next;
1182 if(n->type == 1 && !n->__anon1.declaration)
1183 {
1184 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1185 if(n->symbol && n->symbol->__anon2.__anon1.structExternal == n)
1186 n->symbol->__anon2.__anon1.structExternal = (((void *)0));
1187 FreeExternal(n);
1188 }
1189 else if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)n->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1190 {
1191 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1192 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, n);
1193 }
1194 else if(!n->nonBreakableIncoming)
1195 {
1196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1197 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, n);
1198 }
1199 }
1200 while(1)
1201 {
1202 struct TopoEdge * e, * ne;
1203
1204 if((n = S.first))
1205 {
1206 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&S, (struct __ecereNameSpace__ecere__com__IteratorPointer *)n);
1207 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&L, n);
1208 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)
1209 {
1210 struct External * m = e->to;
1211 struct __ecereNameSpace__ecere__sys__OldList * list;
1212
1213 if(m->nonBreakableIncoming)
1214 {
1215 list = input;
1216 }
1217 else
1218 {
1219 list = &B;
1220 }
1221 if(!(*list).count)
1222 __ecereNameSpace__ecere__com__PrintLn(__ecereClass_char__PTR_, "!!! Something's wrong !!!", (void *)0);
1223 ne = ((struct TopoEdge *)(uintptr_t)e->out.next);
1224 if(!e->breakable)
1225 {
1226 m->nonBreakableIncoming--;
1227 }
1228 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1229 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = n->outgoing;
1230
1231 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1232 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(n->outgoing, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e);
1233 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1234 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = m->incoming;
1235
1236 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1237 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(m->incoming, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e);
1238 ((e ? (__ecereClass_TopoEdge->Destructor ? __ecereClass_TopoEdge->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
1239 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)m->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1240 {
1241 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*list), m);
1242 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, m);
1243 }
1244 else if(!m->nonBreakableIncoming)
1245 {
1246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*list), m);
1247 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, m);
1248 }
1249 }
1250 }
1251 else if((n = B.first))
1252 {
1253 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&B, (struct __ecereNameSpace__ecere__com__IteratorPointer *)n);
1254 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)
1255 {
1256 struct TopoEdge * e2, * n2;
1257 struct External * m = e->from;
1258 struct External * f;
1259
1260 f = __ecereMethod_External_ForwardDeclare(m);
1261 ne = ((struct TopoEdge *)(uintptr_t)e->in.next);
1262 {
1263 struct External * c, * next;
1264
1265 for(c = (*input).first; c; c = next)
1266 {
1267 next = c->next;
1268 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)c->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1269 {
1270 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), c);
1271 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, c);
1272 }
1273 else if(!c->nonBreakableIncoming)
1274 {
1275 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), c);
1276 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, c);
1277 }
1278 }
1279 }
1280 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)
1281 {
1282 n2 = ((struct TopoEdge *)(uintptr_t)e2->out.next);
1283 if(e2->breakable)
1284 {
1285 struct External * to = e2->to;
1286
1287 if(e2 == e)
1288 ;
1289 else
1290 ;
1291 e2->breakable = 0;
1292 e2->from = f;
1293 ((void (*)(struct __ecereNameSpace__ecere__com__Instance *, struct __ecereNameSpace__ecere__com__IteratorPointer * it))__extension__ ({
1294 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = m->outgoing;
1295
1296 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1297 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(m->outgoing, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e2);
1298 ((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, uint64 value))__extension__ ({
1299 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f->outgoing;
1300
1301 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
1302 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Add])(f->outgoing, (uint64)(uintptr_t)(e2));
1303 to->nonBreakableIncoming++;
1304 if(e2 != e && to->nonBreakableIncoming == 1)
1305 {
1306 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&B, to);
1307 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), to);
1308 }
1309 }
1310 }
1311 if(!((struct __ecereNameSpace__ecere__com__LinkList *)(((char *)f->incoming + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->count)
1312 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&S, f);
1313 else if(!f->nonBreakableIncoming)
1314 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&B, f);
1315 else
1316 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), f);
1317 if(S.first)
1318 break;
1319 }
1320 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*input), n);
1321 }
1322 else
1323 {
1324 if((*input).count)
1325 {
1326 Compiler_Error("declarations cycles found\n");
1327 }
1328 else
1329 *input = L;
1330 break;
1331 }
1332 }
1333 for(n = (*input).first; n; n = next)
1334 {
1335 next = n->next;
1336 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))))
1337 {
1338 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*input), n);
1339 if(n->symbol && n->symbol->__anon2.__anon1.structExternal == n)
1340 n->symbol->__anon2.__anon1.structExternal = (((void *)0));
1341 FreeExternal(n);
1342 }
1343 }
1344 }
1345
1346 void __ecereUnregisterModule_pass3(struct __ecereNameSpace__ecere__com__Instance * module)
1347 {
1348
1349 }
1350
1351 struct Statement;
1352
1353 typedef union YYSTYPE
1354 {
1355 int specifierType;
1356 int i;
1357 int declMode;
1358 struct Identifier * id;
1359 struct Expression * exp;
1360 struct Specifier * specifier;
1361 struct __ecereNameSpace__ecere__sys__OldList * list;
1362 struct Enumerator * enumerator;
1363 struct Declarator * declarator;
1364 struct Pointer * pointer;
1365 struct Initializer * initializer;
1366 struct InitDeclarator * initDeclarator;
1367 struct TypeName * typeName;
1368 struct Declaration * declaration;
1369 struct Statement * stmt;
1370 struct FunctionDefinition * function;
1371 struct External * external;
1372 struct Context * context;
1373 struct AsmField * asmField;
1374 struct Attrib * attrib;
1375 struct ExtDecl * extDecl;
1376 struct Attribute * attribute;
1377 struct Instantiation * instance;
1378 struct MembersInit * membersInit;
1379 struct MemberInit * memberInit;
1380 struct ClassFunction * classFunction;
1381 struct ClassDefinition * _class;
1382 struct ClassDef * classDef;
1383 struct PropertyDef * prop;
1384 char * string;
1385 struct Symbol * symbol;
1386 struct PropertyWatch * propertyWatch;
1387 struct TemplateParameter * templateParameter;
1388 struct TemplateArgument * templateArgument;
1389 struct TemplateDatatype * templateDatatype;
1390 struct DBTableEntry * dbtableEntry;
1391 struct DBIndexItem * dbindexItem;
1392 struct DBTableDef * dbtableDef;
1393 } __attribute__ ((gcc_struct)) YYSTYPE;
1394
1395 extern YYSTYPE yylval;
1396
1397 struct Expression
1398 {
1399 struct Expression * prev;
1400 struct Expression * next;
1401 struct Location loc;
1402 int type;
1403 union
1404 {
1405 struct
1406 {
1407 char *  constant;
1408 struct Identifier * identifier;
1409 } __attribute__ ((gcc_struct)) __anon1;
1410 struct Statement * compound;
1411 struct Instantiation * instance;
1412 struct
1413 {
1414 char *  string;
1415 unsigned int intlString;
1416 unsigned int wideString;
1417 } __attribute__ ((gcc_struct)) __anon2;
1418 struct __ecereNameSpace__ecere__sys__OldList *  list;
1419 struct
1420 {
1421 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
1422 struct Declarator * decl;
1423 } __attribute__ ((gcc_struct)) _classExp;
1424 struct
1425 {
1426 struct Identifier * id;
1427 } __attribute__ ((gcc_struct)) classData;
1428 struct
1429 {
1430 struct Expression * exp;
1431 struct __ecereNameSpace__ecere__sys__OldList * arguments;
1432 struct Location argLoc;
1433 } __attribute__ ((gcc_struct)) call;
1434 struct
1435 {
1436 struct Expression * exp;
1437 struct __ecereNameSpace__ecere__sys__OldList * index;
1438 } __attribute__ ((gcc_struct)) index;
1439 struct
1440 {
1441 struct Expression * exp;
1442 struct Identifier * member;
1443 int memberType;
1444 unsigned int thisPtr;
1445 } __attribute__ ((gcc_struct)) member;
1446 struct
1447 {
1448 int op;
1449 struct Expression * exp1;
1450 struct Expression * exp2;
1451 } __attribute__ ((gcc_struct)) op;
1452 struct TypeName * typeName;
1453 struct Specifier * _class;
1454 struct
1455 {
1456 struct TypeName * typeName;
1457 struct Expression * exp;
1458 } __attribute__ ((gcc_struct)) cast;
1459 struct
1460 {
1461 struct Expression * cond;
1462 struct __ecereNameSpace__ecere__sys__OldList * exp;
1463 struct Expression * elseExp;
1464 } __attribute__ ((gcc_struct)) cond;
1465 struct
1466 {
1467 struct TypeName * typeName;
1468 struct Expression * size;
1469 } __attribute__ ((gcc_struct)) _new;
1470 struct
1471 {
1472 struct TypeName * typeName;
1473 struct Expression * size;
1474 struct Expression * exp;
1475 } __attribute__ ((gcc_struct)) _renew;
1476 struct
1477 {
1478 char * table;
1479 struct Identifier * id;
1480 } __attribute__ ((gcc_struct)) db;
1481 struct
1482 {
1483 struct Expression * ds;
1484 struct Expression * name;
1485 } __attribute__ ((gcc_struct)) dbopen;
1486 struct
1487 {
1488 struct TypeName * typeName;
1489 struct Initializer * initializer;
1490 } __attribute__ ((gcc_struct)) initializer;
1491 struct
1492 {
1493 struct Expression * exp;
1494 struct TypeName * typeName;
1495 } __attribute__ ((gcc_struct)) vaArg;
1496 } __attribute__ ((gcc_struct)) __anon1;
1497 unsigned int debugValue;
1498 struct __ecereNameSpace__ecere__com__DataValue val;
1499 uint64 address;
1500 unsigned int hasAddress;
1501 struct Type * expType;
1502 struct Type * destType;
1503 unsigned int usage;
1504 int tempCount;
1505 unsigned int byReference;
1506 unsigned int isConstant;
1507 unsigned int addedThis;
1508 unsigned int needCast;
1509 unsigned int thisPtr;
1510 unsigned int opDestType;
1511 unsigned int needTemplateCast;
1512 } __attribute__ ((gcc_struct));
1513
1514 struct Statement
1515 {
1516 struct Statement * prev;
1517 struct Statement * next;
1518 struct Location loc;
1519 int type;
1520 union
1521 {
1522 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
1523 struct
1524 {
1525 struct Identifier * id;
1526 struct Statement * stmt;
1527 } __attribute__ ((gcc_struct)) labeled;
1528 struct
1529 {
1530 struct Expression * exp;
1531 struct Statement * stmt;
1532 } __attribute__ ((gcc_struct)) caseStmt;
1533 struct
1534 {
1535 struct __ecereNameSpace__ecere__sys__OldList * declarations;
1536 struct __ecereNameSpace__ecere__sys__OldList * statements;
1537 struct Context * context;
1538 unsigned int isSwitch;
1539 } __attribute__ ((gcc_struct)) compound;
1540 struct
1541 {
1542 struct __ecereNameSpace__ecere__sys__OldList * exp;
1543 struct Statement * stmt;
1544 struct Statement * elseStmt;
1545 } __attribute__ ((gcc_struct)) ifStmt;
1546 struct
1547 {
1548 struct __ecereNameSpace__ecere__sys__OldList * exp;
1549 struct Statement * stmt;
1550 } __attribute__ ((gcc_struct)) switchStmt;
1551 struct
1552 {
1553 struct __ecereNameSpace__ecere__sys__OldList * exp;
1554 struct Statement * stmt;
1555 } __attribute__ ((gcc_struct)) whileStmt;
1556 struct
1557 {
1558 struct __ecereNameSpace__ecere__sys__OldList * exp;
1559 struct Statement * stmt;
1560 } __attribute__ ((gcc_struct)) doWhile;
1561 struct
1562 {
1563 struct Statement * init;
1564 struct Statement * check;
1565 struct __ecereNameSpace__ecere__sys__OldList * increment;
1566 struct Statement * stmt;
1567 } __attribute__ ((gcc_struct)) forStmt;
1568 struct
1569 {
1570 struct Identifier * id;
1571 } __attribute__ ((gcc_struct)) gotoStmt;
1572 struct
1573 {
1574 struct Specifier * spec;
1575 char * statements;
1576 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
1577 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
1578 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
1579 } __attribute__ ((gcc_struct)) asmStmt;
1580 struct
1581 {
1582 struct Expression * watcher;
1583 struct Expression * object;
1584 struct __ecereNameSpace__ecere__sys__OldList * watches;
1585 } __attribute__ ((gcc_struct)) _watch;
1586 struct
1587 {
1588 struct Identifier * id;
1589 struct __ecereNameSpace__ecere__sys__OldList * exp;
1590 struct __ecereNameSpace__ecere__sys__OldList * filter;
1591 struct Statement * stmt;
1592 } __attribute__ ((gcc_struct)) forEachStmt;
1593 struct Declaration * decl;
1594 } __attribute__ ((gcc_struct)) __anon1;
1595 } __attribute__ ((gcc_struct));
1596
1597 struct FunctionDefinition
1598 {
1599 struct FunctionDefinition * prev;
1600 struct FunctionDefinition * next;
1601 struct Location loc;
1602 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1603 struct Declarator * declarator;
1604 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1605 struct Statement * body;
1606 struct __ecereNameSpace__ecere__com__Class * _class;
1607 struct __ecereNameSpace__ecere__sys__OldList attached;
1608 int declMode;
1609 struct Type * type;
1610 struct Symbol * propSet;
1611 int tempCount;
1612 unsigned int propertyNoThis;
1613 } __attribute__ ((gcc_struct));
1614
1615 static void AddPointerCast(struct Expression * e)
1616 {
1617 struct Type * src = e->expType;
1618
1619 if(src && (src->kind == 20 || src->kind == 8))
1620 {
1621 if(e->type != 11 || !IsVoidPtrCast(e->__anon1.cast.typeName))
1622 {
1623 if(src)
1624 src->refCount++;
1625 if(src->kind == 20 && src->__anon1.templateParameter && src->__anon1.templateParameter->type == 0)
1626 {
1627 struct Type * newType = (((void *)0));
1628
1629 if(src->__anon1.templateParameter->dataTypeString)
1630 newType = ProcessTypeString(src->__anon1.templateParameter->dataTypeString, 0);
1631 else if(src->__anon1.templateParameter->__anon1.dataType)
1632 newType = ProcessType(src->__anon1.templateParameter->__anon1.dataType->specifiers, src->__anon1.templateParameter->__anon1.dataType->decl);
1633 if(newType)
1634 {
1635 FreeType(src);
1636 src = newType;
1637 }
1638 }
1639 if(src && src->kind == 8 && src->__anon1._class)
1640 {
1641 struct __ecereNameSpace__ecere__com__Class * sc = src->__anon1._class->__anon1.registered;
1642
1643 if(src->thisClassFrom)
1644 sc = src->thisClassFrom;
1645 if(sc && (sc->type == 1 || sc->type == 5))
1646 {
1647 struct Type * dest = e->destType;
1648
1649 if(dest && (dest->kind == 20 || dest->kind == 8))
1650 {
1651 if(dest)
1652 dest->refCount++;
1653 if(dest->kind == 20 && dest->__anon1.templateParameter && dest->__anon1.templateParameter->type == 0)
1654 {
1655 struct Type * newType = (((void *)0));
1656
1657 if(dest->__anon1.templateParameter->dataTypeString)
1658 newType = ProcessTypeString(dest->__anon1.templateParameter->dataTypeString, 0);
1659 else if(dest->__anon1.templateParameter->__anon1.dataType)
1660 newType = ProcessType(dest->__anon1.templateParameter->__anon1.dataType->specifiers, dest->__anon1.templateParameter->__anon1.dataType->decl);
1661 if(newType)
1662 {
1663 FreeType(dest);
1664 dest = newType;
1665 }
1666 }
1667 if(!dest->passAsTemplate && dest->kind == 8 && dest->__anon1._class && dest->__anon1._class->__anon1.registered)
1668 {
1669 struct __ecereNameSpace__ecere__com__Class * dc = dest->__anon1._class->__anon1.registered;
1670
1671 if(dest->thisClassFrom)
1672 dc = dest->thisClassFrom;
1673 if(sc->templateClass)
1674 sc = sc->templateClass;
1675 if(dc->templateClass)
1676 dc = dc->templateClass;
1677 if(dc->base && sc != dc)
1678 {
1679 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
1680 e->type = 11;
1681 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
1682 }
1683 }
1684 FreeType(dest);
1685 }
1686 }
1687 }
1688 FreeType(src);
1689 }
1690 }
1691 }
1692
1693 static void InstDeclPassDeclaration(struct Declaration *  decl);
1694
1695 static void InstDeclPassSpecifier(struct Specifier * spec, unsigned int byRefTypedObject)
1696 {
1697 switch(spec->type)
1698 {
1699 case 0:
1700 if(spec->__anon1.specifier == TYPED_OBJECT)
1701 {
1702 spec->type = 5;
1703 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 *"));
1704 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1705 }
1706 break;
1707 case 1:
1708 break;
1709 case 2:
1710 {
1711 struct Enumerator * e;
1712
1713 if(spec->__anon1.__anon2.list)
1714 {
1715 for(e = (*spec->__anon1.__anon2.list).first; e; e = e->next)
1716 {
1717 }
1718 }
1719 break;
1720 }
1721 case 3:
1722 case 4:
1723 {
1724 if(spec->__anon1.__anon2.definitions)
1725 {
1726 struct ClassDef * def;
1727
1728 for(def = (*spec->__anon1.__anon2.definitions).first; def; def = def->next)
1729 if(def->__anon1.decl)
1730 InstDeclPassDeclaration(def->__anon1.decl);
1731 }
1732 if(spec->__anon1.__anon2.id)
1733 InstDeclPassIdentifier(spec->__anon1.__anon2.id);
1734 break;
1735 }
1736 case 5:
1737 if(spec->__anon1.__anon1.extDecl && spec->__anon1.__anon1.extDecl->type == 0 && spec->__anon1.__anon1.extDecl->__anon1.s)
1738 {
1739 if(!strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "dllexport"))
1740 {
1741 struct Specifier * prevSpec;
1742
1743 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1744 for(prevSpec = spec->prev; prevSpec; prevSpec = prevSpec->prev)
1745 if(prevSpec->type == 0 && prevSpec->__anon1.specifier == EXTERN)
1746 break;
1747 if(prevSpec)
1748 {
1749 if(targetPlatform == 1)
1750 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__declspec(dllexport)");
1751 else
1752 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__ ((visibility(\"default\")))");
1753 }
1754 else
1755 {
1756 if(targetPlatform == 1)
1757 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1758 else
1759 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1760 }
1761 }
1762 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__"))
1763 {
1764 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1765 if(targetPlatform == 1)
1766 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1767 else
1768 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1769 }
1770 }
1771 break;
1772 }
1773 }
1774
1775 void InstDeclPassTypeName(struct TypeName *  type, unsigned int param);
1776
1777 static void InstDeclPassDeclarator(struct Declarator * decl)
1778 {
1779 switch(decl->type)
1780 {
1781 case 0:
1782 if(decl->declarator)
1783 InstDeclPassDeclarator(decl->declarator);
1784 break;
1785 case 1:
1786 {
1787 if(decl->__anon1.identifier)
1788 InstDeclPassIdentifier(decl->__anon1.identifier);
1789 break;
1790 }
1791 case 2:
1792 if(decl->declarator)
1793 InstDeclPassDeclarator(decl->declarator);
1794 break;
1795 case 3:
1796 if(decl->declarator)
1797 InstDeclPassDeclarator(decl->declarator);
1798 break;
1799 case 4:
1800 {
1801 if(decl->declarator)
1802 InstDeclPassDeclarator(decl->declarator);
1803 if(decl->__anon1.function.parameters)
1804 {
1805 struct TypeName * type;
1806
1807 if(decl->declarator)
1808 InstDeclPassDeclarator(decl->declarator);
1809 for(type = (*decl->__anon1.function.parameters).first; type; type = type->next)
1810 {
1811 unsigned int typedObject = 0;
1812 struct Specifier * spec = (((void *)0));
1813
1814 if(type->qualifiers)
1815 {
1816 spec = (struct Specifier *)(*type->qualifiers).first;
1817 if(spec && spec->type == 1 && !strcmp(spec->__anon1.__anon1.name, "class"))
1818 typedObject = 1;
1819 }
1820 InstDeclPassTypeName(type, 1);
1821 if(typedObject)
1822 {
1823 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);
1824
1825 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1826 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->__anon1.function.parameters), spec->prev, _class);
1827 }
1828 }
1829 }
1830 break;
1831 }
1832 case 5:
1833 case 6:
1834 case 7:
1835 if((decl->type == 6 || decl->type == 7) && decl->__anon1.extended.extended)
1836 {
1837 if(decl->__anon1.extended.extended->type == 0 && decl->__anon1.extended.extended->__anon1.s && !strcmp(decl->__anon1.extended.extended->__anon1.s, "dllexport"))
1838 {
1839 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1840 if(targetPlatform == 1)
1841 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1842 else
1843 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1844 }
1845 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__")))
1846 {
1847 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1848 if(targetPlatform == 1)
1849 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1850 else
1851 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1852 }
1853 }
1854 if(decl->declarator)
1855 InstDeclPassDeclarator(decl->declarator);
1856 break;
1857 }
1858 }
1859
1860 void InstDeclPassTypeName(struct TypeName * type, unsigned int param)
1861 {
1862 if(type->qualifiers)
1863 {
1864 struct Specifier * spec;
1865
1866 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1867 {
1868 int result;
1869
1870 if((result = ReplaceClassSpec(type->qualifiers, spec, param)))
1871 ReplaceByInstancePtr(spec, &type->declarator, result);
1872 else
1873 {
1874 struct Symbol * classSym = (spec->type == 1) ? spec->__anon1.__anon1.symbol : (((void *)0));
1875
1876 if(type->classObjectType && (!classSym || (classSym && classSym->__anon1.registered && (classSym->__anon1.registered->type == 4 || classSym->__anon1.registered->type == 2 || classSym->__anon1.registered->type == 3))))
1877 ReplaceByInstancePtr(spec, &type->declarator, 2);
1878 }
1879 InstDeclPassSpecifier(spec, type->declarator && type->declarator->type == 5);
1880 }
1881 }
1882 if(type->declarator)
1883 InstDeclPassDeclarator(type->declarator);
1884 }
1885
1886 static void InstDeclPassExpression(struct Expression *  exp);
1887
1888 static void InstDeclPassInitializer(struct Initializer * init)
1889 {
1890 switch(init->type)
1891 {
1892 case 0:
1893 if(init->__anon1.exp)
1894 {
1895 InstDeclPassExpression(init->__anon1.exp);
1896 AddPointerCast(init->__anon1.exp);
1897 }
1898 break;
1899 case 1:
1900 {
1901 struct Initializer * i;
1902
1903 for(i = (*init->__anon1.list).first; i; i = i->next)
1904 InstDeclPassInitializer(i);
1905 break;
1906 }
1907 }
1908 }
1909
1910 static void InstDeclPassStatement(struct Statement * stmt)
1911 {
1912 switch(stmt->type)
1913 {
1914 case 14:
1915 if(stmt->__anon1.decl)
1916 InstDeclPassDeclaration(stmt->__anon1.decl);
1917 break;
1918 case 0:
1919 InstDeclPassStatement(stmt->__anon1.labeled.stmt);
1920 break;
1921 case 1:
1922 if(stmt->__anon1.caseStmt.exp)
1923 InstDeclPassExpression(stmt->__anon1.caseStmt.exp);
1924 if(stmt->__anon1.caseStmt.stmt)
1925 InstDeclPassStatement(stmt->__anon1.caseStmt.stmt);
1926 break;
1927 case 2:
1928 {
1929 struct Declaration * decl;
1930 struct Statement * s;
1931 struct Context * prevContext = curContext;
1932
1933 if(!stmt->__anon1.compound.isSwitch)
1934 curContext = stmt->__anon1.compound.context;
1935 if(stmt->__anon1.compound.declarations)
1936 {
1937 for(decl = (*stmt->__anon1.compound.declarations).first; decl; decl = decl->next)
1938 InstDeclPassDeclaration(decl);
1939 }
1940 if(stmt->__anon1.compound.statements)
1941 {
1942 for(s = (*stmt->__anon1.compound.statements).first; s; s = s->next)
1943 InstDeclPassStatement(s);
1944 }
1945 curContext = prevContext;
1946 break;
1947 }
1948 case 3:
1949 {
1950 if(stmt->__anon1.expressions)
1951 {
1952 struct Expression * exp;
1953
1954 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
1955 InstDeclPassExpression(exp);
1956 }
1957 break;
1958 }
1959 case 4:
1960 {
1961 if(stmt->__anon1.ifStmt.exp)
1962 {
1963 struct Expression * exp;
1964
1965 for(exp = (*stmt->__anon1.ifStmt.exp).first; exp; exp = exp->next)
1966 InstDeclPassExpression(exp);
1967 }
1968 if(stmt->__anon1.ifStmt.stmt)
1969 InstDeclPassStatement(stmt->__anon1.ifStmt.stmt);
1970 if(stmt->__anon1.ifStmt.elseStmt)
1971 InstDeclPassStatement(stmt->__anon1.ifStmt.elseStmt);
1972 break;
1973 }
1974 case 5:
1975 {
1976 struct Expression * exp;
1977
1978 if(stmt->__anon1.switchStmt.exp)
1979 {
1980 for(exp = (*stmt->__anon1.switchStmt.exp).first; exp; exp = exp->next)
1981 InstDeclPassExpression(exp);
1982 }
1983 InstDeclPassStatement(stmt->__anon1.switchStmt.stmt);
1984 break;
1985 }
1986 case 6:
1987 {
1988 struct Expression * exp;
1989
1990 if(stmt->__anon1.whileStmt.exp)
1991 {
1992 for(exp = (*stmt->__anon1.whileStmt.exp).first; exp; exp = exp->next)
1993 InstDeclPassExpression(exp);
1994 }
1995 InstDeclPassStatement(stmt->__anon1.whileStmt.stmt);
1996 break;
1997 }
1998 case 7:
1999 {
2000 if(stmt->__anon1.doWhile.exp)
2001 {
2002 struct Expression * exp;
2003
2004 for(exp = (*stmt->__anon1.doWhile.exp).first; exp; exp = exp->next)
2005 InstDeclPassExpression(exp);
2006 }
2007 if(stmt->__anon1.doWhile.stmt)
2008 InstDeclPassStatement(stmt->__anon1.doWhile.stmt);
2009 break;
2010 }
2011 case 8:
2012 {
2013 struct Expression * exp;
2014
2015 if(stmt->__anon1.forStmt.init)
2016 InstDeclPassStatement(stmt->__anon1.forStmt.init);
2017 if(stmt->__anon1.forStmt.check)
2018 InstDeclPassStatement(stmt->__anon1.forStmt.check);
2019 if(stmt->__anon1.forStmt.increment)
2020 {
2021 for(exp = (*stmt->__anon1.forStmt.increment).first; exp; exp = exp->next)
2022 InstDeclPassExpression(exp);
2023 }
2024 if(stmt->__anon1.forStmt.stmt)
2025 InstDeclPassStatement(stmt->__anon1.forStmt.stmt);
2026 break;
2027 }
2028 case 9:
2029 break;
2030 case 10:
2031 break;
2032 case 11:
2033 break;
2034 case 12:
2035 {
2036 struct Expression * exp;
2037
2038 if(stmt->__anon1.expressions)
2039 {
2040 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
2041 InstDeclPassExpression(exp);
2042 AddPointerCast((*stmt->__anon1.expressions).last);
2043 }
2044 break;
2045 }
2046 case 13:
2047 {
2048 struct AsmField * field;
2049
2050 if(stmt->__anon1.asmStmt.inputFields)
2051 {
2052 for(field = (*stmt->__anon1.asmStmt.inputFields).first; field; field = field->next)
2053 if(field->expression)
2054 InstDeclPassExpression(field->expression);
2055 }
2056 if(stmt->__anon1.asmStmt.outputFields)
2057 {
2058 for(field = (*stmt->__anon1.asmStmt.outputFields).first; field; field = field->next)
2059 if(field->expression)
2060 InstDeclPassExpression(field->expression);
2061 }
2062 if(stmt->__anon1.asmStmt.clobberedFields)
2063 {
2064 for(field = (*stmt->__anon1.asmStmt.clobberedFields).first; field; field = field->next)
2065 if(field->expression)
2066 InstDeclPassExpression(field->expression);
2067 }
2068 break;
2069 }
2070 }
2071 }
2072
2073 static void InstDeclPassDeclaration(struct Declaration * decl)
2074 {
2075 switch(decl->type)
2076 {
2077 case 1:
2078 {
2079 if(decl->__anon1.__anon1.specifiers)
2080 {
2081 struct Specifier * spec;
2082
2083 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2084 {
2085 int type;
2086
2087 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2088 {
2089 struct InitDeclarator * d;
2090
2091 if(decl->__anon1.__anon1.declarators)
2092 {
2093 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2094 ReplaceByInstancePtr(spec, &d->declarator, type);
2095 }
2096 }
2097 InstDeclPassSpecifier(spec, 0);
2098 }
2099 }
2100 if(decl->__anon1.__anon1.declarators)
2101 {
2102 struct InitDeclarator * d;
2103
2104 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2105 {
2106 InstDeclPassDeclarator(d->declarator);
2107 if(d->initializer)
2108 InstDeclPassInitializer(d->initializer);
2109 }
2110 }
2111 break;
2112 }
2113 case 0:
2114 {
2115 if(decl->__anon1.__anon1.specifiers)
2116 {
2117 struct Specifier * spec;
2118
2119 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2120 {
2121 int type;
2122
2123 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2124 {
2125 if(decl->__anon1.__anon1.declarators)
2126 {
2127 struct Declarator * d;
2128
2129 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2130 ReplaceByInstancePtr(spec, &d, type);
2131 }
2132 }
2133 InstDeclPassSpecifier(spec, 0);
2134 }
2135 }
2136 if(decl->__anon1.__anon1.declarators)
2137 {
2138 struct Declarator * d;
2139
2140 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2141 InstDeclPassDeclarator(d);
2142 }
2143 break;
2144 }
2145 case 2:
2146 break;
2147 }
2148 }
2149
2150 static void InstDeclPassExpression(struct Expression * exp)
2151 {
2152 switch(exp->type)
2153 {
2154 case 0:
2155 {
2156 if(exp->__anon1.__anon1.identifier)
2157 InstDeclPassIdentifier(exp->__anon1.__anon1.identifier);
2158 break;
2159 }
2160 case 2:
2161 break;
2162 case 3:
2163 break;
2164 case 4:
2165 if(exp->__anon1.op.exp1)
2166 InstDeclPassExpression(exp->__anon1.op.exp1);
2167 if(exp->__anon1.op.exp2)
2168 {
2169 InstDeclPassExpression(exp->__anon1.op.exp2);
2170 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)
2171 {
2172 struct Expression * e = exp->__anon1.op.exp2;
2173
2174 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2175 e->type = 11;
2176 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2177 e = exp->__anon1.op.exp1;
2178 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2179 e->type = 11;
2180 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2181 }
2182 else if(exp->__anon1.op.exp1 && (exp->__anon1.op.op == '=' || exp->__anon1.op.op == EQ_OP || exp->__anon1.op.op == NE_OP))
2183 AddPointerCast(exp->__anon1.op.exp2);
2184 }
2185 break;
2186 case 32:
2187 case 5:
2188 {
2189 struct Expression * e;
2190
2191 for(e = (*exp->__anon1.list).first; e; e = e->next)
2192 InstDeclPassExpression(e);
2193 break;
2194 }
2195 case 6:
2196 {
2197 struct Expression * e;
2198
2199 InstDeclPassExpression(exp->__anon1.index.exp);
2200 for(e = (*exp->__anon1.index.index).first; e; e = e->next)
2201 InstDeclPassExpression(e);
2202 break;
2203 }
2204 case 7:
2205 {
2206 struct Expression * e;
2207
2208 InstDeclPassExpression(exp->__anon1.call.exp);
2209 if(exp->__anon1.call.arguments)
2210 {
2211 for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
2212 {
2213 unsigned int addCast = 0;
2214
2215 InstDeclPassExpression(e);
2216 AddPointerCast(e);
2217 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)
2218 addCast = 1;
2219 else if(e->expType && e->expType->kind == 8 && e->expType->__anon1._class && e->expType->__anon1._class->__anon1.registered && e->expType->__anon1._class->__anon1.registered->type == 1 && e->byReference && e->destType && e->destType->kind == 8 && e->destType->classObjectType && e->destType->byReference)
2220 addCast = 1;
2221 if(addCast && (e->type != 11 || !IsVoidPtrCast(e->__anon1.cast.typeName)))
2222 {
2223 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2224 e->type = 11;
2225 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2226 }
2227 }
2228 }
2229 break;
2230 }
2231 case 8:
2232 {
2233 if(exp->__anon1.member.exp)
2234 InstDeclPassExpression(exp->__anon1.member.exp);
2235 break;
2236 }
2237 case 9:
2238 {
2239 if(exp->__anon1.member.exp)
2240 InstDeclPassExpression(exp->__anon1.member.exp);
2241 break;
2242 }
2243 case 10:
2244 InstDeclPassTypeName(exp->__anon1.typeName, 0);
2245 break;
2246 case 11:
2247 {
2248 struct Type * type = exp->expType;
2249
2250 if(type && type->kind == 8 && type->__anon1._class->__anon1.registered && type->__anon1._class->__anon1.registered->type == 1 && !exp->needCast)
2251 {
2252 if(exp->destType && exp->destType->classObjectType == 2 && exp->destType->byReference)
2253 {
2254 FreeTypeName(exp->__anon1.cast.typeName);
2255 exp->__anon1.cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), MkPointer((((void *)0)), (((void *)0)))), (((void *)0))));
2256 }
2257 else
2258 {
2259 struct Expression * castExp = exp->__anon1.cast.exp;
2260 struct Expression * prev = exp->prev, * next = exp->next;
2261
2262 exp->__anon1.cast.exp = (((void *)0));
2263 FreeExpContents(exp);
2264 FreeType(exp->expType);
2265 FreeType(exp->destType);
2266 *exp = *castExp;
2267 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
2268 exp->prev = prev;
2269 exp->next = next;
2270 InstDeclPassExpression(exp);
2271 }
2272 }
2273 else
2274 {
2275 if(exp->expType && exp->expType->kind == 13)
2276 {
2277 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))
2278 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2279 }
2280 InstDeclPassTypeName(exp->__anon1.cast.typeName, ((unsigned int)((exp->usage & 0x4) >> 2)));
2281 if(exp->__anon1.cast.exp)
2282 {
2283 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))
2284 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2285 InstDeclPassExpression(exp->__anon1.cast.exp);
2286 }
2287 }
2288 break;
2289 }
2290 case 12:
2291 {
2292 struct Expression * e;
2293
2294 InstDeclPassExpression(exp->__anon1.cond.cond);
2295 for(e = (*exp->__anon1.cond.exp).first; e; e = e->next)
2296 InstDeclPassExpression(e);
2297 InstDeclPassExpression(exp->__anon1.cond.elseExp);
2298 break;
2299 }
2300 case 23:
2301 {
2302 InstDeclPassStatement(exp->__anon1.compound);
2303 break;
2304 }
2305 case 34:
2306 {
2307 InstDeclPassExpression(exp->__anon1.vaArg.exp);
2308 break;
2309 }
2310 case 33:
2311 {
2312 InstDeclPassTypeName(exp->__anon1.initializer.typeName, 0);
2313 InstDeclPassInitializer(exp->__anon1.initializer.initializer);
2314 break;
2315 }
2316 }
2317 }
2318
2319 void ProcessInstanceDeclarations()
2320 {
2321 struct External * external;
2322
2323 curContext = globalContext;
2324 for(external = (*ast).first; external; external = external->next)
2325 {
2326 curExternal = external;
2327 if(external->type == 0)
2328 {
2329 struct FunctionDefinition * func = external->__anon1.function;
2330
2331 if(func->specifiers)
2332 {
2333 struct Specifier * spec;
2334
2335 for(spec = (*func->specifiers).first; spec; spec = spec->next)
2336 {
2337 int type;
2338
2339 if((type = ReplaceClassSpec(func->specifiers, spec, 0)))
2340 ReplaceByInstancePtr(spec, &func->declarator, type);
2341 InstDeclPassSpecifier(spec, 0);
2342 }
2343 }
2344 InstDeclPassDeclarator(func->declarator);
2345 if(func->body)
2346 InstDeclPassStatement(func->body);
2347 }
2348 else if(external->type == 1)
2349 {
2350 if(external->__anon1.declaration)
2351 InstDeclPassDeclaration(external->__anon1.declaration);
2352 }
2353 }
2354 TopoSort(ast);
2355 }
2356
2357 void __ecereRegisterModule_pass3(struct __ecereNameSpace__ecere__com__Instance * module)
2358 {
2359 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
2360
2361 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("InstDeclPassTypeName", "void InstDeclPassTypeName(TypeName type, bool param)", InstDeclPassTypeName, module, 2);
2362 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("IsVoidPtrCast", "bool IsVoidPtrCast(TypeName typeName)", IsVoidPtrCast, module, 2);
2363 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("TopoSort", "void TopoSort(ecere::sys::OldList * input)", TopoSort, module, 2);
2364 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstanceDeclarations", "void ProcessInstanceDeclarations(void)", ProcessInstanceDeclarations, module, 1);
2365 }
2366