compiler/libec: (#341, #351, #644, #771) Improved enum type matching and type handlin...
[sdk] / compiler / bootstrap / libec / bootstrap / pass0.c
1 /* Code generated from eC source file: pass0.ec */
2 #if defined(__GNUC__)
3 typedef long long int64;
4 typedef unsigned long long uint64;
5 #ifndef _WIN32
6 #define __declspec(x)
7 #endif
8 #elif defined(__TINYC__)
9 #include <stdarg.h>
10 #define __builtin_va_list va_list
11 #define __builtin_va_start va_start
12 #define __builtin_va_end va_end
13 #ifdef _WIN32
14 #define strcasecmp stricmp
15 #define strncasecmp strnicmp
16 #define __declspec(x) __attribute__((x))
17 #else
18 #define __declspec(x)
19 #endif
20 typedef long long int64;
21 typedef unsigned long long uint64;
22 #else
23 typedef __int64 int64;
24 typedef unsigned __int64 uint64;
25 #endif
26 #ifdef __BIG_ENDIAN__
27 #define __ENDIAN_PAD(x) (8 - (x))
28 #else
29 #define __ENDIAN_PAD(x) 0
30 #endif
31 #include <stdint.h>
32 #include <sys/types.h>
33
34 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
35 #define _64BIT 1
36 #else
37 #define _64BIT 0
38 #endif
39
40 #define arch_PointerSize                  sizeof(void *)
41 #define structSize_Instance               (_64BIT ? 24 : 12)
42 #define structSize_Module                 (_64BIT ? 560 : 300)
43
44 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
45
46 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
47
48 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
49
50 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
51
52 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
53
54 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
55
56 struct __ecereNameSpace__ecere__sys__BTNode;
57
58 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
59
60 struct __ecereNameSpace__ecere__sys__BinaryTree
61 {
62 struct __ecereNameSpace__ecere__sys__BTNode * root;
63 int count;
64 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
65 void (*  FreeKey)(void *  key);
66 } __attribute__ ((gcc_struct));
67
68 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
69
70 struct __ecereNameSpace__ecere__sys__OldList
71 {
72 void *  first;
73 void *  last;
74 int count;
75 unsigned int offset;
76 unsigned int circ;
77 } __attribute__ ((gcc_struct));
78
79 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
80
81 struct __ecereNameSpace__ecere__com__Method
82 {
83 char *  name;
84 struct __ecereNameSpace__ecere__com__Method * parent;
85 struct __ecereNameSpace__ecere__com__Method * left;
86 struct __ecereNameSpace__ecere__com__Method * right;
87 int depth;
88 int (*  function)();
89 int vid;
90 int type;
91 struct __ecereNameSpace__ecere__com__Class * _class;
92 void *  symbol;
93 char *  dataTypeString;
94 struct Type * dataType;
95 int memberAccess;
96 } __attribute__ ((gcc_struct));
97
98 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
99
100 struct __ecereNameSpace__ecere__com__Property
101 {
102 struct __ecereNameSpace__ecere__com__Property * prev;
103 struct __ecereNameSpace__ecere__com__Property * next;
104 char *  name;
105 unsigned int isProperty;
106 int memberAccess;
107 int id;
108 struct __ecereNameSpace__ecere__com__Class * _class;
109 char *  dataTypeString;
110 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
111 struct Type * dataType;
112 void (*  Set)(void * , int);
113 int (*  Get)(void * );
114 unsigned int (*  IsSet)(void * );
115 void *  data;
116 void *  symbol;
117 int vid;
118 unsigned int conversion;
119 unsigned int watcherOffset;
120 char *  category;
121 unsigned int compiled;
122 unsigned int selfWatchable;
123 unsigned int isWatchable;
124 } __attribute__ ((gcc_struct));
125
126 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
127
128 struct CodePosition
129 {
130 int line;
131 int charPos;
132 int pos;
133 int included;
134 } __attribute__ ((gcc_struct));
135
136 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
137
138 struct Location
139 {
140 struct CodePosition start;
141 struct CodePosition end;
142 } __attribute__ ((gcc_struct));
143
144 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
145
146 struct Attrib;
147
148 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
149
150 struct ExtDecl;
151
152 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
153
154 struct ClassDefinition
155 {
156 struct ClassDefinition * prev;
157 struct ClassDefinition * next;
158 struct Location loc;
159 struct Specifier * _class;
160 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
161 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
162 struct Symbol * symbol;
163 struct Location blockStart;
164 struct Location nameLoc;
165 int endid;
166 int declMode;
167 unsigned int deleteWatchable;
168 } __attribute__ ((gcc_struct));
169
170 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
171
172 struct Context
173 {
174 struct Context * parent;
175 struct __ecereNameSpace__ecere__sys__BinaryTree types;
176 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
177 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
178 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
179 int nextID;
180 int simpleID;
181 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
182 struct ClassDefinition * classDef;
183 unsigned int templateTypesOnly;
184 unsigned int hasNameSpace;
185 } __attribute__ ((gcc_struct));
186
187 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
188
189 struct Instantiation
190 {
191 struct Instantiation * prev;
192 struct Instantiation * next;
193 struct Location loc;
194 struct Specifier * _class;
195 struct Expression * exp;
196 struct __ecereNameSpace__ecere__sys__OldList *  members;
197 struct Symbol * symbol;
198 unsigned int fullSet;
199 unsigned int isConstant;
200 unsigned char *  data;
201 struct Location nameLoc;
202 struct Location insideLoc;
203 unsigned int built;
204 } __attribute__ ((gcc_struct));
205
206 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
207
208 struct Declaration
209 {
210 struct Declaration * prev;
211 struct Declaration * next;
212 struct Location loc;
213 int type;
214 union
215 {
216 struct
217 {
218 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
219 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
220 } __attribute__ ((gcc_struct));
221 struct Instantiation * inst;
222 struct
223 {
224 struct Identifier * id;
225 struct Expression * exp;
226 } __attribute__ ((gcc_struct));
227 } __attribute__ ((gcc_struct));
228 struct Specifier * extStorage;
229 struct Symbol * symbol;
230 int declMode;
231 } __attribute__ ((gcc_struct));
232
233 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
234
235 struct Statement
236 {
237 struct Statement * prev;
238 struct Statement * next;
239 struct Location loc;
240 int type;
241 union
242 {
243 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
244 struct
245 {
246 struct Identifier * id;
247 struct Statement * stmt;
248 } __attribute__ ((gcc_struct)) labeled;
249 struct
250 {
251 struct Expression * exp;
252 struct Statement * stmt;
253 } __attribute__ ((gcc_struct)) caseStmt;
254 struct
255 {
256 struct __ecereNameSpace__ecere__sys__OldList * declarations;
257 struct __ecereNameSpace__ecere__sys__OldList * statements;
258 struct Context * context;
259 unsigned int isSwitch;
260 } __attribute__ ((gcc_struct)) compound;
261 struct
262 {
263 struct __ecereNameSpace__ecere__sys__OldList * exp;
264 struct Statement * stmt;
265 struct Statement * elseStmt;
266 } __attribute__ ((gcc_struct)) ifStmt;
267 struct
268 {
269 struct __ecereNameSpace__ecere__sys__OldList * exp;
270 struct Statement * stmt;
271 } __attribute__ ((gcc_struct)) switchStmt;
272 struct
273 {
274 struct __ecereNameSpace__ecere__sys__OldList * exp;
275 struct Statement * stmt;
276 } __attribute__ ((gcc_struct)) whileStmt;
277 struct
278 {
279 struct __ecereNameSpace__ecere__sys__OldList * exp;
280 struct Statement * stmt;
281 } __attribute__ ((gcc_struct)) doWhile;
282 struct
283 {
284 struct Statement * init;
285 struct Statement * check;
286 struct __ecereNameSpace__ecere__sys__OldList * increment;
287 struct Statement * stmt;
288 } __attribute__ ((gcc_struct)) forStmt;
289 struct
290 {
291 struct Identifier * id;
292 } __attribute__ ((gcc_struct)) gotoStmt;
293 struct
294 {
295 struct Specifier * spec;
296 char * statements;
297 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
298 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
299 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
300 } __attribute__ ((gcc_struct)) asmStmt;
301 struct
302 {
303 struct Expression * watcher;
304 struct Expression * object;
305 struct __ecereNameSpace__ecere__sys__OldList * watches;
306 } __attribute__ ((gcc_struct)) _watch;
307 struct
308 {
309 struct Identifier * id;
310 struct __ecereNameSpace__ecere__sys__OldList * exp;
311 struct __ecereNameSpace__ecere__sys__OldList * filter;
312 struct Statement * stmt;
313 } __attribute__ ((gcc_struct)) forEachStmt;
314 struct Declaration * decl;
315 } __attribute__ ((gcc_struct));
316 } __attribute__ ((gcc_struct));
317
318 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
319
320 struct TypeName
321 {
322 struct TypeName * prev;
323 struct TypeName * next;
324 struct Location loc;
325 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
326 struct Declarator * declarator;
327 int classObjectType;
328 struct Expression * bitCount;
329 } __attribute__ ((gcc_struct));
330
331 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
332
333 struct Initializer
334 {
335 struct Initializer * prev;
336 struct Initializer * next;
337 struct Location loc;
338 int type;
339 union
340 {
341 struct Expression * exp;
342 struct __ecereNameSpace__ecere__sys__OldList *  list;
343 } __attribute__ ((gcc_struct));
344 unsigned int isConstant;
345 } __attribute__ ((gcc_struct));
346
347 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
348
349 struct __ecereNameSpace__ecere__com__DataValue
350 {
351 union
352 {
353 char c;
354 unsigned char uc;
355 short s;
356 unsigned short us;
357 int i;
358 unsigned int ui;
359 void *  p;
360 float f;
361 double d;
362 long long i64;
363 uint64 ui64;
364 } __attribute__ ((gcc_struct));
365 } __attribute__ ((gcc_struct));
366
367 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
368
369 struct Expression
370 {
371 struct Expression * prev;
372 struct Expression * next;
373 struct Location loc;
374 int type;
375 union
376 {
377 struct
378 {
379 char *  constant;
380 struct Identifier * identifier;
381 } __attribute__ ((gcc_struct));
382 struct Statement * compound;
383 struct Instantiation * instance;
384 struct
385 {
386 char *  string;
387 unsigned int intlString;
388 } __attribute__ ((gcc_struct));
389 struct __ecereNameSpace__ecere__sys__OldList *  list;
390 struct
391 {
392 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
393 struct Declarator * decl;
394 } __attribute__ ((gcc_struct)) _classExp;
395 struct
396 {
397 struct Identifier * id;
398 } __attribute__ ((gcc_struct)) classData;
399 struct
400 {
401 struct Expression * exp;
402 struct __ecereNameSpace__ecere__sys__OldList * arguments;
403 struct Location argLoc;
404 } __attribute__ ((gcc_struct)) call;
405 struct
406 {
407 struct Expression * exp;
408 struct __ecereNameSpace__ecere__sys__OldList * index;
409 } __attribute__ ((gcc_struct)) index;
410 struct
411 {
412 struct Expression * exp;
413 struct Identifier * member;
414 int memberType;
415 unsigned int thisPtr;
416 } __attribute__ ((gcc_struct)) member;
417 struct
418 {
419 int op;
420 struct Expression * exp1;
421 struct Expression * exp2;
422 } __attribute__ ((gcc_struct)) op;
423 struct TypeName * typeName;
424 struct Specifier * _class;
425 struct
426 {
427 struct TypeName * typeName;
428 struct Expression * exp;
429 } __attribute__ ((gcc_struct)) cast;
430 struct
431 {
432 struct Expression * cond;
433 struct __ecereNameSpace__ecere__sys__OldList * exp;
434 struct Expression * elseExp;
435 } __attribute__ ((gcc_struct)) cond;
436 struct
437 {
438 struct TypeName * typeName;
439 struct Expression * size;
440 } __attribute__ ((gcc_struct)) _new;
441 struct
442 {
443 struct TypeName * typeName;
444 struct Expression * size;
445 struct Expression * exp;
446 } __attribute__ ((gcc_struct)) _renew;
447 struct
448 {
449 char * table;
450 struct Identifier * id;
451 } __attribute__ ((gcc_struct)) db;
452 struct
453 {
454 struct Expression * ds;
455 struct Expression * name;
456 } __attribute__ ((gcc_struct)) dbopen;
457 struct
458 {
459 struct TypeName * typeName;
460 struct Initializer * initializer;
461 } __attribute__ ((gcc_struct)) initializer;
462 struct
463 {
464 struct Expression * exp;
465 struct TypeName * typeName;
466 } __attribute__ ((gcc_struct)) vaArg;
467 } __attribute__ ((gcc_struct));
468 unsigned int debugValue;
469 struct __ecereNameSpace__ecere__com__DataValue val;
470 uint64 address;
471 unsigned int hasAddress;
472 struct Type * expType;
473 struct Type * destType;
474 unsigned int usage;
475 int tempCount;
476 unsigned int byReference;
477 unsigned int isConstant;
478 unsigned int addedThis;
479 unsigned int needCast;
480 unsigned int thisPtr;
481 unsigned int opDestType;
482 } __attribute__ ((gcc_struct));
483
484 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
485
486 struct TemplateDatatype;
487
488 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
489
490 struct TemplateArgument;
491
492 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
493
494 struct TemplateParameter;
495
496 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
497
498 struct Specifier
499 {
500 struct Specifier * prev;
501 struct Specifier * next;
502 struct Location loc;
503 int type;
504 union
505 {
506 int specifier;
507 struct
508 {
509 struct ExtDecl * extDecl;
510 char *  name;
511 struct Symbol * symbol;
512 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
513 } __attribute__ ((gcc_struct));
514 struct
515 {
516 struct Identifier * id;
517 struct __ecereNameSpace__ecere__sys__OldList *  list;
518 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
519 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
520 unsigned int addNameSpace;
521 struct Context * ctx;
522 struct ExtDecl * extDeclStruct;
523 } __attribute__ ((gcc_struct));
524 struct Expression * expression;
525 struct Specifier * _class;
526 struct TemplateParameter * templateParameter;
527 } __attribute__ ((gcc_struct));
528 } __attribute__ ((gcc_struct));
529
530 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
531
532 struct Identifier
533 {
534 struct Identifier * prev;
535 struct Identifier * next;
536 struct Location loc;
537 struct Symbol * classSym;
538 struct Specifier * _class;
539 char *  string;
540 struct Identifier * badID;
541 } __attribute__ ((gcc_struct));
542
543 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
544
545 struct Pointer;
546
547 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
548
549 struct Declarator
550 {
551 struct Declarator * prev;
552 struct Declarator * next;
553 struct Location loc;
554 int type;
555 struct Symbol * symbol;
556 struct Declarator * declarator;
557 union
558 {
559 struct Identifier * identifier;
560 struct
561 {
562 struct Expression * exp;
563 struct Expression * posExp;
564 struct Attrib * attrib;
565 } __attribute__ ((gcc_struct)) structDecl;
566 struct
567 {
568 struct Expression * exp;
569 struct Specifier * enumClass;
570 } __attribute__ ((gcc_struct)) array;
571 struct
572 {
573 struct __ecereNameSpace__ecere__sys__OldList * parameters;
574 } __attribute__ ((gcc_struct)) function;
575 struct
576 {
577 struct Pointer * pointer;
578 } __attribute__ ((gcc_struct)) pointer;
579 struct
580 {
581 struct ExtDecl * extended;
582 } __attribute__ ((gcc_struct)) extended;
583 } __attribute__ ((gcc_struct));
584 } __attribute__ ((gcc_struct));
585
586 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
587
588 struct FunctionDefinition
589 {
590 struct FunctionDefinition * prev;
591 struct FunctionDefinition * next;
592 struct Location loc;
593 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
594 struct Declarator * declarator;
595 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
596 struct Statement * body;
597 struct __ecereNameSpace__ecere__com__Class * _class;
598 struct __ecereNameSpace__ecere__sys__OldList attached;
599 int declMode;
600 struct Type * type;
601 struct Symbol * propSet;
602 int tempCount;
603 unsigned int propertyNoThis;
604 } __attribute__ ((gcc_struct));
605
606 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
607
608 struct DBTableDef;
609
610 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
611
612 struct External
613 {
614 struct External * prev;
615 struct External * next;
616 struct Location loc;
617 int type;
618 struct Symbol * symbol;
619 union
620 {
621 struct FunctionDefinition * function;
622 struct ClassDefinition * _class;
623 struct Declaration * declaration;
624 char *  importString;
625 struct Identifier * id;
626 struct DBTableDef * table;
627 } __attribute__ ((gcc_struct));
628 int importType;
629 } __attribute__ ((gcc_struct));
630
631 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
632
633 struct ModuleImport;
634
635 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
636
637 struct ClassImport;
638
639 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
640
641 struct Symbol
642 {
643 char *  string;
644 struct Symbol * parent;
645 struct Symbol * left;
646 struct Symbol * right;
647 int depth;
648 struct Type * type;
649 union
650 {
651 struct __ecereNameSpace__ecere__com__Method * method;
652 struct __ecereNameSpace__ecere__com__Property * _property;
653 struct __ecereNameSpace__ecere__com__Class * registered;
654 } __attribute__ ((gcc_struct));
655 int id;
656 int idCode;
657 union
658 {
659 struct
660 {
661 struct External * pointerExternal;
662 struct External * structExternal;
663 } __attribute__ ((gcc_struct));
664 struct
665 {
666 struct External * externalGet;
667 struct External * externalSet;
668 struct External * externalPtr;
669 struct External * externalIsSet;
670 } __attribute__ ((gcc_struct));
671 struct
672 {
673 struct External * methodExternal;
674 struct External * methodCodeExternal;
675 } __attribute__ ((gcc_struct));
676 } __attribute__ ((gcc_struct));
677 unsigned int imported;
678 unsigned int declaredStructSym;
679 struct __ecereNameSpace__ecere__com__Class * _class;
680 unsigned int declaredStruct;
681 unsigned int needConstructor;
682 unsigned int needDestructor;
683 char *  constructorName;
684 char *  structName;
685 char *  className;
686 char *  destructorName;
687 struct ModuleImport * module;
688 struct ClassImport * _import;
689 struct Location nameLoc;
690 unsigned int isParam;
691 unsigned int isRemote;
692 unsigned int isStruct;
693 unsigned int fireWatchersDone;
694 int declaring;
695 unsigned int classData;
696 unsigned int isStatic;
697 char *  shortName;
698 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
699 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
700 struct Context * ctx;
701 int isIterator;
702 struct Expression * propCategory;
703 } __attribute__ ((gcc_struct));
704
705 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
706
707 struct Type
708 {
709 struct Type * prev;
710 struct Type * next;
711 int refCount;
712 union
713 {
714 struct Symbol * _class;
715 struct
716 {
717 struct __ecereNameSpace__ecere__sys__OldList members;
718 char *  enumName;
719 } __attribute__ ((gcc_struct));
720 struct
721 {
722 struct Type * returnType;
723 struct __ecereNameSpace__ecere__sys__OldList params;
724 struct Symbol * thisClass;
725 unsigned int staticMethod;
726 struct TemplateParameter * thisClassTemplate;
727 } __attribute__ ((gcc_struct));
728 struct
729 {
730 struct __ecereNameSpace__ecere__com__Method * method;
731 struct __ecereNameSpace__ecere__com__Class * methodClass;
732 struct __ecereNameSpace__ecere__com__Class * usedClass;
733 } __attribute__ ((gcc_struct));
734 struct
735 {
736 struct Type * arrayType;
737 int arraySize;
738 struct Expression * arraySizeExp;
739 unsigned int freeExp;
740 struct Symbol * enumClass;
741 } __attribute__ ((gcc_struct));
742 struct Type * type;
743 struct TemplateParameter * templateParameter;
744 } __attribute__ ((gcc_struct));
745 int kind;
746 unsigned int size;
747 char *  name;
748 char *  typeName;
749 int classObjectType;
750 int alignment;
751 unsigned int offset;
752 int bitFieldCount;
753 int count;
754 unsigned int isSigned : 1;
755 unsigned int constant : 1;
756 unsigned int truth : 1;
757 unsigned int byReference : 1;
758 unsigned int extraParam : 1;
759 unsigned int directClassAccess : 1;
760 unsigned int computing : 1;
761 unsigned int keepCast : 1;
762 unsigned int passAsTemplate : 1;
763 unsigned int dllExport : 1;
764 unsigned int attrStdcall : 1;
765 unsigned int declaredWithStruct : 1;
766 unsigned int typedByReference : 1;
767 } __attribute__ ((gcc_struct));
768
769 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
770
771 struct __ecereNameSpace__ecere__com__Class
772 {
773 struct __ecereNameSpace__ecere__com__Class * prev;
774 struct __ecereNameSpace__ecere__com__Class * next;
775 char *  name;
776 int offset;
777 int structSize;
778 int (* *  _vTbl)();
779 int vTblSize;
780 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
781 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
782 int offsetClass;
783 int sizeClass;
784 struct __ecereNameSpace__ecere__com__Class * base;
785 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
786 struct __ecereNameSpace__ecere__sys__BinaryTree members;
787 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
788 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
789 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
790 struct __ecereNameSpace__ecere__sys__OldList derivatives;
791 int memberID;
792 int startMemberID;
793 int type;
794 struct __ecereNameSpace__ecere__com__Instance * module;
795 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
796 char *  dataTypeString;
797 struct Type * dataType;
798 int typeSize;
799 int defaultAlignment;
800 void (*  Initialize)();
801 int memberOffset;
802 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
803 char *  designerClass;
804 unsigned int noExpansion;
805 char *  defaultProperty;
806 unsigned int comRedefinition;
807 int count;
808 int isRemote;
809 unsigned int internalDecl;
810 void *  data;
811 unsigned int computeSize;
812 int structAlignment;
813 int destructionWatchOffset;
814 unsigned int fixed;
815 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
816 int inheritanceAccess;
817 char *  fullName;
818 void *  symbol;
819 struct __ecereNameSpace__ecere__sys__OldList conversions;
820 struct __ecereNameSpace__ecere__sys__OldList templateParams;
821 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
822 struct __ecereNameSpace__ecere__com__Class * templateClass;
823 struct __ecereNameSpace__ecere__sys__OldList templatized;
824 int numParams;
825 unsigned int isInstanceClass;
826 unsigned int byValueSystemClass;
827 } __attribute__ ((gcc_struct));
828
829 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
830
831 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
832
833 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
834
835 struct __ecereNameSpace__ecere__com__Instance
836 {
837 int (* *  _vTbl)();
838 struct __ecereNameSpace__ecere__com__Class * _class;
839 int _refCount;
840 } __attribute__ ((gcc_struct));
841
842 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
843
844 struct __ecereNameSpace__ecere__com__DataMember
845 {
846 struct __ecereNameSpace__ecere__com__DataMember * prev;
847 struct __ecereNameSpace__ecere__com__DataMember * next;
848 char *  name;
849 unsigned int isProperty;
850 int memberAccess;
851 int id;
852 struct __ecereNameSpace__ecere__com__Class * _class;
853 char *  dataTypeString;
854 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
855 struct Type * dataType;
856 int type;
857 int offset;
858 int memberID;
859 struct __ecereNameSpace__ecere__sys__OldList members;
860 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
861 int memberOffset;
862 int structAlignment;
863 } __attribute__ ((gcc_struct));
864
865 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
866
867 struct __ecereNameSpace__ecere__com__SerialBuffer
868 {
869 unsigned char *  _buffer;
870 unsigned int count;
871 unsigned int _size;
872 unsigned int pos;
873 } __attribute__ ((gcc_struct));
874
875 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
876
877 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
878 {
879 union
880 {
881 struct
882 {
883 char *  dataTypeString;
884 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
885 } __attribute__ ((gcc_struct));
886 struct __ecereNameSpace__ecere__com__DataValue expression;
887 struct
888 {
889 char *  memberString;
890 union
891 {
892 struct __ecereNameSpace__ecere__com__DataMember * member;
893 struct __ecereNameSpace__ecere__com__Property * prop;
894 struct __ecereNameSpace__ecere__com__Method * method;
895 } __attribute__ ((gcc_struct));
896 } __attribute__ ((gcc_struct));
897 } __attribute__ ((gcc_struct));
898 } __attribute__ ((gcc_struct));
899
900 enum yytokentype
901 {
902 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
903 };
904
905 typedef union YYSTYPE
906 {
907 int specifierType;
908 int i;
909 int declMode;
910 struct Identifier * id;
911 struct Expression * exp;
912 struct Specifier * specifier;
913 struct __ecereNameSpace__ecere__sys__OldList * list;
914 struct Enumerator * enumerator;
915 struct Declarator * declarator;
916 struct Pointer * pointer;
917 struct Initializer * initializer;
918 struct InitDeclarator * initDeclarator;
919 struct TypeName * typeName;
920 struct Declaration * declaration;
921 struct Statement * stmt;
922 struct FunctionDefinition * function;
923 struct External * external;
924 struct Context * context;
925 struct AsmField * asmField;
926 struct Attrib * attrib;
927 struct ExtDecl * extDecl;
928 struct Attribute * attribute;
929 struct Instantiation * instance;
930 struct MembersInit * membersInit;
931 struct MemberInit * memberInit;
932 struct ClassFunction * classFunction;
933 struct ClassDefinition * _class;
934 struct ClassDef * classDef;
935 struct PropertyDef * prop;
936 char * string;
937 struct Symbol * symbol;
938 struct PropertyWatch * propertyWatch;
939 struct TemplateParameter * templateParameter;
940 struct TemplateArgument * templateArgument;
941 struct TemplateDatatype * templateDatatype;
942 struct DBTableEntry * dbtableEntry;
943 struct DBIndexItem * dbindexItem;
944 struct DBTableDef * dbtableDef;
945 } __attribute__ ((gcc_struct)) YYSTYPE;
946
947 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
948
949 struct Enumerator;
950
951 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
952
953 struct InitDeclarator;
954
955 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
956
957 struct AsmField;
958
959 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
960
961 struct Attribute;
962
963 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
964
965 struct ClassFunction
966 {
967 struct ClassFunction * prev;
968 struct ClassFunction * next;
969 struct Location loc;
970 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
971 struct Declarator * declarator;
972 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
973 struct Statement * body;
974 struct __ecereNameSpace__ecere__com__Class * _class;
975 struct __ecereNameSpace__ecere__sys__OldList attached;
976 int declMode;
977 struct Type * type;
978 struct Symbol * propSet;
979 unsigned int isVirtual;
980 unsigned int isConstructor;
981 unsigned int isDestructor;
982 unsigned int dontMangle;
983 int id;
984 int idCode;
985 } __attribute__ ((gcc_struct));
986
987 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
988
989 struct MembersInit
990 {
991 struct MembersInit * prev;
992 struct MembersInit * next;
993 struct Location loc;
994 int type;
995 union
996 {
997 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
998 struct ClassFunction * function;
999 } __attribute__ ((gcc_struct));
1000 } __attribute__ ((gcc_struct));
1001
1002 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1003
1004 struct MemberInit
1005 {
1006 struct MemberInit * prev;
1007 struct MemberInit * next;
1008 struct Location loc;
1009 struct Location realLoc;
1010 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1011 struct Initializer * initializer;
1012 unsigned int used;
1013 unsigned int variable;
1014 unsigned int takeOutExp;
1015 } __attribute__ ((gcc_struct));
1016
1017 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1018
1019 struct PropertyDef
1020 {
1021 struct PropertyDef * prev;
1022 struct PropertyDef * next;
1023 struct Location loc;
1024 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1025 struct Declarator * declarator;
1026 struct Identifier * id;
1027 struct Statement * getStmt;
1028 struct Statement * setStmt;
1029 struct Statement * issetStmt;
1030 struct Symbol * symbol;
1031 struct Expression * category;
1032 struct
1033 {
1034 unsigned int conversion : 1;
1035 unsigned int isWatchable : 1;
1036 unsigned int isDBProp : 1;
1037 } __attribute__ ((gcc_struct));
1038 } __attribute__ ((gcc_struct));
1039
1040 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1041
1042 struct PropertyWatch;
1043
1044 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1045
1046 struct ClassDef
1047 {
1048 struct ClassDef * prev;
1049 struct ClassDef * next;
1050 struct Location loc;
1051 int type;
1052 union
1053 {
1054 struct Declaration * decl;
1055 struct ClassFunction * function;
1056 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1057 struct PropertyDef * propertyDef;
1058 struct PropertyWatch * propertyWatch;
1059 char *  designer;
1060 struct Identifier * defaultProperty;
1061 struct
1062 {
1063 struct Identifier * id;
1064 struct Initializer * initializer;
1065 } __attribute__ ((gcc_struct));
1066 } __attribute__ ((gcc_struct));
1067 int memberAccess;
1068 void *  object;
1069 } __attribute__ ((gcc_struct));
1070
1071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1072
1073 struct DBTableEntry;
1074
1075 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1076
1077 struct DBIndexItem;
1078
1079 extern YYSTYPE yylval;
1080
1081 extern struct Location yylloc;
1082
1083 extern struct External * curExternal;
1084
1085 void MangleClassName(char * className)
1086 {
1087 char output[1024];
1088 int c, d = 0;
1089 char ch;
1090
1091 for(c = 0; (ch = className[c]); c++)
1092 {
1093 if(ch == ' ')
1094 output[d++] = '_';
1095 else if(ch == '*')
1096 {
1097 output[d++] = '_';
1098 output[d++] = 'P';
1099 output[d++] = 'T';
1100 output[d++] = 'R';
1101 output[d++] = '_';
1102 }
1103 else if(ch == '<')
1104 {
1105 output[d++] = '_';
1106 output[d++] = 'T';
1107 output[d++] = 'P';
1108 output[d++] = 'L';
1109 output[d++] = '_';
1110 }
1111 else if(ch == '=')
1112 {
1113 output[d++] = '_';
1114 output[d++] = 'E';
1115 output[d++] = 'Q';
1116 output[d++] = 'U';
1117 output[d++] = '_';
1118 }
1119 else if(ch == '>')
1120 {
1121 output[d++] = '_';
1122 }
1123 else if(ch == ',')
1124 {
1125 output[d++] = '__';
1126 }
1127 else
1128 output[d++] = ch;
1129 }
1130 output[d] = (char)0;
1131 }
1132
1133 extern char *  strcat(char * , const char * );
1134
1135 extern size_t strlen(const char * );
1136
1137 void FullClassNameCat(char * output, char * className, unsigned int includeTemplateParams)
1138 {
1139 int c;
1140 char ch;
1141 int len;
1142
1143 for(c = 0; (ch = className[c]) && ch != '<'; c++)
1144 {
1145 if(ch == ':')
1146 {
1147 strcat(output, "__ecereNameSpace__");
1148 break;
1149 }
1150 }
1151 len = strlen(output);
1152 for(c = 0; (ch = className[c]); c++)
1153 {
1154 if(ch == ':')
1155 output[len++] = '_';
1156 else if(ch == ' ')
1157 output[len++] = '_';
1158 else if(ch == '*')
1159 {
1160 output[len++] = '_';
1161 output[len++] = 'P';
1162 output[len++] = 'T';
1163 output[len++] = 'R';
1164 output[len++] = '_';
1165 }
1166 else if(ch == '=')
1167 {
1168 output[len++] = '_';
1169 output[len++] = 'E';
1170 output[len++] = 'Q';
1171 output[len++] = 'U';
1172 output[len++] = '_';
1173 }
1174 else if(ch == '<')
1175 {
1176 if(!includeTemplateParams)
1177 break;
1178 output[len++] = '_';
1179 output[len++] = 'T';
1180 output[len++] = 'P';
1181 output[len++] = 'L';
1182 output[len++] = '_';
1183 }
1184 else if(ch == '>')
1185 {
1186 output[len++] = '_';
1187 }
1188 else if(ch == ',')
1189 {
1190 output[len++] = '__';
1191 }
1192 else
1193 output[len++] = ch;
1194 }
1195 output[len++] = (char)0;
1196 }
1197
1198 extern int AddMembers(struct __ecereNameSpace__ecere__sys__OldList *  declarations, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember, unsigned int *  retSize, struct __ecereNameSpace__ecere__com__Class * topClass, unsigned int *  addedPadding);
1199
1200 static void AddSimpleBaseMembers(struct __ecereNameSpace__ecere__sys__OldList * list, struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * topClass)
1201 {
1202 if(_class->type != 1000)
1203 AddMembers(list, _class, 0x0, (((void *)0)), topClass, (((void *)0)));
1204 }
1205
1206 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
1207
1208 struct __ecereNameSpace__ecere__com__NameSpace
1209 {
1210 char *  name;
1211 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
1212 struct __ecereNameSpace__ecere__com__NameSpace *  left;
1213 struct __ecereNameSpace__ecere__com__NameSpace *  right;
1214 int depth;
1215 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
1216 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
1217 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
1218 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
1219 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
1220 } __attribute__ ((gcc_struct));
1221
1222 static unsigned int NameSpaceContained(struct __ecereNameSpace__ecere__com__NameSpace * ns, struct __ecereNameSpace__ecere__com__NameSpace * parent)
1223 {
1224 if(ns == parent)
1225 return 0x1;
1226 else if((*ns).parent)
1227 return NameSpaceContained((*ns).parent, parent);
1228 else
1229 return 0x0;
1230 }
1231
1232 extern void Compiler_Error(char *  format, ...);
1233
1234 extern char *  __ecereNameSpace__ecere__GetTranslatedString(char * name, char *  string, char *  stringAndContext);
1235
1236 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1237
1238 struct __ecereNameSpace__ecere__com__Module
1239 {
1240 struct __ecereNameSpace__ecere__com__Instance * application;
1241 struct __ecereNameSpace__ecere__sys__OldList classes;
1242 struct __ecereNameSpace__ecere__sys__OldList defines;
1243 struct __ecereNameSpace__ecere__sys__OldList functions;
1244 struct __ecereNameSpace__ecere__sys__OldList modules;
1245 struct __ecereNameSpace__ecere__com__Instance * prev;
1246 struct __ecereNameSpace__ecere__com__Instance * next;
1247 char *  name;
1248 void *  library;
1249 void *  Unload;
1250 int importType;
1251 int origImportType;
1252 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1253 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1254 } __attribute__ ((gcc_struct));
1255
1256 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
1257
1258 struct __ecereNameSpace__ecere__com__Application
1259 {
1260 int argc;
1261 char * *  argv;
1262 int exitCode;
1263 unsigned int isGUIApp;
1264 struct __ecereNameSpace__ecere__sys__OldList allModules;
1265 char *  parsedCommand;
1266 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
1267 } __attribute__ ((gcc_struct));
1268
1269 extern unsigned int ModuleAccess(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor);
1270
1271 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1272
1273 static void CheckPublicClass(struct Symbol * classSym, int access, char * word)
1274 {
1275 struct __ecereNameSpace__ecere__com__Class * regClass = classSym ? classSym->registered : (((void *)0));
1276
1277 if(regClass)
1278 {
1279 if(regClass->templateClass)
1280 regClass = regClass->templateClass;
1281 if(classSym->isStatic && access != 3)
1282 {
1283 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Non-static %s making use of a static class\n", (((void *)0))), word);
1284 }
1285 else if(access == 1)
1286 {
1287 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->application + structSize_Module)))->systemNameSpace))
1288 {
1289 if(NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) || !ModuleAccess(privateModule, regClass->module))
1290 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Public %s making use of a private class\n", (((void *)0))), word);
1291 }
1292 }
1293 }
1294 }
1295
1296 static void CheckPublicTypeName(struct TypeName * type, int access)
1297 {
1298 if(type->qualifiers)
1299 {
1300 struct Specifier * spec;
1301
1302 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1303 {
1304 if(spec->type == 1)
1305 {
1306 struct Symbol * classSym = spec->symbol;
1307
1308 CheckPublicClass(classSym, access, "define");
1309 }
1310 }
1311 }
1312 }
1313
1314 static void CheckPublicExpression(struct Expression * exp, int access);
1315
1316 static void CheckPublicInitializer(struct Initializer * init, int access)
1317 {
1318 switch(init->type)
1319 {
1320 case 0:
1321 CheckPublicExpression(init->exp, access);
1322 break;
1323 case 1:
1324 {
1325 struct Initializer * i;
1326
1327 for(i = (*init->list).first; i; i = i->next)
1328 CheckPublicInitializer(i, access);
1329 break;
1330 }
1331 }
1332 }
1333
1334 static void CheckPublicExpression(struct Expression * exp, int access)
1335 {
1336 if(exp)
1337 {
1338 switch(exp->type)
1339 {
1340 case 0:
1341 break;
1342 case 2:
1343 break;
1344 case 3:
1345 break;
1346 case 4:
1347 if(exp->op.exp1)
1348 CheckPublicExpression(exp->op.exp1, access);
1349 if(exp->op.exp2)
1350 CheckPublicExpression(exp->op.exp2, access);
1351 break;
1352 case 5:
1353 {
1354 struct Expression * e;
1355
1356 for(e = (*exp->list).first; e; e = e->next)
1357 CheckPublicExpression(e, access);
1358 break;
1359 }
1360 case 6:
1361 {
1362 struct Expression * e;
1363
1364 CheckPublicExpression(exp->index.exp, access);
1365 for(e = (*exp->index.index).first; e; e = e->next)
1366 CheckPublicExpression(e, access);
1367 break;
1368 }
1369 case 7:
1370 {
1371 struct Expression * e;
1372
1373 CheckPublicExpression(exp->call.exp, access);
1374 if(exp->call.arguments)
1375 {
1376 for(e = (*exp->call.arguments).first; e; e = e->next)
1377 CheckPublicExpression(e, access);
1378 }
1379 break;
1380 }
1381 case 8:
1382 {
1383 CheckPublicExpression(exp->member.exp, access);
1384 break;
1385 }
1386 case 9:
1387 {
1388 CheckPublicExpression(exp->member.exp, access);
1389 break;
1390 }
1391 case 10:
1392 CheckPublicTypeName(exp->typeName, access);
1393 break;
1394 case 11:
1395 {
1396 struct Type * type = exp->expType;
1397
1398 CheckPublicTypeName(exp->cast.typeName, access);
1399 if(exp->cast.exp)
1400 CheckPublicExpression(exp->cast.exp, access);
1401 break;
1402 }
1403 case 12:
1404 {
1405 struct Expression * e;
1406
1407 CheckPublicExpression(exp->cond.cond, access);
1408 for(e = (*exp->cond.exp).first; e; e = e->next)
1409 CheckPublicExpression(e, access);
1410 CheckPublicExpression(exp->cond.elseExp, access);
1411 break;
1412 }
1413 case 13:
1414 case 26:
1415 CheckPublicExpression(exp->_new.size, access);
1416 break;
1417 case 14:
1418 case 27:
1419 CheckPublicExpression(exp->_renew.size, access);
1420 CheckPublicExpression(exp->_renew.exp, access);
1421 break;
1422 case 1:
1423 {
1424 struct MembersInit * members;
1425
1426 CheckPublicClass(exp->instance->_class->symbol, access, "define");
1427 for(members = (*exp->instance->members).first; members; members = members->next)
1428 {
1429 if(members->type == 0)
1430 {
1431 struct MemberInit * member;
1432
1433 for(member = (*members->dataMembers).first; member; member = member->next)
1434 {
1435 CheckPublicInitializer(member->initializer, access);
1436 }
1437 }
1438 }
1439 break;
1440 }
1441 }
1442 }
1443 }
1444
1445 static void CheckPublicDataType(struct Type * type, int access, char * word)
1446 {
1447 if(type)
1448 {
1449 switch(type->kind)
1450 {
1451 case 8:
1452 {
1453 CheckPublicClass(type->_class, access, word);
1454 break;
1455 }
1456 case 9:
1457 case 10:
1458 {
1459 break;
1460 }
1461 case 11:
1462 {
1463 struct Type * param;
1464
1465 CheckPublicDataType(type->returnType, access, word);
1466 for(param = type->params.first; param; param = param->next)
1467 CheckPublicDataType(param, access, word);
1468 CheckPublicClass(type->thisClass, access, word);
1469 break;
1470 }
1471 case 12:
1472 CheckPublicDataType(type->arrayType, access, word);
1473 if(type->enumClass)
1474 CheckPublicClass(type->enumClass, access, word);
1475 break;
1476 case 13:
1477 {
1478 CheckPublicDataType(type->type, access, word);
1479 break;
1480 }
1481 case 16:
1482 {
1483 break;
1484 }
1485 case 19:
1486 {
1487 CheckPublicClass(type->_class, access, word);
1488 break;
1489 }
1490 }
1491 }
1492 }
1493
1494 extern struct Identifier * GetDeclId(struct Declarator * decl);
1495
1496 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
1497
1498 struct __ecereNameSpace__ecere__com__BTNamedLink
1499 {
1500 char *  name;
1501 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
1502 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
1503 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
1504 int depth;
1505 void *  data;
1506 } __attribute__ ((gcc_struct));
1507
1508 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMember(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
1509
1510 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1511
1512 static void CheckMembersDefinitions(struct __ecereNameSpace__ecere__com__Class * regClass, struct __ecereNameSpace__ecere__com__DataMember * member, struct __ecereNameSpace__ecere__sys__OldList * definitions, int access)
1513 {
1514 if(definitions != (((void *)0)))
1515 {
1516 struct ClassDef * def;
1517
1518 for(def = definitions->first; def; def = def->next)
1519 {
1520 if(def->type == 2)
1521 {
1522 struct Declaration * decl = def->decl;
1523 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
1524
1525 yylloc = def->loc;
1526 if(decl->type == 0)
1527 {
1528 struct Declarator * d;
1529
1530 if(decl->declarators)
1531 {
1532 for(d = (*decl->declarators).first; d; d = d->next)
1533 {
1534 struct Identifier * declId = GetDeclId(d);
1535
1536 if(declId)
1537 {
1538 if(member)
1539 {
1540 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, declId->string);
1541
1542 dataMember = link ? link->data : (((void *)0));
1543 }
1544 else
1545 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, declId->string, privateModule, (((void *)0)), (((void *)0)));
1546 if(dataMember)
1547 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class data member", (((void *)0))));
1548 }
1549 }
1550 }
1551 else if(decl->specifiers)
1552 {
1553 struct Specifier * spec;
1554
1555 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
1556 {
1557 if(spec->type == 3 || spec->type == 4)
1558 {
1559 if(spec->definitions && !spec->id)
1560 {
1561 CheckMembersDefinitions(regClass, member, spec->definitions, (def->memberAccess == 2) ? 2 : access);
1562 }
1563 else if(spec->definitions && spec->id)
1564 {
1565 if(member)
1566 {
1567 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, spec->id->string);
1568
1569 dataMember = link ? link->data : (((void *)0));
1570 }
1571 else
1572 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, spec->id->string, privateModule, (((void *)0)), (((void *)0)));
1573 if(dataMember)
1574 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class data member", (((void *)0))));
1575 }
1576 }
1577 }
1578 }
1579 }
1580 else if(decl->type == 2)
1581 {
1582 CheckPublicClass(decl->inst->_class->symbol, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString("ec", "class member instance", (((void *)0))));
1583 }
1584 }
1585 }
1586 }
1587 }
1588
1589 extern unsigned int inCompiler;
1590
1591 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1592
1593 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
1594
1595 extern struct Symbol * FindClass(char *  name);
1596
1597 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_FindProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1598
1599 extern struct __ecereNameSpace__ecere__com__Property * __ecereNameSpace__ecere__com__eClass_AddProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, char *  dataType, void *  setStmt, void *  getStmt, int declMode);
1600
1601 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_AddDataMember(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, char *  type, unsigned int size, unsigned int alignment, int declMode);
1602
1603 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_FindMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, struct __ecereNameSpace__ecere__com__Instance * module);
1604
1605 extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_AddMethod(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, char *  type, void *  function, int declMode);
1606
1607 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
1608
1609 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
1610
1611 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
1612
1613 extern struct Specifier * MkSpecifierName(char *  name);
1614
1615 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
1616
1617 extern struct Identifier * MkIdentifier(char *  string);
1618
1619 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
1620
1621 extern struct Expression * QMkExpId(char *  id);
1622
1623 extern void FreeDeclarator(struct Declarator * decl);
1624
1625 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
1626
1627 extern void FreeSpecifier(struct Specifier * spec);
1628
1629 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1630
1631 extern struct Type * MkClassType(char *  name);
1632
1633 extern char *  strcpy(char * , const char * );
1634
1635 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
1636
1637 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1638
1639 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
1640
1641 extern void FreeExternal(struct External * external);
1642
1643 extern int declMode;
1644
1645 extern int structDeclMode;
1646
1647 extern char *  strstr(const char * , const char * );
1648
1649 extern char *  sourceFile;
1650
1651 extern struct Specifier * MkSpecifier(int specifier);
1652
1653 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
1654
1655 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1656
1657 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1658
1659 extern struct Context * PushContext(void);
1660
1661 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1662
1663 extern struct Expression * CopyExpression(struct Expression * exp);
1664
1665 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
1666
1667 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
1668
1669 extern void PopContext(struct Context * ctx);
1670
1671 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
1672
1673 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
1674
1675 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
1676
1677 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
1678
1679 extern struct ClassDef * MkClassDefFunction(struct ClassFunction * function);
1680
1681 extern struct Specifier * CopySpecifier(struct Specifier * spec);
1682
1683 extern struct Expression * MkExpInstance(struct Instantiation * inst);
1684
1685 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
1686
1687 extern struct Expression * MkExpIdentifier(struct Identifier * id);
1688
1689 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
1690
1691 extern void FreeInitializer(struct Initializer * initializer);
1692
1693 extern struct Statement * MkReturnStmt(struct __ecereNameSpace__ecere__sys__OldList * exp);
1694
1695 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1696
1697 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
1698
1699 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
1700
1701 extern void Compiler_Warning(char *  format, ...);
1702
1703 extern struct __ecereNameSpace__ecere__sys__OldList *  ast;
1704
1705 extern int sprintf(char * , char * , ...);
1706
1707 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1708
1709 extern struct Context * curContext;
1710
1711 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
1712
1713 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1714
1715 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
1716
1717 extern void FreeType(struct Type * type);
1718
1719 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
1720
1721 extern void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
1722
1723 extern void FreeInitDeclarator(struct InitDeclarator * decl);
1724
1725 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1726
1727 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
1728
1729 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
1730
1731 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
1732
1733 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
1734
1735 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
1736
1737 static void ProcessClass(int classType, struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol, struct __ecereNameSpace__ecere__sys__OldList * baseSpecs, struct __ecereNameSpace__ecere__sys__OldList * enumValues, struct Location * loc, struct __ecereNameSpace__ecere__sys__OldList * defs, void * after, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators, struct ExtDecl * extDecl)
1738 {
1739 char structName[1024];
1740 char className[1024];
1741 char constructorName[1024];
1742 char destructorName[1024];
1743 struct __ecereNameSpace__ecere__com__Class * regClass;
1744 struct ClassFunction * destructor = (((void *)0)), * constructor = (((void *)0));
1745 unsigned int redefinition = 0x0;
1746 unsigned int isUnion = classType == 6;
1747 struct External * external = (((void *)0));
1748 struct ClassDef * def;
1749 struct __ecereNameSpace__ecere__sys__OldList * list;
1750 struct __ecereNameSpace__ecere__sys__OldList * classDataList;
1751
1752 if(inCompiler)
1753 {
1754 list = MkList();
1755 classDataList = MkList();
1756 }
1757 regClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, symbol->string);
1758 if(!regClass)
1759 return ;
1760 classType = regClass->type;
1761 if(inCompiler)
1762 {
1763 yylloc = *loc;
1764 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && regClass->inheritanceAccess == 1)
1765 {
1766 if(!regClass->base->symbol)
1767 regClass->base->symbol = FindClass(regClass->base->fullName);
1768 CheckPublicClass(regClass->base->symbol, 1, __ecereNameSpace__ecere__GetTranslatedString("ec", "class", (((void *)0))));
1769 }
1770 else if(!symbol->isStatic && regClass->base)
1771 {
1772 if(!regClass->base->symbol)
1773 regClass->base->symbol = FindClass(regClass->base->fullName);
1774 CheckPublicClass(regClass->base->symbol, 2, __ecereNameSpace__ecere__GetTranslatedString("ec", "class", (((void *)0))));
1775 }
1776 }
1777 if(definitions != (((void *)0)))
1778 {
1779 for(def = definitions->first; def; def = def->next)
1780 {
1781 if(def->type == 13)
1782 {
1783 struct __ecereNameSpace__ecere__com__DataMember * member;
1784 struct __ecereNameSpace__ecere__com__Property * prop;
1785 struct __ecereNameSpace__ecere__com__Method * method;
1786
1787 if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(regClass, def->id->string, privateModule)))
1788 {
1789 __ecereNameSpace__ecere__com__eClass_AddProperty(regClass, def->id->string, (((void *)0)), (((void *)0)), (((void *)0)), def->memberAccess);
1790 }
1791 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, def->id->string, privateModule, (((void *)0)), (((void *)0)))))
1792 {
1793 __ecereNameSpace__ecere__com__eClass_AddDataMember(regClass, def->id->string, (((void *)0)), 0, 0, def->memberAccess);
1794 }
1795 else if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, def->id->string, privateModule)))
1796 {
1797 __ecereNameSpace__ecere__com__eClass_AddMethod(regClass, def->id->string, (((void *)0)), (((void *)0)), def->memberAccess);
1798 }
1799 else
1800 {
1801 yylloc = def->loc;
1802 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't find member %s to override\n", (((void *)0))), def->id->string);
1803 }
1804 }
1805 }
1806 }
1807 if(inCompiler)
1808 {
1809 external = MkExternalDeclaration((((void *)0)));
1810 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
1811 curExternal = external;
1812 curExternal->symbol = symbol;
1813 }
1814 if((classType == 1 || classType == 5) && inCompiler)
1815 {
1816 AddSimpleBaseMembers(list, regClass->base, regClass);
1817 }
1818 if(definitions != (((void *)0)))
1819 {
1820 if(inCompiler)
1821 {
1822 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace))
1823 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 1);
1824 else if(!symbol->isStatic)
1825 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 2);
1826 }
1827 for(def = definitions->first; def; def = def->next)
1828 {
1829 if(def->type == 2)
1830 {
1831 struct Declaration * decl = def->decl;
1832
1833 if(decl->type == 0)
1834 {
1835 if(inCompiler && classType != 2)
1836 {
1837 ListAdd(list, MkClassDefDeclaration(decl));
1838 def->decl = (((void *)0));
1839 }
1840 }
1841 else if(decl->type == 2)
1842 {
1843 struct Instantiation * inst = decl->inst;
1844 struct Expression * exp = inst->exp;
1845 struct Symbol * classSym;
1846
1847 if(exp)
1848 {
1849 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
1850 struct Declarator * d;
1851
1852 ListAdd(specifiers, MkSpecifierName(inst->_class->name));
1853 d = MkDeclaratorIdentifier(MkIdentifier(exp->identifier->string));
1854 if(inCompiler)
1855 {
1856 struct __ecereNameSpace__ecere__sys__OldList * declarators = MkList();
1857
1858 ListAdd(declarators, d);
1859 decl = MkStructDeclaration(specifiers, declarators, (((void *)0)));
1860 ListAdd(list, MkClassDefDeclaration(decl));
1861 exp->type = 8;
1862 exp->member.member = exp->identifier;
1863 exp->member.exp = QMkExpId("this");
1864 exp->member.memberType = 3;
1865 exp->member.thisPtr = 0x1;
1866 }
1867 else
1868 {
1869 FreeDeclarator(d);
1870 FreeList(specifiers, FreeSpecifier);
1871 }
1872 }
1873 classSym = inst->_class->symbol;
1874 if(classSym && classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 2 || classSym->registered->type == 3))
1875 {
1876 if(inst->members && (*inst->members).count)
1877 symbol->needConstructor = 0x1;
1878 }
1879 else
1880 {
1881 symbol->needConstructor = 0x1;
1882 symbol->needDestructor = 0x1;
1883 }
1884 }
1885 }
1886 else if(def->type == 9)
1887 {
1888 struct Declaration * decl = def->decl;
1889
1890 if(decl->type == 0)
1891 {
1892 if(inCompiler && classType != 2)
1893 {
1894 ListAdd(classDataList, MkClassDefDeclaration(decl));
1895 def->decl = (((void *)0));
1896 }
1897 }
1898 }
1899 else if(def->type == 1)
1900 symbol->needConstructor = 0x1;
1901 else if(def->type == 4)
1902 symbol->needConstructor = 0x1;
1903 else if(def->type == 0)
1904 {
1905 struct ClassFunction * func = def->function;
1906
1907 if(func->isDestructor)
1908 {
1909 if(destructor)
1910 {
1911 yylloc = *loc;
1912 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "redefinition of destructor for class %s\n", (((void *)0))), symbol->string);
1913 }
1914 else
1915 {
1916 symbol->needDestructor = 0x1;
1917 destructor = func;
1918 if(!inCompiler && func->body)
1919 {
1920 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1921
1922 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1923 }
1924 }
1925 }
1926 if(func->isConstructor)
1927 {
1928 if(constructor)
1929 {
1930 yylloc = *loc;
1931 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "redefinition of constructor for class %s\n", (((void *)0))), symbol->string);
1932 }
1933 else
1934 {
1935 symbol->needConstructor = 0x1;
1936 constructor = func;
1937 if(!inCompiler && func->body)
1938 {
1939 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1940
1941 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1942 }
1943 }
1944 }
1945 }
1946 }
1947 }
1948 if(inCompiler)
1949 {
1950 external->symbol = (((void *)0));
1951 if((*list).count)
1952 {
1953 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = (initDeclarators != (((void *)0))) ? initDeclarators : MkList();
1954
1955 initDeclarators = (((void *)0));
1956 strcpy(structName, symbol->string);
1957 symbol->structName = __ecereNameSpace__ecere__sys__CopyString(structName);
1958 {
1959 struct Specifier * spec = MkStructOrUnion(3, MkIdentifier(structName), isUnion ? MkListOne(MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkStructOrUnion(4, (((void *)0)), list)), (((void *)0)), (((void *)0))))) : list);
1960
1961 spec->extDeclStruct = extDecl;
1962 ListAdd(specs, spec);
1963 }
1964 external->symbol = symbol;
1965 symbol->structExternal = external;
1966 external->declaration = MkDeclaration(specs, declarators);
1967 after = external;
1968 symbol->declaredStruct = 0x1;
1969 }
1970 else
1971 {
1972 curExternal = external->prev;
1973 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(defs, external);
1974 FreeExternal(external);
1975 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
1976 }
1977 if((*classDataList).count)
1978 {
1979 char classDataStructName[1024];
1980 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1981 struct External * external;
1982
1983 strcpy(classDataStructName, "__ecereClassData_");
1984 FullClassNameCat(classDataStructName, symbol->string, 0x0);
1985 declMode = structDeclMode = 0;
1986 ListAdd(specs, MkStructOrUnion(3, MkIdentifier(classDataStructName), classDataList));
1987 external = MkExternalDeclaration(MkDeclaration(specs, (((void *)0))));
1988 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
1989 after = external;
1990 symbol->classData = 0x1;
1991 }
1992 else
1993 (__ecereNameSpace__ecere__com__eSystem_Delete(classDataList), classDataList = 0);
1994 }
1995 if(inCompiler)
1996 {
1997 {
1998 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = MkList();
1999
2000 strcpy(className, "__ecereClass_");
2001 FullClassNameCat(className, symbol->string, 0x1);
2002 MangleClassName(className);
2003 symbol->className = __ecereNameSpace__ecere__sys__CopyString(className);
2004 if(!strstr(sourceFile, ".main.ec"))
2005 ListAdd(specs, MkSpecifier(STATIC));
2006 ListAdd(specs, MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
2007 ListAdd(declarators, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(className))), (((void *)0))));
2008 symbol->methodExternal = MkExternalDeclaration(MkDeclaration(specs, declarators));
2009 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, symbol->methodExternal);
2010 after = symbol->methodExternal;
2011 }
2012 if(symbol->needDestructor)
2013 {
2014 struct ClassFunction * function;
2015 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
2016 struct Declarator * decl;
2017 struct Statement * body;
2018 struct Context * context;
2019 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2020
2021 strcpy(destructorName, "__ecereDestructor_");
2022 FullClassNameCat(destructorName, symbol->string, 0x0);
2023 symbol->destructorName = __ecereNameSpace__ecere__sys__CopyString(destructorName);
2024 ListAdd(specs, MkSpecifier(VOID));
2025 context = PushContext();
2026 statements = MkList();
2027 if(definitions != (((void *)0)))
2028 {
2029 for(def = definitions->first; def; def = def->next)
2030 {
2031 if(def->type == 2 && def->decl && def->decl->type == 2)
2032 {
2033 struct Instantiation * inst = def->decl->inst;
2034 struct Symbol * classSym = inst->_class->symbol;
2035
2036 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0))
2037 {
2038 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2039
2040 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2041 }
2042 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 5))
2043 {
2044 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2045
2046 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2047 }
2048 }
2049 }
2050 }
2051 if(destructor && destructor->body)
2052 {
2053 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*statements), (((void *)0)), destructor->body);
2054 destructor->body->compound.context->parent = context;
2055 destructor->body = (((void *)0));
2056 }
2057 body = MkCompoundStmt(declarations, statements);
2058 PopContext(context);
2059 body->compound.context = context;
2060 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(destructorName)), (((void *)0)));
2061 decl->symbol = __extension__ ({
2062 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2063
2064 __ecereInstance1->id = symbol->id, __ecereInstance1->idCode = symbol->idCode, __ecereInstance1;
2065 });
2066 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2067 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2068 ProcessClassFunctionBody(function, body);
2069 function->id = symbol->id;
2070 function->idCode = symbol->idCode;
2071 function->dontMangle = 0x1;
2072 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2073 }
2074 if(symbol->needConstructor && inCompiler)
2075 {
2076 struct ClassFunction * function;
2077 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
2078 struct Declarator * decl;
2079 struct Statement * body;
2080 struct Context * context;
2081 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2082
2083 strcpy(constructorName, "__ecereConstructor_");
2084 FullClassNameCat(constructorName, symbol->string, 0x0);
2085 symbol->constructorName = __ecereNameSpace__ecere__sys__CopyString(constructorName);
2086 ListAdd(specs, MkSpecifierName("bool"));
2087 context = PushContext();
2088 statements = MkList();
2089 if(definitions != (((void *)0)))
2090 {
2091 for(def = definitions->first; def; def = def->next)
2092 {
2093 if(def->type == 2 && def->decl && def->decl->type == 2)
2094 {
2095 struct Instantiation * inst = def->decl->inst;
2096 struct Symbol * classSym = inst->_class->symbol;
2097
2098 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5))
2099 {
2100 struct Instantiation * newInst = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
2101
2102 *newInst = *inst;
2103 newInst->members = (((void *)0));
2104 newInst->exp = CopyExpression(inst->exp);
2105 newInst->_class = CopySpecifier(inst->_class);
2106 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(newInst))));
2107 inst->built = 0x1;
2108 }
2109 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0))
2110 {
2111 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_IncRef")), MkListOne(CopyExpression(inst->exp))))));
2112 }
2113 }
2114 }
2115 for(def = definitions->first; def; def = def->next)
2116 {
2117 if(def->type == 1 && def->defProperties)
2118 {
2119 struct MemberInit * propertyDef;
2120
2121 for(propertyDef = (*def->defProperties).first; propertyDef; propertyDef = propertyDef->next)
2122 {
2123 struct Expression * memberExp;
2124 struct Identifier * id = (*propertyDef->identifiers).first;
2125
2126 if(id)
2127 {
2128 memberExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), id);
2129 for(id = id->next; id; id = id->next)
2130 memberExp = MkExpMember(memberExp, id);
2131 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(memberExp, '=', (propertyDef->initializer && propertyDef->initializer->type == 0 ? propertyDef->initializer->exp : (((void *)0)))))));
2132 }
2133 if(propertyDef->initializer)
2134 {
2135 if(propertyDef->initializer->type == 0)
2136 propertyDef->initializer->exp = (((void *)0));
2137 FreeInitializer(propertyDef->initializer);
2138 }
2139 propertyDef->initializer = (((void *)0));
2140 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*propertyDef->identifiers));
2141 }
2142 }
2143 }
2144 for(def = definitions->first; def; def = def->next)
2145 {
2146 if(def->type == 2 && def->decl && def->decl->type == 2)
2147 {
2148 struct Instantiation * inst = def->decl->inst;
2149 struct Symbol * classSym = inst->_class->symbol;
2150
2151 if(inst->exp || (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5))
2152 {
2153 if(!(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5)) || (inst->members && (*inst->members).count))
2154 {
2155 def->decl->inst = (((void *)0));
2156 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(inst))));
2157 }
2158 }
2159 }
2160 }
2161 }
2162 if(constructor && constructor->body)
2163 {
2164 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*statements), constructor->body);
2165 constructor->body->compound.context->parent = context;
2166 constructor->body = (((void *)0));
2167 }
2168 ListAdd(statements, MkReturnStmt(MkListOne(MkExpIdentifier(MkIdentifier("true")))));
2169 body = MkCompoundStmt(declarations, statements);
2170 PopContext(context);
2171 body->compound.context = context;
2172 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(constructorName)), (((void *)0)));
2173 decl->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2174 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2175 decl->symbol->id = symbol->id;
2176 decl->symbol->idCode = symbol->idCode;
2177 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2178 ProcessClassFunctionBody(function, body);
2179 function->id = symbol->id;
2180 function->idCode = symbol->idCode;
2181 function->dontMangle = 0x1;
2182 if(definitions != (((void *)0)))
2183 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2184 }
2185 }
2186 if(definitions != (((void *)0)))
2187 {
2188 for(def = definitions->first; def; def = def->next)
2189 {
2190 if(def->type == 3 && def->propertyDef)
2191 {
2192 struct PropertyDef * propertyDef = def->propertyDef;
2193 struct ClassDef * after = def;
2194 struct ClassDef * newDef;
2195
2196 if(inCompiler)
2197 {
2198 yylloc = propertyDef->loc;
2199 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && def->memberAccess == 1)
2200 CheckPublicDataType(propertyDef->symbol->type, 1, "class property");
2201 else if(!symbol->isStatic)
2202 CheckPublicDataType(propertyDef->symbol->type, 2, "class property");
2203 }
2204 {
2205 {
2206 struct ClassFunction * func;
2207 struct Declarator * decl;
2208 char name[1024];
2209 struct __ecereNameSpace__ecere__sys__OldList * params;
2210
2211 if(propertyDef->getStmt && propertyDef->id)
2212 {
2213 strcpy(name, "__ecereProp_");
2214 FullClassNameCat(name, symbol->string, 0x0);
2215 strcat(name, "_Get_");
2216 FullClassNameCat(name, propertyDef->id->string, 0x1);
2217 MangleClassName(name);
2218 params = MkList();
2219 if(propertyDef->symbol->type && propertyDef->symbol->type->kind == 8 && propertyDef->symbol->type->_class && propertyDef->symbol->type->_class->registered && propertyDef->symbol->type->_class->registered->type == 1)
2220 {
2221 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), MkDeclaratorIdentifier(MkIdentifier("value"))));
2222 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2223 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), decl, (((void *)0)));
2224 }
2225 else
2226 {
2227 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2228 func = MkClassFunction(CopyList(propertyDef->specifiers, CopySpecifier), (((void *)0)), decl, (((void *)0)));
2229 }
2230 ProcessClassFunctionBody(func, propertyDef->getStmt);
2231 func->declarator->symbol = propertyDef->symbol;
2232 propertyDef->symbol->externalGet = (struct External *)func;
2233 func->dontMangle = 0x1;
2234 newDef = MkClassDefFunction(func);
2235 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2236 after = newDef;
2237 if(inCompiler)
2238 propertyDef->getStmt = (((void *)0));
2239 else
2240 func->body = (((void *)0));
2241 }
2242 if(propertyDef->setStmt && propertyDef->id)
2243 {
2244 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2245
2246 strcpy(name, "__ecereProp_");
2247 FullClassNameCat(name, symbol->string, 0x0);
2248 strcat(name, "_Set_");
2249 FullClassNameCat(name, propertyDef->id->string, 0x1);
2250 MangleClassName(name);
2251 params = MkList();
2252 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")))));
2253 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2254 {
2255 unsigned int isConversion = propertyDef->symbol->_property && propertyDef->symbol->_property->conversion;
2256 unsigned int useVoid = 0x0;
2257
2258 switch(regClass->type)
2259 {
2260 case 1:
2261 case 6:
2262 useVoid = 0x1;
2263 break;
2264 case 5:
2265 case 0:
2266 useVoid = !isConversion;
2267 break;
2268 default:
2269 useVoid = !isConversion;
2270 if(useVoid && !propertyDef->isDBProp)
2271 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "set defined on type without storage for non-conversion property\n", (((void *)0))));
2272 }
2273 ListAdd(specifiers, useVoid ? MkSpecifier(VOID) : MkSpecifierName(regClass->fullName));
2274 }
2275 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2276 ProcessClassFunctionBody(func, propertyDef->setStmt);
2277 func->dontMangle = 0x1;
2278 func->declarator->symbol = propertyDef->symbol;
2279 propertyDef->symbol->externalSet = (struct External *)func;
2280 if(!propertyDef->conversion && regClass->type == 0)
2281 func->propSet = propertyDef->symbol;
2282 newDef = MkClassDefFunction(func);
2283 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2284 after = newDef;
2285 if(inCompiler)
2286 propertyDef->setStmt = (((void *)0));
2287 else
2288 func->body = (((void *)0));
2289 }
2290 if(propertyDef->issetStmt && propertyDef->id)
2291 {
2292 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2293
2294 strcpy(name, "__ecereProp_");
2295 FullClassNameCat(name, symbol->string, 0x0);
2296 strcat(name, "_IsSet_");
2297 FullClassNameCat(name, propertyDef->id->string, 0x1);
2298 MangleClassName(name);
2299 params = MkList();
2300 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2301 ListAdd(specifiers, MkSpecifierName("bool"));
2302 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2303 ProcessClassFunctionBody(func, propertyDef->issetStmt);
2304 func->dontMangle = 0x1;
2305 func->declarator->symbol = propertyDef->symbol;
2306 propertyDef->symbol->externalIsSet = (struct External *)func;
2307 newDef = MkClassDefFunction(func);
2308 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2309 after = newDef;
2310 if(inCompiler)
2311 propertyDef->issetStmt = (((void *)0));
2312 else
2313 func->body = (((void *)0));
2314 }
2315 if(propertyDef->id && inCompiler)
2316 {
2317 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(symbol->registered, propertyDef->id->string, privateModule);
2318 struct Declaration * decl;
2319 struct External * external;
2320 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2321
2322 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
2323 ListAdd(specifiers, MkSpecifierName("Property"));
2324 strcpy(name, "__ecereProp_");
2325 FullClassNameCat(name, symbol->string, 0x0);
2326 strcat(name, "_");
2327 FullClassNameCat(name, propertyDef->id->string, 0x1);
2328 MangleClassName(name);
2329 {
2330 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
2331
2332 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2333 strcpy(name, "__ecerePropM_");
2334 FullClassNameCat(name, symbol->string, 0x0);
2335 strcat(name, "_");
2336 FullClassNameCat(name, propertyDef->id->string, 0x1);
2337 MangleClassName(name);
2338 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2339 decl = MkDeclaration(specifiers, list);
2340 }
2341 external = MkExternalDeclaration(decl);
2342 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2343 external->symbol = propertyDef->symbol;
2344 propertyDef->symbol->externalPtr = external;
2345 if(inCompiler && prop && prop->symbol)
2346 ((struct Symbol *)prop->symbol)->externalPtr = external;
2347 }
2348 }
2349 }
2350 }
2351 else if(def->type == 10 && def->propertyDef)
2352 {
2353 struct PropertyDef * propertyDef = def->propertyDef;
2354 struct ClassDef * after = def;
2355 struct ClassDef * newDef;
2356
2357 {
2358 if(inCompiler)
2359 {
2360 yylloc = propertyDef->loc;
2361 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace))
2362 CheckPublicDataType(propertyDef->symbol->type, 1, "classwide property");
2363 else if(!symbol->isStatic)
2364 CheckPublicDataType(propertyDef->symbol->type, 2, "classwide property");
2365 }
2366 {
2367 struct ClassFunction * func;
2368 struct Declarator * decl;
2369 char name[1024];
2370 struct __ecereNameSpace__ecere__sys__OldList * params;
2371
2372 if(propertyDef->getStmt && propertyDef->id)
2373 {
2374 struct Declarator * declId;
2375
2376 sprintf(name, "class::__ecereClassProp_");
2377 FullClassNameCat(name, symbol->string, 0x0);
2378 strcat(name, "_Get_");
2379 strcat(name, propertyDef->id->string);
2380 MangleClassName(name);
2381 params = MkList();
2382 declId = MkDeclaratorIdentifier(MkIdentifier(name));
2383 {
2384 decl = MkDeclaratorFunction(declId, params);
2385 func = MkClassFunction(MkListOne(MkSpecifierName("uint64")), (((void *)0)), decl, (((void *)0)));
2386 }
2387 ProcessClassFunctionBody(func, propertyDef->getStmt);
2388 func->declarator->symbol = propertyDef->symbol;
2389 propertyDef->symbol->externalGet = (struct External *)func;
2390 func->dontMangle = 0x1;
2391 newDef = MkClassDefFunction(func);
2392 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2393 after = newDef;
2394 decl = MkDeclaratorFunction(propertyDef->declarator, (((void *)0)));
2395 func->type = ProcessType(propertyDef->specifiers, decl);
2396 decl->declarator = (((void *)0));
2397 FreeDeclarator(decl);
2398 if(func->type->returnType->kind == 8 && func->type->returnType->_class && func->type->returnType->_class->registered && func->type->returnType->_class->registered->type == 1)
2399 func->type->returnType->byReference = 0x1;
2400 if(inCompiler)
2401 propertyDef->getStmt = (((void *)0));
2402 else
2403 func->body = (((void *)0));
2404 }
2405 if(propertyDef->setStmt && propertyDef->id)
2406 {
2407 struct Context * prevCurContext;
2408 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2409 struct Statement * body = propertyDef->setStmt;
2410 struct Declarator * ptrDecl;
2411
2412 strcpy(name, "class::__ecereClassProp_");
2413 FullClassNameCat(name, symbol->string, 0x0);
2414 strcat(name, "_Set_");
2415 strcat(name, propertyDef->id->string);
2416 MangleClassName(name);
2417 params = MkList();
2418 prevCurContext = curContext;
2419 curContext = body->compound.context;
2420 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorIdentifier(MkIdentifier("_value"))));
2421 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2422 if(!body->compound.declarations)
2423 body->compound.declarations = MkList();
2424 if(propertyDef->symbol->type && propertyDef->symbol->type->kind == 8 && propertyDef->symbol->type->_class && propertyDef->symbol->type->_class->registered && propertyDef->symbol->type->_class->registered->type == 1)
2425 ptrDecl = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value"))));
2426 else
2427 ptrDecl = PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")));
2428 ListAdd(body->compound.declarations, MkDeclaration(CopyList(propertyDef->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(ptrDecl, MkInitializerAssignment(MkExpCast(MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), CopyDeclarator(propertyDef->declarator)), MkExpIdentifier(MkIdentifier("_value"))))))));
2429 curContext = prevCurContext;
2430 {
2431 struct Symbol * sym = ptrDecl->symbol;
2432
2433 sym->isParam = 0x1;
2434 FreeType(sym->type);
2435 sym->type = ProcessType(propertyDef->specifiers, propertyDef->declarator);
2436 }
2437 ListAdd(specifiers, MkSpecifier(VOID));
2438 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2439 ProcessClassFunctionBody(func, propertyDef->setStmt);
2440 func->dontMangle = 0x1;
2441 func->declarator->symbol = propertyDef->symbol;
2442 propertyDef->symbol->externalSet = (struct External *)func;
2443 newDef = MkClassDefFunction(func);
2444 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2445 after = newDef;
2446 if(inCompiler)
2447 propertyDef->setStmt = (((void *)0));
2448 else
2449 func->body = (((void *)0));
2450 }
2451 }
2452 }
2453 }
2454 else if(def->type == 0 && def->function->declarator)
2455 {
2456 struct ClassFunction * func = def->function;
2457
2458 func->_class = regClass;
2459 if(!func->dontMangle)
2460 {
2461 struct Declarator * funcDecl = GetFuncDecl(func->declarator);
2462 struct Identifier * id = GetDeclId(funcDecl);
2463 struct __ecereNameSpace__ecere__com__Method * method;
2464
2465 if(!funcDecl->function.parameters || !(*funcDecl->function.parameters).first)
2466 {
2467 if(!funcDecl->function.parameters)
2468 funcDecl->function.parameters = MkList();
2469 ListAdd(funcDecl->function.parameters, MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
2470 }
2471 method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, id->string, privateModule);
2472 FreeSpecifier(id->_class);
2473 id->_class = (((void *)0));
2474 if(inCompiler && method)
2475 {
2476 char * newId = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (strlen(id->string) + strlen("__ecereMethod___ecereNameSpace__") + strlen(symbol->string) + 2));
2477
2478 newId[0] = '\0';
2479 ProcessMethodType(method);
2480 yylloc = def->loc;
2481 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && method->memberAccess == 1)
2482 CheckPublicDataType(method->dataType, 1, "class method");
2483 strcpy(newId, "__ecereMethod_");
2484 FullClassNameCat(newId, symbol->string, 0x0);
2485 strcat(newId, "_");
2486 strcat(newId, id->string);
2487 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
2488 id->string = newId;
2489 if(method->type != 1)
2490 {
2491 if(method->symbol)
2492 {
2493 (__ecereNameSpace__ecere__com__eSystem_Delete(((struct Symbol *)method->symbol)->string), ((struct Symbol *)method->symbol)->string = 0);
2494 ((struct Symbol *)method->symbol)->string = __ecereNameSpace__ecere__sys__CopyString(newId);
2495 }
2496 }
2497 }
2498 }
2499 }
2500 }
2501 }
2502 if(initDeclarators != (((void *)0)))
2503 FreeList(initDeclarators, FreeInitDeclarator);
2504 }
2505
2506 void PreProcessClassDefinitions()
2507 {
2508 struct External * external, * next;
2509
2510 curExternal = (((void *)0));
2511 if(ast)
2512 {
2513 for(external = (*ast).first; external; external = next)
2514 {
2515 next = external->next;
2516 curExternal = external;
2517 if(external->type == 2)
2518 {
2519 struct ClassDefinition * _class = external->_class;
2520
2521 if(_class->definitions)
2522 {
2523 ProcessClass(0, _class->definitions, _class->symbol, _class->baseSpecs, (((void *)0)), &_class->loc, ast, external->prev, (((void *)0)), (((void *)0)));
2524 }
2525 }
2526 else if(external->type == 1)
2527 {
2528 struct Declaration * declaration = external->declaration;
2529
2530 if(declaration->type == 1)
2531 {
2532 if(declaration->specifiers)
2533 {
2534 struct Specifier * specifier;
2535
2536 for(specifier = (*declaration->specifiers).first; specifier; specifier = specifier->next)
2537 {
2538 if((specifier->type == 2 || specifier->type == 3 || specifier->type == 4) && specifier->id && specifier->id->string && (declaration->declMode || specifier->baseSpecs || (specifier->type == 2 && specifier->definitions)))
2539 {
2540 struct Symbol * symbol = FindClass(specifier->id->string);
2541
2542 if(symbol)
2543 {
2544 struct __ecereNameSpace__ecere__sys__OldList * initDeclarators = (((void *)0));
2545 struct ExtDecl * extDecl = specifier->extDeclStruct;
2546
2547 specifier->extDeclStruct = (((void *)0));
2548 if(inCompiler)
2549 {
2550 initDeclarators = declaration->declarators;
2551 declaration->declarators = (((void *)0));
2552 }
2553 ProcessClass((specifier->type == 4) ? 6 : 0, specifier->definitions, symbol, specifier->baseSpecs, specifier->list, &specifier->loc, ast, external->prev, initDeclarators, extDecl);
2554 }
2555 }
2556 }
2557 }
2558 }
2559 else if(inCompiler && declaration->type == 3)
2560 {
2561 yylloc = declaration->loc;
2562 if(declaration->declMode == 1)
2563 CheckPublicExpression(declaration->exp, 1);
2564 else if(declaration->declMode != 3)
2565 CheckPublicExpression(declaration->exp, 2);
2566 }
2567 }
2568 else if(external->type == 3)
2569 {
2570 }
2571 else if(inCompiler && external->type == 0)
2572 {
2573 yylloc = external->function->loc;
2574 if(!external->function->type)
2575 external->function->type = ProcessType(external->function->specifiers, external->function->declarator);
2576 if(external->function->declMode == 1)
2577 CheckPublicDataType(external->function->type, 1, "function");
2578 else if(external->function->declMode != 3)
2579 CheckPublicDataType(external->function->type, 2, "function");
2580 }
2581 }
2582 }
2583 }
2584
2585 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
2586
2587 struct __ecereNameSpace__ecere__com__GlobalFunction;
2588
2589 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(char *  name, char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
2590
2591 void __ecereRegisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
2592 {
2593 struct __ecereNameSpace__ecere__com__Class * class;
2594
2595 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MangleClassName", "void MangleClassName(char * className)", MangleClassName, module, 1);
2596 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FullClassNameCat", "void FullClassNameCat(char * output, char * className, bool includeTemplateParams)", FullClassNameCat, module, 1);
2597 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PreProcessClassDefinitions", "void PreProcessClassDefinitions(void)", PreProcessClassDefinitions, module, 1);
2598 }
2599
2600 void __ecereUnregisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
2601 {
2602
2603 }
2604