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