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