compiler/libec Improvements to conversion from AST->Type class, and to outputting...
[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 unsigned 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 } __attribute__ ((gcc_struct));
816
817 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
818
819 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
820
821 struct __ecereNameSpace__ecere__com__Instance
822 {
823 int (* *  _vTbl)();
824 struct __ecereNameSpace__ecere__com__Class * _class;
825 int _refCount;
826 } __attribute__ ((gcc_struct));
827
828 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
829
830 struct __ecereNameSpace__ecere__com__DataMember
831 {
832 struct __ecereNameSpace__ecere__com__DataMember * prev;
833 struct __ecereNameSpace__ecere__com__DataMember * next;
834 char *  name;
835 unsigned int isProperty;
836 int memberAccess;
837 int id;
838 struct __ecereNameSpace__ecere__com__Class * _class;
839 char *  dataTypeString;
840 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
841 struct Type * dataType;
842 int type;
843 int offset;
844 int memberID;
845 struct __ecereNameSpace__ecere__sys__OldList members;
846 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
847 int memberOffset;
848 int structAlignment;
849 } __attribute__ ((gcc_struct));
850
851 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
852
853 struct __ecereNameSpace__ecere__com__SerialBuffer
854 {
855 unsigned char *  _buffer;
856 unsigned int count;
857 unsigned int _size;
858 unsigned int pos;
859 } __attribute__ ((gcc_struct));
860
861 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
862
863 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
864 {
865 union
866 {
867 struct
868 {
869 char *  dataTypeString;
870 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
871 } __attribute__ ((gcc_struct));
872 struct __ecereNameSpace__ecere__com__DataValue expression;
873 struct
874 {
875 char *  memberString;
876 union
877 {
878 struct __ecereNameSpace__ecere__com__DataMember * member;
879 struct __ecereNameSpace__ecere__com__Property * prop;
880 struct __ecereNameSpace__ecere__com__Method * method;
881 } __attribute__ ((gcc_struct));
882 } __attribute__ ((gcc_struct));
883 } __attribute__ ((gcc_struct));
884 } __attribute__ ((gcc_struct));
885
886 enum yytokentype
887 {
888 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
889 };
890
891 typedef union YYSTYPE
892 {
893 int specifierType;
894 int i;
895 int declMode;
896 struct Identifier * id;
897 struct Expression * exp;
898 struct Specifier * specifier;
899 struct __ecereNameSpace__ecere__sys__OldList * list;
900 struct Enumerator * enumerator;
901 struct Declarator * declarator;
902 struct Pointer * pointer;
903 struct Initializer * initializer;
904 struct InitDeclarator * initDeclarator;
905 struct TypeName * typeName;
906 struct Declaration * declaration;
907 struct Statement * stmt;
908 struct FunctionDefinition * function;
909 struct External * external;
910 struct Context * context;
911 struct AsmField * asmField;
912 struct Attrib * attrib;
913 struct ExtDecl * extDecl;
914 struct Attribute * attribute;
915 struct Instantiation * instance;
916 struct MembersInit * membersInit;
917 struct MemberInit * memberInit;
918 struct ClassFunction * classFunction;
919 struct ClassDefinition * _class;
920 struct ClassDef * classDef;
921 struct PropertyDef * prop;
922 char * string;
923 struct Symbol * symbol;
924 struct PropertyWatch * propertyWatch;
925 struct TemplateParameter * templateParameter;
926 struct TemplateArgument * templateArgument;
927 struct TemplateDatatype * templateDatatype;
928 struct DBTableEntry * dbtableEntry;
929 struct DBIndexItem * dbindexItem;
930 struct DBTableDef * dbtableDef;
931 } __attribute__ ((gcc_struct)) YYSTYPE;
932
933 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
934
935 struct Enumerator;
936
937 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
938
939 struct InitDeclarator;
940
941 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
942
943 struct AsmField;
944
945 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
946
947 struct Attribute;
948
949 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
950
951 struct ClassFunction
952 {
953 struct ClassFunction * prev;
954 struct ClassFunction * next;
955 struct Location loc;
956 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
957 struct Declarator * declarator;
958 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
959 struct Statement * body;
960 struct __ecereNameSpace__ecere__com__Class * _class;
961 struct __ecereNameSpace__ecere__sys__OldList attached;
962 int declMode;
963 struct Type * type;
964 struct Symbol * propSet;
965 unsigned int isVirtual;
966 unsigned int isConstructor;
967 unsigned int isDestructor;
968 unsigned int dontMangle;
969 int id;
970 int idCode;
971 } __attribute__ ((gcc_struct));
972
973 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
974
975 struct MembersInit
976 {
977 struct MembersInit * prev;
978 struct MembersInit * next;
979 struct Location loc;
980 int type;
981 union
982 {
983 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
984 struct ClassFunction * function;
985 } __attribute__ ((gcc_struct));
986 } __attribute__ ((gcc_struct));
987
988 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
989
990 struct MemberInit
991 {
992 struct MemberInit * prev;
993 struct MemberInit * next;
994 struct Location loc;
995 struct Location realLoc;
996 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
997 struct Initializer * initializer;
998 unsigned int used;
999 unsigned int variable;
1000 unsigned int takeOutExp;
1001 } __attribute__ ((gcc_struct));
1002
1003 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1004
1005 struct PropertyDef
1006 {
1007 struct PropertyDef * prev;
1008 struct PropertyDef * next;
1009 struct Location loc;
1010 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1011 struct Declarator * declarator;
1012 struct Identifier * id;
1013 struct Statement * getStmt;
1014 struct Statement * setStmt;
1015 struct Statement * issetStmt;
1016 struct Symbol * symbol;
1017 unsigned int conversion;
1018 unsigned int isWatchable;
1019 struct Expression * category;
1020 } __attribute__ ((gcc_struct));
1021
1022 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1023
1024 struct PropertyWatch;
1025
1026 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1027
1028 struct ClassDef
1029 {
1030 struct ClassDef * prev;
1031 struct ClassDef * next;
1032 struct Location loc;
1033 int type;
1034 union
1035 {
1036 struct Declaration * decl;
1037 struct ClassFunction * function;
1038 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1039 struct PropertyDef * propertyDef;
1040 struct PropertyWatch * propertyWatch;
1041 char *  designer;
1042 struct Identifier * defaultProperty;
1043 struct
1044 {
1045 struct Identifier * id;
1046 struct Initializer * initializer;
1047 } __attribute__ ((gcc_struct));
1048 } __attribute__ ((gcc_struct));
1049 int memberAccess;
1050 void *  object;
1051 } __attribute__ ((gcc_struct));
1052
1053 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1054
1055 struct DBTableEntry;
1056
1057 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1058
1059 struct DBIndexItem;
1060
1061 extern YYSTYPE yylval;
1062
1063 extern struct Location yylloc;
1064
1065 extern struct External * curExternal;
1066
1067 void MangleClassName(char * className)
1068 {
1069 char output[1024];
1070 int c, d = 0;
1071 char ch;
1072
1073 for(c = 0; (ch = className[c]); c++)
1074 {
1075 if(ch == ' ')
1076 output[d++] = '_';
1077 else if(ch == '*')
1078 {
1079 output[d++] = '_';
1080 output[d++] = 'P';
1081 output[d++] = 'T';
1082 output[d++] = 'R';
1083 output[d++] = '_';
1084 }
1085 else if(ch == '<')
1086 {
1087 output[d++] = '_';
1088 output[d++] = 'T';
1089 output[d++] = 'P';
1090 output[d++] = 'L';
1091 output[d++] = '_';
1092 }
1093 else if(ch == '=')
1094 {
1095 output[d++] = '_';
1096 output[d++] = 'E';
1097 output[d++] = 'Q';
1098 output[d++] = 'U';
1099 output[d++] = '_';
1100 }
1101 else if(ch == '>')
1102 {
1103 output[d++] = '_';
1104 }
1105 else if(ch == ',')
1106 {
1107 output[d++] = '__';
1108 }
1109 else
1110 output[d++] = ch;
1111 }
1112 output[d] = (char)0;
1113 }
1114
1115 extern char *  strcat(char * , const char * );
1116
1117 extern size_t strlen(const char * );
1118
1119 void FullClassNameCat(char * output, char * className, unsigned int includeTemplateParams)
1120 {
1121 int c;
1122 char ch;
1123 int len;
1124
1125 for(c = 0; (ch = className[c]) && ch != '<'; c++)
1126 {
1127 if(ch == ':')
1128 {
1129 strcat(output, "__ecereNameSpace__");
1130 break;
1131 }
1132 }
1133 len = strlen(output);
1134 for(c = 0; (ch = className[c]); c++)
1135 {
1136 if(ch == ':')
1137 output[len++] = '_';
1138 else if(ch == ' ')
1139 output[len++] = '_';
1140 else if(ch == '*')
1141 {
1142 output[len++] = '_';
1143 output[len++] = 'P';
1144 output[len++] = 'T';
1145 output[len++] = 'R';
1146 output[len++] = '_';
1147 }
1148 else if(ch == '=')
1149 {
1150 output[len++] = '_';
1151 output[len++] = 'E';
1152 output[len++] = 'Q';
1153 output[len++] = 'U';
1154 output[len++] = '_';
1155 }
1156 else if(ch == '<')
1157 {
1158 if(!includeTemplateParams)
1159 break;
1160 output[len++] = '_';
1161 output[len++] = 'T';
1162 output[len++] = 'P';
1163 output[len++] = 'L';
1164 output[len++] = '_';
1165 }
1166 else if(ch == '>')
1167 {
1168 output[len++] = '_';
1169 }
1170 else if(ch == ',')
1171 {
1172 output[len++] = '__';
1173 }
1174 else
1175 output[len++] = ch;
1176 }
1177 output[len++] = (char)0;
1178 }
1179
1180 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);
1181
1182 static void AddSimpleBaseMembers(struct __ecereNameSpace__ecere__sys__OldList * list, struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * topClass)
1183 {
1184 if(_class->type != 1000)
1185 AddMembers(list, _class, 0x0, (((void *)0)), topClass, (((void *)0)));
1186 }
1187
1188 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
1189
1190 struct __ecereNameSpace__ecere__com__NameSpace
1191 {
1192 char *  name;
1193 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
1194 struct __ecereNameSpace__ecere__com__NameSpace *  left;
1195 struct __ecereNameSpace__ecere__com__NameSpace *  right;
1196 int depth;
1197 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
1198 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
1199 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
1200 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
1201 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
1202 } __attribute__ ((gcc_struct));
1203
1204 static unsigned int NameSpaceContained(struct __ecereNameSpace__ecere__com__NameSpace * ns, struct __ecereNameSpace__ecere__com__NameSpace * parent)
1205 {
1206 if(ns == parent)
1207 return 0x1;
1208 else if((*ns).parent)
1209 return NameSpaceContained((*ns).parent, parent);
1210 else
1211 return 0x0;
1212 }
1213
1214 extern void Compiler_Error(char *  format, ...);
1215
1216 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
1217
1218 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
1219
1220 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
1221
1222 struct __ecereNameSpace__ecere__com__Module
1223 {
1224 struct __ecereNameSpace__ecere__com__Instance * application;
1225 struct __ecereNameSpace__ecere__sys__OldList classes;
1226 struct __ecereNameSpace__ecere__sys__OldList defines;
1227 struct __ecereNameSpace__ecere__sys__OldList functions;
1228 struct __ecereNameSpace__ecere__sys__OldList modules;
1229 struct __ecereNameSpace__ecere__com__Instance * prev;
1230 struct __ecereNameSpace__ecere__com__Instance * next;
1231 char *  name;
1232 void *  library;
1233 void *  Unload;
1234 int importType;
1235 int origImportType;
1236 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
1237 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
1238 } __attribute__ ((gcc_struct));
1239
1240 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
1241
1242 struct __ecereNameSpace__ecere__com__Application
1243 {
1244 int argc;
1245 char * *  argv;
1246 int exitCode;
1247 unsigned int isGUIApp;
1248 struct __ecereNameSpace__ecere__sys__OldList allModules;
1249 char *  parsedCommand;
1250 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
1251 } __attribute__ ((gcc_struct));
1252
1253 extern unsigned int ModuleAccess(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor);
1254
1255 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1256
1257 static void CheckPublicClass(struct Symbol * classSym, int access, char * word)
1258 {
1259 struct __ecereNameSpace__ecere__com__Class * regClass = classSym ? classSym->registered : (((void *)0));
1260
1261 if(regClass)
1262 {
1263 if(regClass->templateClass)
1264 regClass = regClass->templateClass;
1265 if(classSym->isStatic && access != 3)
1266 {
1267 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Non-static %s making use of a static class\n", (((void *)0))), word);
1268 }
1269 else if(access == 1)
1270 {
1271 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->application + structSize_Module)))->systemNameSpace))
1272 {
1273 if(NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) || !ModuleAccess(privateModule, regClass->module))
1274 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Public %s making use of a private class\n", (((void *)0))), word);
1275 }
1276 }
1277 }
1278 }
1279
1280 static void CheckPublicTypeName(struct TypeName * type, int access)
1281 {
1282 if(type->qualifiers)
1283 {
1284 struct Specifier * spec;
1285
1286 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
1287 {
1288 if(spec->type == 1)
1289 {
1290 struct Symbol * classSym = spec->symbol;
1291
1292 CheckPublicClass(classSym, access, "define");
1293 }
1294 }
1295 }
1296 }
1297
1298 static void CheckPublicExpression(struct Expression * exp, int access);
1299
1300 static void CheckPublicInitializer(struct Initializer * init, int access)
1301 {
1302 switch(init->type)
1303 {
1304 case 0:
1305 CheckPublicExpression(init->exp, access);
1306 break;
1307 case 1:
1308 {
1309 struct Initializer * i;
1310
1311 for(i = (*init->list).first; i; i = i->next)
1312 CheckPublicInitializer(i, access);
1313 break;
1314 }
1315 }
1316 }
1317
1318 static void CheckPublicExpression(struct Expression * exp, int access)
1319 {
1320 if(exp)
1321 {
1322 switch(exp->type)
1323 {
1324 case 0:
1325 break;
1326 case 2:
1327 break;
1328 case 3:
1329 break;
1330 case 4:
1331 if(exp->op.exp1)
1332 CheckPublicExpression(exp->op.exp1, access);
1333 if(exp->op.exp2)
1334 CheckPublicExpression(exp->op.exp2, access);
1335 break;
1336 case 5:
1337 {
1338 struct Expression * e;
1339
1340 for(e = (*exp->list).first; e; e = e->next)
1341 CheckPublicExpression(e, access);
1342 break;
1343 }
1344 case 6:
1345 {
1346 struct Expression * e;
1347
1348 CheckPublicExpression(exp->index.exp, access);
1349 for(e = (*exp->index.index).first; e; e = e->next)
1350 CheckPublicExpression(e, access);
1351 break;
1352 }
1353 case 7:
1354 {
1355 struct Expression * e;
1356
1357 CheckPublicExpression(exp->call.exp, access);
1358 if(exp->call.arguments)
1359 {
1360 for(e = (*exp->call.arguments).first; e; e = e->next)
1361 CheckPublicExpression(e, access);
1362 }
1363 break;
1364 }
1365 case 8:
1366 {
1367 CheckPublicExpression(exp->member.exp, access);
1368 break;
1369 }
1370 case 9:
1371 {
1372 CheckPublicExpression(exp->member.exp, access);
1373 break;
1374 }
1375 case 10:
1376 CheckPublicTypeName(exp->typeName, access);
1377 break;
1378 case 11:
1379 {
1380 struct Type * type = exp->expType;
1381
1382 CheckPublicTypeName(exp->cast.typeName, access);
1383 if(exp->cast.exp)
1384 CheckPublicExpression(exp->cast.exp, access);
1385 break;
1386 }
1387 case 12:
1388 {
1389 struct Expression * e;
1390
1391 CheckPublicExpression(exp->cond.cond, access);
1392 for(e = (*exp->cond.exp).first; e; e = e->next)
1393 CheckPublicExpression(e, access);
1394 CheckPublicExpression(exp->cond.elseExp, access);
1395 break;
1396 }
1397 case 13:
1398 case 28:
1399 CheckPublicExpression(exp->_new.size, access);
1400 break;
1401 case 14:
1402 case 29:
1403 CheckPublicExpression(exp->_renew.size, access);
1404 CheckPublicExpression(exp->_renew.exp, access);
1405 break;
1406 case 1:
1407 {
1408 struct MembersInit * members;
1409
1410 CheckPublicClass(exp->instance->_class->symbol, access, "define");
1411 for(members = (*exp->instance->members).first; members; members = members->next)
1412 {
1413 if(members->type == 0)
1414 {
1415 struct MemberInit * member;
1416
1417 for(member = (*members->dataMembers).first; member; member = member->next)
1418 {
1419 CheckPublicInitializer(member->initializer, access);
1420 }
1421 }
1422 }
1423 break;
1424 }
1425 }
1426 }
1427 }
1428
1429 static void CheckPublicDataType(struct Type * type, int access, char * word)
1430 {
1431 if(type)
1432 {
1433 switch(type->kind)
1434 {
1435 case 8:
1436 {
1437 CheckPublicClass(type->_class, access, word);
1438 break;
1439 }
1440 case 9:
1441 case 10:
1442 {
1443 break;
1444 }
1445 case 11:
1446 {
1447 struct Type * param;
1448
1449 CheckPublicDataType(type->returnType, access, word);
1450 for(param = type->params.first; param; param = param->next)
1451 CheckPublicDataType(param, access, word);
1452 CheckPublicClass(type->thisClass, access, word);
1453 break;
1454 }
1455 case 12:
1456 CheckPublicDataType(type->arrayType, access, word);
1457 if(type->enumClass)
1458 CheckPublicClass(type->enumClass, access, word);
1459 break;
1460 case 13:
1461 {
1462 CheckPublicDataType(type->type, access, word);
1463 break;
1464 }
1465 case 16:
1466 {
1467 break;
1468 }
1469 case 19:
1470 {
1471 CheckPublicClass(type->_class, access, word);
1472 break;
1473 }
1474 }
1475 }
1476 }
1477
1478 extern struct Identifier * GetDeclId(struct Declarator * decl);
1479
1480 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
1481
1482 struct __ecereNameSpace__ecere__com__BTNamedLink
1483 {
1484 char *  name;
1485 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
1486 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
1487 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
1488 int depth;
1489 void *  data;
1490 } __attribute__ ((gcc_struct));
1491
1492 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);
1493
1494 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1495
1496 static void CheckMembersDefinitions(struct __ecereNameSpace__ecere__com__Class * regClass, struct __ecereNameSpace__ecere__com__DataMember * member, struct __ecereNameSpace__ecere__sys__OldList * definitions, int access)
1497 {
1498 if(definitions != (((void *)0)))
1499 {
1500 struct ClassDef * def;
1501
1502 for(def = definitions->first; def; def = def->next)
1503 {
1504 if(def->type == 2)
1505 {
1506 struct Declaration * decl = def->decl;
1507 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
1508
1509 yylloc = def->loc;
1510 if(decl->type == 0)
1511 {
1512 struct Declarator * d;
1513
1514 if(decl->declarators)
1515 {
1516 for(d = (*decl->declarators).first; d; d = d->next)
1517 {
1518 struct Identifier * declId = GetDeclId(d);
1519
1520 if(declId)
1521 {
1522 if(member)
1523 {
1524 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, declId->string);
1525
1526 dataMember = link ? link->data : (((void *)0));
1527 }
1528 else
1529 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, declId->string, privateModule, (((void *)0)), (((void *)0)));
1530 if(dataMember)
1531 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "class data member", (((void *)0))));
1532 }
1533 }
1534 }
1535 else if(decl->specifiers)
1536 {
1537 struct Specifier * spec;
1538
1539 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
1540 {
1541 if(spec->type == 3 || spec->type == 4)
1542 {
1543 if(spec->definitions && !spec->id)
1544 {
1545 CheckMembersDefinitions(regClass, member, spec->definitions, (def->memberAccess == 2) ? 2 : access);
1546 }
1547 else if(spec->definitions && spec->id)
1548 {
1549 if(member)
1550 {
1551 struct __ecereNameSpace__ecere__com__BTNamedLink * link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&member->membersAlpha, spec->id->string);
1552
1553 dataMember = link ? link->data : (((void *)0));
1554 }
1555 else
1556 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, spec->id->string, privateModule, (((void *)0)), (((void *)0)));
1557 if(dataMember)
1558 CheckPublicDataType(dataMember->dataType, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "class data member", (((void *)0))));
1559 }
1560 }
1561 }
1562 }
1563 }
1564 else if(decl->type == 2)
1565 {
1566 CheckPublicClass(decl->inst->_class->symbol, (def->memberAccess == 2) ? 2 : access, __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "class member instance", (((void *)0))));
1567 }
1568 }
1569 }
1570 }
1571 }
1572
1573 extern unsigned int inCompiler;
1574
1575 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1576
1577 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
1578
1579 extern struct Symbol * FindClass(char *  name);
1580
1581 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);
1582
1583 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);
1584
1585 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);
1586
1587 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);
1588
1589 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);
1590
1591 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
1592
1593 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
1594
1595 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
1596
1597 extern struct Specifier * MkSpecifierName(char *  name);
1598
1599 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
1600
1601 extern struct Identifier * MkIdentifier(char *  string);
1602
1603 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
1604
1605 extern struct Expression * QMkExpId(char *  id);
1606
1607 extern void FreeDeclarator(struct Declarator * decl);
1608
1609 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
1610
1611 extern void FreeSpecifier(struct Specifier * spec);
1612
1613 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1614
1615 extern struct Type * MkClassType(char *  name);
1616
1617 extern char *  strcpy(char * , const char * );
1618
1619 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
1620
1621 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1622
1623 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
1624
1625 extern void FreeExternal(struct External * external);
1626
1627 extern int declMode;
1628
1629 extern char *  strstr(const char * , const char * );
1630
1631 extern char *  sourceFile;
1632
1633 extern struct Specifier * MkSpecifier(int specifier);
1634
1635 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
1636
1637 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1638
1639 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1640
1641 extern struct Context * PushContext(void);
1642
1643 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1644
1645 extern struct Expression * CopyExpression(struct Expression * exp);
1646
1647 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
1648
1649 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
1650
1651 extern void PopContext(struct Context * ctx);
1652
1653 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
1654
1655 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
1656
1657 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
1658
1659 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
1660
1661 extern struct ClassDef * MkClassDefFunction(struct ClassFunction * function);
1662
1663 extern struct Specifier * CopySpecifier(struct Specifier * spec);
1664
1665 extern struct Expression * MkExpInstance(struct Instantiation * inst);
1666
1667 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
1668
1669 extern struct Expression * MkExpIdentifier(struct Identifier * id);
1670
1671 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
1672
1673 extern void FreeInitializer(struct Initializer * initializer);
1674
1675 extern struct Statement * MkReturnStmt(struct __ecereNameSpace__ecere__sys__OldList * exp);
1676
1677 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1678
1679 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
1680
1681 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
1682
1683 extern struct __ecereNameSpace__ecere__sys__OldList *  ast;
1684
1685 extern int sprintf(char * , char * , ...);
1686
1687 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1688
1689 extern struct Context * curContext;
1690
1691 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
1692
1693 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1694
1695 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
1696
1697 extern void FreeType(struct Type * type);
1698
1699 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
1700
1701 extern void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
1702
1703 extern void FreeInitDeclarator(struct InitDeclarator * decl);
1704
1705 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1706
1707 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
1708
1709 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
1710
1711 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
1712
1713 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
1714
1715 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
1716
1717 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)
1718 {
1719 char structName[1024];
1720 char className[1024];
1721 char constructorName[1024];
1722 char destructorName[1024];
1723 struct __ecereNameSpace__ecere__com__Class * regClass;
1724 struct ClassFunction * destructor = (((void *)0)), * constructor = (((void *)0));
1725 unsigned int redefinition = 0x0;
1726 unsigned int isUnion = classType == 6;
1727 struct External * external = (((void *)0));
1728 struct ClassDef * def;
1729 struct __ecereNameSpace__ecere__sys__OldList * list;
1730 struct __ecereNameSpace__ecere__sys__OldList * classDataList;
1731
1732 if(inCompiler)
1733 {
1734 list = MkList();
1735 classDataList = MkList();
1736 }
1737 regClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, symbol->string);
1738 if(!regClass)
1739 return ;
1740 classType = regClass->type;
1741 if(inCompiler)
1742 {
1743 yylloc = *loc;
1744 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && regClass->inheritanceAccess == 1)
1745 {
1746 if(!regClass->base->symbol)
1747 regClass->base->symbol = FindClass(regClass->base->fullName);
1748 CheckPublicClass(regClass->base->symbol, 1, __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "class", (((void *)0))));
1749 }
1750 else if(!symbol->isStatic && regClass->base)
1751 {
1752 if(!regClass->base->symbol)
1753 regClass->base->symbol = FindClass(regClass->base->fullName);
1754 CheckPublicClass(regClass->base->symbol, 2, __ecereNameSpace__ecere__GetTranslatedString(__thisModule, "class", (((void *)0))));
1755 }
1756 }
1757 if(definitions != (((void *)0)))
1758 {
1759 for(def = definitions->first; def; def = def->next)
1760 {
1761 if(def->type == 13)
1762 {
1763 struct __ecereNameSpace__ecere__com__DataMember * member;
1764 struct __ecereNameSpace__ecere__com__Property * prop;
1765 struct __ecereNameSpace__ecere__com__Method * method;
1766
1767 if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(regClass, def->id->string, privateModule)))
1768 {
1769 __ecereNameSpace__ecere__com__eClass_AddProperty(regClass, def->id->string, (((void *)0)), (((void *)0)), (((void *)0)), def->memberAccess);
1770 }
1771 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(regClass, def->id->string, privateModule, (((void *)0)), (((void *)0)))))
1772 {
1773 __ecereNameSpace__ecere__com__eClass_AddDataMember(regClass, def->id->string, (((void *)0)), 0, 0, def->memberAccess);
1774 }
1775 else if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, def->id->string, privateModule)))
1776 {
1777 __ecereNameSpace__ecere__com__eClass_AddMethod(regClass, def->id->string, (((void *)0)), (((void *)0)), def->memberAccess);
1778 }
1779 else
1780 {
1781 yylloc = def->loc;
1782 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't find member %s to override\n", (((void *)0))), def->id->string);
1783 }
1784 }
1785 }
1786 }
1787 if(inCompiler)
1788 {
1789 external = MkExternalDeclaration((((void *)0)));
1790 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
1791 curExternal = external;
1792 curExternal->symbol = symbol;
1793 }
1794 if((classType == 1 || classType == 5) && inCompiler)
1795 {
1796 AddSimpleBaseMembers(list, regClass->base, regClass);
1797 }
1798 if(definitions != (((void *)0)))
1799 {
1800 if(inCompiler)
1801 {
1802 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace))
1803 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 1);
1804 else if(!symbol->isStatic)
1805 CheckMembersDefinitions(regClass, (((void *)0)), definitions, 2);
1806 }
1807 for(def = definitions->first; def; def = def->next)
1808 {
1809 if(def->type == 2)
1810 {
1811 struct Declaration * decl = def->decl;
1812
1813 if(decl->type == 0)
1814 {
1815 if(inCompiler && classType != 2)
1816 {
1817 ListAdd(list, MkClassDefDeclaration(decl));
1818 def->decl = (((void *)0));
1819 }
1820 }
1821 else if(decl->type == 2)
1822 {
1823 struct Instantiation * inst = decl->inst;
1824 struct Expression * exp = inst->exp;
1825 struct Symbol * classSym;
1826
1827 if(exp)
1828 {
1829 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
1830 struct Declarator * d;
1831
1832 ListAdd(specifiers, MkSpecifierName(inst->_class->name));
1833 d = MkDeclaratorIdentifier(MkIdentifier(exp->identifier->string));
1834 if(inCompiler)
1835 {
1836 struct __ecereNameSpace__ecere__sys__OldList * declarators = MkList();
1837
1838 ListAdd(declarators, d);
1839 decl = MkStructDeclaration(specifiers, declarators, (((void *)0)));
1840 ListAdd(list, MkClassDefDeclaration(decl));
1841 exp->type = 8;
1842 exp->member.member = exp->identifier;
1843 exp->member.exp = QMkExpId("this");
1844 exp->member.memberType = 3;
1845 exp->member.thisPtr = 0x1;
1846 }
1847 else
1848 {
1849 FreeDeclarator(d);
1850 FreeList(specifiers, FreeSpecifier);
1851 }
1852 }
1853 classSym = inst->_class->symbol;
1854 if(classSym && classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 2 || classSym->registered->type == 3))
1855 {
1856 if(inst->members && (*inst->members).count)
1857 symbol->needConstructor = 0x1;
1858 }
1859 else
1860 {
1861 symbol->needConstructor = 0x1;
1862 symbol->needDestructor = 0x1;
1863 }
1864 }
1865 }
1866 else if(def->type == 9)
1867 {
1868 struct Declaration * decl = def->decl;
1869
1870 if(decl->type == 0)
1871 {
1872 if(inCompiler && classType != 2)
1873 {
1874 ListAdd(classDataList, MkClassDefDeclaration(decl));
1875 def->decl = (((void *)0));
1876 }
1877 }
1878 }
1879 else if(def->type == 1)
1880 symbol->needConstructor = 0x1;
1881 else if(def->type == 4)
1882 symbol->needConstructor = 0x1;
1883 else if(def->type == 0)
1884 {
1885 struct ClassFunction * func = def->function;
1886
1887 if(func->isDestructor)
1888 {
1889 if(destructor)
1890 {
1891 yylloc = *loc;
1892 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "redefinition of destructor for class %s\n", (((void *)0))), symbol->string);
1893 }
1894 else
1895 {
1896 symbol->needDestructor = 0x1;
1897 destructor = func;
1898 if(!inCompiler && func->body)
1899 {
1900 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1901
1902 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1903 }
1904 }
1905 }
1906 if(func->isConstructor)
1907 {
1908 if(constructor)
1909 {
1910 yylloc = *loc;
1911 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "redefinition of constructor for class %s\n", (((void *)0))), symbol->string);
1912 }
1913 else
1914 {
1915 symbol->needConstructor = 0x1;
1916 constructor = func;
1917 if(!inCompiler && func->body)
1918 {
1919 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
1920
1921 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&func->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
1922 }
1923 }
1924 }
1925 }
1926 }
1927 }
1928 if(inCompiler)
1929 {
1930 external->symbol = (((void *)0));
1931 if((*list).count)
1932 {
1933 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = (initDeclarators != (((void *)0))) ? initDeclarators : MkList();
1934
1935 initDeclarators = (((void *)0));
1936 strcpy(structName, symbol->string);
1937 symbol->structName = __ecereNameSpace__ecere__sys__CopyString(structName);
1938 {
1939 struct Specifier * spec = MkStructOrUnion(3, MkIdentifier(structName), isUnion ? MkListOne(MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkStructOrUnion(4, (((void *)0)), list)), (((void *)0)), (((void *)0))))) : list);
1940
1941 spec->extDeclStruct = extDecl;
1942 ListAdd(specs, spec);
1943 }
1944 external->symbol = symbol;
1945 symbol->structExternal = external;
1946 external->declaration = MkDeclaration(specs, declarators);
1947 after = external;
1948 symbol->declaredStruct = 0x1;
1949 }
1950 else
1951 {
1952 curExternal = external->prev;
1953 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(defs, external);
1954 FreeExternal(external);
1955 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
1956 }
1957 if((*classDataList).count)
1958 {
1959 char classDataStructName[1024];
1960 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1961 struct External * external;
1962
1963 strcpy(classDataStructName, "__ecereClassData_");
1964 FullClassNameCat(classDataStructName, symbol->string, 0x0);
1965 declMode = 0;
1966 ListAdd(specs, MkStructOrUnion(3, MkIdentifier(classDataStructName), classDataList));
1967 external = MkExternalDeclaration(MkDeclaration(specs, (((void *)0))));
1968 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, external);
1969 after = external;
1970 symbol->classData = 0x1;
1971 }
1972 else
1973 (__ecereNameSpace__ecere__com__eSystem_Delete(classDataList), classDataList = 0);
1974 }
1975 if(inCompiler)
1976 {
1977 {
1978 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * declarators = MkList();
1979
1980 strcpy(className, "__ecereClass_");
1981 FullClassNameCat(className, symbol->string, 0x1);
1982 MangleClassName(className);
1983 symbol->className = __ecereNameSpace__ecere__sys__CopyString(className);
1984 if(!strstr(sourceFile, ".main.ec"))
1985 ListAdd(specs, MkSpecifier(STATIC));
1986 ListAdd(specs, MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
1987 ListAdd(declarators, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(className))), (((void *)0))));
1988 symbol->methodExternal = MkExternalDeclaration(MkDeclaration(specs, declarators));
1989 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(defs, after, symbol->methodExternal);
1990 after = symbol->methodExternal;
1991 }
1992 if(symbol->needDestructor)
1993 {
1994 struct ClassFunction * function;
1995 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1996 struct Declarator * decl;
1997 struct Statement * body;
1998 struct Context * context;
1999 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2000
2001 strcpy(destructorName, "__ecereDestructor_");
2002 FullClassNameCat(destructorName, symbol->string, 0x0);
2003 symbol->destructorName = __ecereNameSpace__ecere__sys__CopyString(destructorName);
2004 ListAdd(specs, MkSpecifier(VOID));
2005 context = PushContext();
2006 statements = MkList();
2007 if(definitions != (((void *)0)))
2008 {
2009 for(def = definitions->first; def; def = def->next)
2010 {
2011 if(def->type == 2 && def->decl && def->decl->type == 2)
2012 {
2013 struct Instantiation * inst = def->decl->inst;
2014 struct Symbol * classSym = inst->_class->symbol;
2015
2016 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0))
2017 {
2018 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2019
2020 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2021 }
2022 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 5))
2023 {
2024 struct Expression * exp = MkExpOp((((void *)0)), DELETE, CopyExpression(inst->exp));
2025
2026 ListAdd(statements, MkExpressionStmt(MkListOne(exp)));
2027 }
2028 }
2029 }
2030 }
2031 if(destructor && destructor->body)
2032 {
2033 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*statements), (((void *)0)), destructor->body);
2034 destructor->body->compound.context->parent = context;
2035 destructor->body = (((void *)0));
2036 }
2037 body = MkCompoundStmt(declarations, statements);
2038 PopContext(context);
2039 body->compound.context = context;
2040 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(destructorName)), (((void *)0)));
2041 decl->symbol = __extension__ ({
2042 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2043
2044 __ecereInstance1->id = symbol->id, __ecereInstance1->idCode = symbol->idCode, __ecereInstance1;
2045 });
2046 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2047 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2048 ProcessClassFunctionBody(function, body);
2049 function->id = symbol->id;
2050 function->idCode = symbol->idCode;
2051 function->dontMangle = 0x1;
2052 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2053 }
2054 if(symbol->needConstructor && inCompiler)
2055 {
2056 struct ClassFunction * function;
2057 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
2058 struct Declarator * decl;
2059 struct Statement * body;
2060 struct Context * context;
2061 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0)), * statements;
2062
2063 strcpy(constructorName, "__ecereConstructor_");
2064 FullClassNameCat(constructorName, symbol->string, 0x0);
2065 symbol->constructorName = __ecereNameSpace__ecere__sys__CopyString(constructorName);
2066 ListAdd(specs, MkSpecifierName("bool"));
2067 context = PushContext();
2068 statements = MkList();
2069 if(definitions != (((void *)0)))
2070 {
2071 for(def = definitions->first; def; def = def->next)
2072 {
2073 if(def->type == 2 && def->decl && def->decl->type == 2)
2074 {
2075 struct Instantiation * inst = def->decl->inst;
2076 struct Symbol * classSym = inst->_class->symbol;
2077
2078 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5))
2079 {
2080 struct Instantiation * newInst = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
2081
2082 *newInst = *inst;
2083 newInst->members = (((void *)0));
2084 newInst->exp = CopyExpression(inst->exp);
2085 newInst->_class = CopySpecifier(inst->_class);
2086 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(newInst))));
2087 inst->built = 0x1;
2088 }
2089 if(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0))
2090 {
2091 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_IncRef")), MkListOne(CopyExpression(inst->exp))))));
2092 }
2093 }
2094 }
2095 for(def = definitions->first; def; def = def->next)
2096 {
2097 if(def->type == 1 && def->defProperties)
2098 {
2099 struct MemberInit * propertyDef;
2100
2101 for(propertyDef = (*def->defProperties).first; propertyDef; propertyDef = propertyDef->next)
2102 {
2103 struct Expression * memberExp;
2104 struct Identifier * id = (*propertyDef->identifiers).first;
2105
2106 if(id)
2107 {
2108 memberExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), id);
2109 for(id = id->next; id; id = id->next)
2110 memberExp = MkExpMember(memberExp, id);
2111 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(memberExp, '=', (propertyDef->initializer && propertyDef->initializer->type == 0 ? propertyDef->initializer->exp : (((void *)0)))))));
2112 }
2113 if(propertyDef->initializer)
2114 {
2115 if(propertyDef->initializer->type == 0)
2116 propertyDef->initializer->exp = (((void *)0));
2117 FreeInitializer(propertyDef->initializer);
2118 }
2119 propertyDef->initializer = (((void *)0));
2120 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*propertyDef->identifiers));
2121 }
2122 }
2123 }
2124 for(def = definitions->first; def; def = def->next)
2125 {
2126 if(def->type == 2 && def->decl && def->decl->type == 2)
2127 {
2128 struct Instantiation * inst = def->decl->inst;
2129 struct Symbol * classSym = inst->_class->symbol;
2130
2131 if(inst->exp || (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5))
2132 {
2133 if(!(inst->exp && (!classSym || !classSym->registered || classSym->registered->type == 0 || classSym->registered->type == 5)) || (inst->members && (*inst->members).count))
2134 {
2135 def->decl->inst = (((void *)0));
2136 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpInstance(inst))));
2137 }
2138 }
2139 }
2140 }
2141 }
2142 if(constructor && constructor->body)
2143 {
2144 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*statements), constructor->body);
2145 constructor->body->compound.context->parent = context;
2146 constructor->body = (((void *)0));
2147 }
2148 ListAdd(statements, MkReturnStmt(MkListOne(MkExpIdentifier(MkIdentifier("true")))));
2149 body = MkCompoundStmt(declarations, statements);
2150 PopContext(context);
2151 body->compound.context = context;
2152 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(constructorName)), (((void *)0)));
2153 decl->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2154 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), decl->symbol);
2155 decl->symbol->id = symbol->id;
2156 decl->symbol->idCode = symbol->idCode;
2157 function = MkClassFunction(specs, (((void *)0)), decl, (((void *)0)));
2158 ProcessClassFunctionBody(function, body);
2159 function->id = symbol->id;
2160 function->idCode = symbol->idCode;
2161 function->dontMangle = 0x1;
2162 if(definitions != (((void *)0)))
2163 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, (((void *)0)), MkClassDefFunction(function));
2164 }
2165 }
2166 if(definitions != (((void *)0)))
2167 {
2168 for(def = definitions->first; def; def = def->next)
2169 {
2170 if(def->type == 3 && def->propertyDef)
2171 {
2172 struct PropertyDef * propertyDef = def->propertyDef;
2173 struct ClassDef * after = def;
2174 struct ClassDef * newDef;
2175
2176 if(inCompiler)
2177 {
2178 yylloc = propertyDef->loc;
2179 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && def->memberAccess == 1)
2180 CheckPublicDataType(propertyDef->symbol->type, 1, "class property");
2181 else if(!symbol->isStatic)
2182 CheckPublicDataType(propertyDef->symbol->type, 2, "class property");
2183 }
2184 {
2185 {
2186 struct ClassFunction * func;
2187 struct Declarator * decl;
2188 char name[1024];
2189 struct __ecereNameSpace__ecere__sys__OldList * params;
2190
2191 if(propertyDef->getStmt && propertyDef->id)
2192 {
2193 strcpy(name, "__ecereProp_");
2194 FullClassNameCat(name, symbol->string, 0x0);
2195 strcat(name, "_Get_");
2196 FullClassNameCat(name, propertyDef->id->string, 0x1);
2197 MangleClassName(name);
2198 params = MkList();
2199 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)
2200 {
2201 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), MkDeclaratorIdentifier(MkIdentifier("value"))));
2202 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2203 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), decl, (((void *)0)));
2204 }
2205 else
2206 {
2207 decl = PlugDeclarator(propertyDef->declarator, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params));
2208 func = MkClassFunction(CopyList(propertyDef->specifiers, CopySpecifier), (((void *)0)), decl, (((void *)0)));
2209 }
2210 ProcessClassFunctionBody(func, propertyDef->getStmt);
2211 func->declarator->symbol = propertyDef->symbol;
2212 propertyDef->symbol->externalGet = (struct External *)func;
2213 func->dontMangle = 0x1;
2214 newDef = MkClassDefFunction(func);
2215 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2216 after = newDef;
2217 if(inCompiler)
2218 propertyDef->getStmt = (((void *)0));
2219 else
2220 func->body = (((void *)0));
2221 }
2222 if(propertyDef->setStmt && propertyDef->id)
2223 {
2224 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2225
2226 strcpy(name, "__ecereProp_");
2227 FullClassNameCat(name, symbol->string, 0x0);
2228 strcat(name, "_Set_");
2229 FullClassNameCat(name, propertyDef->id->string, 0x1);
2230 MangleClassName(name);
2231 params = MkList();
2232 ListAdd(params, MkTypeName(CopyList(propertyDef->specifiers, CopySpecifier), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")))));
2233 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2234 if(!propertyDef->symbol->_property || !propertyDef->symbol->_property->conversion)
2235 ListAdd(specifiers, MkSpecifier(VOID));
2236 else
2237 {
2238 if(regClass->type == 1)
2239 ListAdd(specifiers, MkSpecifier(VOID));
2240 else
2241 ListAdd(specifiers, MkSpecifierName(regClass->fullName));
2242 }
2243 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2244 ProcessClassFunctionBody(func, propertyDef->setStmt);
2245 func->dontMangle = 0x1;
2246 func->declarator->symbol = propertyDef->symbol;
2247 propertyDef->symbol->externalSet = (struct External *)func;
2248 if(!propertyDef->conversion && regClass->type == 0)
2249 func->propSet = propertyDef->symbol;
2250 newDef = MkClassDefFunction(func);
2251 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2252 after = newDef;
2253 if(inCompiler)
2254 propertyDef->setStmt = (((void *)0));
2255 else
2256 func->body = (((void *)0));
2257 }
2258 if(propertyDef->issetStmt && propertyDef->id)
2259 {
2260 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2261
2262 strcpy(name, "__ecereProp_");
2263 FullClassNameCat(name, symbol->string, 0x0);
2264 strcat(name, "_IsSet_");
2265 FullClassNameCat(name, propertyDef->id->string, 0x1);
2266 MangleClassName(name);
2267 params = MkList();
2268 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2269 ListAdd(specifiers, MkSpecifierName("bool"));
2270 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2271 ProcessClassFunctionBody(func, propertyDef->issetStmt);
2272 func->dontMangle = 0x1;
2273 func->declarator->symbol = propertyDef->symbol;
2274 propertyDef->symbol->externalIsSet = (struct External *)func;
2275 newDef = MkClassDefFunction(func);
2276 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2277 after = newDef;
2278 if(inCompiler)
2279 propertyDef->issetStmt = (((void *)0));
2280 else
2281 func->body = (((void *)0));
2282 }
2283 if(propertyDef->id && inCompiler)
2284 {
2285 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(symbol->registered, propertyDef->id->string, privateModule);
2286 struct Declaration * decl;
2287 struct External * external;
2288 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2289
2290 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
2291 ListAdd(specifiers, MkSpecifierName("Property"));
2292 strcpy(name, "__ecereProp_");
2293 FullClassNameCat(name, symbol->string, 0x0);
2294 strcat(name, "_");
2295 FullClassNameCat(name, propertyDef->id->string, 0x1);
2296 MangleClassName(name);
2297 {
2298 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
2299
2300 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2301 strcpy(name, "__ecerePropM_");
2302 FullClassNameCat(name, symbol->string, 0x0);
2303 strcat(name, "_");
2304 FullClassNameCat(name, propertyDef->id->string, 0x1);
2305 MangleClassName(name);
2306 ListAdd(list, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))));
2307 decl = MkDeclaration(specifiers, list);
2308 }
2309 external = MkExternalDeclaration(decl);
2310 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2311 external->symbol = propertyDef->symbol;
2312 propertyDef->symbol->externalPtr = external;
2313 if(inCompiler && prop && prop->symbol)
2314 ((struct Symbol *)prop->symbol)->externalPtr = external;
2315 }
2316 }
2317 }
2318 }
2319 else if(def->type == 10 && def->propertyDef)
2320 {
2321 struct PropertyDef * propertyDef = def->propertyDef;
2322 struct ClassDef * after = def;
2323 struct ClassDef * newDef;
2324
2325 {
2326 if(inCompiler)
2327 {
2328 yylloc = propertyDef->loc;
2329 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace))
2330 CheckPublicDataType(propertyDef->symbol->type, 1, "classwide property");
2331 else if(!symbol->isStatic)
2332 CheckPublicDataType(propertyDef->symbol->type, 2, "classwide property");
2333 }
2334 {
2335 struct ClassFunction * func;
2336 struct Declarator * decl;
2337 char name[1024];
2338 struct __ecereNameSpace__ecere__sys__OldList * params;
2339
2340 if(propertyDef->getStmt && propertyDef->id)
2341 {
2342 struct Declarator * declId;
2343
2344 sprintf(name, "class::__ecereClassProp_");
2345 FullClassNameCat(name, symbol->string, 0x0);
2346 strcat(name, "_Get_");
2347 strcat(name, propertyDef->id->string);
2348 MangleClassName(name);
2349 params = MkList();
2350 declId = MkDeclaratorIdentifier(MkIdentifier(name));
2351 {
2352 decl = MkDeclaratorFunction(declId, params);
2353 func = MkClassFunction(MkListOne(MkSpecifierName("uint64")), (((void *)0)), decl, (((void *)0)));
2354 }
2355 ProcessClassFunctionBody(func, propertyDef->getStmt);
2356 func->declarator->symbol = propertyDef->symbol;
2357 propertyDef->symbol->externalGet = (struct External *)func;
2358 func->dontMangle = 0x1;
2359 newDef = MkClassDefFunction(func);
2360 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2361 after = newDef;
2362 func->type = ProcessType(propertyDef->specifiers, MkDeclaratorFunction(propertyDef->declarator, (((void *)0))));
2363 if(func->type->returnType->kind == 8 && func->type->returnType->_class && func->type->returnType->_class->registered && func->type->returnType->_class->registered->type == 1)
2364 func->type->returnType->byReference = 0x1;
2365 if(inCompiler)
2366 propertyDef->getStmt = (((void *)0));
2367 else
2368 func->body = (((void *)0));
2369 }
2370 if(propertyDef->setStmt && propertyDef->id)
2371 {
2372 struct Context * prevCurContext;
2373 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
2374 struct Statement * body = propertyDef->setStmt;
2375 struct Declarator * ptrDecl;
2376
2377 strcpy(name, "class::__ecereClassProp_");
2378 FullClassNameCat(name, symbol->string, 0x0);
2379 strcat(name, "_Set_");
2380 strcat(name, propertyDef->id->string);
2381 MangleClassName(name);
2382 params = MkList();
2383 prevCurContext = curContext;
2384 curContext = body->compound.context;
2385 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorIdentifier(MkIdentifier("_value"))));
2386 decl = MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(name)), params);
2387 if(!body->compound.declarations)
2388 body->compound.declarations = MkList();
2389 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)
2390 ptrDecl = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value"))));
2391 else
2392 ptrDecl = PlugDeclarator(propertyDef->declarator, MkDeclaratorIdentifier(MkIdentifier("value")));
2393 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"))))))));
2394 curContext = prevCurContext;
2395 {
2396 struct Symbol * sym = ptrDecl->symbol;
2397
2398 sym->isParam = 0x1;
2399 FreeType(sym->type);
2400 sym->type = ProcessType(propertyDef->specifiers, propertyDef->declarator);
2401 }
2402 ListAdd(specifiers, MkSpecifier(VOID));
2403 func = MkClassFunction(specifiers, (((void *)0)), decl, (((void *)0)));
2404 ProcessClassFunctionBody(func, propertyDef->setStmt);
2405 func->dontMangle = 0x1;
2406 func->declarator->symbol = propertyDef->symbol;
2407 propertyDef->symbol->externalSet = (struct External *)func;
2408 newDef = MkClassDefFunction(func);
2409 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(definitions, after, newDef);
2410 after = newDef;
2411 if(inCompiler)
2412 propertyDef->setStmt = (((void *)0));
2413 else
2414 func->body = (((void *)0));
2415 }
2416 }
2417 }
2418 }
2419 else if(def->type == 0 && def->function->declarator)
2420 {
2421 struct ClassFunction * func = def->function;
2422
2423 func->_class = regClass;
2424 if(!func->dontMangle)
2425 {
2426 struct Declarator * funcDecl = GetFuncDecl(func->declarator);
2427 struct Identifier * id = GetDeclId(funcDecl);
2428 struct __ecereNameSpace__ecere__com__Method * method;
2429
2430 if(!funcDecl->function.parameters || !(*funcDecl->function.parameters).first)
2431 {
2432 if(!funcDecl->function.parameters)
2433 funcDecl->function.parameters = MkList();
2434 ListAdd(funcDecl->function.parameters, MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
2435 }
2436 method = __ecereNameSpace__ecere__com__eClass_FindMethod(regClass, id->string, privateModule);
2437 FreeSpecifier(id->_class);
2438 id->_class = (((void *)0));
2439 if(inCompiler && method)
2440 {
2441 char * newId = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (strlen(id->string) + strlen("__ecereMethod___ecereNameSpace__") + strlen(symbol->string) + 2));
2442
2443 newId[0] = '\0';
2444 ProcessMethodType(method);
2445 yylloc = def->loc;
2446 if(!NameSpaceContained(regClass->nameSpace, &((struct __ecereNameSpace__ecere__com__Module *)(((char *)regClass->module + structSize_Instance)))->privateNameSpace) && method->memberAccess == 1)
2447 CheckPublicDataType(method->dataType, 1, "class method");
2448 strcpy(newId, "__ecereMethod_");
2449 FullClassNameCat(newId, symbol->string, 0x0);
2450 strcat(newId, "_");
2451 strcat(newId, id->string);
2452 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
2453 id->string = newId;
2454 if(method->type != 1)
2455 {
2456 if(method->symbol)
2457 {
2458 (__ecereNameSpace__ecere__com__eSystem_Delete(((struct Symbol *)method->symbol)->string), ((struct Symbol *)method->symbol)->string = 0);
2459 ((struct Symbol *)method->symbol)->string = __ecereNameSpace__ecere__sys__CopyString(newId);
2460 }
2461 }
2462 }
2463 }
2464 }
2465 }
2466 }
2467 if(initDeclarators != (((void *)0)))
2468 FreeList(initDeclarators, FreeInitDeclarator);
2469 }
2470
2471 void PreProcessClassDefinitions()
2472 {
2473 struct External * external, * next;
2474
2475 curExternal = (((void *)0));
2476 if(ast)
2477 {
2478 for(external = (*ast).first; external; external = next)
2479 {
2480 next = external->next;
2481 curExternal = external;
2482 if(external->type == 2)
2483 {
2484 struct ClassDefinition * _class = external->_class;
2485
2486 if(_class->definitions)
2487 {
2488 ProcessClass(0, _class->definitions, _class->symbol, _class->baseSpecs, (((void *)0)), &_class->loc, ast, external->prev, (((void *)0)), (((void *)0)));
2489 }
2490 }
2491 else if(external->type == 1)
2492 {
2493 struct Declaration * declaration = external->declaration;
2494
2495 if(declaration->type == 1)
2496 {
2497 if(declaration->specifiers)
2498 {
2499 struct Specifier * specifier;
2500
2501 for(specifier = (*declaration->specifiers).first; specifier; specifier = specifier->next)
2502 {
2503 if((specifier->type == 2 || specifier->type == 3 || specifier->type == 4) && specifier->id && specifier->id->string && (declaration->declMode || specifier->baseSpecs || (specifier->type == 2 && specifier->definitions)))
2504 {
2505 struct Symbol * symbol = FindClass(specifier->id->string);
2506
2507 if(symbol)
2508 {
2509 struct __ecereNameSpace__ecere__sys__OldList * initDeclarators = (((void *)0));
2510 struct ExtDecl * extDecl = specifier->extDeclStruct;
2511
2512 specifier->extDeclStruct = (((void *)0));
2513 if(inCompiler)
2514 {
2515 initDeclarators = declaration->declarators;
2516 declaration->declarators = (((void *)0));
2517 }
2518 ProcessClass((specifier->type == 4) ? 6 : 0, specifier->definitions, symbol, specifier->baseSpecs, specifier->list, &specifier->loc, ast, external->prev, initDeclarators, extDecl);
2519 }
2520 }
2521 }
2522 }
2523 }
2524 else if(inCompiler && declaration->type == 3)
2525 {
2526 yylloc = declaration->loc;
2527 if(declaration->declMode == 1)
2528 CheckPublicExpression(declaration->exp, 1);
2529 else if(declaration->declMode != 3)
2530 CheckPublicExpression(declaration->exp, 2);
2531 }
2532 }
2533 else if(external->type == 3)
2534 {
2535 }
2536 else if(inCompiler && external->type == 0)
2537 {
2538 yylloc = external->function->loc;
2539 if(!external->function->type)
2540 external->function->type = ProcessType(external->function->specifiers, external->function->declarator);
2541 if(external->function->declMode == 1)
2542 CheckPublicDataType(external->function->type, 1, "function");
2543 else if(external->function->declMode != 3)
2544 CheckPublicDataType(external->function->type, 2, "function");
2545 }
2546 }
2547 }
2548 }
2549
2550 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
2551
2552 struct __ecereNameSpace__ecere__com__GlobalFunction;
2553
2554 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);
2555
2556 void __ecereRegisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
2557 {
2558 struct __ecereNameSpace__ecere__com__Class * class;
2559
2560 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MangleClassName", "void MangleClassName(char * className)", MangleClassName, module, 1);
2561 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FullClassNameCat", "void FullClassNameCat(char * output, char * className, bool includeTemplateParams)", FullClassNameCat, module, 1);
2562 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PreProcessClassDefinitions", "void PreProcessClassDefinitions(void)", PreProcessClassDefinitions, module, 1);
2563 }
2564
2565 void __ecereUnregisterModule_pass0(struct __ecereNameSpace__ecere__com__Instance * module)
2566 {
2567
2568 }
2569