compiler; deps/libffi: Getting rid of warnings
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #elif defined(__TINYC__)
5 #include <stdarg.h>
6 #define __builtin_va_list va_list
7 #define __builtin_va_start va_start
8 #define __builtin_va_end va_end
9 #ifdef _WIN32
10 #define strcasecmp stricmp
11 #define strncasecmp strnicmp
12 #define __declspec(x) __attribute__((x))
13 #endif
14 typedef long long int64;
15 typedef unsigned long long uint64;
16 #else
17 typedef __int64 int64;
18 typedef unsigned __int64 uint64;
19 #endif
20 #ifdef __BIG_ENDIAN__
21 #define __ENDIAN_PAD(x) (8 - (x))
22 #else
23 #define __ENDIAN_PAD(x) 0
24 #endif
25 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
26
27 struct __ecereNameSpace__ecere__sys__BTNode;
28
29 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
30
31 struct __ecereNameSpace__ecere__sys__BinaryTree
32 {
33 struct __ecereNameSpace__ecere__sys__BTNode * root;
34 int count;
35 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, unsigned int a, unsigned int b);
36 void (*  FreeKey)(void *  key);
37 };
38
39 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
40
41 struct __ecereNameSpace__ecere__sys__OldList
42 {
43 void *  first;
44 void *  last;
45 int count;
46 unsigned int offset;
47 unsigned int circ;
48 };
49
50 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
51
52 struct __ecereNameSpace__ecere__com__Method
53 {
54 char *  name;
55 struct __ecereNameSpace__ecere__com__Method * parent;
56 struct __ecereNameSpace__ecere__com__Method * left;
57 struct __ecereNameSpace__ecere__com__Method * right;
58 int depth;
59 int (*  function)();
60 int vid;
61 int type;
62 struct __ecereNameSpace__ecere__com__Class * _class;
63 void *  symbol;
64 char *  dataTypeString;
65 struct Type * dataType;
66 int memberAccess;
67 };
68
69 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
70
71 struct __ecereNameSpace__ecere__com__Property
72 {
73 struct __ecereNameSpace__ecere__com__Property * prev;
74 struct __ecereNameSpace__ecere__com__Property * next;
75 char *  name;
76 unsigned int isProperty;
77 int memberAccess;
78 int id;
79 struct __ecereNameSpace__ecere__com__Class * _class;
80 char *  dataTypeString;
81 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
82 struct Type * dataType;
83 void (*  Set)();
84 int (*  Get)();
85 unsigned int (*  IsSet)();
86 void *  data;
87 void *  symbol;
88 int vid;
89 unsigned int conversion;
90 unsigned int watcherOffset;
91 char *  category;
92 unsigned int compiled;
93 unsigned int selfWatchable;
94 unsigned int isWatchable;
95 };
96
97 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
98
99 struct CodePosition
100 {
101 int line;
102 int charPos;
103 int pos;
104 unsigned int included;
105 };
106
107 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
108
109 struct Location
110 {
111 struct CodePosition start;
112 struct CodePosition end;
113 };
114
115 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
116
117 struct ClassDefinition
118 {
119 struct ClassDefinition * prev;
120 struct ClassDefinition * next;
121 struct Location loc;
122 struct Specifier * _class;
123 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
124 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
125 struct Symbol * symbol;
126 struct Location blockStart;
127 struct Location nameLoc;
128 int endid;
129 int declMode;
130 unsigned int deleteWatchable;
131 };
132
133 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
134
135 struct Context
136 {
137 struct Context * parent;
138 struct __ecereNameSpace__ecere__sys__BinaryTree types;
139 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
140 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
141 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
142 int nextID;
143 int simpleID;
144 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
145 struct ClassDefinition * classDef;
146 unsigned int templateTypesOnly;
147 unsigned int hasNameSpace;
148 };
149
150 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
151
152 struct Instantiation
153 {
154 struct Instantiation * prev;
155 struct Instantiation * next;
156 struct Location loc;
157 struct Specifier * _class;
158 struct Expression * exp;
159 struct __ecereNameSpace__ecere__sys__OldList *  members;
160 struct Symbol * symbol;
161 unsigned int fullSet;
162 unsigned int isConstant;
163 unsigned char *  data;
164 struct Location nameLoc;
165 struct Location insideLoc;
166 unsigned int built;
167 };
168
169 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
170
171 struct Declaration
172 {
173 struct Declaration * prev;
174 struct Declaration * next;
175 struct Location loc;
176 int type;
177 union
178 {
179 struct
180 {
181 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
182 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
183 };
184 struct Instantiation * inst;
185 struct
186 {
187 struct Identifier * id;
188 struct Expression * exp;
189 };
190 };
191 struct Specifier * extStorage;
192 struct Symbol * symbol;
193 int declMode;
194 };
195
196 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
197
198 struct Statement
199 {
200 struct Statement * prev;
201 struct Statement * next;
202 struct Location loc;
203 int type;
204 union
205 {
206 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
207 struct
208 {
209 struct Identifier * id;
210 struct Statement * stmt;
211 } labeled;
212 struct
213 {
214 struct Expression * exp;
215 struct Statement * stmt;
216 } caseStmt;
217 struct
218 {
219 struct __ecereNameSpace__ecere__sys__OldList * declarations;
220 struct __ecereNameSpace__ecere__sys__OldList * statements;
221 struct Context * context;
222 unsigned int isSwitch;
223 } compound;
224 struct
225 {
226 struct __ecereNameSpace__ecere__sys__OldList * exp;
227 struct Statement * stmt;
228 struct Statement * elseStmt;
229 } ifStmt;
230 struct
231 {
232 struct __ecereNameSpace__ecere__sys__OldList * exp;
233 struct Statement * stmt;
234 } switchStmt;
235 struct
236 {
237 struct __ecereNameSpace__ecere__sys__OldList * exp;
238 struct Statement * stmt;
239 } whileStmt;
240 struct
241 {
242 struct __ecereNameSpace__ecere__sys__OldList * exp;
243 struct Statement * stmt;
244 } doWhile;
245 struct
246 {
247 struct Statement * init;
248 struct Statement * check;
249 struct __ecereNameSpace__ecere__sys__OldList * increment;
250 struct Statement * stmt;
251 } forStmt;
252 struct
253 {
254 struct Identifier * id;
255 } gotoStmt;
256 struct
257 {
258 struct Specifier * spec;
259 char * statements;
260 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
261 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
262 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
263 } asmStmt;
264 struct
265 {
266 struct Expression * watcher;
267 struct Expression * object;
268 struct __ecereNameSpace__ecere__sys__OldList * watches;
269 } _watch;
270 struct
271 {
272 struct Identifier * id;
273 struct __ecereNameSpace__ecere__sys__OldList * exp;
274 struct __ecereNameSpace__ecere__sys__OldList * filter;
275 struct Statement * stmt;
276 } forEachStmt;
277 struct Declaration * decl;
278 };
279 };
280
281 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
282
283 struct TypeName
284 {
285 struct TypeName * prev;
286 struct TypeName * next;
287 struct Location loc;
288 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
289 struct Declarator * declarator;
290 int classObjectType;
291 struct Expression * bitCount;
292 };
293
294 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
295
296 struct Initializer
297 {
298 struct Initializer * prev;
299 struct Initializer * next;
300 struct Location loc;
301 int type;
302 union
303 {
304 struct Expression * exp;
305 struct __ecereNameSpace__ecere__sys__OldList *  list;
306 };
307 unsigned int isConstant;
308 };
309
310 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
311
312 struct __ecereNameSpace__ecere__com__DataValue
313 {
314 union
315 {
316 char c;
317 unsigned char uc;
318 short s;
319 unsigned short us;
320 int i;
321 unsigned int ui;
322 void *  p;
323 float f;
324 double d;
325 long long i64;
326 uint64 ui64;
327 };
328 };
329
330 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
331
332 struct Expression
333 {
334 struct Expression * prev;
335 struct Expression * next;
336 struct Location loc;
337 int type;
338 union
339 {
340 struct
341 {
342 char *  constant;
343 struct Identifier * identifier;
344 };
345 struct Statement * compound;
346 struct Instantiation * instance;
347 char *  string;
348 struct __ecereNameSpace__ecere__sys__OldList *  list;
349 struct
350 {
351 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
352 struct Declarator * decl;
353 } _classExp;
354 struct
355 {
356 struct Identifier * id;
357 } classData;
358 struct
359 {
360 struct Expression * exp;
361 struct __ecereNameSpace__ecere__sys__OldList * arguments;
362 struct Location argLoc;
363 } call;
364 struct
365 {
366 struct Expression * exp;
367 struct __ecereNameSpace__ecere__sys__OldList * index;
368 } index;
369 struct
370 {
371 struct Expression * exp;
372 struct Identifier * member;
373 int memberType;
374 unsigned int thisPtr;
375 } member;
376 struct
377 {
378 int op;
379 struct Expression * exp1;
380 struct Expression * exp2;
381 } op;
382 struct TypeName * typeName;
383 struct Specifier * _class;
384 struct
385 {
386 struct TypeName * typeName;
387 struct Expression * exp;
388 } cast;
389 struct
390 {
391 struct Expression * cond;
392 struct __ecereNameSpace__ecere__sys__OldList * exp;
393 struct Expression * elseExp;
394 } cond;
395 struct
396 {
397 struct TypeName * typeName;
398 struct Expression * size;
399 } _new;
400 struct
401 {
402 struct TypeName * typeName;
403 struct Expression * size;
404 struct Expression * exp;
405 } _renew;
406 struct
407 {
408 char * table;
409 struct Identifier * id;
410 } db;
411 struct
412 {
413 struct Expression * ds;
414 struct Expression * name;
415 } dbopen;
416 struct
417 {
418 struct TypeName * typeName;
419 struct Initializer * initializer;
420 } initializer;
421 struct
422 {
423 struct Expression * exp;
424 struct TypeName * typeName;
425 } vaArg;
426 };
427 unsigned int debugValue;
428 struct __ecereNameSpace__ecere__com__DataValue val;
429 unsigned int address;
430 unsigned int hasAddress;
431 struct Type * expType;
432 struct Type * destType;
433 unsigned int usage;
434 int tempCount;
435 unsigned int byReference;
436 unsigned int isConstant;
437 unsigned int addedThis;
438 unsigned int needCast;
439 unsigned int thisPtr;
440 };
441
442 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
443
444 struct TemplateDatatype
445 {
446 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
447 struct Declarator * decl;
448 };
449
450 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
451
452 struct TemplateArgument;
453
454 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
455
456 struct TemplateParameter
457 {
458 struct TemplateParameter * prev;
459 struct TemplateParameter * next;
460 struct Location loc;
461 int type;
462 struct Identifier * identifier;
463 union
464 {
465 struct TemplateDatatype * dataType;
466 int memberType;
467 };
468 struct TemplateArgument * defaultArgument;
469 char *  dataTypeString;
470 struct Type * baseType;
471 };
472
473 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
474
475 struct Specifier
476 {
477 struct Specifier * prev;
478 struct Specifier * next;
479 struct Location loc;
480 int type;
481 union
482 {
483 int specifier;
484 struct
485 {
486 char *  name;
487 struct Symbol * symbol;
488 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
489 };
490 struct
491 {
492 struct Identifier * id;
493 struct __ecereNameSpace__ecere__sys__OldList *  list;
494 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
495 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
496 unsigned int addNameSpace;
497 struct Context * ctx;
498 };
499 struct Expression * expression;
500 struct Specifier * _class;
501 struct TemplateParameter * templateParameter;
502 };
503 };
504
505 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
506
507 struct Identifier
508 {
509 struct Identifier * prev;
510 struct Identifier * next;
511 struct Location loc;
512 struct Symbol * classSym;
513 struct Specifier * _class;
514 char *  string;
515 struct Identifier * badID;
516 };
517
518 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
519
520 struct Pointer;
521
522 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
523
524 struct Declarator
525 {
526 struct Declarator * prev;
527 struct Declarator * next;
528 struct Location loc;
529 int type;
530 struct Symbol * symbol;
531 struct Declarator * declarator;
532 union
533 {
534 struct Identifier * identifier;
535 struct
536 {
537 struct Expression * exp;
538 struct Expression * posExp;
539 char * attrib;
540 } structDecl;
541 struct
542 {
543 struct Expression * exp;
544 struct Specifier * enumClass;
545 } array;
546 struct
547 {
548 struct __ecereNameSpace__ecere__sys__OldList * parameters;
549 } function;
550 struct
551 {
552 struct Pointer * pointer;
553 } pointer;
554 struct
555 {
556 char * extended;
557 } extended;
558 };
559 };
560
561 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
562
563 struct FunctionDefinition
564 {
565 struct FunctionDefinition * prev;
566 struct FunctionDefinition * next;
567 struct Location loc;
568 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
569 struct Declarator * declarator;
570 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
571 struct Statement * body;
572 struct __ecereNameSpace__ecere__com__Class * _class;
573 struct __ecereNameSpace__ecere__sys__OldList attached;
574 int declMode;
575 struct Type * type;
576 struct Symbol * propSet;
577 int tempCount;
578 unsigned int propertyNoThis;
579 };
580
581 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
582
583 struct DBTableDef;
584
585 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
586
587 struct External
588 {
589 struct External * prev;
590 struct External * next;
591 struct Location loc;
592 int type;
593 struct Symbol * symbol;
594 union
595 {
596 struct FunctionDefinition * function;
597 struct ClassDefinition * _class;
598 struct Declaration * declaration;
599 char *  importString;
600 struct Identifier * id;
601 struct DBTableDef * table;
602 };
603 int importType;
604 };
605
606 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
607
608 struct ModuleImport
609 {
610 struct ModuleImport * prev;
611 struct ModuleImport * next;
612 char *  name;
613 struct __ecereNameSpace__ecere__sys__OldList classes;
614 struct __ecereNameSpace__ecere__sys__OldList functions;
615 int importType;
616 int importAccess;
617 };
618
619 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
620
621 struct ClassImport
622 {
623 struct ClassImport * prev;
624 struct ClassImport * next;
625 char *  name;
626 struct __ecereNameSpace__ecere__sys__OldList methods;
627 struct __ecereNameSpace__ecere__sys__OldList properties;
628 unsigned int itself;
629 unsigned int isRemote;
630 };
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 };
648 int id;
649 int idCode;
650 union
651 {
652 struct
653 {
654 struct External * pointerExternal;
655 struct External * structExternal;
656 };
657 struct
658 {
659 struct External * externalGet;
660 struct External * externalSet;
661 struct External * externalPtr;
662 struct External * externalIsSet;
663 };
664 struct
665 {
666 struct External * methodExternal;
667 struct External * methodCodeExternal;
668 };
669 };
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 };
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 };
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 };
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 };
727 struct
728 {
729 struct Type * arrayType;
730 int arraySize;
731 struct Expression * arraySizeExp;
732 unsigned int freeExp;
733 struct Symbol * enumClass;
734 };
735 struct Type * type;
736 struct TemplateParameter * templateParameter;
737 };
738 unsigned int isSigned;
739 int kind;
740 unsigned int constant;
741 unsigned int size;
742 char *  name;
743 char *  typeName;
744 unsigned int count;
745 unsigned int truth;
746 int classObjectType;
747 unsigned int byReference;
748 unsigned int extraParam;
749 int alignment;
750 unsigned int directClassAccess;
751 unsigned int computing;
752 unsigned int dllExport;
753 unsigned int offset;
754 unsigned int keepCast;
755 unsigned int passAsTemplate;
756 int bitFieldCount;
757 };
758
759 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
760
761 struct __ecereNameSpace__ecere__com__Class
762 {
763 struct __ecereNameSpace__ecere__com__Class * prev;
764 struct __ecereNameSpace__ecere__com__Class * next;
765 char *  name;
766 int offset;
767 int structSize;
768 int (* *  _vTbl)();
769 int vTblSize;
770 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
771 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
772 int offsetClass;
773 int sizeClass;
774 struct __ecereNameSpace__ecere__com__Class * base;
775 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
776 struct __ecereNameSpace__ecere__sys__BinaryTree members;
777 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
778 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
779 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
780 struct __ecereNameSpace__ecere__sys__OldList derivatives;
781 int memberID;
782 int startMemberID;
783 int type;
784 struct __ecereNameSpace__ecere__com__Instance * module;
785 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
786 char *  dataTypeString;
787 struct Type * dataType;
788 int typeSize;
789 int defaultAlignment;
790 void (*  Initialize)();
791 int memberOffset;
792 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
793 char *  designerClass;
794 unsigned int noExpansion;
795 char *  defaultProperty;
796 unsigned int comRedefinition;
797 int count;
798 unsigned int isRemote;
799 unsigned int internalDecl;
800 void *  data;
801 unsigned int computeSize;
802 int structAlignment;
803 int destructionWatchOffset;
804 unsigned int fixed;
805 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
806 int inheritanceAccess;
807 char *  fullName;
808 void *  symbol;
809 struct __ecereNameSpace__ecere__sys__OldList conversions;
810 struct __ecereNameSpace__ecere__sys__OldList templateParams;
811 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
812 struct __ecereNameSpace__ecere__com__Class * templateClass;
813 struct __ecereNameSpace__ecere__sys__OldList templatized;
814 int numParams;
815 };
816
817 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
818
819 struct __ecereNameSpace__ecere__com__Instance
820 {
821 int (* *  _vTbl)();
822 struct __ecereNameSpace__ecere__com__Class * _class;
823 int _refCount;
824 };
825
826 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
827
828 struct __ecereNameSpace__ecere__com__DataMember
829 {
830 struct __ecereNameSpace__ecere__com__DataMember * prev;
831 struct __ecereNameSpace__ecere__com__DataMember * next;
832 char *  name;
833 unsigned int isProperty;
834 int memberAccess;
835 int id;
836 struct __ecereNameSpace__ecere__com__Class * _class;
837 char *  dataTypeString;
838 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
839 struct Type * dataType;
840 int type;
841 int offset;
842 int memberID;
843 struct __ecereNameSpace__ecere__sys__OldList members;
844 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
845 int memberOffset;
846 int structAlignment;
847 };
848
849 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
850
851 struct __ecereNameSpace__ecere__com__SerialBuffer
852 {
853 unsigned char *  _buffer;
854 unsigned int count;
855 unsigned int _size;
856 unsigned int pos;
857 };
858
859 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
860
861 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
862 {
863 union
864 {
865 struct
866 {
867 char *  dataTypeString;
868 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
869 };
870 struct __ecereNameSpace__ecere__com__DataValue expression;
871 struct
872 {
873 char *  memberString;
874 union
875 {
876 struct __ecereNameSpace__ecere__com__DataMember * member;
877 struct __ecereNameSpace__ecere__com__Property * prop;
878 struct __ecereNameSpace__ecere__com__Method * method;
879 };
880 };
881 };
882 };
883
884 typedef unsigned int size_t;
885
886 void exit(int status);
887
888 void * calloc(size_t nmemb, size_t size);
889
890 void free(void * ptr);
891
892 void * malloc(size_t size);
893
894 void * realloc(void * ptr, size_t size);
895
896 long int strtol(const char * nptr, char ** endptr, int base);
897
898 long long int strtoll(const char * nptr, char ** endptr, int base);
899
900 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
901
902 enum yytokentype
903 {
904 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, EXT_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
905 };
906
907 typedef union YYSTYPE
908 {
909 int specifierType;
910 int i;
911 int declMode;
912 struct Identifier * id;
913 struct Expression * exp;
914 struct Specifier * specifier;
915 struct __ecereNameSpace__ecere__sys__OldList * list;
916 struct Enumerator * enumerator;
917 struct Declarator * declarator;
918 struct Pointer * pointer;
919 struct Initializer * initializer;
920 struct InitDeclarator * initDeclarator;
921 struct TypeName * typeName;
922 struct Declaration * declaration;
923 struct Statement * stmt;
924 struct FunctionDefinition * function;
925 struct External * external;
926 struct Context * context;
927 struct AsmField * asmField;
928 struct Instantiation * instance;
929 struct MembersInit * membersInit;
930 struct MemberInit * memberInit;
931 struct ClassFunction * classFunction;
932 struct ClassDefinition * _class;
933 struct ClassDef * classDef;
934 struct PropertyDef * prop;
935 char * string;
936 struct Symbol * symbol;
937 struct PropertyWatch * propertyWatch;
938 struct TemplateParameter * templateParameter;
939 struct TemplateArgument * templateArgument;
940 struct TemplateDatatype * templateDatatype;
941 struct DBTableEntry * dbtableEntry;
942 struct DBIndexItem * dbindexItem;
943 struct DBTableDef * dbtableDef;
944 } YYSTYPE;
945
946 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
947
948 struct Enumerator
949 {
950 struct Enumerator * prev;
951 struct Enumerator * next;
952 struct Location loc;
953 struct Identifier * id;
954 struct Expression * exp;
955 };
956
957 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
958
959 struct InitDeclarator
960 {
961 struct InitDeclarator * prev;
962 struct InitDeclarator * next;
963 struct Location loc;
964 struct Declarator * declarator;
965 struct Initializer * initializer;
966 };
967
968 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
969
970 struct AsmField
971 {
972 struct AsmField * prev;
973 struct AsmField * next;
974 struct Location loc;
975 char *  command;
976 struct Expression * expression;
977 };
978
979 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
980
981 struct ClassFunction
982 {
983 struct ClassFunction * prev;
984 struct ClassFunction * next;
985 struct Location loc;
986 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
987 struct Declarator * declarator;
988 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
989 struct Statement * body;
990 struct __ecereNameSpace__ecere__com__Class * _class;
991 struct __ecereNameSpace__ecere__sys__OldList attached;
992 int declMode;
993 struct Type * type;
994 struct Symbol * propSet;
995 unsigned int isVirtual;
996 unsigned int isConstructor;
997 unsigned int isDestructor;
998 unsigned int dontMangle;
999 int id;
1000 int idCode;
1001 };
1002
1003 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1004
1005 struct MembersInit
1006 {
1007 struct MembersInit * prev;
1008 struct MembersInit * next;
1009 struct Location loc;
1010 int type;
1011 union
1012 {
1013 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1014 struct ClassFunction * function;
1015 };
1016 };
1017
1018 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1019
1020 struct MemberInit
1021 {
1022 struct MemberInit * prev;
1023 struct MemberInit * next;
1024 struct Location loc;
1025 struct Location realLoc;
1026 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1027 struct Initializer * initializer;
1028 unsigned int used;
1029 unsigned int variable;
1030 unsigned int takeOutExp;
1031 };
1032
1033 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1034
1035 struct PropertyDef
1036 {
1037 struct PropertyDef * prev;
1038 struct PropertyDef * next;
1039 struct Location loc;
1040 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1041 struct Declarator * declarator;
1042 struct Identifier * id;
1043 struct Statement * getStmt;
1044 struct Statement * setStmt;
1045 struct Statement * issetStmt;
1046 struct Symbol * symbol;
1047 unsigned int conversion;
1048 unsigned int isWatchable;
1049 struct Expression * category;
1050 };
1051
1052 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1053
1054 struct PropertyWatch
1055 {
1056 struct PropertyWatch * prev;
1057 struct PropertyWatch * next;
1058 struct Location loc;
1059 struct Statement * compound;
1060 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1061 unsigned int deleteWatch;
1062 };
1063
1064 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1065
1066 struct ClassDef
1067 {
1068 struct ClassDef * prev;
1069 struct ClassDef * next;
1070 struct Location loc;
1071 int type;
1072 union
1073 {
1074 struct Declaration * decl;
1075 struct ClassFunction * function;
1076 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1077 struct PropertyDef * propertyDef;
1078 struct PropertyWatch * propertyWatch;
1079 char *  designer;
1080 struct Identifier * defaultProperty;
1081 struct
1082 {
1083 struct Identifier * id;
1084 struct Initializer * initializer;
1085 };
1086 };
1087 int memberAccess;
1088 void *  object;
1089 };
1090
1091 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1092
1093 struct DBTableEntry;
1094
1095 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1096
1097 struct DBIndexItem;
1098
1099 extern YYSTYPE yylval;
1100
1101 extern struct Location yylloc;
1102
1103 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1104
1105 extern int returnCode;
1106
1107 extern struct Expression * parsedExpression;
1108
1109 extern unsigned int yydebug;
1110
1111 void SetYydebug(unsigned int b)
1112 {
1113 yydebug = b;
1114 }
1115
1116 extern unsigned int echoOn;
1117
1118 void resetScanner();
1119
1120 int propWatcherID;
1121
1122 int expression_yyparse();
1123
1124 static struct Statement * curCompound;
1125
1126 struct External * curExternal, * afterExternal;
1127
1128 static struct Type * curSwitchType;
1129
1130 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1131
1132 struct __ecereNameSpace__ecere__com__Class * thisClass;
1133
1134 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1135 {
1136 thisClass = c;
1137 }
1138
1139 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1140 {
1141 return thisClass;
1142 }
1143
1144 static char * thisNameSpace;
1145
1146 struct __ecereNameSpace__ecere__com__Class * containerClass;
1147
1148 unsigned int thisClassParams = 0x1;
1149
1150 unsigned int internalValueCounter;
1151
1152 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1153
1154 struct __ecereNameSpace__ecere__sys__TempFile
1155 {
1156 char __ecere_padding[24];
1157 };
1158
1159 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1160
1161 extern int strlen(const char * );
1162
1163 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1164
1165 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1166
1167 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1168
1169 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1170
1171 void PrintExpression(struct Expression * exp, char * string)
1172 {
1173 {
1174 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1175 int count;
1176
1177 if(exp)
1178 OutputExpression(exp, f);
1179 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1180 count = strlen(string);
1181 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1182 string[count] = '\0';
1183 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1184 }
1185 }
1186
1187 extern int isspace(int c);
1188
1189 long long _strtoi64(char * string, char ** endString, int base)
1190 {
1191 long long value = 0;
1192 int sign = 1;
1193 int c;
1194 char ch;
1195
1196 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1197 ;
1198 if(ch == '+')
1199 c++;
1200 else if(ch == '-')
1201 {
1202 sign = -1;
1203 c++;
1204 }
1205 ;
1206 if(!base)
1207 {
1208 if(ch == (char)0 && string[c + 1] == 'x')
1209 {
1210 base = 16;
1211 c += 2;
1212 }
1213 else if(ch == '0')
1214 {
1215 base = 8;
1216 c++;
1217 }
1218 else
1219 base = 10;
1220 }
1221 for(; (ch = string[c]); c++)
1222 {
1223 if(ch == '0')
1224 ch = (char)0;
1225 else if(ch >= '1' && ch <= '9')
1226 ch -= '1';
1227 else if(ch >= 'a' && ch <= 'z')
1228 ch -= 'a';
1229 else if(ch >= 'A' && ch <= 'Z')
1230 ch -= 'A';
1231 else
1232 {
1233 if(endString)
1234 *endString = string + c;
1235 break;
1236 }
1237 if(ch < base)
1238 {
1239 value *= base;
1240 value += ch;
1241 }
1242 else
1243 {
1244 if(endString)
1245 *endString = string + c;
1246 break;
1247 }
1248 }
1249 return sign * value;
1250 }
1251
1252 uint64 _strtoui64(char * string, char ** endString, int base)
1253 {
1254 uint64 value = 0;
1255 int sign = 1;
1256 int c;
1257 char ch;
1258
1259 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1260 ;
1261 if(ch == '+')
1262 c++;
1263 else if(ch == '-')
1264 {
1265 sign = -1;
1266 c++;
1267 }
1268 ;
1269 if(!base)
1270 {
1271 if(ch == (char)0 && string[c + 1] == 'x')
1272 {
1273 base = 16;
1274 c += 2;
1275 }
1276 else if(ch == '0')
1277 {
1278 base = 8;
1279 c++;
1280 }
1281 else
1282 base = 10;
1283 }
1284 for(; (ch = string[c]); c++)
1285 {
1286 if(ch == '0')
1287 ch = (char)0;
1288 else if(ch >= '1' && ch <= '9')
1289 ch -= '1';
1290 else if(ch >= 'a' && ch <= 'z')
1291 ch -= 'a';
1292 else if(ch >= 'A' && ch <= 'Z')
1293 ch -= 'A';
1294 else
1295 {
1296 if(endString)
1297 *endString = string + c;
1298 break;
1299 }
1300 if(ch < base)
1301 {
1302 value *= base;
1303 value += ch;
1304 }
1305 else
1306 {
1307 if(endString)
1308 *endString = string + c;
1309 break;
1310 }
1311 }
1312 return sign * value;
1313 }
1314
1315 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1316
1317 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1318
1319 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1320 {
1321 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1322 {
1323 if(!param->baseType)
1324 {
1325 if(param->dataTypeString)
1326 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1327 else
1328 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1329 }
1330 return param->baseType;
1331 }
1332 return (((void *)0));
1333 }
1334
1335 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1336 {
1337 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1338 return 0x1;
1339 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1340 {
1341 return 0x0;
1342 }
1343 if(type1->kind == type2->kind)
1344 {
1345 switch(type1->kind)
1346 {
1347 case 1:
1348 case 2:
1349 case 3:
1350 case 4:
1351 if(type1->passAsTemplate && !type2->passAsTemplate)
1352 return 0x1;
1353 return type1->isSigned != type2->isSigned;
1354 case 8:
1355 return type1->_class != type2->_class;
1356 case 13:
1357 return NeedCast(type1->type, type2->type);
1358 default:
1359 return 0x1;
1360 }
1361 }
1362 return 0x1;
1363 }
1364
1365 extern int strcmp(const char * , const char * );
1366
1367 extern struct Context * curContext;
1368
1369 extern struct Context * topContext;
1370
1371 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1372
1373 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);
1374
1375 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1376
1377 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);
1378
1379 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);
1380
1381 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1382
1383 struct __ecereNameSpace__ecere__com__ClassProperty
1384 {
1385 char *  name;
1386 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1387 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1388 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1389 int depth;
1390 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, int);
1391 int (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1392 char *  dataTypeString;
1393 struct Type * dataType;
1394 unsigned int constant;
1395 };
1396
1397 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1398
1399 extern struct Expression * QMkExpId(char *  id);
1400
1401 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1402
1403 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1404 {
1405 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1406 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1407 char *  name;
1408 int type;
1409 union
1410 {
1411 char *  dataTypeString;
1412 int memberType;
1413 };
1414 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1415 void *  param;
1416 char __ecere_padding[4];
1417 };
1418
1419 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1420
1421 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1422
1423 extern void FreeIdentifier(struct Identifier * id);
1424
1425 void ProcessExpressionType(struct Expression * exp);
1426
1427 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1428
1429 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1430
1431 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1432
1433 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1434
1435 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1436
1437 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1438
1439 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1440
1441 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1442
1443 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1444 {
1445 if(exp->type == 0 && exp->identifier)
1446 {
1447 struct Identifier * id = exp->identifier;
1448 struct Context * ctx;
1449 struct Symbol * symbol = (((void *)0));
1450
1451 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1452 {
1453 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1454 {
1455 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1456 if(symbol)
1457 break;
1458 }
1459 }
1460 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1461 {
1462 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1463 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1464 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1465 struct __ecereNameSpace__ecere__com__ClassProperty * classProp;
1466
1467 if(!prop)
1468 {
1469 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1470 }
1471 if(!prop && !method)
1472 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1473 if(!prop && !method && !member)
1474 {
1475 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1476 }
1477 if(prop || method || member || classProp)
1478 {
1479 exp->type = 8;
1480 exp->member.member = id;
1481 exp->member.memberType = 0;
1482 exp->member.exp = QMkExpId("this");
1483 exp->addedThis = 0x1;
1484 }
1485 else if(_class && _class->templateParams.first)
1486 {
1487 struct __ecereNameSpace__ecere__com__Class * sClass;
1488
1489 for(sClass = _class; sClass; sClass = sClass->base)
1490 {
1491 if(sClass->templateParams.first)
1492 {
1493 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1494
1495 for(param = sClass->templateParams.first; param; param = param->next)
1496 {
1497 if(param->type == 2 && !strcmp(param->name, id->string))
1498 {
1499 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1500
1501 if(argExp)
1502 {
1503 struct Declarator * decl;
1504 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1505
1506 FreeIdentifier(exp->member.member);
1507 ProcessExpressionType(argExp);
1508 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1509 exp->expType = ProcessType(specs, decl);
1510 exp->type = 5;
1511 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1512 }
1513 }
1514 }
1515 }
1516 }
1517 }
1518 }
1519 }
1520 }
1521
1522 extern int sprintf(char * , char * , ...);
1523
1524 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1525
1526 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1527
1528 char * PrintInt(long long result)
1529 {
1530 char temp[100];
1531
1532 if(result > (((long long)0x7fffffffffffffffLL)))
1533 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1534 else
1535 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1536 return __ecereNameSpace__ecere__sys__CopyString(temp);
1537 }
1538
1539 char * PrintUInt(uint64 result)
1540 {
1541 char temp[100];
1542
1543 if(result > (0xffffffff))
1544 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1545 else if(result > (((int)0x7fffffff)))
1546 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1547 else
1548 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1549 return __ecereNameSpace__ecere__sys__CopyString(temp);
1550 }
1551
1552 char * PrintInt64(long long result)
1553 {
1554 char temp[100];
1555
1556 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1557 return __ecereNameSpace__ecere__sys__CopyString(temp);
1558 }
1559
1560 char * PrintUInt64(uint64 result)
1561 {
1562 char temp[100];
1563
1564 if(result > (((long long)0x7fffffffffffffffLL)))
1565 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1566 else
1567 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1568 return __ecereNameSpace__ecere__sys__CopyString(temp);
1569 }
1570
1571 char * PrintHexUInt(uint64 result)
1572 {
1573 char temp[100];
1574
1575 if(result > (0xffffffff))
1576 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1577 else
1578 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1579 return __ecereNameSpace__ecere__sys__CopyString(temp);
1580 }
1581
1582 char * PrintHexUInt64(uint64 result)
1583 {
1584 char temp[100];
1585
1586 if(result > (0xffffffff))
1587 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1588 else
1589 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1590 return __ecereNameSpace__ecere__sys__CopyString(temp);
1591 }
1592
1593 char * PrintShort(short result)
1594 {
1595 char temp[100];
1596
1597 sprintf(temp, "%d", (unsigned short)result);
1598 return __ecereNameSpace__ecere__sys__CopyString(temp);
1599 }
1600
1601 char * PrintUShort(unsigned short result)
1602 {
1603 char temp[100];
1604
1605 if(result > (unsigned short)32767)
1606 sprintf(temp, "0x%X", (int)result);
1607 else
1608 sprintf(temp, "%d", result);
1609 return __ecereNameSpace__ecere__sys__CopyString(temp);
1610 }
1611
1612 extern int isprint(int c);
1613
1614 char * PrintChar(char result)
1615 {
1616 char temp[100];
1617
1618 if(result > (char)0 && isprint(result))
1619 sprintf(temp, "'%c'", result);
1620 else if(result < (char)0)
1621 sprintf(temp, "%d", result);
1622 else
1623 sprintf(temp, "0x%X", (unsigned char)result);
1624 return __ecereNameSpace__ecere__sys__CopyString(temp);
1625 }
1626
1627 char * PrintUChar(unsigned char result)
1628 {
1629 char temp[100];
1630
1631 sprintf(temp, "0x%X", result);
1632 return __ecereNameSpace__ecere__sys__CopyString(temp);
1633 }
1634
1635 char * PrintFloat(float result)
1636 {
1637 char temp[350];
1638
1639 sprintf(temp, "%.16ff", result);
1640 return __ecereNameSpace__ecere__sys__CopyString(temp);
1641 }
1642
1643 char * PrintDouble(double result)
1644 {
1645 char temp[350];
1646
1647 sprintf(temp, "%.16f", result);
1648 return __ecereNameSpace__ecere__sys__CopyString(temp);
1649 }
1650
1651 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1652
1653 struct OpTable
1654 {
1655 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1656 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1657 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1658 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1659 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1660 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1661 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1662 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1663 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1664 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1665 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1666 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1667 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1668 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1669 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1670 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1671 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1672 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1673 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1674 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1675 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1676 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1677 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1678 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1679 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1680 unsigned int (*  Not)(struct Expression *, struct Operand *);
1681 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1682 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1683 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1684 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1685 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1686 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1687 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1688 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1689 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1690 };
1691
1692 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1693
1694 struct Operand
1695 {
1696 int kind;
1697 struct Type * type;
1698 unsigned int ptrSize;
1699 union
1700 {
1701 char c;
1702 unsigned char uc;
1703 short s;
1704 unsigned short us;
1705 int i;
1706 unsigned int ui;
1707 float f;
1708 double d;
1709 unsigned char *  p;
1710 long long i64;
1711 uint64 ui64;
1712 };
1713 struct OpTable ops;
1714 };
1715
1716 struct Operand GetOperand(struct Expression * exp);
1717
1718 unsigned int GetInt(struct Expression * exp, int * value2)
1719 {
1720 struct Operand op2 = GetOperand(exp);
1721
1722 if(op2.kind == 3 && op2.type->isSigned)
1723 *value2 = op2.i;
1724 else if(op2.kind == 3)
1725 *value2 = (int)op2.ui;
1726 if(op2.kind == 4 && op2.type->isSigned)
1727 *value2 = (int)op2.i64;
1728 else if(op2.kind == 4)
1729 *value2 = (int)op2.ui64;
1730 else if(op2.kind == 2 && op2.type->isSigned)
1731 *value2 = (int)op2.s;
1732 else if(op2.kind == 2)
1733 *value2 = (int)op2.us;
1734 else if(op2.kind == 1 && op2.type->isSigned)
1735 *value2 = (int)op2.c;
1736 else if(op2.kind == 1)
1737 *value2 = (int)op2.uc;
1738 else if(op2.kind == 6)
1739 *value2 = (int)op2.f;
1740 else if(op2.kind == 7)
1741 *value2 = (int)op2.d;
1742 else if(op2.kind == 13)
1743 *value2 = (int)op2.ui;
1744 else
1745 return 0x0;
1746 return 0x1;
1747 }
1748
1749 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1750 {
1751 struct Operand op2 = GetOperand(exp);
1752
1753 if(op2.kind == 3 && op2.type->isSigned)
1754 *value2 = (unsigned int)op2.i;
1755 else if(op2.kind == 3)
1756 *value2 = op2.ui;
1757 if(op2.kind == 4 && op2.type->isSigned)
1758 *value2 = (unsigned int)op2.i64;
1759 else if(op2.kind == 4)
1760 *value2 = (unsigned int)op2.ui64;
1761 else if(op2.kind == 2 && op2.type->isSigned)
1762 *value2 = (unsigned int)op2.s;
1763 else if(op2.kind == 2)
1764 *value2 = (unsigned int)op2.us;
1765 else if(op2.kind == 1 && op2.type->isSigned)
1766 *value2 = (unsigned int)op2.c;
1767 else if(op2.kind == 1)
1768 *value2 = (unsigned int)op2.uc;
1769 else if(op2.kind == 6)
1770 *value2 = (unsigned int)op2.f;
1771 else if(op2.kind == 7)
1772 *value2 = (unsigned int)op2.d;
1773 else if(op2.kind == 13)
1774 *value2 = op2.ui;
1775 else
1776 return 0x0;
1777 return 0x1;
1778 }
1779
1780 unsigned int GetInt64(struct Expression * exp, long long * value2)
1781 {
1782 struct Operand op2 = GetOperand(exp);
1783
1784 if(op2.kind == 3 && op2.type->isSigned)
1785 *value2 = (long long)op2.i;
1786 else if(op2.kind == 3)
1787 *value2 = (long long)op2.ui;
1788 if(op2.kind == 4 && op2.type->isSigned)
1789 *value2 = op2.i64;
1790 else if(op2.kind == 4)
1791 *value2 = (long long)op2.ui64;
1792 else if(op2.kind == 2 && op2.type->isSigned)
1793 *value2 = (long long)op2.s;
1794 else if(op2.kind == 2)
1795 *value2 = (long long)op2.us;
1796 else if(op2.kind == 1 && op2.type->isSigned)
1797 *value2 = (long long)op2.c;
1798 else if(op2.kind == 1)
1799 *value2 = (long long)op2.uc;
1800 else if(op2.kind == 6)
1801 *value2 = (long long)op2.f;
1802 else if(op2.kind == 7)
1803 *value2 = (long long)op2.d;
1804 else if(op2.kind == 13)
1805 *value2 = (long long)op2.ui;
1806 else
1807 return 0x0;
1808 return 0x1;
1809 }
1810
1811 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1812 {
1813 struct Operand op2 = GetOperand(exp);
1814
1815 if(op2.kind == 3 && op2.type->isSigned)
1816 *value2 = (uint64)op2.i;
1817 else if(op2.kind == 3)
1818 *value2 = (uint64)op2.ui;
1819 if(op2.kind == 4 && op2.type->isSigned)
1820 *value2 = (uint64)op2.i64;
1821 else if(op2.kind == 4)
1822 *value2 = op2.ui64;
1823 else if(op2.kind == 2 && op2.type->isSigned)
1824 *value2 = (uint64)op2.s;
1825 else if(op2.kind == 2)
1826 *value2 = (uint64)op2.us;
1827 else if(op2.kind == 1 && op2.type->isSigned)
1828 *value2 = (uint64)op2.c;
1829 else if(op2.kind == 1)
1830 *value2 = (uint64)op2.uc;
1831 else if(op2.kind == 6)
1832 *value2 = (uint64)op2.f;
1833 else if(op2.kind == 7)
1834 *value2 = (uint64)op2.d;
1835 else if(op2.kind == 13)
1836 *value2 = (uint64)op2.ui;
1837 else
1838 return 0x0;
1839 return 0x1;
1840 }
1841
1842 unsigned int GetShort(struct Expression * exp, short * value2)
1843 {
1844 struct Operand op2 = GetOperand(exp);
1845
1846 if(op2.kind == 3 && op2.type->isSigned)
1847 *value2 = (short)op2.i;
1848 else if(op2.kind == 3)
1849 *value2 = (short)op2.ui;
1850 if(op2.kind == 4 && op2.type->isSigned)
1851 *value2 = (short)op2.i64;
1852 else if(op2.kind == 4)
1853 *value2 = (short)op2.ui64;
1854 else if(op2.kind == 2 && op2.type->isSigned)
1855 *value2 = op2.s;
1856 else if(op2.kind == 2)
1857 *value2 = (short)op2.us;
1858 else if(op2.kind == 1 && op2.type->isSigned)
1859 *value2 = (short)op2.c;
1860 else if(op2.kind == 1)
1861 *value2 = (short)op2.uc;
1862 else if(op2.kind == 6)
1863 *value2 = (short)op2.f;
1864 else if(op2.kind == 7)
1865 *value2 = (short)op2.d;
1866 else if(op2.kind == 13)
1867 *value2 = (short)op2.ui;
1868 else
1869 return 0x0;
1870 return 0x1;
1871 }
1872
1873 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1874 {
1875 struct Operand op2 = GetOperand(exp);
1876
1877 if(op2.kind == 3 && op2.type->isSigned)
1878 *value2 = (unsigned short)op2.i;
1879 else if(op2.kind == 3)
1880 *value2 = (unsigned short)op2.ui;
1881 if(op2.kind == 4 && op2.type->isSigned)
1882 *value2 = (unsigned short)op2.i64;
1883 else if(op2.kind == 4)
1884 *value2 = (unsigned short)op2.ui64;
1885 else if(op2.kind == 2 && op2.type->isSigned)
1886 *value2 = (unsigned short)op2.s;
1887 else if(op2.kind == 2)
1888 *value2 = op2.us;
1889 else if(op2.kind == 1 && op2.type->isSigned)
1890 *value2 = (unsigned short)op2.c;
1891 else if(op2.kind == 1)
1892 *value2 = (unsigned short)op2.uc;
1893 else if(op2.kind == 6)
1894 *value2 = (unsigned short)op2.f;
1895 else if(op2.kind == 7)
1896 *value2 = (unsigned short)op2.d;
1897 else if(op2.kind == 13)
1898 *value2 = (unsigned short)op2.ui;
1899 else
1900 return 0x0;
1901 return 0x1;
1902 }
1903
1904 unsigned int GetChar(struct Expression * exp, char * value2)
1905 {
1906 struct Operand op2 = GetOperand(exp);
1907
1908 if(op2.kind == 3 && op2.type->isSigned)
1909 *value2 = (char)op2.i;
1910 else if(op2.kind == 3)
1911 *value2 = (char)op2.ui;
1912 if(op2.kind == 4 && op2.type->isSigned)
1913 *value2 = (char)op2.i64;
1914 else if(op2.kind == 4)
1915 *value2 = (char)op2.ui64;
1916 else if(op2.kind == 2 && op2.type->isSigned)
1917 *value2 = (char)op2.s;
1918 else if(op2.kind == 2)
1919 *value2 = (char)op2.us;
1920 else if(op2.kind == 1 && op2.type->isSigned)
1921 *value2 = op2.c;
1922 else if(op2.kind == 1)
1923 *value2 = (char)op2.uc;
1924 else if(op2.kind == 6)
1925 *value2 = (char)op2.f;
1926 else if(op2.kind == 7)
1927 *value2 = (char)op2.d;
1928 else if(op2.kind == 13)
1929 *value2 = (char)op2.ui;
1930 else
1931 return 0x0;
1932 return 0x1;
1933 }
1934
1935 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
1936 {
1937 struct Operand op2 = GetOperand(exp);
1938
1939 if(op2.kind == 3 && op2.type->isSigned)
1940 *value2 = (unsigned char)op2.i;
1941 else if(op2.kind == 3)
1942 *value2 = (unsigned char)op2.ui;
1943 if(op2.kind == 4 && op2.type->isSigned)
1944 *value2 = (unsigned char)op2.i64;
1945 else if(op2.kind == 4)
1946 *value2 = (unsigned char)op2.ui64;
1947 else if(op2.kind == 2 && op2.type->isSigned)
1948 *value2 = (unsigned char)op2.s;
1949 else if(op2.kind == 2)
1950 *value2 = (unsigned char)op2.us;
1951 else if(op2.kind == 1 && op2.type->isSigned)
1952 *value2 = (unsigned char)op2.c;
1953 else if(op2.kind == 1)
1954 *value2 = op2.uc;
1955 else if(op2.kind == 6)
1956 *value2 = (unsigned char)op2.f;
1957 else if(op2.kind == 7)
1958 *value2 = (unsigned char)op2.d;
1959 else if(op2.kind == 13)
1960 *value2 = (unsigned char)op2.ui;
1961 else
1962 return 0x0;
1963 return 0x1;
1964 }
1965
1966 unsigned int GetFloat(struct Expression * exp, float * value2)
1967 {
1968 struct Operand op2 = GetOperand(exp);
1969
1970 if(op2.kind == 3 && op2.type->isSigned)
1971 *value2 = (float)(float)op2.i;
1972 else if(op2.kind == 3)
1973 *value2 = (float)(float)op2.ui;
1974 if(op2.kind == 4 && op2.type->isSigned)
1975 *value2 = (float)(float)op2.i64;
1976 else if(op2.kind == 4)
1977 *value2 = (float)(float)op2.ui64;
1978 else if(op2.kind == 2 && op2.type->isSigned)
1979 *value2 = (float)(float)op2.s;
1980 else if(op2.kind == 2)
1981 *value2 = (float)(float)op2.us;
1982 else if(op2.kind == 1 && op2.type->isSigned)
1983 *value2 = (float)(float)op2.c;
1984 else if(op2.kind == 1)
1985 *value2 = (float)(float)op2.uc;
1986 else if(op2.kind == 6)
1987 *value2 = (float)op2.f;
1988 else if(op2.kind == 7)
1989 *value2 = (float)op2.d;
1990 else if(op2.kind == 13)
1991 *value2 = (float)(float)op2.ui;
1992 else
1993 return 0x0;
1994 return 0x1;
1995 }
1996
1997 unsigned int GetDouble(struct Expression * exp, double * value2)
1998 {
1999 struct Operand op2 = GetOperand(exp);
2000
2001 if(op2.kind == 3 && op2.type->isSigned)
2002 *value2 = (double)(double)op2.i;
2003 else if(op2.kind == 3)
2004 *value2 = (double)(double)op2.ui;
2005 if(op2.kind == 4 && op2.type->isSigned)
2006 *value2 = (double)(double)op2.i64;
2007 else if(op2.kind == 4)
2008 *value2 = (double)(double)op2.ui64;
2009 else if(op2.kind == 2 && op2.type->isSigned)
2010 *value2 = (double)(double)op2.s;
2011 else if(op2.kind == 2)
2012 *value2 = (double)(double)op2.us;
2013 else if(op2.kind == 1 && op2.type->isSigned)
2014 *value2 = (double)(double)op2.c;
2015 else if(op2.kind == 1)
2016 *value2 = (double)(double)op2.uc;
2017 else if(op2.kind == 6)
2018 *value2 = (double)op2.f;
2019 else if(op2.kind == 7)
2020 *value2 = (double)op2.d;
2021 else if(op2.kind == 13)
2022 *value2 = (double)(double)op2.ui;
2023 else
2024 return 0x0;
2025 return 0x1;
2026 }
2027
2028 void ComputeExpression(struct Expression * exp);
2029
2030 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2031
2032 int ComputeTypeSize(struct Type * type);
2033
2034 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2035
2036 struct __ecereNameSpace__ecere__com__BitMember
2037 {
2038 struct __ecereNameSpace__ecere__com__BitMember * prev;
2039 struct __ecereNameSpace__ecere__com__BitMember * next;
2040 char *  name;
2041 unsigned int isProperty;
2042 int memberAccess;
2043 int id;
2044 struct __ecereNameSpace__ecere__com__Class * _class;
2045 char *  dataTypeString;
2046 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2047 struct Type * dataType;
2048 int type;
2049 int size;
2050 int pos;
2051 uint64 mask;
2052 };
2053
2054 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2055
2056 struct __ecereNameSpace__ecere__sys__OldLink
2057 {
2058 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2059 struct __ecereNameSpace__ecere__sys__OldLink * next;
2060 void *  data;
2061 };
2062
2063 void FinishTemplatesContext(struct Context * context);
2064
2065 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2066 {
2067 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2068 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2069
2070 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || _class->structSize == _class->offset) && _class->computeSize))
2071 {
2072 int c;
2073 int unionMemberOffset = 0;
2074 int bitFields = 0;
2075
2076 if(!member && _class->destructionWatchOffset)
2077 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2078 {
2079 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2080
2081 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2082 {
2083 if(!dataMember->isProperty)
2084 {
2085 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2086 {
2087 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2088 }
2089 }
2090 }
2091 }
2092 {
2093 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2094
2095 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2096 {
2097 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2098 {
2099 if(!isMember && _class->type == 2 && dataMember->dataType)
2100 {
2101 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2102 uint64 mask = 0;
2103 int d;
2104
2105 ComputeTypeSize(dataMember->dataType);
2106 if(bitMember->pos == -1)
2107 bitMember->pos = _class->memberOffset;
2108 if(!bitMember->size)
2109 bitMember->size = dataMember->dataType->size * 8;
2110 _class->memberOffset = bitMember->pos + bitMember->size;
2111 for(d = 0; d < bitMember->size; d++)
2112 {
2113 if(d)
2114 mask <<= 1;
2115 mask |= 1;
2116 }
2117 bitMember->mask = mask << bitMember->pos;
2118 }
2119 else if(dataMember->type == 0 && dataMember->dataType)
2120 {
2121 int size;
2122 int alignment = 0;
2123
2124 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2125 ComputeTypeSize(dataMember->dataType);
2126 if(dataMember->dataType->bitFieldCount)
2127 {
2128 bitFields += dataMember->dataType->bitFieldCount;
2129 size = 0;
2130 }
2131 else
2132 {
2133 if(bitFields)
2134 {
2135 int size = (bitFields + 7) / 8;
2136
2137 if(isMember)
2138 {
2139 int __simpleStruct0;
2140
2141 if(alignment)
2142 {
2143 int __simpleStruct0;
2144
2145 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2146 if(member->memberOffset % alignment)
2147 member->memberOffset += alignment - (member->memberOffset % alignment);
2148 }
2149 dataMember->offset = member->memberOffset;
2150 if(member->type == 1)
2151 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2152 else
2153 {
2154 member->memberOffset += size;
2155 }
2156 }
2157 else
2158 {
2159 if(alignment)
2160 {
2161 int __simpleStruct0;
2162
2163 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2164 if(_class->memberOffset % alignment)
2165 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2166 }
2167 dataMember->offset = _class->memberOffset;
2168 _class->memberOffset += size;
2169 }
2170 bitFields = 0;
2171 }
2172 size = dataMember->dataType->size;
2173 alignment = dataMember->dataType->alignment;
2174 }
2175 if(isMember)
2176 {
2177 int __simpleStruct0;
2178
2179 if(alignment)
2180 {
2181 int __simpleStruct0;
2182
2183 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2184 if(member->memberOffset % alignment)
2185 member->memberOffset += alignment - (member->memberOffset % alignment);
2186 }
2187 dataMember->offset = member->memberOffset;
2188 if(member->type == 1)
2189 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2190 else
2191 {
2192 member->memberOffset += size;
2193 }
2194 }
2195 else
2196 {
2197 if(alignment)
2198 {
2199 int __simpleStruct0;
2200
2201 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2202 if(_class->memberOffset % alignment)
2203 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2204 }
2205 dataMember->offset = _class->memberOffset;
2206 _class->memberOffset += size;
2207 }
2208 }
2209 else
2210 {
2211 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2212 if(isMember)
2213 {
2214 int __simpleStruct2;
2215 int __simpleStruct0, __simpleStruct1;
2216
2217 member->structAlignment = (__simpleStruct0 = member->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2218 dataMember->offset = member->memberOffset;
2219 if(member->type == 1)
2220 unionMemberOffset = (__simpleStruct2 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct2) ? unionMemberOffset : __simpleStruct2);
2221 else
2222 member->memberOffset += dataMember->memberOffset;
2223 }
2224 else
2225 {
2226 int __simpleStruct0, __simpleStruct1;
2227
2228 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2229 dataMember->offset = _class->memberOffset;
2230 _class->memberOffset += dataMember->memberOffset;
2231 }
2232 }
2233 }
2234 }
2235 if(bitFields)
2236 {
2237 int alignment = 0;
2238 int size = (bitFields + 7) / 8;
2239
2240 if(isMember)
2241 {
2242 int __simpleStruct0;
2243
2244 if(alignment)
2245 {
2246 int __simpleStruct0;
2247
2248 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2249 if(member->memberOffset % alignment)
2250 member->memberOffset += alignment - (member->memberOffset % alignment);
2251 }
2252 if(member->type == 1)
2253 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2254 else
2255 {
2256 member->memberOffset += size;
2257 }
2258 }
2259 else
2260 {
2261 if(alignment)
2262 {
2263 int __simpleStruct0;
2264
2265 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2266 if(_class->memberOffset % alignment)
2267 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2268 }
2269 _class->memberOffset += size;
2270 }
2271 bitFields = 0;
2272 }
2273 }
2274 if(member && member->type == 1)
2275 {
2276 member->memberOffset = unionMemberOffset;
2277 }
2278 if(!isMember)
2279 {
2280 if(_class->type != 2)
2281 {
2282 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset;
2283 if(!member)
2284 {
2285 struct __ecereNameSpace__ecere__com__Property * prop;
2286
2287 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2288 {
2289 if(prop->isProperty && prop->isWatchable)
2290 {
2291 prop->watcherOffset = _class->structSize;
2292 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2293 }
2294 }
2295 }
2296 {
2297 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2298
2299 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2300 {
2301 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2302
2303 if(deriv->computeSize)
2304 {
2305 deriv->offset = _class->structSize;
2306 deriv->memberOffset = 0;
2307 deriv->structSize = deriv->offset;
2308 ComputeClassMembers(deriv, 0x0);
2309 }
2310 }
2311 }
2312 }
2313 }
2314 }
2315 if(context)
2316 FinishTemplatesContext(context);
2317 }
2318
2319 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2320
2321 struct __ecereNameSpace__ecere__com__NameSpace
2322 {
2323 char *  name;
2324 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2325 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2326 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2327 int depth;
2328 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2329 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2330 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2331 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2332 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2333 };
2334
2335 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2336
2337 struct __ecereNameSpace__ecere__com__Module
2338 {
2339 struct __ecereNameSpace__ecere__com__Instance * application;
2340 struct __ecereNameSpace__ecere__sys__OldList classes;
2341 struct __ecereNameSpace__ecere__sys__OldList defines;
2342 struct __ecereNameSpace__ecere__sys__OldList functions;
2343 struct __ecereNameSpace__ecere__sys__OldList modules;
2344 struct __ecereNameSpace__ecere__com__Instance * prev;
2345 struct __ecereNameSpace__ecere__com__Instance * next;
2346 char *  name;
2347 void *  library;
2348 void *  Unload;
2349 int importType;
2350 int origImportType;
2351 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2352 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2353 };
2354
2355 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2356 {
2357 struct __ecereNameSpace__ecere__com__Class * _class;
2358 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2359
2360 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
2361 ComputeModuleClasses(subModule->data);
2362 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->classes.first; _class; _class = _class->next)
2363 ComputeClassMembers(_class, 0x0);
2364 }
2365
2366 extern unsigned int inCompiler;
2367
2368 extern void Compiler_Error(char *  format, ...);
2369
2370 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2371
2372 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2373
2374 extern int __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
2375
2376 int ComputeTypeSize(struct Type * type)
2377 {
2378 unsigned int size = type ? type->size : 0;
2379
2380 if(!size && type && !type->computing)
2381 {
2382 type->computing = 0x1;
2383 switch(type->kind)
2384 {
2385 case 1:
2386 type->alignment = size = sizeof(char);
2387 break;
2388 case 3:
2389 type->alignment = size = sizeof(int);
2390 break;
2391 case 4:
2392 type->alignment = size = sizeof(long long);
2393 break;
2394 case 5:
2395 type->alignment = size = sizeof(long);
2396 break;
2397 case 2:
2398 type->alignment = size = sizeof(short);
2399 break;
2400 case 6:
2401 type->alignment = size = sizeof(float);
2402 break;
2403 case 7:
2404 type->alignment = size = sizeof(double);
2405 break;
2406 case 8:
2407 {
2408 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2409
2410 if(_class && _class->type == 1)
2411 {
2412 ComputeClassMembers(_class, 0x0);
2413 type->alignment = _class->structAlignment;
2414 size = _class->structSize;
2415 if(type->alignment && size % type->alignment)
2416 size += type->alignment - (size % type->alignment);
2417 }
2418 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2419 {
2420 if(!_class->dataType)
2421 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2422 size = type->alignment = ComputeTypeSize(_class->dataType);
2423 }
2424 else
2425 size = type->alignment = sizeof(struct __ecereNameSpace__ecere__com__Instance **);
2426 break;
2427 }
2428 case 13:
2429 case 19:
2430 size = type->alignment = sizeof(void *);
2431 break;
2432 case 12:
2433 if(type->arraySizeExp)
2434 {
2435 ProcessExpressionType(type->arraySizeExp);
2436 ComputeExpression(type->arraySizeExp);
2437 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2438 {
2439 struct Location oldLoc = yylloc;
2440 char expression[10240];
2441
2442 expression[0] = '\0';
2443 type->arraySizeExp->expType = (((void *)0));
2444 yylloc = type->arraySizeExp->loc;
2445 if(inCompiler)
2446 PrintExpression(type->arraySizeExp, expression);
2447 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2448 yylloc = oldLoc;
2449 }
2450 GetInt(type->arraySizeExp, &type->arraySize);
2451 }
2452 else if(type->enumClass)
2453 {
2454 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2455 {
2456 type->arraySize = __ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2457 }
2458 else
2459 type->arraySize = 0;
2460 }
2461 else
2462 {
2463 type->arraySize = 0;
2464 }
2465 size = ComputeTypeSize(type->type) * type->arraySize;
2466 type->alignment = type->type->alignment;
2467 break;
2468 case 9:
2469 {
2470 struct Type * member;
2471
2472 for(member = type->members.first; member; member = member->next)
2473 {
2474 int __simpleStruct0, __simpleStruct1;
2475 unsigned int addSize = ComputeTypeSize(member);
2476
2477 member->offset = size;
2478 if(member->alignment && size % member->alignment)
2479 member->offset += member->alignment - (size % member->alignment);
2480 size = member->offset;
2481 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2482 size += addSize;
2483 }
2484 if(type->alignment && size % type->alignment)
2485 size += type->alignment - (size % type->alignment);
2486 break;
2487 }
2488 case 10:
2489 {
2490 struct Type * member;
2491
2492 for(member = type->members.first; member; member = member->next)
2493 {
2494 int __simpleStruct0, __simpleStruct1;
2495 unsigned int addSize = ComputeTypeSize(member);
2496
2497 member->offset = size;
2498 if(member->alignment && size % member->alignment)
2499 member->offset += member->alignment - (size % member->alignment);
2500 size = member->offset;
2501 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2502 size = ((size > addSize) ? size : addSize);
2503 }
2504 if(type->alignment && size % type->alignment)
2505 size += type->alignment - (size % type->alignment);
2506 break;
2507 }
2508 case 20:
2509 {
2510 struct TemplateParameter * param = type->templateParameter;
2511 struct Type * baseType = ProcessTemplateParameterType(param);
2512
2513 if(baseType)
2514 size = ComputeTypeSize(baseType);
2515 else
2516 size = sizeof(uint64);
2517 break;
2518 }
2519 case 15:
2520 {
2521 size = sizeof(enum
2522 {
2523 test
2524 });
2525 break;
2526 }
2527 case 21:
2528 {
2529 size = sizeof(void *);
2530 break;
2531 }
2532 }
2533 type->size = size;
2534 type->computing = 0x0;
2535 }
2536 return size;
2537 }
2538
2539 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2540
2541 extern struct Identifier * MkIdentifier(char *  string);
2542
2543 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2544
2545 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2546
2547 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2548
2549 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2550
2551 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2552
2553 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2554
2555 extern void FreeType(struct Type * type);
2556
2557 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2558
2559 extern struct Specifier * MkSpecifier(int specifier);
2560
2561 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2562
2563 extern struct Expression * MkExpConstant(char *  string);
2564
2565 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)
2566 {
2567 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2568 unsigned int totalSize = 0;
2569 unsigned int maxSize = 0;
2570 int alignment, size;
2571 struct __ecereNameSpace__ecere__com__DataMember * member;
2572 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2573
2574 if(!isMember && _class->base)
2575 {
2576 maxSize = _class->structSize;
2577 {
2578 if(_class->type == 1 || _class->type == 5)
2579 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass);
2580 else
2581 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2582 }
2583 }
2584 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2585 {
2586 if(!member->isProperty)
2587 {
2588 switch(member->type)
2589 {
2590 case 0:
2591 {
2592 if(member->dataTypeString)
2593 {
2594 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2595 struct Declarator * decl;
2596
2597 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2598 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2599 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2600 if(!member->dataType)
2601 member->dataType = ProcessType(specs, decl);
2602 ReplaceThisClassSpecifiers(specs, topClass);
2603 {
2604 struct Type * type = ProcessType(specs, decl);
2605
2606 DeclareType(member->dataType, 0x0, 0x0);
2607 FreeType(type);
2608 }
2609 ComputeTypeSize(member->dataType);
2610 size = member->dataType->size;
2611 alignment = member->dataType->alignment;
2612 if(alignment)
2613 {
2614 if(totalSize % alignment)
2615 totalSize += alignment - (totalSize % alignment);
2616 }
2617 totalSize += size;
2618 }
2619 break;
2620 }
2621 case 1:
2622 case 2:
2623 {
2624 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2625
2626 size = 0;
2627 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass);
2628 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2629 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2630 alignment = member->structAlignment;
2631 if(alignment)
2632 {
2633 if(totalSize % alignment)
2634 totalSize += alignment - (totalSize % alignment);
2635 }
2636 totalSize += size;
2637 break;
2638 }
2639 }
2640 }
2641 }
2642 if(retSize)
2643 {
2644 unsigned int __simpleStruct0;
2645
2646 if(topMember && topMember->type == 1)
2647 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2648 else
2649 *retSize += totalSize;
2650 }
2651 else if(totalSize < maxSize && _class->type != 1000)
2652 {
2653 char sizeString[50];
2654
2655 sprintf(sizeString, "%d", maxSize - totalSize);
2656 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2657 }
2658 if(context)
2659 FinishTemplatesContext(context);
2660 return topMember ? topMember->memberID : _class->memberID;
2661 }
2662
2663 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2664 {
2665 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2666 unsigned int totalSize = 0;
2667 struct __ecereNameSpace__ecere__com__DataMember * member;
2668 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2669
2670 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2671 DeclareMembers(_class->base, 0x0);
2672 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2673 {
2674 if(!member->isProperty)
2675 {
2676 switch(member->type)
2677 {
2678 case 0:
2679 {
2680 if(!member->dataType && member->dataTypeString)
2681 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2682 if(member->dataType)
2683 DeclareType(member->dataType, 0x0, 0x0);
2684 break;
2685 }
2686 case 1:
2687 case 2:
2688 {
2689 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2690 break;
2691 }
2692 }
2693 }
2694 }
2695 if(context)
2696 FinishTemplatesContext(context);
2697 return topMember ? topMember->memberID : _class->memberID;
2698 }
2699
2700 extern struct Symbol * FindClass(char *  name);
2701
2702 extern char *  strchr(char * , int);
2703
2704 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2705
2706 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2707
2708 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2709
2710 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2711
2712 extern char *  strcpy(char * , const char * );
2713
2714 extern void MangleClassName(char *  className);
2715
2716 extern void DeclareClass(struct Symbol * classSym, char *  className);
2717
2718 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2719
2720 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2721
2722 void DeclareStruct(char * name, unsigned int skipNoHead)
2723 {
2724 struct External * external = (((void *)0));
2725 struct Symbol * classSym = FindClass(name);
2726
2727 if(!inCompiler || !classSym)
2728 return (((void *)0));
2729 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2730 return (((void *)0));
2731 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2732 {
2733 struct Declaration * decl;
2734 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2735 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2736 char structName[1024];
2737
2738 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2739 classSym->declaring++;
2740 if(strchr(classSym->string, '<'))
2741 {
2742 if(classSym->registered->templateClass)
2743 {
2744 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2745 classSym->declaring--;
2746 }
2747 return (((void *)0));
2748 }
2749 DeclareMembers(classSym->registered, 0x0);
2750 structName[0] = (char)0;
2751 FullClassNameCat(structName, name, 0x0);
2752 if(!skipNoHead)
2753 {
2754 classSym->declaredStructSym = 0x1;
2755 declarations = MkList();
2756 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered);
2757 if(!(*declarations).count)
2758 {
2759 FreeList(declarations, (((void *)0)));
2760 declarations = (((void *)0));
2761 }
2762 }
2763 if(skipNoHead || declarations)
2764 {
2765 if(external && external->declaration)
2766 {
2767 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2768 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2769 {
2770 if(classSym->structExternal)
2771 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2772 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2773 classSym->id = curExternal->symbol->idCode;
2774 classSym->idCode = curExternal->symbol->idCode;
2775 }
2776 }
2777 else
2778 {
2779 if(!external)
2780 external = MkExternalDeclaration((((void *)0)));
2781 specifiers = MkList();
2782 declarators = MkList();
2783 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2784 external->declaration = decl = MkDeclaration(specifiers, declarators);
2785 if(decl->symbol && !decl->symbol->pointerExternal)
2786 decl->symbol->pointerExternal = external;
2787 if(classSym->registered && classSym->registered->type == 1)
2788 {
2789 char className[1024];
2790
2791 strcpy(className, "__ecereClass_");
2792 FullClassNameCat(className, classSym->string, 0x1);
2793 MangleClassName(className);
2794 DeclareClass(classSym, className);
2795 external->symbol = classSym;
2796 classSym->pointerExternal = external;
2797 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2798 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2799 }
2800 else
2801 {
2802 char className[1024];
2803
2804 strcpy(className, "__ecereClass_");
2805 FullClassNameCat(className, classSym->string, 0x1);
2806 MangleClassName(className);
2807 classSym->structExternal = external;
2808 DeclareClass(classSym, className);
2809 external->symbol = classSym;
2810 }
2811 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2812 }
2813 }
2814 classSym->declaring--;
2815 }
2816 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2817 {
2818 classSym->declaring++;
2819 {
2820 if(classSym->registered)
2821 DeclareMembers(classSym->registered, 0x0);
2822 }
2823 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
2824 {
2825 if(classSym->structExternal)
2826 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2827 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2828 classSym->id = curExternal->symbol->idCode;
2829 classSym->idCode = curExternal->symbol->idCode;
2830 }
2831 classSym->declaring--;
2832 }
2833 }
2834
2835 extern char *  strcat(char * , const char * );
2836
2837 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
2838
2839 extern struct ModuleImport * mainModule;
2840
2841 extern struct Specifier * MkSpecifierName(char *  name);
2842
2843 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
2844
2845 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
2846
2847 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
2848
2849 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
2850
2851 extern void FreeDeclarator(struct Declarator * decl);
2852
2853 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
2854
2855 struct PropertyImport
2856 {
2857 struct PropertyImport * prev;
2858 struct PropertyImport * next;
2859 char *  name;
2860 unsigned int isVirtual;
2861 unsigned int hasSet;
2862 unsigned int hasGet;
2863 };
2864
2865 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
2866
2867 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
2868 {
2869 void * __ecereTemp1;
2870 struct Symbol * symbol = prop->symbol;
2871 char propName[1024];
2872
2873 strcpy(setName, "__ecereProp_");
2874 FullClassNameCat(setName, prop->_class->fullName, 0x0);
2875 strcat(setName, "_Set_");
2876 FullClassNameCat(setName, prop->name, 0x1);
2877 strcpy(getName, "__ecereProp_");
2878 FullClassNameCat(getName, prop->_class->fullName, 0x0);
2879 strcat(getName, "_Get_");
2880 FullClassNameCat(getName, prop->name, 0x1);
2881 strcpy(propName, "__ecereProp_");
2882 FullClassNameCat(propName, prop->_class->fullName, 0x0);
2883 strcat(propName, "_");
2884 FullClassNameCat(propName, prop->name, 0x1);
2885 MangleClassName(getName);
2886 MangleClassName(setName);
2887 MangleClassName(propName);
2888 if(prop->_class->type == 1)
2889 DeclareStruct(prop->_class->fullName, 0x0);
2890 if(!symbol || curExternal->symbol->idCode < symbol->id)
2891 {
2892 unsigned int imported = 0x0;
2893 unsigned int dllImport = 0x0;
2894
2895 if(!symbol || symbol->_import)
2896 {
2897 if(!symbol)
2898 {
2899 struct Symbol * classSym;
2900
2901 if(!prop->_class->symbol)
2902 prop->_class->symbol = FindClass(prop->_class->fullName);
2903 classSym = prop->_class->symbol;
2904 if(classSym && !classSym->_import)
2905 {
2906 struct ModuleImport * module;
2907
2908 if(prop->_class->module)
2909 module = FindModule(prop->_class->module);
2910 else
2911 module = mainModule;
2912 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = prop->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
2913 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
2914 }
2915 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2916 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), ((struct PropertyImport *)__ecereTemp1)->isVirtual = 0x0, ((struct PropertyImport *)__ecereTemp1)->hasSet = prop->Set ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1)->hasGet = prop->Get ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1));
2917 if(classSym)
2918 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
2919 }
2920 imported = 0x1;
2921 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 12)))->importType != 1)
2922 dllImport = 0x1;
2923 }
2924 if(!symbol->type)
2925 {
2926 struct Context * context = SetupTemplatesContext(prop->_class);
2927
2928 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
2929 FinishTemplatesContext(context);
2930 }
2931 if(prop->Get)
2932 {
2933 if(!symbol->externalGet || symbol->externalGet->type == 0)
2934 {
2935 struct Declaration * decl;
2936 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2937 struct Declarator * d;
2938 struct __ecereNameSpace__ecere__sys__OldList * params;
2939 struct Specifier * spec;
2940 struct External * external;
2941 struct Declarator * typeDecl;
2942 unsigned int simple = 0x0;
2943
2944 specifiers = MkList();
2945 declarators = MkList();
2946 params = MkList();
2947 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
2948 d = MkDeclaratorIdentifier(MkIdentifier(getName));
2949 if(dllImport)
2950 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
2951 {
2952 struct Context * context = SetupTemplatesContext(prop->_class);
2953
2954 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
2955 FinishTemplatesContext(context);
2956 }
2957 for(spec = (*specifiers).first; spec; spec = spec->next)
2958 {
2959 if(spec->type == 1)
2960 {
2961 if((!typeDecl || typeDecl->type == 1))
2962 {
2963 struct Symbol * classSym = spec->symbol;
2964
2965 symbol->_class = classSym->registered;
2966 if(classSym->registered && classSym->registered->type == 1)
2967 {
2968 DeclareStruct(spec->name, 0x0);
2969 simple = 0x1;
2970 }
2971 }
2972 }
2973 }
2974 if(!simple)
2975 d = PlugDeclarator(typeDecl, d);
2976 else
2977 {
2978 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
2979 specifiers = MkList();
2980 }
2981 d = MkDeclaratorFunction(d, params);
2982 if(dllImport)
2983 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
2984 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
2985 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
2986 if(simple)
2987 ListAdd(specifiers, MkSpecifier(VOID));
2988 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
2989 decl = MkDeclaration(specifiers, declarators);
2990 external = MkExternalDeclaration(decl);
2991 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
2992 external->symbol = symbol;
2993 symbol->externalGet = external;
2994 ReplaceThisClassSpecifiers(specifiers, prop->_class);
2995 if(typeDecl)
2996 FreeDeclarator(typeDecl);
2997 }
2998 else
2999 {
3000 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3001 }
3002 }
3003 if(prop->Set)
3004 {
3005 if(!symbol->externalSet || symbol->externalSet->type == 0)
3006 {
3007 struct Declaration * decl;
3008 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3009 struct Declarator * d;
3010 struct __ecereNameSpace__ecere__sys__OldList * params;
3011 struct Specifier * spec;
3012 struct External * external;
3013 struct Declarator * typeDecl;
3014
3015 declarators = MkList();
3016 params = MkList();
3017 if(!prop->conversion || prop->_class->type == 1)
3018 {
3019 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3020 }
3021 specifiers = MkList();
3022 {
3023 struct Context * context = SetupTemplatesContext(prop->_class);
3024
3025 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3026 FinishTemplatesContext(context);
3027 }
3028 ListAdd(params, MkTypeName(specifiers, d));
3029 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3030 if(dllImport)
3031 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3032 d = MkDeclaratorFunction(d, params);
3033 for(spec = (*specifiers).first; spec; spec = spec->next)
3034 {
3035 if(spec->type == 1)
3036 {
3037 if((!typeDecl || typeDecl->type == 1))
3038 {
3039 struct Symbol * classSym = spec->symbol;
3040
3041 symbol->_class = classSym->registered;
3042 if(classSym->registered && classSym->registered->type == 1)
3043 DeclareStruct(spec->name, 0x0);
3044 }
3045 }
3046 }
3047 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3048 specifiers = MkList();
3049 if(dllImport)
3050 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3051 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3052 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3053 if(!prop->conversion || prop->_class->type == 1)
3054 ListAdd(specifiers, MkSpecifier(VOID));
3055 else
3056 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3057 decl = MkDeclaration(specifiers, declarators);
3058 external = MkExternalDeclaration(decl);
3059 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3060 external->symbol = symbol;
3061 symbol->externalSet = external;
3062 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3063 }
3064 else
3065 {
3066 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3067 }
3068 }
3069 if(!symbol->externalPtr)
3070 {
3071 struct Declaration * decl;
3072 struct External * external;
3073 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3074
3075 if(imported)
3076 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3077 else
3078 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3079 ListAdd(specifiers, MkSpecifierName("Property"));
3080 {
3081 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3082
3083 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3084 if(!imported)
3085 {
3086 strcpy(propName, "__ecerePropM_");
3087 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3088 strcat(propName, "_");
3089 FullClassNameCat(propName, prop->name, 0x1);
3090 MangleClassName(propName);
3091 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3092 }
3093 decl = MkDeclaration(specifiers, list);
3094 }
3095 external = MkExternalDeclaration(decl);
3096 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3097 external->symbol = symbol;
3098 symbol->externalPtr = external;
3099 }
3100 else
3101 {
3102 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3103 }
3104 symbol->id = curExternal->symbol->idCode;
3105 }
3106 }
3107
3108 struct Type * Dereference(struct Type * source)
3109 {
3110 void * __ecereTemp1;
3111 struct Type * type = (((void *)0));
3112
3113 if(source)
3114 {
3115 if(source->kind == 13 || source->kind == 12)
3116 {
3117 type = source->type;
3118 source->type->refCount++;
3119 }
3120 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3121 {
3122 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3123 }
3124 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3125 {
3126 type = source;
3127 source->refCount++;
3128 }
3129 else
3130 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3131 }
3132 return type;
3133 }
3134
3135 static struct Type * Reference(struct Type * source)
3136 {
3137 void * __ecereTemp1;
3138 struct Type * type = (((void *)0));
3139
3140 if(source)
3141 {
3142 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = source, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3143 source->refCount++;
3144 }
3145 return type;
3146 }
3147
3148 extern void __ecereNameSpace__ecere__com__eClass_FindNextMember(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class **  curClass, struct __ecereNameSpace__ecere__com__DataMember **  curMember, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
3149
3150 extern void *  memcpy(void * , const void * , unsigned int size);
3151
3152 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3153
3154 extern void FreeExpression(struct Expression * exp);
3155
3156 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3157
3158 unsigned int MatchTypes(struct Type * source, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, struct __ecereNameSpace__ecere__com__Class * owningClassSource, struct __ecereNameSpace__ecere__com__Class * owningClassDest, unsigned int doConversion, unsigned int enumBaseType, unsigned int acceptReversedParams, unsigned int isConversionExploration);
3159
3160 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3161
3162 extern struct Type * MkClassType(char *  name);
3163
3164 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);
3165
3166 void ProcessMemberInitData(struct MemberInit * member, struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class ** curClass, struct __ecereNameSpace__ecere__com__DataMember ** curMember, struct __ecereNameSpace__ecere__com__DataMember ** subMemberStack, int * subMemberStackPos)
3167 {
3168 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3169 unsigned int found = 0x0;
3170 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3171 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3172 unsigned int freeType = 0x0;
3173
3174 yylloc = member->loc;
3175 if(!ident)
3176 {
3177 if(curMember)
3178 {
3179 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3180 if(*curMember)
3181 {
3182 found = 0x1;
3183 dataMember = *curMember;
3184 }
3185 }
3186 }
3187 else
3188 {
3189 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3190 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3191 int _subMemberStackPos = 0;
3192
3193 if(!thisMember)
3194 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3195 if(thisMember)
3196 {
3197 dataMember = thisMember;
3198 if(curMember && thisMember->memberAccess == 1)
3199 {
3200 *curMember = thisMember;
3201 *curClass = thisMember->_class;
3202 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3203 *subMemberStackPos = _subMemberStackPos;
3204 }
3205 found = 0x1;
3206 }
3207 else
3208 {
3209 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3210 if(method && method->type == 1)
3211 found = 0x1;
3212 else
3213 method = (((void *)0));
3214 }
3215 }
3216 if(found)
3217 {
3218 struct Type * type = (((void *)0));
3219
3220 if(dataMember)
3221 {
3222 if(!dataMember->dataType && dataMember->dataTypeString)
3223 {
3224 struct Context * context = SetupTemplatesContext(_class);
3225
3226 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3227 FinishTemplatesContext(context);
3228 }
3229 type = dataMember->dataType;
3230 }
3231 else if(method)
3232 {
3233 if(!method->dataType)
3234 ProcessMethodType(method);
3235 type = method->dataType;
3236 }
3237 if(ident && ident->next)
3238 {
3239 for(ident = ident->next; ident && type; ident = ident->next)
3240 {
3241 if(type->kind == 8)
3242 {
3243 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3244 if(!dataMember)
3245 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3246 if(dataMember)
3247 type = dataMember->dataType;
3248 }
3249 else if(type->kind == 9 || type->kind == 10)
3250 {
3251 struct Type * memberType;
3252
3253 for(memberType = type->members.first; memberType; memberType = memberType->next)
3254 {
3255 if(!strcmp(memberType->name, ident->string))
3256 {
3257 type = memberType;
3258 break;
3259 }
3260 }
3261 }
3262 }
3263 }
3264 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3265 {
3266 int id = 0;
3267 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3268 struct __ecereNameSpace__ecere__com__Class * sClass;
3269
3270 for(sClass = _class; sClass; sClass = sClass->base)
3271 {
3272 id = 0;
3273 if(sClass->templateClass)
3274 sClass = sClass->templateClass;
3275 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3276 {
3277 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3278 {
3279 for(sClass = sClass->base; sClass; sClass = sClass->base)
3280 {
3281 if(sClass->templateClass)
3282 sClass = sClass->templateClass;
3283 id += sClass->templateParams.count;
3284 }
3285 break;
3286 }
3287 id++;
3288 }
3289 if(curParam)
3290 break;
3291 }
3292 if(curParam)
3293 {
3294 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3295
3296 if(arg.dataTypeString)
3297 {
3298 type = ProcessTypeString(arg.dataTypeString, 0x0);
3299 freeType = 0x1;
3300 if(type && _class->templateClass)
3301 type->passAsTemplate = 0x1;
3302 if(type)
3303 {
3304 }
3305 }
3306 }
3307 }
3308 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3309 {
3310 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3311 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3312 int c;
3313 int paramCount = 0;
3314 int lastParam = -1;
3315 char templateString[1024];
3316 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3317
3318 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3319 for(cClass = expClass; cClass; cClass = cClass->base)
3320 {
3321 int p = 0;
3322
3323 if(cClass->templateClass)
3324 cClass = cClass->templateClass;
3325 for(param = cClass->templateParams.first; param; param = param->next)
3326 {
3327 int id = p;
3328 struct __ecereNameSpace__ecere__com__Class * sClass;
3329 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3330
3331 for(sClass = cClass->base; sClass; sClass = sClass->base)
3332 {
3333 if(sClass->templateClass)
3334 sClass = sClass->templateClass;
3335 id += sClass->templateParams.count;
3336 }
3337 arg = expClass->templateArgs[id];
3338 for(sClass = _class; sClass; sClass = sClass->base)
3339 {
3340 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3341 int p = 0;
3342 struct __ecereNameSpace__ecere__com__Class * nextClass;
3343
3344 if(sClass->templateClass)
3345 sClass = sClass->templateClass;
3346 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3347 {
3348 if(nextClass->templateClass)
3349 nextClass = nextClass->templateClass;
3350 p += nextClass->templateParams.count;
3351 }
3352 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3353 {
3354 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3355 {
3356 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3357 {
3358 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3359 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3360 break;
3361 }
3362 }
3363 }
3364 }
3365 {
3366 char argument[256];
3367
3368 argument[0] = '\0';
3369 switch(param->type)
3370 {
3371 case 2:
3372 {
3373 char expString[1024];
3374 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3375 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3376 struct Expression * exp;
3377 char * string = PrintHexUInt64(arg.expression.ui64);
3378
3379 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3380 ProcessExpressionType(exp);
3381 ComputeExpression(exp);
3382 expString[0] = '\0';
3383 PrintExpression(exp, expString);
3384 strcat(argument, expString);
3385 FreeExpression(exp);
3386 break;
3387 }
3388 case 1:
3389 {
3390 strcat(argument, arg.member->name);
3391 break;
3392 }
3393 case 0:
3394 {
3395 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3396 strcat(argument, arg.dataTypeString);
3397 break;
3398 }
3399 }
3400 if(argument[0])
3401 {
3402 if(paramCount)
3403 strcat(templateString, ", ");
3404 if(lastParam != p - 1)
3405 {
3406 strcat(templateString, param->name);
3407 strcat(templateString, " = ");
3408 }
3409 strcat(templateString, argument);
3410 paramCount++;
3411 lastParam = p;
3412 }
3413 p++;
3414 }
3415 }
3416 }
3417 {
3418 int len = strlen(templateString);
3419
3420 if(templateString[len - 1] == '<')
3421 len--;
3422 else
3423 {
3424 if(templateString[len - 1] == '>')
3425 templateString[len++] = ' ';
3426 templateString[len++] = '>';
3427 }
3428 templateString[len++] = '\0';
3429 }
3430 {
3431 struct Context * context = SetupTemplatesContext(_class);
3432
3433 if(freeType)
3434 FreeType(type);
3435 type = ProcessTypeString(templateString, 0x0);
3436 freeType = 0x1;
3437 FinishTemplatesContext(context);
3438 }
3439 }
3440 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3441 {
3442 ProcessExpressionType(member->initializer->exp);
3443 if(!member->initializer->exp->expType)
3444 {
3445 if(inCompiler)
3446 {
3447 char expString[10240];
3448
3449 expString[0] = '\0';
3450 PrintExpression(member->initializer->exp, expString);
3451 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3452 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3453 }
3454 }
3455 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3456 {
3457 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3458 }
3459 }
3460 else if(member->initializer)
3461 {
3462 ProcessInitializer(member->initializer, type);
3463 }
3464 if(freeType)
3465 FreeType(type);
3466 }
3467 else
3468 {
3469 if(_class && _class->type == 3)
3470 {
3471 if(member->initializer)
3472 {
3473 struct Type * type = MkClassType(_class->fullName);
3474
3475 ProcessInitializer(member->initializer, type);
3476 FreeType(type);
3477 }
3478 }
3479 else
3480 {
3481 if(member->initializer)
3482 {
3483 ProcessInitializer(member->initializer, (((void *)0)));
3484 }
3485 if(ident)
3486 {
3487 if(method)
3488 {
3489 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3490 }
3491 else if(_class)
3492 {
3493 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3494 if(inCompiler)
3495 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3496 }
3497 }
3498 else if(_class)
3499 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3500 }
3501 }
3502 }
3503
3504 extern struct Identifier * GetDeclId(struct Declarator * decl);
3505
3506 extern struct External * ProcessClassFunction(struct __ecereNameSpace__ecere__com__Class * owningClass, struct ClassFunction * func, struct __ecereNameSpace__ecere__sys__OldList * defs, struct External * after, unsigned int makeStatic);
3507
3508 extern void FreeSpecifier(struct Specifier * spec);
3509
3510 static void ProcessFunction(struct FunctionDefinition * function);
3511
3512 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3513
3514 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3515
3516 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3517
3518 extern void FreeClassFunction(struct ClassFunction * func);
3519
3520 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3521
3522 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3523
3524 void ProcessInstantiationType(struct Instantiation * inst)
3525 {
3526 yylloc = inst->loc;
3527 if(inst->_class)
3528 {
3529 struct MembersInit * members;
3530 struct Symbol * classSym;
3531 struct __ecereNameSpace__ecere__com__Class * _class;
3532
3533 classSym = inst->_class->symbol;
3534 _class = classSym ? classSym->registered : (((void *)0));
3535 if(!_class || _class->type != 5)
3536 DeclareStruct(inst->_class->name, 0x0);
3537 afterExternal = afterExternal ? afterExternal : curExternal;
3538 if(inst->exp)
3539 ProcessExpressionType(inst->exp);
3540 inst->isConstant = 0x1;
3541 if(inst->members)
3542 {
3543 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3544 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3545 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3546 int subMemberStackPos = 0;
3547
3548 for(members = (*inst->members).first; members; members = members->next)
3549 {
3550 switch(members->type)
3551 {
3552 case 1:
3553 {
3554 char name[1024];
3555 static unsigned int instMethodID = 0;
3556 struct External * external = curExternal;
3557 struct Context * context = curContext;
3558 struct Declarator * declarator = members->function->declarator;
3559 struct Identifier * nameID = GetDeclId(declarator);
3560 char * unmangled = nameID ? nameID->string : (((void *)0));
3561 struct Expression * exp;
3562 struct External * createdExternal = (((void *)0));
3563
3564 if(inCompiler)
3565 {
3566 char number[16];
3567
3568 strcpy(name, "__ecereInstMeth_");
3569 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3570 strcat(name, "_");
3571 strcat(name, nameID->string);
3572 strcat(name, "_");
3573 sprintf(number, "_%08d", instMethodID++);
3574 strcat(name, number);
3575 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3576 }
3577 if(declarator)
3578 {
3579 struct Symbol * symbol = declarator->symbol;
3580 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3581
3582 if(method && method->type == 1)
3583 {
3584 symbol->method = method;
3585 ProcessMethodType(method);
3586 if(!symbol->type->thisClass)
3587 {
3588 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3589 {
3590 if(!currentClass->symbol)
3591 currentClass->symbol = FindClass(currentClass->fullName);
3592 symbol->type->thisClass = currentClass->symbol;
3593 }
3594 else
3595 {
3596 if(!_class->symbol)
3597 _class->symbol = FindClass(_class->fullName);
3598 symbol->type->thisClass = _class->symbol;
3599 }
3600 }
3601 DeclareType(symbol->type, 0x1, 0x1);
3602 }
3603 else if(classSym)
3604 {
3605 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3606 }
3607 }
3608 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3609 if(nameID)
3610 {
3611 FreeSpecifier(nameID->_class);
3612 nameID->_class = (((void *)0));
3613 }
3614 if(inCompiler)
3615 {
3616 struct Type * type = declarator->symbol->type;
3617 struct External * oldExternal = curExternal;
3618
3619 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3620 {
3621 struct External * externalDecl;
3622
3623 externalDecl = MkExternalDeclaration((((void *)0)));
3624 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3625 if(createdExternal->function)
3626 {
3627 ProcessFunction(createdExternal->function);
3628 {
3629 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3630
3631 externalDecl->declaration = decl;
3632 if(decl->symbol && !decl->symbol->pointerExternal)
3633 decl->symbol->pointerExternal = externalDecl;
3634 declarator->symbol->pointerExternal = externalDecl;
3635 }
3636 }
3637 }
3638 }
3639 else if(declarator)
3640 {
3641 curExternal = declarator->symbol->pointerExternal;
3642 ProcessFunction((struct FunctionDefinition *)members->function);
3643 }
3644 curExternal = external;
3645 curContext = context;
3646 if(inCompiler)
3647 {
3648 FreeClassFunction(members->function);
3649 exp = QMkExpId(name);
3650 members->type = 0;
3651 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3652 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3653 }
3654 break;
3655 }
3656 case 0:
3657 {
3658 if(members->dataMembers && classSym)
3659 {
3660 struct MemberInit * member;
3661 struct Location oldyyloc = yylloc;
3662
3663 for(member = (*members->dataMembers).first; member; member = member->next)
3664 {
3665 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3666 if(member->initializer && !member->initializer->isConstant)
3667 inst->isConstant = 0x0;
3668 }
3669 yylloc = oldyyloc;
3670 }
3671 break;
3672 }
3673 }
3674 }
3675 }
3676 }
3677 }
3678
3679 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3680 {
3681 if(inCompiler)
3682 {
3683 if(type->kind == 11)
3684 {
3685 struct Type * param;
3686
3687 if(declareParams)
3688 {
3689 for(param = type->params.first; param; param = param->next)
3690 DeclareType(param, declarePointers, 0x1);
3691 }
3692 DeclareType(type->returnType, declarePointers, 0x1);
3693 }
3694 else if(type->kind == 13 && declarePointers)
3695 DeclareType(type->type, declarePointers, 0x0);
3696 else if(type->kind == 8)
3697 {
3698 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3699 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3700 }
3701 else if(type->kind == 9 || type->kind == 10)
3702 {
3703 struct Type * member;
3704
3705 for(member = type->members.first; member; member = member->next)
3706 DeclareType(member, 0x0, 0x0);
3707 }
3708 else if(type->kind == 12)
3709 DeclareType(type->arrayType, declarePointers, 0x0);
3710 }
3711 }
3712
3713 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3714
3715 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3716 {
3717 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3718 int id = 0;
3719 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3720 struct __ecereNameSpace__ecere__com__Class * sClass;
3721
3722 for(sClass = _class; sClass; sClass = sClass->base)
3723 {
3724 id = 0;
3725 if(sClass->templateClass)
3726 sClass = sClass->templateClass;
3727 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3728 {
3729 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3730 {
3731 for(sClass = sClass->base; sClass; sClass = sClass->base)
3732 {
3733 if(sClass->templateClass)
3734 sClass = sClass->templateClass;
3735 id += sClass->templateParams.count;
3736 }
3737 break;
3738 }
3739 id++;
3740 }
3741 if(curParam)
3742 break;
3743 }
3744 if(curParam)
3745 {
3746 arg = &_class->templateArgs[id];
3747 if(arg && param->type == 0)
3748 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3749 }
3750 return arg;
3751 }
3752
3753 extern struct Context * PushContext(void);
3754
3755 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3756
3757 struct TemplatedType
3758 {
3759 unsigned int key;
3760 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3761 struct __ecereNameSpace__ecere__sys__BTNode * left;
3762 struct __ecereNameSpace__ecere__sys__BTNode * right;
3763 int depth;
3764 struct TemplateParameter * param;
3765 };
3766
3767 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3768
3769 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3770 {
3771 void * __ecereTemp1;
3772 struct Context * context = PushContext();
3773
3774 context->templateTypesOnly = 0x1;
3775 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3776 {
3777 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3778
3779 for(; param; param = param->next)
3780 {
3781 if(param->type == 0 && param->identifier)
3782 {
3783 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (unsigned int)param->identifier->string, type->param = param, type);
3784
3785 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3786 }
3787 }
3788 }
3789 else if(_class)
3790 {
3791 struct __ecereNameSpace__ecere__com__Class * sClass;
3792
3793 for(sClass = _class; sClass; sClass = sClass->base)
3794 {
3795 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
3796
3797 for(p = sClass->templateParams.first; p; p = p->next)
3798 {
3799 if(p->type == 0)
3800 {
3801 struct TemplateParameter * param = p->param;
3802 struct TemplatedType * type;
3803
3804 if(!param)
3805 {
3806 p->param = param = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter), ((struct TemplateParameter *)__ecereTemp1)->identifier = MkIdentifier(p->name), ((struct TemplateParameter *)__ecereTemp1)->type = p->type, ((struct TemplateParameter *)__ecereTemp1)->dataTypeString = p->dataTypeString, ((struct TemplateParameter *)__ecereTemp1));
3807 }
3808 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), ((struct TemplatedType *)__ecereTemp1)->key = (unsigned int)p->name, ((struct TemplatedType *)__ecereTemp1)->param = param, ((struct TemplatedType *)__ecereTemp1));
3809 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3810 }
3811 }
3812 }
3813 }
3814 return context;
3815 }
3816
3817 extern void PopContext(struct Context * ctx);
3818
3819 extern void FreeContext(struct Context * context);
3820
3821 void FinishTemplatesContext(struct Context * context)
3822 {
3823 PopContext(context);
3824 FreeContext(context);
3825 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
3826 }
3827
3828 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
3829 {
3830 if(!method->dataType)
3831 {
3832 struct Context * context = SetupTemplatesContext(method->_class);
3833
3834 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3835 FinishTemplatesContext(context);
3836 if(method->type != 1 && method->dataType)
3837 {
3838 if(!method->dataType->thisClass && !method->dataType->staticMethod)
3839 {
3840 if(!method->_class->symbol)
3841 method->_class->symbol = FindClass(method->_class->fullName);
3842 method->dataType->thisClass = method->_class->symbol;
3843 }
3844 }
3845 }
3846 }
3847
3848 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
3849 {
3850 if(!prop->dataType)
3851 {
3852 struct Context * context = SetupTemplatesContext(prop->_class);
3853
3854 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
3855 FinishTemplatesContext(context);
3856 }
3857 }
3858
3859 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
3860
3861 extern void FreeTypeName(struct TypeName * typeName);
3862
3863 static void ProcessDeclarator(struct Declarator * decl);
3864
3865 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
3866
3867 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
3868
3869 struct MethodImport
3870 {
3871 struct MethodImport * prev;
3872 struct MethodImport * next;
3873 char *  name;
3874 unsigned int isVirtual;
3875 };
3876
3877 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3878
3879 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
3880 {
3881 void * __ecereTemp1;
3882 struct Symbol * symbol = method->symbol;
3883
3884 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
3885 {
3886 unsigned int imported = 0x0;
3887 unsigned int dllImport = 0x0;
3888
3889 if(!method->dataType)
3890 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3891 if(!symbol || symbol->_import || method->type == 1)
3892 {
3893 if(!symbol || method->type == 1)
3894 {
3895 struct Symbol * classSym;
3896
3897 if(!method->_class->symbol)
3898 method->_class->symbol = FindClass(method->_class->fullName);
3899 classSym = method->_class->symbol;
3900 if(!classSym->_import)
3901 {
3902 struct ModuleImport * module;
3903
3904 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->name)
3905 module = FindModule(method->_class->module);
3906 else
3907 module = mainModule;
3908 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = method->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
3909 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3910 }
3911 if(!symbol)
3912 {
3913 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3914 }
3915 if(!symbol->_import)
3916 {
3917 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->name), ((struct MethodImport *)__ecereTemp1)->isVirtual = method->type == 1, ((struct MethodImport *)__ecereTemp1));
3918 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
3919 }
3920 if(!symbol)
3921 {
3922 symbol->type = method->dataType;
3923 if(symbol->type)
3924 symbol->type->refCount++;
3925 }
3926 }
3927 if(!method->dataType->dllExport)
3928 {
3929 imported = 0x1;
3930 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->importType != 1)
3931 dllImport = 0x1;
3932 }
3933 }
3934 if(method->type != 1 && method->dataType)
3935 DeclareType(method->dataType, 0x1, 0x1);
3936 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
3937 {
3938 struct Declaration * decl;
3939 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3940 struct Declarator * d;
3941 struct Declarator * funcDecl;
3942 struct External * external;
3943
3944 specifiers = MkList();
3945 declarators = MkList();
3946 if(dllImport)
3947 ListAdd(specifiers, MkSpecifier(EXTERN));
3948 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
3949 ListAdd(specifiers, MkSpecifier(STATIC));
3950 if(method->type == 1)
3951 {
3952 ListAdd(specifiers, MkSpecifier(INT));
3953 d = MkDeclaratorIdentifier(MkIdentifier(name));
3954 }
3955 else
3956 {
3957 d = MkDeclaratorIdentifier(MkIdentifier(name));
3958 if(dllImport)
3959 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3960 {
3961 struct Context * context = SetupTemplatesContext(method->_class);
3962
3963 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
3964 FinishTemplatesContext(context);
3965 }
3966 funcDecl = GetFuncDecl(d);
3967 if(dllImport)
3968 {
3969 struct Specifier * spec, * next;
3970
3971 for(spec = (*specifiers).first; spec; spec = next)
3972 {
3973 next = spec->next;
3974 if(spec->type == 5)
3975 {
3976 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
3977 FreeSpecifier(spec);
3978 }
3979 }
3980 }
3981 if(method->dataType && !method->dataType->staticMethod)
3982 {
3983 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
3984 {
3985 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
3986 struct TypeName * thisParam = MkTypeName(MkListOne(MkSpecifierName(method->dataType->thisClass ? method->dataType->thisClass->string : method->_class->fullName)), (_class && _class->type == 1000) ? MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("this"))) : MkDeclaratorIdentifier(MkIdentifier("this")));
3987 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
3988 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
3989
3990 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
3991 {
3992 struct TypeName * param = (*funcDecl->function.parameters).first;
3993
3994 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
3995 FreeTypeName(param);
3996 }
3997 if(!funcDecl->function.parameters)
3998 funcDecl->function.parameters = MkList();
3999 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4000 }
4001 }
4002 }
4003 ProcessDeclarator(d);
4004 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4005 decl = MkDeclaration(specifiers, declarators);
4006 ReplaceThisClassSpecifiers(specifiers, method->_class);
4007 if(symbol->pointerExternal)
4008 {
4009 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4010
4011 {
4012 *functionSymbol = *symbol;
4013 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4014 if(functionSymbol->type)
4015 functionSymbol->type->refCount++;
4016 }
4017 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4018 symbol->pointerExternal->symbol = functionSymbol;
4019 }
4020 external = MkExternalDeclaration(decl);
4021 if(curExternal)
4022 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4023 external->symbol = symbol;
4024 symbol->pointerExternal = external;
4025 }
4026 else if(ast)
4027 {
4028 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4029 }
4030 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4031 }
4032 }
4033
4034 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4035 {
4036 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4037 {
4038 unsigned int first = 0x1;
4039 int p = 0;
4040 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4041 int lastParam = -1;
4042 char className[1024];
4043
4044 strcpy(className, _class->fullName);
4045 for(param = _class->templateParams.first; param; param = param->next)
4046 {
4047 {
4048 if(first)
4049 strcat(className, "<");
4050 if(!first)
4051 strcat(className, ", ");
4052 if(lastParam + 1 != p)
4053 {
4054 strcat(className, param->name);
4055 strcat(className, " = ");
4056 }
4057 strcat(className, param->name);
4058 first = 0x0;
4059 lastParam = p;
4060 }
4061 p++;
4062 }
4063 if(!first)
4064 {
4065 int len = strlen(className);
4066
4067 if(className[len - 1] == '>')
4068 className[len++] = ' ';
4069 className[len++] = '>';
4070 className[len++] = '\0';
4071 }
4072 return __ecereNameSpace__ecere__sys__CopyString(className);
4073 }
4074 else
4075 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4076 }
4077
4078 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4079 {
4080 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4081 {
4082 unsigned int first = 0x1;
4083 int p = 0;
4084 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4085 int lastParam = -1;
4086 char className[1024];
4087
4088 strcpy(className, _class->fullName);
4089 for(param = _class->templateParams.first; param; param = param->next)
4090 {
4091 {
4092 if(first)
4093 strcat(className, "<");
4094 if(!first)
4095 strcat(className, ", ");
4096 if(lastParam + 1 != p)
4097 {
4098 strcat(className, param->name);
4099 strcat(className, " = ");
4100 }
4101 strcat(className, param->name);
4102 first = 0x0;
4103 lastParam = p;
4104 }
4105 p++;
4106 }
4107 if(!first)
4108 {
4109 int len = strlen(className);
4110
4111 if(className[len - 1] == '>')
4112 className[len++] = ' ';
4113 className[len++] = '>';
4114 className[len++] = '\0';
4115 }
4116 return MkClassType(className);
4117 }
4118 else
4119 {
4120 return MkClassType(_class->fullName);
4121 }
4122 }
4123
4124 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4125 {
4126 if(specs != (((void *)0)) && _class)
4127 {
4128 struct Specifier * spec;
4129
4130 for(spec = specs->first; spec; spec = spec->next)
4131 {
4132 if(spec->type == 0 && spec->specifier == THISCLASS)
4133 {
4134 spec->type = 1;
4135 spec->name = ReplaceThisClass(_class);
4136 spec->symbol = FindClass(spec->name);
4137 }
4138 }
4139 }
4140 }
4141
4142 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4143
4144 struct __ecereNameSpace__ecere__com__GlobalFunction
4145 {
4146 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4147 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4148 char *  name;
4149 int (*  function)();
4150 struct __ecereNameSpace__ecere__com__Instance * module;
4151 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4152 char *  dataTypeString;
4153 struct Type * dataType;
4154 void *  symbol;
4155 };
4156
4157 extern struct Context * globalContext;
4158
4159 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4160
4161 struct FunctionImport
4162 {
4163 struct FunctionImport * prev;
4164 struct FunctionImport * next;
4165 char *  name;
4166 };
4167
4168 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4169 {
4170 void * __ecereTemp1;
4171 struct Symbol * symbol = function->symbol;
4172
4173 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4174 {
4175 unsigned int imported = 0x0;
4176 unsigned int dllImport = 0x0;
4177
4178 if(!function->dataType)
4179 {
4180 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4181 if(!function->dataType->thisClass)
4182 function->dataType->staticMethod = 0x1;
4183 }
4184 if(inCompiler)
4185 {
4186 if(!symbol)
4187 {
4188 struct ModuleImport * module = FindModule(function->module);
4189
4190 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4191 if(module->name)
4192 {
4193 if(!function->dataType->dllExport)
4194 {
4195 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(function->name), ((struct FunctionImport *)__ecereTemp1));
4196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4197 }
4198 }
4199 {
4200 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4201 if(!symbol->type->thisClass)
4202 symbol->type->staticMethod = 0x1;
4203 }
4204 }
4205 imported = symbol->_import ? 0x1 : 0x0;
4206 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1)
4207 dllImport = 0x1;
4208 }
4209 DeclareType(function->dataType, 0x1, 0x1);
4210 if(inCompiler)
4211 {
4212 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4213 {
4214 struct Declaration * decl;
4215 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4216 struct Declarator * d;
4217 struct Declarator * funcDecl;
4218 struct External * external;
4219
4220 specifiers = MkList();
4221 declarators = MkList();
4222 ListAdd(specifiers, MkSpecifier(EXTERN));
4223 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4224 if(dllImport)
4225 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4226 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4227 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType == 1)
4228 {
4229 struct Specifier * spec;
4230
4231 for(spec = (*specifiers).first; spec; spec = spec->next)
4232 if(spec->type == 5 && !strcmp(spec->name, "dllexport"))
4233 {
4234 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4235 FreeSpecifier(spec);
4236 break;
4237 }
4238 }
4239 funcDecl = GetFuncDecl(d);
4240 if(funcDecl && !funcDecl->function.parameters)
4241 {
4242 funcDecl->function.parameters = MkList();
4243 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4244 }
4245 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4246 {
4247 struct Context * oldCtx = curContext;
4248
4249 curContext = globalContext;
4250 decl = MkDeclaration(specifiers, declarators);
4251 curContext = oldCtx;
4252 }
4253 if(symbol->pointerExternal)
4254 {
4255 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4256
4257 {
4258 *functionSymbol = *symbol;
4259 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4260 if(functionSymbol->type)
4261 functionSymbol->type->refCount++;
4262 }
4263 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4264 symbol->pointerExternal->symbol = functionSymbol;
4265 }
4266 external = MkExternalDeclaration(decl);
4267 if(curExternal)
4268 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4269 external->symbol = symbol;
4270 symbol->pointerExternal = external;
4271 }
4272 else
4273 {
4274 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4275 }
4276 if(curExternal)
4277 symbol->id = curExternal->symbol->idCode;
4278 }
4279 }
4280 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1) ? 0x1 : 0x0;
4281 }
4282
4283 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4284
4285 struct GlobalData
4286 {
4287 unsigned int key;
4288 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4289 struct __ecereNameSpace__ecere__sys__BTNode * left;
4290 struct __ecereNameSpace__ecere__sys__BTNode * right;
4291 int depth;
4292 struct __ecereNameSpace__ecere__com__Instance * module;
4293 char *  dataTypeString;
4294 struct Type * dataType;
4295 void *  symbol;
4296 char *  fullName;
4297 };
4298
4299 void DeclareGlobalData(struct GlobalData * data)
4300 {
4301 struct Symbol * symbol = data->symbol;
4302
4303 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4304 {
4305 if(inCompiler)
4306 {
4307 if(!symbol)
4308 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4309 }
4310 if(!data->dataType)
4311 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4312 DeclareType(data->dataType, 0x1, 0x1);
4313 if(inCompiler)
4314 {
4315 if(!symbol->pointerExternal)
4316 {
4317 struct Declaration * decl;
4318 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4319 struct Declarator * d;
4320 struct External * external;
4321
4322 specifiers = MkList();
4323 declarators = MkList();
4324 ListAdd(specifiers, MkSpecifier(EXTERN));
4325 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4326 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4327 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4328 decl = MkDeclaration(specifiers, declarators);
4329 external = MkExternalDeclaration(decl);
4330 if(curExternal)
4331 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4332 external->symbol = symbol;
4333 symbol->pointerExternal = external;
4334 }
4335 else
4336 {
4337 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4338 }
4339 if(curExternal)
4340 symbol->id = curExternal->symbol->idCode;
4341 }
4342 }
4343 }
4344
4345 struct Conversion
4346 {
4347 struct Conversion * prev, * next;
4348 struct __ecereNameSpace__ecere__com__Property * convert;
4349 unsigned int isGet;
4350 struct Type * resultType;
4351 };
4352
4353 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4354
4355 extern void Compiler_Warning(char *  format, ...);
4356
4357 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4358
4359 unsigned int MatchTypes(struct Type * source, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, struct __ecereNameSpace__ecere__com__Class * owningClassSource, struct __ecereNameSpace__ecere__com__Class * owningClassDest, unsigned int doConversion, unsigned int enumBaseType, unsigned int acceptReversedParams, unsigned int isConversionExploration)
4360 {
4361 if(source && dest)
4362 {
4363 if(source->kind == 20 && dest->kind != 20)
4364 {
4365 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4366
4367 if(type)
4368 source = type;
4369 }
4370 if(dest->kind == 20 && source->kind != 20)
4371 {
4372 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4373
4374 if(type)
4375 dest = type;
4376 }
4377 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4378 {
4379 return 0x1;
4380 }
4381 if(source->classObjectType == 3 && dest->classObjectType != 2)
4382 {
4383 return 0x1;
4384 }
4385 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4386 {
4387 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4388 return 0x1;
4389 }
4390 if(dest->kind == 14 && source->kind != 0)
4391 return 0x1;
4392 if(dest->kind == 13 && dest->type->kind == 0 && ((source->kind == 8 && (!source->_class || !source->_class->registered || source->_class->registered->type == 1 || source->_class->registered->type == 0 || source->_class->registered->type == 5 || source->_class->registered->type == 1000)) || source->kind == 19 || source->kind == 13 || source->kind == 12 || source->kind == 11 || source->kind == 21))
4393 return 0x1;
4394 if(!isConversionExploration && source->kind == 13 && source->type->kind == 0 && ((dest->kind == 8 && (!dest->_class || !dest->_class->registered || dest->_class->registered->type == 1 || dest->_class->registered->type == 0 || dest->_class->registered->type == 5 || dest->_class->registered->type == 1000)) || dest->kind == 19 || dest->kind == 13 || dest->kind == 12 || dest->kind == 11 || dest->kind == 21))
4395 return 0x1;
4396 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4397 {
4398 if(source->_class->registered && source->_class->registered->type == 3)
4399 {
4400 if(conversions != (((void *)0)))
4401 {
4402 if(source->_class->registered == dest->_class->registered)
4403 return 0x1;
4404 }
4405 else
4406 {
4407 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4408
4409 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4410 ;
4411 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4412 ;
4413 if(sourceBase == destBase)
4414 return 0x1;
4415 }
4416 }
4417 else if(source->_class && dest->_class && (dest->classObjectType == source->classObjectType || !dest->classObjectType) && (enumBaseType || (!source->_class->registered || source->_class->registered->type != 4) || (!dest->_class->registered || dest->_class->registered->type != 4)) && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, dest->_class->registered))
4418 return 0x1;
4419 else
4420 {
4421 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4422 {
4423 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4424 {
4425 return 0x1;
4426 }
4427 }
4428 }
4429 }
4430 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4431 return 0x1;
4432 if(doConversion)
4433 {
4434 if(source->kind == 8)
4435 {
4436 struct __ecereNameSpace__ecere__com__Class * _class;
4437
4438 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4439 {
4440 struct __ecereNameSpace__ecere__com__Property * convert;
4441
4442 for(convert = _class->conversions.first; convert; convert = convert->next)
4443 {
4444 if(convert->memberAccess == 1 || _class->module == privateModule)
4445 {
4446 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4447
4448 if(!convert->dataType)
4449 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4450 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4451 {
4452 if(!conversions && !convert->Get)
4453 return 0x1;
4454 else if(conversions != (((void *)0)))
4455 {
4456 if(_class->type == 3 && convert->dataType->kind == 8 && convert->dataType->_class && convert->dataType->_class->registered && _class->base == convert->dataType->_class->registered->base && (dest->kind != 8 || dest->_class->registered != _class->base))
4457 return 0x1;
4458 else
4459 {
4460 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4461
4462 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4463 return 0x1;
4464 }
4465 }
4466 }
4467 }
4468 }
4469 }
4470 }
4471 if(dest->kind == 8)
4472 {
4473 struct __ecereNameSpace__ecere__com__Class * _class;
4474
4475 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4476 {
4477 struct __ecereNameSpace__ecere__com__Property * convert;
4478
4479 for(convert = _class->conversions.first; convert; convert = convert->next)
4480 {
4481 if(convert->memberAccess == 1 || _class->module == privateModule)
4482 {
4483 if(!convert->dataType)
4484 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4485 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4486 {
4487 if(!conversions && !convert->Set)
4488 return 0x1;
4489 else if(conversions != (((void *)0)))
4490 {
4491 if(_class->type == 3 && convert->dataType->kind == 8 && convert->dataType->_class && convert->dataType->_class->registered && _class->base == convert->dataType->_class->registered->base && (source->kind != 8 || source->_class->registered != _class->base))
4492 return 0x1;
4493 else
4494 {
4495 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4496
4497 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4498 return 0x1;
4499 }
4500 }
4501 }
4502 }
4503 }
4504 }
4505 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4506 {
4507 if(!dest->_class->registered->dataType)
4508 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4509 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4510 {
4511 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4512 {
4513 return 0x1;
4514 }
4515 }
4516 }
4517 }
4518 if(source->kind == 8)
4519 {
4520 struct __ecereNameSpace__ecere__com__Class * _class;
4521
4522 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4523 {
4524 struct __ecereNameSpace__ecere__com__Property * convert;
4525
4526 for(convert = _class->conversions.first; convert; convert = convert->next)
4527 {
4528 if(convert->memberAccess == 1 || _class->module == privateModule)
4529 {
4530 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4531
4532 if(!convert->dataType)
4533 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4534 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4535 {
4536 if(!conversions && !convert->Get)
4537 return 0x1;
4538 else if(conversions != (((void *)0)))
4539 {
4540 if(_class->type == 3 && convert->dataType->kind == 8 && convert->dataType->_class && convert->dataType->_class->registered && _class->base == convert->dataType->_class->registered->base && (dest->kind != 8 || dest->_class->registered != _class->base))
4541 return 0x1;
4542 else
4543 {
4544 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4545
4546 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4547 return 0x1;
4548 }
4549 }
4550 }
4551 }
4552 }
4553 }
4554 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4555 {
4556 if(!source->_class->registered->dataType)
4557 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4558 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4559 {
4560 return 0x1;
4561 }
4562 }
4563 }
4564 }
4565 if(source->kind == 8 || source->kind == 19)
4566 ;
4567 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4568 return 0x1;
4569 else if(dest->kind == 7 && source->kind == 6)
4570 return 0x1;
4571 else if(dest->kind == 2 && source->kind == 1)
4572 return 0x1;
4573 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1))
4574 return 0x1;
4575 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4576 return 0x1;
4577 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4))
4578 return 0x1;
4579 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || dest->kind == 4))
4580 return 0x1;
4581 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && ((source->kind == 11 || (source->kind == 13 && source->type->kind == 11) || source->kind == 16)))
4582 {
4583 struct Type * paramSource, * paramDest;
4584
4585 if(dest->kind == 16)
4586 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4587 if(source->kind == 16)
4588 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4589 if(dest->kind == 13 && dest->type->kind == 11)
4590 dest = dest->type;
4591 if(source->kind == 13 && source->type->kind == 11)
4592 source = source->type;
4593 if(dest->kind == 16)
4594 dest = dest->method->dataType;
4595 if(source->kind == 16)
4596 source = source->method->dataType;
4597 paramSource = source->params.first;
4598 if(paramSource && paramSource->kind == 0)
4599 paramSource = (((void *)0));
4600 paramDest = dest->params.first;
4601 if(paramDest && paramDest->kind == 0)
4602 paramDest = (((void *)0));
4603 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4604 {
4605 if(!paramDest || (!(paramDest->kind == 13 && paramDest->type && paramDest->type->kind == 0) && (paramDest->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, paramDest->_class->registered))))
4606 {
4607 if(paramDest && paramDest->kind == 8)
4608 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4609 else
4610 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4611 return 0x0;
4612 }
4613 paramDest = paramDest->next;
4614 }
4615 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4616 {
4617 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4618 {
4619 if(dest->thisClass)
4620 {
4621 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4622 {
4623 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4624 return 0x0;
4625 }
4626 }
4627 else
4628 {
4629 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4630 {
4631 if(owningClassDest)
4632 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4633 else
4634 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4635 return 0x0;
4636 }
4637 }
4638 paramSource = paramSource->next;
4639 }
4640 else
4641 {
4642 if(dest->thisClass)
4643 {
4644 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4645 {
4646 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4647 return 0x0;
4648 }
4649 }
4650 else
4651 {
4652 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4653 {
4654 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4655 return 0x0;
4656 }
4657 }
4658 }
4659 }
4660 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4661 {
4662 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4663 return 0x0;
4664 }
4665 for(; paramDest; paramDest = paramDest->next)
4666 {
4667 if(!paramSource)
4668 {
4669 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4670 return 0x0;
4671 }
4672 {
4673 struct Type * paramDestType = paramDest;
4674 struct Type * paramSourceType = paramSource;
4675 struct Type * type = paramDestType;
4676
4677 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4678 {
4679 int id = 0;
4680 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4681 struct __ecereNameSpace__ecere__com__Class * sClass;
4682
4683 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4684 {
4685 id = 0;
4686 if(sClass->templateClass)
4687 sClass = sClass->templateClass;
4688 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4689 {
4690 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4691 {
4692 for(sClass = sClass->base; sClass; sClass = sClass->base)
4693 {
4694 if(sClass->templateClass)
4695 sClass = sClass->templateClass;
4696 id += sClass->templateParams.count;
4697 }
4698 break;
4699 }
4700 id++;
4701 }
4702 if(curParam)
4703 break;
4704 }
4705 if(curParam)
4706 {
4707 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4708
4709 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4710 }
4711 }
4712 if(!MatchTypes(paramDestType, paramSourceType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0) && (!acceptReversedParams || !MatchTypes(paramSourceType, paramDestType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0)))
4713 {
4714 char type[1024];
4715
4716 type[0] = (char)0;
4717 PrintType(paramDest, type, 0x0, 0x1);
4718 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4719 if(paramDestType != paramDest)
4720 FreeType(paramDestType);
4721 return 0x0;
4722 }
4723 if(paramDestType != paramDest)
4724 FreeType(paramDestType);
4725 }
4726 paramSource = paramSource->next;
4727 }
4728 if(paramSource)
4729 {
4730 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4731 return 0x0;
4732 }
4733 return 0x1;
4734 }
4735 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4736 {
4737 return 0x1;
4738 }
4739 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4740 {
4741 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4742 return 0x1;
4743 }
4744 }
4745 return 0x0;
4746 }
4747
4748 static void FreeConvert(struct Conversion * convert)
4749 {
4750 if(convert->resultType)
4751 FreeType(convert->resultType);
4752 }
4753
4754 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4755
4756 struct __ecereNameSpace__ecere__com__BTNamedLink
4757 {
4758 char *  name;
4759 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4760 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4761 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4762 int depth;
4763 void *  data;
4764 };
4765
4766 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4767
4768 struct __ecereNameSpace__ecere__com__EnumClassData
4769 {
4770 struct __ecereNameSpace__ecere__sys__OldList values;
4771 int largest;
4772 };
4773
4774 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4775
4776 struct __ecereNameSpace__ecere__sys__NamedLink
4777 {
4778 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4779 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4780 char *  name;
4781 void *  data;
4782 };
4783
4784 extern void FreeExpContents(struct Expression * exp);
4785
4786 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
4787
4788 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
4789
4790 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
4791
4792 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
4793
4794 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
4795
4796 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4797 {
4798 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
4799
4800 for(link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&nameSpace->classes); link; link = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)link)))
4801 {
4802 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
4803
4804 if(_class->type == 4)
4805 {
4806 struct __ecereNameSpace__ecere__sys__OldList converts = 
4807 {
4808 0, 0, 0, 0, 0
4809 };
4810 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4811
4812 type->kind = 8;
4813 if(!_class->symbol)
4814 _class->symbol = FindClass(_class->fullName);
4815 type->_class = _class->symbol;
4816 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
4817 {
4818 struct __ecereNameSpace__ecere__sys__NamedLink * value;
4819 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
4820
4821 if(enumClass)
4822 {
4823 struct __ecereNameSpace__ecere__com__Class * baseClass;
4824
4825 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
4826 {
4827 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
4828
4829 for(value = e->values.first; value; value = value->next)
4830 {
4831 if(!strcmp(value->name, string))
4832 break;
4833 }
4834 if(value)
4835 {
4836 FreeExpContents(sourceExp);
4837 FreeType(sourceExp->expType);
4838 sourceExp->isConstant = 0x1;
4839 sourceExp->expType = MkClassType(baseClass->fullName);
4840 {
4841 char constant[256];
4842
4843 sourceExp->type = 2;
4844 if(!strcmp(baseClass->dataTypeString, "int"))
4845 sprintf(constant, "%d", value->data);
4846 else
4847 sprintf(constant, "0x%X", value->data);
4848 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
4849 }
4850 while(converts.first)
4851 {
4852 struct Conversion * convert = converts.first;
4853
4854 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
4855 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
4856 }
4857 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4858 return 0x1;
4859 }
4860 }
4861 }
4862 }
4863 if(converts.first)
4864 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
4865 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4866 }
4867 }
4868 for(nameSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&nameSpace->nameSpaces); nameSpace != (((void *)0)); nameSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)nameSpace)))
4869 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
4870 return 0x1;
4871 return 0x0;
4872 }
4873
4874 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
4875
4876 struct __ecereNameSpace__ecere__com__SubModule
4877 {
4878 struct __ecereNameSpace__ecere__com__SubModule * prev;
4879 struct __ecereNameSpace__ecere__com__SubModule * next;
4880 struct __ecereNameSpace__ecere__com__Instance * module;
4881 int importMode;
4882 };
4883
4884 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
4885 {
4886 struct __ecereNameSpace__ecere__com__SubModule * subModule;
4887
4888 if(searchFor == searchIn)
4889 return 0x1;
4890 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->modules.first; subModule; subModule = subModule->next)
4891 {
4892 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->application)
4893 {
4894 if(ModuleVisibility(subModule->module, searchFor))
4895 return 0x1;
4896 }
4897 }
4898 return 0x0;
4899 }
4900
4901 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
4902
4903 struct __ecereNameSpace__ecere__com__Application
4904 {
4905 int argc;
4906 char * *  argv;
4907 int exitCode;
4908 unsigned int isGUIApp;
4909 struct __ecereNameSpace__ecere__sys__OldList allModules;
4910 char *  parsedCommand;
4911 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
4912 };
4913
4914 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4915 {
4916 struct __ecereNameSpace__ecere__com__Instance * module;
4917
4918 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->systemNameSpace, sourceExp, dest, string, conversions))
4919 return 0x1;
4920 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->privateNameSpace, sourceExp, dest, string, conversions))
4921 return 0x1;
4922 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4923 return 0x1;
4924 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->next)
4925 {
4926 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4927 return 0x1;
4928 }
4929 return 0x0;
4930 }
4931
4932 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
4933
4934 void ReadString(char *  output, char *  string);
4935
4936 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
4937
4938 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
4939
4940 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
4941
4942 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
4943 {
4944 void * __ecereTemp1;
4945 struct Type * source = sourceExp->expType;
4946 struct Type * realDest = dest;
4947
4948 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
4949 return 0x1;
4950 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
4951 {
4952 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
4953 {
4954 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4955
4956 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4957 ;
4958 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
4959 ;
4960 if(sourceBase == destBase)
4961 return 0x1;
4962 }
4963 }
4964 if(source)
4965 {
4966 struct __ecereNameSpace__ecere__sys__OldList * specs;
4967 unsigned int flag = 0x0;
4968 long long value = (((int)0x7fffffff));
4969
4970 source->refCount++;
4971 dest->refCount++;
4972 if(sourceExp->type == 2)
4973 {
4974 if(source->isSigned)
4975 value = strtoll(sourceExp->constant, (((void *)0)), 0);
4976 else
4977 value = strtoull(sourceExp->constant, (((void *)0)), 0);
4978 }
4979 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
4980 {
4981 if(source->isSigned)
4982 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
4983 else
4984 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
4985 }
4986 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
4987 {
4988 FreeType(source);
4989 source = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->isSigned = 0x0, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
4990 }
4991 if(dest->kind == 8)
4992 {
4993 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
4994
4995 if(_class && _class->type == 3)
4996 {
4997 if(source->kind != 8)
4998 {
4999 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5000 struct Type * tempDest, * tempSource;
5001
5002 for(; _class->base->type != 1000; _class = _class->base)
5003 ;
5004 tempSource = dest;
5005 tempDest = tempType;
5006 tempType->kind = 8;
5007 if(!_class->symbol)
5008 _class->symbol = FindClass(_class->fullName);
5009 tempType->_class = _class->symbol;
5010 tempType->truth = dest->truth;
5011 if(tempType->_class)
5012 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5013 FreeType(sourceExp->expType);
5014 sourceExp->expType = dest;
5015 dest->refCount++;
5016 flag = 0x1;
5017 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5018 }
5019 }
5020 if(_class && _class->type == 2 && source->kind != 8)
5021 {
5022 if(!dest->_class->registered->dataType)
5023 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5024 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5025 {
5026 FreeType(source);
5027 FreeType(sourceExp->expType);
5028 source = sourceExp->expType = MkClassType(dest->_class->string);
5029 source->refCount++;
5030 }
5031 }
5032 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5033 {
5034 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5035 struct Declarator * decl;
5036 char string[1024];
5037
5038 ReadString(string, sourceExp->string);
5039 decl = SpecDeclFromString(string, specs, (((void *)0)));
5040 FreeExpContents(sourceExp);
5041 FreeType(sourceExp->expType);
5042 sourceExp->type = 26;
5043 sourceExp->_classExp.specifiers = specs;
5044 sourceExp->_classExp.decl = decl;
5045 sourceExp->expType = dest;
5046 dest->refCount++;
5047 FreeType(source);
5048 FreeType(dest);
5049 return 0x1;
5050 }
5051 }
5052 else if(source->kind == 8)
5053 {
5054 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5055
5056 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5057 {
5058 if(dest->kind != 8)
5059 {
5060 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5061 struct Type * tempDest, * tempSource;
5062
5063 if(!source->_class->registered->dataType)
5064 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5065 for(; _class->base->type != 1000; _class = _class->base)
5066 ;
5067 tempDest = source;
5068 tempSource = tempType;
5069 tempType->kind = 8;
5070 tempType->_class = FindClass(_class->fullName);
5071 tempType->truth = source->truth;
5072 tempType->classObjectType = source->classObjectType;
5073 if(tempType->_class)
5074 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5075 if(conversions->last)
5076 {
5077 ((struct Conversion *)conversions->last)->resultType = dest;
5078 dest->refCount++;
5079 }
5080 FreeType(sourceExp->expType);
5081 sourceExp->expType = MkClassType(_class->fullName);
5082 sourceExp->expType->truth = source->truth;
5083 sourceExp->expType->classObjectType = source->classObjectType;
5084 if(!sourceExp->destType)
5085 {
5086 FreeType(sourceExp->destType);
5087 sourceExp->destType = sourceExp->expType;
5088 if(sourceExp->expType)
5089 sourceExp->expType->refCount++;
5090 }
5091 if(!_class->dataType)
5092 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5093 FreeType(dest);
5094 dest = MkClassType(source->_class->string);
5095 dest->truth = source->truth;
5096 dest->classObjectType = source->classObjectType;
5097 FreeType(source);
5098 source = _class->dataType;
5099 source->refCount++;
5100 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5101 }
5102 }
5103 }
5104 if(!flag)
5105 {
5106 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5107 {
5108 FreeType(source);
5109 FreeType(dest);
5110 return 0x1;
5111 }
5112 }
5113 if(dest->kind == 8)
5114 {
5115 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5116
5117 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5118 {
5119 if(_class->type == 0 || _class->type == 5)
5120 {
5121 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5122
5123 *newExp = *sourceExp;
5124 if(sourceExp->destType)
5125 sourceExp->destType->refCount++;
5126 if(sourceExp->expType)
5127 sourceExp->expType->refCount++;
5128 sourceExp->type = 11;
5129 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5130 sourceExp->cast.exp = newExp;
5131 FreeType(sourceExp->expType);
5132 sourceExp->expType = (((void *)0));
5133 ProcessExpressionType(sourceExp);
5134 if(!inCompiler)
5135 {
5136 FreeType(sourceExp->expType);
5137 sourceExp->expType = dest;
5138 }
5139 FreeType(source);
5140 if(inCompiler)
5141 FreeType(dest);
5142 return 0x1;
5143 }
5144 if(!_class->dataType)
5145 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5146 FreeType(dest);
5147 dest = _class->dataType;
5148 dest->refCount++;
5149 }
5150 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5151 {
5152 specs = MkListOne(MkSpecifier(DOUBLE));
5153 }
5154 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5155 {
5156 specs = MkListOne(MkSpecifier(FLOAT));
5157 }
5158 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5159 {
5160 specs = MkList();
5161 if(!dest->isSigned)
5162 ListAdd(specs, MkSpecifier(UNSIGNED));
5163 ListAdd(specs, MkSpecifier(INT64));
5164 }
5165 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5166 {
5167 specs = MkList();
5168 if(!dest->isSigned)
5169 ListAdd(specs, MkSpecifier(UNSIGNED));
5170 ListAdd(specs, MkSpecifier(INT));
5171 }
5172 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5173 {
5174 specs = MkList();
5175 if(!dest->isSigned)
5176 ListAdd(specs, MkSpecifier(UNSIGNED));
5177 ListAdd(specs, MkSpecifier(SHORT));
5178 }
5179 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5180 {
5181 specs = MkList();
5182 if(!dest->isSigned)
5183 ListAdd(specs, MkSpecifier(UNSIGNED));
5184 ListAdd(specs, MkSpecifier(CHAR));
5185 }
5186 else
5187 {
5188 FreeType(source);
5189 FreeType(dest);
5190 return 0x0;
5191 }
5192 }
5193 else if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || source->kind == 4 || source->kind == 3 || source->kind == 15 || source->kind == 2 || source->kind == 1))
5194 {
5195 specs = MkListOne(MkSpecifier(DOUBLE));
5196 }
5197 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5198 {
5199 specs = MkListOne(MkSpecifier(FLOAT));
5200 }
5201 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (dest->isSigned ? (value >= -128 && value <= 127) : (value >= 0 && value <= 255)))
5202 {
5203 specs = MkList();
5204 if(!dest->isSigned)
5205 ListAdd(specs, MkSpecifier(UNSIGNED));
5206 ListAdd(specs, MkSpecifier(CHAR));
5207 }
5208 else if(dest->kind == 2 && (source->kind == 15 || source->kind == 1 || source->kind == 2 || (source->kind == 3 && (dest->isSigned ? (value >= -32768 && value <= 32767) : (value >= 0 && value <= 65535)))))
5209 {
5210 specs = MkList();
5211 if(!dest->isSigned)
5212 ListAdd(specs, MkSpecifier(UNSIGNED));
5213 ListAdd(specs, MkSpecifier(SHORT));
5214 }
5215 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5216 {
5217 specs = MkList();
5218 if(!dest->isSigned)
5219 ListAdd(specs, MkSpecifier(UNSIGNED));
5220 ListAdd(specs, MkSpecifier(INT));
5221 }
5222 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5223 {
5224 specs = MkList();
5225 if(!dest->isSigned)
5226 ListAdd(specs, MkSpecifier(UNSIGNED));
5227 ListAdd(specs, MkSpecifier(INT64));
5228 }
5229 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5230 {
5231 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5232 }
5233 else
5234 {
5235 FreeType(source);
5236 FreeType(dest);
5237 return 0x0;
5238 }
5239 if(!flag)
5240 {
5241 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5242
5243 *newExp = *sourceExp;
5244 newExp->prev = (((void *)0));
5245 newExp->next = (((void *)0));
5246 if(sourceExp->destType)
5247 sourceExp->destType->refCount++;
5248 if(sourceExp->expType)
5249 sourceExp->expType->refCount++;
5250 sourceExp->type = 11;
5251 if(realDest->kind == 8)
5252 {
5253 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5254 FreeList(specs, FreeSpecifier);
5255 }
5256 else
5257 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5258 if(newExp->type == 4)
5259 {
5260 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5261 }
5262 else
5263 sourceExp->cast.exp = newExp;
5264 FreeType(sourceExp->expType);
5265 sourceExp->expType = (((void *)0));
5266 ProcessExpressionType(sourceExp);
5267 }
5268 else
5269 FreeList(specs, FreeSpecifier);
5270 FreeType(dest);
5271 FreeType(source);
5272 return 0x1;
5273 }
5274 else
5275 {
5276 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5277 sourceExp = (*sourceExp->list).last;
5278 if(sourceExp->type == 0)
5279 {
5280 struct Identifier * id = sourceExp->identifier;
5281
5282 if(dest->kind == 8)
5283 {
5284 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5285 {
5286 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5287 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5288
5289 if(enumClass)
5290 {
5291 for(; _class && _class->type == 4; _class = _class->base)
5292 {
5293 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5294 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5295
5296 for(value = e->values.first; value; value = value->next)
5297 {
5298 if(!strcmp(value->name, id->string))
5299 break;
5300 }
5301 if(value)
5302 {
5303 FreeExpContents(sourceExp);
5304 FreeType(sourceExp->expType);
5305 sourceExp->isConstant = 0x1;
5306 sourceExp->expType = MkClassType(_class->fullName);
5307 {
5308 char constant[256];
5309
5310 sourceExp->type = 2;
5311 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5312 sprintf(constant, "%d", value->data);
5313 else
5314 sprintf(constant, "0x%X", value->data);
5315 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5316 }
5317 return 0x1;
5318 }
5319 }
5320 }
5321 }
5322 }
5323 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5324 return 0x1;
5325 }
5326 }
5327 return 0x0;
5328 }
5329
5330 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5331 {
5332 int value2 = op2->i;
5333
5334 exp->type = 2;
5335 exp->string = PrintInt(op1->i + value2);
5336 if(!exp->expType)
5337 {
5338 exp->expType = op1->type;
5339 if(op1->type)
5340 op1->type->refCount++;
5341 }
5342 return 0x1;
5343 }
5344
5345 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5346 {
5347 unsigned int value2 = op2->ui;
5348
5349 exp->type = 2;
5350 exp->string = PrintUInt(op1->ui + value2);
5351 if(!exp->expType)
5352 {
5353 exp->expType = op1->type;
5354 if(op1->type)
5355 op1->type->refCount++;
5356 }
5357 return 0x1;
5358 }
5359
5360 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5361 {
5362 short value2 = op2->s;
5363
5364 exp->type = 2;
5365 exp->string = PrintShort(op1->s + value2);
5366 if(!exp->expType)
5367 {
5368 exp->expType = op1->type;
5369 if(op1->type)
5370 op1->type->refCount++;
5371 }
5372 return 0x1;
5373 }
5374
5375 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5376 {
5377 unsigned short value2 = op2->us;
5378
5379 exp->type = 2;
5380 exp->string = PrintUShort(op1->us + value2);
5381 if(!exp->expType)
5382 {
5383 exp->expType = op1->type;
5384 if(op1->type)
5385 op1->type->refCount++;
5386 }
5387 return 0x1;
5388 }
5389
5390 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5391 {
5392 char value2 = op2->c;
5393
5394 exp->type = 2;
5395 exp->string = PrintChar(op1->c + value2);
5396 if(!exp->expType)
5397 {
5398 exp->expType = op1->type;
5399 if(op1->type)
5400 op1->type->refCount++;
5401 }
5402 return 0x1;
5403 }
5404
5405 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5406 {
5407 unsigned char value2 = op2->uc;
5408
5409 exp->type = 2;
5410 exp->string = PrintUChar(op1->uc + value2);
5411 if(!exp->expType)
5412 {
5413 exp->expType = op1->type;
5414 if(op1->type)
5415 op1->type->refCount++;
5416 }
5417 return 0x1;
5418 }
5419
5420 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5421 {
5422 float value2 = op2->f;
5423
5424 exp->type = 2;
5425 exp->string = PrintFloat(op1->f + value2);
5426 if(!exp->expType)
5427 {
5428 exp->expType = op1->type;
5429 if(op1->type)
5430 op1->type->refCount++;
5431 }
5432 return 0x1;
5433 }
5434
5435 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5436 {
5437 double value2 = op2->d;
5438
5439 exp->type = 2;
5440 exp->string = PrintDouble(op1->d + value2);
5441 if(!exp->expType)
5442 {
5443 exp->expType = op1->type;
5444 if(op1->type)
5445 op1->type->refCount++;
5446 }
5447 return 0x1;
5448 }
5449
5450 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5451 {
5452 int value2 = op2->i;
5453
5454 exp->type = 2;
5455 exp->string = PrintInt(op1->i - value2);
5456 if(!exp->expType)
5457 {
5458 exp->expType = op1->type;
5459 if(op1->type)
5460 op1->type->refCount++;
5461 }
5462 return 0x1;
5463 }
5464
5465 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5466 {
5467 unsigned int value2 = op2->ui;
5468
5469 exp->type = 2;
5470 exp->string = PrintUInt(op1->ui - value2);
5471 if(!exp->expType)
5472 {
5473 exp->expType = op1->type;
5474 if(op1->type)
5475 op1->type->refCount++;
5476 }
5477 return 0x1;
5478 }
5479
5480 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5481 {
5482 short value2 = op2->s;
5483
5484 exp->type = 2;
5485 exp->string = PrintShort(op1->s - value2);
5486 if(!exp->expType)
5487 {
5488 exp->expType = op1->type;
5489 if(op1->type)
5490 op1->type->refCount++;
5491 }
5492 return 0x1;
5493 }
5494
5495 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5496 {
5497 unsigned short value2 = op2->us;
5498
5499 exp->type = 2;
5500 exp->string = PrintUShort(op1->us - value2);
5501 if(!exp->expType)
5502 {
5503 exp->expType = op1->type;
5504 if(op1->type)
5505 op1->type->refCount++;
5506 }
5507 return 0x1;
5508 }
5509
5510 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5511 {
5512 char value2 = op2->c;
5513
5514 exp->type = 2;
5515 exp->string = PrintChar(op1->c - value2);
5516 if(!exp->expType)
5517 {
5518 exp->expType = op1->type;
5519 if(op1->type)
5520 op1->type->refCount++;
5521 }
5522 return 0x1;
5523 }
5524
5525 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5526 {
5527 unsigned char value2 = op2->uc;
5528
5529 exp->type = 2;
5530 exp->string = PrintUChar(op1->uc - value2);
5531 if(!exp->expType)
5532 {
5533 exp->expType = op1->type;
5534 if(op1->type)
5535 op1->type->refCount++;
5536 }
5537 return 0x1;
5538 }
5539
5540 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5541 {
5542 float value2 = op2->f;
5543
5544 exp->type = 2;
5545 exp->string = PrintFloat(op1->f - value2);
5546 if(!exp->expType)
5547 {
5548 exp->expType = op1->type;
5549 if(op1->type)
5550 op1->type->refCount++;
5551 }
5552 return 0x1;
5553 }
5554
5555 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5556 {
5557 double value2 = op2->d;
5558
5559 exp->type = 2;
5560 exp->string = PrintDouble(op1->d - value2);
5561 if(!exp->expType)
5562 {
5563 exp->expType = op1->type;
5564 if(op1->type)
5565 op1->type->refCount++;
5566 }
5567 return 0x1;
5568 }
5569
5570 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5571 {
5572 int value2 = op2->i;
5573
5574 exp->type = 2;
5575 exp->string = PrintInt(op1->i * value2);
5576 if(!exp->expType)
5577 {
5578 exp->expType = op1->type;
5579 if(op1->type)
5580 op1->type->refCount++;
5581 }
5582 return 0x1;
5583 }
5584
5585 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5586 {
5587 unsigned int value2 = op2->ui;
5588
5589 exp->type = 2;
5590 exp->string = PrintUInt(op1->ui * value2);
5591 if(!exp->expType)
5592 {
5593 exp->expType = op1->type;
5594 if(op1->type)
5595 op1->type->refCount++;
5596 }
5597 return 0x1;
5598 }
5599
5600 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5601 {
5602 short value2 = op2->s;
5603
5604 exp->type = 2;
5605 exp->string = PrintShort(op1->s * value2);
5606 if(!exp->expType)
5607 {
5608 exp->expType = op1->type;
5609 if(op1->type)
5610 op1->type->refCount++;
5611 }
5612 return 0x1;
5613 }
5614
5615 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5616 {
5617 unsigned short value2 = op2->us;
5618
5619 exp->type = 2;
5620 exp->string = PrintUShort(op1->us * value2);
5621 if(!exp->expType)
5622 {
5623 exp->expType = op1->type;
5624 if(op1->type)
5625 op1->type->refCount++;
5626 }
5627 return 0x1;
5628 }
5629
5630 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5631 {
5632 char value2 = op2->c;
5633
5634 exp->type = 2;
5635 exp->string = PrintChar(op1->c * value2);
5636 if(!exp->expType)
5637 {
5638 exp->expType = op1->type;
5639 if(op1->type)
5640 op1->type->refCount++;
5641 }
5642 return 0x1;
5643 }
5644
5645 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5646 {
5647 unsigned char value2 = op2->uc;
5648
5649 exp->type = 2;
5650 exp->string = PrintUChar(op1->uc * value2);
5651 if(!exp->expType)
5652 {
5653 exp->expType = op1->type;
5654 if(op1->type)
5655 op1->type->refCount++;
5656 }
5657 return 0x1;
5658 }
5659
5660 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5661 {
5662 float value2 = op2->f;
5663
5664 exp->type = 2;
5665 exp->string = PrintFloat(op1->f * value2);
5666 if(!exp->expType)
5667 {
5668 exp->expType = op1->type;
5669 if(op1->type)
5670 op1->type->refCount++;
5671 }
5672 return 0x1;
5673 }
5674
5675 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5676 {
5677 double value2 = op2->d;
5678
5679 exp->type = 2;
5680 exp->string = PrintDouble(op1->d * value2);
5681 if(!exp->expType)
5682 {
5683 exp->expType = op1->type;
5684 if(op1->type)
5685 op1->type->refCount++;
5686 }
5687 return 0x1;
5688 }
5689
5690 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5691 {
5692 int value2 = op2->i;
5693
5694 exp->type = 2;
5695 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5696 if(!exp->expType)
5697 {
5698 exp->expType = op1->type;
5699 if(op1->type)
5700 op1->type->refCount++;
5701 }
5702 return 0x1;
5703 }
5704
5705 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5706 {
5707 unsigned int value2 = op2->ui;
5708
5709 exp->type = 2;
5710 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5711 if(!exp->expType)
5712 {
5713 exp->expType = op1->type;
5714 if(op1->type)
5715 op1->type->refCount++;
5716 }
5717 return 0x1;
5718 }
5719
5720 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5721 {
5722 short value2 = op2->s;
5723
5724 exp->type = 2;
5725 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5726 if(!exp->expType)
5727 {
5728 exp->expType = op1->type;
5729 if(op1->type)
5730 op1->type->refCount++;
5731 }
5732 return 0x1;
5733 }
5734
5735 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5736 {
5737 unsigned short value2 = op2->us;
5738
5739 exp->type = 2;
5740 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5741 if(!exp->expType)
5742 {
5743 exp->expType = op1->type;
5744 if(op1->type)
5745 op1->type->refCount++;
5746 }
5747 return 0x1;
5748 }
5749
5750 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5751 {
5752 char value2 = op2->c;
5753
5754 exp->type = 2;
5755 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5756 if(!exp->expType)
5757 {
5758 exp->expType = op1->type;
5759 if(op1->type)
5760 op1->type->refCount++;
5761 }
5762 return 0x1;
5763 }
5764
5765 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5766 {
5767 unsigned char value2 = op2->uc;
5768
5769 exp->type = 2;
5770 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5771 if(!exp->expType)
5772 {
5773 exp->expType = op1->type;
5774 if(op1->type)
5775 op1->type->refCount++;
5776 }
5777 return 0x1;
5778 }
5779
5780 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5781 {
5782 float value2 = op2->f;
5783
5784 exp->type = 2;
5785 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
5786 if(!exp->expType)
5787 {
5788 exp->expType = op1->type;
5789 if(op1->type)
5790 op1->type->refCount++;
5791 }
5792 return 0x1;
5793 }
5794
5795 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5796 {
5797 double value2 = op2->d;
5798
5799 exp->type = 2;
5800 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
5801 if(!exp->expType)
5802 {
5803 exp->expType = op1->type;
5804 if(op1->type)
5805 op1->type->refCount++;
5806 }
5807 return 0x1;
5808 }
5809
5810 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5811 {
5812 int value2 = op2->i;
5813
5814 exp->type = 2;
5815 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
5816 if(!exp->expType)
5817 {
5818 exp->expType = op1->type;
5819 if(op1->type)
5820 op1->type->refCount++;
5821 }
5822 return 0x1;
5823 }
5824
5825 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5826 {
5827 unsigned int value2 = op2->ui;
5828
5829 exp->type = 2;
5830 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
5831 if(!exp->expType)
5832 {
5833 exp->expType = op1->type;
5834 if(op1->type)
5835 op1->type->refCount++;
5836 }
5837 return 0x1;
5838 }
5839
5840 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5841 {
5842 short value2 = op2->s;
5843
5844 exp->type = 2;
5845 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
5846 if(!exp->expType)
5847 {
5848 exp->expType = op1->type;
5849 if(op1->type)
5850 op1->type->refCount++;
5851 }
5852 return 0x1;
5853 }
5854
5855 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5856 {
5857 unsigned short value2 = op2->us;
5858
5859 exp->type = 2;
5860 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
5861 if(!exp->expType)
5862 {
5863 exp->expType = op1->type;
5864 if(op1->type)
5865 op1->type->refCount++;
5866 }
5867 return 0x1;
5868 }
5869
5870 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5871 {
5872 char value2 = op2->c;
5873
5874 exp->type = 2;
5875 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
5876 if(!exp->expType)
5877 {
5878 exp->expType = op1->type;
5879 if(op1->type)
5880 op1->type->refCount++;
5881 }
5882 return 0x1;
5883 }
5884
5885 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5886 {
5887 unsigned char value2 = op2->uc;
5888
5889 exp->type = 2;
5890 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
5891 if(!exp->expType)
5892 {
5893 exp->expType = op1->type;
5894 if(op1->type)
5895 op1->type->refCount++;
5896 }
5897 return 0x1;
5898 }
5899
5900 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
5901 {
5902 exp->type = 2;
5903 exp->string = PrintInt(-op1->i);
5904 if(!exp->expType)
5905 {
5906 exp->expType = op1->type;
5907 if(op1->type)
5908 op1->type->refCount++;
5909 }
5910 return 0x1;
5911 }
5912
5913 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
5914 {
5915 exp->type = 2;
5916 exp->string = PrintUInt(-op1->ui);
5917 if(!exp->expType)
5918 {
5919 exp->expType = op1->type;
5920 if(op1->type)
5921 op1->type->refCount++;
5922 }
5923 return 0x1;
5924 }
5925
5926 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
5927 {
5928 exp->type = 2;
5929 exp->string = PrintShort(-op1->s);
5930 if(!exp->expType)
5931 {
5932 exp->expType = op1->type;
5933 if(op1->type)
5934 op1->type->refCount++;
5935 }
5936 return 0x1;
5937 }
5938
5939 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
5940 {
5941 exp->type = 2;
5942 exp->string = PrintUShort(-op1->us);
5943 if(!exp->expType)
5944 {
5945 exp->expType = op1->type;
5946 if(op1->type)
5947 op1->type->refCount++;
5948 }
5949 return 0x1;
5950 }
5951
5952 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
5953 {
5954 exp->type = 2;
5955 exp->string = PrintChar(-op1->c);
5956 if(!exp->expType)
5957 {
5958 exp->expType = op1->type;
5959 if(op1->type)
5960 op1->type->refCount++;
5961 }
5962 return 0x1;
5963 }
5964
5965 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
5966 {
5967 exp->type = 2;
5968 exp->string = PrintUChar(-op1->uc);
5969 if(!exp->expType)
5970 {
5971 exp->expType = op1->type;
5972 if(op1->type)
5973 op1->type->refCount++;
5974 }
5975 return 0x1;
5976 }
5977
5978 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
5979 {
5980 exp->type = 2;
5981 exp->string = PrintFloat(-op1->f);
5982 if(!exp->expType)
5983 {
5984 exp->expType = op1->type;
5985 if(op1->type)
5986 op1->type->refCount++;
5987 }
5988 return 0x1;
5989 }
5990
5991 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
5992 {
5993 exp->type = 2;
5994 exp->string = PrintDouble(-op1->d);
5995 if(!exp->expType)
5996 {
5997 exp->expType = op1->type;
5998 if(op1->type)
5999 op1->type->refCount++;
6000 }
6001 return 0x1;
6002 }
6003
6004 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6005 {
6006 exp->type = 2;
6007 exp->string = PrintInt(++op1->i);
6008 if(!exp->expType)
6009 {
6010 exp->expType = op1->type;
6011 if(op1->type)
6012 op1->type->refCount++;
6013 }
6014 return 0x1;
6015 }
6016
6017 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6018 {
6019 exp->type = 2;
6020 exp->string = PrintUInt(++op1->ui);
6021 if(!exp->expType)
6022 {
6023 exp->expType = op1->type;
6024 if(op1->type)
6025 op1->type->refCount++;
6026 }
6027 return 0x1;
6028 }
6029
6030 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6031 {
6032 exp->type = 2;
6033 exp->string = PrintShort(++op1->s);
6034 if(!exp->expType)
6035 {
6036 exp->expType = op1->type;
6037 if(op1->type)
6038 op1->type->refCount++;
6039 }
6040 return 0x1;
6041 }
6042
6043 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6044 {
6045 exp->type = 2;
6046 exp->string = PrintUShort(++op1->us);
6047 if(!exp->expType)
6048 {
6049 exp->expType = op1->type;
6050 if(op1->type)
6051 op1->type->refCount++;
6052 }
6053 return 0x1;
6054 }
6055
6056 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6057 {
6058 exp->type = 2;
6059 exp->string = PrintChar(++op1->c);
6060 if(!exp->expType)
6061 {
6062 exp->expType = op1->type;
6063 if(op1->type)
6064 op1->type->refCount++;
6065 }
6066 return 0x1;
6067 }
6068
6069 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6070 {
6071 exp->type = 2;
6072 exp->string = PrintUChar(++op1->uc);
6073 if(!exp->expType)
6074 {
6075 exp->expType = op1->type;
6076 if(op1->type)
6077 op1->type->refCount++;
6078 }
6079 return 0x1;
6080 }
6081
6082 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6083 {
6084 exp->type = 2;
6085 exp->string = PrintFloat(++op1->f);
6086 if(!exp->expType)
6087 {
6088 exp->expType = op1->type;
6089 if(op1->type)
6090 op1->type->refCount++;
6091 }
6092 return 0x1;
6093 }
6094
6095 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6096 {
6097 exp->type = 2;
6098 exp->string = PrintDouble(++op1->d);
6099 if(!exp->expType)
6100 {
6101 exp->expType = op1->type;
6102 if(op1->type)
6103 op1->type->refCount++;
6104 }
6105 return 0x1;
6106 }
6107
6108 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6109 {
6110 exp->type = 2;
6111 exp->string = PrintInt(--op1->i);
6112 if(!exp->expType)
6113 {
6114 exp->expType = op1->type;
6115 if(op1->type)
6116 op1->type->refCount++;
6117 }
6118 return 0x1;
6119 }
6120
6121 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6122 {
6123 exp->type = 2;
6124 exp->string = PrintUInt(--op1->ui);
6125 if(!exp->expType)
6126 {
6127 exp->expType = op1->type;
6128 if(op1->type)
6129 op1->type->refCount++;
6130 }
6131 return 0x1;
6132 }
6133
6134 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6135 {
6136 exp->type = 2;
6137 exp->string = PrintShort(--op1->s);
6138 if(!exp->expType)
6139 {
6140 exp->expType = op1->type;
6141 if(op1->type)
6142 op1->type->refCount++;
6143 }
6144 return 0x1;
6145 }
6146
6147 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6148 {
6149 exp->type = 2;
6150 exp->string = PrintUShort(--op1->us);
6151 if(!exp->expType)
6152 {
6153 exp->expType = op1->type;
6154 if(op1->type)
6155 op1->type->refCount++;
6156 }
6157 return 0x1;
6158 }
6159
6160 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6161 {
6162 exp->type = 2;
6163 exp->string = PrintChar(--op1->c);
6164 if(!exp->expType)
6165 {
6166 exp->expType = op1->type;
6167 if(op1->type)
6168 op1->type->refCount++;
6169 }
6170 return 0x1;
6171 }
6172
6173 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6174 {
6175 exp->type = 2;
6176 exp->string = PrintUChar(--op1->uc);
6177 if(!exp->expType)
6178 {
6179 exp->expType = op1->type;
6180 if(op1->type)
6181 op1->type->refCount++;
6182 }
6183 return 0x1;
6184 }
6185
6186 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6187 {
6188 exp->type = 2;
6189 exp->string = PrintFloat(--op1->f);
6190 if(!exp->expType)
6191 {
6192 exp->expType = op1->type;
6193 if(op1->type)
6194 op1->type->refCount++;
6195 }
6196 return 0x1;
6197 }
6198
6199 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6200 {
6201 exp->type = 2;
6202 exp->string = PrintDouble(--op1->d);
6203 if(!exp->expType)
6204 {
6205 exp->expType = op1->type;
6206 if(op1->type)
6207 op1->type->refCount++;
6208 }
6209 return 0x1;
6210 }
6211
6212 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6213 {
6214 int value2 = op2->i;
6215
6216 exp->type = 2;
6217 exp->string = PrintInt(op1->i = value2);
6218 if(!exp->expType)
6219 {
6220 exp->expType = op1->type;
6221 if(op1->type)
6222 op1->type->refCount++;
6223 }
6224 return 0x1;
6225 }
6226
6227 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6228 {
6229 unsigned int value2 = op2->ui;
6230
6231 exp->type = 2;
6232 exp->string = PrintUInt(op1->ui = value2);
6233 if(!exp->expType)
6234 {
6235 exp->expType = op1->type;
6236 if(op1->type)
6237 op1->type->refCount++;
6238 }
6239 return 0x1;
6240 }
6241
6242 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6243 {
6244 short value2 = op2->s;
6245
6246 exp->type = 2;
6247 exp->string = PrintShort(op1->s = value2);
6248 if(!exp->expType)
6249 {
6250 exp->expType = op1->type;
6251 if(op1->type)
6252 op1->type->refCount++;
6253 }
6254 return 0x1;
6255 }
6256
6257 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6258 {
6259 unsigned short value2 = op2->us;
6260
6261 exp->type = 2;
6262 exp->string = PrintUShort(op1->us = value2);
6263 if(!exp->expType)
6264 {
6265 exp->expType = op1->type;
6266 if(op1->type)
6267 op1->type->refCount++;
6268 }
6269 return 0x1;
6270 }
6271
6272 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6273 {
6274 char value2 = op2->c;
6275
6276 exp->type = 2;
6277 exp->string = PrintChar(op1->c = value2);
6278 if(!exp->expType)
6279 {
6280 exp->expType = op1->type;
6281 if(op1->type)
6282 op1->type->refCount++;
6283 }
6284 return 0x1;
6285 }
6286
6287 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6288 {
6289 unsigned char value2 = op2->uc;
6290
6291 exp->type = 2;
6292 exp->string = PrintUChar(op1->uc = value2);
6293 if(!exp->expType)
6294 {
6295 exp->expType = op1->type;
6296 if(op1->type)
6297 op1->type->refCount++;
6298 }
6299 return 0x1;
6300 }
6301
6302 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6303 {
6304 float value2 = op2->f;
6305
6306 exp->type = 2;
6307 exp->string = PrintFloat(op1->f = value2);
6308 if(!exp->expType)
6309 {
6310 exp->expType = op1->type;
6311 if(op1->type)
6312 op1->type->refCount++;
6313 }
6314 return 0x1;
6315 }
6316
6317 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6318 {
6319 double value2 = op2->d;
6320
6321 exp->type = 2;
6322 exp->string = PrintDouble(op1->d = value2);
6323 if(!exp->expType)
6324 {
6325 exp->expType = op1->type;
6326 if(op1->type)
6327 op1->type->refCount++;
6328 }
6329 return 0x1;
6330 }
6331
6332 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6333 {
6334 int value2 = op2->i;
6335
6336 exp->type = 2;
6337 exp->string = PrintInt(op1->i += value2);
6338 if(!exp->expType)
6339 {
6340 exp->expType = op1->type;
6341 if(op1->type)
6342 op1->type->refCount++;
6343 }
6344 return 0x1;
6345 }
6346
6347 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6348 {
6349 unsigned int value2 = op2->ui;
6350
6351 exp->type = 2;
6352 exp->string = PrintUInt(op1->ui += value2);
6353 if(!exp->expType)
6354 {
6355 exp->expType = op1->type;
6356 if(op1->type)
6357 op1->type->refCount++;
6358 }
6359 return 0x1;
6360 }
6361
6362 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6363 {
6364 short value2 = op2->s;
6365
6366 exp->type = 2;
6367 exp->string = PrintShort(op1->s += value2);
6368 if(!exp->expType)
6369 {
6370 exp->expType = op1->type;
6371 if(op1->type)
6372 op1->type->refCount++;
6373 }
6374 return 0x1;
6375 }
6376
6377 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6378 {
6379 unsigned short value2 = op2->us;
6380
6381 exp->type = 2;
6382 exp->string = PrintUShort(op1->us += value2);
6383 if(!exp->expType)
6384 {
6385 exp->expType = op1->type;
6386 if(op1->type)
6387 op1->type->refCount++;
6388 }
6389 return 0x1;
6390 }
6391
6392 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6393 {
6394 char value2 = op2->c;
6395
6396 exp->type = 2;
6397 exp->string = PrintChar(op1->c += value2);
6398 if(!exp->expType)
6399 {
6400 exp->expType = op1->type;
6401 if(op1->type)
6402 op1->type->refCount++;
6403 }
6404 return 0x1;
6405 }
6406
6407 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6408 {
6409 unsigned char value2 = op2->uc;
6410
6411 exp->type = 2;
6412 exp->string = PrintUChar(op1->uc += value2);
6413 if(!exp->expType)
6414 {
6415 exp->expType = op1->type;
6416 if(op1->type)
6417 op1->type->refCount++;
6418 }
6419 return 0x1;
6420 }
6421
6422 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6423 {
6424 float value2 = op2->f;
6425
6426 exp->type = 2;
6427 exp->string = PrintFloat(op1->f += value2);
6428 if(!exp->expType)
6429 {
6430 exp->expType = op1->type;
6431 if(op1->type)
6432 op1->type->refCount++;
6433 }
6434 return 0x1;
6435 }
6436
6437 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6438 {
6439 double value2 = op2->d;
6440
6441 exp->type = 2;
6442 exp->string = PrintDouble(op1->d += value2);
6443 if(!exp->expType)
6444 {
6445 exp->expType = op1->type;
6446 if(op1->type)
6447 op1->type->refCount++;
6448 }
6449 return 0x1;
6450 }
6451
6452 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6453 {
6454 int value2 = op2->i;
6455
6456 exp->type = 2;
6457 exp->string = PrintInt(op1->i -= value2);
6458 if(!exp->expType)
6459 {
6460 exp->expType = op1->type;
6461 if(op1->type)
6462 op1->type->refCount++;
6463 }
6464 return 0x1;
6465 }
6466
6467 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6468 {
6469 unsigned int value2 = op2->ui;
6470
6471 exp->type = 2;
6472 exp->string = PrintUInt(op1->ui -= value2);
6473 if(!exp->expType)
6474 {
6475 exp->expType = op1->type;
6476 if(op1->type)
6477 op1->type->refCount++;
6478 }
6479 return 0x1;
6480 }
6481
6482 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6483 {
6484 short value2 = op2->s;
6485
6486 exp->type = 2;
6487 exp->string = PrintShort(op1->s -= value2);
6488 if(!exp->expType)
6489 {
6490 exp->expType = op1->type;
6491 if(op1->type)
6492 op1->type->refCount++;
6493 }
6494 return 0x1;
6495 }
6496
6497 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6498 {
6499 unsigned short value2 = op2->us;
6500
6501 exp->type = 2;
6502 exp->string = PrintUShort(op1->us -= value2);
6503 if(!exp->expType)
6504 {
6505 exp->expType = op1->type;
6506 if(op1->type)
6507 op1->type->refCount++;
6508 }
6509 return 0x1;
6510 }
6511
6512 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6513 {
6514 char value2 = op2->c;
6515
6516 exp->type = 2;
6517 exp->string = PrintChar(op1->c -= value2);
6518 if(!exp->expType)
6519 {
6520 exp->expType = op1->type;
6521 if(op1->type)
6522 op1->type->refCount++;
6523 }
6524 return 0x1;
6525 }
6526
6527 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6528 {
6529 unsigned char value2 = op2->uc;
6530
6531 exp->type = 2;
6532 exp->string = PrintUChar(op1->uc -= value2);
6533 if(!exp->expType)
6534 {
6535 exp->expType = op1->type;
6536 if(op1->type)
6537 op1->type->refCount++;
6538 }
6539 return 0x1;
6540 }
6541
6542 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6543 {
6544 float value2 = op2->f;
6545
6546 exp->type = 2;
6547 exp->string = PrintFloat(op1->f -= value2);
6548 if(!exp->expType)
6549 {
6550 exp->expType = op1->type;
6551 if(op1->type)
6552 op1->type->refCount++;
6553 }
6554 return 0x1;
6555 }
6556
6557 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6558 {
6559 double value2 = op2->d;
6560
6561 exp->type = 2;
6562 exp->string = PrintDouble(op1->d -= value2);
6563 if(!exp->expType)
6564 {
6565 exp->expType = op1->type;
6566 if(op1->type)
6567 op1->type->refCount++;
6568 }
6569 return 0x1;
6570 }
6571
6572 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6573 {
6574 int value2 = op2->i;
6575
6576 exp->type = 2;
6577 exp->string = PrintInt(op1->i *= value2);
6578 if(!exp->expType)
6579 {
6580 exp->expType = op1->type;
6581 if(op1->type)
6582 op1->type->refCount++;
6583 }
6584 return 0x1;
6585 }
6586
6587 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6588 {
6589 unsigned int value2 = op2->ui;
6590
6591 exp->type = 2;
6592 exp->string = PrintUInt(op1->ui *= value2);
6593 if(!exp->expType)
6594 {
6595 exp->expType = op1->type;
6596 if(op1->type)
6597 op1->type->refCount++;
6598 }
6599 return 0x1;
6600 }
6601
6602 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6603 {
6604 short value2 = op2->s;
6605
6606 exp->type = 2;
6607 exp->string = PrintShort(op1->s *= value2);
6608 if(!exp->expType)
6609 {
6610 exp->expType = op1->type;
6611 if(op1->type)
6612 op1->type->refCount++;
6613 }
6614 return 0x1;
6615 }
6616
6617 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6618 {
6619 unsigned short value2 = op2->us;
6620
6621 exp->type = 2;
6622 exp->string = PrintUShort(op1->us *= value2);
6623 if(!exp->expType)
6624 {
6625 exp->expType = op1->type;
6626 if(op1->type)
6627 op1->type->refCount++;
6628 }
6629 return 0x1;
6630 }
6631
6632 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6633 {
6634 char value2 = op2->c;
6635
6636 exp->type = 2;
6637 exp->string = PrintChar(op1->c *= value2);
6638 if(!exp->expType)
6639 {
6640 exp->expType = op1->type;
6641 if(op1->type)
6642 op1->type->refCount++;
6643 }
6644 return 0x1;
6645 }
6646
6647 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6648 {
6649 unsigned char value2 = op2->uc;
6650
6651 exp->type = 2;
6652 exp->string = PrintUChar(op1->uc *= value2);
6653 if(!exp->expType)
6654 {
6655 exp->expType = op1->type;
6656 if(op1->type)
6657 op1->type->refCount++;
6658 }
6659 return 0x1;
6660 }
6661
6662 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6663 {
6664 float value2 = op2->f;
6665
6666 exp->type = 2;
6667 exp->string = PrintFloat(op1->f *= value2);
6668 if(!exp->expType)
6669 {
6670 exp->expType = op1->type;
6671 if(op1->type)
6672 op1->type->refCount++;
6673 }
6674 return 0x1;
6675 }
6676
6677 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6678 {
6679 double value2 = op2->d;
6680
6681 exp->type = 2;
6682 exp->string = PrintDouble(op1->d *= value2);
6683 if(!exp->expType)
6684 {
6685 exp->expType = op1->type;
6686 if(op1->type)
6687 op1->type->refCount++;
6688 }
6689 return 0x1;
6690 }
6691
6692 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6693 {
6694 int value2 = op2->i;
6695
6696 exp->type = 2;
6697 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6698 if(!exp->expType)
6699 {
6700 exp->expType = op1->type;
6701 if(op1->type)
6702 op1->type->refCount++;
6703 }
6704 return 0x1;
6705 }
6706
6707 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6708 {
6709 unsigned int value2 = op2->ui;
6710
6711 exp->type = 2;
6712 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6713 if(!exp->expType)
6714 {
6715 exp->expType = op1->type;
6716 if(op1->type)
6717 op1->type->refCount++;
6718 }
6719 return 0x1;
6720 }
6721
6722 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6723 {
6724 short value2 = op2->s;
6725
6726 exp->type = 2;
6727 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6728 if(!exp->expType)
6729 {
6730 exp->expType = op1->type;
6731 if(op1->type)
6732 op1->type->refCount++;
6733 }
6734 return 0x1;
6735 }
6736
6737 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6738 {
6739 unsigned short value2 = op2->us;
6740
6741 exp->type = 2;
6742 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6743 if(!exp->expType)
6744 {
6745 exp->expType = op1->type;
6746 if(op1->type)
6747 op1->type->refCount++;
6748 }
6749 return 0x1;
6750 }
6751
6752 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6753 {
6754 char value2 = op2->c;
6755
6756 exp->type = 2;
6757 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6758 if(!exp->expType)
6759 {
6760 exp->expType = op1->type;
6761 if(op1->type)
6762 op1->type->refCount++;
6763 }
6764 return 0x1;
6765 }
6766
6767 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6768 {
6769 unsigned char value2 = op2->uc;
6770
6771 exp->type = 2;
6772 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6773 if(!exp->expType)
6774 {
6775 exp->expType = op1->type;
6776 if(op1->type)
6777 op1->type->refCount++;
6778 }
6779 return 0x1;
6780 }
6781
6782 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6783 {
6784 float value2 = op2->f;
6785
6786 exp->type = 2;
6787 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
6788 if(!exp->expType)
6789 {
6790 exp->expType = op1->type;
6791 if(op1->type)
6792 op1->type->refCount++;
6793 }
6794 return 0x1;
6795 }
6796
6797 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6798 {
6799 double value2 = op2->d;
6800
6801 exp->type = 2;
6802 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
6803 if(!exp->expType)
6804 {
6805 exp->expType = op1->type;
6806 if(op1->type)
6807 op1->type->refCount++;
6808 }
6809 return 0x1;
6810 }
6811
6812 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6813 {
6814 int value2 = op2->i;
6815
6816 exp->type = 2;
6817 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
6818 if(!exp->expType)
6819 {
6820 exp->expType = op1->type;
6821 if(op1->type)
6822 op1->type->refCount++;
6823 }
6824 return 0x1;
6825 }
6826
6827 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6828 {
6829 unsigned int value2 = op2->ui;
6830
6831 exp->type = 2;
6832 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
6833 if(!exp->expType)
6834 {
6835 exp->expType = op1->type;
6836 if(op1->type)
6837 op1->type->refCount++;
6838 }
6839 return 0x1;
6840 }
6841
6842 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6843 {
6844 short value2 = op2->s;
6845
6846 exp->type = 2;
6847 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
6848 if(!exp->expType)
6849 {
6850 exp->expType = op1->type;
6851 if(op1->type)
6852 op1->type->refCount++;
6853 }
6854 return 0x1;
6855 }
6856
6857 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6858 {
6859 unsigned short value2 = op2->us;
6860
6861 exp->type = 2;
6862 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
6863 if(!exp->expType)
6864 {
6865 exp->expType = op1->type;
6866 if(op1->type)
6867 op1->type->refCount++;
6868 }
6869 return 0x1;
6870 }
6871
6872 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6873 {
6874 char value2 = op2->c;
6875
6876 exp->type = 2;
6877 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
6878 if(!exp->expType)
6879 {
6880 exp->expType = op1->type;
6881 if(op1->type)
6882 op1->type->refCount++;
6883 }
6884 return 0x1;
6885 }
6886
6887 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6888 {
6889 unsigned char value2 = op2->uc;
6890
6891 exp->type = 2;
6892 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
6893 if(!exp->expType)
6894 {
6895 exp->expType = op1->type;
6896 if(op1->type)
6897 op1->type->refCount++;
6898 }
6899 return 0x1;
6900 }
6901
6902 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6903 {
6904 int value2 = op2->i;
6905
6906 exp->type = 2;
6907 exp->string = PrintInt(op1->i & value2);
6908 if(!exp->expType)
6909 {
6910 exp->expType = op1->type;
6911 if(op1->type)
6912 op1->type->refCount++;
6913 }
6914 return 0x1;
6915 }
6916
6917 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6918 {
6919 unsigned int value2 = op2->ui;
6920
6921 exp->type = 2;
6922 exp->string = PrintUInt(op1->ui & value2);
6923 if(!exp->expType)
6924 {
6925 exp->expType = op1->type;
6926 if(op1->type)
6927 op1->type->refCount++;
6928 }
6929 return 0x1;
6930 }
6931
6932 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6933 {
6934 short value2 = op2->s;
6935
6936 exp->type = 2;
6937 exp->string = PrintShort(op1->s & value2);
6938 if(!exp->expType)
6939 {
6940 exp->expType = op1->type;
6941 if(op1->type)
6942 op1->type->refCount++;
6943 }
6944 return 0x1;
6945 }
6946
6947 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6948 {
6949 unsigned short value2 = op2->us;
6950
6951 exp->type = 2;
6952 exp->string = PrintUShort(op1->us & value2);
6953 if(!exp->expType)
6954 {
6955 exp->expType = op1->type;
6956 if(op1->type)
6957 op1->type->refCount++;
6958 }
6959 return 0x1;
6960 }
6961
6962 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6963 {
6964 char value2 = op2->c;
6965
6966 exp->type = 2;
6967 exp->string = PrintChar(op1->c & value2);
6968 if(!exp->expType)
6969 {
6970 exp->expType = op1->type;
6971 if(op1->type)
6972 op1->type->refCount++;
6973 }
6974 return 0x1;
6975 }
6976
6977 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6978 {
6979 unsigned char value2 = op2->uc;
6980
6981 exp->type = 2;
6982 exp->string = PrintUChar(op1->uc & value2);
6983 if(!exp->expType)
6984 {
6985 exp->expType = op1->type;
6986 if(op1->type)
6987 op1->type->refCount++;
6988 }
6989 return 0x1;
6990 }
6991
6992 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6993 {
6994 int value2 = op2->i;
6995
6996 exp->type = 2;
6997 exp->string = PrintInt(op1->i | value2);
6998 if(!exp->expType)
6999 {
7000 exp->expType = op1->type;
7001 if(op1->type)
7002 op1->type->refCount++;
7003 }
7004 return 0x1;
7005 }
7006
7007 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7008 {
7009 unsigned int value2 = op2->ui;
7010
7011 exp->type = 2;
7012 exp->string = PrintUInt(op1->ui | value2);
7013 if(!exp->expType)
7014 {
7015 exp->expType = op1->type;
7016 if(op1->type)
7017 op1->type->refCount++;
7018 }
7019 return 0x1;
7020 }
7021
7022 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7023 {
7024 short value2 = op2->s;
7025
7026 exp->type = 2;
7027 exp->string = PrintShort(op1->s | value2);
7028 if(!exp->expType)
7029 {
7030 exp->expType = op1->type;
7031 if(op1->type)
7032 op1->type->refCount++;
7033 }
7034 return 0x1;
7035 }
7036
7037 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7038 {
7039 unsigned short value2 = op2->us;
7040
7041 exp->type = 2;
7042 exp->string = PrintUShort(op1->us | value2);
7043 if(!exp->expType)
7044 {
7045 exp->expType = op1->type;
7046 if(op1->type)
7047 op1->type->refCount++;
7048 }
7049 return 0x1;
7050 }
7051
7052 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7053 {
7054 char value2 = op2->c;
7055
7056 exp->type = 2;
7057 exp->string = PrintChar(op1->c | value2);
7058 if(!exp->expType)
7059 {
7060 exp->expType = op1->type;
7061 if(op1->type)
7062 op1->type->refCount++;
7063 }
7064 return 0x1;
7065 }
7066
7067 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7068 {
7069 unsigned char value2 = op2->uc;
7070
7071 exp->type = 2;
7072 exp->string = PrintUChar(op1->uc | value2);
7073 if(!exp->expType)
7074 {
7075 exp->expType = op1->type;
7076 if(op1->type)
7077 op1->type->refCount++;
7078 }
7079 return 0x1;
7080 }
7081
7082 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7083 {
7084 int value2 = op2->i;
7085
7086 exp->type = 2;
7087 exp->string = PrintInt(op1->i ^ value2);
7088 if(!exp->expType)
7089 {
7090 exp->expType = op1->type;
7091 if(op1->type)
7092 op1->type->refCount++;
7093 }
7094 return 0x1;
7095 }
7096
7097 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7098 {
7099 unsigned int value2 = op2->ui;
7100
7101 exp->type = 2;
7102 exp->string = PrintUInt(op1->ui ^ value2);
7103 if(!exp->expType)
7104 {
7105 exp->expType = op1->type;
7106 if(op1->type)
7107 op1->type->refCount++;
7108 }
7109 return 0x1;
7110 }
7111
7112 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7113 {
7114 short value2 = op2->s;
7115
7116 exp->type = 2;
7117 exp->string = PrintShort(op1->s ^ value2);
7118 if(!exp->expType)
7119 {
7120 exp->expType = op1->type;
7121 if(op1->type)
7122 op1->type->refCount++;
7123 }
7124 return 0x1;
7125 }
7126
7127 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7128 {
7129 unsigned short value2 = op2->us;
7130
7131 exp->type = 2;
7132 exp->string = PrintUShort(op1->us ^ value2);
7133 if(!exp->expType)
7134 {
7135 exp->expType = op1->type;
7136 if(op1->type)
7137 op1->type->refCount++;
7138 }
7139 return 0x1;
7140 }
7141
7142 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7143 {
7144 char value2 = op2->c;
7145
7146 exp->type = 2;
7147 exp->string = PrintChar(op1->c ^ value2);
7148 if(!exp->expType)
7149 {
7150 exp->expType = op1->type;
7151 if(op1->type)
7152 op1->type->refCount++;
7153 }
7154 return 0x1;
7155 }
7156
7157 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7158 {
7159 unsigned char value2 = op2->uc;
7160
7161 exp->type = 2;
7162 exp->string = PrintUChar(op1->uc ^ value2);
7163 if(!exp->expType)
7164 {
7165 exp->expType = op1->type;
7166 if(op1->type)
7167 op1->type->refCount++;
7168 }
7169 return 0x1;
7170 }
7171
7172 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7173 {
7174 int value2 = op2->i;
7175
7176 exp->type = 2;
7177 exp->string = PrintInt(op1->i << value2);
7178 if(!exp->expType)
7179 {
7180 exp->expType = op1->type;
7181 if(op1->type)
7182 op1->type->refCount++;
7183 }
7184 return 0x1;
7185 }
7186
7187 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7188 {
7189 unsigned int value2 = op2->ui;
7190
7191 exp->type = 2;
7192 exp->string = PrintUInt(op1->ui << value2);
7193 if(!exp->expType)
7194 {
7195 exp->expType = op1->type;
7196 if(op1->type)
7197 op1->type->refCount++;
7198 }
7199 return 0x1;
7200 }
7201
7202 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7203 {
7204 short value2 = op2->s;
7205
7206 exp->type = 2;
7207 exp->string = PrintShort(op1->s << value2);
7208 if(!exp->expType)
7209 {
7210 exp->expType = op1->type;
7211 if(op1->type)
7212 op1->type->refCount++;
7213 }
7214 return 0x1;
7215 }
7216
7217 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7218 {
7219 unsigned short value2 = op2->us;
7220
7221 exp->type = 2;
7222 exp->string = PrintUShort(op1->us << value2);
7223 if(!exp->expType)
7224 {
7225 exp->expType = op1->type;
7226 if(op1->type)
7227 op1->type->refCount++;
7228 }
7229 return 0x1;
7230 }
7231
7232 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7233 {
7234 char value2 = op2->c;
7235
7236 exp->type = 2;
7237 exp->string = PrintChar(op1->c << value2);
7238 if(!exp->expType)
7239 {
7240 exp->expType = op1->type;
7241 if(op1->type)
7242 op1->type->refCount++;
7243 }
7244 return 0x1;
7245 }
7246
7247 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7248 {
7249 unsigned char value2 = op2->uc;
7250
7251 exp->type = 2;
7252 exp->string = PrintUChar(op1->uc << value2);
7253 if(!exp->expType)
7254 {
7255 exp->expType = op1->type;
7256 if(op1->type)
7257 op1->type->refCount++;
7258 }
7259 return 0x1;
7260 }
7261
7262 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7263 {
7264 int value2 = op2->i;
7265
7266 exp->type = 2;
7267 exp->string = PrintInt(op1->i >> value2);
7268 if(!exp->expType)
7269 {
7270 exp->expType = op1->type;
7271 if(op1->type)
7272 op1->type->refCount++;
7273 }
7274 return 0x1;
7275 }
7276
7277 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7278 {
7279 unsigned int value2 = op2->ui;
7280
7281 exp->type = 2;
7282 exp->string = PrintUInt(op1->ui >> value2);
7283 if(!exp->expType)
7284 {
7285 exp->expType = op1->type;
7286 if(op1->type)
7287 op1->type->refCount++;
7288 }
7289 return 0x1;
7290 }
7291
7292 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7293 {
7294 short value2 = op2->s;
7295
7296 exp->type = 2;
7297 exp->string = PrintShort(op1->s >> value2);
7298 if(!exp->expType)
7299 {
7300 exp->expType = op1->type;
7301 if(op1->type)
7302 op1->type->refCount++;
7303 }
7304 return 0x1;
7305 }
7306
7307 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7308 {
7309 unsigned short value2 = op2->us;
7310
7311 exp->type = 2;
7312 exp->string = PrintUShort(op1->us >> value2);
7313 if(!exp->expType)
7314 {
7315 exp->expType = op1->type;
7316 if(op1->type)
7317 op1->type->refCount++;
7318 }
7319 return 0x1;
7320 }
7321
7322 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7323 {
7324 char value2 = op2->c;
7325
7326 exp->type = 2;
7327 exp->string = PrintChar(op1->c >> value2);
7328 if(!exp->expType)
7329 {
7330 exp->expType = op1->type;
7331 if(op1->type)
7332 op1->type->refCount++;
7333 }
7334 return 0x1;
7335 }
7336
7337 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7338 {
7339 unsigned char value2 = op2->uc;
7340
7341 exp->type = 2;
7342 exp->string = PrintUChar(op1->uc >> value2);
7343 if(!exp->expType)
7344 {
7345 exp->expType = op1->type;
7346 if(op1->type)
7347 op1->type->refCount++;
7348 }
7349 return 0x1;
7350 }
7351
7352 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7353 {
7354 exp->type = 2;
7355 exp->string = PrintInt(~op1->i);
7356 if(!exp->expType)
7357 {
7358 exp->expType = op1->type;
7359 if(op1->type)
7360 op1->type->refCount++;
7361 }
7362 return 0x1;
7363 }
7364
7365 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7366 {
7367 exp->type = 2;
7368 exp->string = PrintUInt(~op1->ui);
7369 if(!exp->expType)
7370 {
7371 exp->expType = op1->type;
7372 if(op1->type)
7373 op1->type->refCount++;
7374 }
7375 return 0x1;
7376 }
7377
7378 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7379 {
7380 exp->type = 2;
7381 exp->string = PrintShort(~op1->s);
7382 if(!exp->expType)
7383 {
7384 exp->expType = op1->type;
7385 if(op1->type)
7386 op1->type->refCount++;
7387 }
7388 return 0x1;
7389 }
7390
7391 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7392 {
7393 exp->type = 2;
7394 exp->string = PrintUShort(~op1->us);
7395 if(!exp->expType)
7396 {
7397 exp->expType = op1->type;
7398 if(op1->type)
7399 op1->type->refCount++;
7400 }
7401 return 0x1;
7402 }
7403
7404 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7405 {
7406 exp->type = 2;
7407 exp->string = PrintChar(~op1->c);
7408 if(!exp->expType)
7409 {
7410 exp->expType = op1->type;
7411 if(op1->type)
7412 op1->type->refCount++;
7413 }
7414 return 0x1;
7415 }
7416
7417 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7418 {
7419 exp->type = 2;
7420 exp->string = PrintUChar(~op1->uc);
7421 if(!exp->expType)
7422 {
7423 exp->expType = op1->type;
7424 if(op1->type)
7425 op1->type->refCount++;
7426 }
7427 return 0x1;
7428 }
7429
7430 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7431 {
7432 int value2 = op2->i;
7433
7434 exp->type = 2;
7435 exp->string = PrintInt(op1->i &= value2);
7436 if(!exp->expType)
7437 {
7438 exp->expType = op1->type;
7439 if(op1->type)
7440 op1->type->refCount++;
7441 }
7442 return 0x1;
7443 }
7444
7445 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7446 {
7447 unsigned int value2 = op2->ui;
7448
7449 exp->type = 2;
7450 exp->string = PrintUInt(op1->ui &= value2);
7451 if(!exp->expType)
7452 {
7453 exp->expType = op1->type;
7454 if(op1->type)
7455 op1->type->refCount++;
7456 }
7457 return 0x1;
7458 }
7459
7460 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7461 {
7462 short value2 = op2->s;
7463
7464 exp->type = 2;
7465 exp->string = PrintShort(op1->s &= value2);
7466 if(!exp->expType)
7467 {
7468 exp->expType = op1->type;
7469 if(op1->type)
7470 op1->type->refCount++;
7471 }
7472 return 0x1;
7473 }
7474
7475 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7476 {
7477 unsigned short value2 = op2->us;
7478
7479 exp->type = 2;
7480 exp->string = PrintUShort(op1->us &= value2);
7481 if(!exp->expType)
7482 {
7483 exp->expType = op1->type;
7484 if(op1->type)
7485 op1->type->refCount++;
7486 }
7487 return 0x1;
7488 }
7489
7490 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7491 {
7492 char value2 = op2->c;
7493
7494 exp->type = 2;
7495 exp->string = PrintChar(op1->c &= value2);
7496 if(!exp->expType)
7497 {
7498 exp->expType = op1->type;
7499 if(op1->type)
7500 op1->type->refCount++;
7501 }
7502 return 0x1;
7503 }
7504
7505 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7506 {
7507 unsigned char value2 = op2->uc;
7508
7509 exp->type = 2;
7510 exp->string = PrintUChar(op1->uc &= value2);
7511 if(!exp->expType)
7512 {
7513 exp->expType = op1->type;
7514 if(op1->type)
7515 op1->type->refCount++;
7516 }
7517 return 0x1;
7518 }
7519
7520 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7521 {
7522 int value2 = op2->i;
7523
7524 exp->type = 2;
7525 exp->string = PrintInt(op1->i |= value2);
7526 if(!exp->expType)
7527 {
7528 exp->expType = op1->type;
7529 if(op1->type)
7530 op1->type->refCount++;
7531 }
7532 return 0x1;
7533 }
7534
7535 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7536 {
7537 unsigned int value2 = op2->ui;
7538
7539 exp->type = 2;
7540 exp->string = PrintUInt(op1->ui |= value2);
7541 if(!exp->expType)
7542 {
7543 exp->expType = op1->type;
7544 if(op1->type)
7545 op1->type->refCount++;
7546 }
7547 return 0x1;
7548 }
7549
7550 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7551 {
7552 short value2 = op2->s;
7553
7554 exp->type = 2;
7555 exp->string = PrintShort(op1->s |= value2);
7556 if(!exp->expType)
7557 {
7558 exp->expType = op1->type;
7559 if(op1->type)
7560 op1->type->refCount++;
7561 }
7562 return 0x1;
7563 }
7564
7565 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7566 {
7567 unsigned short value2 = op2->us;
7568
7569 exp->type = 2;
7570 exp->string = PrintUShort(op1->us |= value2);
7571 if(!exp->expType)
7572 {
7573 exp->expType = op1->type;
7574 if(op1->type)
7575 op1->type->refCount++;
7576 }
7577 return 0x1;
7578 }
7579
7580 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7581 {
7582 char value2 = op2->c;
7583
7584 exp->type = 2;
7585 exp->string = PrintChar(op1->c |= value2);
7586 if(!exp->expType)
7587 {
7588 exp->expType = op1->type;
7589 if(op1->type)
7590 op1->type->refCount++;
7591 }
7592 return 0x1;
7593 }
7594
7595 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7596 {
7597 unsigned char value2 = op2->uc;
7598
7599 exp->type = 2;
7600 exp->string = PrintUChar(op1->uc |= value2);
7601 if(!exp->expType)
7602 {
7603 exp->expType = op1->type;
7604 if(op1->type)
7605 op1->type->refCount++;
7606 }
7607 return 0x1;
7608 }
7609
7610 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7611 {
7612 int value2 = op2->i;
7613
7614 exp->type = 2;
7615 exp->string = PrintInt(op1->i ^= value2);
7616 if(!exp->expType)
7617 {
7618 exp->expType = op1->type;
7619 if(op1->type)
7620 op1->type->refCount++;
7621 }
7622 return 0x1;
7623 }
7624
7625 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7626 {
7627 unsigned int value2 = op2->ui;
7628
7629 exp->type = 2;
7630 exp->string = PrintUInt(op1->ui ^= value2);
7631 if(!exp->expType)
7632 {
7633 exp->expType = op1->type;
7634 if(op1->type)
7635 op1->type->refCount++;
7636 }
7637 return 0x1;
7638 }
7639
7640 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7641 {
7642 short value2 = op2->s;
7643
7644 exp->type = 2;
7645 exp->string = PrintShort(op1->s ^= value2);
7646 if(!exp->expType)
7647 {
7648 exp->expType = op1->type;
7649 if(op1->type)
7650 op1->type->refCount++;
7651 }
7652 return 0x1;
7653 }
7654
7655 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7656 {
7657 unsigned short value2 = op2->us;
7658
7659 exp->type = 2;
7660 exp->string = PrintUShort(op1->us ^= value2);
7661 if(!exp->expType)
7662 {
7663 exp->expType = op1->type;
7664 if(op1->type)
7665 op1->type->refCount++;
7666 }
7667 return 0x1;
7668 }
7669
7670 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7671 {
7672 char value2 = op2->c;
7673
7674 exp->type = 2;
7675 exp->string = PrintChar(op1->c ^= value2);
7676 if(!exp->expType)
7677 {
7678 exp->expType = op1->type;
7679 if(op1->type)
7680 op1->type->refCount++;
7681 }
7682 return 0x1;
7683 }
7684
7685 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7686 {
7687 unsigned char value2 = op2->uc;
7688
7689 exp->type = 2;
7690 exp->string = PrintUChar(op1->uc ^= value2);
7691 if(!exp->expType)
7692 {
7693 exp->expType = op1->type;
7694 if(op1->type)
7695 op1->type->refCount++;
7696 }
7697 return 0x1;
7698 }
7699
7700 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7701 {
7702 int value2 = op2->i;
7703
7704 exp->type = 2;
7705 exp->string = PrintInt(op1->i <<= value2);
7706 if(!exp->expType)
7707 {
7708 exp->expType = op1->type;
7709 if(op1->type)
7710 op1->type->refCount++;
7711 }
7712 return 0x1;
7713 }
7714
7715 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7716 {
7717 unsigned int value2 = op2->ui;
7718
7719 exp->type = 2;
7720 exp->string = PrintUInt(op1->ui <<= value2);
7721 if(!exp->expType)
7722 {
7723 exp->expType = op1->type;
7724 if(op1->type)
7725 op1->type->refCount++;
7726 }
7727 return 0x1;
7728 }
7729
7730 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7731 {
7732 short value2 = op2->s;
7733
7734 exp->type = 2;
7735 exp->string = PrintShort(op1->s <<= value2);
7736 if(!exp->expType)
7737 {
7738 exp->expType = op1->type;
7739 if(op1->type)
7740 op1->type->refCount++;
7741 }
7742 return 0x1;
7743 }
7744
7745 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7746 {
7747 unsigned short value2 = op2->us;
7748
7749 exp->type = 2;
7750 exp->string = PrintUShort(op1->us <<= value2);
7751 if(!exp->expType)
7752 {
7753 exp->expType = op1->type;
7754 if(op1->type)
7755 op1->type->refCount++;
7756 }
7757 return 0x1;
7758 }
7759
7760 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7761 {
7762 char value2 = op2->c;
7763
7764 exp->type = 2;
7765 exp->string = PrintChar(op1->c <<= value2);
7766 if(!exp->expType)
7767 {
7768 exp->expType = op1->type;
7769 if(op1->type)
7770 op1->type->refCount++;
7771 }
7772 return 0x1;
7773 }
7774
7775 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7776 {
7777 unsigned char value2 = op2->uc;
7778
7779 exp->type = 2;
7780 exp->string = PrintUChar(op1->uc <<= value2);
7781 if(!exp->expType)
7782 {
7783 exp->expType = op1->type;
7784 if(op1->type)
7785 op1->type->refCount++;
7786 }
7787 return 0x1;
7788 }
7789
7790 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7791 {
7792 int value2 = op2->i;
7793
7794 exp->type = 2;
7795 exp->string = PrintInt(op1->i >>= value2);
7796 if(!exp->expType)
7797 {
7798 exp->expType = op1->type;
7799 if(op1->type)
7800 op1->type->refCount++;
7801 }
7802 return 0x1;
7803 }
7804
7805 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7806 {
7807 unsigned int value2 = op2->ui;
7808
7809 exp->type = 2;
7810 exp->string = PrintUInt(op1->ui >>= value2);
7811 if(!exp->expType)
7812 {
7813 exp->expType = op1->type;
7814 if(op1->type)
7815 op1->type->refCount++;
7816 }
7817 return 0x1;
7818 }
7819
7820 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7821 {
7822 short value2 = op2->s;
7823
7824 exp->type = 2;
7825 exp->string = PrintShort(op1->s >>= value2);
7826 if(!exp->expType)
7827 {
7828 exp->expType = op1->type;
7829 if(op1->type)
7830 op1->type->refCount++;
7831 }
7832 return 0x1;
7833 }
7834
7835 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7836 {
7837 unsigned short value2 = op2->us;
7838
7839 exp->type = 2;
7840 exp->string = PrintUShort(op1->us >>= value2);
7841 if(!exp->expType)
7842 {
7843 exp->expType = op1->type;
7844 if(op1->type)
7845 op1->type->refCount++;
7846 }
7847 return 0x1;
7848 }
7849
7850 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7851 {
7852 char value2 = op2->c;
7853
7854 exp->type = 2;
7855 exp->string = PrintChar(op1->c >>= value2);
7856 if(!exp->expType)
7857 {
7858 exp->expType = op1->type;
7859 if(op1->type)
7860 op1->type->refCount++;
7861 }
7862 return 0x1;
7863 }
7864
7865 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7866 {
7867 unsigned char value2 = op2->uc;
7868
7869 exp->type = 2;
7870 exp->string = PrintUChar(op1->uc >>= value2);
7871 if(!exp->expType)
7872 {
7873 exp->expType = op1->type;
7874 if(op1->type)
7875 op1->type->refCount++;
7876 }
7877 return 0x1;
7878 }
7879
7880 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
7881 {
7882 exp->type = 2;
7883 exp->string = PrintInt(!op1->i);
7884 if(!exp->expType)
7885 {
7886 exp->expType = op1->type;
7887 if(op1->type)
7888 op1->type->refCount++;
7889 }
7890 return 0x1;
7891 }
7892
7893 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
7894 {
7895 exp->type = 2;
7896 exp->string = PrintUInt(!op1->ui);
7897 if(!exp->expType)
7898 {
7899 exp->expType = op1->type;
7900 if(op1->type)
7901 op1->type->refCount++;
7902 }
7903 return 0x1;
7904 }
7905
7906 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
7907 {
7908 exp->type = 2;
7909 exp->string = PrintShort(!op1->s);
7910 if(!exp->expType)
7911 {
7912 exp->expType = op1->type;
7913 if(op1->type)
7914 op1->type->refCount++;
7915 }
7916 return 0x1;
7917 }
7918
7919 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
7920 {
7921 exp->type = 2;
7922 exp->string = PrintUShort(!op1->us);
7923 if(!exp->expType)
7924 {
7925 exp->expType = op1->type;
7926 if(op1->type)
7927 op1->type->refCount++;
7928 }
7929 return 0x1;
7930 }
7931
7932 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
7933 {
7934 exp->type = 2;
7935 exp->string = PrintChar(!op1->c);
7936 if(!exp->expType)
7937 {
7938 exp->expType = op1->type;
7939 if(op1->type)
7940 op1->type->refCount++;
7941 }
7942 return 0x1;
7943 }
7944
7945 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
7946 {
7947 exp->type = 2;
7948 exp->string = PrintUChar(!op1->uc);
7949 if(!exp->expType)
7950 {
7951 exp->expType = op1->type;
7952 if(op1->type)
7953 op1->type->refCount++;
7954 }
7955 return 0x1;
7956 }
7957
7958 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7959 {
7960 int value2 = op2->i;
7961
7962 exp->type = 2;
7963 exp->string = PrintInt(op1->i == value2);
7964 if(!exp->expType)
7965 {
7966 exp->expType = op1->type;
7967 if(op1->type)
7968 op1->type->refCount++;
7969 }
7970 return 0x1;
7971 }
7972
7973 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7974 {
7975 unsigned int value2 = op2->ui;
7976
7977 exp->type = 2;
7978 exp->string = PrintUInt(op1->ui == value2);
7979 if(!exp->expType)
7980 {
7981 exp->expType = op1->type;
7982 if(op1->type)
7983 op1->type->refCount++;
7984 }
7985 return 0x1;
7986 }
7987
7988 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7989 {
7990 short value2 = op2->s;
7991
7992 exp->type = 2;
7993 exp->string = PrintShort(op1->s == value2);
7994 if(!exp->expType)
7995 {
7996 exp->expType = op1->type;
7997 if(op1->type)
7998 op1->type->refCount++;
7999 }
8000 return 0x1;
8001 }
8002
8003 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8004 {
8005 unsigned short value2 = op2->us;
8006
8007 exp->type = 2;
8008 exp->string = PrintUShort(op1->us == value2);
8009 if(!exp->expType)
8010 {
8011 exp->expType = op1->type;
8012 if(op1->type)
8013 op1->type->refCount++;
8014 }
8015 return 0x1;
8016 }
8017
8018 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8019 {
8020 char value2 = op2->c;
8021
8022 exp->type = 2;
8023 exp->string = PrintChar(op1->c == value2);
8024 if(!exp->expType)
8025 {
8026 exp->expType = op1->type;
8027 if(op1->type)
8028 op1->type->refCount++;
8029 }
8030 return 0x1;
8031 }
8032
8033 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8034 {
8035 unsigned char value2 = op2->uc;
8036
8037 exp->type = 2;
8038 exp->string = PrintUChar(op1->uc == value2);
8039 if(!exp->expType)
8040 {
8041 exp->expType = op1->type;
8042 if(op1->type)
8043 op1->type->refCount++;
8044 }
8045 return 0x1;
8046 }
8047
8048 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8049 {
8050 float value2 = op2->f;
8051
8052 exp->type = 2;
8053 exp->string = PrintFloat(op1->f == value2);
8054 if(!exp->expType)
8055 {
8056 exp->expType = op1->type;
8057 if(op1->type)
8058 op1->type->refCount++;
8059 }
8060 return 0x1;
8061 }
8062
8063 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8064 {
8065 double value2 = op2->d;
8066
8067 exp->type = 2;
8068 exp->string = PrintDouble(op1->d == value2);
8069 if(!exp->expType)
8070 {
8071 exp->expType = op1->type;
8072 if(op1->type)
8073 op1->type->refCount++;
8074 }
8075 return 0x1;
8076 }
8077
8078 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8079 {
8080 int value2 = op2->i;
8081
8082 exp->type = 2;
8083 exp->string = PrintInt(op1->i != value2);
8084 if(!exp->expType)
8085 {
8086 exp->expType = op1->type;
8087 if(op1->type)
8088 op1->type->refCount++;
8089 }
8090 return 0x1;
8091 }
8092
8093 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8094 {
8095 unsigned int value2 = op2->ui;
8096
8097 exp->type = 2;
8098 exp->string = PrintUInt(op1->ui != value2);
8099 if(!exp->expType)
8100 {
8101 exp->expType = op1->type;
8102 if(op1->type)
8103 op1->type->refCount++;
8104 }
8105 return 0x1;
8106 }
8107
8108 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8109 {
8110 short value2 = op2->s;
8111
8112 exp->type = 2;
8113 exp->string = PrintShort(op1->s != value2);
8114 if(!exp->expType)
8115 {
8116 exp->expType = op1->type;
8117 if(op1->type)
8118 op1->type->refCount++;
8119 }
8120 return 0x1;
8121 }
8122
8123 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8124 {
8125 unsigned short value2 = op2->us;
8126
8127 exp->type = 2;
8128 exp->string = PrintUShort(op1->us != value2);
8129 if(!exp->expType)
8130 {
8131 exp->expType = op1->type;
8132 if(op1->type)
8133 op1->type->refCount++;
8134 }
8135 return 0x1;
8136 }
8137
8138 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8139 {
8140 char value2 = op2->c;
8141
8142 exp->type = 2;
8143 exp->string = PrintChar(op1->c != value2);
8144 if(!exp->expType)
8145 {
8146 exp->expType = op1->type;
8147 if(op1->type)
8148 op1->type->refCount++;
8149 }
8150 return 0x1;
8151 }
8152
8153 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8154 {
8155 unsigned char value2 = op2->uc;
8156
8157 exp->type = 2;
8158 exp->string = PrintUChar(op1->uc != value2);
8159 if(!exp->expType)
8160 {
8161 exp->expType = op1->type;
8162 if(op1->type)
8163 op1->type->refCount++;
8164 }
8165 return 0x1;
8166 }
8167
8168 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8169 {
8170 float value2 = op2->f;
8171
8172 exp->type = 2;
8173 exp->string = PrintFloat(op1->f != value2);
8174 if(!exp->expType)
8175 {
8176 exp->expType = op1->type;
8177 if(op1->type)
8178 op1->type->refCount++;
8179 }
8180 return 0x1;
8181 }
8182
8183 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8184 {
8185 double value2 = op2->d;
8186
8187 exp->type = 2;
8188 exp->string = PrintDouble(op1->d != value2);
8189 if(!exp->expType)
8190 {
8191 exp->expType = op1->type;
8192 if(op1->type)
8193 op1->type->refCount++;
8194 }
8195 return 0x1;
8196 }
8197
8198 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8199 {
8200 int value2 = op2->i;
8201
8202 exp->type = 2;
8203 exp->string = PrintInt(op1->i && value2);
8204 if(!exp->expType)
8205 {
8206 exp->expType = op1->type;
8207 if(op1->type)
8208 op1->type->refCount++;
8209 }
8210 return 0x1;
8211 }
8212
8213 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8214 {
8215 unsigned int value2 = op2->ui;
8216
8217 exp->type = 2;
8218 exp->string = PrintUInt(op1->ui && value2);
8219 if(!exp->expType)
8220 {
8221 exp->expType = op1->type;
8222 if(op1->type)
8223 op1->type->refCount++;
8224 }
8225 return 0x1;
8226 }
8227
8228 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8229 {
8230 short value2 = op2->s;
8231
8232 exp->type = 2;
8233 exp->string = PrintShort(op1->s && value2);
8234 if(!exp->expType)
8235 {
8236 exp->expType = op1->type;
8237 if(op1->type)
8238 op1->type->refCount++;
8239 }
8240 return 0x1;
8241 }
8242
8243 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8244 {
8245 unsigned short value2 = op2->us;
8246
8247 exp->type = 2;
8248 exp->string = PrintUShort(op1->us && value2);
8249 if(!exp->expType)
8250 {
8251 exp->expType = op1->type;
8252 if(op1->type)
8253 op1->type->refCount++;
8254 }
8255 return 0x1;
8256 }
8257
8258 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8259 {
8260 char value2 = op2->c;
8261
8262 exp->type = 2;
8263 exp->string = PrintChar(op1->c && value2);
8264 if(!exp->expType)
8265 {
8266 exp->expType = op1->type;
8267 if(op1->type)
8268 op1->type->refCount++;
8269 }
8270 return 0x1;
8271 }
8272
8273 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8274 {
8275 unsigned char value2 = op2->uc;
8276
8277 exp->type = 2;
8278 exp->string = PrintUChar(op1->uc && value2);
8279 if(!exp->expType)
8280 {
8281 exp->expType = op1->type;
8282 if(op1->type)
8283 op1->type->refCount++;
8284 }
8285 return 0x1;
8286 }
8287
8288 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8289 {
8290 float value2 = op2->f;
8291
8292 exp->type = 2;
8293 exp->string = PrintFloat(op1->f && value2);
8294 if(!exp->expType)
8295 {
8296 exp->expType = op1->type;
8297 if(op1->type)
8298 op1->type->refCount++;
8299 }
8300 return 0x1;
8301 }
8302
8303 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8304 {
8305 double value2 = op2->d;
8306
8307 exp->type = 2;
8308 exp->string = PrintDouble(op1->d && value2);
8309 if(!exp->expType)
8310 {
8311 exp->expType = op1->type;
8312 if(op1->type)
8313 op1->type->refCount++;
8314 }
8315 return 0x1;
8316 }
8317
8318 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8319 {
8320 int value2 = op2->i;
8321
8322 exp->type = 2;
8323 exp->string = PrintInt(op1->i || value2);
8324 if(!exp->expType)
8325 {
8326 exp->expType = op1->type;
8327 if(op1->type)
8328 op1->type->refCount++;
8329 }
8330 return 0x1;
8331 }
8332
8333 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8334 {
8335 unsigned int value2 = op2->ui;
8336
8337 exp->type = 2;
8338 exp->string = PrintUInt(op1->ui || value2);
8339 if(!exp->expType)
8340 {
8341 exp->expType = op1->type;
8342 if(op1->type)
8343 op1->type->refCount++;
8344 }
8345 return 0x1;
8346 }
8347
8348 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8349 {
8350 short value2 = op2->s;
8351
8352 exp->type = 2;
8353 exp->string = PrintShort(op1->s || value2);
8354 if(!exp->expType)
8355 {
8356 exp->expType = op1->type;
8357 if(op1->type)
8358 op1->type->refCount++;
8359 }
8360 return 0x1;
8361 }
8362
8363 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8364 {
8365 unsigned short value2 = op2->us;
8366
8367 exp->type = 2;
8368 exp->string = PrintUShort(op1->us || value2);
8369 if(!exp->expType)
8370 {
8371 exp->expType = op1->type;
8372 if(op1->type)
8373 op1->type->refCount++;
8374 }
8375 return 0x1;
8376 }
8377
8378 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8379 {
8380 char value2 = op2->c;
8381
8382 exp->type = 2;
8383 exp->string = PrintChar(op1->c || value2);
8384 if(!exp->expType)
8385 {
8386 exp->expType = op1->type;
8387 if(op1->type)
8388 op1->type->refCount++;
8389 }
8390 return 0x1;
8391 }
8392
8393 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8394 {
8395 unsigned char value2 = op2->uc;
8396
8397 exp->type = 2;
8398 exp->string = PrintUChar(op1->uc || value2);
8399 if(!exp->expType)
8400 {
8401 exp->expType = op1->type;
8402 if(op1->type)
8403 op1->type->refCount++;
8404 }
8405 return 0x1;
8406 }
8407
8408 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8409 {
8410 float value2 = op2->f;
8411
8412 exp->type = 2;
8413 exp->string = PrintFloat(op1->f || value2);
8414 if(!exp->expType)
8415 {
8416 exp->expType = op1->type;
8417 if(op1->type)
8418 op1->type->refCount++;
8419 }
8420 return 0x1;
8421 }
8422
8423 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8424 {
8425 double value2 = op2->d;
8426
8427 exp->type = 2;
8428 exp->string = PrintDouble(op1->d || value2);
8429 if(!exp->expType)
8430 {
8431 exp->expType = op1->type;
8432 if(op1->type)
8433 op1->type->refCount++;
8434 }
8435 return 0x1;
8436 }
8437
8438 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8439 {
8440 int value2 = op2->i;
8441
8442 exp->type = 2;
8443 exp->string = PrintInt(op1->i > value2);
8444 if(!exp->expType)
8445 {
8446 exp->expType = op1->type;
8447 if(op1->type)
8448 op1->type->refCount++;
8449 }
8450 return 0x1;
8451 }
8452
8453 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8454 {
8455 unsigned int value2 = op2->ui;
8456
8457 exp->type = 2;
8458 exp->string = PrintUInt(op1->ui > value2);
8459 if(!exp->expType)
8460 {
8461 exp->expType = op1->type;
8462 if(op1->type)
8463 op1->type->refCount++;
8464 }
8465 return 0x1;
8466 }
8467
8468 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8469 {
8470 short value2 = op2->s;
8471
8472 exp->type = 2;
8473 exp->string = PrintShort(op1->s > value2);
8474 if(!exp->expType)
8475 {
8476 exp->expType = op1->type;
8477 if(op1->type)
8478 op1->type->refCount++;
8479 }
8480 return 0x1;
8481 }
8482
8483 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8484 {
8485 unsigned short value2 = op2->us;
8486
8487 exp->type = 2;
8488 exp->string = PrintUShort(op1->us > value2);
8489 if(!exp->expType)
8490 {
8491 exp->expType = op1->type;
8492 if(op1->type)
8493 op1->type->refCount++;
8494 }
8495 return 0x1;
8496 }
8497
8498 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8499 {
8500 char value2 = op2->c;
8501
8502 exp->type = 2;
8503 exp->string = PrintChar(op1->c > value2);
8504 if(!exp->expType)
8505 {
8506 exp->expType = op1->type;
8507 if(op1->type)
8508 op1->type->refCount++;
8509 }
8510 return 0x1;
8511 }
8512
8513 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8514 {
8515 unsigned char value2 = op2->uc;
8516
8517 exp->type = 2;
8518 exp->string = PrintUChar(op1->uc > value2);
8519 if(!exp->expType)
8520 {
8521 exp->expType = op1->type;
8522 if(op1->type)
8523 op1->type->refCount++;
8524 }
8525 return 0x1;
8526 }
8527
8528 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8529 {
8530 float value2 = op2->f;
8531
8532 exp->type = 2;
8533 exp->string = PrintFloat(op1->f > value2);
8534 if(!exp->expType)
8535 {
8536 exp->expType = op1->type;
8537 if(op1->type)
8538 op1->type->refCount++;
8539 }
8540 return 0x1;
8541 }
8542
8543 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8544 {
8545 double value2 = op2->d;
8546
8547 exp->type = 2;
8548 exp->string = PrintDouble(op1->d > value2);
8549 if(!exp->expType)
8550 {
8551 exp->expType = op1->type;
8552 if(op1->type)
8553 op1->type->refCount++;
8554 }
8555 return 0x1;
8556 }
8557
8558 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8559 {
8560 int value2 = op2->i;
8561
8562 exp->type = 2;
8563 exp->string = PrintInt(op1->i < value2);
8564 if(!exp->expType)
8565 {
8566 exp->expType = op1->type;
8567 if(op1->type)
8568 op1->type->refCount++;
8569 }
8570 return 0x1;
8571 }
8572
8573 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8574 {
8575 unsigned int value2 = op2->ui;
8576
8577 exp->type = 2;
8578 exp->string = PrintUInt(op1->ui < value2);
8579 if(!exp->expType)
8580 {
8581 exp->expType = op1->type;
8582 if(op1->type)
8583 op1->type->refCount++;
8584 }
8585 return 0x1;
8586 }
8587
8588 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8589 {
8590 short value2 = op2->s;
8591
8592 exp->type = 2;
8593 exp->string = PrintShort(op1->s < value2);
8594 if(!exp->expType)
8595 {
8596 exp->expType = op1->type;
8597 if(op1->type)
8598 op1->type->refCount++;
8599 }
8600 return 0x1;
8601 }
8602
8603 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8604 {
8605 unsigned short value2 = op2->us;
8606
8607 exp->type = 2;
8608 exp->string = PrintUShort(op1->us < value2);
8609 if(!exp->expType)
8610 {
8611 exp->expType = op1->type;
8612 if(op1->type)
8613 op1->type->refCount++;
8614 }
8615 return 0x1;
8616 }
8617
8618 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8619 {
8620 char value2 = op2->c;
8621
8622 exp->type = 2;
8623 exp->string = PrintChar(op1->c < value2);
8624 if(!exp->expType)
8625 {
8626 exp->expType = op1->type;
8627 if(op1->type)
8628 op1->type->refCount++;
8629 }
8630 return 0x1;
8631 }
8632
8633 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8634 {
8635 unsigned char value2 = op2->uc;
8636
8637 exp->type = 2;
8638 exp->string = PrintUChar(op1->uc < value2);
8639 if(!exp->expType)
8640 {
8641 exp->expType = op1->type;
8642 if(op1->type)
8643 op1->type->refCount++;
8644 }
8645 return 0x1;
8646 }
8647
8648 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8649 {
8650 float value2 = op2->f;
8651
8652 exp->type = 2;
8653 exp->string = PrintFloat(op1->f < value2);
8654 if(!exp->expType)
8655 {
8656 exp->expType = op1->type;
8657 if(op1->type)
8658 op1->type->refCount++;
8659 }
8660 return 0x1;
8661 }
8662
8663 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8664 {
8665 double value2 = op2->d;
8666
8667 exp->type = 2;
8668 exp->string = PrintDouble(op1->d < value2);
8669 if(!exp->expType)
8670 {
8671 exp->expType = op1->type;
8672 if(op1->type)
8673 op1->type->refCount++;
8674 }
8675 return 0x1;
8676 }
8677
8678 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8679 {
8680 int value2 = op2->i;
8681
8682 exp->type = 2;
8683 exp->string = PrintInt(op1->i >= value2);
8684 if(!exp->expType)
8685 {
8686 exp->expType = op1->type;
8687 if(op1->type)
8688 op1->type->refCount++;
8689 }
8690 return 0x1;
8691 }
8692
8693 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8694 {
8695 unsigned int value2 = op2->ui;
8696
8697 exp->type = 2;
8698 exp->string = PrintUInt(op1->ui >= value2);
8699 if(!exp->expType)
8700 {
8701 exp->expType = op1->type;
8702 if(op1->type)
8703 op1->type->refCount++;
8704 }
8705 return 0x1;
8706 }
8707
8708 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8709 {
8710 short value2 = op2->s;
8711
8712 exp->type = 2;
8713 exp->string = PrintShort(op1->s >= value2);
8714 if(!exp->expType)
8715 {
8716 exp->expType = op1->type;
8717 if(op1->type)
8718 op1->type->refCount++;
8719 }
8720 return 0x1;
8721 }
8722
8723 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8724 {
8725 unsigned short value2 = op2->us;
8726
8727 exp->type = 2;
8728 exp->string = PrintUShort(op1->us >= value2);
8729 if(!exp->expType)
8730 {
8731 exp->expType = op1->type;
8732 if(op1->type)
8733 op1->type->refCount++;
8734 }
8735 return 0x1;
8736 }
8737
8738 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8739 {
8740 char value2 = op2->c;
8741
8742 exp->type = 2;
8743 exp->string = PrintChar(op1->c >= value2);
8744 if(!exp->expType)
8745 {
8746 exp->expType = op1->type;
8747 if(op1->type)
8748 op1->type->refCount++;
8749 }
8750 return 0x1;
8751 }
8752
8753 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8754 {
8755 unsigned char value2 = op2->uc;
8756
8757 exp->type = 2;
8758 exp->string = PrintUChar(op1->uc >= value2);
8759 if(!exp->expType)
8760 {
8761 exp->expType = op1->type;
8762 if(op1->type)
8763 op1->type->refCount++;
8764 }
8765 return 0x1;
8766 }
8767
8768 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8769 {
8770 float value2 = op2->f;
8771
8772 exp->type = 2;
8773 exp->string = PrintFloat(op1->f >= value2);
8774 if(!exp->expType)
8775 {
8776 exp->expType = op1->type;
8777 if(op1->type)
8778 op1->type->refCount++;
8779 }
8780 return 0x1;
8781 }
8782
8783 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8784 {
8785 double value2 = op2->d;
8786
8787 exp->type = 2;
8788 exp->string = PrintDouble(op1->d >= value2);
8789 if(!exp->expType)
8790 {
8791 exp->expType = op1->type;
8792 if(op1->type)
8793 op1->type->refCount++;
8794 }
8795 return 0x1;
8796 }
8797
8798 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8799 {
8800 int value2 = op2->i;
8801
8802 exp->type = 2;
8803 exp->string = PrintInt(op1->i <= value2);
8804 if(!exp->expType)
8805 {
8806 exp->expType = op1->type;
8807 if(op1->type)
8808 op1->type->refCount++;
8809 }
8810 return 0x1;
8811 }
8812
8813 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8814 {
8815 unsigned int value2 = op2->ui;
8816
8817 exp->type = 2;
8818 exp->string = PrintUInt(op1->ui <= value2);
8819 if(!exp->expType)
8820 {
8821 exp->expType = op1->type;
8822 if(op1->type)
8823 op1->type->refCount++;
8824 }
8825 return 0x1;
8826 }
8827
8828 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8829 {
8830 short value2 = op2->s;
8831
8832 exp->type = 2;
8833 exp->string = PrintShort(op1->s <= value2);
8834 if(!exp->expType)
8835 {
8836 exp->expType = op1->type;
8837 if(op1->type)
8838 op1->type->refCount++;
8839 }
8840 return 0x1;
8841 }
8842
8843 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8844 {
8845 unsigned short value2 = op2->us;
8846
8847 exp->type = 2;
8848 exp->string = PrintUShort(op1->us <= value2);
8849 if(!exp->expType)
8850 {
8851 exp->expType = op1->type;
8852 if(op1->type)
8853 op1->type->refCount++;
8854 }
8855 return 0x1;
8856 }
8857
8858 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8859 {
8860 char value2 = op2->c;
8861
8862 exp->type = 2;
8863 exp->string = PrintChar(op1->c <= value2);
8864 if(!exp->expType)
8865 {
8866 exp->expType = op1->type;
8867 if(op1->type)
8868 op1->type->refCount++;
8869 }
8870 return 0x1;
8871 }
8872
8873 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8874 {
8875 unsigned char value2 = op2->uc;
8876
8877 exp->type = 2;
8878 exp->string = PrintUChar(op1->uc <= value2);
8879 if(!exp->expType)
8880 {
8881 exp->expType = op1->type;
8882 if(op1->type)
8883 op1->type->refCount++;
8884 }
8885 return 0x1;
8886 }
8887
8888 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8889 {
8890 float value2 = op2->f;
8891
8892 exp->type = 2;
8893 exp->string = PrintFloat(op1->f <= value2);
8894 if(!exp->expType)
8895 {
8896 exp->expType = op1->type;
8897 if(op1->type)
8898 op1->type->refCount++;
8899 }
8900 return 0x1;
8901 }
8902
8903 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8904 {
8905 double value2 = op2->d;
8906
8907 exp->type = 2;
8908 exp->string = PrintDouble(op1->d <= value2);
8909 if(!exp->expType)
8910 {
8911 exp->expType = op1->type;
8912 if(op1->type)
8913 op1->type->refCount++;
8914 }
8915 return 0x1;
8916 }
8917
8918 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8919 {
8920 exp->type = 2;
8921 exp->string = PrintInt(op1->i ? op2->i : op3->i);
8922 if(!exp->expType)
8923 {
8924 exp->expType = op1->type;
8925 if(op1->type)
8926 op1->type->refCount++;
8927 }
8928 return 0x1;
8929 }
8930
8931 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8932 {
8933 exp->type = 2;
8934 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
8935 if(!exp->expType)
8936 {
8937 exp->expType = op1->type;
8938 if(op1->type)
8939 op1->type->refCount++;
8940 }
8941 return 0x1;
8942 }
8943
8944 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8945 {
8946 exp->type = 2;
8947 exp->string = PrintShort(op1->s ? op2->s : op3->s);
8948 if(!exp->expType)
8949 {
8950 exp->expType = op1->type;
8951 if(op1->type)
8952 op1->type->refCount++;
8953 }
8954 return 0x1;
8955 }
8956
8957 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8958 {
8959 exp->type = 2;
8960 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
8961 if(!exp->expType)
8962 {
8963 exp->expType = op1->type;
8964 if(op1->type)
8965 op1->type->refCount++;
8966 }
8967 return 0x1;
8968 }
8969
8970 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8971 {
8972 exp->type = 2;
8973 exp->string = PrintChar(op1->c ? op2->c : op3->c);
8974 if(!exp->expType)
8975 {
8976 exp->expType = op1->type;
8977 if(op1->type)
8978 op1->type->refCount++;
8979 }
8980 return 0x1;
8981 }
8982
8983 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8984 {
8985 exp->type = 2;
8986 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
8987 if(!exp->expType)
8988 {
8989 exp->expType = op1->type;
8990 if(op1->type)
8991 op1->type->refCount++;
8992 }
8993 return 0x1;
8994 }
8995
8996 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8997 {
8998 exp->type = 2;
8999 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9000 if(!exp->expType)
9001 {
9002 exp->expType = op1->type;
9003 if(op1->type)
9004 op1->type->refCount++;
9005 }
9006 return 0x1;
9007 }
9008
9009 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9010 {
9011 exp->type = 2;
9012 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9013 if(!exp->expType)
9014 {
9015 exp->expType = op1->type;
9016 if(op1->type)
9017 op1->type->refCount++;
9018 }
9019 return 0x1;
9020 }
9021
9022 struct OpTable intOps = 
9023 {
9024 IntAdd, IntSub, IntMul, IntDiv, IntMod, IntNeg, IntInc, IntDec, IntAsign, IntAddAsign, IntSubAsign, IntMulAsign, IntDivAsign, IntModAsign, IntBitAnd, IntBitOr, IntBitXor, IntLShift, IntRShift, IntBitNot, IntAndAsign, IntOrAsign, IntXorAsign, IntLShiftAsign, IntRShiftAsign, IntNot, IntEqu, IntNqu, IntAnd, IntOr, IntGrt, IntSma, IntGrtEqu, IntSmaEqu, IntCond
9025 };
9026
9027 struct OpTable uintOps = 
9028 {
9029 UIntAdd, UIntSub, UIntMul, UIntDiv, UIntMod, UIntNeg, UIntInc, UIntDec, UIntAsign, UIntAddAsign, UIntSubAsign, UIntMulAsign, UIntDivAsign, UIntModAsign, UIntBitAnd, UIntBitOr, UIntBitXor, UIntLShift, UIntRShift, UIntBitNot, UIntAndAsign, UIntOrAsign, UIntXorAsign, UIntLShiftAsign, UIntRShiftAsign, UIntNot, UIntEqu, UIntNqu, UIntAnd, UIntOr, UIntGrt, UIntSma, UIntGrtEqu, UIntSmaEqu, UIntCond
9030 };
9031
9032 struct OpTable shortOps = 
9033 {
9034 ShortAdd, ShortSub, ShortMul, ShortDiv, ShortMod, ShortNeg, ShortInc, ShortDec, ShortAsign, ShortAddAsign, ShortSubAsign, ShortMulAsign, ShortDivAsign, ShortModAsign, ShortBitAnd, ShortBitOr, ShortBitXor, ShortLShift, ShortRShift, ShortBitNot, ShortAndAsign, ShortOrAsign, ShortXorAsign, ShortLShiftAsign, ShortRShiftAsign, ShortNot, ShortEqu, ShortNqu, ShortAnd, ShortOr, ShortGrt, ShortSma, ShortGrtEqu, ShortSmaEqu, ShortCond
9035 };
9036
9037 struct OpTable ushortOps = 
9038 {
9039 UShortAdd, UShortSub, UShortMul, UShortDiv, UShortMod, UShortNeg, UShortInc, UShortDec, UShortAsign, UShortAddAsign, UShortSubAsign, UShortMulAsign, UShortDivAsign, UShortModAsign, UShortBitAnd, UShortBitOr, UShortBitXor, UShortLShift, UShortRShift, UShortBitNot, UShortAndAsign, UShortOrAsign, UShortXorAsign, UShortLShiftAsign, UShortRShiftAsign, UShortNot, UShortEqu, UShortNqu, UShortAnd, UShortOr, UShortGrt, UShortSma, UShortGrtEqu, UShortSmaEqu, UShortCond
9040 };
9041
9042 struct OpTable floatOps = 
9043 {
9044 FloatAdd, FloatSub, FloatMul, FloatDiv, (((void *)0)), FloatNeg, FloatInc, FloatDec, FloatAsign, FloatAddAsign, FloatSubAsign, FloatMulAsign, FloatDivAsign, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), FloatEqu, FloatNqu, FloatAnd, FloatOr, FloatGrt, FloatSma, FloatGrtEqu, FloatSmaEqu
9045 };
9046
9047 struct OpTable doubleOps = 
9048 {
9049 DoubleAdd, DoubleSub, DoubleMul, DoubleDiv, (((void *)0)), DoubleNeg, DoubleInc, DoubleDec, DoubleAsign, DoubleAddAsign, DoubleSubAsign, DoubleMulAsign, DoubleDivAsign, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)), DoubleEqu, DoubleNqu, DoubleAnd, DoubleOr, DoubleGrt, DoubleSma, DoubleGrtEqu, DoubleSmaEqu
9050 };
9051
9052 struct OpTable charOps = 
9053 {
9054 CharAdd, CharSub, CharMul, CharDiv, CharMod, CharNeg, CharInc, CharDec, CharAsign, CharAddAsign, CharSubAsign, CharMulAsign, CharDivAsign, CharModAsign, CharBitAnd, CharBitOr, CharBitXor, CharLShift, CharRShift, CharBitNot, CharAndAsign, CharOrAsign, CharXorAsign, CharLShiftAsign, CharRShiftAsign, CharNot, CharEqu, CharNqu, CharAnd, CharOr, CharGrt, CharSma, CharGrtEqu, CharSmaEqu, CharCond
9055 };
9056
9057 struct OpTable ucharOps = 
9058 {
9059 UCharAdd, UCharSub, UCharMul, UCharDiv, UCharMod, UCharNeg, UCharInc, UCharDec, UCharAsign, UCharAddAsign, UCharSubAsign, UCharMulAsign, UCharDivAsign, UCharModAsign, UCharBitAnd, UCharBitOr, UCharBitXor, UCharLShift, UCharRShift, UCharBitNot, UCharAndAsign, UCharOrAsign, UCharXorAsign, UCharLShiftAsign, UCharRShiftAsign, UCharNot, UCharEqu, UCharNqu, UCharAnd, UCharOr, UCharGrt, UCharSma, UCharGrtEqu, UCharSmaEqu, UCharCond
9060 };
9061
9062 void ReadString(char * output, char * string)
9063 {
9064 int len = strlen(string);
9065 int c, d = 0;
9066 unsigned int quoted = 0x0, escaped = 0x0;
9067
9068 for(c = 0; c < len; c++)
9069 {
9070 char ch = string[c];
9071
9072 if(escaped)
9073 {
9074 switch(ch)
9075 {
9076 case 'n':
9077 output[d] = '\n';
9078 break;
9079 case 't':
9080 output[d] = '\t';
9081 break;
9082 case 'a':
9083 output[d] = '\a';
9084 break;
9085 case 'b':
9086 output[d] = '\b';
9087 break;
9088 case 'f':
9089 output[d] = '\f';
9090 break;
9091 case 'r':
9092 output[d] = '\r';
9093 break;
9094 case 'v':
9095 output[d] = '\v';
9096 break;
9097 case '\\':
9098 output[d] = '\\';
9099 break;
9100 case '\"':
9101 output[d] = '\"';
9102 break;
9103 default:
9104 output[d++] = '\\';
9105 output[d] = ch;
9106 }
9107 d++;
9108 escaped = 0x0;
9109 }
9110 else
9111 {
9112 if(ch == '\"')
9113 quoted ^= 0x1;
9114 else if(quoted)
9115 {
9116 if(ch == '\\')
9117 escaped = 0x1;
9118 else
9119 output[d++] = ch;
9120 }
9121 }
9122 }
9123 output[d] = '\0';
9124 }
9125
9126 extern double strtod(char * , char * * );
9127
9128 struct Operand GetOperand(struct Expression * exp)
9129 {
9130 struct Operand op = 
9131 {
9132 0, 0, 0, 0, 
9133 {
9134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9135 }
9136 };
9137 struct Type * type = exp->expType;
9138
9139 if(type)
9140 {
9141 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9142 {
9143 if(!type->_class->registered->dataType)
9144 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9145 type = type->_class->registered->dataType;
9146 }
9147 op.kind = type->kind;
9148 op.type = exp->expType;
9149 if(exp->isConstant && exp->type == 2)
9150 {
9151 switch(op.kind)
9152 {
9153 case 1:
9154 {
9155 if(exp->constant[0] == '\'')
9156 op.c = exp->constant[1];
9157 else if(type->isSigned)
9158 {
9159 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9160 op.ops = charOps;
9161 }
9162 else
9163 {
9164 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9165 op.ops = ucharOps;
9166 }
9167 break;
9168 }
9169 case 2:
9170 if(type->isSigned)
9171 {
9172 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9173 op.ops = shortOps;
9174 }
9175 else
9176 {
9177 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9178 op.ops = ushortOps;
9179 }
9180 break;
9181 case 3:
9182 case 5:
9183 if(type->isSigned)
9184 {
9185 op.i = strtol(exp->constant, (((void *)0)), 0);
9186 op.ops = intOps;
9187 }
9188 else
9189 {
9190 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9191 op.ops = uintOps;
9192 }
9193 op.kind = 3;
9194 break;
9195 case 4:
9196 if(type->isSigned)
9197 {
9198 op.i64 = _strtoi64(exp->constant, (((void *)0)), 0);
9199 op.ops = intOps;
9200 }
9201 else
9202 {
9203 op.ui64 = _strtoui64(exp->constant, (((void *)0)), 0);
9204 op.ops = uintOps;
9205 }
9206 op.kind = 3;
9207 break;
9208 case 6:
9209 op.f = (float)strtod(exp->constant, (((void *)0)));
9210 op.ops = floatOps;
9211 break;
9212 case 7:
9213 op.d = (double)strtod(exp->constant, (((void *)0)));
9214 op.ops = doubleOps;
9215 break;
9216 case 12:
9217 case 13:
9218 case 8:
9219 op.p = (unsigned char *)strtoul(exp->constant, (((void *)0)), 0);
9220 op.kind = 13;
9221 op.ops = uintOps;
9222 break;
9223 }
9224 }
9225 }
9226 return op;
9227 }
9228
9229 int __ecereVMethodID_class_OnGetString;
9230
9231 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9232
9233 static void UnusedFunction()
9234 {
9235 int a;
9236
9237 ((char *  (*)(struct __ecereNameSpace__ecere__com__Class *, void *, char *  tempString, void *  fieldData, unsigned int *  needClass))__ecereClass_int->_vTbl[__ecereVMethodID_class_OnGetString])(__ecereClass_int, &a, 0, 0, 0);
9238 }
9239
9240 extern int __ecereVMethodID_class_OnGetString;
9241
9242 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9243 {
9244 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9245
9246 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9247 {
9248 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9249 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9250 else
9251 {
9252 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9253 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9254 struct Type * type;
9255 void * ptr = inst->data + dataMember->offset + offset;
9256 char * result = (((void *)0));
9257
9258 exp->loc = member->loc = inst->loc;
9259 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9260 if(!dataMember->dataType)
9261 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9262 type = dataMember->dataType;
9263 if(type->kind == 8)
9264 {
9265 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9266
9267 if(_class->type == 4)
9268 {
9269 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9270
9271 if(enumClass)
9272 {
9273 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9274 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9275
9276 for(item = e->values.first; item; item = item->next)
9277 {
9278 if((int)item->data == *(int *)ptr)
9279 {
9280 result = item->name;
9281 break;
9282 }
9283 }
9284 if(result)
9285 {
9286 exp->identifier = MkIdentifier(result);
9287 exp->type = 0;
9288 exp->destType = MkClassType(_class->fullName);
9289 ProcessExpressionType(exp);
9290 }
9291 }
9292 }
9293 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9294 {
9295 if(!_class->dataType)
9296 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9297 type = _class->dataType;
9298 }
9299 }
9300 if(!result)
9301 {
9302 switch(type->kind)
9303 {
9304 case 6:
9305 {
9306 FreeExpContents(exp);
9307 exp->constant = PrintFloat(*(float *)ptr);
9308 exp->type = 2;
9309 break;
9310 }
9311 case 7:
9312 {
9313 FreeExpContents(exp);
9314 exp->constant = PrintDouble(*(double *)ptr);
9315 exp->type = 2;
9316 break;
9317 }
9318 case 3:
9319 {
9320 FreeExpContents(exp);
9321 exp->constant = PrintInt(*(int *)ptr);
9322 exp->type = 2;
9323 break;
9324 }
9325 case 4:
9326 {
9327 FreeExpContents(exp);
9328 exp->constant = PrintInt64(*(long long *)ptr);
9329 exp->type = 2;
9330 break;
9331 }
9332 default:
9333 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9334 }
9335 }
9336 ListAdd(memberList, member);
9337 }
9338 if(parentDataMember->type == 1)
9339 break;
9340 }
9341 }
9342
9343 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9344
9345 void PopulateInstance(struct Instantiation * inst)
9346 {
9347 struct Symbol * classSym = inst->_class->symbol;
9348 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9349 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9350 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9351
9352 inst->members = MkListOne(MkMembersInitList(memberList));
9353 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9354 {
9355 if(!dataMember->isProperty)
9356 {
9357 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9358 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9359 else
9360 {
9361 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9362 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9363 struct Type * type;
9364 void * ptr = inst->data + dataMember->offset;
9365 char * result = (((void *)0));
9366
9367 exp->loc = member->loc = inst->loc;
9368 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9369 if(!dataMember->dataType)
9370 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9371 type = dataMember->dataType;
9372 if(type->kind == 8)
9373 {
9374 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9375
9376 if(_class->type == 4)
9377 {
9378 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9379
9380 if(enumClass)
9381 {
9382 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9383 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9384
9385 for(item = e->values.first; item; item = item->next)
9386 {
9387 if((int)item->data == *(int *)ptr)
9388 {
9389 result = item->name;
9390 break;
9391 }
9392 }
9393 }
9394 if(result)
9395 {
9396 exp->identifier = MkIdentifier(result);
9397 exp->type = 0;
9398 exp->destType = MkClassType(_class->fullName);
9399 ProcessExpressionType(exp);
9400 }
9401 }
9402 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9403 {
9404 if(!_class->dataType)
9405 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9406 type = _class->dataType;
9407 }
9408 }
9409 if(!result)
9410 {
9411 switch(type->kind)
9412 {
9413 case 6:
9414 {
9415 exp->constant = PrintFloat(*(float *)ptr);
9416 exp->type = 2;
9417 break;
9418 }
9419 case 7:
9420 {
9421 exp->constant = PrintDouble(*(double *)ptr);
9422 exp->type = 2;
9423 break;
9424 }
9425 case 3:
9426 {
9427 exp->constant = PrintInt(*(int *)ptr);
9428 exp->type = 2;
9429 break;
9430 }
9431 case 4:
9432 {
9433 exp->constant = PrintInt64(*(long long *)ptr);
9434 exp->type = 2;
9435 break;
9436 }
9437 default:
9438 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9439 }
9440 }
9441 ListAdd(memberList, member);
9442 }
9443 }
9444 }
9445 }
9446
9447 extern struct __ecereNameSpace__ecere__com__DataMember * __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, unsigned int *  offset, struct __ecereNameSpace__ecere__com__Instance * module, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
9448
9449 extern void FreeInstance(struct Instantiation * inst);
9450
9451 void ComputeInstantiation(struct Expression * exp)
9452 {
9453 struct Instantiation * inst = exp->instance;
9454 struct MembersInit * members;
9455 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9456 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9457 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9458 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9459 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9460 int subMemberStackPos = 0;
9461 uint64 bits = 0;
9462
9463 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9464 {
9465 if(inst->data)
9466 return ;
9467 if(_class->type == 0 || _class->type == 5)
9468 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9469 else
9470 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9471 }
9472 if(inst->members)
9473 {
9474 for(members = (*inst->members).first; members; members = members->next)
9475 {
9476 switch(members->type)
9477 {
9478 case 0:
9479 {
9480 if(members->dataMembers)
9481 {
9482 struct MemberInit * member;
9483
9484 for(member = (*members->dataMembers).first; member; member = member->next)
9485 {
9486 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9487 unsigned int found = 0x0;
9488 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9489 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9490 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9491 unsigned int dataMemberOffset;
9492
9493 if(!ident)
9494 {
9495 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9496 if(curMember)
9497 {
9498 if(curMember->isProperty)
9499 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9500 else
9501 {
9502 dataMember = curMember;
9503 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9504 }
9505 found = 0x1;
9506 }
9507 }
9508 else
9509 {
9510 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9511 if(prop)
9512 {
9513 found = 0x1;
9514 if(prop->memberAccess == 1)
9515 {
9516 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9517 curClass = prop->_class;
9518 }
9519 }
9520 else
9521 {
9522 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9523 int _subMemberStackPos = 0;
9524
9525 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9526 if(dataMember)
9527 {
9528 found = 0x1;
9529 if(dataMember->memberAccess == 1)
9530 {
9531 curMember = dataMember;
9532 curClass = dataMember->_class;
9533 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9534 subMemberStackPos = _subMemberStackPos;
9535 }
9536 }
9537 }
9538 }
9539 if(found && member->initializer && member->initializer->type == 0)
9540 {
9541 struct Expression * value = member->initializer->exp;
9542 struct Type * type = (((void *)0));
9543
9544 if(prop)
9545 {
9546 type = prop->dataType;
9547 }
9548 else if(dataMember)
9549 {
9550 if(!dataMember->dataType)
9551 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9552 type = dataMember->dataType;
9553 }
9554 if(ident && ident->next)
9555 {
9556 for(ident = ident->next; ident && type; ident = ident->next)
9557 {
9558 if(type->kind == 8)
9559 {
9560 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9561 if(prop)
9562 type = prop->dataType;
9563 else
9564 {
9565 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9566 if(dataMember)
9567 type = dataMember->dataType;
9568 }
9569 }
9570 else if(type->kind == 9 || type->kind == 10)
9571 {
9572 struct Type * memberType;
9573
9574 for(memberType = type->members.first; memberType; memberType = memberType->next)
9575 {
9576 if(!strcmp(memberType->name, ident->string))
9577 {
9578 type = memberType;
9579 break;
9580 }
9581 }
9582 }
9583 }
9584 }
9585 if(value)
9586 {
9587 FreeType(value->destType);
9588 value->destType = type;
9589 if(type)
9590 type->refCount++;
9591 ComputeExpression(value);
9592 }
9593 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9594 {
9595 if(type->kind == 8)
9596 {
9597 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9598
9599 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9600 {
9601 if(!_class->dataType)
9602 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9603 type = _class->dataType;
9604 }
9605 }
9606 if(dataMember)
9607 {
9608 void * ptr = inst->data + dataMemberOffset;
9609
9610 if(value->type == 2)
9611 {
9612 switch(type->kind)
9613 {
9614 case 3:
9615 {
9616 GetInt(value, (int *)ptr);
9617 break;
9618 }
9619 case 4:
9620 {
9621 GetInt64(value, (long long *)ptr);
9622 break;
9623 }
9624 case 6:
9625 {
9626 GetFloat(value, (float *)ptr);
9627 break;
9628 }
9629 case 7:
9630 {
9631 GetDouble(value, (double *)ptr);
9632 break;
9633 }
9634 }
9635 }
9636 else if(value->type == 1)
9637 {
9638 if(type->kind == 8)
9639 {
9640 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9641
9642 if(_class->type == 1)
9643 {
9644 ComputeTypeSize(type);
9645 if(value->instance->data)
9646 memcpy(ptr, value->instance->data, type->size);
9647 }
9648 }
9649 }
9650 }
9651 else if(prop)
9652 {
9653 if(value->type == 1 && value->instance->data)
9654 {
9655 void (* Set)(void *, void *) = (void *)prop->Set;
9656
9657 Set(inst->data, value->instance->data);
9658 PopulateInstance(inst);
9659 }
9660 else if(value->type == 2)
9661 {
9662 switch(type->kind)
9663 {
9664 case 7:
9665 {
9666 void (* Set)(void *, double) = (void *)prop->Set;
9667
9668 Set(inst->data, strtod(value->constant, (((void *)0))));
9669 break;
9670 }
9671 case 6:
9672 {
9673 void (* Set)(void *, float) = (void *)prop->Set;
9674
9675 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9676 break;
9677 }
9678 case 3:
9679 {
9680 void (* Set)(void *, int) = (void *)prop->Set;
9681
9682 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9683 break;
9684 }
9685 case 4:
9686 {
9687 void (* Set)(void *, long long) = (void *)prop->Set;
9688
9689 Set(inst->data, _strtoi64(value->constant, (((void *)0)), 0));
9690 break;
9691 }
9692 }
9693 }
9694 else if(value->type == 3)
9695 {
9696 char temp[1024];
9697
9698 ReadString(temp, value->string);
9699 prop->Set(inst->data, temp);
9700 }
9701 }
9702 }
9703 else if(_class->type == 3)
9704 {
9705 if(prop)
9706 {
9707 if(value->type == 2)
9708 {
9709 if(type->kind == 8)
9710 {
9711 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9712
9713 if(_class->type == 3)
9714 {
9715 if(!_class->dataType)
9716 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9717 type = _class->dataType;
9718 }
9719 }
9720 switch(type->kind)
9721 {
9722 case 6:
9723 {
9724 float fValue;
9725 float (* Set)(float) = (void *)prop->Set;
9726
9727 GetFloat(member->initializer->exp, &fValue);
9728 exp->constant = PrintFloat(Set(fValue));
9729 exp->type = 2;
9730 break;
9731 }
9732 case 7:
9733 {
9734 double dValue;
9735 double (* Set)(double) = (void *)prop->Set;
9736
9737 GetDouble(member->initializer->exp, &dValue);
9738 exp->constant = PrintDouble(Set(dValue));
9739 exp->type = 2;
9740 break;
9741 }
9742 }
9743 }
9744 }
9745 }
9746 else if(_class->type == 2)
9747 {
9748 if(prop)
9749 {
9750 if(value->type == 1 && value->instance->data)
9751 {
9752 unsigned int (* Set)(void *) = (void *)prop->Set;
9753
9754 bits = Set(value->instance->data);
9755 }
9756 else if(value->type == 2)
9757 {
9758 }
9759 }
9760 else if(dataMember)
9761 {
9762 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
9763 struct Type * type;
9764 int part = 0;
9765
9766 GetInt(value, &part);
9767 bits = (bits & ~bitMember->mask);
9768 if(!bitMember->dataType)
9769 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
9770 type = bitMember->dataType;
9771 if(type->kind == 8 && type->_class && type->_class->registered)
9772 {
9773 if(!type->_class->registered->dataType)
9774 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9775 type = type->_class->registered->dataType;
9776 }
9777 switch(type->kind)
9778 {
9779 case 1:
9780 if(type->isSigned)
9781 bits |= ((char)part << bitMember->pos);
9782 else
9783 bits |= ((unsigned char)part << bitMember->pos);
9784 break;
9785 case 2:
9786 if(type->isSigned)
9787 bits |= ((short)part << bitMember->pos);
9788 else
9789 bits |= ((unsigned short)part << bitMember->pos);
9790 break;
9791 case 3:
9792 case 5:
9793 if(type->isSigned)
9794 bits |= (part << bitMember->pos);
9795 else
9796 bits |= ((unsigned int)part << bitMember->pos);
9797 break;
9798 case 4:
9799 if(type->isSigned)
9800 bits |= ((long long)part << bitMember->pos);
9801 else
9802 bits |= ((uint64)part << bitMember->pos);
9803 break;
9804 }
9805 }
9806 }
9807 }
9808 else
9809 {
9810 if(_class && _class->type == 3)
9811 {
9812 ComputeExpression(member->initializer->exp);
9813 exp->constant = member->initializer->exp->constant;
9814 exp->type = 2;
9815 member->initializer->exp->constant = (((void *)0));
9816 }
9817 }
9818 }
9819 }
9820 break;
9821 }
9822 }
9823 }
9824 }
9825 if(_class && _class->type == 2)
9826 {
9827 exp->constant = PrintHexUInt(bits);
9828 exp->type = 2;
9829 }
9830 if(exp->type != 1)
9831 {
9832 FreeInstance(inst);
9833 }
9834 }
9835
9836 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
9837 {
9838 if(exp->op.op == SIZEOF)
9839 {
9840 FreeExpContents(exp);
9841 exp->type = 2;
9842 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
9843 }
9844 else
9845 {
9846 if(!exp->op.exp1)
9847 {
9848 switch(exp->op.op)
9849 {
9850 case '+':
9851 {
9852 struct Expression * exp2 = exp->op.exp2;
9853
9854 exp->op.exp2 = (((void *)0));
9855 FreeExpContents(exp);
9856 FreeType(exp->expType);
9857 FreeType(exp->destType);
9858 *exp = *exp2;
9859 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
9860 break;
9861 }
9862 case '-':
9863 if(op1->ops.Neg)
9864 {
9865 FreeExpContents(exp);
9866 op1->ops.Neg(exp, op1);
9867 }
9868 break;
9869 case '~':
9870 if(op1->ops.BitNot)
9871 {
9872 FreeExpContents(exp);
9873 op1->ops.BitNot(exp, op1);
9874 }
9875 break;
9876 case '!':
9877 if(op1->ops.Not)
9878 {
9879 FreeExpContents(exp);
9880 op1->ops.Not(exp, op1);
9881 }
9882 break;
9883 }
9884 }
9885 else
9886 {
9887 switch(exp->op.op)
9888 {
9889 case '+':
9890 if(op1->ops.Add)
9891 {
9892 FreeExpContents(exp);
9893 op1->ops.Add(exp, op1, op2);
9894 }
9895 break;
9896 case '-':
9897 if(op1->ops.Sub)
9898 {
9899 FreeExpContents(exp);
9900 op1->ops.Sub(exp, op1, op2);
9901 }
9902 break;
9903 case '*':
9904 if(op1->ops.Mul)
9905 {
9906 FreeExpContents(exp);
9907 op1->ops.Mul(exp, op1, op2);
9908 }
9909 break;
9910 case '/':
9911 if(op1->ops.Div)
9912 {
9913 FreeExpContents(exp);
9914 op1->ops.Div(exp, op1, op2);
9915 }
9916 break;
9917 case '%':
9918 if(op1->ops.Mod)
9919 {
9920 FreeExpContents(exp);
9921 op1->ops.Mod(exp, op1, op2);
9922 }
9923 break;
9924 case '&':
9925 if(exp->op.exp2)
9926 {
9927 if(op1->ops.BitAnd)
9928 {
9929 FreeExpContents(exp);
9930 op1->ops.BitAnd(exp, op1, op2);
9931 }
9932 }
9933 break;
9934 case '|':
9935 if(op1->ops.BitOr)
9936 {
9937 FreeExpContents(exp);
9938 op1->ops.BitOr(exp, op1, op2);
9939 }
9940 break;
9941 case '^':
9942 if(op1->ops.BitXor)
9943 {
9944 FreeExpContents(exp);
9945 op1->ops.BitXor(exp, op1, op2);
9946 }
9947 break;
9948 case LEFT_OP:
9949 if(op1->ops.LShift)
9950 {
9951 FreeExpContents(exp);
9952 op1->ops.LShift(exp, op1, op2);
9953 }
9954 break;
9955 case RIGHT_OP:
9956 if(op1->ops.RShift)
9957 {
9958 FreeExpContents(exp);
9959 op1->ops.RShift(exp, op1, op2);
9960 }
9961 break;
9962 case EQ_OP:
9963 if(op1->ops.Equ)
9964 {
9965 FreeExpContents(exp);
9966 op1->ops.Equ(exp, op1, op2);
9967 }
9968 break;
9969 case NE_OP:
9970 if(op1->ops.Nqu)
9971 {
9972 FreeExpContents(exp);
9973 op1->ops.Nqu(exp, op1, op2);
9974 }
9975 break;
9976 case AND_OP:
9977 if(op1->ops.And)
9978 {
9979 FreeExpContents(exp);
9980 op1->ops.And(exp, op1, op2);
9981 }
9982 break;
9983 case OR_OP:
9984 if(op1->ops.Or)
9985 {
9986 FreeExpContents(exp);
9987 op1->ops.Or(exp, op1, op2);
9988 }
9989 break;
9990 case '>':
9991 if(op1->ops.Grt)
9992 {
9993 FreeExpContents(exp);
9994 op1->ops.Grt(exp, op1, op2);
9995 }
9996 break;
9997 case '<':
9998 if(op1->ops.Sma)
9999 {
10000 FreeExpContents(exp);
10001 op1->ops.Sma(exp, op1, op2);
10002 }
10003 break;
10004 case GE_OP:
10005 if(op1->ops.GrtEqu)
10006 {
10007 FreeExpContents(exp);
10008 op1->ops.GrtEqu(exp, op1, op2);
10009 }
10010 break;
10011 case LE_OP:
10012 if(op1->ops.SmaEqu)
10013 {
10014 FreeExpContents(exp);
10015 op1->ops.SmaEqu(exp, op1, op2);
10016 }
10017 break;
10018 }
10019 }
10020 }
10021 }
10022
10023 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10024
10025 void ComputeExpression(struct Expression * exp)
10026 {
10027 char expString[10240];
10028
10029 expString[0] = '\0';
10030 switch(exp->type)
10031 {
10032 case 1:
10033 {
10034 ComputeInstantiation(exp);
10035 break;
10036 }
10037 case 4:
10038 {
10039 struct Expression * exp1, * exp2 = (((void *)0));
10040 struct Operand op1 = 
10041 {
10042 0, 0, 0, 0, 
10043 {
10044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10045 }
10046 };
10047 struct Operand op2 = 
10048 {
10049 0, 0, 0, 0, 
10050 {
10051 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10052 }
10053 };
10054
10055 if(exp->op.exp2)
10056 ComputeExpression(exp->op.exp2);
10057 if(exp->op.exp1)
10058 {
10059 ComputeExpression(exp->op.exp1);
10060 exp1 = exp->op.exp1;
10061 exp2 = exp->op.exp2;
10062 op1 = GetOperand(exp1);
10063 if(op1.type)
10064 op1.type->refCount++;
10065 if(exp2)
10066 {
10067 op2 = GetOperand(exp2);
10068 if(op2.type)
10069 op2.type->refCount++;
10070 }
10071 }
10072 else
10073 {
10074 exp1 = exp->op.exp2;
10075 op1 = GetOperand(exp1);
10076 if(op1.type)
10077 op1.type->refCount++;
10078 }
10079 CallOperator(exp, exp1, exp2, &op1, &op2);
10080 if(op1.type)
10081 FreeType(op1.type);
10082 if(op2.type)
10083 FreeType(op2.type);
10084 break;
10085 }
10086 case 5:
10087 case 34:
10088 {
10089 struct Expression * e, * n;
10090
10091 for(e = (*exp->list).first; e; e = n)
10092 {
10093 n = e->next;
10094 if(!n)
10095 {
10096 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10097
10098 ComputeExpression(e);
10099 FreeType(exp->expType);
10100 FreeType(exp->destType);
10101 *exp = *e;
10102 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10103 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10104 }
10105 else
10106 {
10107 FreeExpression(e);
10108 }
10109 }
10110 break;
10111 }
10112 case 8:
10113 {
10114 struct Expression * memberExp = exp->member.exp;
10115 struct Identifier * memberID = exp->member.member;
10116 struct Type * type;
10117
10118 ComputeExpression(exp->member.exp);
10119 type = exp->member.exp->expType;
10120 if(type)
10121 {
10122 struct __ecereNameSpace__ecere__com__Class * _class = (exp->member.member && exp->member.member->classSym) ? exp->member.member->classSym->registered : (((type->kind == 8 || type->kind == 19) && type->_class) ? type->_class->registered : (((void *)0)));
10123 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10124 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10125 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10126
10127 if(type->kind == 19 && exp->member.exp->type == 26)
10128 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10129 if(!_class)
10130 {
10131 char string[256];
10132 struct Symbol * classSym;
10133
10134 string[0] = '\0';
10135 PrintType(type, string, 0x0, 0x1);
10136 classSym = FindClass(string);
10137 _class = classSym ? classSym->registered : (((void *)0));
10138 }
10139 if(exp->member.member)
10140 {
10141 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10142 if(!prop)
10143 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10144 }
10145 if(!prop && !member && _class && exp->member.member)
10146 {
10147 struct Symbol * classSym = FindClass(exp->member.member->string);
10148
10149 convertTo = _class;
10150 _class = classSym ? classSym->registered : (((void *)0));
10151 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10152 }
10153 if(prop)
10154 {
10155 if(prop->compiled)
10156 {
10157 struct Type * type = prop->dataType;
10158
10159 if(_class->type == 3)
10160 {
10161 if(type->kind == 8)
10162 {
10163 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10164
10165 if(_class->type == 3)
10166 {
10167 if(!_class->dataType)
10168 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10169 type = _class->dataType;
10170 }
10171 }
10172 switch(type->kind)
10173 {
10174 case 6:
10175 {
10176 float value;
10177 float (* Get)(float) = (void *)prop->Get;
10178
10179 GetFloat(exp->member.exp, &value);
10180 exp->constant = PrintFloat(Get ? Get(value) : value);
10181 exp->type = 2;
10182 break;
10183 }
10184 case 7:
10185 {
10186 double value;
10187 double (* Get)(double);
10188
10189 GetDouble(exp->member.exp, &value);
10190 if(convertTo)
10191 Get = (void *)prop->Set;
10192 else
10193 Get = (void *)prop->Get;
10194 exp->constant = PrintDouble(Get ? Get(value) : value);
10195 exp->type = 2;
10196 break;
10197 }
10198 }
10199 }
10200 else
10201 {
10202 if(convertTo)
10203 {
10204 struct Expression * value = exp->member.exp;
10205 struct Type * type;
10206
10207 if(!prop->dataType)
10208 ProcessPropertyType(prop);
10209 type = prop->dataType;
10210 if(!type)
10211 {
10212 }
10213 else if(_class->type == 1)
10214 {
10215 switch(type->kind)
10216 {
10217 case 8:
10218 {
10219 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10220
10221 if(propertyClass->type == 1 && value->type == 1)
10222 {
10223 void (* Set)(void *, void *) = (void *)prop->Set;
10224
10225 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10226 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10227 exp->instance->_class = MkSpecifierName(_class->fullName);
10228 exp->instance->loc = exp->loc;
10229 exp->type = 1;
10230 Set(exp->instance->data, value->instance->data);
10231 PopulateInstance(exp->instance);
10232 }
10233 break;
10234 }
10235 case 3:
10236 {
10237 int intValue;
10238 void (* Set)(void *, int) = (void *)prop->Set;
10239
10240 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10241 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10242 exp->instance->_class = MkSpecifierName(_class->fullName);
10243 exp->instance->loc = exp->loc;
10244 exp->type = 1;
10245 GetInt(value, &intValue);
10246 Set(exp->instance->data, intValue);
10247 PopulateInstance(exp->instance);
10248 break;
10249 }
10250 case 4:
10251 {
10252 long long intValue;
10253 void (* Set)(void *, long long) = (void *)prop->Set;
10254
10255 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10256 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10257 exp->instance->_class = MkSpecifierName(_class->fullName);
10258 exp->instance->loc = exp->loc;
10259 exp->type = 1;
10260 GetInt64(value, &intValue);
10261 Set(exp->instance->data, intValue);
10262 PopulateInstance(exp->instance);
10263 break;
10264 }
10265 case 7:
10266 {
10267 double doubleValue;
10268 void (* Set)(void *, double) = (void *)prop->Set;
10269
10270 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10271 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10272 exp->instance->_class = MkSpecifierName(_class->fullName);
10273 exp->instance->loc = exp->loc;
10274 exp->type = 1;
10275 GetDouble(value, &doubleValue);
10276 Set(exp->instance->data, doubleValue);
10277 PopulateInstance(exp->instance);
10278 break;
10279 }
10280 }
10281 }
10282 else if(_class->type == 2)
10283 {
10284 switch(type->kind)
10285 {
10286 case 8:
10287 {
10288 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10289
10290 if(propertyClass->type == 1 && value->instance->data)
10291 {
10292 unsigned int (* Set)(void *) = (void *)prop->Set;
10293 unsigned int bits = Set(value->instance->data);
10294
10295 exp->constant = PrintHexUInt(bits);
10296 exp->type = 2;
10297 break;
10298 }
10299 else if(_class->type == 2)
10300 {
10301 unsigned int value;
10302 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10303 unsigned int bits;
10304
10305 GetUInt(exp->member.exp, &value);
10306 bits = Set(value);
10307 exp->constant = PrintHexUInt(bits);
10308 exp->type = 2;
10309 }
10310 }
10311 }
10312 }
10313 }
10314 else
10315 {
10316 if(_class->type == 2)
10317 {
10318 unsigned int value;
10319
10320 GetUInt(exp->member.exp, &value);
10321 switch(type->kind)
10322 {
10323 case 8:
10324 {
10325 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10326
10327 if(_class->type == 1)
10328 {
10329 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10330
10331 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10332 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10333 exp->instance->_class = MkSpecifierName(_class->fullName);
10334 exp->instance->loc = exp->loc;
10335 exp->type = 1;
10336 Get(value, exp->instance->data);
10337 PopulateInstance(exp->instance);
10338 }
10339 else if(_class->type == 2)
10340 {
10341 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10342 uint64 bits = Get(value);
10343
10344 exp->constant = PrintHexUInt64(bits);
10345 exp->type = 2;
10346 }
10347 break;
10348 }
10349 }
10350 }
10351 else if(_class->type == 1)
10352 {
10353 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10354
10355 switch(type->kind)
10356 {
10357 case 8:
10358 {
10359 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10360
10361 if(_class->type == 1 && value)
10362 {
10363 void (* Get)(void *, void *) = (void *)prop->Get;
10364
10365 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10366 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10367 exp->instance->_class = MkSpecifierName(_class->fullName);
10368 exp->instance->loc = exp->loc;
10369 exp->type = 1;
10370 Get(value, exp->instance->data);
10371 PopulateInstance(exp->instance);
10372 }
10373 break;
10374 }
10375 }
10376 }
10377 }
10378 }
10379 }
10380 else
10381 {
10382 exp->isConstant = 0x0;
10383 }
10384 }
10385 else if(member)
10386 {
10387 }
10388 }
10389 if(exp->type != 8)
10390 {
10391 FreeExpression(memberExp);
10392 FreeIdentifier(memberID);
10393 }
10394 break;
10395 }
10396 case 10:
10397 {
10398 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10399
10400 FreeExpContents(exp);
10401 exp->constant = PrintUInt(ComputeTypeSize(type));
10402 exp->type = 2;
10403 FreeType(type);
10404 break;
10405 }
10406 case 15:
10407 {
10408 struct Symbol * classSym = exp->_class->symbol;
10409
10410 if(classSym && classSym->registered)
10411 {
10412 if(classSym->registered->fixed)
10413 {
10414 FreeSpecifier(exp->_class);
10415 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10416 exp->type = 2;
10417 }
10418 else
10419 {
10420 char className[1024];
10421
10422 strcpy(className, "__ecereClass_");
10423 FullClassNameCat(className, classSym->string, 0x1);
10424 MangleClassName(className);
10425 FreeExpContents(exp);
10426 exp->type = 9;
10427 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10428 exp->member.member = MkIdentifier("structSize");
10429 }
10430 }
10431 break;
10432 }
10433 case 11:
10434 {
10435 struct Type * type;
10436 struct Expression * e = exp;
10437
10438 if(exp->type == 11)
10439 {
10440 if(exp->cast.exp)
10441 ComputeExpression(exp->cast.exp);
10442 e = exp->cast.exp;
10443 }
10444 if(e && exp->expType)
10445 {
10446 type = exp->expType;
10447 if(type->kind == 8)
10448 {
10449 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10450
10451 if(_class && (_class->type == 3 || _class->type == 2))
10452 {
10453 if(!_class->dataType)
10454 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10455 type = _class->dataType;
10456 }
10457 }
10458 switch(type->kind)
10459 {
10460 case 1:
10461 if(type->isSigned)
10462 {
10463 char value;
10464
10465 GetChar(e, &value);
10466 FreeExpContents(exp);
10467 exp->constant = PrintChar(value);
10468 exp->type = 2;
10469 }
10470 else
10471 {
10472 unsigned char value;
10473
10474 GetUChar(e, &value);
10475 FreeExpContents(exp);
10476 exp->constant = PrintUChar(value);
10477 exp->type = 2;
10478 }
10479 break;
10480 case 2:
10481 if(type->isSigned)
10482 {
10483 short value;
10484
10485 GetShort(e, &value);
10486 FreeExpContents(exp);
10487 exp->constant = PrintShort(value);
10488 exp->type = 2;
10489 }
10490 else
10491 {
10492 unsigned short value;
10493
10494 GetUShort(e, &value);
10495 FreeExpContents(exp);
10496 exp->constant = PrintUShort(value);
10497 exp->type = 2;
10498 }
10499 break;
10500 case 3:
10501 if(type->isSigned)
10502 {
10503 int value;
10504
10505 GetInt(e, &value);
10506 FreeExpContents(exp);
10507 exp->constant = PrintInt(value);
10508 exp->type = 2;
10509 }
10510 else
10511 {
10512 unsigned int value;
10513
10514 GetUInt(e, &value);
10515 FreeExpContents(exp);
10516 exp->constant = PrintUInt(value);
10517 exp->type = 2;
10518 }
10519 break;
10520 case 4:
10521 if(type->isSigned)
10522 {
10523 long long value;
10524
10525 GetInt64(e, &value);
10526 FreeExpContents(exp);
10527 exp->constant = PrintInt64(value);
10528 exp->type = 2;
10529 }
10530 else
10531 {
10532 uint64 value;
10533
10534 GetUInt64(e, &value);
10535 FreeExpContents(exp);
10536 exp->constant = PrintUInt64(value);
10537 exp->type = 2;
10538 }
10539 break;
10540 case 6:
10541 {
10542 float value;
10543
10544 GetFloat(e, &value);
10545 FreeExpContents(exp);
10546 exp->constant = PrintFloat(value);
10547 exp->type = 2;
10548 break;
10549 }
10550 case 7:
10551 {
10552 double value;
10553
10554 GetDouble(e, &value);
10555 FreeExpContents(exp);
10556 exp->constant = PrintDouble(value);
10557 exp->type = 2;
10558 break;
10559 }
10560 }
10561 }
10562 break;
10563 }
10564 case 12:
10565 {
10566 struct Operand op1 = 
10567 {
10568 0, 0, 0, 0, 
10569 {
10570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10571 }
10572 };
10573 struct Operand op2 = 
10574 {
10575 0, 0, 0, 0, 
10576 {
10577 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10578 }
10579 };
10580 struct Operand op3 = 
10581 {
10582 0, 0, 0, 0, 
10583 {
10584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10585 }
10586 };
10587
10588 if(exp->cond.exp)
10589 ComputeExpression((*exp->cond.exp).last);
10590 if(exp->cond.elseExp)
10591 ComputeExpression(exp->cond.elseExp);
10592 if(exp->cond.cond)
10593 ComputeExpression(exp->cond.cond);
10594 op1 = GetOperand(exp->cond.cond);
10595 if(op1.type)
10596 op1.type->refCount++;
10597 op2 = GetOperand((*exp->cond.exp).last);
10598 if(op2.type)
10599 op2.type->refCount++;
10600 op3 = GetOperand(exp->cond.elseExp);
10601 if(op3.type)
10602 op3.type->refCount++;
10603 if(op1.ops.Cond)
10604 {
10605 FreeExpContents(exp);
10606 op1.ops.Cond(exp, &op1, &op2, &op3);
10607 }
10608 if(op1.type)
10609 FreeType(op1.type);
10610 if(op2.type)
10611 FreeType(op2.type);
10612 if(op3.type)
10613 FreeType(op3.type);
10614 break;
10615 }
10616 }
10617 }
10618
10619 void ApplyAnyObjectLogic(struct Expression * e);
10620
10621 extern void CopyTypeInto(struct Type * type, struct Type * src);
10622
10623 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10624 {
10625 unsigned int result = 0x1;
10626
10627 if(destType)
10628 {
10629 struct __ecereNameSpace__ecere__sys__OldList converts = 
10630 {
10631 0, 0, 0, 0, 0
10632 };
10633 struct Conversion * convert;
10634
10635 if(destType->kind == 0)
10636 return 0x0;
10637 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
10638 result = 0x0;
10639 if(converts.count)
10640 {
10641 for(convert = converts.first; convert; convert = convert->next)
10642 {
10643 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
10644
10645 if(!empty)
10646 {
10647 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10648 int objectType = exp->expType ? exp->expType->classObjectType : 0;
10649
10650 *newExp = *exp;
10651 newExp->destType = (((void *)0));
10652 if(convert->isGet)
10653 {
10654 exp->type = 8;
10655 exp->addedThis = 0x1;
10656 exp->member.exp = newExp;
10657 FreeType(exp->member.exp->expType);
10658 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
10659 exp->member.exp->expType->classObjectType = objectType;
10660 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
10661 exp->member.memberType = 1;
10662 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10663 exp->needCast = 0x1;
10664 if(exp->expType)
10665 exp->expType->refCount++;
10666 ApplyAnyObjectLogic(exp->member.exp);
10667 }
10668 else
10669 {
10670 {
10671 exp->type = 8;
10672 exp->addedThis = 0x1;
10673 exp->member.exp = newExp;
10674 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
10675 {
10676 newExp->byReference = 0x1;
10677 }
10678 FreeType(exp->member.exp->expType);
10679 exp->member.exp->expType = (((void *)0));
10680 if(convert->convert->dataType)
10681 {
10682 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
10683 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
10684 exp->member.exp->expType->refCount = 1;
10685 exp->member.exp->expType->classObjectType = objectType;
10686 ApplyAnyObjectLogic(exp->member.exp);
10687 }
10688 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
10689 exp->member.memberType = 4;
10690 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10691 exp->needCast = 0x1;
10692 if(convert->resultType)
10693 convert->resultType->refCount++;
10694 }
10695 }
10696 }
10697 else
10698 {
10699 FreeType(exp->expType);
10700 if(convert->isGet)
10701 {
10702 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10703 exp->needCast = 0x1;
10704 if(exp->expType)
10705 exp->expType->refCount++;
10706 }
10707 else
10708 {
10709 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10710 exp->needCast = 0x1;
10711 if(convert->resultType)
10712 convert->resultType->refCount++;
10713 }
10714 }
10715 }
10716 if(exp->isConstant && inCompiler)
10717 ComputeExpression(exp);
10718 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
10719 }
10720 if(!result && exp->expType && converts.count)
10721 {
10722 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
10723 }
10724 if(!result && exp->expType && exp->destType)
10725 {
10726 if((exp->destType->kind == 8 && exp->expType->kind == 13 && exp->expType->type->kind == 8 && exp->expType->type->_class == exp->destType->_class && exp->destType->_class->registered && exp->destType->_class->registered->type == 1) || (exp->expType->kind == 8 && exp->destType->kind == 13 && exp->destType->type->kind == 8 && exp->destType->type->_class == exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1))
10727 result = 0x1;
10728 }
10729 }
10730 return result;
10731 }
10732
10733 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
10734
10735 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
10736
10737 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
10738
10739 void CheckTemplateTypes(struct Expression * exp)
10740 {
10741 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
10742 {
10743 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10744 struct Statement * compound;
10745 struct Context * context;
10746
10747 *newExp = *exp;
10748 if(exp->destType)
10749 exp->destType->refCount++;
10750 if(exp->expType)
10751 exp->expType->refCount++;
10752 newExp->prev = (((void *)0));
10753 newExp->next = (((void *)0));
10754 switch(exp->expType->kind)
10755 {
10756 case 7:
10757 if(exp->destType->classObjectType)
10758 {
10759 if(exp->destType)
10760 exp->destType->refCount--;
10761 if(exp->expType)
10762 exp->expType->refCount--;
10763 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10764 }
10765 else
10766 {
10767 struct __ecereNameSpace__ecere__sys__OldList * specs;
10768 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10769 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10770
10771 context = PushContext();
10772 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10773 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10774 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10775 exp->type = 25;
10776 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10777 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
10778 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
10779 exp->compound->compound.context = context;
10780 PopContext(context);
10781 }
10782 break;
10783 default:
10784 exp->type = 11;
10785 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
10786 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10787 break;
10788 }
10789 }
10790 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
10791 {
10792 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10793 struct Statement * compound;
10794 struct Context * context;
10795
10796 *newExp = *exp;
10797 if(exp->destType)
10798 exp->destType->refCount++;
10799 if(exp->expType)
10800 exp->expType->refCount++;
10801 newExp->prev = (((void *)0));
10802 newExp->next = (((void *)0));
10803 switch(exp->expType->kind)
10804 {
10805 case 7:
10806 if(exp->destType->classObjectType)
10807 {
10808 if(exp->destType)
10809 exp->destType->refCount--;
10810 if(exp->expType)
10811 exp->expType->refCount--;
10812 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10813 }
10814 else
10815 {
10816 struct __ecereNameSpace__ecere__sys__OldList * specs;
10817 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
10818 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
10819
10820 context = PushContext();
10821 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
10822 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
10823 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
10824 exp->type = 25;
10825 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
10826 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
10827 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
10828 exp->compound->compound.context = context;
10829 PopContext(context);
10830 }
10831 break;
10832 case 8:
10833 {
10834 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
10835 {
10836 exp->type = 5;
10837 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
10838 ProcessExpressionType((*exp->list).first);
10839 break;
10840 }
10841 else
10842 {
10843 exp->type = 5;
10844 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
10845 newExp->needCast = 0x1;
10846 ProcessExpressionType((*exp->list).first);
10847 break;
10848 }
10849 }
10850 default:
10851 {
10852 if(exp->expType->kind == 20)
10853 {
10854 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
10855
10856 if(type)
10857 {
10858 FreeType(exp->destType);
10859 FreeType(exp->expType);
10860 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10861 break;
10862 }
10863 }
10864 if(newExp->type == 8 && newExp->member.memberType == 3)
10865 {
10866 exp->type = 4;
10867 exp->op.op = '*';
10868 exp->op.exp1 = (((void *)0));
10869 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
10870 }
10871 else
10872 {
10873 char typeString[1024];
10874 struct Declarator * decl;
10875 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
10876
10877 typeString[0] = '\0';
10878 PrintType(exp->expType, typeString, 0x0, 0x0);
10879 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
10880 exp->type = 11;
10881 exp->cast.typeName = MkTypeName(specs, decl);
10882 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10883 exp->cast.exp->needCast = 0x1;
10884 }
10885 break;
10886 }
10887 }
10888 }
10889 }
10890
10891 extern int strncmp(const char * , const char * , int n);
10892
10893 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
10894
10895 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
10896 {
10897 int nsLen = strlen(nameSpace);
10898 struct Symbol * symbol;
10899
10900 for(symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(tree, nameSpace); symbol; symbol = (struct Symbol *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)symbol)))
10901 {
10902 char * s = symbol->string;
10903
10904 if(!strncmp(s, nameSpace, nsLen))
10905 {
10906 int c;
10907 char * namePart;
10908
10909 for(c = strlen(s) - 1; c >= 0; c--)
10910 if(s[c] == ':')
10911 break;
10912 namePart = s + c + 1;
10913 if(!strcmp(namePart, name))
10914 {
10915 return symbol;
10916 }
10917 }
10918 else
10919 break;
10920 }
10921 return (((void *)0));
10922 }
10923
10924 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
10925 {
10926 int c;
10927 char nameSpace[1024];
10928 char * namePart;
10929 unsigned int gotColon = 0x0;
10930
10931 nameSpace[0] = '\0';
10932 for(c = strlen(name) - 1; c >= 0; c--)
10933 if(name[c] == ':')
10934 {
10935 gotColon = 0x1;
10936 break;
10937 }
10938 namePart = name + c + 1;
10939 while(c >= 0 && name[c] == ':')
10940 c--;
10941 if(c >= 0)
10942 {
10943 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
10944
10945 if(symbol)
10946 return symbol;
10947 memcpy(nameSpace, name, c + 1);
10948 nameSpace[c + 1] = (char)0;
10949 return ScanWithNameSpace(tree, nameSpace, namePart);
10950 }
10951 else if(gotColon)
10952 {
10953 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
10954
10955 return symbol;
10956 }
10957 else
10958 {
10959 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
10960
10961 if(symbol)
10962 return symbol;
10963 return ScanWithNameSpace(tree, "", namePart);
10964 }
10965 return (((void *)0));
10966 }
10967
10968 static void ProcessDeclaration(struct Declaration * decl);
10969
10970 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
10971 {
10972 struct Context * ctx;
10973 struct Symbol * symbol = (((void *)0));
10974
10975 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
10976 {
10977 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
10978 {
10979 symbol = (((void *)0));
10980 if(thisNameSpace)
10981 {
10982 char curName[1024];
10983
10984 strcpy(curName, thisNameSpace);
10985 strcat(curName, "::");
10986 strcat(curName, name);
10987 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
10988 }
10989 if(!symbol)
10990 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
10991 }
10992 else
10993 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
10994 if(symbol || ctx == endContext)
10995 break;
10996 }
10997 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
10998 {
10999 if(symbol->pointerExternal->type == 0)
11000 {
11001 struct FunctionDefinition * function = symbol->pointerExternal->function;
11002 struct Context * tmpContext = curContext;
11003
11004 curContext = (((void *)0));
11005 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11006 curContext = tmpContext;
11007 symbol->pointerExternal->symbol = symbol;
11008 DeclareType(symbol->type, 0x1, 0x1);
11009 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11010 symbol->id = curExternal->symbol->idCode;
11011 }
11012 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11013 {
11014 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11015 symbol->id = curExternal->symbol->idCode;
11016 }
11017 }
11018 return symbol;
11019 }
11020
11021 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11022 {
11023 if(!type->isSigned)
11024 ListAdd(specs, MkSpecifier(UNSIGNED));
11025 switch(type->kind)
11026 {
11027 case 8:
11028 {
11029 if(type->_class->registered)
11030 {
11031 if(!type->_class->registered->dataType)
11032 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11033 GetTypeSpecs(type->_class->registered->dataType, specs);
11034 }
11035 break;
11036 }
11037 case 7:
11038 ListAdd(specs, MkSpecifier(DOUBLE));
11039 break;
11040 case 6:
11041 ListAdd(specs, MkSpecifier(FLOAT));
11042 break;
11043 case 1:
11044 ListAdd(specs, MkSpecifier(CHAR));
11045 break;
11046 case 2:
11047 ListAdd(specs, MkSpecifier(SHORT));
11048 break;
11049 case 4:
11050 ListAdd(specs, MkSpecifier(INT64));
11051 break;
11052 case 3:
11053 default:
11054 ListAdd(specs, MkSpecifier(INT));
11055 break;
11056 }
11057 }
11058
11059 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11060
11061 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11062 {
11063 if(type)
11064 {
11065 switch(type->kind)
11066 {
11067 case 8:
11068 if(type->_class && type->_class->string)
11069 {
11070 if(type->classObjectType == 2)
11071 strcat(string, "typed_object");
11072 else if(fullName)
11073 strcat(string, type->_class->string);
11074 else
11075 {
11076 if(type->_class->registered)
11077 strcat(string, type->_class->registered->name);
11078 else
11079 strcat(string, type->_class->string);
11080 }
11081 }
11082 break;
11083 case 13:
11084 {
11085 {
11086 _PrintType(type->type, string, 0x0, printFunction, fullName);
11087 strcat(string, " *");
11088 }
11089 break;
11090 }
11091 case 0:
11092 strcat(string, "void");
11093 break;
11094 case 3:
11095 strcat(string, type->isSigned ? "int" : "uint");
11096 break;
11097 case 4:
11098 strcat(string, type->isSigned ? "int64" : "uint64");
11099 break;
11100 case 1:
11101 strcat(string, type->isSigned ? "char" : "byte");
11102 break;
11103 case 2:
11104 strcat(string, type->isSigned ? "short" : "uint16");
11105 break;
11106 case 6:
11107 strcat(string, "float");
11108 break;
11109 case 7:
11110 strcat(string, "double");
11111 break;
11112 case 9:
11113 if(type->enumName)
11114 {
11115 strcat(string, "struct ");
11116 strcat(string, type->enumName);
11117 }
11118 else if(type->typeName)
11119 {
11120 strcat(string, type->typeName);
11121 }
11122 else
11123 {
11124 struct Type * member;
11125
11126 strcat(string, "struct {");
11127 for(member = type->members.first; member; member = member->next)
11128 {
11129 PrintType(member, string, 0x1, fullName);
11130 strcat(string, "; ");
11131 }
11132 strcat(string, "}");
11133 }
11134 break;
11135 case 10:
11136 if(type->enumName)
11137 {
11138 strcat(string, "union ");
11139 strcat(string, type->enumName);
11140 }
11141 else if(type->typeName)
11142 {
11143 strcat(string, type->typeName);
11144 }
11145 else
11146 {
11147 strcat(string, "union ");
11148 strcat(string, "(unnamed)");
11149 }
11150 break;
11151 case 15:
11152 if(type->enumName)
11153 {
11154 strcat(string, "enum ");
11155 strcat(string, type->enumName);
11156 }
11157 else if(type->typeName)
11158 {
11159 strcat(string, type->typeName);
11160 }
11161 else
11162 strcat(string, "enum");
11163 break;
11164 case 11:
11165 {
11166 if(printFunction)
11167 {
11168 if(type->dllExport)
11169 strcat(string, "dllexport ");
11170 PrintType(type->returnType, string, 0x0, fullName);
11171 strcat(string, " ");
11172 }
11173 if(printName)
11174 {
11175 if(type->name)
11176 {
11177 if(fullName)
11178 strcat(string, type->name);
11179 else
11180 {
11181 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11182
11183 if(name)
11184 name += 2;
11185 else
11186 name = type->name;
11187 strcat(string, name);
11188 }
11189 }
11190 }
11191 if(printFunction)
11192 {
11193 struct Type * param;
11194
11195 strcat(string, "(");
11196 for(param = type->params.first; param; param = param->next)
11197 {
11198 PrintType(param, string, 0x1, fullName);
11199 if(param->next)
11200 strcat(string, ", ");
11201 }
11202 strcat(string, ")");
11203 }
11204 break;
11205 }
11206 case 12:
11207 {
11208 {
11209 char baseType[1024], size[256];
11210 struct Type * arrayType = type;
11211
11212 baseType[0] = '\0';
11213 size[0] = '\0';
11214 while(arrayType->kind == 12)
11215 {
11216 strcat(size, "[");
11217 if(arrayType->enumClass)
11218 strcat(size, arrayType->enumClass->string);
11219 else if(arrayType->arraySizeExp)
11220 PrintExpression(arrayType->arraySizeExp, size);
11221 strcat(size, "]");
11222 arrayType = arrayType->arrayType;
11223 }
11224 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11225 strcat(string, baseType);
11226 strcat(string, size);
11227 }
11228 printName = 0x0;
11229 break;
11230 }
11231 case 14:
11232 strcat(string, "...");
11233 break;
11234 case 16:
11235 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11236 break;
11237 case 19:
11238 strcat(string, "subclass(");
11239 strcat(string, type->_class ? type->_class->string : "int");
11240 strcat(string, ")");
11241 break;
11242 case 20:
11243 strcat(string, type->templateParameter->identifier->string);
11244 break;
11245 case 21:
11246 strcat(string, "thisclass");
11247 break;
11248 case 17:
11249 strcat(string, "__builtin_va_list");
11250 break;
11251 }
11252 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11253 {
11254 strcat(string, " ");
11255 strcat(string, type->name);
11256 }
11257 }
11258 }
11259
11260 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11261 {
11262 struct Type * funcType;
11263
11264 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11265 ;
11266 if(funcType && funcType->kind == 11 && type != funcType)
11267 {
11268 char typeString[1024];
11269 struct Type * param;
11270
11271 PrintType(funcType->returnType, string, 0x0, fullName);
11272 strcat(string, "(");
11273 _PrintType(type, string, printName, 0x0, fullName);
11274 strcat(string, ")");
11275 strcat(string, "(");
11276 for(param = funcType->params.first; param; param = param->next)
11277 {
11278 PrintType(param, string, 0x1, fullName);
11279 if(param->next)
11280 strcat(string, ", ");
11281 }
11282 strcat(string, ")");
11283 }
11284 else
11285 _PrintType(type, string, printName, 0x1, fullName);
11286 if(type->bitFieldCount)
11287 {
11288 char count[100];
11289
11290 sprintf(count, ":%d", type->bitFieldCount);
11291 strcat(string, count);
11292 }
11293 }
11294
11295 static struct Type * FindMember(struct Type * type, char * string)
11296 {
11297 struct Type * memberType;
11298
11299 for(memberType = type->members.first; memberType; memberType = memberType->next)
11300 {
11301 if(!memberType->name)
11302 {
11303 struct Type * subType = FindMember(memberType, string);
11304
11305 if(subType)
11306 return subType;
11307 }
11308 else if(!strcmp(memberType->name, string))
11309 return memberType;
11310 }
11311 return (((void *)0));
11312 }
11313
11314 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11315 {
11316 struct Type * memberType;
11317
11318 for(memberType = type->members.first; memberType; memberType = memberType->next)
11319 {
11320 if(!memberType->name)
11321 {
11322 struct Type * subType = FindMember(memberType, string);
11323
11324 if(subType)
11325 {
11326 *offset += memberType->offset;
11327 return subType;
11328 }
11329 }
11330 else if(!strcmp(memberType->name, string))
11331 {
11332 *offset += memberType->offset;
11333 return memberType;
11334 }
11335 }
11336 return (((void *)0));
11337 }
11338
11339 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11340
11341 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11342
11343 struct Expression * ParseExpressionString(char * expression)
11344 {
11345 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11346 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
11347 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11348 echoOn = 0x0;
11349 parsedExpression = (((void *)0));
11350 resetScanner();
11351 expression_yyparse();
11352 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11353 return parsedExpression;
11354 }
11355
11356 extern char *  QMkString(char *  source);
11357
11358 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11359 {
11360 void * __ecereTemp1;
11361 struct Identifier * id = exp->identifier;
11362 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11363 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11364 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11365 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11366
11367 if(_class && _class->type == 4)
11368 {
11369 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11370 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11371
11372 if(enumClass)
11373 {
11374 struct __ecereNameSpace__ecere__com__Class * baseClass;
11375
11376 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11377 {
11378 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11379
11380 for(value = e->values.first; value; value = value->next)
11381 {
11382 if(!strcmp(value->name, id->string))
11383 break;
11384 }
11385 if(value)
11386 {
11387 char constant[256];
11388
11389 FreeExpContents(exp);
11390 exp->type = 2;
11391 exp->isConstant = 0x1;
11392 if(!strcmp(baseClass->dataTypeString, "int"))
11393 sprintf(constant, "%d", value->data);
11394 else
11395 sprintf(constant, "0x%X", value->data);
11396 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11397 exp->expType = MkClassType(baseClass->fullName);
11398 break;
11399 }
11400 }
11401 }
11402 if(value)
11403 return 0x1;
11404 }
11405 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11406 {
11407 ProcessMethodType(method);
11408 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1)->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), ((struct Type *)__ecereTemp1));
11409 return 0x1;
11410 }
11411 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11412 {
11413 if(!prop->dataType)
11414 ProcessPropertyType(prop);
11415 exp->expType = prop->dataType;
11416 if(prop->dataType)
11417 prop->dataType->refCount++;
11418 return 0x1;
11419 }
11420 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11421 {
11422 if(!member->dataType)
11423 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11424 exp->expType = member->dataType;
11425 if(member->dataType)
11426 member->dataType->refCount++;
11427 return 0x1;
11428 }
11429 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11430 {
11431 if(!classProp->dataType)
11432 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11433 if(classProp->constant)
11434 {
11435 FreeExpContents(exp);
11436 exp->isConstant = 0x1;
11437 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11438 {
11439 exp->type = 3;
11440 exp->constant = QMkString((char *)classProp->Get(_class));
11441 }
11442 else
11443 {
11444 char constant[256];
11445
11446 exp->type = 2;
11447 sprintf(constant, "%d", classProp->Get(_class));
11448 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11449 }
11450 }
11451 else
11452 {
11453 }
11454 exp->expType = classProp->dataType;
11455 if(classProp->dataType)
11456 classProp->dataType->refCount++;
11457 return 0x1;
11458 }
11459 return 0x0;
11460 }
11461
11462 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11463 {
11464 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11465 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11466 struct __ecereNameSpace__ecere__com__NameSpace * child;
11467
11468 if(!data)
11469 {
11470 for(child = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(&nameSpace->nameSpaces); child; child = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)child)))
11471 {
11472 data = ScanGlobalData(child, name);
11473 if(data)
11474 break;
11475 }
11476 }
11477 return data;
11478 }
11479
11480 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11481
11482 extern char *  strncpy(char * , const char * , int n);
11483
11484 static struct GlobalData * FindGlobalData(char * name)
11485 {
11486 int start = 0, c;
11487 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11488
11489 nameSpace = globalData;
11490 for(c = 0; name[c]; c++)
11491 {
11492 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11493 {
11494 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11495 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11496
11497 strncpy(spaceName, name + start, c - start);
11498 spaceName[c - start] = '\0';
11499 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11500 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11501 if(!newSpace)
11502 return (((void *)0));
11503 nameSpace = newSpace;
11504 if(name[c] == ':')
11505 c++;
11506 start = c + 1;
11507 }
11508 }
11509 if(c - start)
11510 {
11511 return ScanGlobalData(nameSpace, name + start);
11512 }
11513 return (((void *)0));
11514 }
11515
11516 static int definedExpStackPos;
11517
11518 static void * definedExpStack[512];
11519
11520 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11521 {
11522 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11523
11524 FreeExpContents(checkedExp);
11525 FreeType(checkedExp->expType);
11526 FreeType(checkedExp->destType);
11527 *checkedExp = *newExp;
11528 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11529 checkedExp->prev = prev;
11530 checkedExp->next = next;
11531 }
11532
11533 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11534
11535 extern int printf(char * , ...);
11536
11537 void __ecereMethod_Expression_Clear();
11538
11539 void ApplyAnyObjectLogic(struct Expression * e)
11540 {
11541 struct Type * destType = e->destType;
11542
11543 if(destType && (destType->classObjectType == 3))
11544 {
11545 if(e && e->expType)
11546 {
11547 struct Type * type = e->expType;
11548 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11549
11550 if(type->kind == 8 && type->_class && type->_class->registered)
11551 {
11552 _class = type->_class->registered;
11553 }
11554 else if(type->kind == 19)
11555 {
11556 _class = FindClass("ecere::com::Class")->registered;
11557 }
11558 else
11559 {
11560 char string[1024] = "";
11561 struct Symbol * classSym;
11562
11563 PrintType(type, string, 0x0, 0x1);
11564 classSym = FindClass(string);
11565 if(classSym)
11566 _class = classSym->registered;
11567 }
11568 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "ecere::com::Class")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
11569 {
11570 if(!_class || strcmp(_class->fullName, "char *"))
11571 {
11572 struct Expression * checkedExp = e, * newExp;
11573
11574 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11575 {
11576 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11577 {
11578 if(checkedExp->type == 25)
11579 {
11580 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11581 }
11582 else
11583 checkedExp = (*checkedExp->list).last;
11584 }
11585 else if(checkedExp->type == 11)
11586 checkedExp = checkedExp->cast.exp;
11587 }
11588 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11589 {
11590 newExp = checkedExp->op.exp2;
11591 checkedExp->op.exp2 = (((void *)0));
11592 FreeExpContents(checkedExp);
11593 if(e->expType && e->expType->passAsTemplate)
11594 {
11595 char size[100];
11596
11597 ComputeTypeSize(e->expType);
11598 sprintf(size, "%d", e->expType->size);
11599 newExp = MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp), '+', MkExpCall(MkExpIdentifier(MkIdentifier("__ENDIAN_PAD")), MkListOne(MkExpConstant(size))))));
11600 }
11601 ReplaceExpContents(checkedExp, newExp);
11602 e->byReference = 0x1;
11603 }
11604 else if(!e->byReference || (_class && _class->type == 5))
11605 {
11606 struct Expression * checkedExp, * newExp;
11607
11608 {
11609 unsigned int hasAddress = e->type == 0 || (e->type == 8 && e->member.memberType == 3) || (e->type == 9 && e->member.memberType == 3) || (e->type == 4 && !e->op.exp1 && e->op.op == '*') || e->type == 6;
11610
11611 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11612 {
11613 struct Context * context = PushContext();
11614 struct Declarator * decl;
11615 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11616 char typeString[1024];
11617 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11618
11619 typeString[0] = '\0';
11620 *newExp = *e;
11621 newExp->prev = (((void *)0));
11622 newExp->next = (((void *)0));
11623 newExp->expType = (((void *)0));
11624 PrintType(e->expType, typeString, 0x0, 0x1);
11625 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11626 newExp->destType = ProcessType(specs, decl);
11627 curContext = context;
11628 e->type = 25;
11629 if(curCompound)
11630 {
11631 char name[100];
11632 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
11633
11634 sprintf(name, "__internalValue%03X", internalValueCounter++);
11635 if(!curCompound->compound.declarations)
11636 curCompound->compound.declarations = MkList();
11637 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
11638 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
11639 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
11640 e->compound = MkCompoundStmt((((void *)0)), stmts);
11641 }
11642 else
11643 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
11644 {
11645 struct Type * type = e->destType;
11646
11647 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11648 CopyTypeInto(e->destType, type);
11649 e->destType->refCount = 1;
11650 e->destType->classObjectType = 0;
11651 FreeType(type);
11652 }
11653 e->compound->compound.context = context;
11654 PopContext(context);
11655 curContext = context->parent;
11656 }
11657 }
11658 checkedExp = e;
11659 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11660 {
11661 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11662 {
11663 if(checkedExp->type == 25)
11664 {
11665 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11666 }
11667 else
11668 checkedExp = (*checkedExp->list).last;
11669 }
11670 else if(checkedExp->type == 11)
11671 checkedExp = checkedExp->cast.exp;
11672 }
11673 {
11674 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11675
11676 *operand = *checkedExp;
11677 checkedExp->destType = (((void *)0));
11678 checkedExp->expType = (((void *)0));
11679 __ecereMethod_Expression_Clear(checkedExp);
11680 checkedExp->type = 4;
11681 checkedExp->op.op = '&';
11682 checkedExp->op.exp1 = (((void *)0));
11683 checkedExp->op.exp2 = operand;
11684 }
11685 }
11686 }
11687 }
11688 }
11689 }
11690 {
11691 }
11692 if((!destType || destType->kind == 14 || destType->kind == 0) && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && (e->expType->byReference || (e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && (e->expType->_class->registered->type == 2 || e->expType->_class->registered->type == 4 || e->expType->_class->registered->type == 3))))
11693 {
11694 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
11695 {
11696 return ;
11697 }
11698 else
11699 {
11700 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11701
11702 *thisExp = *e;
11703 thisExp->prev = (((void *)0));
11704 thisExp->next = (((void *)0));
11705 __ecereMethod_Expression_Clear(e);
11706 e->type = 5;
11707 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
11708 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
11709 ((struct Expression *)(*e->list).first)->byReference = 0x1;
11710 {
11711 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11712 CopyTypeInto(e->expType, thisExp->expType);
11713 e->expType->byReference = 0x0;
11714 e->expType->refCount = 1;
11715 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && (e->expType->_class->registered->type == 2 || e->expType->_class->registered->type == 4 || e->expType->_class->registered->type == 3))
11716 {
11717 e->expType->classObjectType = 0;
11718 }
11719 }
11720 }
11721 }
11722 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
11723 {
11724 if(destType->kind == 14)
11725 {
11726 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
11727 }
11728 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
11729 {
11730 unsigned int byReference = e->expType->byReference;
11731 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11732 struct Declarator * decl;
11733 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11734 char typeString[1024];
11735 struct Type * type;
11736 int backupClassObjectType;
11737
11738 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
11739 type = e->expType;
11740 else
11741 type = destType;
11742 backupClassObjectType = type->classObjectType;
11743 type->classObjectType = 0;
11744 typeString[0] = '\0';
11745 PrintType(type, typeString, 0x0, 0x1);
11746 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11747 type->classObjectType = backupClassObjectType;
11748 *thisExp = *e;
11749 thisExp->prev = (((void *)0));
11750 thisExp->next = (((void *)0));
11751 __ecereMethod_Expression_Clear(e);
11752 if((type->kind == 8 && type->_class && type->_class->registered && strcmp(type->_class->registered->fullName, "ecere::com::Instance") && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
11753 {
11754 e->type = 4;
11755 e->op.op = '*';
11756 e->op.exp1 = (((void *)0));
11757 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
11758 }
11759 else
11760 {
11761 e->type = 11;
11762 e->cast.typeName = MkTypeName(specs, decl);
11763 e->cast.exp = thisExp;
11764 e->byReference = 0x1;
11765 }
11766 e->expType = type;
11767 e->destType = destType;
11768 type->refCount++;
11769 destType->refCount++;
11770 }
11771 }
11772 }
11773
11774 extern char *  strstr(char * , const char * );
11775
11776 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
11777
11778 struct __ecereNameSpace__ecere__com__DefinedExpression
11779 {
11780 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
11781 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
11782 char *  name;
11783 char *  value;
11784 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
11785 };
11786
11787 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11788
11789 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11790
11791 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
11792
11793 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
11794
11795 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
11796
11797 extern struct Expression * CopyExpression(struct Expression * exp);
11798
11799 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
11800
11801 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
11802
11803 static void ProcessStatement(struct Statement * stmt);
11804
11805 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
11806
11807 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
11808
11809 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
11810
11811 extern char *  sourceFile;
11812
11813 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
11814
11815 void ProcessExpressionType(struct Expression * exp)
11816 {
11817 void * __ecereTemp2;
11818 void * __ecereTemp1;
11819 unsigned int unresolved = 0x0;
11820 struct Location oldyylloc = yylloc;
11821 unsigned int notByReference = 0x0;
11822
11823 if(!exp || exp->expType)
11824 return ;
11825 yylloc = exp->loc;
11826 switch(exp->type)
11827 {
11828 case 0:
11829 {
11830 struct Identifier * id = exp->identifier;
11831
11832 if(!id)
11833 return ;
11834 if(id->_class && id->_class->name)
11835 {
11836 id->classSym = id->_class->symbol;
11837 }
11838 if(strstr(id->string, "__ecereClass") == id->string)
11839 {
11840 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
11841 break;
11842 }
11843 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
11844 {
11845 ReplaceClassMembers(exp, thisClass);
11846 if(exp->type != 0)
11847 {
11848 ProcessExpressionType(exp);
11849 break;
11850 }
11851 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
11852 break;
11853 }
11854 else
11855 {
11856 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11857
11858 if(!symbol)
11859 {
11860 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
11861 break;
11862 else
11863 {
11864 if(thisClass)
11865 {
11866 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
11867 if(exp->type != 0)
11868 {
11869 ProcessExpressionType(exp);
11870 break;
11871 }
11872 }
11873 else if(currentClass && !id->_class)
11874 {
11875 if(ResolveIdWithClass(exp, currentClass, 0x1))
11876 break;
11877 }
11878 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11879 }
11880 }
11881 if(symbol)
11882 {
11883 struct Type * type = symbol->type;
11884 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
11885
11886 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
11887 {
11888 struct Context * context = SetupTemplatesContext(_class);
11889
11890 type = ReplaceThisClassType(_class);
11891 FinishTemplatesContext(context);
11892 if(type)
11893 type->refCount = 0;
11894 }
11895 FreeSpecifier(id->_class);
11896 id->_class = (((void *)0));
11897 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11898 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
11899 id->classSym = (((void *)0));
11900 exp->expType = type;
11901 if(type)
11902 type->refCount++;
11903 if(type && (type->kind == 15 || (_class && _class->type == 4)))
11904 exp->isConstant = 0x1;
11905 if(symbol->isParam || !strcmp(id->string, "this"))
11906 {
11907 if(_class && _class->type == 1)
11908 exp->byReference = 0x1;
11909 }
11910 if(symbol->isIterator)
11911 {
11912 if(symbol->isIterator == 3)
11913 {
11914 exp->type = 5;
11915 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
11916 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
11917 exp->expType = (((void *)0));
11918 ProcessExpressionType(exp);
11919 }
11920 else if(symbol->isIterator != 4)
11921 {
11922 exp->type = 8;
11923 exp->member.exp = MkExpIdentifier(exp->identifier);
11924 exp->member.exp->expType = exp->expType;
11925 exp->member.member = MkIdentifier("data");
11926 exp->expType = (((void *)0));
11927 ProcessExpressionType(exp);
11928 }
11929 }
11930 break;
11931 }
11932 else
11933 {
11934 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
11935
11936 if(thisNameSpace && !(id->_class && !id->_class->name))
11937 {
11938 char name[1024];
11939
11940 strcpy(name, thisNameSpace);
11941 strcat(name, "::");
11942 strcat(name, id->string);
11943 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
11944 }
11945 if(!definedExp)
11946 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
11947 if(definedExp)
11948 {
11949 int c;
11950
11951 for(c = 0; c < definedExpStackPos; c++)
11952 if(definedExpStack[c] == definedExp)
11953 break;
11954 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
11955 {
11956 struct Location backupYylloc = yylloc;
11957
11958 definedExpStack[definedExpStackPos++] = definedExp;
11959 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11960 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
11961 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11962 echoOn = 0x0;
11963 parsedExpression = (((void *)0));
11964 resetScanner();
11965 expression_yyparse();
11966 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11967 yylloc = backupYylloc;
11968 if(parsedExpression)
11969 {
11970 FreeIdentifier(id);
11971 exp->type = 5;
11972 exp->list = MkListOne(parsedExpression);
11973 parsedExpression->loc = yylloc;
11974 ProcessExpressionType(exp);
11975 definedExpStackPos--;
11976 return ;
11977 }
11978 definedExpStackPos--;
11979 }
11980 else
11981 {
11982 if(inCompiler)
11983 {
11984 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
11985 }
11986 }
11987 }
11988 else
11989 {
11990 struct GlobalData * data = (((void *)0));
11991
11992 if(thisNameSpace && !(id->_class && !id->_class->name))
11993 {
11994 char name[1024];
11995
11996 strcpy(name, thisNameSpace);
11997 strcat(name, "::");
11998 strcat(name, id->string);
11999 data = FindGlobalData(name);
12000 }
12001 if(!data)
12002 data = FindGlobalData(id->string);
12003 if(data)
12004 {
12005 DeclareGlobalData(data);
12006 exp->expType = data->dataType;
12007 if(data->dataType)
12008 data->dataType->refCount++;
12009 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12010 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12011 FreeSpecifier(id->_class);
12012 id->_class = (((void *)0));
12013 break;
12014 }
12015 else
12016 {
12017 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12018
12019 if(thisNameSpace && !(id->_class && !id->_class->name))
12020 {
12021 char name[1024];
12022
12023 strcpy(name, thisNameSpace);
12024 strcat(name, "::");
12025 strcat(name, id->string);
12026 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12027 }
12028 if(!function)
12029 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12030 if(function)
12031 {
12032 char name[1024];
12033
12034 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12035 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12036 name[0] = (char)0;
12037 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12038 strcpy(name, "__ecereFunction_");
12039 FullClassNameCat(name, id->string, 0x0);
12040 if(DeclareFunction(function, name))
12041 {
12042 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12043 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12044 }
12045 exp->expType = function->dataType;
12046 if(function->dataType)
12047 function->dataType->refCount++;
12048 FreeSpecifier(id->_class);
12049 id->_class = (((void *)0));
12050 break;
12051 }
12052 }
12053 }
12054 }
12055 }
12056 unresolved = 0x1;
12057 break;
12058 }
12059 case 1:
12060 {
12061 struct __ecereNameSpace__ecere__com__Class * _class;
12062
12063 if(!exp->instance->_class)
12064 {
12065 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12066 {
12067 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12068 }
12069 }
12070 ProcessInstantiationType(exp->instance);
12071 exp->isConstant = exp->instance->isConstant;
12072 if(exp->instance->_class)
12073 {
12074 exp->expType = MkClassType(exp->instance->_class->name);
12075 }
12076 break;
12077 }
12078 case 2:
12079 {
12080 if(!exp->expType)
12081 {
12082 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12083
12084 exp->expType = type;
12085 if(exp->constant[0] == '\'')
12086 {
12087 if((int)((unsigned char *)exp->constant)[1] > 127)
12088 {
12089 int nb;
12090 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12091
12092 if(nb < 2)
12093 ch = exp->constant[1];
12094 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12095 exp->constant = PrintUInt(ch);
12096 type->kind = 8;
12097 type->_class = FindClass("unichar");
12098 type->isSigned = 0x0;
12099 }
12100 else
12101 {
12102 type->kind = 1;
12103 type->isSigned = 0x1;
12104 }
12105 }
12106 else if(strchr(exp->constant, '.'))
12107 {
12108 char ch = exp->constant[strlen(exp->constant) - 1];
12109
12110 if(ch == 'f')
12111 type->kind = 6;
12112 else
12113 type->kind = 7;
12114 type->isSigned = 0x1;
12115 }
12116 else
12117 {
12118 if(exp->constant[0] == '0' && exp->constant[1])
12119 type->isSigned = 0x0;
12120 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12121 type->isSigned = 0x0;
12122 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12123 type->isSigned = 0x0;
12124 else
12125 type->isSigned = 0x1;
12126 type->kind = 3;
12127 }
12128 exp->isConstant = 0x1;
12129 }
12130 break;
12131 }
12132 case 3:
12133 {
12134 exp->isConstant = 0x1;
12135 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->constant = 0x1, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
12136 break;
12137 }
12138 case 13:
12139 case 28:
12140 ProcessExpressionType(exp->_new.size);
12141 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), ((struct Type *)__ecereTemp1));
12142 DeclareType(exp->expType->type, 0x0, 0x0);
12143 break;
12144 case 14:
12145 case 29:
12146 ProcessExpressionType(exp->_renew.size);
12147 ProcessExpressionType(exp->_renew.exp);
12148 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12149 DeclareType(exp->expType->type, 0x0, 0x0);
12150 break;
12151 case 4:
12152 {
12153 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12154 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12155 unsigned int useDestType = 0x0, useSideType = 0x0;
12156 struct Location oldyylloc = yylloc;
12157 unsigned int useSideUnit = 0x0;
12158 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12159
12160 switch(exp->op.op)
12161 {
12162 case '=':
12163 case MUL_ASSIGN:
12164 case DIV_ASSIGN:
12165 case MOD_ASSIGN:
12166 case ADD_ASSIGN:
12167 case SUB_ASSIGN:
12168 case LEFT_ASSIGN:
12169 case RIGHT_ASSIGN:
12170 case AND_ASSIGN:
12171 case XOR_ASSIGN:
12172 case OR_ASSIGN:
12173 assign = 0x1;
12174 break;
12175 case '!':
12176 break;
12177 case AND_OP:
12178 case OR_OP:
12179 boolOps = 0x1;
12180 boolResult = 0x1;
12181 break;
12182 case EQ_OP:
12183 case '<':
12184 case '>':
12185 case LE_OP:
12186 case GE_OP:
12187 case NE_OP:
12188 boolResult = 0x1;
12189 useSideType = 0x1;
12190 break;
12191 case '+':
12192 case '-':
12193 useSideUnit = 0x1;
12194 case '|':
12195 case '&':
12196 case '^':
12197 case '/':
12198 case '%':
12199 case '*':
12200 if(exp->op.op != '*' || exp->op.exp1)
12201 {
12202 useSideType = 0x1;
12203 useDestType = 0x1;
12204 }
12205 break;
12206 }
12207 if(exp->op.op == '&')
12208 {
12209 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12210 {
12211 struct Identifier * id = exp->op.exp2->identifier;
12212 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12213
12214 if(symbol && symbol->isIterator == 2)
12215 {
12216 exp->type = 8;
12217 exp->member.exp = exp->op.exp2;
12218 exp->member.member = MkIdentifier("key");
12219 exp->expType = (((void *)0));
12220 exp->op.exp2->expType = symbol->type;
12221 symbol->type->refCount++;
12222 ProcessExpressionType(exp);
12223 FreeType(dummy);
12224 break;
12225 }
12226 }
12227 }
12228 if(exp->op.exp1)
12229 {
12230 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class && exp->destType->_class->registered && useDestType && ((exp->destType->_class->registered->type == 3 && useSideUnit) || exp->destType->_class->registered->type == 4 || exp->destType->_class->registered->type == 2))
12231 {
12232 if(exp->op.exp1->destType)
12233 FreeType(exp->op.exp1->destType);
12234 exp->op.exp1->destType = exp->destType;
12235 if(exp->destType)
12236 exp->destType->refCount++;
12237 }
12238 else if(!assign)
12239 {
12240 if(exp->op.exp1->destType)
12241 FreeType(exp->op.exp1->destType);
12242 exp->op.exp1->destType = dummy;
12243 dummy->refCount++;
12244 }
12245 if(exp->op.exp1->destType && exp->op.op != '=')
12246 exp->op.exp1->destType->count++;
12247 ProcessExpressionType(exp->op.exp1);
12248 if(exp->op.exp1->destType && exp->op.op != '=')
12249 exp->op.exp1->destType->count--;
12250 if(exp->op.exp1->destType == dummy)
12251 {
12252 FreeType(dummy);
12253 exp->op.exp1->destType = (((void *)0));
12254 }
12255 type1 = exp->op.exp1->expType;
12256 }
12257 if(exp->op.exp2)
12258 {
12259 char expString[10240];
12260
12261 expString[0] = '\0';
12262 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12263 {
12264 if(exp->op.exp1)
12265 {
12266 exp->op.exp2->destType = exp->op.exp1->expType;
12267 if(exp->op.exp1->expType)
12268 exp->op.exp1->expType->refCount++;
12269 }
12270 else
12271 {
12272 exp->op.exp2->destType = exp->destType;
12273 if(exp->destType)
12274 exp->destType->refCount++;
12275 }
12276 if(type1)
12277 type1->refCount++;
12278 exp->expType = type1;
12279 }
12280 else if(assign)
12281 {
12282 if(inCompiler)
12283 PrintExpression(exp->op.exp2, expString);
12284 if(type1 && type1->kind == 13)
12285 {
12286 if(exp->op.op == MUL_ASSIGN || exp->op.op == DIV_ASSIGN || exp->op.op == MOD_ASSIGN || exp->op.op == LEFT_ASSIGN || exp->op.op == RIGHT_ASSIGN || exp->op.op == AND_ASSIGN || exp->op.op == OR_ASSIGN)
12287 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12288 else if(exp->op.op == '=')
12289 {
12290 if(exp->op.exp2->destType)
12291 FreeType(exp->op.exp2->destType);
12292 exp->op.exp2->destType = type1;
12293 if(type1)
12294 type1->refCount++;
12295 }
12296 }
12297 else
12298 {
12299 if(exp->op.op == MUL_ASSIGN || exp->op.op == DIV_ASSIGN || exp->op.op == MOD_ASSIGN || exp->op.op == LEFT_ASSIGN || exp->op.op == RIGHT_ASSIGN)
12300 ;
12301 else
12302 {
12303 if(exp->op.exp2->destType)
12304 FreeType(exp->op.exp2->destType);
12305 exp->op.exp2->destType = type1;
12306 if(type1)
12307 type1->refCount++;
12308 }
12309 }
12310 if(type1)
12311 type1->refCount++;
12312 exp->expType = type1;
12313 }
12314 else if(exp->destType && exp->destType->kind == 8 && exp->destType->_class && exp->destType->_class->registered && ((exp->destType->_class->registered->type == 3 && useDestType && useSideUnit) || (exp->destType->_class->registered->type == 4 && useDestType)))
12315 {
12316 if(exp->op.exp2->destType)
12317 FreeType(exp->op.exp2->destType);
12318 exp->op.exp2->destType = exp->destType;
12319 if(exp->destType)
12320 exp->destType->refCount++;
12321 }
12322 else
12323 {
12324 if(exp->op.exp2->destType)
12325 FreeType(exp->op.exp2->destType);
12326 exp->op.exp2->destType = dummy;
12327 dummy->refCount++;
12328 }
12329 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12330 {
12331 FreeType(exp->op.exp2->destType);
12332 exp->op.exp2->destType = type1;
12333 type1->refCount++;
12334 }
12335 if(exp->op.exp2->destType && exp->op.op != '=')
12336 exp->op.exp2->destType->count++;
12337 ProcessExpressionType(exp->op.exp2);
12338 if(exp->op.exp2->destType && exp->op.op != '=')
12339 exp->op.exp2->destType->count--;
12340 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12341 {
12342 if(exp->op.exp2->expType->kind == 4 || exp->op.exp2->expType->kind == 3 || exp->op.exp2->expType->kind == 2 || exp->op.exp2->expType->kind == 1)
12343 {
12344 if(exp->op.op != '=' && type1->type->kind == 0)
12345 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12346 }
12347 else if(exp->op.exp2->expType->kind == 13 || exp->op.exp2->expType->kind == 12 || exp->op.exp2->expType->kind == 11 || exp->op.exp2->expType->kind == 16 || (type1->type->kind == 0 && exp->op.exp2->expType->kind == 8 && exp->op.exp2->expType->_class->registered && (exp->op.exp2->expType->_class->registered->type == 0 || exp->op.exp2->expType->_class->registered->type == 1 || exp->op.exp2->expType->_class->registered->type == 5)))
12348 {
12349 if(exp->op.op == ADD_ASSIGN)
12350 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12351 }
12352 else if((exp->op.exp2->expType->kind == 8 && type1->kind == 13 && type1->type->kind == 8 && type1->type->_class == exp->op.exp2->expType->_class && exp->op.exp2->expType->_class->registered && exp->op.exp2->expType->_class->registered->type == 1))
12353 {
12354 if(exp->op.op == ADD_ASSIGN)
12355 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12356 }
12357 else if(inCompiler)
12358 {
12359 char type1String[1024];
12360 char type2String[1024];
12361
12362 type1String[0] = '\0';
12363 type2String[0] = '\0';
12364 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12365 PrintType(type1, type2String, 0x0, 0x1);
12366 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12367 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12368 }
12369 }
12370 if(exp->op.exp2->destType == dummy)
12371 {
12372 FreeType(dummy);
12373 exp->op.exp2->destType = (((void *)0));
12374 }
12375 type2 = exp->op.exp2->expType;
12376 }
12377 dummy->kind = 0;
12378 if(exp->op.op == SIZEOF)
12379 {
12380 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12381 exp->isConstant = 0x1;
12382 }
12383 else if(exp->op.op == '*' && !exp->op.exp1)
12384 {
12385 exp->expType = Dereference(type2);
12386 if(type2 && type2->kind == 8)
12387 notByReference = 0x1;
12388 }
12389 else if(exp->op.op == '&' && !exp->op.exp1)
12390 exp->expType = Reference(type2);
12391 else if(!assign)
12392 {
12393 if(boolOps)
12394 {
12395 if(exp->op.exp1)
12396 {
12397 if(exp->op.exp1->destType)
12398 FreeType(exp->op.exp1->destType);
12399 exp->op.exp1->destType = MkClassType("bool");
12400 exp->op.exp1->destType->truth = 0x1;
12401 if(!exp->op.exp1->expType)
12402 ProcessExpressionType(exp->op.exp1);
12403 else
12404 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12405 FreeType(exp->op.exp1->expType);
12406 exp->op.exp1->expType = MkClassType("bool");
12407 exp->op.exp1->expType->truth = 0x1;
12408 }
12409 if(exp->op.exp2)
12410 {
12411 if(exp->op.exp2->destType)
12412 FreeType(exp->op.exp2->destType);
12413 exp->op.exp2->destType = MkClassType("bool");
12414 exp->op.exp2->destType->truth = 0x1;
12415 if(!exp->op.exp2->expType)
12416 ProcessExpressionType(exp->op.exp2);
12417 else
12418 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12419 FreeType(exp->op.exp2->expType);
12420 exp->op.exp2->expType = MkClassType("bool");
12421 exp->op.exp2->expType->truth = 0x1;
12422 }
12423 }
12424 else if(exp->op.exp1 && exp->op.exp2 && ((useSideType) || ((!type1 || type1->kind != 8 || !strcmp(type1->_class->string, "String")) && (!type2 || type2->kind != 8 || !strcmp(type2->_class->string, "String")))))
12425 {
12426 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12427 {
12428 if(exp->op.exp2->destType)
12429 FreeType(exp->op.exp2->destType);
12430 exp->op.exp2->destType = type1;
12431 type1->refCount++;
12432 if(exp->op.exp1->destType)
12433 FreeType(exp->op.exp1->destType);
12434 exp->op.exp1->destType = type2;
12435 type2->refCount++;
12436 if(!boolResult && type1->kind == 8 && (!exp->destType || exp->destType->kind != 8) && type1->_class->registered && type1->_class->registered->type == 3 && type2->_class->registered && type2->_class->registered->type == 3 && type1->_class->registered != type2->_class->registered)
12437 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operating on %s and %s with an untyped result, assuming %s\n", (((void *)0))), type1->_class->string, type2->_class->string, type1->_class->string);
12438 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12439 {
12440 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12441
12442 if(argExp)
12443 {
12444 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12445
12446 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12447 ProcessExpressionType(exp->op.exp1);
12448 if(type2->kind != 13)
12449 {
12450 ProcessExpressionType(classExp);
12451 exp->op.exp2 = MkExpBrackets(MkListOne(MkExpOp(exp->op.exp2, '*', MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("5")), OR_OP, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("0"))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize"))))))));
12452 if(!exp->op.exp2->expType)
12453 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12454 ProcessExpressionType(exp->op.exp2);
12455 }
12456 }
12457 }
12458 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
12459 {
12460 if(type1->kind != 8 && type1->type->kind == 0)
12461 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12462 exp->expType = type1;
12463 if(type1)
12464 type1->refCount++;
12465 }
12466 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
12467 {
12468 if(type2->kind != 8 && type2->type->kind == 0)
12469 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12470 exp->expType = type2;
12471 if(type2)
12472 type2->refCount++;
12473 }
12474 else if((type1->kind == 13 && type2->kind != 13 && type2->kind != 12 && type2->kind != 11 && type2->kind != 16 && type2->kind != 8 && type2->kind != 19) || (type2->kind == 13 && type1->kind != 13 && type1->kind != 12 && type1->kind != 11 && type1->kind != 16 && type1->kind != 8 && type1->kind != 19))
12475 {
12476 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12477 }
12478 else
12479 {
12480 unsigned int success = 0x0;
12481
12482 if(type1->kind == 13 && type2->kind == 13)
12483 {
12484 if(exp->op.op == '+')
12485 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12486 else if(exp->op.op == '-')
12487 {
12488 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12489 {
12490 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12491 success = 0x1;
12492 if(type1->type->kind == 20)
12493 {
12494 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12495
12496 if(argExp)
12497 {
12498 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12499
12500 ProcessExpressionType(classExp);
12501 exp->type = 5;
12502 exp->list = MkListOne(MkExpOp(MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(exp->op.exp1))), exp->op.op, MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(exp->op.exp2)))))), '/', MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass"))), OR_OP, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass")))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize")))))));
12503 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12504 FreeType(dummy);
12505 return ;
12506 }
12507 }
12508 }
12509 }
12510 }
12511 if(!success && exp->op.exp1->type == 2)
12512 {
12513 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12514 {
12515 if(exp->expType)
12516 FreeType(exp->expType);
12517 exp->expType = exp->op.exp1->destType;
12518 if(exp->op.exp1->destType)
12519 exp->op.exp1->destType->refCount++;
12520 success = 0x1;
12521 }
12522 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12523 {
12524 if(exp->expType)
12525 FreeType(exp->expType);
12526 exp->expType = exp->op.exp2->destType;
12527 if(exp->op.exp2->destType)
12528 exp->op.exp2->destType->refCount++;
12529 success = 0x1;
12530 }
12531 }
12532 else if(!success)
12533 {
12534 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12535 {
12536 if(exp->expType)
12537 FreeType(exp->expType);
12538 exp->expType = exp->op.exp2->destType;
12539 if(exp->op.exp2->destType)
12540 exp->op.exp2->destType->refCount++;
12541 success = 0x1;
12542 }
12543 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12544 {
12545 if(exp->expType)
12546 FreeType(exp->expType);
12547 exp->expType = exp->op.exp1->destType;
12548 if(exp->op.exp1->destType)
12549 exp->op.exp1->destType->refCount++;
12550 success = 0x1;
12551 }
12552 }
12553 if(!success)
12554 {
12555 char expString1[10240];
12556 char expString2[10240];
12557 char type1[1024];
12558 char type2[1024];
12559
12560 expString1[0] = '\0';
12561 expString2[0] = '\0';
12562 type1[0] = '\0';
12563 type2[0] = '\0';
12564 if(inCompiler)
12565 {
12566 PrintExpression(exp->op.exp1, expString1);
12567 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12568 PrintExpression(exp->op.exp2, expString2);
12569 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12570 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12571 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12572 }
12573 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12574 }
12575 }
12576 }
12577 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12578 {
12579 if(exp->op.exp1->destType)
12580 FreeType(exp->op.exp1->destType);
12581 exp->op.exp1->destType = type2->_class->registered->dataType;
12582 if(type2->_class->registered->dataType)
12583 type2->_class->registered->dataType->refCount++;
12584 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12585 exp->expType = type2;
12586 if(type2)
12587 type2->refCount++;
12588 }
12589 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12590 {
12591 if(exp->op.exp2->destType)
12592 FreeType(exp->op.exp2->destType);
12593 exp->op.exp2->destType = type1->_class->registered->dataType;
12594 if(type1->_class->registered->dataType)
12595 type1->_class->registered->dataType->refCount++;
12596 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12597 exp->expType = type1;
12598 if(type1)
12599 type1->refCount++;
12600 }
12601 else if(type1)
12602 {
12603 unsigned int valid = 0x0;
12604
12605 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12606 {
12607 if(exp->op.exp2->destType)
12608 FreeType(exp->op.exp2->destType);
12609 if(!type1->_class->registered->dataType)
12610 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12611 exp->op.exp2->destType = type1->_class->registered->dataType;
12612 exp->op.exp2->destType->refCount++;
12613 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12614 type2 = exp->op.exp2->destType;
12615 exp->expType = type2;
12616 type2->refCount++;
12617 }
12618 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12619 {
12620 if(exp->op.exp1->destType)
12621 FreeType(exp->op.exp1->destType);
12622 if(!type2->_class->registered->dataType)
12623 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12624 exp->op.exp1->destType = type2->_class->registered->dataType;
12625 exp->op.exp1->destType->refCount++;
12626 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12627 type1 = exp->op.exp1->destType;
12628 exp->expType = type1;
12629 type1->refCount++;
12630 }
12631 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12632 {
12633 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12634 {
12635 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12636 {
12637 if(exp->expType)
12638 FreeType(exp->expType);
12639 exp->expType = exp->op.exp1->expType;
12640 if(exp->op.exp2->expType)
12641 exp->op.exp1->expType->refCount++;
12642 valid = 0x1;
12643 }
12644 }
12645 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12646 {
12647 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12648 {
12649 if(exp->expType)
12650 FreeType(exp->expType);
12651 exp->expType = exp->op.exp2->expType;
12652 if(exp->op.exp2->expType)
12653 exp->op.exp2->expType->refCount++;
12654 valid = 0x1;
12655 }
12656 }
12657 }
12658 if(!valid)
12659 {
12660 if(exp->op.exp2->destType)
12661 FreeType(exp->op.exp2->destType);
12662 exp->op.exp2->destType = type1;
12663 type1->refCount++;
12664 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12665 {
12666 if(exp->expType)
12667 FreeType(exp->expType);
12668 exp->expType = exp->op.exp2->destType;
12669 if(exp->op.exp2->destType)
12670 exp->op.exp2->destType->refCount++;
12671 }
12672 else if(type1 && type2)
12673 {
12674 char expString1[10240];
12675 char expString2[10240];
12676 char type1String[1024];
12677 char type2String[1024];
12678
12679 expString1[0] = '\0';
12680 expString2[0] = '\0';
12681 type1String[0] = '\0';
12682 type2String[0] = '\0';
12683 if(inCompiler)
12684 {
12685 PrintExpression(exp->op.exp1, expString1);
12686 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12687 PrintExpression(exp->op.exp2, expString2);
12688 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12689 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12690 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12691 }
12692 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
12693 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12694 {
12695 exp->expType = exp->op.exp1->expType;
12696 if(exp->op.exp1->expType)
12697 exp->op.exp1->expType->refCount++;
12698 }
12699 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12700 {
12701 exp->expType = exp->op.exp2->expType;
12702 if(exp->op.exp2->expType)
12703 exp->op.exp2->expType->refCount++;
12704 }
12705 }
12706 }
12707 }
12708 else if(type2)
12709 {
12710 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12711 {
12712 struct Type * oldType = exp->op.exp1->expType;
12713
12714 exp->op.exp1->expType = (((void *)0));
12715 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12716 FreeType(oldType);
12717 else
12718 exp->op.exp1->expType = oldType;
12719 }
12720 if(exp->op.exp1->destType)
12721 FreeType(exp->op.exp1->destType);
12722 exp->op.exp1->destType = type2;
12723 type2->refCount++;
12724 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12725 {
12726 if(exp->expType)
12727 FreeType(exp->expType);
12728 exp->expType = exp->op.exp1->destType;
12729 if(exp->op.exp1->destType)
12730 exp->op.exp1->destType->refCount++;
12731 }
12732 }
12733 }
12734 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12735 {
12736 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12737 {
12738 if(exp->op.exp1->destType)
12739 FreeType(exp->op.exp1->destType);
12740 exp->op.exp1->destType = type2->_class->registered->dataType;
12741 if(type2->_class->registered->dataType)
12742 type2->_class->registered->dataType->refCount++;
12743 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12744 }
12745 if(exp->op.op == '!')
12746 {
12747 exp->expType = MkClassType("bool");
12748 exp->expType->truth = 0x1;
12749 }
12750 else
12751 {
12752 exp->expType = type2;
12753 if(type2)
12754 type2->refCount++;
12755 }
12756 }
12757 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
12758 {
12759 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12760 {
12761 if(exp->op.exp2->destType)
12762 FreeType(exp->op.exp2->destType);
12763 exp->op.exp2->destType = type1->_class->registered->dataType;
12764 if(type1->_class->registered->dataType)
12765 type1->_class->registered->dataType->refCount++;
12766 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12767 }
12768 exp->expType = type1;
12769 if(type1)
12770 type1->refCount++;
12771 }
12772 }
12773 yylloc = exp->loc;
12774 if(exp->op.exp1 && !exp->op.exp1->expType)
12775 {
12776 char expString[10000];
12777
12778 expString[0] = '\0';
12779 if(inCompiler)
12780 {
12781 PrintExpression(exp->op.exp1, expString);
12782 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12783 }
12784 if(expString[0])
12785 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12786 }
12787 if(exp->op.exp2 && !exp->op.exp2->expType)
12788 {
12789 char expString[10240];
12790
12791 expString[0] = '\0';
12792 if(inCompiler)
12793 {
12794 PrintExpression(exp->op.exp2, expString);
12795 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12796 }
12797 if(expString[0])
12798 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12799 }
12800 if(boolResult)
12801 {
12802 FreeType(exp->expType);
12803 exp->expType = MkClassType("bool");
12804 exp->expType->truth = 0x1;
12805 }
12806 if(exp->op.op != SIZEOF)
12807 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
12808 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
12809 {
12810 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
12811 }
12812 yylloc = oldyylloc;
12813 FreeType(dummy);
12814 break;
12815 }
12816 case 5:
12817 case 34:
12818 {
12819 struct Expression * e;
12820
12821 exp->isConstant = 0x1;
12822 for(e = (*exp->list).first; e; e = e->next)
12823 {
12824 unsigned int inced = 0x0;
12825
12826 if(!e->next)
12827 {
12828 FreeType(e->destType);
12829 e->destType = exp->destType;
12830 if(e->destType)
12831 {
12832 exp->destType->refCount++;
12833 e->destType->count++;
12834 inced = 0x1;
12835 }
12836 }
12837 ProcessExpressionType(e);
12838 if(inced)
12839 exp->destType->count--;
12840 if(!exp->expType && !e->next)
12841 {
12842 exp->expType = e->expType;
12843 if(e->expType)
12844 e->expType->refCount++;
12845 }
12846 if(!e->isConstant)
12847 exp->isConstant = 0x0;
12848 }
12849 e = (*exp->list).first;
12850 if(!e->next && e->type == 8)
12851 {
12852 struct Expression * next = exp->next, * prev = exp->prev;
12853
12854 FreeType(exp->expType);
12855 FreeType(exp->destType);
12856 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
12857 *exp = *e;
12858 exp->prev = prev;
12859 exp->next = next;
12860 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
12861 ProcessExpressionType(exp);
12862 }
12863 break;
12864 }
12865 case 6:
12866 {
12867 struct Expression * e;
12868
12869 exp->isConstant = 0x1;
12870 ProcessExpressionType(exp->index.exp);
12871 if(!exp->index.exp->isConstant)
12872 exp->isConstant = 0x0;
12873 if(exp->index.exp->expType)
12874 {
12875 struct Type * source = exp->index.exp->expType;
12876
12877 if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass) && source->_class->registered->templateArgs)
12878 {
12879 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
12880
12881 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
12882 if(exp->index.index && (*exp->index.index).last)
12883 {
12884 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
12885 }
12886 }
12887 }
12888 for(e = (*exp->index.index).first; e; e = e->next)
12889 {
12890 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
12891 {
12892 if(e->destType)
12893 FreeType(e->destType);
12894 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
12895 }
12896 ProcessExpressionType(e);
12897 if(!e->next)
12898 {
12899 }
12900 if(!e->isConstant)
12901 exp->isConstant = 0x0;
12902 }
12903 if(!exp->expType)
12904 exp->expType = Dereference(exp->index.exp->expType);
12905 if(exp->expType)
12906 DeclareType(exp->expType, 0x0, 0x0);
12907 break;
12908 }
12909 case 7:
12910 {
12911 struct Expression * e;
12912 struct Type * functionType;
12913 struct Type * methodType = (((void *)0));
12914 char name[1024];
12915
12916 name[0] = '\0';
12917 if(inCompiler)
12918 {
12919 PrintExpression(exp->call.exp, name);
12920 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
12921 {
12922 PrintExpression(exp->call.exp, name);
12923 }
12924 }
12925 if(exp->call.exp->type == 0)
12926 {
12927 struct Expression * idExp = exp->call.exp;
12928 struct Identifier * id = idExp->identifier;
12929
12930 if(!strcmp(id->string, "__ENDIAN_PAD"))
12931 {
12932 exp->expType = ProcessTypeString("int", 0x1);
12933 if(exp->call.arguments && (*exp->call.arguments).first)
12934 ProcessExpressionType((*exp->call.arguments).first);
12935 break;
12936 }
12937 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
12938 {
12939 struct Expression * a = (((void *)0));
12940 struct Expression * b = (((void *)0));
12941 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
12942
12943 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
12944 {
12945 a = (*exp->call.arguments).first;
12946 b = (*exp->call.arguments).last;
12947 tempExp1 = a;
12948 tempExp2 = b;
12949 }
12950 else if((*exp->call.arguments).count == 1)
12951 {
12952 a = (*exp->call.arguments).first;
12953 tempExp1 = a;
12954 }
12955 if(a)
12956 {
12957 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
12958 idExp->identifier = (((void *)0));
12959 FreeExpContents(exp);
12960 ProcessExpressionType(a);
12961 if(b)
12962 ProcessExpressionType(b);
12963 exp->type = 5;
12964 exp->list = MkList();
12965 if(a->expType && (!b || b->expType))
12966 {
12967 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
12968 {
12969 if(inCompiler)
12970 {
12971 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12972 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
12973 struct Declaration * decl;
12974 char temp1[1024], temp2[1024];
12975
12976 GetTypeSpecs(a->expType, specs);
12977 if(a && !a->isConstant && a->type != 0)
12978 {
12979 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
12980 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
12981 tempExp1 = QMkExpId(temp1);
12982 tempExp1->expType = a->expType;
12983 if(a->expType)
12984 a->expType->refCount++;
12985 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
12986 }
12987 if(b && !b->isConstant && b->type != 0)
12988 {
12989 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
12990 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
12991 tempExp2 = QMkExpId(temp2);
12992 tempExp2->expType = b->expType;
12993 if(b->expType)
12994 b->expType->refCount++;
12995 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
12996 }
12997 decl = MkDeclaration(specs, decls);
12998 if(!curCompound->compound.declarations)
12999 curCompound->compound.declarations = MkList();
13000 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13001 }
13002 }
13003 }
13004 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13005 {
13006 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13007
13008 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13009 exp->expType = a->expType;
13010 if(a->expType)
13011 a->expType->refCount++;
13012 }
13013 else if(!strcmp(id->string, "Abs"))
13014 {
13015 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13016 exp->expType = a->expType;
13017 if(a->expType)
13018 a->expType->refCount++;
13019 }
13020 else if(!strcmp(id->string, "Sgn"))
13021 {
13022 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '!', CopyExpression(tempExp1)))), MkListOne(MkExpConstant("0")), MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpConstant("-1")), MkExpConstant("1"))))));
13023 exp->expType = ProcessTypeString("int", 0x0);
13024 }
13025 FreeExpression(tempExp1);
13026 if(tempExp2)
13027 FreeExpression(tempExp2);
13028 FreeIdentifier(id);
13029 break;
13030 }
13031 }
13032 }
13033 {
13034 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13035
13036 if(!exp->call.exp->destType)
13037 {
13038 exp->call.exp->destType = dummy;
13039 dummy->refCount++;
13040 }
13041 ProcessExpressionType(exp->call.exp);
13042 if(exp->call.exp->destType == dummy)
13043 {
13044 FreeType(dummy);
13045 exp->call.exp->destType = (((void *)0));
13046 }
13047 FreeType(dummy);
13048 }
13049 functionType = exp->call.exp->expType;
13050 if(functionType && functionType->kind == 16)
13051 {
13052 methodType = functionType;
13053 functionType = methodType->method->dataType;
13054 if(exp->call.exp->expType->usedClass)
13055 {
13056 char typeString[1024];
13057
13058 typeString[0] = '\0';
13059 PrintType(functionType, typeString, 0x1, 0x1);
13060 if(strstr(typeString, "thisclass"))
13061 {
13062 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13063 struct Declarator * decl;
13064
13065 {
13066 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13067
13068 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13069 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13070 thisClassParams = 0x0;
13071 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13072 {
13073 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13074
13075 thisClass = exp->call.exp->expType->usedClass;
13076 ProcessDeclarator(decl);
13077 thisClass = backupThisClass;
13078 }
13079 thisClassParams = 0x1;
13080 functionType = ProcessType(specs, decl);
13081 functionType->refCount = 0;
13082 FinishTemplatesContext(context);
13083 }
13084 FreeList(specs, FreeSpecifier);
13085 FreeDeclarator(decl);
13086 }
13087 }
13088 }
13089 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13090 {
13091 struct Type * type = functionType->type;
13092
13093 if(!functionType->refCount)
13094 {
13095 functionType->type = (((void *)0));
13096 FreeType(functionType);
13097 }
13098 functionType = type;
13099 }
13100 if(functionType && functionType->kind != 11)
13101 {
13102 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13103 }
13104 else if(functionType)
13105 {
13106 unsigned int emptyParams = 0x0, noParams = 0x0;
13107 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13108 struct Type * type = functionType->params.first;
13109 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13110 int extra = 0;
13111 struct Location oldyylloc = yylloc;
13112
13113 if(!type)
13114 emptyParams = 0x1;
13115 if(functionType->extraParam && e)
13116 {
13117 e->destType = MkClassType(functionType->thisClass->string);
13118 e = e->next;
13119 }
13120 if(!functionType->staticMethod)
13121 {
13122 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13123 {
13124 type = MkClassType(memberExp->member.exp->expType->_class->string);
13125 if(e)
13126 {
13127 e->destType = type;
13128 e = e->next;
13129 type = functionType->params.first;
13130 }
13131 else
13132 type->refCount = 0;
13133 }
13134 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13135 {
13136 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13137 if(e)
13138 {
13139 e->destType = type;
13140 e = e->next;
13141 type = functionType->params.first;
13142 }
13143 else
13144 type->refCount = 0;
13145 }
13146 }
13147 if(type && type->kind == 0)
13148 {
13149 noParams = 0x1;
13150 if(!type->refCount)
13151 FreeType(type);
13152 type = (((void *)0));
13153 }
13154 for(; e; e = e->next)
13155 {
13156 if(!type && !emptyParams)
13157 {
13158 yylloc = e->loc;
13159 if(methodType && methodType->methodClass)
13160 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13161 else
13162 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13163 break;
13164 }
13165 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13166 {
13167 struct Type * templatedType = (((void *)0));
13168 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13169 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13170 int id = 0;
13171
13172 if(_class && _class->templateArgs)
13173 {
13174 struct __ecereNameSpace__ecere__com__Class * sClass;
13175
13176 for(sClass = _class; sClass; sClass = sClass->base)
13177 {
13178 if(sClass->templateClass)
13179 sClass = sClass->templateClass;
13180 id = 0;
13181 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13182 {
13183 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13184 {
13185 struct __ecereNameSpace__ecere__com__Class * nextClass;
13186
13187 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13188 {
13189 if(nextClass->templateClass)
13190 nextClass = nextClass->templateClass;
13191 id += nextClass->templateParams.count;
13192 }
13193 break;
13194 }
13195 id++;
13196 }
13197 if(curParam)
13198 break;
13199 }
13200 }
13201 if(curParam && _class->templateArgs[id].dataTypeString)
13202 {
13203 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13204
13205 {
13206 struct Context * context = SetupTemplatesContext(_class);
13207
13208 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13209 FinishTemplatesContext(context);
13210 }
13211 e->destType = templatedType;
13212 if(templatedType)
13213 {
13214 templatedType->passAsTemplate = 0x1;
13215 }
13216 }
13217 else
13218 {
13219 e->destType = type;
13220 if(type)
13221 type->refCount++;
13222 }
13223 }
13224 else
13225 {
13226 e->destType = type;
13227 if(type)
13228 type->refCount++;
13229 }
13230 if(type && type->kind != 14)
13231 {
13232 struct Type * next = type->next;
13233
13234 if(!type->refCount)
13235 FreeType(type);
13236 type = next;
13237 }
13238 }
13239 if(type && type->kind != 14)
13240 {
13241 if(methodType && methodType->methodClass)
13242 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13243 else
13244 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13245 }
13246 yylloc = oldyylloc;
13247 if(type && !type->refCount)
13248 FreeType(type);
13249 }
13250 else
13251 {
13252 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13253 if(exp->call.exp->type == 0)
13254 {
13255 char * string = exp->call.exp->identifier->string;
13256
13257 if(inCompiler)
13258 {
13259 struct Symbol * symbol;
13260 struct Location oldyylloc = yylloc;
13261
13262 yylloc = exp->call.exp->identifier->loc;
13263 if(strstr(string, "__builtin_") == string)
13264 ;
13265 else
13266 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13267 symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString(string), ((struct Symbol *)__ecereTemp1)->type = ProcessTypeString("int()", 0x1), ((struct Symbol *)__ecereTemp1));
13268 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13269 if(strstr(symbol->string, "::"))
13270 globalContext->hasNameSpace = 0x1;
13271 yylloc = oldyylloc;
13272 }
13273 }
13274 else if(exp->call.exp->type == 8)
13275 {
13276 }
13277 else
13278 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13279 if(!functionType->returnType)
13280 {
13281 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13282 }
13283 }
13284 if(functionType && functionType->kind == 11)
13285 {
13286 exp->expType = functionType->returnType;
13287 if(functionType->returnType)
13288 functionType->returnType->refCount++;
13289 if(!functionType->refCount)
13290 FreeType(functionType);
13291 }
13292 if(exp->call.arguments)
13293 {
13294 for(e = (*exp->call.arguments).first; e; e = e->next)
13295 {
13296 struct Type * destType = e->destType;
13297
13298 ProcessExpressionType(e);
13299 }
13300 }
13301 break;
13302 }
13303 case 8:
13304 {
13305 struct Type * type;
13306 struct Location oldyylloc = yylloc;
13307 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13308
13309 exp->thisPtr = thisPtr;
13310 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13311 {
13312 exp->member.member->classSym = exp->member.member->_class->symbol;
13313 }
13314 ProcessExpressionType(exp->member.exp);
13315 if(exp->member.exp->expType && exp->member.exp->expType->kind == 8 && exp->member.exp->expType->_class && exp->member.exp->expType->_class->registered && exp->member.exp->expType->_class->registered->type == 0)
13316 {
13317 exp->isConstant = 0x0;
13318 }
13319 else
13320 exp->isConstant = exp->member.exp->isConstant;
13321 type = exp->member.exp->expType;
13322 yylloc = exp->loc;
13323 if(type && (type->kind == 20))
13324 {
13325 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13326 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13327
13328 if(_class)
13329 {
13330 for(param = _class->templateParams.first; param; param = param->next)
13331 {
13332 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13333 break;
13334 }
13335 }
13336 if(param && param->defaultArg.member)
13337 {
13338 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13339
13340 if(argExp)
13341 {
13342 struct Expression * expMember = exp->member.exp;
13343 struct Declarator * decl;
13344 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13345 char thisClassTypeString[1024];
13346
13347 FreeIdentifier(exp->member.member);
13348 ProcessExpressionType(argExp);
13349 {
13350 char * colon = strstr(param->defaultArg.memberString, "::");
13351
13352 if(colon)
13353 {
13354 char className[1024];
13355 struct __ecereNameSpace__ecere__com__Class * sClass;
13356
13357 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13358 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13359 }
13360 else
13361 strcpy(thisClassTypeString, _class->fullName);
13362 }
13363 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13364 exp->expType = ProcessType(specs, decl);
13365 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13366 {
13367 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13368 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13369 int c;
13370 int paramCount = 0;
13371 int lastParam = -1;
13372 char templateString[1024];
13373 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13374
13375 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13376 for(cClass = expClass; cClass; cClass = cClass->base)
13377 {
13378 int p = 0;
13379
13380 for(param = cClass->templateParams.first; param; param = param->next)
13381 {
13382 int id = p;
13383 struct __ecereNameSpace__ecere__com__Class * sClass;
13384 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13385
13386 for(sClass = cClass->base; sClass; sClass = sClass->base)
13387 id += sClass->templateParams.count;
13388 arg = expClass->templateArgs[id];
13389 for(sClass = _class; sClass; sClass = sClass->base)
13390 {
13391 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13392 int p = 0;
13393 struct __ecereNameSpace__ecere__com__Class * nextClass;
13394
13395 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13396 p += nextClass->templateParams.count;
13397 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13398 {
13399 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13400 {
13401 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13402 {
13403 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13404 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13405 break;
13406 }
13407 }
13408 }
13409 }
13410 {
13411 char argument[256];
13412
13413 argument[0] = '\0';
13414 switch(param->type)
13415 {
13416 case 2:
13417 {
13418 char expString[1024];
13419 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13420 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13421 struct Expression * exp;
13422 char * string = PrintHexUInt64(arg.expression.ui64);
13423
13424 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13425 ProcessExpressionType(exp);
13426 ComputeExpression(exp);
13427 expString[0] = '\0';
13428 PrintExpression(exp, expString);
13429 strcat(argument, expString);
13430 FreeExpression(exp);
13431 break;
13432 }
13433 case 1:
13434 {
13435 strcat(argument, arg.member->name);
13436 break;
13437 }
13438 case 0:
13439 {
13440 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13441 {
13442 if(!strcmp(arg.dataTypeString, "thisclass"))
13443 strcat(argument, thisClassTypeString);
13444 else
13445 strcat(argument, arg.dataTypeString);
13446 }
13447 break;
13448 }
13449 }
13450 if(argument[0])
13451 {
13452 if(paramCount)
13453 strcat(templateString, ", ");
13454 if(lastParam != p - 1)
13455 {
13456 strcat(templateString, param->name);
13457 strcat(templateString, " = ");
13458 }
13459 strcat(templateString, argument);
13460 paramCount++;
13461 lastParam = p;
13462 }
13463 p++;
13464 }
13465 }
13466 }
13467 {
13468 int len = strlen(templateString);
13469
13470 if(templateString[len - 1] == '>')
13471 templateString[len++] = ' ';
13472 templateString[len++] = '>';
13473 templateString[len++] = '\0';
13474 }
13475 {
13476 struct Context * context = SetupTemplatesContext(_class);
13477
13478 FreeType(exp->expType);
13479 exp->expType = ProcessTypeString(templateString, 0x0);
13480 FinishTemplatesContext(context);
13481 }
13482 }
13483 exp->type = 5;
13484 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpBrackets(MkListOne(MkExpOp(MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), expMember))), '+', MkExpOp(MkExpMember(MkExpMember(argExp, MkIdentifier("member")), MkIdentifier("offset")), '+', MkExpMember(MkExpMember(MkExpMember(CopyExpression(argExp), MkIdentifier("member")), MkIdentifier("_class")), MkIdentifier("offset")))))))));
13485 }
13486 }
13487 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13488 {
13489 type = ProcessTemplateParameterType(type->templateParameter);
13490 }
13491 }
13492 if(type && (type->kind == 20))
13493 ;
13494 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13495 {
13496 struct Identifier * id = exp->member.member;
13497 int typeKind = type->kind;
13498 struct __ecereNameSpace__ecere__com__Class * _class = (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->registered : (type->_class ? type->_class->registered : (((void *)0)))) : (((void *)0));
13499
13500 if(typeKind == 19 && exp->member.exp->type == 26)
13501 {
13502 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13503 typeKind = 8;
13504 }
13505 if(id && (typeKind == 3 || typeKind == 15))
13506 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13507 if(_class && id)
13508 {
13509 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13510 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13511 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13512 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13513 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13514
13515 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13516 exp->member.memberType = 1;
13517 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13518 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13519 if(typeKind != 19)
13520 {
13521 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13522 {
13523 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13524 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13525 {
13526 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13527 if(prop)
13528 member = (((void *)0));
13529 }
13530 if(!member && !prop)
13531 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13532 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13533 exp->member.thisPtr = 0x1;
13534 }
13535 else
13536 {
13537 if(!id->classSym)
13538 {
13539 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13540 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13541 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13542 }
13543 if(!prop && !member)
13544 {
13545 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13546 if(!method)
13547 {
13548 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13549 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13550 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13551 }
13552 }
13553 if(member && prop)
13554 {
13555 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13556 prop = (((void *)0));
13557 else
13558 member = (((void *)0));
13559 }
13560 }
13561 }
13562 if(!prop && !member)
13563 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13564 if(!prop && !member && !method)
13565 {
13566 if(typeKind == 19)
13567 {
13568 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13569 if(classProp)
13570 {
13571 exp->member.memberType = 5;
13572 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13573 }
13574 else
13575 {
13576 char structName[1024];
13577 struct Identifier * id = exp->member.member;
13578 struct Expression * classExp = exp->member.exp;
13579
13580 type->refCount++;
13581 FreeType(classExp->expType);
13582 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13583 strcpy(structName, "__ecereClassData_");
13584 FullClassNameCat(structName, type->_class->string, 0x0);
13585 exp->type = 9;
13586 exp->member.member = id;
13587 exp->member.exp = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(type->_class->string)), (((void *)0))), MkIdentifier("offsetClass"))))))));
13588 FreeType(type);
13589 ProcessExpressionType(exp);
13590 return ;
13591 }
13592 }
13593 else
13594 {
13595 struct Symbol * classSym = FindClass(id->string);
13596
13597 if(classSym)
13598 {
13599 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13600
13601 if(convertClass)
13602 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13603 }
13604 }
13605 }
13606 if(prop)
13607 {
13608 exp->member.memberType = 1;
13609 if(!prop->dataType)
13610 ProcessPropertyType(prop);
13611 exp->expType = prop->dataType;
13612 if(prop->dataType)
13613 prop->dataType->refCount++;
13614 }
13615 else if(member)
13616 {
13617 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13618 {
13619 FreeExpContents(exp);
13620 exp->type = 0;
13621 exp->identifier = MkIdentifier("class");
13622 ProcessExpressionType(exp);
13623 return ;
13624 }
13625 exp->member.memberType = 3;
13626 DeclareStruct(_class->fullName, 0x0);
13627 if(!member->dataType)
13628 {
13629 struct Context * context = SetupTemplatesContext(_class);
13630
13631 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13632 FinishTemplatesContext(context);
13633 }
13634 exp->expType = member->dataType;
13635 if(member->dataType)
13636 member->dataType->refCount++;
13637 }
13638 else if(revConvert)
13639 {
13640 exp->member.memberType = 4;
13641 exp->expType = MkClassType(revConvert->_class->fullName);
13642 }
13643 else if(method)
13644 {
13645 if(inCompiler)
13646 {
13647 exp->member.memberType = 2;
13648 }
13649 if(!method->dataType)
13650 ProcessMethodType(method);
13651 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1));
13652 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13653 exp->expType->usedClass = _class;
13654 }
13655 else if(!classProp)
13656 {
13657 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13658 {
13659 FreeExpContents(exp);
13660 exp->type = 0;
13661 exp->identifier = MkIdentifier("class");
13662 ProcessExpressionType(exp);
13663 return ;
13664 }
13665 yylloc = exp->member.member->loc;
13666 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
13667 if(inCompiler)
13668 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13669 }
13670 if(_class && exp->expType)
13671 {
13672 struct __ecereNameSpace__ecere__com__Class * tClass;
13673
13674 tClass = _class;
13675 while(tClass && !tClass->templateClass)
13676 tClass = tClass->base;
13677 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13678 {
13679 int id = 0;
13680 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13681 struct __ecereNameSpace__ecere__com__Class * sClass;
13682
13683 for(sClass = tClass; sClass; sClass = sClass->base)
13684 {
13685 id = 0;
13686 if(sClass->templateClass)
13687 sClass = sClass->templateClass;
13688 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13689 {
13690 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13691 {
13692 for(sClass = sClass->base; sClass; sClass = sClass->base)
13693 id += sClass->templateParams.count;
13694 break;
13695 }
13696 id++;
13697 }
13698 if(curParam)
13699 break;
13700 }
13701 if(curParam && tClass->templateArgs[id].dataTypeString)
13702 {
13703 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13704 struct Context * context = SetupTemplatesContext(tClass);
13705
13706 FreeType(exp->expType);
13707 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13708 if(exp->expType)
13709 {
13710 if(exp->expType->kind == 21)
13711 {
13712 FreeType(exp->expType);
13713 exp->expType = ReplaceThisClassType(_class);
13714 }
13715 if(tClass->templateClass)
13716 exp->expType->passAsTemplate = 0x1;
13717 if(!exp->destType)
13718 {
13719 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13720 if(exp->destType->kind == 21)
13721 {
13722 FreeType(exp->destType);
13723 exp->destType = ReplaceThisClassType(_class);
13724 }
13725 }
13726 }
13727 FinishTemplatesContext(context);
13728 }
13729 }
13730 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13731 {
13732 int id = 0;
13733 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13734 struct __ecereNameSpace__ecere__com__Class * sClass;
13735
13736 for(sClass = tClass; sClass; sClass = sClass->base)
13737 {
13738 id = 0;
13739 if(sClass->templateClass)
13740 sClass = sClass->templateClass;
13741 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13742 {
13743 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13744 {
13745 for(sClass = sClass->base; sClass; sClass = sClass->base)
13746 id += sClass->templateParams.count;
13747 break;
13748 }
13749 id++;
13750 }
13751 if(curParam)
13752 break;
13753 }
13754 if(curParam)
13755 {
13756 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13757 struct Context * context = SetupTemplatesContext(tClass);
13758 struct Type * basicType;
13759
13760 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
13761 if(basicType)
13762 {
13763 if(basicType->kind == 21)
13764 {
13765 FreeType(basicType);
13766 basicType = ReplaceThisClassType(_class);
13767 }
13768 FreeType(exp->expType);
13769 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = basicType, ((struct Type *)__ecereTemp1));
13770 if(!exp->destType)
13771 {
13772 exp->destType = exp->expType;
13773 exp->destType->refCount++;
13774 }
13775 {
13776 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13777 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13778 struct Declarator * decl;
13779
13780 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
13781 *newExp = *exp;
13782 if(exp->destType)
13783 exp->destType->refCount++;
13784 if(exp->expType)
13785 exp->expType->refCount++;
13786 exp->type = 11;
13787 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
13788 exp->cast.exp = newExp;
13789 }
13790 }
13791 FinishTemplatesContext(context);
13792 }
13793 }
13794 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
13795 {
13796 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13797
13798 if(expClass)
13799 {
13800 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13801 int c;
13802 int p = 0;
13803 int paramCount = 0;
13804 int lastParam = -1;
13805 char templateString[1024];
13806 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13807
13808 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13809 while(cClass != expClass)
13810 {
13811 struct __ecereNameSpace__ecere__com__Class * sClass;
13812
13813 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
13814 ;
13815 cClass = sClass;
13816 for(param = cClass->templateParams.first; param; param = param->next)
13817 {
13818 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
13819 int c;
13820 int cp = 0;
13821 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
13822 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13823
13824 while(cClassCur != tClass && !paramCur)
13825 {
13826 struct __ecereNameSpace__ecere__com__Class * sClassCur;
13827
13828 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
13829 ;
13830 cClassCur = sClassCur;
13831 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
13832 {
13833 if(!strcmp(paramCur->name, param->name))
13834 {
13835 break;
13836 }
13837 cp++;
13838 }
13839 }
13840 if(paramCur && paramCur->type == 0)
13841 arg = tClass->templateArgs[cp];
13842 else
13843 arg = expClass->templateArgs[p];
13844 {
13845 char argument[256];
13846
13847 argument[0] = '\0';
13848 switch(param->type)
13849 {
13850 case 2:
13851 {
13852 char expString[1024];
13853 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13854 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13855 struct Expression * exp;
13856 char * string = PrintHexUInt64(arg.expression.ui64);
13857
13858 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13859 ProcessExpressionType(exp);
13860 ComputeExpression(exp);
13861 expString[0] = '\0';
13862 PrintExpression(exp, expString);
13863 strcat(argument, expString);
13864 FreeExpression(exp);
13865 break;
13866 }
13867 case 1:
13868 {
13869 strcat(argument, arg.member->name);
13870 break;
13871 }
13872 case 0:
13873 {
13874 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13875 strcat(argument, arg.dataTypeString);
13876 break;
13877 }
13878 }
13879 if(argument[0])
13880 {
13881 if(paramCount)
13882 strcat(templateString, ", ");
13883 if(lastParam != p - 1)
13884 {
13885 strcat(templateString, param->name);
13886 strcat(templateString, " = ");
13887 }
13888 strcat(templateString, argument);
13889 paramCount++;
13890 lastParam = p;
13891 }
13892 }
13893 p++;
13894 }
13895 }
13896 {
13897 int len = strlen(templateString);
13898
13899 if(templateString[len - 1] == '>')
13900 templateString[len++] = ' ';
13901 templateString[len++] = '>';
13902 templateString[len++] = '\0';
13903 }
13904 FreeType(exp->expType);
13905 {
13906 struct Context * context = SetupTemplatesContext(tClass);
13907
13908 exp->expType = ProcessTypeString(templateString, 0x0);
13909 FinishTemplatesContext(context);
13910 }
13911 }
13912 }
13913 }
13914 }
13915 else
13916 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "undefined class %s\n", (((void *)0))), (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->string : (type->_class ? type->_class->string : (((void *)0)))) : "(null)");
13917 }
13918 else if(type && (type->kind == 9 || type->kind == 10))
13919 {
13920 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
13921
13922 if(memberType)
13923 {
13924 exp->expType = memberType;
13925 if(memberType)
13926 memberType->refCount++;
13927 }
13928 }
13929 else
13930 {
13931 char expString[10240];
13932
13933 expString[0] = '\0';
13934 if(inCompiler)
13935 {
13936 PrintExpression(exp, expString);
13937 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13938 }
13939 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
13940 }
13941 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
13942 {
13943 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13944 {
13945 struct Identifier * id = exp->member.member;
13946 struct __ecereNameSpace__ecere__com__Class * _class = (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->registered : (type->_class ? type->_class->registered : (((void *)0)))) : (((void *)0));
13947
13948 if(_class)
13949 {
13950 FreeType(exp->expType);
13951 exp->expType = ReplaceThisClassType(_class);
13952 }
13953 }
13954 }
13955 yylloc = oldyylloc;
13956 break;
13957 }
13958 case 9:
13959 {
13960 struct Type * destType = exp->destType;
13961
13962 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13963 {
13964 exp->member.member->classSym = exp->member.member->_class->symbol;
13965 }
13966 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
13967 exp->type = 8;
13968 if(destType)
13969 destType->count++;
13970 ProcessExpressionType(exp);
13971 if(destType)
13972 destType->count--;
13973 break;
13974 }
13975 case 15:
13976 {
13977 struct Symbol * classSym = exp->_class->symbol;
13978
13979 if(classSym && classSym->registered)
13980 {
13981 if(classSym->registered->type == 5)
13982 {
13983 char name[1024];
13984
13985 name[0] = '\0';
13986 DeclareStruct(classSym->string, 0x0);
13987 FreeSpecifier(exp->_class);
13988 exp->type = 10;
13989 FullClassNameCat(name, classSym->string, 0x0);
13990 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
13991 }
13992 else
13993 {
13994 if(classSym->registered->fixed)
13995 {
13996 FreeSpecifier(exp->_class);
13997 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
13998 exp->type = 2;
13999 }
14000 else
14001 {
14002 char className[1024];
14003
14004 strcpy(className, "__ecereClass_");
14005 FullClassNameCat(className, classSym->string, 0x1);
14006 MangleClassName(className);
14007 DeclareClass(classSym, className);
14008 FreeExpContents(exp);
14009 exp->type = 9;
14010 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14011 exp->member.member = MkIdentifier("structSize");
14012 }
14013 }
14014 }
14015 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14016 break;
14017 }
14018 case 10:
14019 {
14020 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14021
14022 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14023 exp->isConstant = 0x1;
14024 DeclareType(type, 0x0, 0x0);
14025 FreeType(type);
14026 break;
14027 }
14028 case 11:
14029 {
14030 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14031
14032 type->count = (unsigned int)1;
14033 FreeType(exp->cast.exp->destType);
14034 exp->cast.exp->destType = type;
14035 type->refCount++;
14036 ProcessExpressionType(exp->cast.exp);
14037 type->count = (unsigned int)0;
14038 exp->expType = type;
14039 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14040 {
14041 void * prev = exp->prev, * next = exp->next;
14042 struct Type * expType = exp->cast.exp->destType;
14043 struct Expression * castExp = exp->cast.exp;
14044 struct Type * destType = exp->destType;
14045
14046 if(expType)
14047 expType->refCount++;
14048 FreeType(exp->expType);
14049 FreeTypeName(exp->cast.typeName);
14050 *exp = *castExp;
14051 FreeType(exp->expType);
14052 FreeType(exp->destType);
14053 exp->expType = expType;
14054 exp->destType = destType;
14055 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14056 exp->prev = prev;
14057 exp->next = next;
14058 }
14059 else
14060 {
14061 exp->isConstant = exp->cast.exp->isConstant;
14062 }
14063 break;
14064 }
14065 case 35:
14066 {
14067 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14068
14069 type->refCount++;
14070 exp->expType = type;
14071 break;
14072 }
14073 case 36:
14074 {
14075 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14076
14077 ProcessExpressionType(exp->vaArg.exp);
14078 type->refCount++;
14079 exp->expType = type;
14080 break;
14081 }
14082 case 12:
14083 {
14084 struct Expression * e;
14085
14086 exp->isConstant = 0x1;
14087 FreeType(exp->cond.cond->destType);
14088 exp->cond.cond->destType = MkClassType("bool");
14089 exp->cond.cond->destType->truth = 0x1;
14090 ProcessExpressionType(exp->cond.cond);
14091 if(!exp->cond.cond->isConstant)
14092 exp->isConstant = 0x0;
14093 for(e = (*exp->cond.exp).first; e; e = e->next)
14094 {
14095 if(!e->next)
14096 {
14097 FreeType(e->destType);
14098 e->destType = exp->destType;
14099 if(e->destType)
14100 e->destType->refCount++;
14101 }
14102 ProcessExpressionType(e);
14103 if(!e->next)
14104 {
14105 exp->expType = e->expType;
14106 if(e->expType)
14107 e->expType->refCount++;
14108 }
14109 if(!e->isConstant)
14110 exp->isConstant = 0x0;
14111 }
14112 FreeType(exp->cond.elseExp->destType);
14113 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14114 if(exp->cond.elseExp->destType)
14115 exp->cond.elseExp->destType->refCount++;
14116 ProcessExpressionType(exp->cond.elseExp);
14117 if(!exp->cond.elseExp->isConstant)
14118 exp->isConstant = 0x0;
14119 break;
14120 }
14121 case 25:
14122 {
14123 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14124 {
14125 struct Statement * last = (*exp->compound->compound.statements).last;
14126
14127 if(last->type == 3 && last->expressions && (*last->expressions).last)
14128 {
14129 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14130 if(exp->destType)
14131 exp->destType->refCount++;
14132 }
14133 ProcessStatement(exp->compound);
14134 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14135 if(((struct Expression *)(*last->expressions).last)->expType)
14136 exp->expType->refCount++;
14137 }
14138 break;
14139 }
14140 case 26:
14141 {
14142 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14143
14144 if(spec && spec->type == 1)
14145 {
14146 exp->expType = MkClassType(spec->name);
14147 exp->expType->kind = 19;
14148 exp->byReference = 0x1;
14149 }
14150 else
14151 {
14152 exp->expType = MkClassType("ecere::com::Class");
14153 exp->byReference = 0x1;
14154 }
14155 break;
14156 }
14157 case 27:
14158 {
14159 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14160
14161 if(_class)
14162 {
14163 struct Identifier * id = exp->classData.id;
14164 char structName[1024];
14165 struct Expression * classExp;
14166
14167 strcpy(structName, "__ecereClassData_");
14168 FullClassNameCat(structName, _class->fullName, 0x0);
14169 exp->type = 9;
14170 exp->member.member = id;
14171 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14172 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14173 else
14174 classExp = MkExpIdentifier(MkIdentifier("class"));
14175 exp->member.exp = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(_class->fullName)), (((void *)0))), MkIdentifier("offsetClass"))))))));
14176 ProcessExpressionType(exp);
14177 return ;
14178 }
14179 break;
14180 }
14181 case 37:
14182 {
14183 struct Type * type = (((void *)0));
14184 char * typeString = (((void *)0));
14185 char typeStringBuf[1024];
14186
14187 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class && exp->destType->_class->registered && exp->destType->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(exp->destType->_class->registered, containerClass))
14188 {
14189 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14190
14191 typeString = templateClass->templateArgs[2].dataTypeString;
14192 }
14193 else if(exp->list)
14194 {
14195 struct Expression * e;
14196
14197 for(e = (*exp->list).first; e; e = e->next)
14198 {
14199 ProcessExpressionType(e);
14200 if(e->expType)
14201 {
14202 if(!type)
14203 {
14204 type = e->expType;
14205 type->refCount++;
14206 }
14207 else
14208 {
14209 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14210 {
14211 FreeType(type);
14212 type = e->expType;
14213 e->expType = (((void *)0));
14214 e = (*exp->list).first;
14215 ProcessExpressionType(e);
14216 if(e->expType)
14217 {
14218 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14219 {
14220 FreeType(e->expType);
14221 e->expType = (((void *)0));
14222 FreeType(type);
14223 type = (((void *)0));
14224 break;
14225 }
14226 }
14227 }
14228 }
14229 if(e->expType)
14230 {
14231 FreeType(e->expType);
14232 e->expType = (((void *)0));
14233 }
14234 }
14235 }
14236 if(type)
14237 {
14238 typeStringBuf[0] = '\0';
14239 PrintType(type, typeStringBuf, 0x0, 0x1);
14240 typeString = typeStringBuf;
14241 FreeType(type);
14242 type = (((void *)0));
14243 }
14244 }
14245 if(typeString)
14246 {
14247 char templateString[1024];
14248 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14249 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14250 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14251 struct Expression * expExt;
14252 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14253
14254 sprintf(templateString, "Container<%s>", typeString);
14255 if(exp->list)
14256 {
14257 struct Expression * e;
14258
14259 type = ProcessTypeString(typeString, 0x0);
14260 while(e = (*exp->list).first)
14261 {
14262 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14263 e->destType = type;
14264 type->refCount++;
14265 ProcessExpressionType(e);
14266 ListAdd(initializers, MkInitializerAssignment(e));
14267 }
14268 FreeType(type);
14269 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14270 }
14271 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14272 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14273 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14274 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14275 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14276 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14277 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14278 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14279 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14280 ListAdd(structInitializers, MkInitializerAssignment((__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression), ((struct Expression *)__ecereTemp1)->type = 2, ((struct Expression *)__ecereTemp1)->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, 0), ((struct Expression *)__ecereTemp1))));
14281 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14282 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14283 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14284 exp->expType = ProcessTypeString(templateString, 0x0);
14285 exp->type = 5;
14286 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14287 ProcessExpressionType(expExt);
14288 }
14289 else
14290 {
14291 exp->expType = ProcessTypeString("Container", 0x0);
14292 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14293 }
14294 break;
14295 }
14296 }
14297 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14298 {
14299 FreeType(exp->expType);
14300 exp->expType = ReplaceThisClassType(thisClass);
14301 }
14302 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14303 {
14304 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14305
14306 if(symbol)
14307 {
14308 if(exp->expType->kind != 15)
14309 {
14310 struct Type * member;
14311 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14312
14313 FreeType(exp->expType);
14314 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14315 exp->expType->kind = symbol->type->kind;
14316 exp->expType->refCount++;
14317 exp->expType->enumName = enumName;
14318 exp->expType->members = symbol->type->members;
14319 for(member = symbol->type->members.first; member; member = member->next)
14320 member->refCount++;
14321 }
14322 else
14323 {
14324 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14325
14326 for(member = symbol->type->members.first; member; member = member->next)
14327 {
14328 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14329
14330 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14331 }
14332 }
14333 }
14334 }
14335 yylloc = exp->loc;
14336 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14337 ;
14338 else if(exp->destType && !exp->destType->keepCast)
14339 {
14340 if(!CheckExpressionType(exp, exp->destType, 0x0))
14341 {
14342 if(!exp->destType->count || unresolved)
14343 {
14344 if(!exp->expType)
14345 {
14346 yylloc = exp->loc;
14347 if(exp->destType->kind != 14)
14348 {
14349 char type2[1024];
14350
14351 type2[0] = '\0';
14352 if(inCompiler)
14353 {
14354 char expString[10240];
14355
14356 expString[0] = '\0';
14357 PrintType(exp->destType, type2, 0x0, 0x1);
14358 if(inCompiler)
14359 {
14360 PrintExpression(exp, expString);
14361 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14362 }
14363 if(unresolved)
14364 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14365 else if(exp->type != 16)
14366 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14367 }
14368 }
14369 else
14370 {
14371 char expString[10240];
14372
14373 expString[0] = '\0';
14374 if(inCompiler)
14375 {
14376 PrintExpression(exp, expString);
14377 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14378 }
14379 if(unresolved)
14380 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14381 else if(exp->type != 16)
14382 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14383 }
14384 }
14385 else
14386 {
14387 char type1[1024];
14388 char type2[1024];
14389
14390 type1[0] = '\0';
14391 type2[0] = '\0';
14392 if(inCompiler)
14393 {
14394 PrintType(exp->expType, type1, 0x0, 0x1);
14395 PrintType(exp->destType, type2, 0x0, 0x1);
14396 }
14397 if(exp->destType->truth && exp->destType->_class && exp->destType->_class->registered && !strcmp(exp->destType->_class->registered->name, "bool") && exp->expType->kind != 0 && exp->expType->kind != 9 && exp->expType->kind != 10 && (exp->expType->kind != 8 || exp->expType->classObjectType || (exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type != 1)))
14398 ;
14399 else
14400 {
14401 char expString[10240];
14402
14403 expString[0] = '\0';
14404 if(inCompiler)
14405 {
14406 PrintExpression(exp, expString);
14407 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14408 }
14409 if(strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec"))
14410 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14411 FreeType(exp->expType);
14412 exp->destType->refCount++;
14413 exp->expType = exp->destType;
14414 }
14415 }
14416 }
14417 }
14418 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14419 {
14420 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14421 char typeString[1024];
14422 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14423 struct Declarator * decl;
14424
14425 typeString[0] = '\0';
14426 *newExp = *exp;
14427 if(exp->expType)
14428 exp->expType->refCount++;
14429 if(exp->expType)
14430 exp->expType->refCount++;
14431 exp->type = 11;
14432 newExp->destType = exp->expType;
14433 PrintType(exp->expType, typeString, 0x0, 0x0);
14434 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14435 exp->cast.typeName = MkTypeName(specs, decl);
14436 exp->cast.exp = newExp;
14437 }
14438 }
14439 else if(unresolved)
14440 {
14441 if(exp->identifier->_class && exp->identifier->_class->name)
14442 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14443 else if(exp->identifier->string && exp->identifier->string[0])
14444 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14445 }
14446 else if(!exp->expType && exp->type != 16)
14447 {
14448 char expString[10240];
14449
14450 expString[0] = '\0';
14451 if(inCompiler)
14452 {
14453 PrintExpression(exp, expString);
14454 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14455 }
14456 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14457 }
14458 ApplyAnyObjectLogic(exp);
14459 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14460 {
14461 exp->byReference = 0x1;
14462 }
14463 yylloc = oldyylloc;
14464 }
14465
14466 static void FindNextDataMember(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class ** curClass, struct __ecereNameSpace__ecere__com__DataMember ** curMember, struct __ecereNameSpace__ecere__com__DataMember ** subMemberStack, int * subMemberStackPos)
14467 {
14468 if(*curMember)
14469 {
14470 *curMember = (*curMember)->next;
14471 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14472 {
14473 *curMember = subMemberStack[--(*subMemberStackPos)];
14474 *curMember = (*curMember)->next;
14475 }
14476 while((*curMember) && (*curMember)->isProperty)
14477 *curMember = (*curMember)->next;
14478 if(subMemberStackPos)
14479 {
14480 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14481 {
14482 subMemberStack[(*subMemberStackPos)++] = *curMember;
14483 *curMember = (*curMember)->members.first;
14484 while(*curMember && (*curMember)->isProperty)
14485 *curMember = (*curMember)->next;
14486 }
14487 }
14488 }
14489 while(!*curMember)
14490 {
14491 if(!*curMember)
14492 {
14493 if(subMemberStackPos && *subMemberStackPos)
14494 {
14495 *curMember = subMemberStack[--(*subMemberStackPos)];
14496 *curMember = (*curMember)->next;
14497 }
14498 else
14499 {
14500 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14501
14502 if(*curClass == _class)
14503 break;
14504 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14505 ;
14506 *curMember = (*curClass)->membersAndProperties.first;
14507 }
14508 while((*curMember) && (*curMember)->isProperty)
14509 *curMember = (*curMember)->next;
14510 if(subMemberStackPos)
14511 {
14512 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14513 {
14514 subMemberStack[(*subMemberStackPos)++] = *curMember;
14515 *curMember = (*curMember)->members.first;
14516 while(*curMember && (*curMember)->isProperty)
14517 *curMember = (*curMember)->next;
14518 }
14519 }
14520 }
14521 }
14522 }
14523
14524 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14525 {
14526 switch(init->type)
14527 {
14528 case 0:
14529 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14530 {
14531 if(init->exp && !init->exp->destType)
14532 {
14533 FreeType(init->exp->destType);
14534 init->exp->destType = type;
14535 if(type)
14536 type->refCount++;
14537 }
14538 if(init->exp)
14539 {
14540 ProcessExpressionType(init->exp);
14541 init->isConstant = init->exp->isConstant;
14542 }
14543 break;
14544 }
14545 else
14546 {
14547 struct Expression * exp = init->exp;
14548 struct Instantiation * inst = exp->instance;
14549 struct MembersInit * members;
14550
14551 init->type = 1;
14552 init->list = MkList();
14553 if(inst->members)
14554 {
14555 for(members = (*inst->members).first; members; members = members->next)
14556 {
14557 if(members->type == 0)
14558 {
14559 struct MemberInit * member;
14560
14561 for(member = (*members->dataMembers).first; member; member = member->next)
14562 {
14563 ListAdd(init->list, member->initializer);
14564 member->initializer = (((void *)0));
14565 }
14566 }
14567 }
14568 }
14569 FreeExpression(exp);
14570 }
14571 case 1:
14572 {
14573 struct Initializer * i;
14574 struct Type * initializerType = (((void *)0));
14575 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14576 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14577 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14578 int subMemberStackPos = 0;
14579
14580 if(type && type->kind == 12)
14581 initializerType = Dereference(type);
14582 else if(type && (type->kind == 9 || type->kind == 10))
14583 initializerType = type->members.first;
14584 for(i = (*init->list).first; i; i = i->next)
14585 {
14586 if(type && type->kind == 8 && type->_class && type->_class->registered)
14587 {
14588 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14589 if(curMember)
14590 {
14591 if(!curMember->dataType)
14592 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14593 initializerType = curMember->dataType;
14594 }
14595 }
14596 ProcessInitializer(i, initializerType);
14597 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14598 initializerType = initializerType->next;
14599 if(!i->isConstant)
14600 init->isConstant = 0x0;
14601 }
14602 if(type && type->kind == 12)
14603 FreeType(initializerType);
14604 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14605 {
14606 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14607 }
14608 break;
14609 }
14610 }
14611 }
14612
14613 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14614
14615 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14616
14617 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14618 {
14619 switch(spec->type)
14620 {
14621 case 0:
14622 {
14623 if(spec->specifier == THISCLASS)
14624 {
14625 if(thisClass)
14626 {
14627 spec->type = 1;
14628 spec->name = ReplaceThisClass(thisClass);
14629 spec->symbol = FindClass(spec->name);
14630 ProcessSpecifier(spec, declareStruct);
14631 }
14632 }
14633 break;
14634 }
14635 case 1:
14636 {
14637 struct Symbol * symbol = FindType(curContext, spec->name);
14638
14639 if(symbol)
14640 DeclareType(symbol->type, 0x1, 0x1);
14641 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14642 DeclareStruct(spec->name, 0x0);
14643 break;
14644 }
14645 case 2:
14646 {
14647 struct Enumerator * e;
14648
14649 if(spec->list)
14650 {
14651 for(e = (*spec->list).first; e; e = e->next)
14652 {
14653 if(e->exp)
14654 ProcessExpressionType(e->exp);
14655 }
14656 }
14657 break;
14658 }
14659 case 3:
14660 case 4:
14661 {
14662 if(spec->definitions)
14663 {
14664 struct ClassDef * def;
14665 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14666
14667 ProcessClass(spec->definitions, symbol);
14668 }
14669 break;
14670 }
14671 }
14672 }
14673
14674 static void ProcessDeclarator(struct Declarator * decl)
14675 {
14676 switch(decl->type)
14677 {
14678 case 1:
14679 if(decl->identifier->classSym)
14680 {
14681 FreeSpecifier(decl->identifier->_class);
14682 decl->identifier->_class = (((void *)0));
14683 }
14684 break;
14685 case 3:
14686 if(decl->array.exp)
14687 ProcessExpressionType(decl->array.exp);
14688 case 0:
14689 case 2:
14690 case 4:
14691 case 5:
14692 case 6:
14693 case 7:
14694 if(decl->declarator)
14695 ProcessDeclarator(decl->declarator);
14696 if(decl->type == 4)
14697 {
14698 struct Identifier * id = GetDeclId(decl);
14699
14700 if(id && id->_class)
14701 {
14702 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14703
14704 if(!decl->function.parameters)
14705 decl->function.parameters = MkList();
14706 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14707 id->_class = (((void *)0));
14708 }
14709 if(decl->function.parameters)
14710 {
14711 struct TypeName * param;
14712
14713 for(param = (*decl->function.parameters).first; param; param = param->next)
14714 {
14715 if(param->qualifiers && (*param->qualifiers).first)
14716 {
14717 struct Specifier * spec = (*param->qualifiers).first;
14718
14719 if(spec && spec->specifier == TYPED_OBJECT)
14720 {
14721 struct Declarator * d = param->declarator;
14722 struct TypeName * newParam = (newParam = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), newParam->qualifiers = MkListOne(MkSpecifier(VOID)), newParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d), newParam);
14723
14724 FreeList(param->qualifiers, FreeSpecifier);
14725 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14726 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14727 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14728 param = newParam;
14729 }
14730 else if(spec && spec->specifier == ANY_OBJECT)
14731 {
14732 struct Declarator * d = param->declarator;
14733
14734 FreeList(param->qualifiers, FreeSpecifier);
14735 param->qualifiers = MkListOne(MkSpecifier(VOID));
14736 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14737 }
14738 else if(spec->specifier == THISCLASS)
14739 {
14740 if(thisClass)
14741 {
14742 spec->type = 1;
14743 spec->name = ReplaceThisClass(thisClass);
14744 spec->symbol = FindClass(spec->name);
14745 ProcessSpecifier(spec, 0x0);
14746 }
14747 }
14748 }
14749 if(param->declarator)
14750 ProcessDeclarator(param->declarator);
14751 }
14752 }
14753 }
14754 break;
14755 }
14756 }
14757
14758 extern struct Identifier * CopyIdentifier(struct Identifier * id);
14759
14760 extern void FreeInitDeclarator(struct InitDeclarator * decl);
14761
14762 static void ProcessDeclaration(struct Declaration * decl)
14763 {
14764 yylloc = decl->loc;
14765 switch(decl->type)
14766 {
14767 case 1:
14768 {
14769 unsigned int declareStruct = 0x0;
14770
14771 if(decl->declarators)
14772 {
14773 struct InitDeclarator * d;
14774
14775 for(d = (*decl->declarators).first; d; d = d->next)
14776 {
14777 struct Type * type, * subType;
14778
14779 ProcessDeclarator(d->declarator);
14780 type = ProcessType(decl->specifiers, d->declarator);
14781 if(d->initializer)
14782 {
14783 ProcessInitializer(d->initializer, type);
14784 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
14785 {
14786 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
14787 {
14788 struct Instantiation * inst = d->initializer->exp->instance;
14789
14790 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
14791 d->initializer->exp->instance = (((void *)0));
14792 if(decl->specifiers)
14793 FreeList(decl->specifiers, FreeSpecifier);
14794 FreeList(decl->declarators, FreeInitDeclarator);
14795 d = (((void *)0));
14796 decl->type = 2;
14797 decl->inst = inst;
14798 }
14799 }
14800 }
14801 for(subType = type; subType; )
14802 {
14803 if(subType->kind == 8)
14804 {
14805 declareStruct = 0x1;
14806 break;
14807 }
14808 else if(subType->kind == 13)
14809 break;
14810 else if(subType->kind == 12)
14811 subType = subType->arrayType;
14812 else
14813 break;
14814 }
14815 FreeType(type);
14816 if(!d)
14817 break;
14818 }
14819 }
14820 if(decl->specifiers)
14821 {
14822 struct Specifier * s;
14823
14824 for(s = (*decl->specifiers).first; s; s = s->next)
14825 {
14826 ProcessSpecifier(s, declareStruct);
14827 }
14828 }
14829 break;
14830 }
14831 case 2:
14832 {
14833 ProcessInstantiationType(decl->inst);
14834 break;
14835 }
14836 case 0:
14837 {
14838 struct Specifier * spec;
14839 struct Declarator * d;
14840 unsigned int declareStruct = 0x0;
14841
14842 if(decl->declarators)
14843 {
14844 for(d = (*decl->declarators).first; d; d = d->next)
14845 {
14846 struct Type * type = ProcessType(decl->specifiers, d->declarator);
14847 struct Type * subType;
14848
14849 ProcessDeclarator(d);
14850 for(subType = type; subType; )
14851 {
14852 if(subType->kind == 8)
14853 {
14854 declareStruct = 0x1;
14855 break;
14856 }
14857 else if(subType->kind == 13)
14858 break;
14859 else if(subType->kind == 12)
14860 subType = subType->arrayType;
14861 else
14862 break;
14863 }
14864 FreeType(type);
14865 }
14866 }
14867 if(decl->specifiers)
14868 {
14869 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
14870 ProcessSpecifier(spec, declareStruct);
14871 }
14872 break;
14873 }
14874 }
14875 }
14876
14877 static struct FunctionDefinition * curFunction;
14878
14879 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
14880 {
14881 char propName[1024], propNameM[1024];
14882 char getName[1024], setName[1024];
14883 struct __ecereNameSpace__ecere__sys__OldList * args;
14884
14885 DeclareProperty(prop, setName, getName);
14886 strcpy(propName, "__ecereProp_");
14887 FullClassNameCat(propName, prop->_class->fullName, 0x0);
14888 strcat(propName, "_");
14889 FullClassNameCat(propName, prop->name, 0x1);
14890 MangleClassName(propName);
14891 strcpy(propNameM, "__ecerePropM_");
14892 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
14893 strcat(propNameM, "_");
14894 FullClassNameCat(propNameM, prop->name, 0x1);
14895 MangleClassName(propNameM);
14896 if(prop->isWatchable)
14897 {
14898 args = MkList();
14899 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14900 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14901 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14902 args = MkList();
14903 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14904 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14905 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14906 }
14907 {
14908 args = MkList();
14909 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14910 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14911 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14912 args = MkList();
14913 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14914 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14915 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14916 }
14917 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
14918 curFunction->propSet->fireWatchersDone = 0x1;
14919 }
14920
14921 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
14922
14923 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
14924
14925 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
14926
14927 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
14928
14929 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
14930
14931 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
14932
14933 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
14934
14935 extern void FreePropertyWatch(struct PropertyWatch * watcher);
14936
14937 static void ProcessStatement(struct Statement * stmt)
14938 {
14939 yylloc = stmt->loc;
14940 switch(stmt->type)
14941 {
14942 case 0:
14943 ProcessStatement(stmt->labeled.stmt);
14944 break;
14945 case 1:
14946 if(stmt->caseStmt.exp)
14947 {
14948 FreeType(stmt->caseStmt.exp->destType);
14949 stmt->caseStmt.exp->destType = curSwitchType;
14950 if(curSwitchType)
14951 curSwitchType->refCount++;
14952 ProcessExpressionType(stmt->caseStmt.exp);
14953 ComputeExpression(stmt->caseStmt.exp);
14954 }
14955 if(stmt->caseStmt.stmt)
14956 ProcessStatement(stmt->caseStmt.stmt);
14957 break;
14958 case 2:
14959 {
14960 if(stmt->compound.context)
14961 {
14962 struct Declaration * decl;
14963 struct Statement * s;
14964 struct Statement * prevCompound = curCompound;
14965 struct Context * prevContext = curContext;
14966
14967 if(!stmt->compound.isSwitch)
14968 {
14969 curCompound = stmt;
14970 curContext = stmt->compound.context;
14971 }
14972 if(stmt->compound.declarations)
14973 {
14974 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
14975 ProcessDeclaration(decl);
14976 }
14977 if(stmt->compound.statements)
14978 {
14979 for(s = (*stmt->compound.statements).first; s; s = s->next)
14980 ProcessStatement(s);
14981 }
14982 curContext = prevContext;
14983 curCompound = prevCompound;
14984 }
14985 break;
14986 }
14987 case 3:
14988 {
14989 struct Expression * exp;
14990
14991 if(stmt->expressions)
14992 {
14993 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
14994 ProcessExpressionType(exp);
14995 }
14996 break;
14997 }
14998 case 4:
14999 {
15000 struct Expression * exp;
15001
15002 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15003 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15004 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15005 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15006 {
15007 ProcessExpressionType(exp);
15008 }
15009 if(stmt->ifStmt.stmt)
15010 ProcessStatement(stmt->ifStmt.stmt);
15011 if(stmt->ifStmt.elseStmt)
15012 ProcessStatement(stmt->ifStmt.elseStmt);
15013 break;
15014 }
15015 case 5:
15016 {
15017 struct Type * oldSwitchType = curSwitchType;
15018
15019 if(stmt->switchStmt.exp)
15020 {
15021 struct Expression * exp;
15022
15023 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15024 {
15025 if(!exp->next)
15026 {
15027 ProcessExpressionType(exp);
15028 }
15029 if(!exp->next)
15030 curSwitchType = exp->expType;
15031 }
15032 }
15033 ProcessStatement(stmt->switchStmt.stmt);
15034 curSwitchType = oldSwitchType;
15035 break;
15036 }
15037 case 6:
15038 {
15039 if(stmt->whileStmt.exp)
15040 {
15041 struct Expression * exp;
15042
15043 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15044 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15045 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15046 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15047 {
15048 ProcessExpressionType(exp);
15049 }
15050 }
15051 if(stmt->whileStmt.stmt)
15052 ProcessStatement(stmt->whileStmt.stmt);
15053 break;
15054 }
15055 case 7:
15056 {
15057 if(stmt->doWhile.exp)
15058 {
15059 struct Expression * exp;
15060
15061 if((*stmt->doWhile.exp).last)
15062 {
15063 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15064 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15065 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15066 }
15067 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15068 {
15069 ProcessExpressionType(exp);
15070 }
15071 }
15072 if(stmt->doWhile.stmt)
15073 ProcessStatement(stmt->doWhile.stmt);
15074 break;
15075 }
15076 case 8:
15077 {
15078 struct Expression * exp;
15079
15080 if(stmt->forStmt.init)
15081 ProcessStatement(stmt->forStmt.init);
15082 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15083 {
15084 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15085 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15086 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15087 }
15088 if(stmt->forStmt.check)
15089 ProcessStatement(stmt->forStmt.check);
15090 if(stmt->forStmt.increment)
15091 {
15092 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15093 ProcessExpressionType(exp);
15094 }
15095 if(stmt->forStmt.stmt)
15096 ProcessStatement(stmt->forStmt.stmt);
15097 break;
15098 }
15099 case 18:
15100 {
15101 struct Identifier * id = stmt->forEachStmt.id;
15102 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15103 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15104 struct Statement * block = stmt->forEachStmt.stmt;
15105 char iteratorType[1024];
15106 struct Type * source;
15107 struct Expression * e;
15108 unsigned int isBuiltin = exp && (*exp).last && (((struct Expression *)(*exp).last)->type == 37 || (((struct Expression *)(*exp).last)->type == 11 && ((struct Expression *)(*exp).last)->cast.exp->type == 37));
15109 struct Expression * arrayExp;
15110 char * typeString = (((void *)0));
15111 int builtinCount = 0;
15112
15113 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15114 {
15115 if(!e->next)
15116 {
15117 FreeType(e->destType);
15118 e->destType = ProcessTypeString("Container", 0x0);
15119 }
15120 if(!isBuiltin || e->next)
15121 ProcessExpressionType(e);
15122 }
15123 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15124 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15125 {
15126 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15127 struct Symbol * symbol;
15128 struct Expression * expIt = (((void *)0));
15129 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15130 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15131 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15132 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15133
15134 stmt->type = 2;
15135 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15136 stmt->compound.context->parent = curContext;
15137 curContext = stmt->compound.context;
15138 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15139 {
15140 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15141 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15142
15143 isCustomAVLTree = 0x1;
15144 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15145 isAVLTree = 0x1;
15146 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15147 isMap = 0x1;
15148 }
15149 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15150 isArray = 0x1;
15151 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15152 {
15153 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15154
15155 isLinkList = 0x1;
15156 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15157 }
15158 if(isArray)
15159 {
15160 struct Declarator * decl;
15161 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15162
15163 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15164 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15165 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15166 }
15167 else if(isBuiltin)
15168 {
15169 struct Type * type = (((void *)0));
15170 char typeStringBuf[1024];
15171
15172 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15173 if(((struct Expression *)(*exp).last)->type == 11)
15174 {
15175 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15176
15177 if(typeName)
15178 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15179 }
15180 if(arrayExp->destType && arrayExp->destType->kind == 8 && arrayExp->destType->_class && arrayExp->destType->_class->registered && arrayExp->destType->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(arrayExp->destType->_class->registered, containerClass) && arrayExp->destType->_class->registered->templateArgs)
15181 {
15182 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15183
15184 typeString = templateClass->templateArgs[2].dataTypeString;
15185 }
15186 else if(arrayExp->list)
15187 {
15188 struct Expression * e;
15189
15190 for(e = (*arrayExp->list).first; e; e = e->next)
15191 {
15192 ProcessExpressionType(e);
15193 if(e->expType)
15194 {
15195 if(!type)
15196 {
15197 type = e->expType;
15198 type->refCount++;
15199 }
15200 else
15201 {
15202 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15203 {
15204 FreeType(type);
15205 type = e->expType;
15206 e->expType = (((void *)0));
15207 e = (*arrayExp->list).first;
15208 ProcessExpressionType(e);
15209 if(e->expType)
15210 {
15211 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15212 {
15213 FreeType(e->expType);
15214 e->expType = (((void *)0));
15215 FreeType(type);
15216 type = (((void *)0));
15217 break;
15218 }
15219 }
15220 }
15221 }
15222 if(e->expType)
15223 {
15224 FreeType(e->expType);
15225 e->expType = (((void *)0));
15226 }
15227 }
15228 }
15229 if(type)
15230 {
15231 typeStringBuf[0] = '\0';
15232 PrintType(type, typeStringBuf, 0x0, 0x1);
15233 typeString = typeStringBuf;
15234 FreeType(type);
15235 }
15236 }
15237 if(typeString)
15238 {
15239 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15240 struct Declarator * decl;
15241 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15242
15243 if(arrayExp->list)
15244 {
15245 struct Expression * e;
15246
15247 builtinCount = (*arrayExp->list).count;
15248 type = ProcessTypeString(typeString, 0x0);
15249 while(e = (*arrayExp->list).first)
15250 {
15251 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15252 e->destType = type;
15253 type->refCount++;
15254 ProcessExpressionType(e);
15255 ListAdd(initializers, MkInitializerAssignment(e));
15256 }
15257 FreeType(type);
15258 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15259 }
15260 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15261 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15262 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15263 FreeList(exp, FreeExpression);
15264 }
15265 else
15266 {
15267 arrayExp->expType = ProcessTypeString("Container", 0x0);
15268 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15269 }
15270 }
15271 else if(isLinkList && !isList)
15272 {
15273 struct Declarator * decl;
15274 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15275
15276 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15277 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15278 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15279 }
15280 else if(_class->templateArgs)
15281 {
15282 if(isMap)
15283 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15284 else
15285 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15286 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15287 }
15288 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15289 if(block && block->type == 2 && block->compound.context)
15290 {
15291 block->compound.context->parent = stmt->compound.context;
15292 }
15293 if(filter)
15294 {
15295 block = MkIfStmt(filter, block, (((void *)0)));
15296 }
15297 if(isArray)
15298 {
15299 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array"))))), MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<', MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array")), '+', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("count")))))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, (((void *)0)))), block));
15300 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15301 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15302 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15303 }
15304 else if(isBuiltin)
15305 {
15306 char count[128];
15307
15308 sprintf(count, "%d", builtinCount);
15309 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpIdentifier(MkIdentifier("__internalArray"))))), MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<', MkExpOp(MkExpIdentifier(MkIdentifier("__internalArray")), '+', MkExpConstant(count))))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, (((void *)0)))), block));
15310 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15311 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15312 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15313 }
15314 else if(isLinkList && !isList)
15315 {
15316 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15317 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15318
15319 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15320 {
15321 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(MkIdentifier("__internalLinkList")), MkIdentifier("first"))))), MkExpressionStmt(MkListOne(MkExpIdentifier(CopyIdentifier(id)))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("next")))), block));
15322 }
15323 else
15324 {
15325 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15326 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15327
15328 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(MkIdentifier("__internalLinkList")), MkIdentifier("first"))))), MkExpressionStmt(MkListOne(MkExpIdentifier(CopyIdentifier(id)))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpCast(MkTypeName(specs, decl), MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalLinkList")), MkIdentifier("GetNext")), MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("IteratorPointer")), (((void *)0))), MkExpIdentifier(CopyIdentifier(id)))))))), block));
15329 }
15330 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15331 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15332 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15333 }
15334 else
15335 {
15336 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15337 }
15338 ProcessExpressionType(expIt);
15339 if((*stmt->compound.declarations).first)
15340 ProcessDeclaration((*stmt->compound.declarations).first);
15341 if(symbol)
15342 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15343 ProcessStatement(stmt);
15344 curContext = stmt->compound.context->parent;
15345 break;
15346 }
15347 else
15348 {
15349 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15350 }
15351 break;
15352 }
15353 case 9:
15354 break;
15355 case 10:
15356 break;
15357 case 11:
15358 break;
15359 case 12:
15360 {
15361 struct Expression * exp;
15362
15363 if(stmt->expressions)
15364 {
15365 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15366 {
15367 if(!exp->next)
15368 {
15369 if(curFunction && !curFunction->type)
15370 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15371 FreeType(exp->destType);
15372 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15373 if(exp->destType)
15374 exp->destType->refCount++;
15375 }
15376 ProcessExpressionType(exp);
15377 }
15378 }
15379 break;
15380 }
15381 case 14:
15382 {
15383 ProcessDeclaration(stmt->decl);
15384 break;
15385 }
15386 case 13:
15387 {
15388 struct AsmField * field;
15389
15390 if(stmt->asmStmt.inputFields)
15391 {
15392 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15393 if(field->expression)
15394 ProcessExpressionType(field->expression);
15395 }
15396 if(stmt->asmStmt.outputFields)
15397 {
15398 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15399 if(field->expression)
15400 ProcessExpressionType(field->expression);
15401 }
15402 if(stmt->asmStmt.clobberedFields)
15403 {
15404 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15405 {
15406 if(field->expression)
15407 ProcessExpressionType(field->expression);
15408 }
15409 }
15410 break;
15411 }
15412 case 17:
15413 {
15414 struct PropertyWatch * propWatch;
15415 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15416 struct Expression * object = stmt->_watch.object;
15417 struct Expression * watcher = stmt->_watch.watcher;
15418
15419 if(watcher)
15420 ProcessExpressionType(watcher);
15421 if(object)
15422 ProcessExpressionType(object);
15423 if(inCompiler)
15424 {
15425 if(watcher || thisClass)
15426 {
15427 struct External * external = curExternal;
15428 struct Context * context = curContext;
15429
15430 stmt->type = 3;
15431 stmt->expressions = MkList();
15432 curExternal = external->prev;
15433 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15434 {
15435 struct ClassFunction * func;
15436 char watcherName[1024];
15437 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15438 struct External * createdExternal;
15439 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15440
15441 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15442 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15443 if(propWatch->deleteWatch)
15444 strcat(watcherName, "_delete");
15445 else
15446 {
15447 struct Identifier * propID;
15448
15449 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15450 {
15451 strcat(watcherName, "_");
15452 strcat(watcherName, propID->string);
15453 }
15454 }
15455 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15456 {
15457 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15458 ProcessClassFunctionBody(func, propWatch->compound);
15459 propWatch->compound = (((void *)0));
15460 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15461 createdExternal->symbol->idCode = external->symbol->idCode;
15462 curExternal = createdExternal;
15463 ProcessFunction(createdExternal->function);
15464 {
15465 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15466
15467 externalDecl->declaration = decl;
15468 if(decl->symbol && !decl->symbol->pointerExternal)
15469 decl->symbol->pointerExternal = externalDecl;
15470 }
15471 if(propWatch->deleteWatch)
15472 {
15473 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15474
15475 ListAdd(args, CopyExpression(object));
15476 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15477 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15478 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15479 }
15480 else
15481 {
15482 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15483 struct Identifier * propID;
15484
15485 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15486 {
15487 char propName[1024];
15488 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15489
15490 if(prop)
15491 {
15492 char getName[1024], setName[1024];
15493 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15494
15495 DeclareProperty(prop, setName, getName);
15496 strcpy(propName, "__ecereProp_");
15497 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15498 strcat(propName, "_");
15499 FullClassNameCat(propName, prop->name, 0x1);
15500 ListAdd(args, CopyExpression(object));
15501 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15502 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15503 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15504 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15505 }
15506 else
15507 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15508 }
15509 }
15510 }
15511 else
15512 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15513 }
15514 curExternal = external;
15515 curContext = context;
15516 if(watcher)
15517 FreeExpression(watcher);
15518 if(object)
15519 FreeExpression(object);
15520 FreeList(watches, FreePropertyWatch);
15521 }
15522 else
15523 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15524 }
15525 else
15526 {
15527 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15528 {
15529 ProcessStatement(propWatch->compound);
15530 }
15531 }
15532 break;
15533 }
15534 case 15:
15535 {
15536 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15537 struct Expression * object = stmt->_watch.object;
15538 struct __ecereNameSpace__ecere__com__Class * _class;
15539
15540 if(object)
15541 ProcessExpressionType(object);
15542 if(inCompiler)
15543 {
15544 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15545 if(_class)
15546 {
15547 struct Identifier * propID;
15548
15549 stmt->type = 3;
15550 stmt->expressions = MkList();
15551 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15552 {
15553 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15554 }
15555 else if(!watches)
15556 {
15557 }
15558 if(watches)
15559 {
15560 for(propID = (*watches).first; propID; propID = propID->next)
15561 {
15562 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15563
15564 if(prop)
15565 {
15566 CreateFireWatcher(prop, object, stmt);
15567 }
15568 else
15569 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15570 }
15571 }
15572 else
15573 {
15574 struct __ecereNameSpace__ecere__com__Property * prop;
15575 struct __ecereNameSpace__ecere__com__Class * base;
15576
15577 for(base = _class; base; base = base->base)
15578 {
15579 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15580 {
15581 if(prop->isProperty && prop->isWatchable)
15582 {
15583 CreateFireWatcher(prop, object, stmt);
15584 }
15585 }
15586 }
15587 }
15588 if(object)
15589 FreeExpression(object);
15590 FreeList(watches, FreeIdentifier);
15591 }
15592 else
15593 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15594 }
15595 break;
15596 }
15597 case 16:
15598 {
15599 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15600 struct Expression * object = stmt->_watch.object;
15601 struct Expression * watcher = stmt->_watch.watcher;
15602 struct __ecereNameSpace__ecere__com__Class * _class;
15603
15604 if(object)
15605 ProcessExpressionType(object);
15606 if(watcher)
15607 ProcessExpressionType(watcher);
15608 if(inCompiler)
15609 {
15610 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15611 if(watcher || thisClass)
15612 {
15613 if(_class)
15614 {
15615 struct Identifier * propID;
15616
15617 stmt->type = 3;
15618 stmt->expressions = MkList();
15619 if(!watches)
15620 {
15621 struct __ecereNameSpace__ecere__sys__OldList * args;
15622
15623 args = MkList();
15624 ListAdd(args, CopyExpression(object));
15625 ListAdd(args, MkExpConstant("0"));
15626 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15627 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15628 }
15629 else
15630 {
15631 for(propID = (*watches).first; propID; propID = propID->next)
15632 {
15633 char propName[1024];
15634 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15635
15636 if(prop)
15637 {
15638 char getName[1024], setName[1024];
15639 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15640
15641 DeclareProperty(prop, setName, getName);
15642 strcpy(propName, "__ecereProp_");
15643 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15644 strcat(propName, "_");
15645 FullClassNameCat(propName, prop->name, 0x1);
15646 MangleClassName(propName);
15647 ListAdd(args, CopyExpression(object));
15648 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15649 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15650 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15651 }
15652 else
15653 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15654 }
15655 }
15656 if(object)
15657 FreeExpression(object);
15658 if(watcher)
15659 FreeExpression(watcher);
15660 FreeList(watches, FreeIdentifier);
15661 }
15662 else
15663 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15664 }
15665 else
15666 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
15667 }
15668 break;
15669 }
15670 }
15671 }
15672
15673 extern struct Expression * QBrackets(struct Expression * exp);
15674
15675 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15676
15677 extern struct Declarator * QMkPtrDecl(char *  id);
15678
15679 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15680
15681 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15682
15683 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15684
15685 static void ProcessFunction(struct FunctionDefinition * function)
15686 {
15687 void * __ecereTemp2;
15688 void * __ecereTemp1;
15689 struct Identifier * id = GetDeclId(function->declarator);
15690 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15691 struct Type * type = symbol ? symbol->type : (((void *)0));
15692 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15693 struct Context * oldTopContext = topContext;
15694
15695 yylloc = function->loc;
15696 if(type && type->thisClass)
15697 {
15698 struct Symbol * classSym = type->thisClass;
15699 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15700 char className[1024];
15701 char structName[1024];
15702 struct Declarator * funcDecl;
15703 struct Symbol * thisSymbol;
15704 unsigned int typedObject = 0x0;
15705
15706 if(_class && !_class->base)
15707 {
15708 _class = currentClass;
15709 if(_class && !_class->symbol)
15710 _class->symbol = FindClass(_class->fullName);
15711 classSym = _class ? _class->symbol : (((void *)0));
15712 typedObject = 0x1;
15713 }
15714 thisClass = _class;
15715 if(inCompiler && _class)
15716 {
15717 if(type->kind == 11)
15718 {
15719 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15720 {
15721 struct Type * param = symbol->type->params.first;
15722
15723 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15724 FreeType(param);
15725 }
15726 if(type->classObjectType != 1)
15727 {
15728 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15729 symbol->type->staticMethod = 0x1;
15730 symbol->type->thisClass = (((void *)0));
15731 symbol->type->extraParam = 0x0;
15732 }
15733 }
15734 strcpy(className, "__ecereClass_");
15735 FullClassNameCat(className, _class->fullName, 0x1);
15736 MangleClassName(className);
15737 structName[0] = (char)0;
15738 FullClassNameCat(structName, _class->fullName, 0x0);
15739 funcDecl = GetFuncDecl(function->declarator);
15740 if(funcDecl)
15741 {
15742 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15743 {
15744 struct TypeName * param = (*funcDecl->function.parameters).first;
15745
15746 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15747 {
15748 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15749 FreeTypeName(param);
15750 }
15751 }
15752 if(!function->propertyNoThis)
15753 {
15754 struct TypeName * thisParam;
15755
15756 if(type->classObjectType != 1)
15757 {
15758 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15759 if(!funcDecl->function.parameters)
15760 funcDecl->function.parameters = MkList();
15761 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15762 }
15763 if(typedObject)
15764 {
15765 if(type->classObjectType != 1)
15766 {
15767 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
15768 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
15769 }
15770 thisParam = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), ((struct TypeName *)__ecereTemp1)->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), ((struct TypeName *)__ecereTemp1)->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), ((struct TypeName *)__ecereTemp1));
15771 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15772 }
15773 }
15774 }
15775 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15776 {
15777 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15778
15779 funcDecl = GetFuncDecl(initDecl->declarator);
15780 if(funcDecl)
15781 {
15782 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15783 {
15784 struct TypeName * param = (*funcDecl->function.parameters).first;
15785
15786 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15787 {
15788 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15789 FreeTypeName(param);
15790 }
15791 }
15792 if(type->classObjectType != 1)
15793 {
15794 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
15795 {
15796 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15797
15798 if(!funcDecl->function.parameters)
15799 funcDecl->function.parameters = MkList();
15800 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15801 }
15802 }
15803 }
15804 }
15805 }
15806 if(function->body)
15807 {
15808 if(type->classObjectType != 1)
15809 {
15810 thisSymbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString("this"), ((struct Symbol *)__ecereTemp1)->type = classSym ? MkClassType(classSym->string) : (((void *)0)), ((struct Symbol *)__ecereTemp1));
15811 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15812 if(typedObject && thisSymbol->type)
15813 {
15814 thisSymbol->type->classObjectType = 2;
15815 thisSymbol->type->byReference = type->byReference;
15816 }
15817 }
15818 }
15819 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
15820 {
15821 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15822
15823 {
15824 struct __ecereNameSpace__ecere__com__Class * base;
15825
15826 for(base = _class; base && base->type != 1000; base = base->next)
15827 {
15828 for(member = base->membersAndProperties.first; member; member = member->next)
15829 if(!member->isProperty)
15830 break;
15831 if(member)
15832 break;
15833 }
15834 }
15835 for(member = _class->membersAndProperties.first; member; member = member->next)
15836 if(!member->isProperty)
15837 break;
15838 if(member)
15839 {
15840 char pointerName[1024];
15841 struct Declaration * decl;
15842 struct Initializer * initializer;
15843 struct Expression * exp, * bytePtr;
15844
15845 strcpy(pointerName, "__ecerePointer_");
15846 FullClassNameCat(pointerName, _class->fullName, 0x0);
15847 {
15848 char className[1024];
15849
15850 strcpy(className, "__ecereClass_");
15851 FullClassNameCat(className, classSym->string, 0x1);
15852 MangleClassName(className);
15853 DeclareClass(classSym, className);
15854 }
15855 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
15856 if(_class->fixed)
15857 {
15858 char string[256];
15859
15860 sprintf(string, "%d", _class->offset);
15861 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
15862 }
15863 else
15864 {
15865 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
15866 }
15867 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
15868 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 0, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
15869 if(function->body)
15870 {
15871 yylloc = function->body->loc;
15872 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
15873 {
15874 struct Context * prevContext = curContext;
15875
15876 curContext = function->body->compound.context;
15877 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
15878 curContext = prevContext;
15879 }
15880 decl->symbol = (((void *)0));
15881 if(!function->body->compound.declarations)
15882 function->body->compound.declarations = MkList();
15883 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
15884 }
15885 }
15886 }
15887 }
15888 else
15889 thisClass = (((void *)0));
15890 if(id)
15891 {
15892 FreeSpecifier(id->_class);
15893 id->_class = (((void *)0));
15894 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15895 {
15896 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15897
15898 id = GetDeclId(initDecl->declarator);
15899 FreeSpecifier(id->_class);
15900 id->_class = (((void *)0));
15901 }
15902 }
15903 if(function->body)
15904 topContext = function->body->compound.context;
15905 {
15906 struct FunctionDefinition * oldFunction = curFunction;
15907
15908 curFunction = function;
15909 if(function->body)
15910 ProcessStatement(function->body);
15911 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
15912 {
15913 struct Statement * prevCompound = curCompound;
15914 struct Context * prevContext = curContext;
15915 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
15916
15917 if(!function->body->compound.statements)
15918 function->body->compound.statements = MkList();
15919 ListAdd(function->body->compound.statements, fireWatchers);
15920 curCompound = function->body;
15921 curContext = function->body->compound.context;
15922 ProcessStatement(fireWatchers);
15923 curContext = prevContext;
15924 curCompound = prevCompound;
15925 }
15926 curFunction = oldFunction;
15927 }
15928 if(function->declarator)
15929 {
15930 ProcessDeclarator(function->declarator);
15931 }
15932 topContext = oldTopContext;
15933 thisClass = oldThisClass;
15934 }
15935
15936 extern void FreeSymbol(struct Symbol * symbol);
15937
15938 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
15939
15940 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
15941 {
15942 struct ClassDef * def;
15943 struct External * external = curExternal;
15944 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
15945
15946 for(def = definitions->first; def; def = def->next)
15947 {
15948 if(def->type == 0)
15949 {
15950 if(def->function->declarator)
15951 curExternal = def->function->declarator->symbol->pointerExternal;
15952 else
15953 curExternal = external;
15954 ProcessFunction((struct FunctionDefinition *)def->function);
15955 }
15956 else if(def->type == 2)
15957 {
15958 if(def->decl->type == 2)
15959 {
15960 thisClass = regClass;
15961 ProcessInstantiationType(def->decl->inst);
15962 thisClass = (((void *)0));
15963 }
15964 else
15965 {
15966 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
15967
15968 if(regClass)
15969 thisClass = regClass;
15970 ProcessDeclaration(def->decl);
15971 thisClass = backThisClass;
15972 }
15973 }
15974 else if(def->type == 1 && def->defProperties)
15975 {
15976 struct MemberInit * defProperty;
15977 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = regClass ? MkClassType(regClass->fullName) : (((void *)0)), thisSymbol);
15978
15979 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15980 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
15981 {
15982 thisClass = regClass;
15983 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
15984 thisClass = (((void *)0));
15985 }
15986 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15987 FreeSymbol(thisSymbol);
15988 }
15989 else if(def->type == 3 && def->propertyDef)
15990 {
15991 struct PropertyDef * prop = def->propertyDef;
15992
15993 thisClass = regClass;
15994 if(prop->setStmt)
15995 {
15996 if(regClass)
15997 {
15998 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15999
16000 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16001 }
16002 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16003 ProcessStatement(prop->setStmt);
16004 }
16005 if(prop->getStmt)
16006 {
16007 if(regClass)
16008 {
16009 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16010
16011 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16012 }
16013 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16014 ProcessStatement(prop->getStmt);
16015 }
16016 if(prop->issetStmt)
16017 {
16018 if(regClass)
16019 {
16020 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16021
16022 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16023 }
16024 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16025 ProcessStatement(prop->issetStmt);
16026 }
16027 thisClass = (((void *)0));
16028 }
16029 else if(def->type == 4 && def->propertyWatch)
16030 {
16031 struct PropertyWatch * propertyWatch = def->propertyWatch;
16032
16033 thisClass = regClass;
16034 if(propertyWatch->compound)
16035 {
16036 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = regClass ? MkClassType(regClass->fullName) : (((void *)0)), thisSymbol);
16037
16038 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16039 curExternal = (((void *)0));
16040 ProcessStatement(propertyWatch->compound);
16041 }
16042 thisClass = (((void *)0));
16043 }
16044 }
16045 }
16046
16047 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16048
16049 void ComputeDataTypes()
16050 {
16051 void * __ecereTemp1;
16052 struct External * external;
16053 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16054
16055 currentClass = (((void *)0));
16056 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16057 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16058 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
16059 curExternal = temp;
16060 DeclareStruct("ecere::com::Class", 0x0);
16061 DeclareStruct("ecere::com::Instance", 0x0);
16062 DeclareStruct("ecere::com::Property", 0x0);
16063 DeclareStruct("ecere::com::DataMember", 0x0);
16064 DeclareStruct("ecere::com::Method", 0x0);
16065 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16066 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16067 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16068 for(external = (*ast).first; external; external = external->next)
16069 {
16070 afterExternal = curExternal = external;
16071 if(external->type == 0)
16072 {
16073 currentClass = external->function->_class;
16074 ProcessFunction(external->function);
16075 }
16076 else if(external->type == 1)
16077 {
16078 currentClass = (((void *)0));
16079 ProcessDeclaration(external->declaration);
16080 }
16081 else if(external->type == 2)
16082 {
16083 struct ClassDefinition * _class = external->_class;
16084
16085 currentClass = external->symbol->registered;
16086 if(_class->definitions)
16087 {
16088 ProcessClass(_class->definitions, _class->symbol);
16089 }
16090 if(inCompiler)
16091 {
16092 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16093 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16094 }
16095 }
16096 else if(external->type == 4)
16097 {
16098 thisNameSpace = external->id->string;
16099 }
16100 }
16101 currentClass = (((void *)0));
16102 thisNameSpace = (((void *)0));
16103 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16104 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16105 }
16106
16107 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);
16108
16109 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16110
16111 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16112 {
16113 struct __ecereNameSpace__ecere__com__Class * class;
16114
16115 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16116 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16117 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16118 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16119 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoi64", "int64 _strtoi64(char * string, char * * endString, int base)", _strtoi64, module, 2);
16120 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoui64", "uint64 _strtoui64(char * string, char * * endString, int base)", _strtoui64, module, 2);
16121 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16122 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16123 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16124 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16125 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16126 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16127 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16128 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16129 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16130 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16131 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16132 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16133 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16134 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16135 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16136 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16137 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16138 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16139 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16140 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16141 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16142 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16143 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16144 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16145 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16146 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16147 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16148 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("AddMembers", "int AddMembers(ecere::sys::OldList * declarations, ecere::com::Class _class, bool isMember, uint * retSize, ecere::com::Class topClass)", AddMembers, module, 2);
16149 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16150 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16151 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16152 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMemberInitData", "void ProcessMemberInitData(MemberInit member, ecere::com::Class _class, ecere::com::Class * curClass, ecere::com::DataMember * curMember, ecere::com::DataMember * subMemberStack, int * subMemberStackPos)", ProcessMemberInitData, module, 2);
16153 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16154 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16155 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16156 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16157 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16158 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16159 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16160 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16161 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16162 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16163 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16164 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16165 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16166 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16167 __ecereClass_Conversion = class;
16168 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypes", "bool MatchTypes(Type source, Type dest, ecere::sys::OldList conversions, ecere::com::Class owningClassSource, ecere::com::Class owningClassDest, bool doConversion, bool enumBaseType, bool acceptReversedParams, bool isConversionExploration)", MatchTypes, module, 1);
16169 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchWithEnums_NameSpace", "bool MatchWithEnums_NameSpace(ecere::com::NameSpace nameSpace, Expression sourceExp, Type dest, char * string, ecere::sys::OldList conversions)", MatchWithEnums_NameSpace, module, 2);
16170 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16171 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchWithEnums_Module", "bool MatchWithEnums_Module(ecere::com::Module mainModule, Expression sourceExp, Type dest, char * string, ecere::sys::OldList conversions)", MatchWithEnums_Module, module, 2);
16172 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16173 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16174 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16175 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16176 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16177 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16178 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16179 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16180 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16181 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16182 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16183 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16184 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16185 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16186 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16187 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16188 }
16189
16190 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16191 {
16192
16193 }
16194