compiler/libec: Another fix for improper usage of compound statement expressions...
[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 ListAdd(curCompound->compound.declarations, 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 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
11812
11813 void ProcessExpressionType(struct Expression * exp)
11814 {
11815 void * __ecereTemp2;
11816 void * __ecereTemp1;
11817 unsigned int unresolved = 0x0;
11818 struct Location oldyylloc = yylloc;
11819 unsigned int notByReference = 0x0;
11820
11821 if(!exp || exp->expType)
11822 return ;
11823 yylloc = exp->loc;
11824 switch(exp->type)
11825 {
11826 case 0:
11827 {
11828 struct Identifier * id = exp->identifier;
11829
11830 if(!id)
11831 return ;
11832 if(id->_class && id->_class->name)
11833 {
11834 id->classSym = id->_class->symbol;
11835 }
11836 if(strstr(id->string, "__ecereClass") == id->string)
11837 {
11838 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
11839 break;
11840 }
11841 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
11842 {
11843 ReplaceClassMembers(exp, thisClass);
11844 if(exp->type != 0)
11845 {
11846 ProcessExpressionType(exp);
11847 break;
11848 }
11849 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
11850 break;
11851 }
11852 else
11853 {
11854 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11855
11856 if(!symbol)
11857 {
11858 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
11859 break;
11860 else
11861 {
11862 if(thisClass)
11863 {
11864 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
11865 if(exp->type != 0)
11866 {
11867 ProcessExpressionType(exp);
11868 break;
11869 }
11870 }
11871 else if(currentClass && !id->_class)
11872 {
11873 if(ResolveIdWithClass(exp, currentClass, 0x1))
11874 break;
11875 }
11876 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11877 }
11878 }
11879 if(symbol)
11880 {
11881 struct Type * type = symbol->type;
11882 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
11883
11884 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
11885 {
11886 struct Context * context = SetupTemplatesContext(_class);
11887
11888 type = ReplaceThisClassType(_class);
11889 FinishTemplatesContext(context);
11890 if(type)
11891 type->refCount = 0;
11892 }
11893 FreeSpecifier(id->_class);
11894 id->_class = (((void *)0));
11895 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11896 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
11897 id->classSym = (((void *)0));
11898 exp->expType = type;
11899 if(type)
11900 type->refCount++;
11901 if(type && (type->kind == 15 || (_class && _class->type == 4)))
11902 exp->isConstant = 0x1;
11903 if(symbol->isParam || !strcmp(id->string, "this"))
11904 {
11905 if(_class && _class->type == 1)
11906 exp->byReference = 0x1;
11907 }
11908 if(symbol->isIterator)
11909 {
11910 if(symbol->isIterator == 3)
11911 {
11912 exp->type = 5;
11913 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
11914 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
11915 exp->expType = (((void *)0));
11916 ProcessExpressionType(exp);
11917 }
11918 else if(symbol->isIterator != 4)
11919 {
11920 exp->type = 8;
11921 exp->member.exp = MkExpIdentifier(exp->identifier);
11922 exp->member.exp->expType = exp->expType;
11923 exp->member.member = MkIdentifier("data");
11924 exp->expType = (((void *)0));
11925 ProcessExpressionType(exp);
11926 }
11927 }
11928 break;
11929 }
11930 else
11931 {
11932 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
11933
11934 if(thisNameSpace && !(id->_class && !id->_class->name))
11935 {
11936 char name[1024];
11937
11938 strcpy(name, thisNameSpace);
11939 strcat(name, "::");
11940 strcat(name, id->string);
11941 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
11942 }
11943 if(!definedExp)
11944 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
11945 if(definedExp)
11946 {
11947 int c;
11948
11949 for(c = 0; c < definedExpStackPos; c++)
11950 if(definedExpStack[c] == definedExp)
11951 break;
11952 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
11953 {
11954 struct Location backupYylloc = yylloc;
11955
11956 definedExpStack[definedExpStackPos++] = definedExp;
11957 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11958 ((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));
11959 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11960 echoOn = 0x0;
11961 parsedExpression = (((void *)0));
11962 resetScanner();
11963 expression_yyparse();
11964 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11965 yylloc = backupYylloc;
11966 if(parsedExpression)
11967 {
11968 FreeIdentifier(id);
11969 exp->type = 5;
11970 exp->list = MkListOne(parsedExpression);
11971 parsedExpression->loc = yylloc;
11972 ProcessExpressionType(exp);
11973 definedExpStackPos--;
11974 return ;
11975 }
11976 definedExpStackPos--;
11977 }
11978 else
11979 {
11980 if(inCompiler)
11981 {
11982 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
11983 }
11984 }
11985 }
11986 else
11987 {
11988 struct GlobalData * data = (((void *)0));
11989
11990 if(thisNameSpace && !(id->_class && !id->_class->name))
11991 {
11992 char name[1024];
11993
11994 strcpy(name, thisNameSpace);
11995 strcat(name, "::");
11996 strcat(name, id->string);
11997 data = FindGlobalData(name);
11998 }
11999 if(!data)
12000 data = FindGlobalData(id->string);
12001 if(data)
12002 {
12003 DeclareGlobalData(data);
12004 exp->expType = data->dataType;
12005 if(data->dataType)
12006 data->dataType->refCount++;
12007 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12008 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12009 FreeSpecifier(id->_class);
12010 id->_class = (((void *)0));
12011 break;
12012 }
12013 else
12014 {
12015 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12016
12017 if(thisNameSpace && !(id->_class && !id->_class->name))
12018 {
12019 char name[1024];
12020
12021 strcpy(name, thisNameSpace);
12022 strcat(name, "::");
12023 strcat(name, id->string);
12024 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12025 }
12026 if(!function)
12027 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12028 if(function)
12029 {
12030 char name[1024];
12031
12032 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12033 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12034 name[0] = (char)0;
12035 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12036 strcpy(name, "__ecereFunction_");
12037 FullClassNameCat(name, id->string, 0x0);
12038 if(DeclareFunction(function, name))
12039 {
12040 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12041 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12042 }
12043 exp->expType = function->dataType;
12044 if(function->dataType)
12045 function->dataType->refCount++;
12046 FreeSpecifier(id->_class);
12047 id->_class = (((void *)0));
12048 break;
12049 }
12050 }
12051 }
12052 }
12053 }
12054 unresolved = 0x1;
12055 break;
12056 }
12057 case 1:
12058 {
12059 struct __ecereNameSpace__ecere__com__Class * _class;
12060
12061 if(!exp->instance->_class)
12062 {
12063 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12064 {
12065 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12066 }
12067 }
12068 ProcessInstantiationType(exp->instance);
12069 exp->isConstant = exp->instance->isConstant;
12070 if(exp->instance->_class)
12071 {
12072 exp->expType = MkClassType(exp->instance->_class->name);
12073 }
12074 break;
12075 }
12076 case 2:
12077 {
12078 if(!exp->expType)
12079 {
12080 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12081
12082 exp->expType = type;
12083 if(exp->constant[0] == '\'')
12084 {
12085 if((int)((unsigned char *)exp->constant)[1] > 127)
12086 {
12087 int nb;
12088 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12089
12090 if(nb < 2)
12091 ch = exp->constant[1];
12092 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12093 exp->constant = PrintUInt(ch);
12094 type->kind = 8;
12095 type->_class = FindClass("unichar");
12096 type->isSigned = 0x0;
12097 }
12098 else
12099 {
12100 type->kind = 1;
12101 type->isSigned = 0x1;
12102 }
12103 }
12104 else if(strchr(exp->constant, '.'))
12105 {
12106 char ch = exp->constant[strlen(exp->constant) - 1];
12107
12108 if(ch == 'f')
12109 type->kind = 6;
12110 else
12111 type->kind = 7;
12112 type->isSigned = 0x1;
12113 }
12114 else
12115 {
12116 if(exp->constant[0] == '0' && exp->constant[1])
12117 type->isSigned = 0x0;
12118 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12119 type->isSigned = 0x0;
12120 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12121 type->isSigned = 0x0;
12122 else
12123 type->isSigned = 0x1;
12124 type->kind = 3;
12125 }
12126 exp->isConstant = 0x1;
12127 }
12128 break;
12129 }
12130 case 3:
12131 {
12132 exp->isConstant = 0x1;
12133 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));
12134 break;
12135 }
12136 case 13:
12137 case 28:
12138 ProcessExpressionType(exp->_new.size);
12139 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));
12140 DeclareType(exp->expType->type, 0x0, 0x0);
12141 break;
12142 case 14:
12143 case 29:
12144 ProcessExpressionType(exp->_renew.size);
12145 ProcessExpressionType(exp->_renew.exp);
12146 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));
12147 DeclareType(exp->expType->type, 0x0, 0x0);
12148 break;
12149 case 4:
12150 {
12151 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12152 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12153 unsigned int useDestType = 0x0, useSideType = 0x0;
12154 struct Location oldyylloc = yylloc;
12155 unsigned int useSideUnit = 0x0;
12156 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12157
12158 switch(exp->op.op)
12159 {
12160 case '=':
12161 case MUL_ASSIGN:
12162 case DIV_ASSIGN:
12163 case MOD_ASSIGN:
12164 case ADD_ASSIGN:
12165 case SUB_ASSIGN:
12166 case LEFT_ASSIGN:
12167 case RIGHT_ASSIGN:
12168 case AND_ASSIGN:
12169 case XOR_ASSIGN:
12170 case OR_ASSIGN:
12171 assign = 0x1;
12172 break;
12173 case '!':
12174 break;
12175 case AND_OP:
12176 case OR_OP:
12177 boolOps = 0x1;
12178 boolResult = 0x1;
12179 break;
12180 case EQ_OP:
12181 case '<':
12182 case '>':
12183 case LE_OP:
12184 case GE_OP:
12185 case NE_OP:
12186 boolResult = 0x1;
12187 useSideType = 0x1;
12188 break;
12189 case '+':
12190 case '-':
12191 useSideUnit = 0x1;
12192 case '|':
12193 case '&':
12194 case '^':
12195 case '/':
12196 case '%':
12197 case '*':
12198 if(exp->op.op != '*' || exp->op.exp1)
12199 {
12200 useSideType = 0x1;
12201 useDestType = 0x1;
12202 }
12203 break;
12204 }
12205 if(exp->op.op == '&')
12206 {
12207 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12208 {
12209 struct Identifier * id = exp->op.exp2->identifier;
12210 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12211
12212 if(symbol && symbol->isIterator == 2)
12213 {
12214 exp->type = 8;
12215 exp->member.exp = exp->op.exp2;
12216 exp->member.member = MkIdentifier("key");
12217 exp->expType = (((void *)0));
12218 exp->op.exp2->expType = symbol->type;
12219 symbol->type->refCount++;
12220 ProcessExpressionType(exp);
12221 FreeType(dummy);
12222 break;
12223 }
12224 }
12225 }
12226 if(exp->op.exp1)
12227 {
12228 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))
12229 {
12230 if(exp->op.exp1->destType)
12231 FreeType(exp->op.exp1->destType);
12232 exp->op.exp1->destType = exp->destType;
12233 if(exp->destType)
12234 exp->destType->refCount++;
12235 }
12236 else if(!assign)
12237 {
12238 if(exp->op.exp1->destType)
12239 FreeType(exp->op.exp1->destType);
12240 exp->op.exp1->destType = dummy;
12241 dummy->refCount++;
12242 }
12243 if(exp->op.exp1->destType && exp->op.op != '=')
12244 exp->op.exp1->destType->count++;
12245 ProcessExpressionType(exp->op.exp1);
12246 if(exp->op.exp1->destType && exp->op.op != '=')
12247 exp->op.exp1->destType->count--;
12248 if(exp->op.exp1->destType == dummy)
12249 {
12250 FreeType(dummy);
12251 exp->op.exp1->destType = (((void *)0));
12252 }
12253 type1 = exp->op.exp1->expType;
12254 }
12255 if(exp->op.exp2)
12256 {
12257 char expString[10240];
12258
12259 expString[0] = '\0';
12260 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12261 {
12262 if(exp->op.exp1)
12263 {
12264 exp->op.exp2->destType = exp->op.exp1->expType;
12265 if(exp->op.exp1->expType)
12266 exp->op.exp1->expType->refCount++;
12267 }
12268 else
12269 {
12270 exp->op.exp2->destType = exp->destType;
12271 if(exp->destType)
12272 exp->destType->refCount++;
12273 }
12274 if(type1)
12275 type1->refCount++;
12276 exp->expType = type1;
12277 }
12278 else if(assign)
12279 {
12280 if(inCompiler)
12281 PrintExpression(exp->op.exp2, expString);
12282 if(type1 && type1->kind == 13)
12283 {
12284 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)
12285 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12286 else if(exp->op.op == '=')
12287 {
12288 if(exp->op.exp2->destType)
12289 FreeType(exp->op.exp2->destType);
12290 exp->op.exp2->destType = type1;
12291 if(type1)
12292 type1->refCount++;
12293 }
12294 }
12295 else
12296 {
12297 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)
12298 ;
12299 else
12300 {
12301 if(exp->op.exp2->destType)
12302 FreeType(exp->op.exp2->destType);
12303 exp->op.exp2->destType = type1;
12304 if(type1)
12305 type1->refCount++;
12306 }
12307 }
12308 if(type1)
12309 type1->refCount++;
12310 exp->expType = type1;
12311 }
12312 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)))
12313 {
12314 if(exp->op.exp2->destType)
12315 FreeType(exp->op.exp2->destType);
12316 exp->op.exp2->destType = exp->destType;
12317 if(exp->destType)
12318 exp->destType->refCount++;
12319 }
12320 else
12321 {
12322 if(exp->op.exp2->destType)
12323 FreeType(exp->op.exp2->destType);
12324 exp->op.exp2->destType = dummy;
12325 dummy->refCount++;
12326 }
12327 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12328 {
12329 FreeType(exp->op.exp2->destType);
12330 exp->op.exp2->destType = type1;
12331 type1->refCount++;
12332 }
12333 if(exp->op.exp2->destType && exp->op.op != '=')
12334 exp->op.exp2->destType->count++;
12335 ProcessExpressionType(exp->op.exp2);
12336 if(exp->op.exp2->destType && exp->op.op != '=')
12337 exp->op.exp2->destType->count--;
12338 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12339 {
12340 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)
12341 {
12342 if(exp->op.op != '=' && type1->type->kind == 0)
12343 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12344 }
12345 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)))
12346 {
12347 if(exp->op.op == ADD_ASSIGN)
12348 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12349 }
12350 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))
12351 {
12352 if(exp->op.op == ADD_ASSIGN)
12353 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12354 }
12355 else if(inCompiler)
12356 {
12357 char type1String[1024];
12358 char type2String[1024];
12359
12360 type1String[0] = '\0';
12361 type2String[0] = '\0';
12362 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12363 PrintType(type1, type2String, 0x0, 0x1);
12364 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12365 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12366 }
12367 }
12368 if(exp->op.exp2->destType == dummy)
12369 {
12370 FreeType(dummy);
12371 exp->op.exp2->destType = (((void *)0));
12372 }
12373 type2 = exp->op.exp2->expType;
12374 }
12375 dummy->kind = 0;
12376 if(exp->op.op == SIZEOF)
12377 {
12378 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12379 exp->isConstant = 0x1;
12380 }
12381 else if(exp->op.op == '*' && !exp->op.exp1)
12382 {
12383 exp->expType = Dereference(type2);
12384 if(type2 && type2->kind == 8)
12385 notByReference = 0x1;
12386 }
12387 else if(exp->op.op == '&' && !exp->op.exp1)
12388 exp->expType = Reference(type2);
12389 else if(!assign)
12390 {
12391 if(boolOps)
12392 {
12393 if(exp->op.exp1)
12394 {
12395 if(exp->op.exp1->destType)
12396 FreeType(exp->op.exp1->destType);
12397 exp->op.exp1->destType = MkClassType("bool");
12398 exp->op.exp1->destType->truth = 0x1;
12399 if(!exp->op.exp1->expType)
12400 ProcessExpressionType(exp->op.exp1);
12401 else
12402 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12403 FreeType(exp->op.exp1->expType);
12404 exp->op.exp1->expType = MkClassType("bool");
12405 exp->op.exp1->expType->truth = 0x1;
12406 }
12407 if(exp->op.exp2)
12408 {
12409 if(exp->op.exp2->destType)
12410 FreeType(exp->op.exp2->destType);
12411 exp->op.exp2->destType = MkClassType("bool");
12412 exp->op.exp2->destType->truth = 0x1;
12413 if(!exp->op.exp2->expType)
12414 ProcessExpressionType(exp->op.exp2);
12415 else
12416 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12417 FreeType(exp->op.exp2->expType);
12418 exp->op.exp2->expType = MkClassType("bool");
12419 exp->op.exp2->expType->truth = 0x1;
12420 }
12421 }
12422 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")))))
12423 {
12424 if(type1 && type2 && ((type1->kind == 8 && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && strcmp(type2->_class->string, "String"))))
12425 {
12426 if(exp->op.exp2->destType)
12427 FreeType(exp->op.exp2->destType);
12428 exp->op.exp2->destType = type1;
12429 type1->refCount++;
12430 if(exp->op.exp1->destType)
12431 FreeType(exp->op.exp1->destType);
12432 exp->op.exp1->destType = type2;
12433 type2->refCount++;
12434 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)
12435 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);
12436 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12437 {
12438 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12439
12440 if(argExp)
12441 {
12442 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12443
12444 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12445 ProcessExpressionType(exp->op.exp1);
12446 if(type2->kind != 13)
12447 {
12448 ProcessExpressionType(classExp);
12449 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"))))))));
12450 if(!exp->op.exp2->expType)
12451 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12452 ProcessExpressionType(exp->op.exp2);
12453 }
12454 }
12455 }
12456 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)))
12457 {
12458 if(type1->kind != 8 && type1->type->kind == 0)
12459 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12460 exp->expType = type1;
12461 if(type1)
12462 type1->refCount++;
12463 }
12464 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)))
12465 {
12466 if(type2->kind != 8 && type2->type->kind == 0)
12467 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12468 exp->expType = type2;
12469 if(type2)
12470 type2->refCount++;
12471 }
12472 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))
12473 {
12474 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12475 }
12476 else
12477 {
12478 unsigned int success = 0x0;
12479
12480 if(type1->kind == 13 && type2->kind == 13)
12481 {
12482 if(exp->op.op == '+')
12483 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12484 else if(exp->op.op == '-')
12485 {
12486 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12487 {
12488 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12489 success = 0x1;
12490 if(type1->type->kind == 20)
12491 {
12492 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12493
12494 if(argExp)
12495 {
12496 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12497
12498 ProcessExpressionType(classExp);
12499 exp->type = 5;
12500 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")))))));
12501 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12502 FreeType(dummy);
12503 return ;
12504 }
12505 }
12506 }
12507 }
12508 }
12509 if(!success && exp->op.exp1->type == 2)
12510 {
12511 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12512 {
12513 if(exp->expType)
12514 FreeType(exp->expType);
12515 exp->expType = exp->op.exp1->destType;
12516 if(exp->op.exp1->destType)
12517 exp->op.exp1->destType->refCount++;
12518 success = 0x1;
12519 }
12520 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12521 {
12522 if(exp->expType)
12523 FreeType(exp->expType);
12524 exp->expType = exp->op.exp2->destType;
12525 if(exp->op.exp2->destType)
12526 exp->op.exp2->destType->refCount++;
12527 success = 0x1;
12528 }
12529 }
12530 else if(!success)
12531 {
12532 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12533 {
12534 if(exp->expType)
12535 FreeType(exp->expType);
12536 exp->expType = exp->op.exp2->destType;
12537 if(exp->op.exp2->destType)
12538 exp->op.exp2->destType->refCount++;
12539 success = 0x1;
12540 }
12541 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12542 {
12543 if(exp->expType)
12544 FreeType(exp->expType);
12545 exp->expType = exp->op.exp1->destType;
12546 if(exp->op.exp1->destType)
12547 exp->op.exp1->destType->refCount++;
12548 success = 0x1;
12549 }
12550 }
12551 if(!success)
12552 {
12553 char expString1[10240];
12554 char expString2[10240];
12555 char type1[1024];
12556 char type2[1024];
12557
12558 expString1[0] = '\0';
12559 expString2[0] = '\0';
12560 type1[0] = '\0';
12561 type2[0] = '\0';
12562 if(inCompiler)
12563 {
12564 PrintExpression(exp->op.exp1, expString1);
12565 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12566 PrintExpression(exp->op.exp2, expString2);
12567 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12568 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12569 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12570 }
12571 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12572 }
12573 }
12574 }
12575 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12576 {
12577 if(exp->op.exp1->destType)
12578 FreeType(exp->op.exp1->destType);
12579 exp->op.exp1->destType = type2->_class->registered->dataType;
12580 if(type2->_class->registered->dataType)
12581 type2->_class->registered->dataType->refCount++;
12582 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12583 exp->expType = type2;
12584 if(type2)
12585 type2->refCount++;
12586 }
12587 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12588 {
12589 if(exp->op.exp2->destType)
12590 FreeType(exp->op.exp2->destType);
12591 exp->op.exp2->destType = type1->_class->registered->dataType;
12592 if(type1->_class->registered->dataType)
12593 type1->_class->registered->dataType->refCount++;
12594 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12595 exp->expType = type1;
12596 if(type1)
12597 type1->refCount++;
12598 }
12599 else if(type1)
12600 {
12601 unsigned int valid = 0x0;
12602
12603 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12604 {
12605 if(exp->op.exp2->destType)
12606 FreeType(exp->op.exp2->destType);
12607 if(!type1->_class->registered->dataType)
12608 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12609 exp->op.exp2->destType = type1->_class->registered->dataType;
12610 exp->op.exp2->destType->refCount++;
12611 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12612 type2 = exp->op.exp2->destType;
12613 exp->expType = type2;
12614 type2->refCount++;
12615 }
12616 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12617 {
12618 if(exp->op.exp1->destType)
12619 FreeType(exp->op.exp1->destType);
12620 if(!type2->_class->registered->dataType)
12621 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12622 exp->op.exp1->destType = type2->_class->registered->dataType;
12623 exp->op.exp1->destType->refCount++;
12624 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12625 type1 = exp->op.exp1->destType;
12626 exp->expType = type1;
12627 type1->refCount++;
12628 }
12629 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12630 {
12631 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12632 {
12633 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12634 {
12635 if(exp->expType)
12636 FreeType(exp->expType);
12637 exp->expType = exp->op.exp1->expType;
12638 if(exp->op.exp2->expType)
12639 exp->op.exp1->expType->refCount++;
12640 valid = 0x1;
12641 }
12642 }
12643 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12644 {
12645 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12646 {
12647 if(exp->expType)
12648 FreeType(exp->expType);
12649 exp->expType = exp->op.exp2->expType;
12650 if(exp->op.exp2->expType)
12651 exp->op.exp2->expType->refCount++;
12652 valid = 0x1;
12653 }
12654 }
12655 }
12656 if(!valid)
12657 {
12658 if(exp->op.exp2->destType)
12659 FreeType(exp->op.exp2->destType);
12660 exp->op.exp2->destType = type1;
12661 type1->refCount++;
12662 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12663 {
12664 if(exp->expType)
12665 FreeType(exp->expType);
12666 exp->expType = exp->op.exp2->destType;
12667 if(exp->op.exp2->destType)
12668 exp->op.exp2->destType->refCount++;
12669 }
12670 else if(type1 && type2)
12671 {
12672 char expString1[10240];
12673 char expString2[10240];
12674 char type1String[1024];
12675 char type2String[1024];
12676
12677 expString1[0] = '\0';
12678 expString2[0] = '\0';
12679 type1String[0] = '\0';
12680 type2String[0] = '\0';
12681 if(inCompiler)
12682 {
12683 PrintExpression(exp->op.exp1, expString1);
12684 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12685 PrintExpression(exp->op.exp2, expString2);
12686 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12687 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12688 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12689 }
12690 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
12691 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12692 {
12693 exp->expType = exp->op.exp1->expType;
12694 if(exp->op.exp1->expType)
12695 exp->op.exp1->expType->refCount++;
12696 }
12697 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12698 {
12699 exp->expType = exp->op.exp2->expType;
12700 if(exp->op.exp2->expType)
12701 exp->op.exp2->expType->refCount++;
12702 }
12703 }
12704 }
12705 }
12706 else if(type2)
12707 {
12708 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12709 {
12710 struct Type * oldType = exp->op.exp1->expType;
12711
12712 exp->op.exp1->expType = (((void *)0));
12713 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12714 FreeType(oldType);
12715 else
12716 exp->op.exp1->expType = oldType;
12717 }
12718 if(exp->op.exp1->destType)
12719 FreeType(exp->op.exp1->destType);
12720 exp->op.exp1->destType = type2;
12721 type2->refCount++;
12722 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12723 {
12724 if(exp->expType)
12725 FreeType(exp->expType);
12726 exp->expType = exp->op.exp1->destType;
12727 if(exp->op.exp1->destType)
12728 exp->op.exp1->destType->refCount++;
12729 }
12730 }
12731 }
12732 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12733 {
12734 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12735 {
12736 if(exp->op.exp1->destType)
12737 FreeType(exp->op.exp1->destType);
12738 exp->op.exp1->destType = type2->_class->registered->dataType;
12739 if(type2->_class->registered->dataType)
12740 type2->_class->registered->dataType->refCount++;
12741 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12742 }
12743 if(exp->op.op == '!')
12744 {
12745 exp->expType = MkClassType("bool");
12746 exp->expType->truth = 0x1;
12747 }
12748 else
12749 {
12750 exp->expType = type2;
12751 if(type2)
12752 type2->refCount++;
12753 }
12754 }
12755 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
12756 {
12757 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12758 {
12759 if(exp->op.exp2->destType)
12760 FreeType(exp->op.exp2->destType);
12761 exp->op.exp2->destType = type1->_class->registered->dataType;
12762 if(type1->_class->registered->dataType)
12763 type1->_class->registered->dataType->refCount++;
12764 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12765 }
12766 exp->expType = type1;
12767 if(type1)
12768 type1->refCount++;
12769 }
12770 }
12771 yylloc = exp->loc;
12772 if(exp->op.exp1 && !exp->op.exp1->expType)
12773 {
12774 char expString[10000];
12775
12776 expString[0] = '\0';
12777 if(inCompiler)
12778 {
12779 PrintExpression(exp->op.exp1, expString);
12780 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12781 }
12782 if(expString[0])
12783 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12784 }
12785 if(exp->op.exp2 && !exp->op.exp2->expType)
12786 {
12787 char expString[10240];
12788
12789 expString[0] = '\0';
12790 if(inCompiler)
12791 {
12792 PrintExpression(exp->op.exp2, expString);
12793 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12794 }
12795 if(expString[0])
12796 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
12797 }
12798 if(boolResult)
12799 {
12800 FreeType(exp->expType);
12801 exp->expType = MkClassType("bool");
12802 exp->expType->truth = 0x1;
12803 }
12804 if(exp->op.op != SIZEOF)
12805 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
12806 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
12807 {
12808 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
12809 }
12810 yylloc = oldyylloc;
12811 FreeType(dummy);
12812 break;
12813 }
12814 case 5:
12815 case 34:
12816 {
12817 struct Expression * e;
12818
12819 exp->isConstant = 0x1;
12820 for(e = (*exp->list).first; e; e = e->next)
12821 {
12822 unsigned int inced = 0x0;
12823
12824 if(!e->next)
12825 {
12826 FreeType(e->destType);
12827 e->destType = exp->destType;
12828 if(e->destType)
12829 {
12830 exp->destType->refCount++;
12831 e->destType->count++;
12832 inced = 0x1;
12833 }
12834 }
12835 ProcessExpressionType(e);
12836 if(inced)
12837 exp->destType->count--;
12838 if(!exp->expType && !e->next)
12839 {
12840 exp->expType = e->expType;
12841 if(e->expType)
12842 e->expType->refCount++;
12843 }
12844 if(!e->isConstant)
12845 exp->isConstant = 0x0;
12846 }
12847 e = (*exp->list).first;
12848 if(!e->next && e->type == 8)
12849 {
12850 struct Expression * next = exp->next, * prev = exp->prev;
12851
12852 FreeType(exp->expType);
12853 FreeType(exp->destType);
12854 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
12855 *exp = *e;
12856 exp->prev = prev;
12857 exp->next = next;
12858 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
12859 ProcessExpressionType(exp);
12860 }
12861 break;
12862 }
12863 case 6:
12864 {
12865 struct Expression * e;
12866
12867 exp->isConstant = 0x1;
12868 ProcessExpressionType(exp->index.exp);
12869 if(!exp->index.exp->isConstant)
12870 exp->isConstant = 0x0;
12871 if(exp->index.exp->expType)
12872 {
12873 struct Type * source = exp->index.exp->expType;
12874
12875 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)
12876 {
12877 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
12878
12879 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
12880 if(exp->index.index && (*exp->index.index).last)
12881 {
12882 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
12883 }
12884 }
12885 }
12886 for(e = (*exp->index.index).first; e; e = e->next)
12887 {
12888 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
12889 {
12890 if(e->destType)
12891 FreeType(e->destType);
12892 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
12893 }
12894 ProcessExpressionType(e);
12895 if(!e->next)
12896 {
12897 }
12898 if(!e->isConstant)
12899 exp->isConstant = 0x0;
12900 }
12901 if(!exp->expType)
12902 exp->expType = Dereference(exp->index.exp->expType);
12903 if(exp->expType)
12904 DeclareType(exp->expType, 0x0, 0x0);
12905 break;
12906 }
12907 case 7:
12908 {
12909 struct Expression * e;
12910 struct Type * functionType;
12911 struct Type * methodType = (((void *)0));
12912 char name[1024];
12913
12914 name[0] = '\0';
12915 if(inCompiler)
12916 {
12917 PrintExpression(exp->call.exp, name);
12918 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
12919 {
12920 PrintExpression(exp->call.exp, name);
12921 }
12922 }
12923 if(exp->call.exp->type == 0)
12924 {
12925 struct Expression * idExp = exp->call.exp;
12926 struct Identifier * id = idExp->identifier;
12927
12928 if(!strcmp(id->string, "__ENDIAN_PAD"))
12929 {
12930 exp->expType = ProcessTypeString("int", 0x1);
12931 if(exp->call.arguments && (*exp->call.arguments).first)
12932 ProcessExpressionType((*exp->call.arguments).first);
12933 break;
12934 }
12935 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
12936 {
12937 struct Expression * a = (((void *)0));
12938 struct Expression * b = (((void *)0));
12939 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
12940
12941 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
12942 {
12943 a = (*exp->call.arguments).first;
12944 b = (*exp->call.arguments).last;
12945 tempExp1 = a;
12946 tempExp2 = b;
12947 }
12948 else if((*exp->call.arguments).count == 1)
12949 {
12950 a = (*exp->call.arguments).first;
12951 tempExp1 = a;
12952 }
12953 if(a)
12954 {
12955 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
12956 idExp->identifier = (((void *)0));
12957 FreeExpContents(exp);
12958 ProcessExpressionType(a);
12959 if(b)
12960 ProcessExpressionType(b);
12961 exp->type = 5;
12962 exp->list = MkList();
12963 if(a->expType && (!b || b->expType))
12964 {
12965 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
12966 {
12967 if(inCompiler)
12968 {
12969 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12970 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
12971 struct Declaration * decl;
12972 char temp1[1024], temp2[1024];
12973
12974 GetTypeSpecs(a->expType, specs);
12975 if(a && !a->isConstant && a->type != 0)
12976 {
12977 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
12978 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
12979 tempExp1 = QMkExpId(temp1);
12980 tempExp1->expType = a->expType;
12981 if(a->expType)
12982 a->expType->refCount++;
12983 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
12984 }
12985 if(b && !b->isConstant && b->type != 0)
12986 {
12987 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
12988 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
12989 tempExp2 = QMkExpId(temp2);
12990 tempExp2->expType = b->expType;
12991 if(b->expType)
12992 b->expType->refCount++;
12993 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
12994 }
12995 decl = MkDeclaration(specs, decls);
12996 if(!curCompound->compound.declarations)
12997 curCompound->compound.declarations = MkList();
12998 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
12999 }
13000 }
13001 }
13002 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13003 {
13004 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13005
13006 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13007 exp->expType = a->expType;
13008 if(a->expType)
13009 a->expType->refCount++;
13010 }
13011 else if(!strcmp(id->string, "Abs"))
13012 {
13013 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13014 exp->expType = a->expType;
13015 if(a->expType)
13016 a->expType->refCount++;
13017 }
13018 else if(!strcmp(id->string, "Sgn"))
13019 {
13020 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"))))));
13021 exp->expType = ProcessTypeString("int", 0x0);
13022 }
13023 FreeExpression(tempExp1);
13024 if(tempExp2)
13025 FreeExpression(tempExp2);
13026 FreeIdentifier(id);
13027 break;
13028 }
13029 }
13030 }
13031 {
13032 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13033
13034 if(!exp->call.exp->destType)
13035 {
13036 exp->call.exp->destType = dummy;
13037 dummy->refCount++;
13038 }
13039 ProcessExpressionType(exp->call.exp);
13040 if(exp->call.exp->destType == dummy)
13041 {
13042 FreeType(dummy);
13043 exp->call.exp->destType = (((void *)0));
13044 }
13045 FreeType(dummy);
13046 }
13047 functionType = exp->call.exp->expType;
13048 if(functionType && functionType->kind == 16)
13049 {
13050 methodType = functionType;
13051 functionType = methodType->method->dataType;
13052 if(exp->call.exp->expType->usedClass)
13053 {
13054 char typeString[1024];
13055
13056 typeString[0] = '\0';
13057 PrintType(functionType, typeString, 0x1, 0x1);
13058 if(strstr(typeString, "thisclass"))
13059 {
13060 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13061 struct Declarator * decl;
13062
13063 {
13064 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13065
13066 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13067 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13068 thisClassParams = 0x0;
13069 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13070 {
13071 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13072
13073 thisClass = exp->call.exp->expType->usedClass;
13074 ProcessDeclarator(decl);
13075 thisClass = backupThisClass;
13076 }
13077 thisClassParams = 0x1;
13078 functionType = ProcessType(specs, decl);
13079 functionType->refCount = 0;
13080 FinishTemplatesContext(context);
13081 }
13082 FreeList(specs, FreeSpecifier);
13083 FreeDeclarator(decl);
13084 }
13085 }
13086 }
13087 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13088 {
13089 struct Type * type = functionType->type;
13090
13091 if(!functionType->refCount)
13092 {
13093 functionType->type = (((void *)0));
13094 FreeType(functionType);
13095 }
13096 functionType = type;
13097 }
13098 if(functionType && functionType->kind != 11)
13099 {
13100 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13101 }
13102 else if(functionType)
13103 {
13104 unsigned int emptyParams = 0x0, noParams = 0x0;
13105 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13106 struct Type * type = functionType->params.first;
13107 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13108 int extra = 0;
13109 struct Location oldyylloc = yylloc;
13110
13111 if(!type)
13112 emptyParams = 0x1;
13113 if(functionType->extraParam && e)
13114 {
13115 e->destType = MkClassType(functionType->thisClass->string);
13116 e = e->next;
13117 }
13118 if(!functionType->staticMethod)
13119 {
13120 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13121 {
13122 type = MkClassType(memberExp->member.exp->expType->_class->string);
13123 if(e)
13124 {
13125 e->destType = type;
13126 e = e->next;
13127 type = functionType->params.first;
13128 }
13129 else
13130 type->refCount = 0;
13131 }
13132 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13133 {
13134 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13135 if(e)
13136 {
13137 e->destType = type;
13138 e = e->next;
13139 type = functionType->params.first;
13140 }
13141 else
13142 type->refCount = 0;
13143 }
13144 }
13145 if(type && type->kind == 0)
13146 {
13147 noParams = 0x1;
13148 if(!type->refCount)
13149 FreeType(type);
13150 type = (((void *)0));
13151 }
13152 for(; e; e = e->next)
13153 {
13154 if(!type && !emptyParams)
13155 {
13156 yylloc = e->loc;
13157 if(methodType && methodType->methodClass)
13158 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);
13159 else
13160 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);
13161 break;
13162 }
13163 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13164 {
13165 struct Type * templatedType = (((void *)0));
13166 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13167 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13168 int id = 0;
13169
13170 if(_class && _class->templateArgs)
13171 {
13172 struct __ecereNameSpace__ecere__com__Class * sClass;
13173
13174 for(sClass = _class; sClass; sClass = sClass->base)
13175 {
13176 if(sClass->templateClass)
13177 sClass = sClass->templateClass;
13178 id = 0;
13179 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13180 {
13181 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13182 {
13183 struct __ecereNameSpace__ecere__com__Class * nextClass;
13184
13185 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13186 {
13187 if(nextClass->templateClass)
13188 nextClass = nextClass->templateClass;
13189 id += nextClass->templateParams.count;
13190 }
13191 break;
13192 }
13193 id++;
13194 }
13195 if(curParam)
13196 break;
13197 }
13198 }
13199 if(curParam && _class->templateArgs[id].dataTypeString)
13200 {
13201 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13202
13203 {
13204 struct Context * context = SetupTemplatesContext(_class);
13205
13206 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13207 FinishTemplatesContext(context);
13208 }
13209 e->destType = templatedType;
13210 if(templatedType)
13211 {
13212 templatedType->passAsTemplate = 0x1;
13213 }
13214 }
13215 else
13216 {
13217 e->destType = type;
13218 if(type)
13219 type->refCount++;
13220 }
13221 }
13222 else
13223 {
13224 e->destType = type;
13225 if(type)
13226 type->refCount++;
13227 }
13228 if(type && type->kind != 14)
13229 {
13230 struct Type * next = type->next;
13231
13232 if(!type->refCount)
13233 FreeType(type);
13234 type = next;
13235 }
13236 }
13237 if(type && type->kind != 14)
13238 {
13239 if(methodType && methodType->methodClass)
13240 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);
13241 else
13242 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);
13243 }
13244 yylloc = oldyylloc;
13245 if(type && !type->refCount)
13246 FreeType(type);
13247 }
13248 else
13249 {
13250 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13251 if(exp->call.exp->type == 0)
13252 {
13253 char * string = exp->call.exp->identifier->string;
13254
13255 if(inCompiler)
13256 {
13257 struct Symbol * symbol;
13258 struct Location oldyylloc = yylloc;
13259
13260 yylloc = exp->call.exp->identifier->loc;
13261 if(strstr(string, "__builtin_") == string)
13262 ;
13263 else
13264 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13265 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));
13266 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13267 if(strstr(symbol->string, "::"))
13268 globalContext->hasNameSpace = 0x1;
13269 yylloc = oldyylloc;
13270 }
13271 }
13272 else if(exp->call.exp->type == 8)
13273 {
13274 }
13275 else
13276 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13277 if(!functionType->returnType)
13278 {
13279 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13280 }
13281 }
13282 if(functionType && functionType->kind == 11)
13283 {
13284 exp->expType = functionType->returnType;
13285 if(functionType->returnType)
13286 functionType->returnType->refCount++;
13287 if(!functionType->refCount)
13288 FreeType(functionType);
13289 }
13290 if(exp->call.arguments)
13291 {
13292 for(e = (*exp->call.arguments).first; e; e = e->next)
13293 {
13294 struct Type * destType = e->destType;
13295
13296 ProcessExpressionType(e);
13297 }
13298 }
13299 break;
13300 }
13301 case 8:
13302 {
13303 struct Type * type;
13304 struct Location oldyylloc = yylloc;
13305 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13306
13307 exp->thisPtr = thisPtr;
13308 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13309 {
13310 exp->member.member->classSym = exp->member.member->_class->symbol;
13311 }
13312 ProcessExpressionType(exp->member.exp);
13313 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)
13314 {
13315 exp->isConstant = 0x0;
13316 }
13317 else
13318 exp->isConstant = exp->member.exp->isConstant;
13319 type = exp->member.exp->expType;
13320 yylloc = exp->loc;
13321 if(type && (type->kind == 20))
13322 {
13323 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13324 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13325
13326 if(_class)
13327 {
13328 for(param = _class->templateParams.first; param; param = param->next)
13329 {
13330 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13331 break;
13332 }
13333 }
13334 if(param && param->defaultArg.member)
13335 {
13336 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13337
13338 if(argExp)
13339 {
13340 struct Expression * expMember = exp->member.exp;
13341 struct Declarator * decl;
13342 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13343 char thisClassTypeString[1024];
13344
13345 FreeIdentifier(exp->member.member);
13346 ProcessExpressionType(argExp);
13347 {
13348 char * colon = strstr(param->defaultArg.memberString, "::");
13349
13350 if(colon)
13351 {
13352 char className[1024];
13353 struct __ecereNameSpace__ecere__com__Class * sClass;
13354
13355 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13356 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13357 }
13358 else
13359 strcpy(thisClassTypeString, _class->fullName);
13360 }
13361 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13362 exp->expType = ProcessType(specs, decl);
13363 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13364 {
13365 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13366 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13367 int c;
13368 int paramCount = 0;
13369 int lastParam = -1;
13370 char templateString[1024];
13371 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13372
13373 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13374 for(cClass = expClass; cClass; cClass = cClass->base)
13375 {
13376 int p = 0;
13377
13378 for(param = cClass->templateParams.first; param; param = param->next)
13379 {
13380 int id = p;
13381 struct __ecereNameSpace__ecere__com__Class * sClass;
13382 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13383
13384 for(sClass = cClass->base; sClass; sClass = sClass->base)
13385 id += sClass->templateParams.count;
13386 arg = expClass->templateArgs[id];
13387 for(sClass = _class; sClass; sClass = sClass->base)
13388 {
13389 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13390 int p = 0;
13391 struct __ecereNameSpace__ecere__com__Class * nextClass;
13392
13393 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13394 p += nextClass->templateParams.count;
13395 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13396 {
13397 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13398 {
13399 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13400 {
13401 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13402 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13403 break;
13404 }
13405 }
13406 }
13407 }
13408 {
13409 char argument[256];
13410
13411 argument[0] = '\0';
13412 switch(param->type)
13413 {
13414 case 2:
13415 {
13416 char expString[1024];
13417 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13418 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13419 struct Expression * exp;
13420 char * string = PrintHexUInt64(arg.expression.ui64);
13421
13422 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13423 ProcessExpressionType(exp);
13424 ComputeExpression(exp);
13425 expString[0] = '\0';
13426 PrintExpression(exp, expString);
13427 strcat(argument, expString);
13428 FreeExpression(exp);
13429 break;
13430 }
13431 case 1:
13432 {
13433 strcat(argument, arg.member->name);
13434 break;
13435 }
13436 case 0:
13437 {
13438 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13439 {
13440 if(!strcmp(arg.dataTypeString, "thisclass"))
13441 strcat(argument, thisClassTypeString);
13442 else
13443 strcat(argument, arg.dataTypeString);
13444 }
13445 break;
13446 }
13447 }
13448 if(argument[0])
13449 {
13450 if(paramCount)
13451 strcat(templateString, ", ");
13452 if(lastParam != p - 1)
13453 {
13454 strcat(templateString, param->name);
13455 strcat(templateString, " = ");
13456 }
13457 strcat(templateString, argument);
13458 paramCount++;
13459 lastParam = p;
13460 }
13461 p++;
13462 }
13463 }
13464 }
13465 {
13466 int len = strlen(templateString);
13467
13468 if(templateString[len - 1] == '>')
13469 templateString[len++] = ' ';
13470 templateString[len++] = '>';
13471 templateString[len++] = '\0';
13472 }
13473 {
13474 struct Context * context = SetupTemplatesContext(_class);
13475
13476 FreeType(exp->expType);
13477 exp->expType = ProcessTypeString(templateString, 0x0);
13478 FinishTemplatesContext(context);
13479 }
13480 }
13481 exp->type = 5;
13482 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")))))))));
13483 }
13484 }
13485 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13486 {
13487 type = ProcessTemplateParameterType(type->templateParameter);
13488 }
13489 }
13490 if(type && (type->kind == 20))
13491 ;
13492 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13493 {
13494 struct Identifier * id = exp->member.member;
13495 int typeKind = type->kind;
13496 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));
13497
13498 if(typeKind == 19 && exp->member.exp->type == 26)
13499 {
13500 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13501 typeKind = 8;
13502 }
13503 if(id && (typeKind == 3 || typeKind == 15))
13504 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13505 if(_class && id)
13506 {
13507 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13508 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13509 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13510 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13511 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13512
13513 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13514 exp->member.memberType = 1;
13515 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13516 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13517 if(typeKind != 19)
13518 {
13519 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13520 {
13521 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13522 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13523 {
13524 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13525 if(prop)
13526 member = (((void *)0));
13527 }
13528 if(!member && !prop)
13529 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13530 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13531 exp->member.thisPtr = 0x1;
13532 }
13533 else
13534 {
13535 if(!id->classSym)
13536 {
13537 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13538 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13539 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13540 }
13541 if(!prop && !member)
13542 {
13543 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13544 if(!method)
13545 {
13546 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13547 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13548 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13549 }
13550 }
13551 if(member && prop)
13552 {
13553 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13554 prop = (((void *)0));
13555 else
13556 member = (((void *)0));
13557 }
13558 }
13559 }
13560 if(!prop && !member)
13561 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13562 if(!prop && !member && !method)
13563 {
13564 if(typeKind == 19)
13565 {
13566 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13567 if(classProp)
13568 {
13569 exp->member.memberType = 5;
13570 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13571 }
13572 else
13573 {
13574 char structName[1024];
13575 struct Identifier * id = exp->member.member;
13576 struct Expression * classExp = exp->member.exp;
13577
13578 type->refCount++;
13579 FreeType(classExp->expType);
13580 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13581 strcpy(structName, "__ecereClassData_");
13582 FullClassNameCat(structName, type->_class->string, 0x0);
13583 exp->type = 9;
13584 exp->member.member = id;
13585 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"))))))));
13586 FreeType(type);
13587 ProcessExpressionType(exp);
13588 return ;
13589 }
13590 }
13591 else
13592 {
13593 struct Symbol * classSym = FindClass(id->string);
13594
13595 if(classSym)
13596 {
13597 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13598
13599 if(convertClass)
13600 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13601 }
13602 }
13603 }
13604 if(prop)
13605 {
13606 exp->member.memberType = 1;
13607 if(!prop->dataType)
13608 ProcessPropertyType(prop);
13609 exp->expType = prop->dataType;
13610 if(prop->dataType)
13611 prop->dataType->refCount++;
13612 }
13613 else if(member)
13614 {
13615 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13616 {
13617 FreeExpContents(exp);
13618 exp->type = 0;
13619 exp->identifier = MkIdentifier("class");
13620 ProcessExpressionType(exp);
13621 return ;
13622 }
13623 exp->member.memberType = 3;
13624 DeclareStruct(_class->fullName, 0x0);
13625 if(!member->dataType)
13626 {
13627 struct Context * context = SetupTemplatesContext(_class);
13628
13629 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13630 FinishTemplatesContext(context);
13631 }
13632 exp->expType = member->dataType;
13633 if(member->dataType)
13634 member->dataType->refCount++;
13635 }
13636 else if(revConvert)
13637 {
13638 exp->member.memberType = 4;
13639 exp->expType = MkClassType(revConvert->_class->fullName);
13640 }
13641 else if(method)
13642 {
13643 if(inCompiler)
13644 {
13645 exp->member.memberType = 2;
13646 }
13647 if(!method->dataType)
13648 ProcessMethodType(method);
13649 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));
13650 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13651 exp->expType->usedClass = _class;
13652 }
13653 else if(!classProp)
13654 {
13655 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13656 {
13657 FreeExpContents(exp);
13658 exp->type = 0;
13659 exp->identifier = MkIdentifier("class");
13660 ProcessExpressionType(exp);
13661 return ;
13662 }
13663 yylloc = exp->member.member->loc;
13664 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
13665 if(inCompiler)
13666 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13667 }
13668 if(_class && exp->expType)
13669 {
13670 struct __ecereNameSpace__ecere__com__Class * tClass;
13671
13672 tClass = _class;
13673 while(tClass && !tClass->templateClass)
13674 tClass = tClass->base;
13675 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13676 {
13677 int id = 0;
13678 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13679 struct __ecereNameSpace__ecere__com__Class * sClass;
13680
13681 for(sClass = tClass; sClass; sClass = sClass->base)
13682 {
13683 id = 0;
13684 if(sClass->templateClass)
13685 sClass = sClass->templateClass;
13686 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13687 {
13688 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13689 {
13690 for(sClass = sClass->base; sClass; sClass = sClass->base)
13691 id += sClass->templateParams.count;
13692 break;
13693 }
13694 id++;
13695 }
13696 if(curParam)
13697 break;
13698 }
13699 if(curParam && tClass->templateArgs[id].dataTypeString)
13700 {
13701 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13702 struct Context * context = SetupTemplatesContext(tClass);
13703
13704 FreeType(exp->expType);
13705 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13706 if(exp->expType)
13707 {
13708 if(exp->expType->kind == 21)
13709 {
13710 FreeType(exp->expType);
13711 exp->expType = ReplaceThisClassType(_class);
13712 }
13713 if(tClass->templateClass)
13714 exp->expType->passAsTemplate = 0x1;
13715 if(!exp->destType)
13716 {
13717 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13718 if(exp->destType->kind == 21)
13719 {
13720 FreeType(exp->destType);
13721 exp->destType = ReplaceThisClassType(_class);
13722 }
13723 }
13724 }
13725 FinishTemplatesContext(context);
13726 }
13727 }
13728 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13729 {
13730 int id = 0;
13731 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13732 struct __ecereNameSpace__ecere__com__Class * sClass;
13733
13734 for(sClass = tClass; sClass; sClass = sClass->base)
13735 {
13736 id = 0;
13737 if(sClass->templateClass)
13738 sClass = sClass->templateClass;
13739 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13740 {
13741 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13742 {
13743 for(sClass = sClass->base; sClass; sClass = sClass->base)
13744 id += sClass->templateParams.count;
13745 break;
13746 }
13747 id++;
13748 }
13749 if(curParam)
13750 break;
13751 }
13752 if(curParam)
13753 {
13754 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13755 struct Context * context = SetupTemplatesContext(tClass);
13756 struct Type * basicType;
13757
13758 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
13759 if(basicType)
13760 {
13761 if(basicType->kind == 21)
13762 {
13763 FreeType(basicType);
13764 basicType = ReplaceThisClassType(_class);
13765 }
13766 FreeType(exp->expType);
13767 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));
13768 if(!exp->destType)
13769 {
13770 exp->destType = exp->expType;
13771 exp->destType->refCount++;
13772 }
13773 {
13774 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13775 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13776 struct Declarator * decl;
13777
13778 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
13779 *newExp = *exp;
13780 if(exp->destType)
13781 exp->destType->refCount++;
13782 if(exp->expType)
13783 exp->expType->refCount++;
13784 exp->type = 11;
13785 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
13786 exp->cast.exp = newExp;
13787 }
13788 }
13789 FinishTemplatesContext(context);
13790 }
13791 }
13792 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
13793 {
13794 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13795
13796 if(expClass)
13797 {
13798 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13799 int c;
13800 int p = 0;
13801 int paramCount = 0;
13802 int lastParam = -1;
13803 char templateString[1024];
13804 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13805
13806 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13807 while(cClass != expClass)
13808 {
13809 struct __ecereNameSpace__ecere__com__Class * sClass;
13810
13811 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
13812 ;
13813 cClass = sClass;
13814 for(param = cClass->templateParams.first; param; param = param->next)
13815 {
13816 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
13817 int c;
13818 int cp = 0;
13819 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
13820 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13821
13822 while(cClassCur != tClass && !paramCur)
13823 {
13824 struct __ecereNameSpace__ecere__com__Class * sClassCur;
13825
13826 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
13827 ;
13828 cClassCur = sClassCur;
13829 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
13830 {
13831 if(!strcmp(paramCur->name, param->name))
13832 {
13833 break;
13834 }
13835 cp++;
13836 }
13837 }
13838 if(paramCur && paramCur->type == 0)
13839 arg = tClass->templateArgs[cp];
13840 else
13841 arg = expClass->templateArgs[p];
13842 {
13843 char argument[256];
13844
13845 argument[0] = '\0';
13846 switch(param->type)
13847 {
13848 case 2:
13849 {
13850 char expString[1024];
13851 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13852 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13853 struct Expression * exp;
13854 char * string = PrintHexUInt64(arg.expression.ui64);
13855
13856 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13857 ProcessExpressionType(exp);
13858 ComputeExpression(exp);
13859 expString[0] = '\0';
13860 PrintExpression(exp, expString);
13861 strcat(argument, expString);
13862 FreeExpression(exp);
13863 break;
13864 }
13865 case 1:
13866 {
13867 strcat(argument, arg.member->name);
13868 break;
13869 }
13870 case 0:
13871 {
13872 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13873 strcat(argument, arg.dataTypeString);
13874 break;
13875 }
13876 }
13877 if(argument[0])
13878 {
13879 if(paramCount)
13880 strcat(templateString, ", ");
13881 if(lastParam != p - 1)
13882 {
13883 strcat(templateString, param->name);
13884 strcat(templateString, " = ");
13885 }
13886 strcat(templateString, argument);
13887 paramCount++;
13888 lastParam = p;
13889 }
13890 }
13891 p++;
13892 }
13893 }
13894 {
13895 int len = strlen(templateString);
13896
13897 if(templateString[len - 1] == '>')
13898 templateString[len++] = ' ';
13899 templateString[len++] = '>';
13900 templateString[len++] = '\0';
13901 }
13902 FreeType(exp->expType);
13903 {
13904 struct Context * context = SetupTemplatesContext(tClass);
13905
13906 exp->expType = ProcessTypeString(templateString, 0x0);
13907 FinishTemplatesContext(context);
13908 }
13909 }
13910 }
13911 }
13912 }
13913 else
13914 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)");
13915 }
13916 else if(type && (type->kind == 9 || type->kind == 10))
13917 {
13918 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
13919
13920 if(memberType)
13921 {
13922 exp->expType = memberType;
13923 if(memberType)
13924 memberType->refCount++;
13925 }
13926 }
13927 else
13928 {
13929 char expString[10240];
13930
13931 expString[0] = '\0';
13932 if(inCompiler)
13933 {
13934 PrintExpression(exp, expString);
13935 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13936 }
13937 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
13938 }
13939 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
13940 {
13941 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13942 {
13943 struct Identifier * id = exp->member.member;
13944 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));
13945
13946 if(_class)
13947 {
13948 FreeType(exp->expType);
13949 exp->expType = ReplaceThisClassType(_class);
13950 }
13951 }
13952 }
13953 yylloc = oldyylloc;
13954 break;
13955 }
13956 case 9:
13957 {
13958 struct Type * destType = exp->destType;
13959
13960 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13961 {
13962 exp->member.member->classSym = exp->member.member->_class->symbol;
13963 }
13964 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
13965 exp->type = 8;
13966 if(destType)
13967 destType->count++;
13968 ProcessExpressionType(exp);
13969 if(destType)
13970 destType->count--;
13971 break;
13972 }
13973 case 15:
13974 {
13975 struct Symbol * classSym = exp->_class->symbol;
13976
13977 if(classSym && classSym->registered)
13978 {
13979 if(classSym->registered->type == 5)
13980 {
13981 char name[1024];
13982
13983 name[0] = '\0';
13984 DeclareStruct(classSym->string, 0x0);
13985 FreeSpecifier(exp->_class);
13986 exp->type = 10;
13987 FullClassNameCat(name, classSym->string, 0x0);
13988 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
13989 }
13990 else
13991 {
13992 if(classSym->registered->fixed)
13993 {
13994 FreeSpecifier(exp->_class);
13995 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
13996 exp->type = 2;
13997 }
13998 else
13999 {
14000 char className[1024];
14001
14002 strcpy(className, "__ecereClass_");
14003 FullClassNameCat(className, classSym->string, 0x1);
14004 MangleClassName(className);
14005 DeclareClass(classSym, className);
14006 FreeExpContents(exp);
14007 exp->type = 9;
14008 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14009 exp->member.member = MkIdentifier("structSize");
14010 }
14011 }
14012 }
14013 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14014 break;
14015 }
14016 case 10:
14017 {
14018 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14019
14020 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14021 exp->isConstant = 0x1;
14022 DeclareType(type, 0x0, 0x0);
14023 FreeType(type);
14024 break;
14025 }
14026 case 11:
14027 {
14028 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14029
14030 type->count = (unsigned int)1;
14031 FreeType(exp->cast.exp->destType);
14032 exp->cast.exp->destType = type;
14033 type->refCount++;
14034 ProcessExpressionType(exp->cast.exp);
14035 type->count = (unsigned int)0;
14036 exp->expType = type;
14037 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14038 {
14039 void * prev = exp->prev, * next = exp->next;
14040 struct Type * expType = exp->cast.exp->destType;
14041 struct Expression * castExp = exp->cast.exp;
14042 struct Type * destType = exp->destType;
14043
14044 if(expType)
14045 expType->refCount++;
14046 FreeType(exp->expType);
14047 FreeTypeName(exp->cast.typeName);
14048 *exp = *castExp;
14049 FreeType(exp->expType);
14050 FreeType(exp->destType);
14051 exp->expType = expType;
14052 exp->destType = destType;
14053 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14054 exp->prev = prev;
14055 exp->next = next;
14056 }
14057 else
14058 {
14059 exp->isConstant = exp->cast.exp->isConstant;
14060 }
14061 break;
14062 }
14063 case 35:
14064 {
14065 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14066
14067 type->refCount++;
14068 exp->expType = type;
14069 break;
14070 }
14071 case 36:
14072 {
14073 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14074
14075 ProcessExpressionType(exp->vaArg.exp);
14076 type->refCount++;
14077 exp->expType = type;
14078 break;
14079 }
14080 case 12:
14081 {
14082 struct Expression * e;
14083
14084 exp->isConstant = 0x1;
14085 FreeType(exp->cond.cond->destType);
14086 exp->cond.cond->destType = MkClassType("bool");
14087 exp->cond.cond->destType->truth = 0x1;
14088 ProcessExpressionType(exp->cond.cond);
14089 if(!exp->cond.cond->isConstant)
14090 exp->isConstant = 0x0;
14091 for(e = (*exp->cond.exp).first; e; e = e->next)
14092 {
14093 if(!e->next)
14094 {
14095 FreeType(e->destType);
14096 e->destType = exp->destType;
14097 if(e->destType)
14098 e->destType->refCount++;
14099 }
14100 ProcessExpressionType(e);
14101 if(!e->next)
14102 {
14103 exp->expType = e->expType;
14104 if(e->expType)
14105 e->expType->refCount++;
14106 }
14107 if(!e->isConstant)
14108 exp->isConstant = 0x0;
14109 }
14110 FreeType(exp->cond.elseExp->destType);
14111 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14112 if(exp->cond.elseExp->destType)
14113 exp->cond.elseExp->destType->refCount++;
14114 ProcessExpressionType(exp->cond.elseExp);
14115 if(!exp->cond.elseExp->isConstant)
14116 exp->isConstant = 0x0;
14117 break;
14118 }
14119 case 25:
14120 {
14121 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14122 {
14123 struct Statement * last = (*exp->compound->compound.statements).last;
14124
14125 if(last->type == 3 && last->expressions && (*last->expressions).last)
14126 {
14127 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14128 if(exp->destType)
14129 exp->destType->refCount++;
14130 }
14131 ProcessStatement(exp->compound);
14132 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14133 if(((struct Expression *)(*last->expressions).last)->expType)
14134 exp->expType->refCount++;
14135 }
14136 break;
14137 }
14138 case 26:
14139 {
14140 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14141
14142 if(spec && spec->type == 1)
14143 {
14144 exp->expType = MkClassType(spec->name);
14145 exp->expType->kind = 19;
14146 exp->byReference = 0x1;
14147 }
14148 else
14149 {
14150 exp->expType = MkClassType("ecere::com::Class");
14151 exp->byReference = 0x1;
14152 }
14153 break;
14154 }
14155 case 27:
14156 {
14157 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14158
14159 if(_class)
14160 {
14161 struct Identifier * id = exp->classData.id;
14162 char structName[1024];
14163 struct Expression * classExp;
14164
14165 strcpy(structName, "__ecereClassData_");
14166 FullClassNameCat(structName, _class->fullName, 0x0);
14167 exp->type = 9;
14168 exp->member.member = id;
14169 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14170 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14171 else
14172 classExp = MkExpIdentifier(MkIdentifier("class"));
14173 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"))))))));
14174 ProcessExpressionType(exp);
14175 return ;
14176 }
14177 break;
14178 }
14179 case 37:
14180 {
14181 struct Type * type = (((void *)0));
14182 char * typeString = (((void *)0));
14183 char typeStringBuf[1024];
14184
14185 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))
14186 {
14187 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14188
14189 typeString = templateClass->templateArgs[2].dataTypeString;
14190 }
14191 else if(exp->list)
14192 {
14193 struct Expression * e;
14194
14195 for(e = (*exp->list).first; e; e = e->next)
14196 {
14197 ProcessExpressionType(e);
14198 if(e->expType)
14199 {
14200 if(!type)
14201 {
14202 type = e->expType;
14203 type->refCount++;
14204 }
14205 else
14206 {
14207 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14208 {
14209 FreeType(type);
14210 type = e->expType;
14211 e->expType = (((void *)0));
14212 e = (*exp->list).first;
14213 ProcessExpressionType(e);
14214 if(e->expType)
14215 {
14216 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14217 {
14218 FreeType(e->expType);
14219 e->expType = (((void *)0));
14220 FreeType(type);
14221 type = (((void *)0));
14222 break;
14223 }
14224 }
14225 }
14226 }
14227 if(e->expType)
14228 {
14229 FreeType(e->expType);
14230 e->expType = (((void *)0));
14231 }
14232 }
14233 }
14234 if(type)
14235 {
14236 typeStringBuf[0] = '\0';
14237 PrintType(type, typeStringBuf, 0x0, 0x1);
14238 typeString = typeStringBuf;
14239 FreeType(type);
14240 type = (((void *)0));
14241 }
14242 }
14243 if(typeString)
14244 {
14245 char templateString[1024];
14246 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14247 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14248 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14249 struct Expression * expExt;
14250 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14251
14252 sprintf(templateString, "Container<%s>", typeString);
14253 if(exp->list)
14254 {
14255 struct Expression * e;
14256
14257 type = ProcessTypeString(typeString, 0x0);
14258 while(e = (*exp->list).first)
14259 {
14260 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14261 e->destType = type;
14262 type->refCount++;
14263 ProcessExpressionType(e);
14264 ListAdd(initializers, MkInitializerAssignment(e));
14265 }
14266 FreeType(type);
14267 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14268 }
14269 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14270 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14271 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14272 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14273 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14274 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14275 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14276 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14277 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14278 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))));
14279 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14280 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14281 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14282 exp->expType = ProcessTypeString(templateString, 0x0);
14283 exp->type = 5;
14284 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14285 ProcessExpressionType(expExt);
14286 }
14287 else
14288 {
14289 exp->expType = ProcessTypeString("Container", 0x0);
14290 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14291 }
14292 break;
14293 }
14294 }
14295 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14296 {
14297 FreeType(exp->expType);
14298 exp->expType = ReplaceThisClassType(thisClass);
14299 }
14300 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14301 {
14302 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14303
14304 if(symbol)
14305 {
14306 if(exp->expType->kind != 15)
14307 {
14308 struct Type * member;
14309 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14310
14311 FreeType(exp->expType);
14312 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14313 exp->expType->kind = symbol->type->kind;
14314 exp->expType->refCount++;
14315 exp->expType->enumName = enumName;
14316 exp->expType->members = symbol->type->members;
14317 for(member = symbol->type->members.first; member; member = member->next)
14318 member->refCount++;
14319 }
14320 else
14321 {
14322 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14323
14324 for(member = symbol->type->members.first; member; member = member->next)
14325 {
14326 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14327
14328 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14329 }
14330 }
14331 }
14332 }
14333 yylloc = exp->loc;
14334 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14335 ;
14336 else if(exp->destType && !exp->destType->keepCast)
14337 {
14338 if(!CheckExpressionType(exp, exp->destType, 0x0))
14339 {
14340 if(!exp->destType->count || unresolved)
14341 {
14342 if(!exp->expType)
14343 {
14344 yylloc = exp->loc;
14345 if(exp->destType->kind != 14)
14346 {
14347 char type2[1024];
14348
14349 type2[0] = '\0';
14350 if(inCompiler)
14351 {
14352 char expString[10240];
14353
14354 expString[0] = '\0';
14355 PrintType(exp->destType, type2, 0x0, 0x1);
14356 if(inCompiler)
14357 {
14358 PrintExpression(exp, expString);
14359 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14360 }
14361 if(unresolved)
14362 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14363 else if(exp->type != 16)
14364 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14365 }
14366 }
14367 else
14368 {
14369 char expString[10240];
14370
14371 expString[0] = '\0';
14372 if(inCompiler)
14373 {
14374 PrintExpression(exp, expString);
14375 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14376 }
14377 if(unresolved)
14378 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14379 else if(exp->type != 16)
14380 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14381 }
14382 }
14383 else
14384 {
14385 char type1[1024];
14386 char type2[1024];
14387
14388 type1[0] = '\0';
14389 type2[0] = '\0';
14390 if(inCompiler)
14391 {
14392 PrintType(exp->expType, type1, 0x0, 0x1);
14393 PrintType(exp->destType, type2, 0x0, 0x1);
14394 }
14395 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)))
14396 ;
14397 else
14398 {
14399 char expString[10240];
14400
14401 expString[0] = '\0';
14402 if(inCompiler)
14403 {
14404 PrintExpression(exp, expString);
14405 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14406 }
14407 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14408 FreeType(exp->expType);
14409 exp->destType->refCount++;
14410 exp->expType = exp->destType;
14411 }
14412 }
14413 }
14414 }
14415 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14416 {
14417 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14418 char typeString[1024];
14419 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14420 struct Declarator * decl;
14421
14422 typeString[0] = '\0';
14423 *newExp = *exp;
14424 if(exp->expType)
14425 exp->expType->refCount++;
14426 if(exp->expType)
14427 exp->expType->refCount++;
14428 exp->type = 11;
14429 newExp->destType = exp->expType;
14430 PrintType(exp->expType, typeString, 0x0, 0x0);
14431 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14432 exp->cast.typeName = MkTypeName(specs, decl);
14433 exp->cast.exp = newExp;
14434 }
14435 }
14436 else if(unresolved)
14437 {
14438 if(exp->identifier->_class && exp->identifier->_class->name)
14439 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14440 else if(exp->identifier->string && exp->identifier->string[0])
14441 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14442 }
14443 else if(!exp->expType && exp->type != 16)
14444 {
14445 char expString[10240];
14446
14447 expString[0] = '\0';
14448 if(inCompiler)
14449 {
14450 PrintExpression(exp, expString);
14451 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14452 }
14453 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14454 }
14455 ApplyAnyObjectLogic(exp);
14456 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14457 {
14458 exp->byReference = 0x1;
14459 }
14460 yylloc = oldyylloc;
14461 }
14462
14463 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)
14464 {
14465 if(*curMember)
14466 {
14467 *curMember = (*curMember)->next;
14468 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14469 {
14470 *curMember = subMemberStack[--(*subMemberStackPos)];
14471 *curMember = (*curMember)->next;
14472 }
14473 while((*curMember) && (*curMember)->isProperty)
14474 *curMember = (*curMember)->next;
14475 if(subMemberStackPos)
14476 {
14477 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14478 {
14479 subMemberStack[(*subMemberStackPos)++] = *curMember;
14480 *curMember = (*curMember)->members.first;
14481 while(*curMember && (*curMember)->isProperty)
14482 *curMember = (*curMember)->next;
14483 }
14484 }
14485 }
14486 while(!*curMember)
14487 {
14488 if(!*curMember)
14489 {
14490 if(subMemberStackPos && *subMemberStackPos)
14491 {
14492 *curMember = subMemberStack[--(*subMemberStackPos)];
14493 *curMember = (*curMember)->next;
14494 }
14495 else
14496 {
14497 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14498
14499 if(*curClass == _class)
14500 break;
14501 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14502 ;
14503 *curMember = (*curClass)->membersAndProperties.first;
14504 }
14505 while((*curMember) && (*curMember)->isProperty)
14506 *curMember = (*curMember)->next;
14507 if(subMemberStackPos)
14508 {
14509 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14510 {
14511 subMemberStack[(*subMemberStackPos)++] = *curMember;
14512 *curMember = (*curMember)->members.first;
14513 while(*curMember && (*curMember)->isProperty)
14514 *curMember = (*curMember)->next;
14515 }
14516 }
14517 }
14518 }
14519 }
14520
14521 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14522 {
14523 switch(init->type)
14524 {
14525 case 0:
14526 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14527 {
14528 if(init->exp && !init->exp->destType)
14529 {
14530 FreeType(init->exp->destType);
14531 init->exp->destType = type;
14532 if(type)
14533 type->refCount++;
14534 }
14535 if(init->exp)
14536 {
14537 ProcessExpressionType(init->exp);
14538 init->isConstant = init->exp->isConstant;
14539 }
14540 break;
14541 }
14542 else
14543 {
14544 struct Expression * exp = init->exp;
14545 struct Instantiation * inst = exp->instance;
14546 struct MembersInit * members;
14547
14548 init->type = 1;
14549 init->list = MkList();
14550 if(inst->members)
14551 {
14552 for(members = (*inst->members).first; members; members = members->next)
14553 {
14554 if(members->type == 0)
14555 {
14556 struct MemberInit * member;
14557
14558 for(member = (*members->dataMembers).first; member; member = member->next)
14559 {
14560 ListAdd(init->list, member->initializer);
14561 member->initializer = (((void *)0));
14562 }
14563 }
14564 }
14565 }
14566 FreeExpression(exp);
14567 }
14568 case 1:
14569 {
14570 struct Initializer * i;
14571 struct Type * initializerType = (((void *)0));
14572 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14573 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14574 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14575 int subMemberStackPos = 0;
14576
14577 if(type && type->kind == 12)
14578 initializerType = Dereference(type);
14579 else if(type && (type->kind == 9 || type->kind == 10))
14580 initializerType = type->members.first;
14581 for(i = (*init->list).first; i; i = i->next)
14582 {
14583 if(type && type->kind == 8 && type->_class && type->_class->registered)
14584 {
14585 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14586 if(curMember)
14587 {
14588 if(!curMember->dataType)
14589 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14590 initializerType = curMember->dataType;
14591 }
14592 }
14593 ProcessInitializer(i, initializerType);
14594 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14595 initializerType = initializerType->next;
14596 if(!i->isConstant)
14597 init->isConstant = 0x0;
14598 }
14599 if(type && type->kind == 12)
14600 FreeType(initializerType);
14601 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14602 {
14603 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14604 }
14605 break;
14606 }
14607 }
14608 }
14609
14610 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14611
14612 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14613
14614 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14615 {
14616 switch(spec->type)
14617 {
14618 case 0:
14619 {
14620 if(spec->specifier == THISCLASS)
14621 {
14622 if(thisClass)
14623 {
14624 spec->type = 1;
14625 spec->name = ReplaceThisClass(thisClass);
14626 spec->symbol = FindClass(spec->name);
14627 ProcessSpecifier(spec, declareStruct);
14628 }
14629 }
14630 break;
14631 }
14632 case 1:
14633 {
14634 struct Symbol * symbol = FindType(curContext, spec->name);
14635
14636 if(symbol)
14637 DeclareType(symbol->type, 0x1, 0x1);
14638 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14639 DeclareStruct(spec->name, 0x0);
14640 break;
14641 }
14642 case 2:
14643 {
14644 struct Enumerator * e;
14645
14646 if(spec->list)
14647 {
14648 for(e = (*spec->list).first; e; e = e->next)
14649 {
14650 if(e->exp)
14651 ProcessExpressionType(e->exp);
14652 }
14653 }
14654 break;
14655 }
14656 case 3:
14657 case 4:
14658 {
14659 if(spec->definitions)
14660 {
14661 struct ClassDef * def;
14662 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14663
14664 ProcessClass(spec->definitions, symbol);
14665 }
14666 break;
14667 }
14668 }
14669 }
14670
14671 static void ProcessDeclarator(struct Declarator * decl)
14672 {
14673 switch(decl->type)
14674 {
14675 case 1:
14676 if(decl->identifier->classSym)
14677 {
14678 FreeSpecifier(decl->identifier->_class);
14679 decl->identifier->_class = (((void *)0));
14680 }
14681 break;
14682 case 3:
14683 if(decl->array.exp)
14684 ProcessExpressionType(decl->array.exp);
14685 case 0:
14686 case 2:
14687 case 4:
14688 case 5:
14689 case 6:
14690 case 7:
14691 if(decl->declarator)
14692 ProcessDeclarator(decl->declarator);
14693 if(decl->type == 4)
14694 {
14695 struct Identifier * id = GetDeclId(decl);
14696
14697 if(id && id->_class)
14698 {
14699 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14700
14701 if(!decl->function.parameters)
14702 decl->function.parameters = MkList();
14703 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14704 id->_class = (((void *)0));
14705 }
14706 if(decl->function.parameters)
14707 {
14708 struct TypeName * param;
14709
14710 for(param = (*decl->function.parameters).first; param; param = param->next)
14711 {
14712 if(param->qualifiers && (*param->qualifiers).first)
14713 {
14714 struct Specifier * spec = (*param->qualifiers).first;
14715
14716 if(spec && spec->specifier == TYPED_OBJECT)
14717 {
14718 struct Declarator * d = param->declarator;
14719 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);
14720
14721 FreeList(param->qualifiers, FreeSpecifier);
14722 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14723 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14724 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14725 param = newParam;
14726 }
14727 else if(spec && spec->specifier == ANY_OBJECT)
14728 {
14729 struct Declarator * d = param->declarator;
14730
14731 FreeList(param->qualifiers, FreeSpecifier);
14732 param->qualifiers = MkListOne(MkSpecifier(VOID));
14733 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14734 }
14735 else if(spec->specifier == THISCLASS)
14736 {
14737 if(thisClass)
14738 {
14739 spec->type = 1;
14740 spec->name = ReplaceThisClass(thisClass);
14741 spec->symbol = FindClass(spec->name);
14742 ProcessSpecifier(spec, 0x0);
14743 }
14744 }
14745 }
14746 if(param->declarator)
14747 ProcessDeclarator(param->declarator);
14748 }
14749 }
14750 }
14751 break;
14752 }
14753 }
14754
14755 extern struct Identifier * CopyIdentifier(struct Identifier * id);
14756
14757 extern void FreeInitDeclarator(struct InitDeclarator * decl);
14758
14759 static void ProcessDeclaration(struct Declaration * decl)
14760 {
14761 yylloc = decl->loc;
14762 switch(decl->type)
14763 {
14764 case 1:
14765 {
14766 unsigned int declareStruct = 0x0;
14767
14768 if(decl->declarators)
14769 {
14770 struct InitDeclarator * d;
14771
14772 for(d = (*decl->declarators).first; d; d = d->next)
14773 {
14774 struct Type * type, * subType;
14775
14776 ProcessDeclarator(d->declarator);
14777 type = ProcessType(decl->specifiers, d->declarator);
14778 if(d->initializer)
14779 {
14780 ProcessInitializer(d->initializer, type);
14781 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
14782 {
14783 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
14784 {
14785 struct Instantiation * inst = d->initializer->exp->instance;
14786
14787 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
14788 d->initializer->exp->instance = (((void *)0));
14789 if(decl->specifiers)
14790 FreeList(decl->specifiers, FreeSpecifier);
14791 FreeList(decl->declarators, FreeInitDeclarator);
14792 d = (((void *)0));
14793 decl->type = 2;
14794 decl->inst = inst;
14795 }
14796 }
14797 }
14798 for(subType = type; subType; )
14799 {
14800 if(subType->kind == 8)
14801 {
14802 declareStruct = 0x1;
14803 break;
14804 }
14805 else if(subType->kind == 13)
14806 break;
14807 else if(subType->kind == 12)
14808 subType = subType->arrayType;
14809 else
14810 break;
14811 }
14812 FreeType(type);
14813 if(!d)
14814 break;
14815 }
14816 }
14817 if(decl->specifiers)
14818 {
14819 struct Specifier * s;
14820
14821 for(s = (*decl->specifiers).first; s; s = s->next)
14822 {
14823 ProcessSpecifier(s, declareStruct);
14824 }
14825 }
14826 break;
14827 }
14828 case 2:
14829 {
14830 ProcessInstantiationType(decl->inst);
14831 break;
14832 }
14833 case 0:
14834 {
14835 struct Specifier * spec;
14836 struct Declarator * d;
14837 unsigned int declareStruct = 0x0;
14838
14839 if(decl->declarators)
14840 {
14841 for(d = (*decl->declarators).first; d; d = d->next)
14842 {
14843 struct Type * type = ProcessType(decl->specifiers, d->declarator);
14844 struct Type * subType;
14845
14846 ProcessDeclarator(d);
14847 for(subType = type; subType; )
14848 {
14849 if(subType->kind == 8)
14850 {
14851 declareStruct = 0x1;
14852 break;
14853 }
14854 else if(subType->kind == 13)
14855 break;
14856 else if(subType->kind == 12)
14857 subType = subType->arrayType;
14858 else
14859 break;
14860 }
14861 FreeType(type);
14862 }
14863 }
14864 if(decl->specifiers)
14865 {
14866 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
14867 ProcessSpecifier(spec, declareStruct);
14868 }
14869 break;
14870 }
14871 }
14872 }
14873
14874 static struct FunctionDefinition * curFunction;
14875
14876 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
14877 {
14878 char propName[1024], propNameM[1024];
14879 char getName[1024], setName[1024];
14880 struct __ecereNameSpace__ecere__sys__OldList * args;
14881
14882 DeclareProperty(prop, setName, getName);
14883 strcpy(propName, "__ecereProp_");
14884 FullClassNameCat(propName, prop->_class->fullName, 0x0);
14885 strcat(propName, "_");
14886 FullClassNameCat(propName, prop->name, 0x1);
14887 MangleClassName(propName);
14888 strcpy(propNameM, "__ecerePropM_");
14889 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
14890 strcat(propNameM, "_");
14891 FullClassNameCat(propNameM, prop->name, 0x1);
14892 MangleClassName(propNameM);
14893 if(prop->isWatchable)
14894 {
14895 args = MkList();
14896 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14897 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14898 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14899 args = MkList();
14900 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14901 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14902 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14903 }
14904 {
14905 args = MkList();
14906 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14907 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14908 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14909 args = MkList();
14910 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14911 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14912 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14913 }
14914 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
14915 curFunction->propSet->fireWatchersDone = 0x1;
14916 }
14917
14918 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
14919
14920 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
14921
14922 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
14923
14924 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
14925
14926 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
14927
14928 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
14929
14930 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
14931
14932 extern void FreePropertyWatch(struct PropertyWatch * watcher);
14933
14934 static void ProcessStatement(struct Statement * stmt)
14935 {
14936 yylloc = stmt->loc;
14937 switch(stmt->type)
14938 {
14939 case 0:
14940 ProcessStatement(stmt->labeled.stmt);
14941 break;
14942 case 1:
14943 if(stmt->caseStmt.exp)
14944 {
14945 FreeType(stmt->caseStmt.exp->destType);
14946 stmt->caseStmt.exp->destType = curSwitchType;
14947 if(curSwitchType)
14948 curSwitchType->refCount++;
14949 ProcessExpressionType(stmt->caseStmt.exp);
14950 ComputeExpression(stmt->caseStmt.exp);
14951 }
14952 if(stmt->caseStmt.stmt)
14953 ProcessStatement(stmt->caseStmt.stmt);
14954 break;
14955 case 2:
14956 {
14957 if(stmt->compound.context)
14958 {
14959 struct Declaration * decl;
14960 struct Statement * s;
14961 struct Statement * prevCompound = curCompound;
14962 struct Context * prevContext = curContext;
14963
14964 if(!stmt->compound.isSwitch)
14965 {
14966 curCompound = stmt;
14967 curContext = stmt->compound.context;
14968 }
14969 if(stmt->compound.declarations)
14970 {
14971 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
14972 ProcessDeclaration(decl);
14973 }
14974 if(stmt->compound.statements)
14975 {
14976 for(s = (*stmt->compound.statements).first; s; s = s->next)
14977 ProcessStatement(s);
14978 }
14979 curContext = prevContext;
14980 curCompound = prevCompound;
14981 }
14982 break;
14983 }
14984 case 3:
14985 {
14986 struct Expression * exp;
14987
14988 if(stmt->expressions)
14989 {
14990 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
14991 ProcessExpressionType(exp);
14992 }
14993 break;
14994 }
14995 case 4:
14996 {
14997 struct Expression * exp;
14998
14999 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15000 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15001 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15002 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15003 {
15004 ProcessExpressionType(exp);
15005 }
15006 if(stmt->ifStmt.stmt)
15007 ProcessStatement(stmt->ifStmt.stmt);
15008 if(stmt->ifStmt.elseStmt)
15009 ProcessStatement(stmt->ifStmt.elseStmt);
15010 break;
15011 }
15012 case 5:
15013 {
15014 struct Type * oldSwitchType = curSwitchType;
15015
15016 if(stmt->switchStmt.exp)
15017 {
15018 struct Expression * exp;
15019
15020 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15021 {
15022 if(!exp->next)
15023 {
15024 ProcessExpressionType(exp);
15025 }
15026 if(!exp->next)
15027 curSwitchType = exp->expType;
15028 }
15029 }
15030 ProcessStatement(stmt->switchStmt.stmt);
15031 curSwitchType = oldSwitchType;
15032 break;
15033 }
15034 case 6:
15035 {
15036 if(stmt->whileStmt.exp)
15037 {
15038 struct Expression * exp;
15039
15040 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15041 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15042 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15043 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15044 {
15045 ProcessExpressionType(exp);
15046 }
15047 }
15048 if(stmt->whileStmt.stmt)
15049 ProcessStatement(stmt->whileStmt.stmt);
15050 break;
15051 }
15052 case 7:
15053 {
15054 if(stmt->doWhile.exp)
15055 {
15056 struct Expression * exp;
15057
15058 if((*stmt->doWhile.exp).last)
15059 {
15060 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15061 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15062 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15063 }
15064 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15065 {
15066 ProcessExpressionType(exp);
15067 }
15068 }
15069 if(stmt->doWhile.stmt)
15070 ProcessStatement(stmt->doWhile.stmt);
15071 break;
15072 }
15073 case 8:
15074 {
15075 struct Expression * exp;
15076
15077 if(stmt->forStmt.init)
15078 ProcessStatement(stmt->forStmt.init);
15079 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15080 {
15081 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15082 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15083 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15084 }
15085 if(stmt->forStmt.check)
15086 ProcessStatement(stmt->forStmt.check);
15087 if(stmt->forStmt.increment)
15088 {
15089 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15090 ProcessExpressionType(exp);
15091 }
15092 if(stmt->forStmt.stmt)
15093 ProcessStatement(stmt->forStmt.stmt);
15094 break;
15095 }
15096 case 18:
15097 {
15098 struct Identifier * id = stmt->forEachStmt.id;
15099 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15100 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15101 struct Statement * block = stmt->forEachStmt.stmt;
15102 char iteratorType[1024];
15103 struct Type * source;
15104 struct Expression * e;
15105 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));
15106 struct Expression * arrayExp;
15107 char * typeString = (((void *)0));
15108 int builtinCount = 0;
15109
15110 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15111 {
15112 if(!e->next)
15113 {
15114 FreeType(e->destType);
15115 e->destType = ProcessTypeString("Container", 0x0);
15116 }
15117 if(!isBuiltin || e->next)
15118 ProcessExpressionType(e);
15119 }
15120 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15121 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15122 {
15123 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15124 struct Symbol * symbol;
15125 struct Expression * expIt = (((void *)0));
15126 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15127 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15128 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15129 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15130
15131 stmt->type = 2;
15132 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15133 stmt->compound.context->parent = curContext;
15134 curContext = stmt->compound.context;
15135 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15136 {
15137 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15138 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15139
15140 isCustomAVLTree = 0x1;
15141 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15142 isAVLTree = 0x1;
15143 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15144 isMap = 0x1;
15145 }
15146 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15147 isArray = 0x1;
15148 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15149 {
15150 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15151
15152 isLinkList = 0x1;
15153 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15154 }
15155 if(isArray)
15156 {
15157 struct Declarator * decl;
15158 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15159
15160 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15161 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15162 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15163 }
15164 else if(isBuiltin)
15165 {
15166 struct Type * type = (((void *)0));
15167 char typeStringBuf[1024];
15168
15169 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15170 if(((struct Expression *)(*exp).last)->type == 11)
15171 {
15172 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15173
15174 if(typeName)
15175 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15176 }
15177 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)
15178 {
15179 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15180
15181 typeString = templateClass->templateArgs[2].dataTypeString;
15182 }
15183 else if(arrayExp->list)
15184 {
15185 struct Expression * e;
15186
15187 for(e = (*arrayExp->list).first; e; e = e->next)
15188 {
15189 ProcessExpressionType(e);
15190 if(e->expType)
15191 {
15192 if(!type)
15193 {
15194 type = e->expType;
15195 type->refCount++;
15196 }
15197 else
15198 {
15199 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15200 {
15201 FreeType(type);
15202 type = e->expType;
15203 e->expType = (((void *)0));
15204 e = (*arrayExp->list).first;
15205 ProcessExpressionType(e);
15206 if(e->expType)
15207 {
15208 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15209 {
15210 FreeType(e->expType);
15211 e->expType = (((void *)0));
15212 FreeType(type);
15213 type = (((void *)0));
15214 break;
15215 }
15216 }
15217 }
15218 }
15219 if(e->expType)
15220 {
15221 FreeType(e->expType);
15222 e->expType = (((void *)0));
15223 }
15224 }
15225 }
15226 if(type)
15227 {
15228 typeStringBuf[0] = '\0';
15229 PrintType(type, typeStringBuf, 0x0, 0x1);
15230 typeString = typeStringBuf;
15231 FreeType(type);
15232 }
15233 }
15234 if(typeString)
15235 {
15236 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15237 struct Declarator * decl;
15238 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15239
15240 if(arrayExp->list)
15241 {
15242 struct Expression * e;
15243
15244 builtinCount = (*arrayExp->list).count;
15245 type = ProcessTypeString(typeString, 0x0);
15246 while(e = (*arrayExp->list).first)
15247 {
15248 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15249 e->destType = type;
15250 type->refCount++;
15251 ProcessExpressionType(e);
15252 ListAdd(initializers, MkInitializerAssignment(e));
15253 }
15254 FreeType(type);
15255 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15256 }
15257 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15258 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15259 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15260 FreeList(exp, FreeExpression);
15261 }
15262 else
15263 {
15264 arrayExp->expType = ProcessTypeString("Container", 0x0);
15265 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15266 }
15267 }
15268 else if(isLinkList && !isList)
15269 {
15270 struct Declarator * decl;
15271 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15272
15273 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15274 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15275 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15276 }
15277 else if(_class->templateArgs)
15278 {
15279 if(isMap)
15280 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15281 else
15282 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15283 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15284 }
15285 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15286 if(block && block->type == 2 && block->compound.context)
15287 {
15288 block->compound.context->parent = stmt->compound.context;
15289 }
15290 if(filter)
15291 {
15292 block = MkIfStmt(filter, block, (((void *)0)));
15293 }
15294 if(isArray)
15295 {
15296 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));
15297 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15298 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15299 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15300 }
15301 else if(isBuiltin)
15302 {
15303 char count[128];
15304
15305 sprintf(count, "%d", builtinCount);
15306 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));
15307 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15308 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15309 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15310 }
15311 else if(isLinkList && !isList)
15312 {
15313 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15314 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15315
15316 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15317 {
15318 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));
15319 }
15320 else
15321 {
15322 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15323 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15324
15325 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));
15326 }
15327 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15328 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15329 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15330 }
15331 else
15332 {
15333 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15334 }
15335 ProcessExpressionType(expIt);
15336 if((*stmt->compound.declarations).first)
15337 ProcessDeclaration((*stmt->compound.declarations).first);
15338 if(symbol)
15339 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15340 ProcessStatement(stmt);
15341 curContext = stmt->compound.context->parent;
15342 break;
15343 }
15344 else
15345 {
15346 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15347 }
15348 break;
15349 }
15350 case 9:
15351 break;
15352 case 10:
15353 break;
15354 case 11:
15355 break;
15356 case 12:
15357 {
15358 struct Expression * exp;
15359
15360 if(stmt->expressions)
15361 {
15362 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15363 {
15364 if(!exp->next)
15365 {
15366 if(curFunction && !curFunction->type)
15367 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15368 FreeType(exp->destType);
15369 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15370 if(exp->destType)
15371 exp->destType->refCount++;
15372 }
15373 ProcessExpressionType(exp);
15374 }
15375 }
15376 break;
15377 }
15378 case 14:
15379 {
15380 ProcessDeclaration(stmt->decl);
15381 break;
15382 }
15383 case 13:
15384 {
15385 struct AsmField * field;
15386
15387 if(stmt->asmStmt.inputFields)
15388 {
15389 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15390 if(field->expression)
15391 ProcessExpressionType(field->expression);
15392 }
15393 if(stmt->asmStmt.outputFields)
15394 {
15395 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15396 if(field->expression)
15397 ProcessExpressionType(field->expression);
15398 }
15399 if(stmt->asmStmt.clobberedFields)
15400 {
15401 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15402 {
15403 if(field->expression)
15404 ProcessExpressionType(field->expression);
15405 }
15406 }
15407 break;
15408 }
15409 case 17:
15410 {
15411 struct PropertyWatch * propWatch;
15412 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15413 struct Expression * object = stmt->_watch.object;
15414 struct Expression * watcher = stmt->_watch.watcher;
15415
15416 if(watcher)
15417 ProcessExpressionType(watcher);
15418 if(object)
15419 ProcessExpressionType(object);
15420 if(inCompiler)
15421 {
15422 if(watcher || thisClass)
15423 {
15424 struct External * external = curExternal;
15425 struct Context * context = curContext;
15426
15427 stmt->type = 3;
15428 stmt->expressions = MkList();
15429 curExternal = external->prev;
15430 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15431 {
15432 struct ClassFunction * func;
15433 char watcherName[1024];
15434 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15435 struct External * createdExternal;
15436 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15437
15438 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15439 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15440 if(propWatch->deleteWatch)
15441 strcat(watcherName, "_delete");
15442 else
15443 {
15444 struct Identifier * propID;
15445
15446 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15447 {
15448 strcat(watcherName, "_");
15449 strcat(watcherName, propID->string);
15450 }
15451 }
15452 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15453 {
15454 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15455 ProcessClassFunctionBody(func, propWatch->compound);
15456 propWatch->compound = (((void *)0));
15457 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15458 createdExternal->symbol->idCode = external->symbol->idCode;
15459 curExternal = createdExternal;
15460 ProcessFunction(createdExternal->function);
15461 {
15462 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15463
15464 externalDecl->declaration = decl;
15465 if(decl->symbol && !decl->symbol->pointerExternal)
15466 decl->symbol->pointerExternal = externalDecl;
15467 }
15468 if(propWatch->deleteWatch)
15469 {
15470 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15471
15472 ListAdd(args, CopyExpression(object));
15473 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15474 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15475 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15476 }
15477 else
15478 {
15479 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15480 struct Identifier * propID;
15481
15482 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15483 {
15484 char propName[1024];
15485 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15486
15487 if(prop)
15488 {
15489 char getName[1024], setName[1024];
15490 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15491
15492 DeclareProperty(prop, setName, getName);
15493 strcpy(propName, "__ecereProp_");
15494 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15495 strcat(propName, "_");
15496 FullClassNameCat(propName, prop->name, 0x1);
15497 ListAdd(args, CopyExpression(object));
15498 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15499 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15500 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15501 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15502 }
15503 else
15504 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15505 }
15506 }
15507 }
15508 else
15509 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15510 }
15511 curExternal = external;
15512 curContext = context;
15513 if(watcher)
15514 FreeExpression(watcher);
15515 if(object)
15516 FreeExpression(object);
15517 FreeList(watches, FreePropertyWatch);
15518 }
15519 else
15520 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15521 }
15522 else
15523 {
15524 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15525 {
15526 ProcessStatement(propWatch->compound);
15527 }
15528 }
15529 break;
15530 }
15531 case 15:
15532 {
15533 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15534 struct Expression * object = stmt->_watch.object;
15535 struct __ecereNameSpace__ecere__com__Class * _class;
15536
15537 if(object)
15538 ProcessExpressionType(object);
15539 if(inCompiler)
15540 {
15541 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15542 if(_class)
15543 {
15544 struct Identifier * propID;
15545
15546 stmt->type = 3;
15547 stmt->expressions = MkList();
15548 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15549 {
15550 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15551 }
15552 else if(!watches)
15553 {
15554 }
15555 if(watches)
15556 {
15557 for(propID = (*watches).first; propID; propID = propID->next)
15558 {
15559 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15560
15561 if(prop)
15562 {
15563 CreateFireWatcher(prop, object, stmt);
15564 }
15565 else
15566 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15567 }
15568 }
15569 else
15570 {
15571 struct __ecereNameSpace__ecere__com__Property * prop;
15572 struct __ecereNameSpace__ecere__com__Class * base;
15573
15574 for(base = _class; base; base = base->base)
15575 {
15576 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15577 {
15578 if(prop->isProperty && prop->isWatchable)
15579 {
15580 CreateFireWatcher(prop, object, stmt);
15581 }
15582 }
15583 }
15584 }
15585 if(object)
15586 FreeExpression(object);
15587 FreeList(watches, FreeIdentifier);
15588 }
15589 else
15590 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15591 }
15592 break;
15593 }
15594 case 16:
15595 {
15596 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15597 struct Expression * object = stmt->_watch.object;
15598 struct Expression * watcher = stmt->_watch.watcher;
15599 struct __ecereNameSpace__ecere__com__Class * _class;
15600
15601 if(object)
15602 ProcessExpressionType(object);
15603 if(watcher)
15604 ProcessExpressionType(watcher);
15605 if(inCompiler)
15606 {
15607 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15608 if(watcher || thisClass)
15609 {
15610 if(_class)
15611 {
15612 struct Identifier * propID;
15613
15614 stmt->type = 3;
15615 stmt->expressions = MkList();
15616 if(!watches)
15617 {
15618 struct __ecereNameSpace__ecere__sys__OldList * args;
15619
15620 args = MkList();
15621 ListAdd(args, CopyExpression(object));
15622 ListAdd(args, MkExpConstant("0"));
15623 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15624 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15625 }
15626 else
15627 {
15628 for(propID = (*watches).first; propID; propID = propID->next)
15629 {
15630 char propName[1024];
15631 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15632
15633 if(prop)
15634 {
15635 char getName[1024], setName[1024];
15636 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15637
15638 DeclareProperty(prop, setName, getName);
15639 strcpy(propName, "__ecereProp_");
15640 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15641 strcat(propName, "_");
15642 FullClassNameCat(propName, prop->name, 0x1);
15643 MangleClassName(propName);
15644 ListAdd(args, CopyExpression(object));
15645 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15646 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15647 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15648 }
15649 else
15650 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15651 }
15652 }
15653 if(object)
15654 FreeExpression(object);
15655 if(watcher)
15656 FreeExpression(watcher);
15657 FreeList(watches, FreeIdentifier);
15658 }
15659 else
15660 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15661 }
15662 else
15663 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
15664 }
15665 break;
15666 }
15667 }
15668 }
15669
15670 extern struct Expression * QBrackets(struct Expression * exp);
15671
15672 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15673
15674 extern struct Declarator * QMkPtrDecl(char *  id);
15675
15676 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15677
15678 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15679
15680 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15681
15682 static void ProcessFunction(struct FunctionDefinition * function)
15683 {
15684 void * __ecereTemp2;
15685 void * __ecereTemp1;
15686 struct Identifier * id = GetDeclId(function->declarator);
15687 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15688 struct Type * type = symbol ? symbol->type : (((void *)0));
15689 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15690 struct Context * oldTopContext = topContext;
15691
15692 yylloc = function->loc;
15693 if(type && type->thisClass)
15694 {
15695 struct Symbol * classSym = type->thisClass;
15696 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15697 char className[1024];
15698 char structName[1024];
15699 struct Declarator * funcDecl;
15700 struct Symbol * thisSymbol;
15701 unsigned int typedObject = 0x0;
15702
15703 if(_class && !_class->base)
15704 {
15705 _class = currentClass;
15706 if(_class && !_class->symbol)
15707 _class->symbol = FindClass(_class->fullName);
15708 classSym = _class ? _class->symbol : (((void *)0));
15709 typedObject = 0x1;
15710 }
15711 thisClass = _class;
15712 if(inCompiler && _class)
15713 {
15714 if(type->kind == 11)
15715 {
15716 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15717 {
15718 struct Type * param = symbol->type->params.first;
15719
15720 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15721 FreeType(param);
15722 }
15723 if(type->classObjectType != 1)
15724 {
15725 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15726 symbol->type->staticMethod = 0x1;
15727 symbol->type->thisClass = (((void *)0));
15728 symbol->type->extraParam = 0x0;
15729 }
15730 }
15731 strcpy(className, "__ecereClass_");
15732 FullClassNameCat(className, _class->fullName, 0x1);
15733 MangleClassName(className);
15734 structName[0] = (char)0;
15735 FullClassNameCat(structName, _class->fullName, 0x0);
15736 funcDecl = GetFuncDecl(function->declarator);
15737 if(funcDecl)
15738 {
15739 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15740 {
15741 struct TypeName * param = (*funcDecl->function.parameters).first;
15742
15743 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15744 {
15745 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15746 FreeTypeName(param);
15747 }
15748 }
15749 if(!function->propertyNoThis)
15750 {
15751 struct TypeName * thisParam;
15752
15753 if(type->classObjectType != 1)
15754 {
15755 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15756 if(!funcDecl->function.parameters)
15757 funcDecl->function.parameters = MkList();
15758 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15759 }
15760 if(typedObject)
15761 {
15762 if(type->classObjectType != 1)
15763 {
15764 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
15765 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
15766 }
15767 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));
15768 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15769 }
15770 }
15771 }
15772 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15773 {
15774 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15775
15776 funcDecl = GetFuncDecl(initDecl->declarator);
15777 if(funcDecl)
15778 {
15779 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15780 {
15781 struct TypeName * param = (*funcDecl->function.parameters).first;
15782
15783 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
15784 {
15785 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15786 FreeTypeName(param);
15787 }
15788 }
15789 if(type->classObjectType != 1)
15790 {
15791 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
15792 {
15793 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15794
15795 if(!funcDecl->function.parameters)
15796 funcDecl->function.parameters = MkList();
15797 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15798 }
15799 }
15800 }
15801 }
15802 }
15803 if(function->body)
15804 {
15805 if(type->classObjectType != 1)
15806 {
15807 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));
15808 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15809 if(typedObject && thisSymbol->type)
15810 {
15811 thisSymbol->type->classObjectType = 2;
15812 thisSymbol->type->byReference = type->byReference;
15813 }
15814 }
15815 }
15816 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
15817 {
15818 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15819
15820 {
15821 struct __ecereNameSpace__ecere__com__Class * base;
15822
15823 for(base = _class; base && base->type != 1000; base = base->next)
15824 {
15825 for(member = base->membersAndProperties.first; member; member = member->next)
15826 if(!member->isProperty)
15827 break;
15828 if(member)
15829 break;
15830 }
15831 }
15832 for(member = _class->membersAndProperties.first; member; member = member->next)
15833 if(!member->isProperty)
15834 break;
15835 if(member)
15836 {
15837 char pointerName[1024];
15838 struct Declaration * decl;
15839 struct Initializer * initializer;
15840 struct Expression * exp, * bytePtr;
15841
15842 strcpy(pointerName, "__ecerePointer_");
15843 FullClassNameCat(pointerName, _class->fullName, 0x0);
15844 {
15845 char className[1024];
15846
15847 strcpy(className, "__ecereClass_");
15848 FullClassNameCat(className, classSym->string, 0x1);
15849 MangleClassName(className);
15850 DeclareClass(classSym, className);
15851 }
15852 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
15853 if(_class->fixed)
15854 {
15855 char string[256];
15856
15857 sprintf(string, "%d", _class->offset);
15858 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
15859 }
15860 else
15861 {
15862 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
15863 }
15864 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
15865 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));
15866 if(function->body)
15867 {
15868 yylloc = function->body->loc;
15869 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
15870 {
15871 struct Context * prevContext = curContext;
15872
15873 curContext = function->body->compound.context;
15874 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
15875 curContext = prevContext;
15876 }
15877 decl->symbol = (((void *)0));
15878 if(!function->body->compound.declarations)
15879 function->body->compound.declarations = MkList();
15880 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
15881 }
15882 }
15883 }
15884 }
15885 else
15886 thisClass = (((void *)0));
15887 if(id)
15888 {
15889 FreeSpecifier(id->_class);
15890 id->_class = (((void *)0));
15891 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15892 {
15893 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15894
15895 id = GetDeclId(initDecl->declarator);
15896 FreeSpecifier(id->_class);
15897 id->_class = (((void *)0));
15898 }
15899 }
15900 if(function->body)
15901 topContext = function->body->compound.context;
15902 {
15903 struct FunctionDefinition * oldFunction = curFunction;
15904
15905 curFunction = function;
15906 if(function->body)
15907 ProcessStatement(function->body);
15908 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
15909 {
15910 struct Statement * prevCompound = curCompound;
15911 struct Context * prevContext = curContext;
15912 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
15913
15914 if(!function->body->compound.statements)
15915 function->body->compound.statements = MkList();
15916 ListAdd(function->body->compound.statements, fireWatchers);
15917 curCompound = function->body;
15918 curContext = function->body->compound.context;
15919 ProcessStatement(fireWatchers);
15920 curContext = prevContext;
15921 curCompound = prevCompound;
15922 }
15923 curFunction = oldFunction;
15924 }
15925 if(function->declarator)
15926 {
15927 ProcessDeclarator(function->declarator);
15928 }
15929 topContext = oldTopContext;
15930 thisClass = oldThisClass;
15931 }
15932
15933 extern void FreeSymbol(struct Symbol * symbol);
15934
15935 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
15936
15937 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
15938 {
15939 struct ClassDef * def;
15940 struct External * external = curExternal;
15941 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
15942
15943 for(def = definitions->first; def; def = def->next)
15944 {
15945 if(def->type == 0)
15946 {
15947 if(def->function->declarator)
15948 curExternal = def->function->declarator->symbol->pointerExternal;
15949 else
15950 curExternal = external;
15951 ProcessFunction((struct FunctionDefinition *)def->function);
15952 }
15953 else if(def->type == 2)
15954 {
15955 if(def->decl->type == 2)
15956 {
15957 thisClass = regClass;
15958 ProcessInstantiationType(def->decl->inst);
15959 thisClass = (((void *)0));
15960 }
15961 else
15962 {
15963 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
15964
15965 if(regClass)
15966 thisClass = regClass;
15967 ProcessDeclaration(def->decl);
15968 thisClass = backThisClass;
15969 }
15970 }
15971 else if(def->type == 1 && def->defProperties)
15972 {
15973 struct MemberInit * defProperty;
15974 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);
15975
15976 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15977 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
15978 {
15979 thisClass = regClass;
15980 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
15981 thisClass = (((void *)0));
15982 }
15983 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15984 FreeSymbol(thisSymbol);
15985 }
15986 else if(def->type == 3 && def->propertyDef)
15987 {
15988 struct PropertyDef * prop = def->propertyDef;
15989
15990 thisClass = regClass;
15991 if(prop->setStmt)
15992 {
15993 if(regClass)
15994 {
15995 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15996
15997 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15998 }
15999 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16000 ProcessStatement(prop->setStmt);
16001 }
16002 if(prop->getStmt)
16003 {
16004 if(regClass)
16005 {
16006 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16007
16008 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16009 }
16010 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16011 ProcessStatement(prop->getStmt);
16012 }
16013 if(prop->issetStmt)
16014 {
16015 if(regClass)
16016 {
16017 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16018
16019 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16020 }
16021 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16022 ProcessStatement(prop->issetStmt);
16023 }
16024 thisClass = (((void *)0));
16025 }
16026 else if(def->type == 4 && def->propertyWatch)
16027 {
16028 struct PropertyWatch * propertyWatch = def->propertyWatch;
16029
16030 thisClass = regClass;
16031 if(propertyWatch->compound)
16032 {
16033 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);
16034
16035 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16036 curExternal = (((void *)0));
16037 ProcessStatement(propertyWatch->compound);
16038 }
16039 thisClass = (((void *)0));
16040 }
16041 }
16042 }
16043
16044 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16045
16046 void ComputeDataTypes()
16047 {
16048 void * __ecereTemp1;
16049 struct External * external;
16050 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16051
16052 currentClass = (((void *)0));
16053 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16054 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16055 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
16056 curExternal = temp;
16057 DeclareStruct("ecere::com::Class", 0x0);
16058 DeclareStruct("ecere::com::Instance", 0x0);
16059 DeclareStruct("ecere::com::Property", 0x0);
16060 DeclareStruct("ecere::com::DataMember", 0x0);
16061 DeclareStruct("ecere::com::Method", 0x0);
16062 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16063 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16064 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16065 for(external = (*ast).first; external; external = external->next)
16066 {
16067 afterExternal = curExternal = external;
16068 if(external->type == 0)
16069 {
16070 currentClass = external->function->_class;
16071 ProcessFunction(external->function);
16072 }
16073 else if(external->type == 1)
16074 {
16075 currentClass = (((void *)0));
16076 ProcessDeclaration(external->declaration);
16077 }
16078 else if(external->type == 2)
16079 {
16080 struct ClassDefinition * _class = external->_class;
16081
16082 currentClass = external->symbol->registered;
16083 if(_class->definitions)
16084 {
16085 ProcessClass(_class->definitions, _class->symbol);
16086 }
16087 if(inCompiler)
16088 {
16089 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16090 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16091 }
16092 }
16093 else if(external->type == 4)
16094 {
16095 thisNameSpace = external->id->string;
16096 }
16097 }
16098 currentClass = (((void *)0));
16099 thisNameSpace = (((void *)0));
16100 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16101 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16102 }
16103
16104 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);
16105
16106 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);
16107
16108 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16109 {
16110 struct __ecereNameSpace__ecere__com__Class * class;
16111
16112 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16113 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16114 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16115 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16116 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoi64", "int64 _strtoi64(char * string, char * * endString, int base)", _strtoi64, module, 2);
16117 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoui64", "uint64 _strtoui64(char * string, char * * endString, int base)", _strtoui64, module, 2);
16118 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16119 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16120 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16121 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16122 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16123 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16124 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16125 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16126 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16127 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16128 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16129 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16130 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16131 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16132 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16133 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16134 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16135 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16136 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16137 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16138 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16139 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16140 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16141 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16142 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16143 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16144 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16145 __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);
16146 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16147 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16148 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16149 __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);
16150 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16151 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16152 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16153 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16154 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16155 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16156 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16157 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16158 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16159 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16160 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16161 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16162 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16163 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16164 __ecereClass_Conversion = class;
16165 __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);
16166 __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);
16167 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16168 __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);
16169 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16170 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16171 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16172 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16173 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16174 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16175 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16176 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16177 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16178 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16179 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16180 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16181 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16182 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16183 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16184 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16185 }
16186
16187 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16188 {
16189
16190 }
16191