40daa7eee4365459ed1a3f590577a878c60d6f28
[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 __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 = 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 __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 = 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 __ecereNameSpace__ecere__com__LinkList *)(((char *)m->outgoing + 0 + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->first; e2; e2 = n2)
1281 {
1282 n2 = 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(sc->templateClass)
1672 sc = sc->templateClass;
1673 if(dc->templateClass)
1674 dc = dc->templateClass;
1675 if(dc->base && sc != dc)
1676 {
1677 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
1678 e->type = 11;
1679 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
1680 }
1681 }
1682 FreeType(dest);
1683 }
1684 }
1685 }
1686 FreeType(src);
1687 }
1688 }
1689 }
1690
1691 static void InstDeclPassDeclaration(struct Declaration *  decl);
1692
1693 static void InstDeclPassSpecifier(struct Specifier * spec, unsigned int byRefTypedObject)
1694 {
1695 switch(spec->type)
1696 {
1697 case 0:
1698 if(spec->__anon1.specifier == TYPED_OBJECT)
1699 {
1700 spec->type = 5;
1701 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 *"));
1702 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1703 }
1704 break;
1705 case 1:
1706 break;
1707 case 2:
1708 {
1709 struct Enumerator * e;
1710
1711 if(spec->__anon1.__anon2.list)
1712 {
1713 for(e = (*spec->__anon1.__anon2.list).first; e; e = e->next)
1714 {
1715 }
1716 }
1717 break;
1718 }
1719 case 3:
1720 case 4:
1721 {
1722 if(spec->__anon1.__anon2.definitions)
1723 {
1724 struct ClassDef * def;
1725
1726 for(def = (*spec->__anon1.__anon2.definitions).first; def; def = def->next)
1727 if(def->__anon1.decl)
1728 InstDeclPassDeclaration(def->__anon1.decl);
1729 }
1730 if(spec->__anon1.__anon2.id)
1731 InstDeclPassIdentifier(spec->__anon1.__anon2.id);
1732 break;
1733 }
1734 case 5:
1735 if(spec->__anon1.__anon1.extDecl && spec->__anon1.__anon1.extDecl->type == 0 && spec->__anon1.__anon1.extDecl->__anon1.s)
1736 {
1737 if(!strcmp(spec->__anon1.__anon1.extDecl->__anon1.s, "dllexport"))
1738 {
1739 struct Specifier * prevSpec;
1740
1741 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1742 for(prevSpec = spec->prev; prevSpec; prevSpec = prevSpec->prev)
1743 if(prevSpec->type == 0 && prevSpec->__anon1.specifier == EXTERN)
1744 break;
1745 if(prevSpec)
1746 {
1747 if(targetPlatform == 1)
1748 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__declspec(dllexport)");
1749 else
1750 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__ ((visibility(\"default\")))");
1751 }
1752 else
1753 {
1754 if(targetPlatform == 1)
1755 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1756 else
1757 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1758 }
1759 }
1760 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__"))
1761 {
1762 (__ecereNameSpace__ecere__com__eSystem_Delete(spec->__anon1.__anon1.extDecl->__anon1.s), spec->__anon1.__anon1.extDecl->__anon1.s = 0);
1763 if(targetPlatform == 1)
1764 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1765 else
1766 spec->__anon1.__anon1.extDecl->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1767 }
1768 }
1769 break;
1770 }
1771 }
1772
1773 void InstDeclPassTypeName(struct TypeName *  type, unsigned int param);
1774
1775 static void InstDeclPassDeclarator(struct Declarator * decl)
1776 {
1777 switch(decl->type)
1778 {
1779 case 0:
1780 if(decl->declarator)
1781 InstDeclPassDeclarator(decl->declarator);
1782 break;
1783 case 1:
1784 {
1785 if(decl->__anon1.identifier)
1786 InstDeclPassIdentifier(decl->__anon1.identifier);
1787 break;
1788 }
1789 case 2:
1790 if(decl->declarator)
1791 InstDeclPassDeclarator(decl->declarator);
1792 break;
1793 case 3:
1794 if(decl->declarator)
1795 InstDeclPassDeclarator(decl->declarator);
1796 break;
1797 case 4:
1798 {
1799 if(decl->declarator)
1800 InstDeclPassDeclarator(decl->declarator);
1801 if(decl->__anon1.function.parameters)
1802 {
1803 struct TypeName * type;
1804
1805 if(decl->declarator)
1806 InstDeclPassDeclarator(decl->declarator);
1807 for(type = (*decl->__anon1.function.parameters).first; type; type = type->next)
1808 {
1809 unsigned int typedObject = 0;
1810 struct Specifier * spec = (((void *)0));
1811
1812 if(type->qualifiers)
1813 {
1814 spec = (struct Specifier *)(*type->qualifiers).first;
1815 if(spec && spec->type == 1 && !strcmp(spec->__anon1.__anon1.name, "class"))
1816 typedObject = 1;
1817 }
1818 InstDeclPassTypeName(type, 1);
1819 if(typedObject)
1820 {
1821 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);
1822
1823 DeclareStruct(curExternal, "ecere::com::Class", 0, 1);
1824 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->__anon1.function.parameters), spec->prev, _class);
1825 }
1826 }
1827 }
1828 break;
1829 }
1830 case 5:
1831 case 6:
1832 case 7:
1833 if((decl->type == 6 || decl->type == 7) && decl->__anon1.extended.extended)
1834 {
1835 if(decl->__anon1.extended.extended->type == 0 && decl->__anon1.extended.extended->__anon1.s && !strcmp(decl->__anon1.extended.extended->__anon1.s, "dllexport"))
1836 {
1837 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1838 if(targetPlatform == 1)
1839 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __declspec(dllexport)");
1840 else
1841 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("extern __attribute__ ((visibility(\"default\")))");
1842 }
1843 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__")))
1844 {
1845 (__ecereNameSpace__ecere__com__eSystem_Delete(decl->__anon1.extended.extended->__anon1.s), decl->__anon1.extended.extended->__anon1.s = 0);
1846 if(targetPlatform == 1)
1847 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("__attribute__((__stdcall__))");
1848 else
1849 decl->__anon1.extended.extended->__anon1.s = __ecereNameSpace__ecere__sys__CopyString("");
1850 }
1851 }
1852 if(decl->declarator)
1853 InstDeclPassDeclarator(decl->declarator);
1854 break;
1855 }
1856 }
1857
1858 void InstDeclPassTypeName(struct TypeName * type, unsigned int param)
1859 {
1860 if(type->qualifiers)
1861 {
1862 struct Specifier * spec;
1863
1864 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1865 {
1866 int result;
1867
1868 if((result = ReplaceClassSpec(type->qualifiers, spec, param)))
1869 ReplaceByInstancePtr(spec, &type->declarator, result);
1870 else
1871 {
1872 struct Symbol * classSym = (spec->type == 1) ? spec->__anon1.__anon1.symbol : (((void *)0));
1873
1874 if(type->classObjectType && (!classSym || (classSym && classSym->__anon1.registered && (classSym->__anon1.registered->type == 4 || classSym->__anon1.registered->type == 2 || classSym->__anon1.registered->type == 3))))
1875 ReplaceByInstancePtr(spec, &type->declarator, 2);
1876 }
1877 InstDeclPassSpecifier(spec, type->declarator && type->declarator->type == 5);
1878 }
1879 }
1880 if(type->declarator)
1881 InstDeclPassDeclarator(type->declarator);
1882 }
1883
1884 static void InstDeclPassExpression(struct Expression *  exp);
1885
1886 static void InstDeclPassInitializer(struct Initializer * init)
1887 {
1888 switch(init->type)
1889 {
1890 case 0:
1891 if(init->__anon1.exp)
1892 {
1893 InstDeclPassExpression(init->__anon1.exp);
1894 AddPointerCast(init->__anon1.exp);
1895 }
1896 break;
1897 case 1:
1898 {
1899 struct Initializer * i;
1900
1901 for(i = (*init->__anon1.list).first; i; i = i->next)
1902 InstDeclPassInitializer(i);
1903 break;
1904 }
1905 }
1906 }
1907
1908 static void InstDeclPassStatement(struct Statement * stmt)
1909 {
1910 switch(stmt->type)
1911 {
1912 case 14:
1913 if(stmt->__anon1.decl)
1914 InstDeclPassDeclaration(stmt->__anon1.decl);
1915 break;
1916 case 0:
1917 InstDeclPassStatement(stmt->__anon1.labeled.stmt);
1918 break;
1919 case 1:
1920 if(stmt->__anon1.caseStmt.exp)
1921 InstDeclPassExpression(stmt->__anon1.caseStmt.exp);
1922 if(stmt->__anon1.caseStmt.stmt)
1923 InstDeclPassStatement(stmt->__anon1.caseStmt.stmt);
1924 break;
1925 case 2:
1926 {
1927 struct Declaration * decl;
1928 struct Statement * s;
1929 struct Context * prevContext = curContext;
1930
1931 if(!stmt->__anon1.compound.isSwitch)
1932 curContext = stmt->__anon1.compound.context;
1933 if(stmt->__anon1.compound.declarations)
1934 {
1935 for(decl = (*stmt->__anon1.compound.declarations).first; decl; decl = decl->next)
1936 InstDeclPassDeclaration(decl);
1937 }
1938 if(stmt->__anon1.compound.statements)
1939 {
1940 for(s = (*stmt->__anon1.compound.statements).first; s; s = s->next)
1941 InstDeclPassStatement(s);
1942 }
1943 curContext = prevContext;
1944 break;
1945 }
1946 case 3:
1947 {
1948 if(stmt->__anon1.expressions)
1949 {
1950 struct Expression * exp;
1951
1952 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
1953 InstDeclPassExpression(exp);
1954 }
1955 break;
1956 }
1957 case 4:
1958 {
1959 if(stmt->__anon1.ifStmt.exp)
1960 {
1961 struct Expression * exp;
1962
1963 for(exp = (*stmt->__anon1.ifStmt.exp).first; exp; exp = exp->next)
1964 InstDeclPassExpression(exp);
1965 }
1966 if(stmt->__anon1.ifStmt.stmt)
1967 InstDeclPassStatement(stmt->__anon1.ifStmt.stmt);
1968 if(stmt->__anon1.ifStmt.elseStmt)
1969 InstDeclPassStatement(stmt->__anon1.ifStmt.elseStmt);
1970 break;
1971 }
1972 case 5:
1973 {
1974 struct Expression * exp;
1975
1976 if(stmt->__anon1.switchStmt.exp)
1977 {
1978 for(exp = (*stmt->__anon1.switchStmt.exp).first; exp; exp = exp->next)
1979 InstDeclPassExpression(exp);
1980 }
1981 InstDeclPassStatement(stmt->__anon1.switchStmt.stmt);
1982 break;
1983 }
1984 case 6:
1985 {
1986 struct Expression * exp;
1987
1988 if(stmt->__anon1.whileStmt.exp)
1989 {
1990 for(exp = (*stmt->__anon1.whileStmt.exp).first; exp; exp = exp->next)
1991 InstDeclPassExpression(exp);
1992 }
1993 InstDeclPassStatement(stmt->__anon1.whileStmt.stmt);
1994 break;
1995 }
1996 case 7:
1997 {
1998 if(stmt->__anon1.doWhile.exp)
1999 {
2000 struct Expression * exp;
2001
2002 for(exp = (*stmt->__anon1.doWhile.exp).first; exp; exp = exp->next)
2003 InstDeclPassExpression(exp);
2004 }
2005 if(stmt->__anon1.doWhile.stmt)
2006 InstDeclPassStatement(stmt->__anon1.doWhile.stmt);
2007 break;
2008 }
2009 case 8:
2010 {
2011 struct Expression * exp;
2012
2013 if(stmt->__anon1.forStmt.init)
2014 InstDeclPassStatement(stmt->__anon1.forStmt.init);
2015 if(stmt->__anon1.forStmt.check)
2016 InstDeclPassStatement(stmt->__anon1.forStmt.check);
2017 if(stmt->__anon1.forStmt.increment)
2018 {
2019 for(exp = (*stmt->__anon1.forStmt.increment).first; exp; exp = exp->next)
2020 InstDeclPassExpression(exp);
2021 }
2022 if(stmt->__anon1.forStmt.stmt)
2023 InstDeclPassStatement(stmt->__anon1.forStmt.stmt);
2024 break;
2025 }
2026 case 9:
2027 break;
2028 case 10:
2029 break;
2030 case 11:
2031 break;
2032 case 12:
2033 {
2034 struct Expression * exp;
2035
2036 if(stmt->__anon1.expressions)
2037 {
2038 for(exp = (*stmt->__anon1.expressions).first; exp; exp = exp->next)
2039 InstDeclPassExpression(exp);
2040 AddPointerCast((*stmt->__anon1.expressions).last);
2041 }
2042 break;
2043 }
2044 case 13:
2045 {
2046 struct AsmField * field;
2047
2048 if(stmt->__anon1.asmStmt.inputFields)
2049 {
2050 for(field = (*stmt->__anon1.asmStmt.inputFields).first; field; field = field->next)
2051 if(field->expression)
2052 InstDeclPassExpression(field->expression);
2053 }
2054 if(stmt->__anon1.asmStmt.outputFields)
2055 {
2056 for(field = (*stmt->__anon1.asmStmt.outputFields).first; field; field = field->next)
2057 if(field->expression)
2058 InstDeclPassExpression(field->expression);
2059 }
2060 if(stmt->__anon1.asmStmt.clobberedFields)
2061 {
2062 for(field = (*stmt->__anon1.asmStmt.clobberedFields).first; field; field = field->next)
2063 if(field->expression)
2064 InstDeclPassExpression(field->expression);
2065 }
2066 break;
2067 }
2068 }
2069 }
2070
2071 static void InstDeclPassDeclaration(struct Declaration * decl)
2072 {
2073 switch(decl->type)
2074 {
2075 case 1:
2076 {
2077 if(decl->__anon1.__anon1.specifiers)
2078 {
2079 struct Specifier * spec;
2080
2081 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2082 {
2083 int type;
2084
2085 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2086 {
2087 struct InitDeclarator * d;
2088
2089 if(decl->__anon1.__anon1.declarators)
2090 {
2091 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2092 ReplaceByInstancePtr(spec, &d->declarator, type);
2093 }
2094 }
2095 InstDeclPassSpecifier(spec, 0);
2096 }
2097 }
2098 if(decl->__anon1.__anon1.declarators)
2099 {
2100 struct InitDeclarator * d;
2101
2102 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2103 {
2104 InstDeclPassDeclarator(d->declarator);
2105 if(d->initializer)
2106 InstDeclPassInitializer(d->initializer);
2107 }
2108 }
2109 break;
2110 }
2111 case 0:
2112 {
2113 if(decl->__anon1.__anon1.specifiers)
2114 {
2115 struct Specifier * spec;
2116
2117 for(spec = (*decl->__anon1.__anon1.specifiers).first; spec; spec = spec->next)
2118 {
2119 int type;
2120
2121 if((type = ReplaceClassSpec(decl->__anon1.__anon1.specifiers, spec, 0)))
2122 {
2123 if(decl->__anon1.__anon1.declarators)
2124 {
2125 struct Declarator * d;
2126
2127 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2128 ReplaceByInstancePtr(spec, &d, type);
2129 }
2130 }
2131 InstDeclPassSpecifier(spec, 0);
2132 }
2133 }
2134 if(decl->__anon1.__anon1.declarators)
2135 {
2136 struct Declarator * d;
2137
2138 for(d = (*decl->__anon1.__anon1.declarators).first; d; d = d->next)
2139 InstDeclPassDeclarator(d);
2140 }
2141 break;
2142 }
2143 case 2:
2144 break;
2145 }
2146 }
2147
2148 static void InstDeclPassExpression(struct Expression * exp)
2149 {
2150 switch(exp->type)
2151 {
2152 case 0:
2153 {
2154 if(exp->__anon1.__anon1.identifier)
2155 InstDeclPassIdentifier(exp->__anon1.__anon1.identifier);
2156 break;
2157 }
2158 case 2:
2159 break;
2160 case 3:
2161 break;
2162 case 4:
2163 if(exp->__anon1.op.exp1)
2164 InstDeclPassExpression(exp->__anon1.op.exp1);
2165 if(exp->__anon1.op.exp2)
2166 {
2167 InstDeclPassExpression(exp->__anon1.op.exp2);
2168 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)
2169 {
2170 struct Expression * e = exp->__anon1.op.exp2;
2171
2172 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2173 e->type = 11;
2174 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2175 e = exp->__anon1.op.exp1;
2176 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2177 e->type = 11;
2178 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2179 }
2180 else if(exp->__anon1.op.exp1 && (exp->__anon1.op.op == '=' || exp->__anon1.op.op == EQ_OP || exp->__anon1.op.op == NE_OP))
2181 AddPointerCast(exp->__anon1.op.exp2);
2182 }
2183 break;
2184 case 32:
2185 case 5:
2186 {
2187 struct Expression * e;
2188
2189 for(e = (*exp->__anon1.list).first; e; e = e->next)
2190 InstDeclPassExpression(e);
2191 break;
2192 }
2193 case 6:
2194 {
2195 struct Expression * e;
2196
2197 InstDeclPassExpression(exp->__anon1.index.exp);
2198 for(e = (*exp->__anon1.index.index).first; e; e = e->next)
2199 InstDeclPassExpression(e);
2200 break;
2201 }
2202 case 7:
2203 {
2204 struct Expression * e;
2205
2206 InstDeclPassExpression(exp->__anon1.call.exp);
2207 if(exp->__anon1.call.arguments)
2208 {
2209 for(e = (*exp->__anon1.call.arguments).first; e; e = e->next)
2210 {
2211 unsigned int addCast = 0;
2212
2213 InstDeclPassExpression(e);
2214 AddPointerCast(e);
2215 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)
2216 addCast = 1;
2217 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)
2218 addCast = 1;
2219 if(addCast && (e->type != 11 || !IsVoidPtrCast(e->__anon1.cast.typeName)))
2220 {
2221 e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
2222 e->type = 11;
2223 e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
2224 }
2225 }
2226 }
2227 break;
2228 }
2229 case 8:
2230 {
2231 if(exp->__anon1.member.exp)
2232 InstDeclPassExpression(exp->__anon1.member.exp);
2233 break;
2234 }
2235 case 9:
2236 {
2237 if(exp->__anon1.member.exp)
2238 InstDeclPassExpression(exp->__anon1.member.exp);
2239 break;
2240 }
2241 case 10:
2242 InstDeclPassTypeName(exp->__anon1.typeName, 0);
2243 break;
2244 case 11:
2245 {
2246 struct Type * type = exp->expType;
2247
2248 if(type && type->kind == 8 && type->__anon1._class->__anon1.registered && type->__anon1._class->__anon1.registered->type == 1 && !exp->needCast)
2249 {
2250 if(exp->destType && exp->destType->classObjectType == 2 && exp->destType->byReference)
2251 {
2252 FreeTypeName(exp->__anon1.cast.typeName);
2253 exp->__anon1.cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), MkPointer((((void *)0)), (((void *)0)))), (((void *)0))));
2254 }
2255 else
2256 {
2257 struct Expression * castExp = exp->__anon1.cast.exp;
2258 struct Expression * prev = exp->prev, * next = exp->next;
2259
2260 exp->__anon1.cast.exp = (((void *)0));
2261 FreeExpContents(exp);
2262 FreeType(exp->expType);
2263 FreeType(exp->destType);
2264 *exp = *castExp;
2265 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
2266 exp->prev = prev;
2267 exp->next = next;
2268 InstDeclPassExpression(exp);
2269 }
2270 }
2271 else
2272 {
2273 if(exp->expType && exp->expType->kind == 13)
2274 {
2275 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))
2276 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2277 }
2278 InstDeclPassTypeName(exp->__anon1.cast.typeName, ((unsigned int)((exp->usage & 0x4) >> 2)));
2279 if(exp->__anon1.cast.exp)
2280 {
2281 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))
2282 exp->__anon1.cast.exp = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uintptr")), (((void *)0))), exp->__anon1.cast.exp);
2283 InstDeclPassExpression(exp->__anon1.cast.exp);
2284 }
2285 }
2286 break;
2287 }
2288 case 12:
2289 {
2290 struct Expression * e;
2291
2292 InstDeclPassExpression(exp->__anon1.cond.cond);
2293 for(e = (*exp->__anon1.cond.exp).first; e; e = e->next)
2294 InstDeclPassExpression(e);
2295 InstDeclPassExpression(exp->__anon1.cond.elseExp);
2296 break;
2297 }
2298 case 23:
2299 {
2300 InstDeclPassStatement(exp->__anon1.compound);
2301 break;
2302 }
2303 case 34:
2304 {
2305 InstDeclPassExpression(exp->__anon1.vaArg.exp);
2306 break;
2307 }
2308 case 33:
2309 {
2310 InstDeclPassTypeName(exp->__anon1.initializer.typeName, 0);
2311 InstDeclPassInitializer(exp->__anon1.initializer.initializer);
2312 break;
2313 }
2314 }
2315 }
2316
2317 void ProcessInstanceDeclarations()
2318 {
2319 struct External * external;
2320
2321 curContext = globalContext;
2322 for(external = (*ast).first; external; external = external->next)
2323 {
2324 curExternal = external;
2325 if(external->type == 0)
2326 {
2327 struct FunctionDefinition * func = external->__anon1.function;
2328
2329 if(func->specifiers)
2330 {
2331 struct Specifier * spec;
2332
2333 for(spec = (*func->specifiers).first; spec; spec = spec->next)
2334 {
2335 int type;
2336
2337 if((type = ReplaceClassSpec(func->specifiers, spec, 0)))
2338 ReplaceByInstancePtr(spec, &func->declarator, type);
2339 InstDeclPassSpecifier(spec, 0);
2340 }
2341 }
2342 InstDeclPassDeclarator(func->declarator);
2343 if(func->body)
2344 InstDeclPassStatement(func->body);
2345 }
2346 else if(external->type == 1)
2347 {
2348 if(external->__anon1.declaration)
2349 InstDeclPassDeclaration(external->__anon1.declaration);
2350 }
2351 }
2352 TopoSort(ast);
2353 }
2354
2355 void __ecereRegisterModule_pass3(struct __ecereNameSpace__ecere__com__Instance * module)
2356 {
2357 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
2358
2359 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("InstDeclPassTypeName", "void InstDeclPassTypeName(TypeName type, bool param)", InstDeclPassTypeName, module, 2);
2360 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("IsVoidPtrCast", "bool IsVoidPtrCast(TypeName typeName)", IsVoidPtrCast, module, 2);
2361 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("TopoSort", "void TopoSort(ecere::sys::OldList * input)", TopoSort, module, 2);
2362 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstanceDeclarations", "void ProcessInstanceDeclarations(void)", ProcessInstanceDeclarations, module, 1);
2363 }
2364