ecere: Fixed up i18n Support; Started Chinese translation integration
[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 };
148
149 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
150
151 struct Instantiation
152 {
153 struct Instantiation * prev;
154 struct Instantiation * next;
155 struct Location loc;
156 struct Specifier * _class;
157 struct Expression * exp;
158 struct __ecereNameSpace__ecere__sys__OldList *  members;
159 struct Symbol * symbol;
160 unsigned int fullSet;
161 unsigned int isConstant;
162 unsigned char *  data;
163 struct Location nameLoc;
164 struct Location insideLoc;
165 unsigned int built;
166 };
167
168 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
169
170 struct Declaration
171 {
172 struct Declaration * prev;
173 struct Declaration * next;
174 struct Location loc;
175 int type;
176 union
177 {
178 struct
179 {
180 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
181 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
182 };
183 struct Instantiation * inst;
184 struct
185 {
186 struct Identifier * id;
187 struct Expression * exp;
188 };
189 };
190 struct Specifier * extStorage;
191 struct Symbol * symbol;
192 int declMode;
193 };
194
195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
196
197 struct Statement
198 {
199 struct Statement * prev;
200 struct Statement * next;
201 struct Location loc;
202 int type;
203 union
204 {
205 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
206 struct
207 {
208 struct Identifier * id;
209 struct Statement * stmt;
210 } labeled;
211 struct
212 {
213 struct Expression * exp;
214 struct Statement * stmt;
215 } caseStmt;
216 struct
217 {
218 struct __ecereNameSpace__ecere__sys__OldList * declarations;
219 struct __ecereNameSpace__ecere__sys__OldList * statements;
220 struct Context * context;
221 unsigned int isSwitch;
222 } compound;
223 struct
224 {
225 struct __ecereNameSpace__ecere__sys__OldList * exp;
226 struct Statement * stmt;
227 struct Statement * elseStmt;
228 } ifStmt;
229 struct
230 {
231 struct __ecereNameSpace__ecere__sys__OldList * exp;
232 struct Statement * stmt;
233 } switchStmt;
234 struct
235 {
236 struct __ecereNameSpace__ecere__sys__OldList * exp;
237 struct Statement * stmt;
238 } whileStmt;
239 struct
240 {
241 struct __ecereNameSpace__ecere__sys__OldList * exp;
242 struct Statement * stmt;
243 } doWhile;
244 struct
245 {
246 struct Statement * init;
247 struct Statement * check;
248 struct __ecereNameSpace__ecere__sys__OldList * increment;
249 struct Statement * stmt;
250 } forStmt;
251 struct
252 {
253 struct Identifier * id;
254 } gotoStmt;
255 struct
256 {
257 struct Specifier * spec;
258 char * statements;
259 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
260 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
261 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
262 } asmStmt;
263 struct
264 {
265 struct Expression * watcher;
266 struct Expression * object;
267 struct __ecereNameSpace__ecere__sys__OldList * watches;
268 } _watch;
269 struct
270 {
271 struct Identifier * id;
272 struct __ecereNameSpace__ecere__sys__OldList * exp;
273 struct __ecereNameSpace__ecere__sys__OldList * filter;
274 struct Statement * stmt;
275 } forEachStmt;
276 struct Declaration * decl;
277 };
278 };
279
280 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
281
282 struct TypeName
283 {
284 struct TypeName * prev;
285 struct TypeName * next;
286 struct Location loc;
287 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
288 struct Declarator * declarator;
289 int classObjectType;
290 struct Expression * bitCount;
291 };
292
293 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
294
295 struct Initializer
296 {
297 struct Initializer * prev;
298 struct Initializer * next;
299 struct Location loc;
300 int type;
301 union
302 {
303 struct Expression * exp;
304 struct __ecereNameSpace__ecere__sys__OldList *  list;
305 };
306 unsigned int isConstant;
307 };
308
309 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
310
311 struct __ecereNameSpace__ecere__com__DataValue
312 {
313 union
314 {
315 char c;
316 unsigned char uc;
317 short s;
318 unsigned short us;
319 int i;
320 unsigned int ui;
321 void *  p;
322 float f;
323 double d;
324 long long i64;
325 uint64 ui64;
326 };
327 };
328
329 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
330
331 struct Expression
332 {
333 struct Expression * prev;
334 struct Expression * next;
335 struct Location loc;
336 int type;
337 union
338 {
339 struct
340 {
341 char *  constant;
342 struct Identifier * identifier;
343 };
344 struct Statement * compound;
345 struct Instantiation * instance;
346 char *  string;
347 struct __ecereNameSpace__ecere__sys__OldList *  list;
348 struct
349 {
350 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
351 struct Declarator * decl;
352 } _classExp;
353 struct
354 {
355 struct Identifier * id;
356 } classData;
357 struct
358 {
359 struct Expression * exp;
360 struct __ecereNameSpace__ecere__sys__OldList * arguments;
361 struct Location argLoc;
362 } call;
363 struct
364 {
365 struct Expression * exp;
366 struct __ecereNameSpace__ecere__sys__OldList * index;
367 } index;
368 struct
369 {
370 struct Expression * exp;
371 struct Identifier * member;
372 int memberType;
373 unsigned int thisPtr;
374 } member;
375 struct
376 {
377 int op;
378 struct Expression * exp1;
379 struct Expression * exp2;
380 } op;
381 struct TypeName * typeName;
382 struct Specifier * _class;
383 struct
384 {
385 struct TypeName * typeName;
386 struct Expression * exp;
387 } cast;
388 struct
389 {
390 struct Expression * cond;
391 struct __ecereNameSpace__ecere__sys__OldList * exp;
392 struct Expression * elseExp;
393 } cond;
394 struct
395 {
396 struct TypeName * typeName;
397 struct Expression * size;
398 } _new;
399 struct
400 {
401 struct TypeName * typeName;
402 struct Expression * size;
403 struct Expression * exp;
404 } _renew;
405 struct
406 {
407 char * table;
408 struct Identifier * id;
409 } db;
410 struct
411 {
412 struct Expression * ds;
413 struct Expression * name;
414 } dbopen;
415 struct
416 {
417 struct TypeName * typeName;
418 struct Initializer * initializer;
419 } initializer;
420 struct
421 {
422 struct Expression * exp;
423 struct TypeName * typeName;
424 } vaArg;
425 };
426 unsigned int debugValue;
427 struct __ecereNameSpace__ecere__com__DataValue val;
428 unsigned int address;
429 unsigned int hasAddress;
430 struct Type * expType;
431 struct Type * destType;
432 unsigned int usage;
433 int tempCount;
434 unsigned int byReference;
435 unsigned int isConstant;
436 unsigned int addedThis;
437 unsigned int needCast;
438 unsigned int thisPtr;
439 };
440
441 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
442
443 struct TemplateDatatype
444 {
445 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
446 struct Declarator * decl;
447 };
448
449 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
450
451 struct TemplateArgument;
452
453 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
454
455 struct TemplateParameter
456 {
457 struct TemplateParameter * prev;
458 struct TemplateParameter * next;
459 struct Location loc;
460 int type;
461 struct Identifier * identifier;
462 union
463 {
464 struct TemplateDatatype * dataType;
465 int memberType;
466 };
467 struct TemplateArgument * defaultArgument;
468 char *  dataTypeString;
469 struct Type * baseType;
470 };
471
472 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
473
474 struct Specifier
475 {
476 struct Specifier * prev;
477 struct Specifier * next;
478 struct Location loc;
479 int type;
480 union
481 {
482 int specifier;
483 struct
484 {
485 char *  name;
486 struct Symbol * symbol;
487 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
488 };
489 struct
490 {
491 struct Identifier * id;
492 struct __ecereNameSpace__ecere__sys__OldList *  list;
493 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
494 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
495 unsigned int addNameSpace;
496 struct Context * ctx;
497 };
498 struct Expression * expression;
499 struct Specifier * _class;
500 struct TemplateParameter * templateParameter;
501 };
502 };
503
504 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
505
506 struct Identifier
507 {
508 struct Identifier * prev;
509 struct Identifier * next;
510 struct Location loc;
511 struct Symbol * classSym;
512 struct Specifier * _class;
513 char *  string;
514 struct Identifier * badID;
515 };
516
517 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
518
519 struct Pointer;
520
521 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
522
523 struct Declarator
524 {
525 struct Declarator * prev;
526 struct Declarator * next;
527 struct Location loc;
528 int type;
529 struct Symbol * symbol;
530 struct Declarator * declarator;
531 union
532 {
533 struct Identifier * identifier;
534 struct
535 {
536 struct Expression * exp;
537 struct Expression * posExp;
538 char * attrib;
539 } structDecl;
540 struct
541 {
542 struct Expression * exp;
543 struct Specifier * enumClass;
544 } array;
545 struct
546 {
547 struct __ecereNameSpace__ecere__sys__OldList * parameters;
548 } function;
549 struct
550 {
551 struct Pointer * pointer;
552 } pointer;
553 struct
554 {
555 char * extended;
556 } extended;
557 };
558 };
559
560 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
561
562 struct FunctionDefinition
563 {
564 struct FunctionDefinition * prev;
565 struct FunctionDefinition * next;
566 struct Location loc;
567 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
568 struct Declarator * declarator;
569 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
570 struct Statement * body;
571 struct __ecereNameSpace__ecere__com__Class * _class;
572 struct __ecereNameSpace__ecere__sys__OldList attached;
573 int declMode;
574 struct Type * type;
575 struct Symbol * propSet;
576 int tempCount;
577 unsigned int propertyNoThis;
578 };
579
580 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
581
582 struct DBTableDef;
583
584 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
585
586 struct External
587 {
588 struct External * prev;
589 struct External * next;
590 struct Location loc;
591 int type;
592 struct Symbol * symbol;
593 union
594 {
595 struct FunctionDefinition * function;
596 struct ClassDefinition * _class;
597 struct Declaration * declaration;
598 char *  importString;
599 struct Identifier * id;
600 struct DBTableDef * table;
601 };
602 int importType;
603 };
604
605 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
606
607 struct ModuleImport
608 {
609 struct ModuleImport * prev;
610 struct ModuleImport * next;
611 char *  name;
612 struct __ecereNameSpace__ecere__sys__OldList classes;
613 struct __ecereNameSpace__ecere__sys__OldList functions;
614 int importType;
615 int importAccess;
616 };
617
618 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
619
620 struct ClassImport
621 {
622 struct ClassImport * prev;
623 struct ClassImport * next;
624 char *  name;
625 struct __ecereNameSpace__ecere__sys__OldList methods;
626 struct __ecereNameSpace__ecere__sys__OldList properties;
627 unsigned int itself;
628 unsigned int isRemote;
629 };
630
631 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
632
633 struct Symbol
634 {
635 char *  string;
636 struct Symbol * parent;
637 struct Symbol * left;
638 struct Symbol * right;
639 int depth;
640 struct Type * type;
641 union
642 {
643 struct __ecereNameSpace__ecere__com__Method * method;
644 struct __ecereNameSpace__ecere__com__Property * _property;
645 struct __ecereNameSpace__ecere__com__Class * registered;
646 };
647 int id;
648 int idCode;
649 union
650 {
651 struct
652 {
653 struct External * pointerExternal;
654 struct External * structExternal;
655 };
656 struct
657 {
658 struct External * externalGet;
659 struct External * externalSet;
660 struct External * externalPtr;
661 struct External * externalIsSet;
662 };
663 struct
664 {
665 struct External * methodExternal;
666 struct External * methodCodeExternal;
667 };
668 };
669 unsigned int imported;
670 unsigned int declaredStructSym;
671 struct __ecereNameSpace__ecere__com__Class * _class;
672 unsigned int declaredStruct;
673 unsigned int needConstructor;
674 unsigned int needDestructor;
675 char *  constructorName;
676 char *  structName;
677 char *  className;
678 char *  destructorName;
679 struct ModuleImport * module;
680 struct ClassImport * _import;
681 struct Location nameLoc;
682 unsigned int isParam;
683 unsigned int isRemote;
684 unsigned int isStruct;
685 unsigned int fireWatchersDone;
686 int declaring;
687 unsigned int classData;
688 unsigned int isStatic;
689 char *  shortName;
690 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
691 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
692 struct Context * ctx;
693 int isIterator;
694 };
695
696 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
697
698 struct Type
699 {
700 struct Type * prev;
701 struct Type * next;
702 int refCount;
703 union
704 {
705 struct Symbol * _class;
706 struct
707 {
708 struct __ecereNameSpace__ecere__sys__OldList members;
709 char *  enumName;
710 };
711 struct
712 {
713 struct Type * returnType;
714 struct __ecereNameSpace__ecere__sys__OldList params;
715 struct Symbol * thisClass;
716 unsigned int staticMethod;
717 struct TemplateParameter * thisClassTemplate;
718 };
719 struct
720 {
721 struct __ecereNameSpace__ecere__com__Method * method;
722 struct __ecereNameSpace__ecere__com__Class * methodClass;
723 struct __ecereNameSpace__ecere__com__Class * usedClass;
724 };
725 struct
726 {
727 struct Type * arrayType;
728 int arraySize;
729 struct Expression * arraySizeExp;
730 unsigned int freeExp;
731 struct Symbol * enumClass;
732 };
733 struct Type * type;
734 struct TemplateParameter * templateParameter;
735 };
736 unsigned int isSigned;
737 int kind;
738 unsigned int constant;
739 unsigned int size;
740 char *  name;
741 char *  typeName;
742 unsigned int count;
743 unsigned int truth;
744 int classObjectType;
745 unsigned int byReference;
746 unsigned int extraParam;
747 int alignment;
748 unsigned int directClassAccess;
749 unsigned int computing;
750 unsigned int dllExport;
751 unsigned int offset;
752 unsigned int keepCast;
753 unsigned int passAsTemplate;
754 int bitFieldCount;
755 };
756
757 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
758
759 struct __ecereNameSpace__ecere__com__Class
760 {
761 struct __ecereNameSpace__ecere__com__Class * prev;
762 struct __ecereNameSpace__ecere__com__Class * next;
763 char *  name;
764 int offset;
765 int structSize;
766 int (* *  _vTbl)();
767 int vTblSize;
768 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
769 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
770 int offsetClass;
771 int sizeClass;
772 struct __ecereNameSpace__ecere__com__Class * base;
773 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
774 struct __ecereNameSpace__ecere__sys__BinaryTree members;
775 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
776 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
777 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
778 struct __ecereNameSpace__ecere__sys__OldList derivatives;
779 int memberID;
780 int startMemberID;
781 int type;
782 struct __ecereNameSpace__ecere__com__Instance * module;
783 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
784 char *  dataTypeString;
785 struct Type * dataType;
786 int typeSize;
787 int defaultAlignment;
788 void (*  Initialize)();
789 int memberOffset;
790 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
791 char *  designerClass;
792 unsigned int noExpansion;
793 char *  defaultProperty;
794 unsigned int comRedefinition;
795 int count;
796 unsigned int isRemote;
797 unsigned int internalDecl;
798 void *  data;
799 unsigned int computeSize;
800 int structAlignment;
801 int destructionWatchOffset;
802 unsigned int fixed;
803 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
804 int inheritanceAccess;
805 char *  fullName;
806 void *  symbol;
807 struct __ecereNameSpace__ecere__sys__OldList conversions;
808 struct __ecereNameSpace__ecere__sys__OldList templateParams;
809 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
810 struct __ecereNameSpace__ecere__com__Class * templateClass;
811 struct __ecereNameSpace__ecere__sys__OldList templatized;
812 int numParams;
813 };
814
815 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
816
817 struct __ecereNameSpace__ecere__com__Instance
818 {
819 int (* *  _vTbl)();
820 struct __ecereNameSpace__ecere__com__Class * _class;
821 int _refCount;
822 };
823
824 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
825
826 struct __ecereNameSpace__ecere__com__DataMember
827 {
828 struct __ecereNameSpace__ecere__com__DataMember * prev;
829 struct __ecereNameSpace__ecere__com__DataMember * next;
830 char *  name;
831 unsigned int isProperty;
832 int memberAccess;
833 int id;
834 struct __ecereNameSpace__ecere__com__Class * _class;
835 char *  dataTypeString;
836 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
837 struct Type * dataType;
838 int type;
839 int offset;
840 int memberID;
841 struct __ecereNameSpace__ecere__sys__OldList members;
842 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
843 int memberOffset;
844 int structAlignment;
845 };
846
847 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
848
849 struct __ecereNameSpace__ecere__com__SerialBuffer
850 {
851 unsigned char *  _buffer;
852 unsigned int count;
853 unsigned int _size;
854 unsigned int pos;
855 };
856
857 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
858
859 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
860 {
861 union
862 {
863 struct
864 {
865 char *  dataTypeString;
866 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
867 };
868 struct __ecereNameSpace__ecere__com__DataValue expression;
869 struct
870 {
871 char *  memberString;
872 union
873 {
874 struct __ecereNameSpace__ecere__com__DataMember * member;
875 struct __ecereNameSpace__ecere__com__Property * prop;
876 struct __ecereNameSpace__ecere__com__Method * method;
877 };
878 };
879 };
880 };
881
882 typedef unsigned int size_t;
883
884 void exit(int status);
885
886 void * calloc(size_t nmemb, size_t size);
887
888 void free(void * ptr);
889
890 void * malloc(size_t size);
891
892 void * realloc(void * ptr, size_t size);
893
894 long int strtol(const char * nptr, char ** endptr, int base);
895
896 long long int strtoll(const char * nptr, char ** endptr, int base);
897
898 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
899
900 typedef union YYSTYPE
901 {
902 int specifierType;
903 int i;
904 int declMode;
905 struct Identifier * id;
906 struct Expression * exp;
907 struct Specifier * specifier;
908 struct __ecereNameSpace__ecere__sys__OldList * list;
909 struct Enumerator * enumerator;
910 struct Declarator * declarator;
911 struct Pointer * pointer;
912 struct Initializer * initializer;
913 struct InitDeclarator * initDeclarator;
914 struct TypeName * typeName;
915 struct Declaration * declaration;
916 struct Statement * stmt;
917 struct FunctionDefinition * function;
918 struct External * external;
919 struct Context * context;
920 struct AsmField * asmField;
921 struct Instantiation * instance;
922 struct MembersInit * membersInit;
923 struct MemberInit * memberInit;
924 struct ClassFunction * classFunction;
925 struct ClassDefinition * _class;
926 struct ClassDef * classDef;
927 struct PropertyDef * prop;
928 char * string;
929 struct Symbol * symbol;
930 struct PropertyWatch * propertyWatch;
931 struct TemplateParameter * templateParameter;
932 struct TemplateArgument * templateArgument;
933 struct TemplateDatatype * templateDatatype;
934 struct DBTableEntry * dbtableEntry;
935 struct DBIndexItem * dbindexItem;
936 struct DBTableDef * dbtableDef;
937 } YYSTYPE;
938
939 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
940
941 struct Enumerator
942 {
943 struct Enumerator * prev;
944 struct Enumerator * next;
945 struct Location loc;
946 struct Identifier * id;
947 struct Expression * exp;
948 };
949
950 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
951
952 struct InitDeclarator
953 {
954 struct InitDeclarator * prev;
955 struct InitDeclarator * next;
956 struct Location loc;
957 struct Declarator * declarator;
958 struct Initializer * initializer;
959 };
960
961 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
962
963 struct AsmField
964 {
965 struct AsmField * prev;
966 struct AsmField * next;
967 struct Location loc;
968 char *  command;
969 struct Expression * expression;
970 };
971
972 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
973
974 struct ClassFunction
975 {
976 struct ClassFunction * prev;
977 struct ClassFunction * next;
978 struct Location loc;
979 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
980 struct Declarator * declarator;
981 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
982 struct Statement * body;
983 struct __ecereNameSpace__ecere__com__Class * _class;
984 struct __ecereNameSpace__ecere__sys__OldList attached;
985 int declMode;
986 struct Type * type;
987 struct Symbol * propSet;
988 unsigned int isVirtual;
989 unsigned int isConstructor;
990 unsigned int isDestructor;
991 unsigned int dontMangle;
992 int id;
993 int idCode;
994 };
995
996 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
997
998 struct MembersInit
999 {
1000 struct MembersInit * prev;
1001 struct MembersInit * next;
1002 struct Location loc;
1003 int type;
1004 union
1005 {
1006 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1007 struct ClassFunction * function;
1008 };
1009 };
1010
1011 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1012
1013 struct MemberInit
1014 {
1015 struct MemberInit * prev;
1016 struct MemberInit * next;
1017 struct Location loc;
1018 struct Location realLoc;
1019 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1020 struct Initializer * initializer;
1021 unsigned int used;
1022 unsigned int variable;
1023 unsigned int takeOutExp;
1024 };
1025
1026 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1027
1028 struct PropertyDef
1029 {
1030 struct PropertyDef * prev;
1031 struct PropertyDef * next;
1032 struct Location loc;
1033 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1034 struct Declarator * declarator;
1035 struct Identifier * id;
1036 struct Statement * getStmt;
1037 struct Statement * setStmt;
1038 struct Statement * issetStmt;
1039 struct Symbol * symbol;
1040 unsigned int conversion;
1041 unsigned int isWatchable;
1042 char *  category;
1043 };
1044
1045 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1046
1047 struct PropertyWatch
1048 {
1049 struct PropertyWatch * prev;
1050 struct PropertyWatch * next;
1051 struct Location loc;
1052 struct Statement * compound;
1053 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1054 unsigned int deleteWatch;
1055 };
1056
1057 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1058
1059 struct ClassDef
1060 {
1061 struct ClassDef * prev;
1062 struct ClassDef * next;
1063 struct Location loc;
1064 int type;
1065 union
1066 {
1067 struct Declaration * decl;
1068 struct ClassFunction * function;
1069 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1070 struct PropertyDef * propertyDef;
1071 struct PropertyWatch * propertyWatch;
1072 char *  designer;
1073 struct Identifier * defaultProperty;
1074 struct
1075 {
1076 struct Identifier * id;
1077 struct Initializer * initializer;
1078 };
1079 };
1080 int memberAccess;
1081 void *  object;
1082 };
1083
1084 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1085
1086 struct DBTableEntry;
1087
1088 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1089
1090 struct DBIndexItem;
1091
1092 extern YYSTYPE yylval;
1093
1094 extern struct Location yylloc;
1095
1096 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1097
1098 extern int returnCode;
1099
1100 extern struct Expression * parsedExpression;
1101
1102 extern unsigned int yydebug;
1103
1104 void SetYydebug(unsigned int b)
1105 {
1106 yydebug = b;
1107 }
1108
1109 extern unsigned int echoOn;
1110
1111 void resetScanner();
1112
1113 int propWatcherID;
1114
1115 int expression_yyparse();
1116
1117 static struct Statement * curCompound;
1118
1119 struct External * curExternal, * afterExternal;
1120
1121 static struct Type * curSwitchType;
1122
1123 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1124
1125 struct __ecereNameSpace__ecere__com__Class * thisClass;
1126
1127 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1128 {
1129 thisClass = c;
1130 }
1131
1132 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1133 {
1134 return thisClass;
1135 }
1136
1137 static char * thisNameSpace;
1138
1139 struct __ecereNameSpace__ecere__com__Class * containerClass;
1140
1141 unsigned int thisClassParams = 0x1;
1142
1143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1144
1145 struct __ecereNameSpace__ecere__sys__TempFile
1146 {
1147 char __ecere_padding[24];
1148 };
1149
1150 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1151
1152 extern int strlen(const char * );
1153
1154 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1155
1156 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1157
1158 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1159
1160 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1161
1162 void PrintExpression(struct Expression * exp, char * string)
1163 {
1164 {
1165 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1166 int count;
1167
1168 if(exp)
1169 OutputExpression(exp, f);
1170 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1171 count = strlen(string);
1172 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);
1173 string[count] = '\0';
1174 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1175 }
1176 }
1177
1178 extern int isspace(int c);
1179
1180 long long _strtoi64(char * string, char ** endString, int base)
1181 {
1182 long long value = 0;
1183 int sign = 1;
1184 int c;
1185 char ch;
1186
1187 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1188 ;
1189 if(ch == '+')
1190 c++;
1191 else if(ch == '-')
1192 {
1193 sign = -1;
1194 c++;
1195 }
1196 ;
1197 if(!base)
1198 {
1199 if(ch == (char)0 && string[c + 1] == 'x')
1200 {
1201 base = 16;
1202 c += 2;
1203 }
1204 else if(ch == '0')
1205 {
1206 base = 8;
1207 c++;
1208 }
1209 else
1210 base = 10;
1211 }
1212 for(; (ch = string[c]); c++)
1213 {
1214 if(ch == '0')
1215 ch = (char)0;
1216 else if(ch >= '1' && ch <= '9')
1217 ch -= '1';
1218 else if(ch >= 'a' && ch <= 'z')
1219 ch -= 'a';
1220 else if(ch >= 'A' && ch <= 'Z')
1221 ch -= 'A';
1222 else
1223 {
1224 *endString = string + c;
1225 break;
1226 }
1227 if(ch < base)
1228 {
1229 value *= base;
1230 value += ch;
1231 }
1232 else
1233 {
1234 *endString = string + c;
1235 break;
1236 }
1237 }
1238 return sign * value;
1239 }
1240
1241 uint64 _strtoui64(char * string, char ** endString, int base)
1242 {
1243 uint64 value = 0;
1244 int sign = 1;
1245 int c;
1246 char ch;
1247
1248 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1249 ;
1250 if(ch == '+')
1251 c++;
1252 else if(ch == '-')
1253 {
1254 sign = -1;
1255 c++;
1256 }
1257 ;
1258 if(!base)
1259 {
1260 if(ch == (char)0 && string[c + 1] == 'x')
1261 {
1262 base = 16;
1263 c += 2;
1264 }
1265 else if(ch == '0')
1266 {
1267 base = 8;
1268 c++;
1269 }
1270 else
1271 base = 10;
1272 }
1273 for(; (ch = string[c]); c++)
1274 {
1275 if(ch == '0')
1276 ch = (char)0;
1277 else if(ch >= '1' && ch <= '9')
1278 ch -= '1';
1279 else if(ch >= 'a' && ch <= 'z')
1280 ch -= 'a';
1281 else if(ch >= 'A' && ch <= 'Z')
1282 ch -= 'A';
1283 else
1284 {
1285 if(endString)
1286 *endString = string + c;
1287 break;
1288 }
1289 if(ch < base)
1290 {
1291 value *= base;
1292 value += ch;
1293 }
1294 else
1295 {
1296 if(endString)
1297 *endString = string + c;
1298 break;
1299 }
1300 }
1301 return sign * value;
1302 }
1303
1304 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1305
1306 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1307
1308 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1309 {
1310 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1311 {
1312 if(!param->baseType)
1313 {
1314 if(param->dataTypeString)
1315 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1316 else
1317 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1318 }
1319 return param->baseType;
1320 }
1321 return (((void *)0));
1322 }
1323
1324 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1325 {
1326 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1327 return 0x1;
1328 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1329 {
1330 return 0x0;
1331 }
1332 if(type1->kind == type2->kind)
1333 {
1334 switch(type1->kind)
1335 {
1336 case 1:
1337 case 2:
1338 case 3:
1339 case 4:
1340 if(type1->passAsTemplate && !type2->passAsTemplate)
1341 return 0x1;
1342 return type1->isSigned != type2->isSigned;
1343 case 8:
1344 return type1->_class != type2->_class;
1345 case 13:
1346 return NeedCast(type1->type, type2->type);
1347 default:
1348 return 0x1;
1349 }
1350 }
1351 return 0x1;
1352 }
1353
1354 extern int strcmp(const char * , const char * );
1355
1356 extern struct Context * curContext;
1357
1358 extern struct Context * topContext;
1359
1360 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1361
1362 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);
1363
1364 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1365
1366 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);
1367
1368 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);
1369
1370 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1371
1372 struct __ecereNameSpace__ecere__com__ClassProperty
1373 {
1374 char *  name;
1375 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1376 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1377 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1378 int depth;
1379 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, int);
1380 int (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1381 char *  dataTypeString;
1382 struct Type * dataType;
1383 unsigned int constant;
1384 };
1385
1386 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1387
1388 extern struct Expression * QMkExpId(char *  id);
1389
1390 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1391
1392 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1393 {
1394 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1395 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1396 char *  name;
1397 int type;
1398 union
1399 {
1400 char *  dataTypeString;
1401 int memberType;
1402 };
1403 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1404 void *  param;
1405 char __ecere_padding[4];
1406 };
1407
1408 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1409
1410 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1411
1412 extern void FreeIdentifier(struct Identifier * id);
1413
1414 void ProcessExpressionType(struct Expression * exp);
1415
1416 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1417
1418 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1419
1420 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1421
1422 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1423
1424 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1425
1426 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1427
1428 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1429
1430 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1431
1432 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1433 {
1434 if(exp->type == 0 && exp->identifier)
1435 {
1436 struct Identifier * id = exp->identifier;
1437 struct Context * ctx;
1438 struct Symbol * symbol = (((void *)0));
1439
1440 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1441 {
1442 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1443 {
1444 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1445 if(symbol)
1446 break;
1447 }
1448 }
1449 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1450 {
1451 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1452 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1453 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1454 struct __ecereNameSpace__ecere__com__ClassProperty * classProp;
1455
1456 if(!prop)
1457 {
1458 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1459 }
1460 if(!prop && !method)
1461 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1462 if(!prop && !method && !member)
1463 {
1464 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1465 }
1466 if(prop || method || member || classProp)
1467 {
1468 exp->type = 8;
1469 exp->member.member = id;
1470 exp->member.memberType = 0;
1471 exp->member.exp = QMkExpId("this");
1472 exp->addedThis = 0x1;
1473 }
1474 else if(_class && _class->templateParams.first)
1475 {
1476 struct __ecereNameSpace__ecere__com__Class * sClass;
1477
1478 for(sClass = _class; sClass; sClass = sClass->base)
1479 {
1480 if(sClass->templateParams.first)
1481 {
1482 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1483
1484 for(param = sClass->templateParams.first; param; param = param->next)
1485 {
1486 if(param->type == 2 && !strcmp(param->name, id->string))
1487 {
1488 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1489
1490 if(argExp)
1491 {
1492 struct Declarator * decl;
1493 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1494
1495 FreeIdentifier(exp->member.member);
1496 ProcessExpressionType(argExp);
1497 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1498 exp->expType = ProcessType(specs, decl);
1499 exp->type = 5;
1500 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1501 }
1502 }
1503 }
1504 }
1505 }
1506 }
1507 }
1508 }
1509 }
1510
1511 extern int sprintf(char * , char * , ...);
1512
1513 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1514
1515 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1516
1517 char * PrintInt(long long result)
1518 {
1519 char temp[100];
1520
1521 if(result > (((long long)0x7fffffffffffffffLL)))
1522 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1523 else
1524 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1525 return __ecereNameSpace__ecere__sys__CopyString(temp);
1526 }
1527
1528 char * PrintUInt(uint64 result)
1529 {
1530 char temp[100];
1531
1532 if(result > (0xffffffff))
1533 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1534 else if(result > (((int)0x7fffffff)))
1535 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1536 else
1537 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1538 return __ecereNameSpace__ecere__sys__CopyString(temp);
1539 }
1540
1541 char * PrintInt64(long long result)
1542 {
1543 char temp[100];
1544
1545 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1546 return __ecereNameSpace__ecere__sys__CopyString(temp);
1547 }
1548
1549 char * PrintUInt64(uint64 result)
1550 {
1551 char temp[100];
1552
1553 if(result > (((long long)0x7fffffffffffffffLL)))
1554 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1555 else
1556 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1557 return __ecereNameSpace__ecere__sys__CopyString(temp);
1558 }
1559
1560 char * PrintHexUInt(uint64 result)
1561 {
1562 char temp[100];
1563
1564 if(result > (0xffffffff))
1565 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1566 else
1567 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1568 return __ecereNameSpace__ecere__sys__CopyString(temp);
1569 }
1570
1571 char * PrintHexUInt64(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 * PrintShort(short result)
1583 {
1584 char temp[100];
1585
1586 sprintf(temp, "%d", (unsigned short)result);
1587 return __ecereNameSpace__ecere__sys__CopyString(temp);
1588 }
1589
1590 char * PrintUShort(unsigned short result)
1591 {
1592 char temp[100];
1593
1594 if(result > (unsigned short)32767)
1595 sprintf(temp, "0x%X", (int)result);
1596 else
1597 sprintf(temp, "%d", result);
1598 return __ecereNameSpace__ecere__sys__CopyString(temp);
1599 }
1600
1601 extern int isprint(int c);
1602
1603 char * PrintChar(char result)
1604 {
1605 char temp[100];
1606
1607 if(result > (char)0 && isprint(result))
1608 sprintf(temp, "'%c'", result);
1609 else if(result < (char)0)
1610 sprintf(temp, "%d", result);
1611 else
1612 sprintf(temp, "0x%X", (unsigned char)result);
1613 return __ecereNameSpace__ecere__sys__CopyString(temp);
1614 }
1615
1616 char * PrintUChar(unsigned char result)
1617 {
1618 char temp[100];
1619
1620 sprintf(temp, "0x%X", result);
1621 return __ecereNameSpace__ecere__sys__CopyString(temp);
1622 }
1623
1624 char * PrintFloat(float result)
1625 {
1626 char temp[100];
1627
1628 sprintf(temp, "%.16ff", result);
1629 return __ecereNameSpace__ecere__sys__CopyString(temp);
1630 }
1631
1632 char * PrintDouble(double result)
1633 {
1634 char temp[100];
1635
1636 sprintf(temp, "%.16f", result);
1637 return __ecereNameSpace__ecere__sys__CopyString(temp);
1638 }
1639
1640 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1641
1642 struct OpTable
1643 {
1644 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1645 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1646 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1647 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1648 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1649 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1650 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1651 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1652 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1653 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1654 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1655 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1656 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1657 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1658 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1659 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1660 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1661 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1662 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1663 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1664 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1665 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1666 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1667 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1668 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1669 unsigned int (*  Not)(struct Expression *, struct Operand *);
1670 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1671 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1672 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1673 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1674 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1675 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1676 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1677 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1678 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1679 };
1680
1681 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1682
1683 struct Operand
1684 {
1685 int kind;
1686 struct Type * type;
1687 unsigned int ptrSize;
1688 union
1689 {
1690 char c;
1691 unsigned char uc;
1692 short s;
1693 unsigned short us;
1694 int i;
1695 unsigned int ui;
1696 float f;
1697 double d;
1698 unsigned char *  p;
1699 long long i64;
1700 uint64 ui64;
1701 };
1702 struct OpTable ops;
1703 };
1704
1705 struct Operand GetOperand(struct Expression * exp);
1706
1707 unsigned int GetInt(struct Expression * exp, int * value2)
1708 {
1709 struct Operand op2 = GetOperand(exp);
1710
1711 if(op2.kind == 3 && op2.type->isSigned)
1712 *value2 = op2.i;
1713 else if(op2.kind == 3)
1714 *value2 = (int)op2.ui;
1715 if(op2.kind == 4 && op2.type->isSigned)
1716 *value2 = (int)op2.i64;
1717 else if(op2.kind == 4)
1718 *value2 = (int)op2.ui64;
1719 else if(op2.kind == 2 && op2.type->isSigned)
1720 *value2 = (int)op2.s;
1721 else if(op2.kind == 2)
1722 *value2 = (int)op2.us;
1723 else if(op2.kind == 1 && op2.type->isSigned)
1724 *value2 = (int)op2.c;
1725 else if(op2.kind == 1)
1726 *value2 = (int)op2.uc;
1727 else if(op2.kind == 6)
1728 *value2 = (int)op2.f;
1729 else if(op2.kind == 7)
1730 *value2 = (int)op2.d;
1731 else if(op2.kind == 13)
1732 *value2 = (int)op2.ui;
1733 else
1734 return 0x0;
1735 return 0x1;
1736 }
1737
1738 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1739 {
1740 struct Operand op2 = GetOperand(exp);
1741
1742 if(op2.kind == 3 && op2.type->isSigned)
1743 *value2 = (unsigned int)op2.i;
1744 else if(op2.kind == 3)
1745 *value2 = op2.ui;
1746 if(op2.kind == 4 && op2.type->isSigned)
1747 *value2 = (unsigned int)op2.i64;
1748 else if(op2.kind == 4)
1749 *value2 = (unsigned int)op2.ui64;
1750 else if(op2.kind == 2 && op2.type->isSigned)
1751 *value2 = (unsigned int)op2.s;
1752 else if(op2.kind == 2)
1753 *value2 = (unsigned int)op2.us;
1754 else if(op2.kind == 1 && op2.type->isSigned)
1755 *value2 = (unsigned int)op2.c;
1756 else if(op2.kind == 1)
1757 *value2 = (unsigned int)op2.uc;
1758 else if(op2.kind == 6)
1759 *value2 = (unsigned int)op2.f;
1760 else if(op2.kind == 7)
1761 *value2 = (unsigned int)op2.d;
1762 else if(op2.kind == 13)
1763 *value2 = op2.ui;
1764 else
1765 return 0x0;
1766 return 0x1;
1767 }
1768
1769 unsigned int GetInt64(struct Expression * exp, long long * value2)
1770 {
1771 struct Operand op2 = GetOperand(exp);
1772
1773 if(op2.kind == 3 && op2.type->isSigned)
1774 *value2 = (long long)op2.i;
1775 else if(op2.kind == 3)
1776 *value2 = (long long)op2.ui;
1777 if(op2.kind == 4 && op2.type->isSigned)
1778 *value2 = op2.i64;
1779 else if(op2.kind == 4)
1780 *value2 = (long long)op2.ui64;
1781 else if(op2.kind == 2 && op2.type->isSigned)
1782 *value2 = (long long)op2.s;
1783 else if(op2.kind == 2)
1784 *value2 = (long long)op2.us;
1785 else if(op2.kind == 1 && op2.type->isSigned)
1786 *value2 = (long long)op2.c;
1787 else if(op2.kind == 1)
1788 *value2 = (long long)op2.uc;
1789 else if(op2.kind == 6)
1790 *value2 = (long long)op2.f;
1791 else if(op2.kind == 7)
1792 *value2 = (long long)op2.d;
1793 else if(op2.kind == 13)
1794 *value2 = (long long)op2.ui;
1795 else
1796 return 0x0;
1797 return 0x1;
1798 }
1799
1800 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1801 {
1802 struct Operand op2 = GetOperand(exp);
1803
1804 if(op2.kind == 3 && op2.type->isSigned)
1805 *value2 = (uint64)op2.i;
1806 else if(op2.kind == 3)
1807 *value2 = (uint64)op2.ui;
1808 if(op2.kind == 4 && op2.type->isSigned)
1809 *value2 = (uint64)op2.i64;
1810 else if(op2.kind == 4)
1811 *value2 = op2.ui64;
1812 else if(op2.kind == 2 && op2.type->isSigned)
1813 *value2 = (uint64)op2.s;
1814 else if(op2.kind == 2)
1815 *value2 = (uint64)op2.us;
1816 else if(op2.kind == 1 && op2.type->isSigned)
1817 *value2 = (uint64)op2.c;
1818 else if(op2.kind == 1)
1819 *value2 = (uint64)op2.uc;
1820 else if(op2.kind == 6)
1821 *value2 = (uint64)op2.f;
1822 else if(op2.kind == 7)
1823 *value2 = (uint64)op2.d;
1824 else if(op2.kind == 13)
1825 *value2 = (uint64)op2.ui;
1826 else
1827 return 0x0;
1828 return 0x1;
1829 }
1830
1831 unsigned int GetShort(struct Expression * exp, short * value2)
1832 {
1833 struct Operand op2 = GetOperand(exp);
1834
1835 if(op2.kind == 3 && op2.type->isSigned)
1836 *value2 = (short)op2.i;
1837 else if(op2.kind == 3)
1838 *value2 = (short)op2.ui;
1839 if(op2.kind == 4 && op2.type->isSigned)
1840 *value2 = (short)op2.i64;
1841 else if(op2.kind == 4)
1842 *value2 = (short)op2.ui64;
1843 else if(op2.kind == 2 && op2.type->isSigned)
1844 *value2 = op2.s;
1845 else if(op2.kind == 2)
1846 *value2 = (short)op2.us;
1847 else if(op2.kind == 1 && op2.type->isSigned)
1848 *value2 = (short)op2.c;
1849 else if(op2.kind == 1)
1850 *value2 = (short)op2.uc;
1851 else if(op2.kind == 6)
1852 *value2 = (short)op2.f;
1853 else if(op2.kind == 7)
1854 *value2 = (short)op2.d;
1855 else if(op2.kind == 13)
1856 *value2 = (short)op2.ui;
1857 else
1858 return 0x0;
1859 return 0x1;
1860 }
1861
1862 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
1863 {
1864 struct Operand op2 = GetOperand(exp);
1865
1866 if(op2.kind == 3 && op2.type->isSigned)
1867 *value2 = (unsigned short)op2.i;
1868 else if(op2.kind == 3)
1869 *value2 = (unsigned short)op2.ui;
1870 if(op2.kind == 4 && op2.type->isSigned)
1871 *value2 = (unsigned short)op2.i64;
1872 else if(op2.kind == 4)
1873 *value2 = (unsigned short)op2.ui64;
1874 else if(op2.kind == 2 && op2.type->isSigned)
1875 *value2 = (unsigned short)op2.s;
1876 else if(op2.kind == 2)
1877 *value2 = op2.us;
1878 else if(op2.kind == 1 && op2.type->isSigned)
1879 *value2 = (unsigned short)op2.c;
1880 else if(op2.kind == 1)
1881 *value2 = (unsigned short)op2.uc;
1882 else if(op2.kind == 6)
1883 *value2 = (unsigned short)op2.f;
1884 else if(op2.kind == 7)
1885 *value2 = (unsigned short)op2.d;
1886 else if(op2.kind == 13)
1887 *value2 = (unsigned short)op2.ui;
1888 else
1889 return 0x0;
1890 return 0x1;
1891 }
1892
1893 unsigned int GetChar(struct Expression * exp, char * value2)
1894 {
1895 struct Operand op2 = GetOperand(exp);
1896
1897 if(op2.kind == 3 && op2.type->isSigned)
1898 *value2 = (char)op2.i;
1899 else if(op2.kind == 3)
1900 *value2 = (char)op2.ui;
1901 if(op2.kind == 4 && op2.type->isSigned)
1902 *value2 = (char)op2.i64;
1903 else if(op2.kind == 4)
1904 *value2 = (char)op2.ui64;
1905 else if(op2.kind == 2 && op2.type->isSigned)
1906 *value2 = (char)op2.s;
1907 else if(op2.kind == 2)
1908 *value2 = (char)op2.us;
1909 else if(op2.kind == 1 && op2.type->isSigned)
1910 *value2 = op2.c;
1911 else if(op2.kind == 1)
1912 *value2 = (char)op2.uc;
1913 else if(op2.kind == 6)
1914 *value2 = (char)op2.f;
1915 else if(op2.kind == 7)
1916 *value2 = (char)op2.d;
1917 else if(op2.kind == 13)
1918 *value2 = (char)op2.ui;
1919 else
1920 return 0x0;
1921 return 0x1;
1922 }
1923
1924 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
1925 {
1926 struct Operand op2 = GetOperand(exp);
1927
1928 if(op2.kind == 3 && op2.type->isSigned)
1929 *value2 = (unsigned char)op2.i;
1930 else if(op2.kind == 3)
1931 *value2 = (unsigned char)op2.ui;
1932 if(op2.kind == 4 && op2.type->isSigned)
1933 *value2 = (unsigned char)op2.i64;
1934 else if(op2.kind == 4)
1935 *value2 = (unsigned char)op2.ui64;
1936 else if(op2.kind == 2 && op2.type->isSigned)
1937 *value2 = (unsigned char)op2.s;
1938 else if(op2.kind == 2)
1939 *value2 = (unsigned char)op2.us;
1940 else if(op2.kind == 1 && op2.type->isSigned)
1941 *value2 = (unsigned char)op2.c;
1942 else if(op2.kind == 1)
1943 *value2 = op2.uc;
1944 else if(op2.kind == 6)
1945 *value2 = (unsigned char)op2.f;
1946 else if(op2.kind == 7)
1947 *value2 = (unsigned char)op2.d;
1948 else if(op2.kind == 13)
1949 *value2 = (unsigned char)op2.ui;
1950 else
1951 return 0x0;
1952 return 0x1;
1953 }
1954
1955 unsigned int GetFloat(struct Expression * exp, float * value2)
1956 {
1957 struct Operand op2 = GetOperand(exp);
1958
1959 if(op2.kind == 3 && op2.type->isSigned)
1960 *value2 = (float)(float)op2.i;
1961 else if(op2.kind == 3)
1962 *value2 = (float)(float)op2.ui;
1963 if(op2.kind == 4 && op2.type->isSigned)
1964 *value2 = (float)(float)op2.i64;
1965 else if(op2.kind == 4)
1966 *value2 = (float)(float)op2.ui64;
1967 else if(op2.kind == 2 && op2.type->isSigned)
1968 *value2 = (float)(float)op2.s;
1969 else if(op2.kind == 2)
1970 *value2 = (float)(float)op2.us;
1971 else if(op2.kind == 1 && op2.type->isSigned)
1972 *value2 = (float)(float)op2.c;
1973 else if(op2.kind == 1)
1974 *value2 = (float)(float)op2.uc;
1975 else if(op2.kind == 6)
1976 *value2 = (float)op2.f;
1977 else if(op2.kind == 7)
1978 *value2 = (float)op2.d;
1979 else if(op2.kind == 13)
1980 *value2 = (float)(float)op2.ui;
1981 else
1982 return 0x0;
1983 return 0x1;
1984 }
1985
1986 unsigned int GetDouble(struct Expression * exp, double * value2)
1987 {
1988 struct Operand op2 = GetOperand(exp);
1989
1990 if(op2.kind == 3 && op2.type->isSigned)
1991 *value2 = (double)(double)op2.i;
1992 else if(op2.kind == 3)
1993 *value2 = (double)(double)op2.ui;
1994 if(op2.kind == 4 && op2.type->isSigned)
1995 *value2 = (double)(double)op2.i64;
1996 else if(op2.kind == 4)
1997 *value2 = (double)(double)op2.ui64;
1998 else if(op2.kind == 2 && op2.type->isSigned)
1999 *value2 = (double)(double)op2.s;
2000 else if(op2.kind == 2)
2001 *value2 = (double)(double)op2.us;
2002 else if(op2.kind == 1 && op2.type->isSigned)
2003 *value2 = (double)(double)op2.c;
2004 else if(op2.kind == 1)
2005 *value2 = (double)(double)op2.uc;
2006 else if(op2.kind == 6)
2007 *value2 = (double)op2.f;
2008 else if(op2.kind == 7)
2009 *value2 = (double)op2.d;
2010 else if(op2.kind == 13)
2011 *value2 = (double)(double)op2.ui;
2012 else
2013 return 0x0;
2014 return 0x1;
2015 }
2016
2017 void ComputeExpression(struct Expression * exp);
2018
2019 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2020
2021 int ComputeTypeSize(struct Type * type);
2022
2023 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2024
2025 struct __ecereNameSpace__ecere__com__BitMember
2026 {
2027 struct __ecereNameSpace__ecere__com__BitMember * prev;
2028 struct __ecereNameSpace__ecere__com__BitMember * next;
2029 char *  name;
2030 unsigned int isProperty;
2031 int memberAccess;
2032 int id;
2033 struct __ecereNameSpace__ecere__com__Class * _class;
2034 char *  dataTypeString;
2035 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2036 struct Type * dataType;
2037 int type;
2038 int size;
2039 int pos;
2040 uint64 mask;
2041 };
2042
2043 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2044
2045 struct __ecereNameSpace__ecere__sys__OldLink
2046 {
2047 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2048 struct __ecereNameSpace__ecere__sys__OldLink * next;
2049 void *  data;
2050 };
2051
2052 void FinishTemplatesContext(struct Context * context);
2053
2054 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2055 {
2056 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2057 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2058
2059 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || _class->structSize == _class->offset) && _class->computeSize))
2060 {
2061 int c;
2062 int unionMemberOffset = 0;
2063 int bitFields = 0;
2064
2065 if(!member && _class->destructionWatchOffset)
2066 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2067 {
2068 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2069
2070 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2071 {
2072 if(!dataMember->isProperty)
2073 {
2074 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2075 {
2076 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2077 }
2078 }
2079 }
2080 }
2081 {
2082 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2083
2084 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2085 {
2086 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2087 {
2088 if(!isMember && _class->type == 2 && dataMember->dataType)
2089 {
2090 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2091 uint64 mask = 0;
2092 int d;
2093
2094 ComputeTypeSize(dataMember->dataType);
2095 if(bitMember->pos == -1)
2096 bitMember->pos = _class->memberOffset;
2097 if(!bitMember->size)
2098 bitMember->size = dataMember->dataType->size * 8;
2099 _class->memberOffset = bitMember->pos + bitMember->size;
2100 for(d = 0; d < bitMember->size; d++)
2101 {
2102 if(d)
2103 mask <<= 1;
2104 mask |= 1;
2105 }
2106 bitMember->mask = mask << bitMember->pos;
2107 }
2108 else if(dataMember->type == 0 && dataMember->dataType)
2109 {
2110 int size;
2111 int alignment = 0;
2112
2113 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2114 ComputeTypeSize(dataMember->dataType);
2115 if(dataMember->dataType->bitFieldCount)
2116 {
2117 bitFields += dataMember->dataType->bitFieldCount;
2118 size = 0;
2119 }
2120 else
2121 {
2122 if(bitFields)
2123 {
2124 int size = (bitFields + 7) / 8;
2125
2126 if(isMember)
2127 {
2128 int __simpleStruct0;
2129
2130 if(alignment)
2131 {
2132 int __simpleStruct0;
2133
2134 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2135 if(member->memberOffset % alignment)
2136 member->memberOffset += alignment - (member->memberOffset % alignment);
2137 }
2138 dataMember->offset = member->memberOffset;
2139 if(member->type == 1)
2140 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2141 else
2142 {
2143 member->memberOffset += size;
2144 }
2145 }
2146 else
2147 {
2148 if(alignment)
2149 {
2150 int __simpleStruct0;
2151
2152 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2153 if(_class->memberOffset % alignment)
2154 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2155 }
2156 dataMember->offset = _class->memberOffset;
2157 _class->memberOffset += size;
2158 }
2159 bitFields = 0;
2160 }
2161 size = dataMember->dataType->size;
2162 alignment = dataMember->dataType->alignment;
2163 }
2164 if(isMember)
2165 {
2166 int __simpleStruct0;
2167
2168 if(alignment)
2169 {
2170 int __simpleStruct0;
2171
2172 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2173 if(member->memberOffset % alignment)
2174 member->memberOffset += alignment - (member->memberOffset % alignment);
2175 }
2176 dataMember->offset = member->memberOffset;
2177 if(member->type == 1)
2178 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2179 else
2180 {
2181 member->memberOffset += size;
2182 }
2183 }
2184 else
2185 {
2186 if(alignment)
2187 {
2188 int __simpleStruct0;
2189
2190 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2191 if(_class->memberOffset % alignment)
2192 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2193 }
2194 dataMember->offset = _class->memberOffset;
2195 _class->memberOffset += size;
2196 }
2197 }
2198 else
2199 {
2200 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2201 if(isMember)
2202 {
2203 int __simpleStruct2;
2204 int __simpleStruct0, __simpleStruct1;
2205
2206 member->structAlignment = (__simpleStruct0 = member->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2207 dataMember->offset = member->memberOffset;
2208 if(member->type == 1)
2209 unionMemberOffset = (__simpleStruct2 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct2) ? unionMemberOffset : __simpleStruct2);
2210 else
2211 member->memberOffset += dataMember->memberOffset;
2212 }
2213 else
2214 {
2215 int __simpleStruct0, __simpleStruct1;
2216
2217 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2218 dataMember->offset = _class->memberOffset;
2219 _class->memberOffset += dataMember->memberOffset;
2220 }
2221 }
2222 }
2223 }
2224 if(bitFields)
2225 {
2226 int alignment = 0;
2227 int size = (bitFields + 7) / 8;
2228
2229 if(isMember)
2230 {
2231 int __simpleStruct0;
2232
2233 if(alignment)
2234 {
2235 int __simpleStruct0;
2236
2237 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2238 if(member->memberOffset % alignment)
2239 member->memberOffset += alignment - (member->memberOffset % alignment);
2240 }
2241 if(member->type == 1)
2242 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2243 else
2244 {
2245 member->memberOffset += size;
2246 }
2247 }
2248 else
2249 {
2250 if(alignment)
2251 {
2252 int __simpleStruct0;
2253
2254 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2255 if(_class->memberOffset % alignment)
2256 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2257 }
2258 _class->memberOffset += size;
2259 }
2260 bitFields = 0;
2261 }
2262 }
2263 if(member && member->type == 1)
2264 {
2265 member->memberOffset = unionMemberOffset;
2266 }
2267 if(!isMember)
2268 {
2269 if(_class->type != 2)
2270 {
2271 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset;
2272 if(!member)
2273 {
2274 struct __ecereNameSpace__ecere__com__Property * prop;
2275
2276 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2277 {
2278 if(prop->isProperty && prop->isWatchable)
2279 {
2280 prop->watcherOffset = _class->structSize;
2281 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2282 }
2283 }
2284 }
2285 {
2286 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2287
2288 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2289 {
2290 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2291
2292 if(deriv->computeSize)
2293 {
2294 deriv->offset = _class->structSize;
2295 deriv->memberOffset = 0;
2296 deriv->structSize = deriv->offset;
2297 ComputeClassMembers(deriv, 0x0);
2298 }
2299 }
2300 }
2301 }
2302 }
2303 }
2304 if(context)
2305 FinishTemplatesContext(context);
2306 }
2307
2308 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2309
2310 struct __ecereNameSpace__ecere__com__NameSpace
2311 {
2312 char *  name;
2313 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2314 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2315 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2316 int depth;
2317 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2318 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2319 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2320 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2321 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2322 };
2323
2324 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2325
2326 struct __ecereNameSpace__ecere__com__Module
2327 {
2328 struct __ecereNameSpace__ecere__com__Instance * application;
2329 struct __ecereNameSpace__ecere__sys__OldList classes;
2330 struct __ecereNameSpace__ecere__sys__OldList defines;
2331 struct __ecereNameSpace__ecere__sys__OldList functions;
2332 struct __ecereNameSpace__ecere__sys__OldList modules;
2333 struct __ecereNameSpace__ecere__com__Instance * prev;
2334 struct __ecereNameSpace__ecere__com__Instance * next;
2335 char *  name;
2336 void *  library;
2337 void *  Unload;
2338 int importType;
2339 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2340 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2341 };
2342
2343 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2344 {
2345 struct __ecereNameSpace__ecere__com__Class * _class;
2346 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2347
2348 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
2349 ComputeModuleClasses(subModule->data);
2350 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->classes.first; _class; _class = _class->next)
2351 ComputeClassMembers(_class, 0x0);
2352 }
2353
2354 extern unsigned int inCompiler;
2355
2356 extern void Compiler_Error(char *  format, ...);
2357
2358 extern int __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
2359
2360 int ComputeTypeSize(struct Type * type)
2361 {
2362 unsigned int size = type ? type->size : 0;
2363
2364 if(!size && type && !type->computing)
2365 {
2366 type->computing = 0x1;
2367 switch(type->kind)
2368 {
2369 case 1:
2370 type->alignment = size = sizeof(char);
2371 break;
2372 case 3:
2373 type->alignment = size = sizeof(int);
2374 break;
2375 case 4:
2376 type->alignment = size = sizeof(long long);
2377 break;
2378 case 5:
2379 type->alignment = size = sizeof(long);
2380 break;
2381 case 2:
2382 type->alignment = size = sizeof(short);
2383 break;
2384 case 6:
2385 type->alignment = size = sizeof(float);
2386 break;
2387 case 7:
2388 type->alignment = size = sizeof(double);
2389 break;
2390 case 8:
2391 {
2392 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2393
2394 if(_class && _class->type == 1)
2395 {
2396 ComputeClassMembers(_class, 0x0);
2397 type->alignment = _class->structAlignment;
2398 size = _class->structSize;
2399 if(type->alignment && size % type->alignment)
2400 size += type->alignment - (size % type->alignment);
2401 }
2402 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2403 {
2404 if(!_class->dataType)
2405 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2406 size = type->alignment = ComputeTypeSize(_class->dataType);
2407 }
2408 else
2409 size = type->alignment = sizeof(struct __ecereNameSpace__ecere__com__Instance **);
2410 break;
2411 }
2412 case 13:
2413 case 19:
2414 size = type->alignment = sizeof(void *);
2415 break;
2416 case 12:
2417 if(type->arraySizeExp)
2418 {
2419 ProcessExpressionType(type->arraySizeExp);
2420 ComputeExpression(type->arraySizeExp);
2421 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)))
2422 {
2423 struct Location oldLoc = yylloc;
2424 char expression[10240];
2425
2426 expression[0] = '\0';
2427 type->arraySizeExp->expType = (((void *)0));
2428 yylloc = type->arraySizeExp->loc;
2429 if(inCompiler)
2430 PrintExpression(type->arraySizeExp, expression);
2431 Compiler_Error("Array size not constant int (%s)\n", expression);
2432 yylloc = oldLoc;
2433 }
2434 GetInt(type->arraySizeExp, &type->arraySize);
2435 }
2436 else if(type->enumClass)
2437 {
2438 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2439 {
2440 type->arraySize = __ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2441 }
2442 else
2443 type->arraySize = 0;
2444 }
2445 else
2446 {
2447 type->arraySize = 0;
2448 }
2449 size = ComputeTypeSize(type->type) * type->arraySize;
2450 type->alignment = type->type->alignment;
2451 break;
2452 case 9:
2453 {
2454 struct Type * member;
2455
2456 for(member = type->members.first; member; member = member->next)
2457 {
2458 int __simpleStruct0, __simpleStruct1;
2459 unsigned int addSize = ComputeTypeSize(member);
2460
2461 member->offset = size;
2462 if(member->alignment && size % member->alignment)
2463 member->offset += member->alignment - (size % member->alignment);
2464 size = member->offset;
2465 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2466 size += addSize;
2467 }
2468 if(type->alignment && size % type->alignment)
2469 size += type->alignment - (size % type->alignment);
2470 break;
2471 }
2472 case 10:
2473 {
2474 struct Type * member;
2475
2476 for(member = type->members.first; member; member = member->next)
2477 {
2478 int __simpleStruct0, __simpleStruct1;
2479 unsigned int addSize = ComputeTypeSize(member);
2480
2481 member->offset = size;
2482 if(member->alignment && size % member->alignment)
2483 member->offset += member->alignment - (size % member->alignment);
2484 size = member->offset;
2485 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2486 size = ((size > addSize) ? size : addSize);
2487 }
2488 if(type->alignment && size % type->alignment)
2489 size += type->alignment - (size % type->alignment);
2490 break;
2491 }
2492 case 20:
2493 {
2494 struct TemplateParameter * param = type->templateParameter;
2495 struct Type * baseType = ProcessTemplateParameterType(param);
2496
2497 if(baseType)
2498 size = ComputeTypeSize(baseType);
2499 else
2500 size = sizeof(uint64);
2501 break;
2502 }
2503 case 15:
2504 {
2505 size = sizeof(enum
2506 {
2507 test
2508 });
2509 break;
2510 }
2511 case 21:
2512 {
2513 size = sizeof(void *);
2514 break;
2515 }
2516 }
2517 type->size = size;
2518 type->computing = 0x0;
2519 }
2520 return size;
2521 }
2522
2523 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2524
2525 extern struct Identifier * MkIdentifier(char *  string);
2526
2527 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2528
2529 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2530
2531 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2532
2533 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2534
2535 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2536
2537 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2538
2539 extern void FreeType(struct Type * type);
2540
2541 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2542
2543 extern struct Specifier * MkSpecifier(int specifier);
2544
2545 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2546
2547 extern struct Expression * MkExpConstant(char *  string);
2548
2549 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)
2550 {
2551 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2552 unsigned int totalSize = 0;
2553 unsigned int maxSize = 0;
2554 int alignment, size;
2555 struct __ecereNameSpace__ecere__com__DataMember * member;
2556 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2557
2558 if(!isMember && _class->base)
2559 {
2560 maxSize = _class->structSize;
2561 {
2562 if(_class->type == 1 || _class->type == 5)
2563 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass);
2564 else
2565 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2566 }
2567 }
2568 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2569 {
2570 if(!member->isProperty)
2571 {
2572 switch(member->type)
2573 {
2574 case 0:
2575 {
2576 if(member->dataTypeString)
2577 {
2578 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2579 struct Declarator * decl;
2580
2581 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2582 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2583 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2584 if(!member->dataType)
2585 member->dataType = ProcessType(specs, decl);
2586 ReplaceThisClassSpecifiers(specs, topClass);
2587 {
2588 struct Type * type = ProcessType(specs, decl);
2589
2590 DeclareType(member->dataType, 0x0, 0x0);
2591 FreeType(type);
2592 }
2593 ComputeTypeSize(member->dataType);
2594 size = member->dataType->size;
2595 alignment = member->dataType->alignment;
2596 if(alignment)
2597 {
2598 if(totalSize % alignment)
2599 totalSize += alignment - (totalSize % alignment);
2600 }
2601 totalSize += size;
2602 }
2603 break;
2604 }
2605 case 1:
2606 case 2:
2607 {
2608 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2609
2610 size = 0;
2611 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass);
2612 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2613 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2614 alignment = member->structAlignment;
2615 if(alignment)
2616 {
2617 if(totalSize % alignment)
2618 totalSize += alignment - (totalSize % alignment);
2619 }
2620 totalSize += size;
2621 break;
2622 }
2623 }
2624 }
2625 }
2626 if(retSize)
2627 {
2628 unsigned int __simpleStruct0;
2629
2630 if(topMember && topMember->type == 1)
2631 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2632 else
2633 *retSize += totalSize;
2634 }
2635 else if(totalSize < maxSize && _class->type != 1000)
2636 {
2637 char sizeString[50];
2638
2639 sprintf(sizeString, "%d", maxSize - totalSize);
2640 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(289)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2641 }
2642 if(context)
2643 FinishTemplatesContext(context);
2644 return topMember ? topMember->memberID : _class->memberID;
2645 }
2646
2647 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2648 {
2649 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2650 unsigned int totalSize = 0;
2651 struct __ecereNameSpace__ecere__com__DataMember * member;
2652 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2653
2654 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2655 DeclareMembers(_class->base, 0x0);
2656 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2657 {
2658 if(!member->isProperty)
2659 {
2660 switch(member->type)
2661 {
2662 case 0:
2663 {
2664 if(!member->dataType && member->dataTypeString)
2665 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2666 if(member->dataType)
2667 DeclareType(member->dataType, 0x0, 0x0);
2668 break;
2669 }
2670 case 1:
2671 case 2:
2672 {
2673 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2674 break;
2675 }
2676 }
2677 }
2678 }
2679 if(context)
2680 FinishTemplatesContext(context);
2681 return topMember ? topMember->memberID : _class->memberID;
2682 }
2683
2684 extern struct Symbol * FindClass(char *  name);
2685
2686 extern char *  strchr(char * , int);
2687
2688 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2689
2690 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2691
2692 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2693
2694 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2695
2696 extern char *  strcpy(char * , const char * );
2697
2698 extern void MangleClassName(char *  className);
2699
2700 extern void DeclareClass(struct Symbol * classSym, char *  className);
2701
2702 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2703
2704 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2705
2706 void DeclareStruct(char * name, unsigned int skipNoHead)
2707 {
2708 struct External * external = (((void *)0));
2709 struct Symbol * classSym = FindClass(name);
2710
2711 if(!inCompiler || !classSym)
2712 return (((void *)0));
2713 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2714 return (((void *)0));
2715 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2716 {
2717 struct Declaration * decl;
2718 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2719 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2720 char structName[1024];
2721
2722 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2723 classSym->declaring++;
2724 if(strchr(classSym->string, '<'))
2725 {
2726 if(classSym->registered->templateClass)
2727 {
2728 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2729 classSym->declaring--;
2730 }
2731 return (((void *)0));
2732 }
2733 DeclareMembers(classSym->registered, 0x0);
2734 structName[0] = (char)0;
2735 FullClassNameCat(structName, name, 0x0);
2736 if(!skipNoHead)
2737 {
2738 classSym->declaredStructSym = 0x1;
2739 declarations = MkList();
2740 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered);
2741 if(!(*declarations).count)
2742 {
2743 FreeList(declarations, (((void *)0)));
2744 declarations = (((void *)0));
2745 }
2746 }
2747 if(skipNoHead || declarations)
2748 {
2749 if(external && external->declaration)
2750 {
2751 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2752 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2753 {
2754 if(classSym->structExternal)
2755 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2756 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2757 classSym->id = curExternal->symbol->idCode;
2758 classSym->idCode = curExternal->symbol->idCode;
2759 }
2760 }
2761 else
2762 {
2763 if(!external)
2764 external = MkExternalDeclaration((((void *)0)));
2765 specifiers = MkList();
2766 declarators = MkList();
2767 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2768 external->declaration = decl = MkDeclaration(specifiers, declarators);
2769 if(decl->symbol && !decl->symbol->pointerExternal)
2770 decl->symbol->pointerExternal = external;
2771 if(classSym->registered && classSym->registered->type == 1)
2772 {
2773 char className[1024];
2774
2775 strcpy(className, "__ecereClass_");
2776 FullClassNameCat(className, classSym->string, 0x1);
2777 MangleClassName(className);
2778 DeclareClass(classSym, className);
2779 external->symbol = classSym;
2780 classSym->pointerExternal = external;
2781 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2782 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2783 }
2784 else
2785 {
2786 char className[1024];
2787
2788 strcpy(className, "__ecereClass_");
2789 FullClassNameCat(className, classSym->string, 0x1);
2790 MangleClassName(className);
2791 classSym->structExternal = external;
2792 DeclareClass(classSym, className);
2793 external->symbol = classSym;
2794 }
2795 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2796 }
2797 }
2798 classSym->declaring--;
2799 }
2800 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2801 {
2802 classSym->declaring++;
2803 {
2804 if(classSym->registered)
2805 DeclareMembers(classSym->registered, 0x0);
2806 }
2807 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
2808 {
2809 if(classSym->structExternal)
2810 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2811 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2812 classSym->id = curExternal->symbol->idCode;
2813 classSym->idCode = curExternal->symbol->idCode;
2814 }
2815 classSym->declaring--;
2816 }
2817 }
2818
2819 extern char *  strcat(char * , const char * );
2820
2821 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
2822
2823 extern struct ModuleImport * mainModule;
2824
2825 extern struct Specifier * MkSpecifierName(char *  name);
2826
2827 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
2828
2829 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
2830
2831 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
2832
2833 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
2834
2835 extern void FreeDeclarator(struct Declarator * decl);
2836
2837 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
2838
2839 struct PropertyImport
2840 {
2841 struct PropertyImport * prev;
2842 struct PropertyImport * next;
2843 char *  name;
2844 unsigned int isVirtual;
2845 unsigned int hasSet;
2846 unsigned int hasGet;
2847 };
2848
2849 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
2850
2851 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
2852 {
2853 void * __ecereTemp1;
2854 struct Symbol * symbol = prop->symbol;
2855 char propName[1024];
2856
2857 strcpy(setName, "__ecereProp_");
2858 FullClassNameCat(setName, prop->_class->fullName, 0x0);
2859 strcat(setName, "_Set_");
2860 FullClassNameCat(setName, prop->name, 0x1);
2861 strcpy(getName, "__ecereProp_");
2862 FullClassNameCat(getName, prop->_class->fullName, 0x0);
2863 strcat(getName, "_Get_");
2864 FullClassNameCat(getName, prop->name, 0x1);
2865 strcpy(propName, "__ecereProp_");
2866 FullClassNameCat(propName, prop->_class->fullName, 0x0);
2867 strcat(propName, "_");
2868 FullClassNameCat(propName, prop->name, 0x1);
2869 MangleClassName(getName);
2870 MangleClassName(setName);
2871 MangleClassName(propName);
2872 if(prop->_class->type == 1)
2873 DeclareStruct(prop->_class->fullName, 0x0);
2874 if(!symbol || curExternal->symbol->idCode < symbol->id)
2875 {
2876 unsigned int imported = 0x0;
2877 unsigned int dllImport = 0x0;
2878
2879 if(!symbol || symbol->_import)
2880 {
2881 if(!symbol)
2882 {
2883 struct Symbol * classSym;
2884
2885 if(!prop->_class->symbol)
2886 prop->_class->symbol = FindClass(prop->_class->fullName);
2887 classSym = prop->_class->symbol;
2888 if(classSym && !classSym->_import)
2889 {
2890 struct ModuleImport * module;
2891
2892 if(prop->_class->module)
2893 module = FindModule(prop->_class->module);
2894 else
2895 module = mainModule;
2896 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));
2897 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
2898 }
2899 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
2900 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));
2901 if(classSym)
2902 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
2903 }
2904 imported = 0x1;
2905 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 12)))->importType != 1)
2906 dllImport = 0x1;
2907 }
2908 if(!symbol->type)
2909 {
2910 struct Context * context = SetupTemplatesContext(prop->_class);
2911
2912 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
2913 FinishTemplatesContext(context);
2914 }
2915 if(prop->Get)
2916 {
2917 if(!symbol->externalGet || symbol->externalGet->type == 0)
2918 {
2919 struct Declaration * decl;
2920 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2921 struct Declarator * d;
2922 struct __ecereNameSpace__ecere__sys__OldList * params;
2923 struct Specifier * spec;
2924 struct External * external;
2925 struct Declarator * typeDecl;
2926 unsigned int simple = 0x0;
2927
2928 specifiers = MkList();
2929 declarators = MkList();
2930 params = MkList();
2931 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
2932 d = MkDeclaratorIdentifier(MkIdentifier(getName));
2933 if(dllImport)
2934 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
2935 {
2936 struct Context * context = SetupTemplatesContext(prop->_class);
2937
2938 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
2939 FinishTemplatesContext(context);
2940 }
2941 for(spec = (*specifiers).first; spec; spec = spec->next)
2942 {
2943 if(spec->type == 1)
2944 {
2945 if((!typeDecl || typeDecl->type == 1))
2946 {
2947 struct Symbol * classSym = spec->symbol;
2948
2949 symbol->_class = classSym->registered;
2950 if(classSym->registered && classSym->registered->type == 1)
2951 {
2952 DeclareStruct(spec->name, 0x0);
2953 simple = 0x1;
2954 }
2955 }
2956 }
2957 }
2958 if(!simple)
2959 d = PlugDeclarator(typeDecl, d);
2960 else
2961 {
2962 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
2963 specifiers = MkList();
2964 }
2965 d = MkDeclaratorFunction(d, params);
2966 if(dllImport)
2967 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(285));
2968 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
2969 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(286));
2970 if(simple)
2971 ListAdd(specifiers, MkSpecifier(301));
2972 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
2973 decl = MkDeclaration(specifiers, declarators);
2974 external = MkExternalDeclaration(decl);
2975 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
2976 external->symbol = symbol;
2977 symbol->externalGet = external;
2978 ReplaceThisClassSpecifiers(specifiers, prop->_class);
2979 if(typeDecl)
2980 FreeDeclarator(typeDecl);
2981 }
2982 else
2983 {
2984 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
2985 }
2986 }
2987 if(prop->Set)
2988 {
2989 if(!symbol->externalSet || symbol->externalSet->type == 0)
2990 {
2991 struct Declaration * decl;
2992 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2993 struct Declarator * d;
2994 struct __ecereNameSpace__ecere__sys__OldList * params;
2995 struct Specifier * spec;
2996 struct External * external;
2997 struct Declarator * typeDecl;
2998
2999 declarators = MkList();
3000 params = MkList();
3001 if(!prop->conversion || prop->_class->type == 1)
3002 {
3003 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3004 }
3005 specifiers = MkList();
3006 {
3007 struct Context * context = SetupTemplatesContext(prop->_class);
3008
3009 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3010 FinishTemplatesContext(context);
3011 }
3012 ListAdd(params, MkTypeName(specifiers, d));
3013 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3014 if(dllImport)
3015 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3016 d = MkDeclaratorFunction(d, params);
3017 for(spec = (*specifiers).first; spec; spec = spec->next)
3018 {
3019 if(spec->type == 1)
3020 {
3021 if((!typeDecl || typeDecl->type == 1))
3022 {
3023 struct Symbol * classSym = spec->symbol;
3024
3025 symbol->_class = classSym->registered;
3026 if(classSym->registered && classSym->registered->type == 1)
3027 DeclareStruct(spec->name, 0x0);
3028 }
3029 }
3030 }
3031 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3032 specifiers = MkList();
3033 if(dllImport)
3034 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(285));
3035 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3036 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(286));
3037 if(!prop->conversion || prop->_class->type == 1)
3038 ListAdd(specifiers, MkSpecifier(301));
3039 else
3040 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3041 decl = MkDeclaration(specifiers, declarators);
3042 external = MkExternalDeclaration(decl);
3043 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3044 external->symbol = symbol;
3045 symbol->externalSet = external;
3046 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3047 }
3048 else
3049 {
3050 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3051 }
3052 }
3053 if(!symbol->externalPtr)
3054 {
3055 struct Declaration * decl;
3056 struct External * external;
3057 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3058
3059 if(imported)
3060 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(285));
3061 else
3062 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(286));
3063 ListAdd(specifiers, MkSpecifierName("Property"));
3064 {
3065 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3066
3067 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3068 if(!imported)
3069 {
3070 strcpy(propName, "__ecerePropM_");
3071 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3072 strcat(propName, "_");
3073 FullClassNameCat(propName, prop->name, 0x1);
3074 MangleClassName(propName);
3075 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3076 }
3077 decl = MkDeclaration(specifiers, list);
3078 }
3079 external = MkExternalDeclaration(decl);
3080 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3081 external->symbol = symbol;
3082 symbol->externalPtr = external;
3083 }
3084 else
3085 {
3086 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3087 }
3088 symbol->id = curExternal->symbol->idCode;
3089 }
3090 }
3091
3092 struct Type * Dereference(struct Type * source)
3093 {
3094 void * __ecereTemp1;
3095 struct Type * type = (((void *)0));
3096
3097 if(source)
3098 {
3099 if(source->kind == 13 || source->kind == 12)
3100 {
3101 type = source->type;
3102 source->type->refCount++;
3103 }
3104 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3105 {
3106 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3107 }
3108 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3109 {
3110 type = source;
3111 source->refCount++;
3112 }
3113 else
3114 Compiler_Error("cannot dereference type\n");
3115 }
3116 return type;
3117 }
3118
3119 static struct Type * Reference(struct Type * source)
3120 {
3121 void * __ecereTemp1;
3122 struct Type * type = (((void *)0));
3123
3124 if(source)
3125 {
3126 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));
3127 source->refCount++;
3128 }
3129 return type;
3130 }
3131
3132 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);
3133
3134 extern void *  memcpy(void * , const void * , unsigned int size);
3135
3136 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3137
3138 extern void FreeExpression(struct Expression * exp);
3139
3140 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3141
3142 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);
3143
3144 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3145
3146 extern struct Type * MkClassType(char *  name);
3147
3148 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);
3149
3150 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)
3151 {
3152 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3153 unsigned int found = 0x0;
3154 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3155 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3156 unsigned int freeType = 0x0;
3157
3158 yylloc = member->loc;
3159 if(!ident)
3160 {
3161 if(curMember)
3162 {
3163 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3164 if(*curMember)
3165 {
3166 found = 0x1;
3167 dataMember = *curMember;
3168 }
3169 }
3170 }
3171 else
3172 {
3173 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3174 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3175 int _subMemberStackPos = 0;
3176
3177 if(!thisMember)
3178 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3179 if(thisMember)
3180 {
3181 dataMember = thisMember;
3182 if(curMember && thisMember->memberAccess == 1)
3183 {
3184 *curMember = thisMember;
3185 *curClass = thisMember->_class;
3186 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3187 *subMemberStackPos = _subMemberStackPos;
3188 }
3189 found = 0x1;
3190 }
3191 else
3192 {
3193 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3194 if(method && method->type == 1)
3195 found = 0x1;
3196 else
3197 method = (((void *)0));
3198 }
3199 }
3200 if(found)
3201 {
3202 struct Type * type = (((void *)0));
3203
3204 if(dataMember)
3205 {
3206 if(!dataMember->dataType && dataMember->dataTypeString)
3207 {
3208 struct Context * context = SetupTemplatesContext(_class);
3209
3210 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3211 FinishTemplatesContext(context);
3212 }
3213 type = dataMember->dataType;
3214 }
3215 else if(method)
3216 {
3217 if(!method->dataType)
3218 ProcessMethodType(method);
3219 type = method->dataType;
3220 }
3221 if(ident && ident->next)
3222 {
3223 for(ident = ident->next; ident && type; ident = ident->next)
3224 {
3225 if(type->kind == 8)
3226 {
3227 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3228 if(!dataMember)
3229 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3230 if(dataMember)
3231 type = dataMember->dataType;
3232 }
3233 else if(type->kind == 9 || type->kind == 10)
3234 {
3235 struct Type * memberType;
3236
3237 for(memberType = type->members.first; memberType; memberType = memberType->next)
3238 {
3239 if(!strcmp(memberType->name, ident->string))
3240 {
3241 type = memberType;
3242 break;
3243 }
3244 }
3245 }
3246 }
3247 }
3248 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3249 {
3250 int id = 0;
3251 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam;
3252 struct __ecereNameSpace__ecere__com__Class * sClass;
3253
3254 for(sClass = _class; sClass; sClass = sClass->base)
3255 {
3256 id = 0;
3257 if(sClass->templateClass)
3258 sClass = sClass->templateClass;
3259 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3260 {
3261 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3262 {
3263 for(sClass = sClass->base; sClass; sClass = sClass->base)
3264 {
3265 if(sClass->templateClass)
3266 sClass = sClass->templateClass;
3267 id += sClass->templateParams.count;
3268 }
3269 break;
3270 }
3271 id++;
3272 }
3273 if(curParam)
3274 break;
3275 }
3276 if(curParam)
3277 {
3278 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3279
3280 if(arg.dataTypeString)
3281 {
3282 type = ProcessTypeString(arg.dataTypeString, 0x0);
3283 freeType = 0x1;
3284 if(type && _class->templateClass)
3285 type->passAsTemplate = 0x1;
3286 if(type)
3287 {
3288 }
3289 }
3290 }
3291 }
3292 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3293 {
3294 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3295 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3296 int c;
3297 int paramCount = 0;
3298 int lastParam = -1;
3299 char templateString[1024];
3300 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3301
3302 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3303 for(cClass = expClass; cClass; cClass = cClass->base)
3304 {
3305 int p = 0;
3306
3307 if(cClass->templateClass)
3308 cClass = cClass->templateClass;
3309 for(param = cClass->templateParams.first; param; param = param->next)
3310 {
3311 int id = p;
3312 struct __ecereNameSpace__ecere__com__Class * sClass;
3313 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3314
3315 for(sClass = cClass->base; sClass; sClass = sClass->base)
3316 {
3317 if(sClass->templateClass)
3318 sClass = sClass->templateClass;
3319 id += sClass->templateParams.count;
3320 }
3321 arg = expClass->templateArgs[id];
3322 for(sClass = _class; sClass; sClass = sClass->base)
3323 {
3324 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3325 int p = 0;
3326 struct __ecereNameSpace__ecere__com__Class * nextClass;
3327
3328 if(sClass->templateClass)
3329 sClass = sClass->templateClass;
3330 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3331 {
3332 if(nextClass->templateClass)
3333 nextClass = nextClass->templateClass;
3334 p += nextClass->templateParams.count;
3335 }
3336 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3337 {
3338 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3339 {
3340 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3341 {
3342 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3343 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3344 break;
3345 }
3346 }
3347 }
3348 }
3349 {
3350 char argument[256];
3351
3352 argument[0] = '\0';
3353 switch(param->type)
3354 {
3355 case 2:
3356 {
3357 char expString[1024];
3358 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3359 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3360 struct Expression * exp;
3361 char * string = PrintHexUInt64(arg.expression.ui64);
3362
3363 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3364 ProcessExpressionType(exp);
3365 ComputeExpression(exp);
3366 expString[0] = '\0';
3367 PrintExpression(exp, expString);
3368 strcat(argument, expString);
3369 FreeExpression(exp);
3370 break;
3371 }
3372 case 1:
3373 {
3374 strcat(argument, arg.member->name);
3375 break;
3376 }
3377 case 0:
3378 {
3379 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3380 strcat(argument, arg.dataTypeString);
3381 break;
3382 }
3383 }
3384 if(argument[0])
3385 {
3386 if(paramCount)
3387 strcat(templateString, ", ");
3388 if(lastParam != p - 1)
3389 {
3390 strcat(templateString, param->name);
3391 strcat(templateString, " = ");
3392 }
3393 strcat(templateString, argument);
3394 paramCount++;
3395 lastParam = p;
3396 }
3397 p++;
3398 }
3399 }
3400 }
3401 {
3402 int len = strlen(templateString);
3403
3404 if(templateString[len - 1] == '<')
3405 len--;
3406 else
3407 {
3408 if(templateString[len - 1] == '>')
3409 templateString[len++] = ' ';
3410 templateString[len++] = '>';
3411 }
3412 templateString[len++] = '\0';
3413 }
3414 {
3415 struct Context * context = SetupTemplatesContext(_class);
3416
3417 if(freeType)
3418 FreeType(type);
3419 type = ProcessTypeString(templateString, 0x0);
3420 freeType = 0x1;
3421 FinishTemplatesContext(context);
3422 }
3423 }
3424 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3425 {
3426 ProcessExpressionType(member->initializer->exp);
3427 if(!member->initializer->exp->expType)
3428 {
3429 if(inCompiler)
3430 {
3431 char expString[10240];
3432
3433 expString[0] = '\0';
3434 PrintExpression(member->initializer->exp, expString);
3435 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3436 Compiler_Error("unresolved symbol used as an instance method %s\n", expString);
3437 }
3438 }
3439 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3440 {
3441 Compiler_Error("incompatible instance method %s\n", ident->string);
3442 }
3443 }
3444 else if(member->initializer)
3445 {
3446 ProcessInitializer(member->initializer, type);
3447 }
3448 if(freeType)
3449 FreeType(type);
3450 }
3451 else
3452 {
3453 if(_class && _class->type == 3)
3454 {
3455 if(member->initializer)
3456 {
3457 struct Type * type = MkClassType(_class->fullName);
3458
3459 ProcessInitializer(member->initializer, type);
3460 FreeType(type);
3461 }
3462 }
3463 else
3464 {
3465 if(member->initializer)
3466 {
3467 ProcessInitializer(member->initializer, (((void *)0)));
3468 }
3469 if(ident)
3470 {
3471 if(method)
3472 {
3473 Compiler_Error("couldn't find virtual method %s in class %s\n", ident->string, _class->fullName);
3474 }
3475 else if(_class)
3476 {
3477 Compiler_Error("couldn't find member %s in class %s\n", ident->string, _class->fullName);
3478 if(inCompiler)
3479 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3480 }
3481 }
3482 else if(_class)
3483 Compiler_Error("too many initializers for instantiation of class %s\n", _class->fullName);
3484 }
3485 }
3486 }
3487
3488 extern struct Identifier * GetDeclId(struct Declarator * decl);
3489
3490 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);
3491
3492 extern void FreeSpecifier(struct Specifier * spec);
3493
3494 static void ProcessFunction(struct FunctionDefinition * function);
3495
3496 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3497
3498 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3499
3500 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3501
3502 extern void FreeClassFunction(struct ClassFunction * func);
3503
3504 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3505
3506 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3507
3508 void ProcessInstantiationType(struct Instantiation * inst)
3509 {
3510 yylloc = inst->loc;
3511 if(inst->_class)
3512 {
3513 struct MembersInit * members;
3514 struct Symbol * classSym;
3515 struct __ecereNameSpace__ecere__com__Class * _class;
3516
3517 classSym = inst->_class->symbol;
3518 _class = classSym ? classSym->registered : (((void *)0));
3519 if(!_class || _class->type != 5)
3520 DeclareStruct(inst->_class->name, 0x0);
3521 afterExternal = afterExternal ? afterExternal : curExternal;
3522 if(inst->exp)
3523 ProcessExpressionType(inst->exp);
3524 inst->isConstant = 0x1;
3525 if(inst->members)
3526 {
3527 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3528 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3529 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3530 int subMemberStackPos = 0;
3531
3532 for(members = (*inst->members).first; members; members = members->next)
3533 {
3534 switch(members->type)
3535 {
3536 case 1:
3537 {
3538 char name[1024];
3539 static unsigned int instMethodID = 0;
3540 struct External * external = curExternal;
3541 struct Context * context = curContext;
3542 struct Declarator * declarator = members->function->declarator;
3543 struct Identifier * nameID = GetDeclId(declarator);
3544 char * unmangled = nameID ? nameID->string : (((void *)0));
3545 struct Expression * exp;
3546 struct External * createdExternal = (((void *)0));
3547
3548 if(inCompiler)
3549 {
3550 char number[16];
3551
3552 strcpy(name, "__ecereInstMeth_");
3553 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3554 strcat(name, "_");
3555 strcat(name, nameID->string);
3556 strcat(name, "_");
3557 sprintf(number, "_%08d", instMethodID++);
3558 strcat(name, number);
3559 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3560 }
3561 if(declarator)
3562 {
3563 struct Symbol * symbol = declarator->symbol;
3564 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3565
3566 if(method && method->type == 1)
3567 {
3568 symbol->method = method;
3569 ProcessMethodType(method);
3570 if(!symbol->type->thisClass)
3571 {
3572 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3573 {
3574 if(!currentClass->symbol)
3575 currentClass->symbol = FindClass(currentClass->fullName);
3576 symbol->type->thisClass = currentClass->symbol;
3577 }
3578 else
3579 {
3580 if(!_class->symbol)
3581 _class->symbol = FindClass(_class->fullName);
3582 symbol->type->thisClass = _class->symbol;
3583 }
3584 }
3585 DeclareType(symbol->type, 0x1, 0x1);
3586 }
3587 else if(classSym)
3588 {
3589 Compiler_Error("couldn't find virtual method %s in class %s\n", unmangled, classSym->string);
3590 }
3591 }
3592 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3593 if(nameID)
3594 {
3595 FreeSpecifier(nameID->_class);
3596 nameID->_class = (((void *)0));
3597 }
3598 if(inCompiler)
3599 {
3600 struct Type * type = declarator->symbol->type;
3601 struct External * oldExternal = curExternal;
3602
3603 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3604 {
3605 struct External * externalDecl;
3606
3607 externalDecl = MkExternalDeclaration((((void *)0)));
3608 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3609 if(createdExternal->function)
3610 {
3611 ProcessFunction(createdExternal->function);
3612 {
3613 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3614
3615 externalDecl->declaration = decl;
3616 if(decl->symbol && !decl->symbol->pointerExternal)
3617 decl->symbol->pointerExternal = externalDecl;
3618 declarator->symbol->pointerExternal = externalDecl;
3619 }
3620 }
3621 }
3622 }
3623 else if(declarator)
3624 {
3625 curExternal = declarator->symbol->pointerExternal;
3626 ProcessFunction((struct FunctionDefinition *)members->function);
3627 }
3628 curExternal = external;
3629 curContext = context;
3630 if(inCompiler)
3631 {
3632 FreeClassFunction(members->function);
3633 exp = QMkExpId(name);
3634 members->type = 0;
3635 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3636 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3637 }
3638 break;
3639 }
3640 case 0:
3641 {
3642 if(members->dataMembers && classSym)
3643 {
3644 struct MemberInit * member;
3645 struct Location oldyyloc = yylloc;
3646
3647 for(member = (*members->dataMembers).first; member; member = member->next)
3648 {
3649 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3650 if(member->initializer && !member->initializer->isConstant)
3651 inst->isConstant = 0x0;
3652 }
3653 yylloc = oldyyloc;
3654 }
3655 break;
3656 }
3657 }
3658 }
3659 }
3660 }
3661 }
3662
3663 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3664 {
3665 if(inCompiler)
3666 {
3667 if(type->kind == 11)
3668 {
3669 struct Type * param;
3670
3671 if(declareParams)
3672 {
3673 for(param = type->params.first; param; param = param->next)
3674 DeclareType(param, declarePointers, 0x1);
3675 }
3676 DeclareType(type->returnType, declarePointers, 0x1);
3677 }
3678 else if(type->kind == 13 && declarePointers)
3679 DeclareType(type->type, declarePointers, 0x0);
3680 else if(type->kind == 8)
3681 {
3682 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3683 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3684 }
3685 else if(type->kind == 9 || type->kind == 10)
3686 {
3687 struct Type * member;
3688
3689 for(member = type->members.first; member; member = member->next)
3690 DeclareType(member, 0x0, 0x0);
3691 }
3692 else if(type->kind == 12)
3693 DeclareType(type->arrayType, declarePointers, 0x0);
3694 }
3695 }
3696
3697 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3698
3699 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3700 {
3701 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3702 int id = 0;
3703 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam;
3704 struct __ecereNameSpace__ecere__com__Class * sClass;
3705
3706 for(sClass = _class; sClass; sClass = sClass->base)
3707 {
3708 id = 0;
3709 if(sClass->templateClass)
3710 sClass = sClass->templateClass;
3711 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3712 {
3713 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3714 {
3715 for(sClass = sClass->base; sClass; sClass = sClass->base)
3716 {
3717 if(sClass->templateClass)
3718 sClass = sClass->templateClass;
3719 id += sClass->templateParams.count;
3720 }
3721 break;
3722 }
3723 id++;
3724 }
3725 if(curParam)
3726 break;
3727 }
3728 if(curParam)
3729 {
3730 arg = &_class->templateArgs[id];
3731 if(arg && param->type == 0)
3732 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3733 }
3734 return arg;
3735 }
3736
3737 extern struct Context * PushContext(void);
3738
3739 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3740
3741 struct TemplatedType
3742 {
3743 unsigned int key;
3744 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3745 struct __ecereNameSpace__ecere__sys__BTNode * left;
3746 struct __ecereNameSpace__ecere__sys__BTNode * right;
3747 int depth;
3748 struct TemplateParameter * param;
3749 };
3750
3751 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3752
3753 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3754 {
3755 void * __ecereTemp1;
3756 struct Context * context = PushContext();
3757
3758 context->templateTypesOnly = 0x1;
3759 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3760 {
3761 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3762
3763 for(; param; param = param->next)
3764 {
3765 if(param->type == 0 && param->identifier)
3766 {
3767 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (unsigned int)param->identifier->string, type->param = param, type);
3768
3769 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3770 }
3771 }
3772 }
3773 else if(_class)
3774 {
3775 struct __ecereNameSpace__ecere__com__Class * sClass;
3776
3777 for(sClass = _class; sClass; sClass = sClass->base)
3778 {
3779 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
3780
3781 for(p = sClass->templateParams.first; p; p = p->next)
3782 {
3783 if(p->type == 0)
3784 {
3785 struct TemplateParameter * param = p->param;
3786 struct TemplatedType * type;
3787
3788 if(!param)
3789 {
3790 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));
3791 }
3792 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));
3793 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3794 }
3795 }
3796 }
3797 }
3798 return context;
3799 }
3800
3801 extern void PopContext(struct Context * ctx);
3802
3803 extern void FreeContext(struct Context * context);
3804
3805 void FinishTemplatesContext(struct Context * context)
3806 {
3807 PopContext(context);
3808 FreeContext(context);
3809 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
3810 }
3811
3812 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
3813 {
3814 if(!method->dataType)
3815 {
3816 struct Context * context = SetupTemplatesContext(method->_class);
3817
3818 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3819 FinishTemplatesContext(context);
3820 if(method->type != 1 && method->dataType)
3821 {
3822 if(!method->dataType->thisClass && !method->dataType->staticMethod)
3823 {
3824 if(!method->_class->symbol)
3825 method->_class->symbol = FindClass(method->_class->fullName);
3826 method->dataType->thisClass = method->_class->symbol;
3827 }
3828 }
3829 }
3830 }
3831
3832 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
3833 {
3834 if(!prop->dataType)
3835 {
3836 struct Context * context = SetupTemplatesContext(prop->_class);
3837
3838 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
3839 FinishTemplatesContext(context);
3840 }
3841 }
3842
3843 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
3844
3845 extern void FreeTypeName(struct TypeName * typeName);
3846
3847 static void ProcessDeclarator(struct Declarator * decl);
3848
3849 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
3850
3851 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
3852
3853 struct MethodImport
3854 {
3855 struct MethodImport * prev;
3856 struct MethodImport * next;
3857 char *  name;
3858 unsigned int isVirtual;
3859 };
3860
3861 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3862
3863 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
3864 {
3865 void * __ecereTemp1;
3866 struct Symbol * symbol = method->symbol;
3867
3868 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
3869 {
3870 unsigned int imported = 0x0;
3871 unsigned int dllImport = 0x0;
3872
3873 if(!method->dataType)
3874 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
3875 if(!symbol || symbol->_import || method->type == 1)
3876 {
3877 if(!symbol || method->type == 1)
3878 {
3879 struct Symbol * classSym;
3880
3881 if(!method->_class->symbol)
3882 method->_class->symbol = FindClass(method->_class->fullName);
3883 classSym = method->_class->symbol;
3884 if(!classSym->_import)
3885 {
3886 struct ModuleImport * module;
3887
3888 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->name)
3889 module = FindModule(method->_class->module);
3890 else
3891 module = mainModule;
3892 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));
3893 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3894 }
3895 if(!symbol)
3896 {
3897 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3898 }
3899 if(!symbol->_import)
3900 {
3901 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));
3902 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
3903 }
3904 if(!symbol)
3905 {
3906 symbol->type = method->dataType;
3907 if(symbol->type)
3908 symbol->type->refCount++;
3909 }
3910 }
3911 if(!method->dataType->dllExport)
3912 {
3913 imported = 0x1;
3914 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->importType != 1)
3915 dllImport = 0x1;
3916 }
3917 }
3918 if(method->type != 1 && method->dataType)
3919 DeclareType(method->dataType, 0x1, 0x1);
3920 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
3921 {
3922 struct Declaration * decl;
3923 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3924 struct Declarator * d;
3925 struct Declarator * funcDecl;
3926 struct External * external;
3927
3928 specifiers = MkList();
3929 declarators = MkList();
3930 if(dllImport)
3931 ListAdd(specifiers, MkSpecifier(285));
3932 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
3933 ListAdd(specifiers, MkSpecifier(286));
3934 if(method->type == 1)
3935 {
3936 ListAdd(specifiers, MkSpecifier(291));
3937 d = MkDeclaratorIdentifier(MkIdentifier(name));
3938 }
3939 else
3940 {
3941 d = MkDeclaratorIdentifier(MkIdentifier(name));
3942 if(dllImport)
3943 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3944 {
3945 struct Context * context = SetupTemplatesContext(method->_class);
3946
3947 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
3948 FinishTemplatesContext(context);
3949 }
3950 funcDecl = GetFuncDecl(d);
3951 if(dllImport)
3952 {
3953 struct Specifier * spec, * next;
3954
3955 for(spec = (*specifiers).first; spec; spec = next)
3956 {
3957 next = spec->next;
3958 if(spec->type == 5)
3959 {
3960 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
3961 FreeSpecifier(spec);
3962 }
3963 }
3964 }
3965 if(method->dataType && !method->dataType->staticMethod)
3966 {
3967 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
3968 {
3969 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
3970 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")));
3971 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
3972 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
3973
3974 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == 301 && !firstParam->declarator)
3975 {
3976 struct TypeName * param = (*funcDecl->function.parameters).first;
3977
3978 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
3979 FreeTypeName(param);
3980 }
3981 if(!funcDecl->function.parameters)
3982 funcDecl->function.parameters = MkList();
3983 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
3984 }
3985 }
3986 }
3987 ProcessDeclarator(d);
3988 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3989 decl = MkDeclaration(specifiers, declarators);
3990 ReplaceThisClassSpecifiers(specifiers, method->_class);
3991 if(symbol->pointerExternal)
3992 {
3993 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3994
3995 {
3996 *functionSymbol = *symbol;
3997 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
3998 if(functionSymbol->type)
3999 functionSymbol->type->refCount++;
4000 }
4001 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4002 symbol->pointerExternal->symbol = functionSymbol;
4003 }
4004 external = MkExternalDeclaration(decl);
4005 if(curExternal)
4006 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4007 external->symbol = symbol;
4008 symbol->pointerExternal = external;
4009 }
4010 else if(ast)
4011 {
4012 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4013 }
4014 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4015 }
4016 }
4017
4018 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4019 {
4020 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4021 {
4022 unsigned int first = 0x1;
4023 int p = 0;
4024 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4025 int lastParam = -1;
4026 char className[1024];
4027
4028 strcpy(className, _class->fullName);
4029 for(param = _class->templateParams.first; param; param = param->next)
4030 {
4031 {
4032 if(first)
4033 strcat(className, "<");
4034 if(!first)
4035 strcat(className, ", ");
4036 if(lastParam + 1 != p)
4037 {
4038 strcat(className, param->name);
4039 strcat(className, " = ");
4040 }
4041 strcat(className, param->name);
4042 first = 0x0;
4043 lastParam = p;
4044 }
4045 p++;
4046 }
4047 if(!first)
4048 {
4049 int len = strlen(className);
4050
4051 if(className[len - 1] == '>')
4052 className[len++] = ' ';
4053 className[len++] = '>';
4054 className[len++] = '\0';
4055 }
4056 return __ecereNameSpace__ecere__sys__CopyString(className);
4057 }
4058 else
4059 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4060 }
4061
4062 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4063 {
4064 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4065 {
4066 unsigned int first = 0x1;
4067 int p = 0;
4068 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4069 int lastParam = -1;
4070 char className[1024];
4071
4072 strcpy(className, _class->fullName);
4073 for(param = _class->templateParams.first; param; param = param->next)
4074 {
4075 {
4076 if(first)
4077 strcat(className, "<");
4078 if(!first)
4079 strcat(className, ", ");
4080 if(lastParam + 1 != p)
4081 {
4082 strcat(className, param->name);
4083 strcat(className, " = ");
4084 }
4085 strcat(className, param->name);
4086 first = 0x0;
4087 lastParam = p;
4088 }
4089 p++;
4090 }
4091 if(!first)
4092 {
4093 int len = strlen(className);
4094
4095 if(className[len - 1] == '>')
4096 className[len++] = ' ';
4097 className[len++] = '>';
4098 className[len++] = '\0';
4099 }
4100 return MkClassType(className);
4101 }
4102 else
4103 {
4104 return MkClassType(_class->fullName);
4105 }
4106 }
4107
4108 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4109 {
4110 if(specs != (((void *)0)) && _class)
4111 {
4112 struct Specifier * spec;
4113
4114 for(spec = specs->first; spec; spec = spec->next)
4115 {
4116 if(spec->type == 0 && spec->specifier == 321)
4117 {
4118 spec->type = 1;
4119 spec->name = ReplaceThisClass(_class);
4120 spec->symbol = FindClass(spec->name);
4121 }
4122 }
4123 }
4124 }
4125
4126 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4127
4128 struct __ecereNameSpace__ecere__com__GlobalFunction
4129 {
4130 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4131 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4132 char *  name;
4133 int (*  function)();
4134 struct __ecereNameSpace__ecere__com__Instance * module;
4135 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4136 char *  dataTypeString;
4137 struct Type * dataType;
4138 void *  symbol;
4139 };
4140
4141 extern struct Context * globalContext;
4142
4143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4144
4145 struct FunctionImport
4146 {
4147 struct FunctionImport * prev;
4148 struct FunctionImport * next;
4149 char *  name;
4150 };
4151
4152 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4153 {
4154 void * __ecereTemp1;
4155 struct Symbol * symbol = function->symbol;
4156
4157 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4158 {
4159 unsigned int imported = 0x0;
4160 unsigned int dllImport = 0x0;
4161
4162 if(!function->dataType)
4163 {
4164 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4165 if(!function->dataType->thisClass)
4166 function->dataType->staticMethod = 0x1;
4167 }
4168 if(inCompiler)
4169 {
4170 if(!symbol)
4171 {
4172 struct ModuleImport * module = FindModule(function->module);
4173
4174 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4175 if(module->name)
4176 {
4177 if(!function->dataType->dllExport)
4178 {
4179 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));
4180 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4181 }
4182 }
4183 {
4184 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4185 if(!symbol->type->thisClass)
4186 symbol->type->staticMethod = 0x1;
4187 }
4188 }
4189 imported = symbol->_import ? 0x1 : 0x0;
4190 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1)
4191 dllImport = 0x1;
4192 }
4193 DeclareType(function->dataType, 0x1, 0x1);
4194 if(inCompiler)
4195 {
4196 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4197 {
4198 struct Declaration * decl;
4199 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4200 struct Declarator * d;
4201 struct Declarator * funcDecl;
4202 struct External * external;
4203
4204 specifiers = MkList();
4205 declarators = MkList();
4206 ListAdd(specifiers, MkSpecifier(285));
4207 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4208 if(dllImport)
4209 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4210 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4211 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType == 1)
4212 {
4213 struct Specifier * spec;
4214
4215 for(spec = (*specifiers).first; spec; spec = spec->next)
4216 if(spec->type == 5 && !strcmp(spec->name, "dllexport"))
4217 {
4218 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4219 FreeSpecifier(spec);
4220 break;
4221 }
4222 }
4223 funcDecl = GetFuncDecl(d);
4224 if(funcDecl && !funcDecl->function.parameters)
4225 {
4226 funcDecl->function.parameters = MkList();
4227 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(301)), (((void *)0))));
4228 }
4229 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4230 {
4231 struct Context * oldCtx = curContext;
4232
4233 curContext = globalContext;
4234 decl = MkDeclaration(specifiers, declarators);
4235 curContext = oldCtx;
4236 }
4237 if(symbol->pointerExternal)
4238 {
4239 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4240
4241 {
4242 *functionSymbol = *symbol;
4243 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4244 if(functionSymbol->type)
4245 functionSymbol->type->refCount++;
4246 }
4247 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4248 symbol->pointerExternal->symbol = functionSymbol;
4249 }
4250 external = MkExternalDeclaration(decl);
4251 if(curExternal)
4252 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4253 external->symbol = symbol;
4254 symbol->pointerExternal = external;
4255 }
4256 else
4257 {
4258 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4259 }
4260 if(curExternal)
4261 symbol->id = curExternal->symbol->idCode;
4262 }
4263 }
4264 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1) ? 0x1 : 0x0;
4265 }
4266
4267 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4268
4269 struct GlobalData
4270 {
4271 unsigned int key;
4272 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4273 struct __ecereNameSpace__ecere__sys__BTNode * left;
4274 struct __ecereNameSpace__ecere__sys__BTNode * right;
4275 int depth;
4276 struct __ecereNameSpace__ecere__com__Instance * module;
4277 char *  dataTypeString;
4278 struct Type * dataType;
4279 void *  symbol;
4280 char *  fullName;
4281 };
4282
4283 void DeclareGlobalData(struct GlobalData * data)
4284 {
4285 struct Symbol * symbol = data->symbol;
4286
4287 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4288 {
4289 if(inCompiler)
4290 {
4291 if(!symbol)
4292 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4293 }
4294 if(!data->dataType)
4295 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4296 DeclareType(data->dataType, 0x1, 0x1);
4297 if(inCompiler)
4298 {
4299 if(!symbol->pointerExternal)
4300 {
4301 struct Declaration * decl;
4302 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4303 struct Declarator * d;
4304 struct External * external;
4305
4306 specifiers = MkList();
4307 declarators = MkList();
4308 ListAdd(specifiers, MkSpecifier(285));
4309 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4310 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4311 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4312 decl = MkDeclaration(specifiers, declarators);
4313 external = MkExternalDeclaration(decl);
4314 if(curExternal)
4315 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4316 external->symbol = symbol;
4317 symbol->pointerExternal = external;
4318 }
4319 else
4320 {
4321 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4322 }
4323 if(curExternal)
4324 symbol->id = curExternal->symbol->idCode;
4325 }
4326 }
4327 }
4328
4329 struct Conversion
4330 {
4331 struct Conversion * prev, * next;
4332 struct __ecereNameSpace__ecere__com__Property * convert;
4333 unsigned int isGet;
4334 struct Type * resultType;
4335 };
4336
4337 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4338
4339 extern void Compiler_Warning(char *  format, ...);
4340
4341 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4342
4343 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)
4344 {
4345 if(source && dest)
4346 {
4347 if(source->kind == 20 && dest->kind != 20)
4348 {
4349 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4350
4351 if(type)
4352 source = type;
4353 }
4354 if(dest->kind == 20 && source->kind != 20)
4355 {
4356 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4357
4358 if(type)
4359 dest = type;
4360 }
4361 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4362 {
4363 return 0x1;
4364 }
4365 if(source->classObjectType == 3 && dest->classObjectType != 2)
4366 {
4367 return 0x1;
4368 }
4369 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4370 {
4371 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4372 return 0x1;
4373 }
4374 if(dest->kind == 14 && source->kind != 0)
4375 return 0x1;
4376 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))
4377 return 0x1;
4378 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))
4379 return 0x1;
4380 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4381 {
4382 if(source->_class->registered && source->_class->registered->type == 3)
4383 {
4384 if(conversions != (((void *)0)))
4385 {
4386 if(source->_class->registered == dest->_class->registered)
4387 return 0x1;
4388 }
4389 else
4390 {
4391 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4392
4393 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4394 ;
4395 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4396 ;
4397 if(sourceBase == destBase)
4398 return 0x1;
4399 }
4400 }
4401 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))
4402 return 0x1;
4403 else
4404 {
4405 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4406 {
4407 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4408 {
4409 return 0x1;
4410 }
4411 }
4412 }
4413 }
4414 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4415 return 0x1;
4416 if(doConversion)
4417 {
4418 if(source->kind == 8)
4419 {
4420 struct __ecereNameSpace__ecere__com__Class * _class;
4421
4422 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4423 {
4424 struct __ecereNameSpace__ecere__com__Property * convert;
4425
4426 for(convert = _class->conversions.first; convert; convert = convert->next)
4427 {
4428 if(convert->memberAccess == 1 || _class->module == privateModule)
4429 {
4430 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4431
4432 if(!convert->dataType)
4433 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4434 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4435 {
4436 if(!conversions && !convert->Get)
4437 return 0x1;
4438 else if(conversions != (((void *)0)))
4439 {
4440 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))
4441 return 0x1;
4442 else
4443 {
4444 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4445
4446 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4447 return 0x1;
4448 }
4449 }
4450 }
4451 }
4452 }
4453 }
4454 }
4455 if(dest->kind == 8)
4456 {
4457 struct __ecereNameSpace__ecere__com__Class * _class;
4458
4459 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4460 {
4461 struct __ecereNameSpace__ecere__com__Property * convert;
4462
4463 for(convert = _class->conversions.first; convert; convert = convert->next)
4464 {
4465 if(convert->memberAccess == 1 || _class->module == privateModule)
4466 {
4467 if(!convert->dataType)
4468 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4469 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4470 {
4471 if(!conversions && !convert->Set)
4472 return 0x1;
4473 else if(conversions != (((void *)0)))
4474 {
4475 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))
4476 return 0x1;
4477 else
4478 {
4479 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4480
4481 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4482 return 0x1;
4483 }
4484 }
4485 }
4486 }
4487 }
4488 }
4489 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4490 {
4491 if(!dest->_class->registered->dataType)
4492 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4493 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4494 {
4495 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4496 {
4497 return 0x1;
4498 }
4499 }
4500 }
4501 }
4502 if(source->kind == 8)
4503 {
4504 struct __ecereNameSpace__ecere__com__Class * _class;
4505
4506 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4507 {
4508 struct __ecereNameSpace__ecere__com__Property * convert;
4509
4510 for(convert = _class->conversions.first; convert; convert = convert->next)
4511 {
4512 if(convert->memberAccess == 1 || _class->module == privateModule)
4513 {
4514 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4515
4516 if(!convert->dataType)
4517 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4518 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4519 {
4520 if(!conversions && !convert->Get)
4521 return 0x1;
4522 else if(conversions != (((void *)0)))
4523 {
4524 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))
4525 return 0x1;
4526 else
4527 {
4528 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4529
4530 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4531 return 0x1;
4532 }
4533 }
4534 }
4535 }
4536 }
4537 }
4538 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4539 {
4540 if(!source->_class->registered->dataType)
4541 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4542 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4543 {
4544 return 0x1;
4545 }
4546 }
4547 }
4548 }
4549 if(source->kind == 8 || source->kind == 19)
4550 ;
4551 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4552 return 0x1;
4553 else if(dest->kind == 7 && source->kind == 6)
4554 return 0x1;
4555 else if(dest->kind == 2 && source->kind == 1)
4556 return 0x1;
4557 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1))
4558 return 0x1;
4559 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4560 return 0x1;
4561 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4))
4562 return 0x1;
4563 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || dest->kind == 4))
4564 return 0x1;
4565 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)))
4566 {
4567 struct Type * paramSource, * paramDest;
4568
4569 if(dest->kind == 16)
4570 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4571 if(source->kind == 16)
4572 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4573 if(dest->kind == 13 && dest->type->kind == 11)
4574 dest = dest->type;
4575 if(source->kind == 13 && source->type->kind == 11)
4576 source = source->type;
4577 if(dest->kind == 16)
4578 dest = dest->method->dataType;
4579 if(source->kind == 16)
4580 source = source->method->dataType;
4581 paramSource = source->params.first;
4582 if(paramSource && paramSource->kind == 0)
4583 paramSource = (((void *)0));
4584 paramDest = dest->params.first;
4585 if(paramDest && paramDest->kind == 0)
4586 paramDest = (((void *)0));
4587 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4588 {
4589 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))))
4590 {
4591 if(paramDest && paramDest->kind == 8)
4592 Compiler_Error("method class must be derived from %s\n", paramDest->_class->string);
4593 else
4594 Compiler_Error("method class should not take an object\n");
4595 return 0x0;
4596 }
4597 paramDest = paramDest->next;
4598 }
4599 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4600 {
4601 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4602 {
4603 if(dest->thisClass)
4604 {
4605 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4606 {
4607 Compiler_Error("method class must be derived from %s\n", dest->thisClass->string);
4608 return 0x0;
4609 }
4610 }
4611 else
4612 {
4613 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4614 {
4615 if(owningClassDest)
4616 Compiler_Error("%s expected to be derived from method class\n", owningClassDest->fullName);
4617 else
4618 Compiler_Error("overriding class expected to be derived from method class\n");
4619 return 0x0;
4620 }
4621 }
4622 paramSource = paramSource->next;
4623 }
4624 else
4625 {
4626 if(dest->thisClass)
4627 {
4628 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4629 {
4630 Compiler_Error("method class must be derived from %s\n", dest->thisClass->string);
4631 return 0x0;
4632 }
4633 }
4634 else
4635 {
4636 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4637 {
4638 Compiler_Error("%s expected to be derived from method class\n", source->thisClass->registered->fullName);
4639 return 0x0;
4640 }
4641 }
4642 }
4643 }
4644 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4645 {
4646 Compiler_Warning("incompatible return type for function\n");
4647 return 0x0;
4648 }
4649 for(; paramDest; paramDest = paramDest->next)
4650 {
4651 if(!paramSource)
4652 {
4653 Compiler_Error("not enough parameters\n");
4654 return 0x0;
4655 }
4656 {
4657 struct Type * paramDestType = paramDest;
4658 struct Type * paramSourceType = paramSource;
4659 struct Type * type = paramDestType;
4660
4661 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4662 {
4663 int id = 0;
4664 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam;
4665 struct __ecereNameSpace__ecere__com__Class * sClass;
4666
4667 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4668 {
4669 id = 0;
4670 if(sClass->templateClass)
4671 sClass = sClass->templateClass;
4672 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4673 {
4674 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4675 {
4676 for(sClass = sClass->base; sClass; sClass = sClass->base)
4677 {
4678 if(sClass->templateClass)
4679 sClass = sClass->templateClass;
4680 id += sClass->templateParams.count;
4681 }
4682 break;
4683 }
4684 id++;
4685 }
4686 if(curParam)
4687 break;
4688 }
4689 if(curParam)
4690 {
4691 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4692
4693 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4694 }
4695 }
4696 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)))
4697 {
4698 char type[1024];
4699
4700 type[0] = (char)0;
4701 PrintType(paramDest, type, 0x0, 0x1);
4702 Compiler_Warning("incompatible parameter %s (expected %s)\n", paramSource->name, type);
4703 if(paramDestType != paramDest)
4704 FreeType(paramDestType);
4705 return 0x0;
4706 }
4707 if(paramDestType != paramDest)
4708 FreeType(paramDestType);
4709 }
4710 paramSource = paramSource->next;
4711 }
4712 if(paramSource)
4713 {
4714 Compiler_Error("too many parameters\n");
4715 return 0x0;
4716 }
4717 return 0x1;
4718 }
4719 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4720 {
4721 return 0x1;
4722 }
4723 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4724 {
4725 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4726 return 0x1;
4727 }
4728 }
4729 return 0x0;
4730 }
4731
4732 static void FreeConvert(struct Conversion * convert)
4733 {
4734 if(convert->resultType)
4735 FreeType(convert->resultType);
4736 }
4737
4738 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4739
4740 struct __ecereNameSpace__ecere__com__BTNamedLink
4741 {
4742 char *  name;
4743 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4744 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4745 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4746 int depth;
4747 void *  data;
4748 };
4749
4750 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4751
4752 struct __ecereNameSpace__ecere__com__EnumClassData
4753 {
4754 struct __ecereNameSpace__ecere__sys__OldList values;
4755 int largest;
4756 };
4757
4758 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4759
4760 struct __ecereNameSpace__ecere__sys__NamedLink
4761 {
4762 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4763 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4764 char *  name;
4765 void *  data;
4766 };
4767
4768 extern void FreeExpContents(struct Expression * exp);
4769
4770 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
4771
4772 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
4773
4774 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
4775
4776 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
4777
4778 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
4779
4780 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4781 {
4782 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
4783
4784 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)))
4785 {
4786 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
4787
4788 if(_class->type == 4)
4789 {
4790 struct __ecereNameSpace__ecere__sys__OldList converts = 
4791 {
4792 0, 0, 0, 0, 0
4793 };
4794 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4795
4796 type->kind = 8;
4797 if(!_class->symbol)
4798 _class->symbol = FindClass(_class->fullName);
4799 type->_class = _class->symbol;
4800 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
4801 {
4802 struct __ecereNameSpace__ecere__sys__NamedLink * value;
4803 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
4804
4805 if(enumClass)
4806 {
4807 struct __ecereNameSpace__ecere__com__Class * baseClass;
4808
4809 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
4810 {
4811 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
4812
4813 for(value = e->values.first; value; value = value->next)
4814 {
4815 if(!strcmp(value->name, string))
4816 break;
4817 }
4818 if(value)
4819 {
4820 FreeExpContents(sourceExp);
4821 FreeType(sourceExp->expType);
4822 sourceExp->isConstant = 0x1;
4823 sourceExp->expType = MkClassType(baseClass->fullName);
4824 {
4825 char constant[256];
4826
4827 sourceExp->type = 2;
4828 if(!strcmp(baseClass->dataTypeString, "int"))
4829 sprintf(constant, "%d", value->data);
4830 else
4831 sprintf(constant, "0x%X", value->data);
4832 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
4833 }
4834 while(converts.first)
4835 {
4836 struct Conversion * convert = converts.first;
4837
4838 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
4839 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
4840 }
4841 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4842 return 0x1;
4843 }
4844 }
4845 }
4846 }
4847 if(converts.first)
4848 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
4849 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
4850 }
4851 }
4852 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)))
4853 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
4854 return 0x1;
4855 return 0x0;
4856 }
4857
4858 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
4859
4860 struct __ecereNameSpace__ecere__com__SubModule
4861 {
4862 struct __ecereNameSpace__ecere__com__SubModule * prev;
4863 struct __ecereNameSpace__ecere__com__SubModule * next;
4864 struct __ecereNameSpace__ecere__com__Instance * module;
4865 int importMode;
4866 };
4867
4868 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
4869 {
4870 struct __ecereNameSpace__ecere__com__SubModule * subModule;
4871
4872 if(searchFor == searchIn)
4873 return 0x1;
4874 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->modules.first; subModule; subModule = subModule->next)
4875 {
4876 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->application)
4877 {
4878 if(ModuleVisibility(subModule->module, searchFor))
4879 return 0x1;
4880 }
4881 }
4882 return 0x0;
4883 }
4884
4885 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
4886
4887 struct __ecereNameSpace__ecere__com__Application
4888 {
4889 int argc;
4890 char * *  argv;
4891 int exitCode;
4892 unsigned int isGUIApp;
4893 struct __ecereNameSpace__ecere__sys__OldList allModules;
4894 char *  parsedCommand;
4895 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
4896 };
4897
4898 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4899 {
4900 struct __ecereNameSpace__ecere__com__Instance * module;
4901
4902 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 296)))->systemNameSpace, sourceExp, dest, string, conversions))
4903 return 0x1;
4904 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->privateNameSpace, sourceExp, dest, string, conversions))
4905 return 0x1;
4906 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4907 return 0x1;
4908 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 296)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->next)
4909 {
4910 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
4911 return 0x1;
4912 }
4913 return 0x0;
4914 }
4915
4916 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
4917
4918 void ReadString(char *  output, char *  string);
4919
4920 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
4921
4922 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
4923
4924 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
4925
4926 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
4927 {
4928 void * __ecereTemp1;
4929 struct Type * source = sourceExp->expType;
4930 struct Type * realDest = dest;
4931
4932 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
4933 return 0x1;
4934 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
4935 {
4936 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
4937 {
4938 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4939
4940 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4941 ;
4942 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
4943 ;
4944 if(sourceBase == destBase)
4945 return 0x1;
4946 }
4947 }
4948 if(source)
4949 {
4950 struct __ecereNameSpace__ecere__sys__OldList * specs;
4951 unsigned int flag = 0x0;
4952 long long value = (((int)0x7fffffff));
4953
4954 source->refCount++;
4955 dest->refCount++;
4956 if(sourceExp->type == 2)
4957 {
4958 if(source->isSigned)
4959 value = strtoll(sourceExp->constant, (((void *)0)), 0);
4960 else
4961 value = strtoull(sourceExp->constant, (((void *)0)), 0);
4962 }
4963 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
4964 {
4965 if(source->isSigned)
4966 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
4967 else
4968 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
4969 }
4970 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
4971 {
4972 FreeType(source);
4973 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));
4974 }
4975 if(dest->kind == 8)
4976 {
4977 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
4978
4979 if(_class && _class->type == 3)
4980 {
4981 if(source->kind != 8)
4982 {
4983 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4984 struct Type * tempDest, * tempSource;
4985
4986 for(; _class->base->type != 1000; _class = _class->base)
4987 ;
4988 tempSource = dest;
4989 tempDest = tempType;
4990 tempType->kind = 8;
4991 if(!_class->symbol)
4992 _class->symbol = FindClass(_class->fullName);
4993 tempType->_class = _class->symbol;
4994 tempType->truth = dest->truth;
4995 if(tempType->_class)
4996 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
4997 FreeType(sourceExp->expType);
4998 sourceExp->expType = dest;
4999 dest->refCount++;
5000 flag = 0x1;
5001 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5002 }
5003 }
5004 if(_class && _class->type == 2 && source->kind != 8)
5005 {
5006 if(!dest->_class->registered->dataType)
5007 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5008 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5009 {
5010 FreeType(source);
5011 FreeType(sourceExp->expType);
5012 source = sourceExp->expType = MkClassType(dest->_class->string);
5013 source->refCount++;
5014 }
5015 }
5016 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5017 {
5018 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5019 struct Declarator * decl;
5020 char string[1024];
5021
5022 ReadString(string, sourceExp->string);
5023 decl = SpecDeclFromString(string, specs, (((void *)0)));
5024 FreeExpContents(sourceExp);
5025 FreeType(sourceExp->expType);
5026 sourceExp->type = 26;
5027 sourceExp->_classExp.specifiers = specs;
5028 sourceExp->_classExp.decl = decl;
5029 sourceExp->expType = dest;
5030 dest->refCount++;
5031 return 0x1;
5032 }
5033 }
5034 else if(source->kind == 8)
5035 {
5036 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5037
5038 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5039 {
5040 if(dest->kind != 8)
5041 {
5042 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5043 struct Type * tempDest, * tempSource;
5044
5045 if(!source->_class->registered->dataType)
5046 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5047 for(; _class->base->type != 1000; _class = _class->base)
5048 ;
5049 tempDest = source;
5050 tempSource = tempType;
5051 tempType->kind = 8;
5052 tempType->_class = FindClass(_class->fullName);
5053 tempType->truth = source->truth;
5054 tempType->classObjectType = source->classObjectType;
5055 if(tempType->_class)
5056 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5057 if(conversions->last)
5058 {
5059 ((struct Conversion *)conversions->last)->resultType = dest;
5060 dest->refCount++;
5061 }
5062 FreeType(sourceExp->expType);
5063 sourceExp->expType = MkClassType(_class->fullName);
5064 sourceExp->expType->truth = source->truth;
5065 sourceExp->expType->classObjectType = source->classObjectType;
5066 if(!sourceExp->destType)
5067 {
5068 FreeType(sourceExp->destType);
5069 sourceExp->destType = sourceExp->expType;
5070 if(sourceExp->expType)
5071 sourceExp->expType->refCount++;
5072 }
5073 if(!_class->dataType)
5074 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5075 FreeType(dest);
5076 dest = MkClassType(source->_class->string);
5077 dest->truth = source->truth;
5078 dest->classObjectType = source->classObjectType;
5079 FreeType(source);
5080 source = _class->dataType;
5081 source->refCount++;
5082 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5083 }
5084 }
5085 }
5086 if(!flag)
5087 {
5088 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5089 {
5090 FreeType(source);
5091 FreeType(dest);
5092 return 0x1;
5093 }
5094 }
5095 if(dest->kind == 8)
5096 {
5097 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5098
5099 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5100 {
5101 if(_class->type == 0 || _class->type == 5)
5102 {
5103 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5104
5105 *newExp = *sourceExp;
5106 if(sourceExp->destType)
5107 sourceExp->destType->refCount++;
5108 if(sourceExp->expType)
5109 sourceExp->expType->refCount++;
5110 sourceExp->type = 11;
5111 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(301)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5112 sourceExp->cast.exp = newExp;
5113 FreeType(sourceExp->expType);
5114 sourceExp->expType = (((void *)0));
5115 ProcessExpressionType(sourceExp);
5116 if(!inCompiler)
5117 {
5118 FreeType(sourceExp->expType);
5119 sourceExp->expType = dest;
5120 }
5121 FreeType(source);
5122 if(inCompiler)
5123 FreeType(dest);
5124 return 0x1;
5125 }
5126 if(!_class->dataType)
5127 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5128 FreeType(dest);
5129 dest = _class->dataType;
5130 dest->refCount++;
5131 }
5132 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5133 {
5134 specs = MkListOne(MkSpecifier(298));
5135 }
5136 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5137 {
5138 specs = MkListOne(MkSpecifier(297));
5139 }
5140 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5141 {
5142 specs = MkList();
5143 if(!dest->isSigned)
5144 ListAdd(specs, MkSpecifier(296));
5145 ListAdd(specs, MkSpecifier(293));
5146 }
5147 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5148 {
5149 specs = MkList();
5150 if(!dest->isSigned)
5151 ListAdd(specs, MkSpecifier(296));
5152 ListAdd(specs, MkSpecifier(291));
5153 }
5154 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5155 {
5156 specs = MkList();
5157 if(!dest->isSigned)
5158 ListAdd(specs, MkSpecifier(296));
5159 ListAdd(specs, MkSpecifier(290));
5160 }
5161 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5162 {
5163 specs = MkList();
5164 if(!dest->isSigned)
5165 ListAdd(specs, MkSpecifier(296));
5166 ListAdd(specs, MkSpecifier(289));
5167 }
5168 else
5169 {
5170 FreeType(source);
5171 FreeType(dest);
5172 return 0x0;
5173 }
5174 }
5175 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))
5176 {
5177 specs = MkListOne(MkSpecifier(298));
5178 }
5179 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5180 {
5181 specs = MkListOne(MkSpecifier(297));
5182 }
5183 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)))
5184 {
5185 specs = MkList();
5186 if(!dest->isSigned)
5187 ListAdd(specs, MkSpecifier(296));
5188 ListAdd(specs, MkSpecifier(289));
5189 }
5190 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)))))
5191 {
5192 specs = MkList();
5193 if(!dest->isSigned)
5194 ListAdd(specs, MkSpecifier(296));
5195 ListAdd(specs, MkSpecifier(290));
5196 }
5197 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5198 {
5199 specs = MkList();
5200 if(!dest->isSigned)
5201 ListAdd(specs, MkSpecifier(296));
5202 ListAdd(specs, MkSpecifier(291));
5203 }
5204 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5205 {
5206 specs = MkList();
5207 if(!dest->isSigned)
5208 ListAdd(specs, MkSpecifier(296));
5209 ListAdd(specs, MkSpecifier(293));
5210 }
5211 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5212 {
5213 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5214 }
5215 else
5216 {
5217 FreeType(source);
5218 FreeType(dest);
5219 return 0x0;
5220 }
5221 if(!flag)
5222 {
5223 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5224
5225 *newExp = *sourceExp;
5226 newExp->prev = (((void *)0));
5227 newExp->next = (((void *)0));
5228 if(sourceExp->destType)
5229 sourceExp->destType->refCount++;
5230 if(sourceExp->expType)
5231 sourceExp->expType->refCount++;
5232 sourceExp->type = 11;
5233 if(realDest->kind == 8)
5234 {
5235 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5236 FreeList(specs, FreeSpecifier);
5237 }
5238 else
5239 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5240 if(newExp->type == 4)
5241 {
5242 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5243 }
5244 else
5245 sourceExp->cast.exp = newExp;
5246 FreeType(sourceExp->expType);
5247 sourceExp->expType = (((void *)0));
5248 ProcessExpressionType(sourceExp);
5249 }
5250 else
5251 FreeList(specs, FreeSpecifier);
5252 FreeType(dest);
5253 FreeType(source);
5254 return 0x1;
5255 }
5256 else
5257 {
5258 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5259 sourceExp = (*sourceExp->list).last;
5260 if(sourceExp->type == 0)
5261 {
5262 struct Identifier * id = sourceExp->identifier;
5263
5264 if(dest->kind == 8)
5265 {
5266 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5267 {
5268 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5269 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5270
5271 if(enumClass)
5272 {
5273 for(; _class && _class->type == 4; _class = _class->base)
5274 {
5275 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5276 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5277
5278 for(value = e->values.first; value; value = value->next)
5279 {
5280 if(!strcmp(value->name, id->string))
5281 break;
5282 }
5283 if(value)
5284 {
5285 FreeExpContents(sourceExp);
5286 FreeType(sourceExp->expType);
5287 sourceExp->isConstant = 0x1;
5288 sourceExp->expType = MkClassType(_class->fullName);
5289 {
5290 char constant[256];
5291
5292 sourceExp->type = 2;
5293 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5294 sprintf(constant, "%d", value->data);
5295 else
5296 sprintf(constant, "0x%X", value->data);
5297 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5298 }
5299 return 0x1;
5300 }
5301 }
5302 }
5303 }
5304 }
5305 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5306 return 0x1;
5307 }
5308 }
5309 return 0x0;
5310 }
5311
5312 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5313 {
5314 int value2 = op2->i;
5315
5316 exp->type = 2;
5317 exp->string = PrintInt(op1->i + value2);
5318 if(!exp->expType)
5319 {
5320 exp->expType = op1->type;
5321 if(op1->type)
5322 op1->type->refCount++;
5323 }
5324 return 0x1;
5325 }
5326
5327 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5328 {
5329 unsigned int value2 = op2->ui;
5330
5331 exp->type = 2;
5332 exp->string = PrintUInt(op1->ui + value2);
5333 if(!exp->expType)
5334 {
5335 exp->expType = op1->type;
5336 if(op1->type)
5337 op1->type->refCount++;
5338 }
5339 return 0x1;
5340 }
5341
5342 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5343 {
5344 short value2 = op2->s;
5345
5346 exp->type = 2;
5347 exp->string = PrintShort(op1->s + value2);
5348 if(!exp->expType)
5349 {
5350 exp->expType = op1->type;
5351 if(op1->type)
5352 op1->type->refCount++;
5353 }
5354 return 0x1;
5355 }
5356
5357 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5358 {
5359 unsigned short value2 = op2->us;
5360
5361 exp->type = 2;
5362 exp->string = PrintUShort(op1->us + value2);
5363 if(!exp->expType)
5364 {
5365 exp->expType = op1->type;
5366 if(op1->type)
5367 op1->type->refCount++;
5368 }
5369 return 0x1;
5370 }
5371
5372 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5373 {
5374 char value2 = op2->c;
5375
5376 exp->type = 2;
5377 exp->string = PrintChar(op1->c + value2);
5378 if(!exp->expType)
5379 {
5380 exp->expType = op1->type;
5381 if(op1->type)
5382 op1->type->refCount++;
5383 }
5384 return 0x1;
5385 }
5386
5387 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5388 {
5389 unsigned char value2 = op2->uc;
5390
5391 exp->type = 2;
5392 exp->string = PrintUChar(op1->uc + value2);
5393 if(!exp->expType)
5394 {
5395 exp->expType = op1->type;
5396 if(op1->type)
5397 op1->type->refCount++;
5398 }
5399 return 0x1;
5400 }
5401
5402 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5403 {
5404 float value2 = op2->f;
5405
5406 exp->type = 2;
5407 exp->string = PrintFloat(op1->f + value2);
5408 if(!exp->expType)
5409 {
5410 exp->expType = op1->type;
5411 if(op1->type)
5412 op1->type->refCount++;
5413 }
5414 return 0x1;
5415 }
5416
5417 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5418 {
5419 double value2 = op2->d;
5420
5421 exp->type = 2;
5422 exp->string = PrintDouble(op1->d + value2);
5423 if(!exp->expType)
5424 {
5425 exp->expType = op1->type;
5426 if(op1->type)
5427 op1->type->refCount++;
5428 }
5429 return 0x1;
5430 }
5431
5432 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5433 {
5434 int value2 = op2->i;
5435
5436 exp->type = 2;
5437 exp->string = PrintInt(op1->i - value2);
5438 if(!exp->expType)
5439 {
5440 exp->expType = op1->type;
5441 if(op1->type)
5442 op1->type->refCount++;
5443 }
5444 return 0x1;
5445 }
5446
5447 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5448 {
5449 unsigned int value2 = op2->ui;
5450
5451 exp->type = 2;
5452 exp->string = PrintUInt(op1->ui - value2);
5453 if(!exp->expType)
5454 {
5455 exp->expType = op1->type;
5456 if(op1->type)
5457 op1->type->refCount++;
5458 }
5459 return 0x1;
5460 }
5461
5462 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5463 {
5464 short value2 = op2->s;
5465
5466 exp->type = 2;
5467 exp->string = PrintShort(op1->s - value2);
5468 if(!exp->expType)
5469 {
5470 exp->expType = op1->type;
5471 if(op1->type)
5472 op1->type->refCount++;
5473 }
5474 return 0x1;
5475 }
5476
5477 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5478 {
5479 unsigned short value2 = op2->us;
5480
5481 exp->type = 2;
5482 exp->string = PrintUShort(op1->us - value2);
5483 if(!exp->expType)
5484 {
5485 exp->expType = op1->type;
5486 if(op1->type)
5487 op1->type->refCount++;
5488 }
5489 return 0x1;
5490 }
5491
5492 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5493 {
5494 char value2 = op2->c;
5495
5496 exp->type = 2;
5497 exp->string = PrintChar(op1->c - value2);
5498 if(!exp->expType)
5499 {
5500 exp->expType = op1->type;
5501 if(op1->type)
5502 op1->type->refCount++;
5503 }
5504 return 0x1;
5505 }
5506
5507 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5508 {
5509 unsigned char value2 = op2->uc;
5510
5511 exp->type = 2;
5512 exp->string = PrintUChar(op1->uc - value2);
5513 if(!exp->expType)
5514 {
5515 exp->expType = op1->type;
5516 if(op1->type)
5517 op1->type->refCount++;
5518 }
5519 return 0x1;
5520 }
5521
5522 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5523 {
5524 float value2 = op2->f;
5525
5526 exp->type = 2;
5527 exp->string = PrintFloat(op1->f - value2);
5528 if(!exp->expType)
5529 {
5530 exp->expType = op1->type;
5531 if(op1->type)
5532 op1->type->refCount++;
5533 }
5534 return 0x1;
5535 }
5536
5537 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5538 {
5539 double value2 = op2->d;
5540
5541 exp->type = 2;
5542 exp->string = PrintDouble(op1->d - value2);
5543 if(!exp->expType)
5544 {
5545 exp->expType = op1->type;
5546 if(op1->type)
5547 op1->type->refCount++;
5548 }
5549 return 0x1;
5550 }
5551
5552 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5553 {
5554 int value2 = op2->i;
5555
5556 exp->type = 2;
5557 exp->string = PrintInt(op1->i * value2);
5558 if(!exp->expType)
5559 {
5560 exp->expType = op1->type;
5561 if(op1->type)
5562 op1->type->refCount++;
5563 }
5564 return 0x1;
5565 }
5566
5567 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5568 {
5569 unsigned int value2 = op2->ui;
5570
5571 exp->type = 2;
5572 exp->string = PrintUInt(op1->ui * value2);
5573 if(!exp->expType)
5574 {
5575 exp->expType = op1->type;
5576 if(op1->type)
5577 op1->type->refCount++;
5578 }
5579 return 0x1;
5580 }
5581
5582 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5583 {
5584 short value2 = op2->s;
5585
5586 exp->type = 2;
5587 exp->string = PrintShort(op1->s * value2);
5588 if(!exp->expType)
5589 {
5590 exp->expType = op1->type;
5591 if(op1->type)
5592 op1->type->refCount++;
5593 }
5594 return 0x1;
5595 }
5596
5597 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5598 {
5599 unsigned short value2 = op2->us;
5600
5601 exp->type = 2;
5602 exp->string = PrintUShort(op1->us * value2);
5603 if(!exp->expType)
5604 {
5605 exp->expType = op1->type;
5606 if(op1->type)
5607 op1->type->refCount++;
5608 }
5609 return 0x1;
5610 }
5611
5612 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5613 {
5614 char value2 = op2->c;
5615
5616 exp->type = 2;
5617 exp->string = PrintChar(op1->c * value2);
5618 if(!exp->expType)
5619 {
5620 exp->expType = op1->type;
5621 if(op1->type)
5622 op1->type->refCount++;
5623 }
5624 return 0x1;
5625 }
5626
5627 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5628 {
5629 unsigned char value2 = op2->uc;
5630
5631 exp->type = 2;
5632 exp->string = PrintUChar(op1->uc * value2);
5633 if(!exp->expType)
5634 {
5635 exp->expType = op1->type;
5636 if(op1->type)
5637 op1->type->refCount++;
5638 }
5639 return 0x1;
5640 }
5641
5642 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5643 {
5644 float value2 = op2->f;
5645
5646 exp->type = 2;
5647 exp->string = PrintFloat(op1->f * value2);
5648 if(!exp->expType)
5649 {
5650 exp->expType = op1->type;
5651 if(op1->type)
5652 op1->type->refCount++;
5653 }
5654 return 0x1;
5655 }
5656
5657 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5658 {
5659 double value2 = op2->d;
5660
5661 exp->type = 2;
5662 exp->string = PrintDouble(op1->d * value2);
5663 if(!exp->expType)
5664 {
5665 exp->expType = op1->type;
5666 if(op1->type)
5667 op1->type->refCount++;
5668 }
5669 return 0x1;
5670 }
5671
5672 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5673 {
5674 int value2 = op2->i;
5675
5676 exp->type = 2;
5677 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5678 if(!exp->expType)
5679 {
5680 exp->expType = op1->type;
5681 if(op1->type)
5682 op1->type->refCount++;
5683 }
5684 return 0x1;
5685 }
5686
5687 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5688 {
5689 unsigned int value2 = op2->ui;
5690
5691 exp->type = 2;
5692 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5693 if(!exp->expType)
5694 {
5695 exp->expType = op1->type;
5696 if(op1->type)
5697 op1->type->refCount++;
5698 }
5699 return 0x1;
5700 }
5701
5702 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5703 {
5704 short value2 = op2->s;
5705
5706 exp->type = 2;
5707 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5708 if(!exp->expType)
5709 {
5710 exp->expType = op1->type;
5711 if(op1->type)
5712 op1->type->refCount++;
5713 }
5714 return 0x1;
5715 }
5716
5717 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5718 {
5719 unsigned short value2 = op2->us;
5720
5721 exp->type = 2;
5722 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5723 if(!exp->expType)
5724 {
5725 exp->expType = op1->type;
5726 if(op1->type)
5727 op1->type->refCount++;
5728 }
5729 return 0x1;
5730 }
5731
5732 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5733 {
5734 char value2 = op2->c;
5735
5736 exp->type = 2;
5737 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5738 if(!exp->expType)
5739 {
5740 exp->expType = op1->type;
5741 if(op1->type)
5742 op1->type->refCount++;
5743 }
5744 return 0x1;
5745 }
5746
5747 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5748 {
5749 unsigned char value2 = op2->uc;
5750
5751 exp->type = 2;
5752 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5753 if(!exp->expType)
5754 {
5755 exp->expType = op1->type;
5756 if(op1->type)
5757 op1->type->refCount++;
5758 }
5759 return 0x1;
5760 }
5761
5762 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5763 {
5764 float value2 = op2->f;
5765
5766 exp->type = 2;
5767 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
5768 if(!exp->expType)
5769 {
5770 exp->expType = op1->type;
5771 if(op1->type)
5772 op1->type->refCount++;
5773 }
5774 return 0x1;
5775 }
5776
5777 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5778 {
5779 double value2 = op2->d;
5780
5781 exp->type = 2;
5782 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
5783 if(!exp->expType)
5784 {
5785 exp->expType = op1->type;
5786 if(op1->type)
5787 op1->type->refCount++;
5788 }
5789 return 0x1;
5790 }
5791
5792 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5793 {
5794 int value2 = op2->i;
5795
5796 exp->type = 2;
5797 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
5798 if(!exp->expType)
5799 {
5800 exp->expType = op1->type;
5801 if(op1->type)
5802 op1->type->refCount++;
5803 }
5804 return 0x1;
5805 }
5806
5807 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5808 {
5809 unsigned int value2 = op2->ui;
5810
5811 exp->type = 2;
5812 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
5813 if(!exp->expType)
5814 {
5815 exp->expType = op1->type;
5816 if(op1->type)
5817 op1->type->refCount++;
5818 }
5819 return 0x1;
5820 }
5821
5822 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5823 {
5824 short value2 = op2->s;
5825
5826 exp->type = 2;
5827 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
5828 if(!exp->expType)
5829 {
5830 exp->expType = op1->type;
5831 if(op1->type)
5832 op1->type->refCount++;
5833 }
5834 return 0x1;
5835 }
5836
5837 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5838 {
5839 unsigned short value2 = op2->us;
5840
5841 exp->type = 2;
5842 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
5843 if(!exp->expType)
5844 {
5845 exp->expType = op1->type;
5846 if(op1->type)
5847 op1->type->refCount++;
5848 }
5849 return 0x1;
5850 }
5851
5852 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5853 {
5854 char value2 = op2->c;
5855
5856 exp->type = 2;
5857 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
5858 if(!exp->expType)
5859 {
5860 exp->expType = op1->type;
5861 if(op1->type)
5862 op1->type->refCount++;
5863 }
5864 return 0x1;
5865 }
5866
5867 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5868 {
5869 unsigned char value2 = op2->uc;
5870
5871 exp->type = 2;
5872 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
5873 if(!exp->expType)
5874 {
5875 exp->expType = op1->type;
5876 if(op1->type)
5877 op1->type->refCount++;
5878 }
5879 return 0x1;
5880 }
5881
5882 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
5883 {
5884 exp->type = 2;
5885 exp->string = PrintInt(-op1->i);
5886 if(!exp->expType)
5887 {
5888 exp->expType = op1->type;
5889 if(op1->type)
5890 op1->type->refCount++;
5891 }
5892 return 0x1;
5893 }
5894
5895 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
5896 {
5897 exp->type = 2;
5898 exp->string = PrintUInt(-op1->ui);
5899 if(!exp->expType)
5900 {
5901 exp->expType = op1->type;
5902 if(op1->type)
5903 op1->type->refCount++;
5904 }
5905 return 0x1;
5906 }
5907
5908 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
5909 {
5910 exp->type = 2;
5911 exp->string = PrintShort(-op1->s);
5912 if(!exp->expType)
5913 {
5914 exp->expType = op1->type;
5915 if(op1->type)
5916 op1->type->refCount++;
5917 }
5918 return 0x1;
5919 }
5920
5921 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
5922 {
5923 exp->type = 2;
5924 exp->string = PrintUShort(-op1->us);
5925 if(!exp->expType)
5926 {
5927 exp->expType = op1->type;
5928 if(op1->type)
5929 op1->type->refCount++;
5930 }
5931 return 0x1;
5932 }
5933
5934 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
5935 {
5936 exp->type = 2;
5937 exp->string = PrintChar(-op1->c);
5938 if(!exp->expType)
5939 {
5940 exp->expType = op1->type;
5941 if(op1->type)
5942 op1->type->refCount++;
5943 }
5944 return 0x1;
5945 }
5946
5947 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
5948 {
5949 exp->type = 2;
5950 exp->string = PrintUChar(-op1->uc);
5951 if(!exp->expType)
5952 {
5953 exp->expType = op1->type;
5954 if(op1->type)
5955 op1->type->refCount++;
5956 }
5957 return 0x1;
5958 }
5959
5960 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
5961 {
5962 exp->type = 2;
5963 exp->string = PrintFloat(-op1->f);
5964 if(!exp->expType)
5965 {
5966 exp->expType = op1->type;
5967 if(op1->type)
5968 op1->type->refCount++;
5969 }
5970 return 0x1;
5971 }
5972
5973 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
5974 {
5975 exp->type = 2;
5976 exp->string = PrintDouble(-op1->d);
5977 if(!exp->expType)
5978 {
5979 exp->expType = op1->type;
5980 if(op1->type)
5981 op1->type->refCount++;
5982 }
5983 return 0x1;
5984 }
5985
5986 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
5987 {
5988 exp->type = 2;
5989 exp->string = PrintInt(++op1->i);
5990 if(!exp->expType)
5991 {
5992 exp->expType = op1->type;
5993 if(op1->type)
5994 op1->type->refCount++;
5995 }
5996 return 0x1;
5997 }
5998
5999 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6000 {
6001 exp->type = 2;
6002 exp->string = PrintUInt(++op1->ui);
6003 if(!exp->expType)
6004 {
6005 exp->expType = op1->type;
6006 if(op1->type)
6007 op1->type->refCount++;
6008 }
6009 return 0x1;
6010 }
6011
6012 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6013 {
6014 exp->type = 2;
6015 exp->string = PrintShort(++op1->s);
6016 if(!exp->expType)
6017 {
6018 exp->expType = op1->type;
6019 if(op1->type)
6020 op1->type->refCount++;
6021 }
6022 return 0x1;
6023 }
6024
6025 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6026 {
6027 exp->type = 2;
6028 exp->string = PrintUShort(++op1->us);
6029 if(!exp->expType)
6030 {
6031 exp->expType = op1->type;
6032 if(op1->type)
6033 op1->type->refCount++;
6034 }
6035 return 0x1;
6036 }
6037
6038 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6039 {
6040 exp->type = 2;
6041 exp->string = PrintChar(++op1->c);
6042 if(!exp->expType)
6043 {
6044 exp->expType = op1->type;
6045 if(op1->type)
6046 op1->type->refCount++;
6047 }
6048 return 0x1;
6049 }
6050
6051 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6052 {
6053 exp->type = 2;
6054 exp->string = PrintUChar(++op1->uc);
6055 if(!exp->expType)
6056 {
6057 exp->expType = op1->type;
6058 if(op1->type)
6059 op1->type->refCount++;
6060 }
6061 return 0x1;
6062 }
6063
6064 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6065 {
6066 exp->type = 2;
6067 exp->string = PrintFloat(++op1->f);
6068 if(!exp->expType)
6069 {
6070 exp->expType = op1->type;
6071 if(op1->type)
6072 op1->type->refCount++;
6073 }
6074 return 0x1;
6075 }
6076
6077 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6078 {
6079 exp->type = 2;
6080 exp->string = PrintDouble(++op1->d);
6081 if(!exp->expType)
6082 {
6083 exp->expType = op1->type;
6084 if(op1->type)
6085 op1->type->refCount++;
6086 }
6087 return 0x1;
6088 }
6089
6090 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6091 {
6092 exp->type = 2;
6093 exp->string = PrintInt(--op1->i);
6094 if(!exp->expType)
6095 {
6096 exp->expType = op1->type;
6097 if(op1->type)
6098 op1->type->refCount++;
6099 }
6100 return 0x1;
6101 }
6102
6103 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6104 {
6105 exp->type = 2;
6106 exp->string = PrintUInt(--op1->ui);
6107 if(!exp->expType)
6108 {
6109 exp->expType = op1->type;
6110 if(op1->type)
6111 op1->type->refCount++;
6112 }
6113 return 0x1;
6114 }
6115
6116 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6117 {
6118 exp->type = 2;
6119 exp->string = PrintShort(--op1->s);
6120 if(!exp->expType)
6121 {
6122 exp->expType = op1->type;
6123 if(op1->type)
6124 op1->type->refCount++;
6125 }
6126 return 0x1;
6127 }
6128
6129 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6130 {
6131 exp->type = 2;
6132 exp->string = PrintUShort(--op1->us);
6133 if(!exp->expType)
6134 {
6135 exp->expType = op1->type;
6136 if(op1->type)
6137 op1->type->refCount++;
6138 }
6139 return 0x1;
6140 }
6141
6142 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6143 {
6144 exp->type = 2;
6145 exp->string = PrintChar(--op1->c);
6146 if(!exp->expType)
6147 {
6148 exp->expType = op1->type;
6149 if(op1->type)
6150 op1->type->refCount++;
6151 }
6152 return 0x1;
6153 }
6154
6155 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6156 {
6157 exp->type = 2;
6158 exp->string = PrintUChar(--op1->uc);
6159 if(!exp->expType)
6160 {
6161 exp->expType = op1->type;
6162 if(op1->type)
6163 op1->type->refCount++;
6164 }
6165 return 0x1;
6166 }
6167
6168 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6169 {
6170 exp->type = 2;
6171 exp->string = PrintFloat(--op1->f);
6172 if(!exp->expType)
6173 {
6174 exp->expType = op1->type;
6175 if(op1->type)
6176 op1->type->refCount++;
6177 }
6178 return 0x1;
6179 }
6180
6181 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6182 {
6183 exp->type = 2;
6184 exp->string = PrintDouble(--op1->d);
6185 if(!exp->expType)
6186 {
6187 exp->expType = op1->type;
6188 if(op1->type)
6189 op1->type->refCount++;
6190 }
6191 return 0x1;
6192 }
6193
6194 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6195 {
6196 int value2 = op2->i;
6197
6198 exp->type = 2;
6199 exp->string = PrintInt(op1->i = value2);
6200 if(!exp->expType)
6201 {
6202 exp->expType = op1->type;
6203 if(op1->type)
6204 op1->type->refCount++;
6205 }
6206 return 0x1;
6207 }
6208
6209 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6210 {
6211 unsigned int value2 = op2->ui;
6212
6213 exp->type = 2;
6214 exp->string = PrintUInt(op1->ui = value2);
6215 if(!exp->expType)
6216 {
6217 exp->expType = op1->type;
6218 if(op1->type)
6219 op1->type->refCount++;
6220 }
6221 return 0x1;
6222 }
6223
6224 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6225 {
6226 short value2 = op2->s;
6227
6228 exp->type = 2;
6229 exp->string = PrintShort(op1->s = value2);
6230 if(!exp->expType)
6231 {
6232 exp->expType = op1->type;
6233 if(op1->type)
6234 op1->type->refCount++;
6235 }
6236 return 0x1;
6237 }
6238
6239 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6240 {
6241 unsigned short value2 = op2->us;
6242
6243 exp->type = 2;
6244 exp->string = PrintUShort(op1->us = value2);
6245 if(!exp->expType)
6246 {
6247 exp->expType = op1->type;
6248 if(op1->type)
6249 op1->type->refCount++;
6250 }
6251 return 0x1;
6252 }
6253
6254 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6255 {
6256 char value2 = op2->c;
6257
6258 exp->type = 2;
6259 exp->string = PrintChar(op1->c = value2);
6260 if(!exp->expType)
6261 {
6262 exp->expType = op1->type;
6263 if(op1->type)
6264 op1->type->refCount++;
6265 }
6266 return 0x1;
6267 }
6268
6269 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6270 {
6271 unsigned char value2 = op2->uc;
6272
6273 exp->type = 2;
6274 exp->string = PrintUChar(op1->uc = value2);
6275 if(!exp->expType)
6276 {
6277 exp->expType = op1->type;
6278 if(op1->type)
6279 op1->type->refCount++;
6280 }
6281 return 0x1;
6282 }
6283
6284 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6285 {
6286 float value2 = op2->f;
6287
6288 exp->type = 2;
6289 exp->string = PrintFloat(op1->f = value2);
6290 if(!exp->expType)
6291 {
6292 exp->expType = op1->type;
6293 if(op1->type)
6294 op1->type->refCount++;
6295 }
6296 return 0x1;
6297 }
6298
6299 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6300 {
6301 double value2 = op2->d;
6302
6303 exp->type = 2;
6304 exp->string = PrintDouble(op1->d = value2);
6305 if(!exp->expType)
6306 {
6307 exp->expType = op1->type;
6308 if(op1->type)
6309 op1->type->refCount++;
6310 }
6311 return 0x1;
6312 }
6313
6314 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6315 {
6316 int value2 = op2->i;
6317
6318 exp->type = 2;
6319 exp->string = PrintInt(op1->i += value2);
6320 if(!exp->expType)
6321 {
6322 exp->expType = op1->type;
6323 if(op1->type)
6324 op1->type->refCount++;
6325 }
6326 return 0x1;
6327 }
6328
6329 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6330 {
6331 unsigned int value2 = op2->ui;
6332
6333 exp->type = 2;
6334 exp->string = PrintUInt(op1->ui += value2);
6335 if(!exp->expType)
6336 {
6337 exp->expType = op1->type;
6338 if(op1->type)
6339 op1->type->refCount++;
6340 }
6341 return 0x1;
6342 }
6343
6344 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6345 {
6346 short value2 = op2->s;
6347
6348 exp->type = 2;
6349 exp->string = PrintShort(op1->s += value2);
6350 if(!exp->expType)
6351 {
6352 exp->expType = op1->type;
6353 if(op1->type)
6354 op1->type->refCount++;
6355 }
6356 return 0x1;
6357 }
6358
6359 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6360 {
6361 unsigned short value2 = op2->us;
6362
6363 exp->type = 2;
6364 exp->string = PrintUShort(op1->us += value2);
6365 if(!exp->expType)
6366 {
6367 exp->expType = op1->type;
6368 if(op1->type)
6369 op1->type->refCount++;
6370 }
6371 return 0x1;
6372 }
6373
6374 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6375 {
6376 char value2 = op2->c;
6377
6378 exp->type = 2;
6379 exp->string = PrintChar(op1->c += value2);
6380 if(!exp->expType)
6381 {
6382 exp->expType = op1->type;
6383 if(op1->type)
6384 op1->type->refCount++;
6385 }
6386 return 0x1;
6387 }
6388
6389 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6390 {
6391 unsigned char value2 = op2->uc;
6392
6393 exp->type = 2;
6394 exp->string = PrintUChar(op1->uc += value2);
6395 if(!exp->expType)
6396 {
6397 exp->expType = op1->type;
6398 if(op1->type)
6399 op1->type->refCount++;
6400 }
6401 return 0x1;
6402 }
6403
6404 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6405 {
6406 float value2 = op2->f;
6407
6408 exp->type = 2;
6409 exp->string = PrintFloat(op1->f += value2);
6410 if(!exp->expType)
6411 {
6412 exp->expType = op1->type;
6413 if(op1->type)
6414 op1->type->refCount++;
6415 }
6416 return 0x1;
6417 }
6418
6419 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6420 {
6421 double value2 = op2->d;
6422
6423 exp->type = 2;
6424 exp->string = PrintDouble(op1->d += value2);
6425 if(!exp->expType)
6426 {
6427 exp->expType = op1->type;
6428 if(op1->type)
6429 op1->type->refCount++;
6430 }
6431 return 0x1;
6432 }
6433
6434 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6435 {
6436 int value2 = op2->i;
6437
6438 exp->type = 2;
6439 exp->string = PrintInt(op1->i -= value2);
6440 if(!exp->expType)
6441 {
6442 exp->expType = op1->type;
6443 if(op1->type)
6444 op1->type->refCount++;
6445 }
6446 return 0x1;
6447 }
6448
6449 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6450 {
6451 unsigned int value2 = op2->ui;
6452
6453 exp->type = 2;
6454 exp->string = PrintUInt(op1->ui -= value2);
6455 if(!exp->expType)
6456 {
6457 exp->expType = op1->type;
6458 if(op1->type)
6459 op1->type->refCount++;
6460 }
6461 return 0x1;
6462 }
6463
6464 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6465 {
6466 short value2 = op2->s;
6467
6468 exp->type = 2;
6469 exp->string = PrintShort(op1->s -= value2);
6470 if(!exp->expType)
6471 {
6472 exp->expType = op1->type;
6473 if(op1->type)
6474 op1->type->refCount++;
6475 }
6476 return 0x1;
6477 }
6478
6479 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6480 {
6481 unsigned short value2 = op2->us;
6482
6483 exp->type = 2;
6484 exp->string = PrintUShort(op1->us -= value2);
6485 if(!exp->expType)
6486 {
6487 exp->expType = op1->type;
6488 if(op1->type)
6489 op1->type->refCount++;
6490 }
6491 return 0x1;
6492 }
6493
6494 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6495 {
6496 char value2 = op2->c;
6497
6498 exp->type = 2;
6499 exp->string = PrintChar(op1->c -= value2);
6500 if(!exp->expType)
6501 {
6502 exp->expType = op1->type;
6503 if(op1->type)
6504 op1->type->refCount++;
6505 }
6506 return 0x1;
6507 }
6508
6509 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6510 {
6511 unsigned char value2 = op2->uc;
6512
6513 exp->type = 2;
6514 exp->string = PrintUChar(op1->uc -= value2);
6515 if(!exp->expType)
6516 {
6517 exp->expType = op1->type;
6518 if(op1->type)
6519 op1->type->refCount++;
6520 }
6521 return 0x1;
6522 }
6523
6524 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6525 {
6526 float value2 = op2->f;
6527
6528 exp->type = 2;
6529 exp->string = PrintFloat(op1->f -= value2);
6530 if(!exp->expType)
6531 {
6532 exp->expType = op1->type;
6533 if(op1->type)
6534 op1->type->refCount++;
6535 }
6536 return 0x1;
6537 }
6538
6539 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6540 {
6541 double value2 = op2->d;
6542
6543 exp->type = 2;
6544 exp->string = PrintDouble(op1->d -= value2);
6545 if(!exp->expType)
6546 {
6547 exp->expType = op1->type;
6548 if(op1->type)
6549 op1->type->refCount++;
6550 }
6551 return 0x1;
6552 }
6553
6554 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6555 {
6556 int value2 = op2->i;
6557
6558 exp->type = 2;
6559 exp->string = PrintInt(op1->i *= value2);
6560 if(!exp->expType)
6561 {
6562 exp->expType = op1->type;
6563 if(op1->type)
6564 op1->type->refCount++;
6565 }
6566 return 0x1;
6567 }
6568
6569 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6570 {
6571 unsigned int value2 = op2->ui;
6572
6573 exp->type = 2;
6574 exp->string = PrintUInt(op1->ui *= value2);
6575 if(!exp->expType)
6576 {
6577 exp->expType = op1->type;
6578 if(op1->type)
6579 op1->type->refCount++;
6580 }
6581 return 0x1;
6582 }
6583
6584 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6585 {
6586 short value2 = op2->s;
6587
6588 exp->type = 2;
6589 exp->string = PrintShort(op1->s *= value2);
6590 if(!exp->expType)
6591 {
6592 exp->expType = op1->type;
6593 if(op1->type)
6594 op1->type->refCount++;
6595 }
6596 return 0x1;
6597 }
6598
6599 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6600 {
6601 unsigned short value2 = op2->us;
6602
6603 exp->type = 2;
6604 exp->string = PrintUShort(op1->us *= value2);
6605 if(!exp->expType)
6606 {
6607 exp->expType = op1->type;
6608 if(op1->type)
6609 op1->type->refCount++;
6610 }
6611 return 0x1;
6612 }
6613
6614 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6615 {
6616 char value2 = op2->c;
6617
6618 exp->type = 2;
6619 exp->string = PrintChar(op1->c *= value2);
6620 if(!exp->expType)
6621 {
6622 exp->expType = op1->type;
6623 if(op1->type)
6624 op1->type->refCount++;
6625 }
6626 return 0x1;
6627 }
6628
6629 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6630 {
6631 unsigned char value2 = op2->uc;
6632
6633 exp->type = 2;
6634 exp->string = PrintUChar(op1->uc *= value2);
6635 if(!exp->expType)
6636 {
6637 exp->expType = op1->type;
6638 if(op1->type)
6639 op1->type->refCount++;
6640 }
6641 return 0x1;
6642 }
6643
6644 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6645 {
6646 float value2 = op2->f;
6647
6648 exp->type = 2;
6649 exp->string = PrintFloat(op1->f *= value2);
6650 if(!exp->expType)
6651 {
6652 exp->expType = op1->type;
6653 if(op1->type)
6654 op1->type->refCount++;
6655 }
6656 return 0x1;
6657 }
6658
6659 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6660 {
6661 double value2 = op2->d;
6662
6663 exp->type = 2;
6664 exp->string = PrintDouble(op1->d *= value2);
6665 if(!exp->expType)
6666 {
6667 exp->expType = op1->type;
6668 if(op1->type)
6669 op1->type->refCount++;
6670 }
6671 return 0x1;
6672 }
6673
6674 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6675 {
6676 int value2 = op2->i;
6677
6678 exp->type = 2;
6679 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6680 if(!exp->expType)
6681 {
6682 exp->expType = op1->type;
6683 if(op1->type)
6684 op1->type->refCount++;
6685 }
6686 return 0x1;
6687 }
6688
6689 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6690 {
6691 unsigned int value2 = op2->ui;
6692
6693 exp->type = 2;
6694 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6695 if(!exp->expType)
6696 {
6697 exp->expType = op1->type;
6698 if(op1->type)
6699 op1->type->refCount++;
6700 }
6701 return 0x1;
6702 }
6703
6704 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6705 {
6706 short value2 = op2->s;
6707
6708 exp->type = 2;
6709 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6710 if(!exp->expType)
6711 {
6712 exp->expType = op1->type;
6713 if(op1->type)
6714 op1->type->refCount++;
6715 }
6716 return 0x1;
6717 }
6718
6719 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6720 {
6721 unsigned short value2 = op2->us;
6722
6723 exp->type = 2;
6724 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6725 if(!exp->expType)
6726 {
6727 exp->expType = op1->type;
6728 if(op1->type)
6729 op1->type->refCount++;
6730 }
6731 return 0x1;
6732 }
6733
6734 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6735 {
6736 char value2 = op2->c;
6737
6738 exp->type = 2;
6739 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6740 if(!exp->expType)
6741 {
6742 exp->expType = op1->type;
6743 if(op1->type)
6744 op1->type->refCount++;
6745 }
6746 return 0x1;
6747 }
6748
6749 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6750 {
6751 unsigned char value2 = op2->uc;
6752
6753 exp->type = 2;
6754 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6755 if(!exp->expType)
6756 {
6757 exp->expType = op1->type;
6758 if(op1->type)
6759 op1->type->refCount++;
6760 }
6761 return 0x1;
6762 }
6763
6764 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6765 {
6766 float value2 = op2->f;
6767
6768 exp->type = 2;
6769 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
6770 if(!exp->expType)
6771 {
6772 exp->expType = op1->type;
6773 if(op1->type)
6774 op1->type->refCount++;
6775 }
6776 return 0x1;
6777 }
6778
6779 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6780 {
6781 double value2 = op2->d;
6782
6783 exp->type = 2;
6784 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
6785 if(!exp->expType)
6786 {
6787 exp->expType = op1->type;
6788 if(op1->type)
6789 op1->type->refCount++;
6790 }
6791 return 0x1;
6792 }
6793
6794 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6795 {
6796 int value2 = op2->i;
6797
6798 exp->type = 2;
6799 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
6800 if(!exp->expType)
6801 {
6802 exp->expType = op1->type;
6803 if(op1->type)
6804 op1->type->refCount++;
6805 }
6806 return 0x1;
6807 }
6808
6809 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6810 {
6811 unsigned int value2 = op2->ui;
6812
6813 exp->type = 2;
6814 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
6815 if(!exp->expType)
6816 {
6817 exp->expType = op1->type;
6818 if(op1->type)
6819 op1->type->refCount++;
6820 }
6821 return 0x1;
6822 }
6823
6824 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6825 {
6826 short value2 = op2->s;
6827
6828 exp->type = 2;
6829 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
6830 if(!exp->expType)
6831 {
6832 exp->expType = op1->type;
6833 if(op1->type)
6834 op1->type->refCount++;
6835 }
6836 return 0x1;
6837 }
6838
6839 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6840 {
6841 unsigned short value2 = op2->us;
6842
6843 exp->type = 2;
6844 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
6845 if(!exp->expType)
6846 {
6847 exp->expType = op1->type;
6848 if(op1->type)
6849 op1->type->refCount++;
6850 }
6851 return 0x1;
6852 }
6853
6854 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6855 {
6856 char value2 = op2->c;
6857
6858 exp->type = 2;
6859 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
6860 if(!exp->expType)
6861 {
6862 exp->expType = op1->type;
6863 if(op1->type)
6864 op1->type->refCount++;
6865 }
6866 return 0x1;
6867 }
6868
6869 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6870 {
6871 unsigned char value2 = op2->uc;
6872
6873 exp->type = 2;
6874 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
6875 if(!exp->expType)
6876 {
6877 exp->expType = op1->type;
6878 if(op1->type)
6879 op1->type->refCount++;
6880 }
6881 return 0x1;
6882 }
6883
6884 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6885 {
6886 int value2 = op2->i;
6887
6888 exp->type = 2;
6889 exp->string = PrintInt(op1->i & value2);
6890 if(!exp->expType)
6891 {
6892 exp->expType = op1->type;
6893 if(op1->type)
6894 op1->type->refCount++;
6895 }
6896 return 0x1;
6897 }
6898
6899 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6900 {
6901 unsigned int value2 = op2->ui;
6902
6903 exp->type = 2;
6904 exp->string = PrintUInt(op1->ui & value2);
6905 if(!exp->expType)
6906 {
6907 exp->expType = op1->type;
6908 if(op1->type)
6909 op1->type->refCount++;
6910 }
6911 return 0x1;
6912 }
6913
6914 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6915 {
6916 short value2 = op2->s;
6917
6918 exp->type = 2;
6919 exp->string = PrintShort(op1->s & value2);
6920 if(!exp->expType)
6921 {
6922 exp->expType = op1->type;
6923 if(op1->type)
6924 op1->type->refCount++;
6925 }
6926 return 0x1;
6927 }
6928
6929 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6930 {
6931 unsigned short value2 = op2->us;
6932
6933 exp->type = 2;
6934 exp->string = PrintUShort(op1->us & value2);
6935 if(!exp->expType)
6936 {
6937 exp->expType = op1->type;
6938 if(op1->type)
6939 op1->type->refCount++;
6940 }
6941 return 0x1;
6942 }
6943
6944 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6945 {
6946 char value2 = op2->c;
6947
6948 exp->type = 2;
6949 exp->string = PrintChar(op1->c & value2);
6950 if(!exp->expType)
6951 {
6952 exp->expType = op1->type;
6953 if(op1->type)
6954 op1->type->refCount++;
6955 }
6956 return 0x1;
6957 }
6958
6959 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6960 {
6961 unsigned char value2 = op2->uc;
6962
6963 exp->type = 2;
6964 exp->string = PrintUChar(op1->uc & value2);
6965 if(!exp->expType)
6966 {
6967 exp->expType = op1->type;
6968 if(op1->type)
6969 op1->type->refCount++;
6970 }
6971 return 0x1;
6972 }
6973
6974 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6975 {
6976 int value2 = op2->i;
6977
6978 exp->type = 2;
6979 exp->string = PrintInt(op1->i | value2);
6980 if(!exp->expType)
6981 {
6982 exp->expType = op1->type;
6983 if(op1->type)
6984 op1->type->refCount++;
6985 }
6986 return 0x1;
6987 }
6988
6989 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6990 {
6991 unsigned int value2 = op2->ui;
6992
6993 exp->type = 2;
6994 exp->string = PrintUInt(op1->ui | value2);
6995 if(!exp->expType)
6996 {
6997 exp->expType = op1->type;
6998 if(op1->type)
6999 op1->type->refCount++;
7000 }
7001 return 0x1;
7002 }
7003
7004 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7005 {
7006 short value2 = op2->s;
7007
7008 exp->type = 2;
7009 exp->string = PrintShort(op1->s | value2);
7010 if(!exp->expType)
7011 {
7012 exp->expType = op1->type;
7013 if(op1->type)
7014 op1->type->refCount++;
7015 }
7016 return 0x1;
7017 }
7018
7019 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7020 {
7021 unsigned short value2 = op2->us;
7022
7023 exp->type = 2;
7024 exp->string = PrintUShort(op1->us | value2);
7025 if(!exp->expType)
7026 {
7027 exp->expType = op1->type;
7028 if(op1->type)
7029 op1->type->refCount++;
7030 }
7031 return 0x1;
7032 }
7033
7034 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7035 {
7036 char value2 = op2->c;
7037
7038 exp->type = 2;
7039 exp->string = PrintChar(op1->c | value2);
7040 if(!exp->expType)
7041 {
7042 exp->expType = op1->type;
7043 if(op1->type)
7044 op1->type->refCount++;
7045 }
7046 return 0x1;
7047 }
7048
7049 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7050 {
7051 unsigned char value2 = op2->uc;
7052
7053 exp->type = 2;
7054 exp->string = PrintUChar(op1->uc | value2);
7055 if(!exp->expType)
7056 {
7057 exp->expType = op1->type;
7058 if(op1->type)
7059 op1->type->refCount++;
7060 }
7061 return 0x1;
7062 }
7063
7064 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7065 {
7066 int value2 = op2->i;
7067
7068 exp->type = 2;
7069 exp->string = PrintInt(op1->i ^ value2);
7070 if(!exp->expType)
7071 {
7072 exp->expType = op1->type;
7073 if(op1->type)
7074 op1->type->refCount++;
7075 }
7076 return 0x1;
7077 }
7078
7079 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7080 {
7081 unsigned int value2 = op2->ui;
7082
7083 exp->type = 2;
7084 exp->string = PrintUInt(op1->ui ^ value2);
7085 if(!exp->expType)
7086 {
7087 exp->expType = op1->type;
7088 if(op1->type)
7089 op1->type->refCount++;
7090 }
7091 return 0x1;
7092 }
7093
7094 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7095 {
7096 short value2 = op2->s;
7097
7098 exp->type = 2;
7099 exp->string = PrintShort(op1->s ^ value2);
7100 if(!exp->expType)
7101 {
7102 exp->expType = op1->type;
7103 if(op1->type)
7104 op1->type->refCount++;
7105 }
7106 return 0x1;
7107 }
7108
7109 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7110 {
7111 unsigned short value2 = op2->us;
7112
7113 exp->type = 2;
7114 exp->string = PrintUShort(op1->us ^ value2);
7115 if(!exp->expType)
7116 {
7117 exp->expType = op1->type;
7118 if(op1->type)
7119 op1->type->refCount++;
7120 }
7121 return 0x1;
7122 }
7123
7124 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7125 {
7126 char value2 = op2->c;
7127
7128 exp->type = 2;
7129 exp->string = PrintChar(op1->c ^ value2);
7130 if(!exp->expType)
7131 {
7132 exp->expType = op1->type;
7133 if(op1->type)
7134 op1->type->refCount++;
7135 }
7136 return 0x1;
7137 }
7138
7139 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7140 {
7141 unsigned char value2 = op2->uc;
7142
7143 exp->type = 2;
7144 exp->string = PrintUChar(op1->uc ^ value2);
7145 if(!exp->expType)
7146 {
7147 exp->expType = op1->type;
7148 if(op1->type)
7149 op1->type->refCount++;
7150 }
7151 return 0x1;
7152 }
7153
7154 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7155 {
7156 int value2 = op2->i;
7157
7158 exp->type = 2;
7159 exp->string = PrintInt(op1->i << value2);
7160 if(!exp->expType)
7161 {
7162 exp->expType = op1->type;
7163 if(op1->type)
7164 op1->type->refCount++;
7165 }
7166 return 0x1;
7167 }
7168
7169 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7170 {
7171 unsigned int value2 = op2->ui;
7172
7173 exp->type = 2;
7174 exp->string = PrintUInt(op1->ui << value2);
7175 if(!exp->expType)
7176 {
7177 exp->expType = op1->type;
7178 if(op1->type)
7179 op1->type->refCount++;
7180 }
7181 return 0x1;
7182 }
7183
7184 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7185 {
7186 short value2 = op2->s;
7187
7188 exp->type = 2;
7189 exp->string = PrintShort(op1->s << value2);
7190 if(!exp->expType)
7191 {
7192 exp->expType = op1->type;
7193 if(op1->type)
7194 op1->type->refCount++;
7195 }
7196 return 0x1;
7197 }
7198
7199 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7200 {
7201 unsigned short value2 = op2->us;
7202
7203 exp->type = 2;
7204 exp->string = PrintUShort(op1->us << value2);
7205 if(!exp->expType)
7206 {
7207 exp->expType = op1->type;
7208 if(op1->type)
7209 op1->type->refCount++;
7210 }
7211 return 0x1;
7212 }
7213
7214 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7215 {
7216 char value2 = op2->c;
7217
7218 exp->type = 2;
7219 exp->string = PrintChar(op1->c << value2);
7220 if(!exp->expType)
7221 {
7222 exp->expType = op1->type;
7223 if(op1->type)
7224 op1->type->refCount++;
7225 }
7226 return 0x1;
7227 }
7228
7229 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7230 {
7231 unsigned char value2 = op2->uc;
7232
7233 exp->type = 2;
7234 exp->string = PrintUChar(op1->uc << value2);
7235 if(!exp->expType)
7236 {
7237 exp->expType = op1->type;
7238 if(op1->type)
7239 op1->type->refCount++;
7240 }
7241 return 0x1;
7242 }
7243
7244 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7245 {
7246 int value2 = op2->i;
7247
7248 exp->type = 2;
7249 exp->string = PrintInt(op1->i >> value2);
7250 if(!exp->expType)
7251 {
7252 exp->expType = op1->type;
7253 if(op1->type)
7254 op1->type->refCount++;
7255 }
7256 return 0x1;
7257 }
7258
7259 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7260 {
7261 unsigned int value2 = op2->ui;
7262
7263 exp->type = 2;
7264 exp->string = PrintUInt(op1->ui >> value2);
7265 if(!exp->expType)
7266 {
7267 exp->expType = op1->type;
7268 if(op1->type)
7269 op1->type->refCount++;
7270 }
7271 return 0x1;
7272 }
7273
7274 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7275 {
7276 short value2 = op2->s;
7277
7278 exp->type = 2;
7279 exp->string = PrintShort(op1->s >> value2);
7280 if(!exp->expType)
7281 {
7282 exp->expType = op1->type;
7283 if(op1->type)
7284 op1->type->refCount++;
7285 }
7286 return 0x1;
7287 }
7288
7289 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7290 {
7291 unsigned short value2 = op2->us;
7292
7293 exp->type = 2;
7294 exp->string = PrintUShort(op1->us >> value2);
7295 if(!exp->expType)
7296 {
7297 exp->expType = op1->type;
7298 if(op1->type)
7299 op1->type->refCount++;
7300 }
7301 return 0x1;
7302 }
7303
7304 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7305 {
7306 char value2 = op2->c;
7307
7308 exp->type = 2;
7309 exp->string = PrintChar(op1->c >> value2);
7310 if(!exp->expType)
7311 {
7312 exp->expType = op1->type;
7313 if(op1->type)
7314 op1->type->refCount++;
7315 }
7316 return 0x1;
7317 }
7318
7319 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7320 {
7321 unsigned char value2 = op2->uc;
7322
7323 exp->type = 2;
7324 exp->string = PrintUChar(op1->uc >> value2);
7325 if(!exp->expType)
7326 {
7327 exp->expType = op1->type;
7328 if(op1->type)
7329 op1->type->refCount++;
7330 }
7331 return 0x1;
7332 }
7333
7334 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7335 {
7336 exp->type = 2;
7337 exp->string = PrintInt(~op1->i);
7338 if(!exp->expType)
7339 {
7340 exp->expType = op1->type;
7341 if(op1->type)
7342 op1->type->refCount++;
7343 }
7344 return 0x1;
7345 }
7346
7347 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7348 {
7349 exp->type = 2;
7350 exp->string = PrintUInt(~op1->ui);
7351 if(!exp->expType)
7352 {
7353 exp->expType = op1->type;
7354 if(op1->type)
7355 op1->type->refCount++;
7356 }
7357 return 0x1;
7358 }
7359
7360 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7361 {
7362 exp->type = 2;
7363 exp->string = PrintShort(~op1->s);
7364 if(!exp->expType)
7365 {
7366 exp->expType = op1->type;
7367 if(op1->type)
7368 op1->type->refCount++;
7369 }
7370 return 0x1;
7371 }
7372
7373 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7374 {
7375 exp->type = 2;
7376 exp->string = PrintUShort(~op1->us);
7377 if(!exp->expType)
7378 {
7379 exp->expType = op1->type;
7380 if(op1->type)
7381 op1->type->refCount++;
7382 }
7383 return 0x1;
7384 }
7385
7386 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7387 {
7388 exp->type = 2;
7389 exp->string = PrintChar(~op1->c);
7390 if(!exp->expType)
7391 {
7392 exp->expType = op1->type;
7393 if(op1->type)
7394 op1->type->refCount++;
7395 }
7396 return 0x1;
7397 }
7398
7399 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7400 {
7401 exp->type = 2;
7402 exp->string = PrintUChar(~op1->uc);
7403 if(!exp->expType)
7404 {
7405 exp->expType = op1->type;
7406 if(op1->type)
7407 op1->type->refCount++;
7408 }
7409 return 0x1;
7410 }
7411
7412 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7413 {
7414 int value2 = op2->i;
7415
7416 exp->type = 2;
7417 exp->string = PrintInt(op1->i &= value2);
7418 if(!exp->expType)
7419 {
7420 exp->expType = op1->type;
7421 if(op1->type)
7422 op1->type->refCount++;
7423 }
7424 return 0x1;
7425 }
7426
7427 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7428 {
7429 unsigned int value2 = op2->ui;
7430
7431 exp->type = 2;
7432 exp->string = PrintUInt(op1->ui &= value2);
7433 if(!exp->expType)
7434 {
7435 exp->expType = op1->type;
7436 if(op1->type)
7437 op1->type->refCount++;
7438 }
7439 return 0x1;
7440 }
7441
7442 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7443 {
7444 short value2 = op2->s;
7445
7446 exp->type = 2;
7447 exp->string = PrintShort(op1->s &= value2);
7448 if(!exp->expType)
7449 {
7450 exp->expType = op1->type;
7451 if(op1->type)
7452 op1->type->refCount++;
7453 }
7454 return 0x1;
7455 }
7456
7457 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7458 {
7459 unsigned short value2 = op2->us;
7460
7461 exp->type = 2;
7462 exp->string = PrintUShort(op1->us &= value2);
7463 if(!exp->expType)
7464 {
7465 exp->expType = op1->type;
7466 if(op1->type)
7467 op1->type->refCount++;
7468 }
7469 return 0x1;
7470 }
7471
7472 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7473 {
7474 char value2 = op2->c;
7475
7476 exp->type = 2;
7477 exp->string = PrintChar(op1->c &= value2);
7478 if(!exp->expType)
7479 {
7480 exp->expType = op1->type;
7481 if(op1->type)
7482 op1->type->refCount++;
7483 }
7484 return 0x1;
7485 }
7486
7487 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7488 {
7489 unsigned char value2 = op2->uc;
7490
7491 exp->type = 2;
7492 exp->string = PrintUChar(op1->uc &= value2);
7493 if(!exp->expType)
7494 {
7495 exp->expType = op1->type;
7496 if(op1->type)
7497 op1->type->refCount++;
7498 }
7499 return 0x1;
7500 }
7501
7502 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7503 {
7504 int value2 = op2->i;
7505
7506 exp->type = 2;
7507 exp->string = PrintInt(op1->i |= value2);
7508 if(!exp->expType)
7509 {
7510 exp->expType = op1->type;
7511 if(op1->type)
7512 op1->type->refCount++;
7513 }
7514 return 0x1;
7515 }
7516
7517 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7518 {
7519 unsigned int value2 = op2->ui;
7520
7521 exp->type = 2;
7522 exp->string = PrintUInt(op1->ui |= value2);
7523 if(!exp->expType)
7524 {
7525 exp->expType = op1->type;
7526 if(op1->type)
7527 op1->type->refCount++;
7528 }
7529 return 0x1;
7530 }
7531
7532 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7533 {
7534 short value2 = op2->s;
7535
7536 exp->type = 2;
7537 exp->string = PrintShort(op1->s |= value2);
7538 if(!exp->expType)
7539 {
7540 exp->expType = op1->type;
7541 if(op1->type)
7542 op1->type->refCount++;
7543 }
7544 return 0x1;
7545 }
7546
7547 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7548 {
7549 unsigned short value2 = op2->us;
7550
7551 exp->type = 2;
7552 exp->string = PrintUShort(op1->us |= value2);
7553 if(!exp->expType)
7554 {
7555 exp->expType = op1->type;
7556 if(op1->type)
7557 op1->type->refCount++;
7558 }
7559 return 0x1;
7560 }
7561
7562 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7563 {
7564 char value2 = op2->c;
7565
7566 exp->type = 2;
7567 exp->string = PrintChar(op1->c |= value2);
7568 if(!exp->expType)
7569 {
7570 exp->expType = op1->type;
7571 if(op1->type)
7572 op1->type->refCount++;
7573 }
7574 return 0x1;
7575 }
7576
7577 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7578 {
7579 unsigned char value2 = op2->uc;
7580
7581 exp->type = 2;
7582 exp->string = PrintUChar(op1->uc |= value2);
7583 if(!exp->expType)
7584 {
7585 exp->expType = op1->type;
7586 if(op1->type)
7587 op1->type->refCount++;
7588 }
7589 return 0x1;
7590 }
7591
7592 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7593 {
7594 int value2 = op2->i;
7595
7596 exp->type = 2;
7597 exp->string = PrintInt(op1->i ^= value2);
7598 if(!exp->expType)
7599 {
7600 exp->expType = op1->type;
7601 if(op1->type)
7602 op1->type->refCount++;
7603 }
7604 return 0x1;
7605 }
7606
7607 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7608 {
7609 unsigned int value2 = op2->ui;
7610
7611 exp->type = 2;
7612 exp->string = PrintUInt(op1->ui ^= value2);
7613 if(!exp->expType)
7614 {
7615 exp->expType = op1->type;
7616 if(op1->type)
7617 op1->type->refCount++;
7618 }
7619 return 0x1;
7620 }
7621
7622 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7623 {
7624 short value2 = op2->s;
7625
7626 exp->type = 2;
7627 exp->string = PrintShort(op1->s ^= value2);
7628 if(!exp->expType)
7629 {
7630 exp->expType = op1->type;
7631 if(op1->type)
7632 op1->type->refCount++;
7633 }
7634 return 0x1;
7635 }
7636
7637 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7638 {
7639 unsigned short value2 = op2->us;
7640
7641 exp->type = 2;
7642 exp->string = PrintUShort(op1->us ^= value2);
7643 if(!exp->expType)
7644 {
7645 exp->expType = op1->type;
7646 if(op1->type)
7647 op1->type->refCount++;
7648 }
7649 return 0x1;
7650 }
7651
7652 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7653 {
7654 char value2 = op2->c;
7655
7656 exp->type = 2;
7657 exp->string = PrintChar(op1->c ^= value2);
7658 if(!exp->expType)
7659 {
7660 exp->expType = op1->type;
7661 if(op1->type)
7662 op1->type->refCount++;
7663 }
7664 return 0x1;
7665 }
7666
7667 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7668 {
7669 unsigned char value2 = op2->uc;
7670
7671 exp->type = 2;
7672 exp->string = PrintUChar(op1->uc ^= value2);
7673 if(!exp->expType)
7674 {
7675 exp->expType = op1->type;
7676 if(op1->type)
7677 op1->type->refCount++;
7678 }
7679 return 0x1;
7680 }
7681
7682 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7683 {
7684 int value2 = op2->i;
7685
7686 exp->type = 2;
7687 exp->string = PrintInt(op1->i <<= value2);
7688 if(!exp->expType)
7689 {
7690 exp->expType = op1->type;
7691 if(op1->type)
7692 op1->type->refCount++;
7693 }
7694 return 0x1;
7695 }
7696
7697 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7698 {
7699 unsigned int value2 = op2->ui;
7700
7701 exp->type = 2;
7702 exp->string = PrintUInt(op1->ui <<= value2);
7703 if(!exp->expType)
7704 {
7705 exp->expType = op1->type;
7706 if(op1->type)
7707 op1->type->refCount++;
7708 }
7709 return 0x1;
7710 }
7711
7712 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7713 {
7714 short value2 = op2->s;
7715
7716 exp->type = 2;
7717 exp->string = PrintShort(op1->s <<= value2);
7718 if(!exp->expType)
7719 {
7720 exp->expType = op1->type;
7721 if(op1->type)
7722 op1->type->refCount++;
7723 }
7724 return 0x1;
7725 }
7726
7727 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7728 {
7729 unsigned short value2 = op2->us;
7730
7731 exp->type = 2;
7732 exp->string = PrintUShort(op1->us <<= value2);
7733 if(!exp->expType)
7734 {
7735 exp->expType = op1->type;
7736 if(op1->type)
7737 op1->type->refCount++;
7738 }
7739 return 0x1;
7740 }
7741
7742 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7743 {
7744 char value2 = op2->c;
7745
7746 exp->type = 2;
7747 exp->string = PrintChar(op1->c <<= value2);
7748 if(!exp->expType)
7749 {
7750 exp->expType = op1->type;
7751 if(op1->type)
7752 op1->type->refCount++;
7753 }
7754 return 0x1;
7755 }
7756
7757 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7758 {
7759 unsigned char value2 = op2->uc;
7760
7761 exp->type = 2;
7762 exp->string = PrintUChar(op1->uc <<= value2);
7763 if(!exp->expType)
7764 {
7765 exp->expType = op1->type;
7766 if(op1->type)
7767 op1->type->refCount++;
7768 }
7769 return 0x1;
7770 }
7771
7772 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7773 {
7774 int value2 = op2->i;
7775
7776 exp->type = 2;
7777 exp->string = PrintInt(op1->i >>= value2);
7778 if(!exp->expType)
7779 {
7780 exp->expType = op1->type;
7781 if(op1->type)
7782 op1->type->refCount++;
7783 }
7784 return 0x1;
7785 }
7786
7787 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7788 {
7789 unsigned int value2 = op2->ui;
7790
7791 exp->type = 2;
7792 exp->string = PrintUInt(op1->ui >>= value2);
7793 if(!exp->expType)
7794 {
7795 exp->expType = op1->type;
7796 if(op1->type)
7797 op1->type->refCount++;
7798 }
7799 return 0x1;
7800 }
7801
7802 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7803 {
7804 short value2 = op2->s;
7805
7806 exp->type = 2;
7807 exp->string = PrintShort(op1->s >>= value2);
7808 if(!exp->expType)
7809 {
7810 exp->expType = op1->type;
7811 if(op1->type)
7812 op1->type->refCount++;
7813 }
7814 return 0x1;
7815 }
7816
7817 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7818 {
7819 unsigned short value2 = op2->us;
7820
7821 exp->type = 2;
7822 exp->string = PrintUShort(op1->us >>= value2);
7823 if(!exp->expType)
7824 {
7825 exp->expType = op1->type;
7826 if(op1->type)
7827 op1->type->refCount++;
7828 }
7829 return 0x1;
7830 }
7831
7832 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7833 {
7834 char value2 = op2->c;
7835
7836 exp->type = 2;
7837 exp->string = PrintChar(op1->c >>= value2);
7838 if(!exp->expType)
7839 {
7840 exp->expType = op1->type;
7841 if(op1->type)
7842 op1->type->refCount++;
7843 }
7844 return 0x1;
7845 }
7846
7847 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7848 {
7849 unsigned char value2 = op2->uc;
7850
7851 exp->type = 2;
7852 exp->string = PrintUChar(op1->uc >>= value2);
7853 if(!exp->expType)
7854 {
7855 exp->expType = op1->type;
7856 if(op1->type)
7857 op1->type->refCount++;
7858 }
7859 return 0x1;
7860 }
7861
7862 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
7863 {
7864 exp->type = 2;
7865 exp->string = PrintInt(!op1->i);
7866 if(!exp->expType)
7867 {
7868 exp->expType = op1->type;
7869 if(op1->type)
7870 op1->type->refCount++;
7871 }
7872 return 0x1;
7873 }
7874
7875 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
7876 {
7877 exp->type = 2;
7878 exp->string = PrintUInt(!op1->ui);
7879 if(!exp->expType)
7880 {
7881 exp->expType = op1->type;
7882 if(op1->type)
7883 op1->type->refCount++;
7884 }
7885 return 0x1;
7886 }
7887
7888 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
7889 {
7890 exp->type = 2;
7891 exp->string = PrintShort(!op1->s);
7892 if(!exp->expType)
7893 {
7894 exp->expType = op1->type;
7895 if(op1->type)
7896 op1->type->refCount++;
7897 }
7898 return 0x1;
7899 }
7900
7901 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
7902 {
7903 exp->type = 2;
7904 exp->string = PrintUShort(!op1->us);
7905 if(!exp->expType)
7906 {
7907 exp->expType = op1->type;
7908 if(op1->type)
7909 op1->type->refCount++;
7910 }
7911 return 0x1;
7912 }
7913
7914 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
7915 {
7916 exp->type = 2;
7917 exp->string = PrintChar(!op1->c);
7918 if(!exp->expType)
7919 {
7920 exp->expType = op1->type;
7921 if(op1->type)
7922 op1->type->refCount++;
7923 }
7924 return 0x1;
7925 }
7926
7927 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
7928 {
7929 exp->type = 2;
7930 exp->string = PrintUChar(!op1->uc);
7931 if(!exp->expType)
7932 {
7933 exp->expType = op1->type;
7934 if(op1->type)
7935 op1->type->refCount++;
7936 }
7937 return 0x1;
7938 }
7939
7940 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7941 {
7942 int value2 = op2->i;
7943
7944 exp->type = 2;
7945 exp->string = PrintInt(op1->i == value2);
7946 if(!exp->expType)
7947 {
7948 exp->expType = op1->type;
7949 if(op1->type)
7950 op1->type->refCount++;
7951 }
7952 return 0x1;
7953 }
7954
7955 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7956 {
7957 unsigned int value2 = op2->ui;
7958
7959 exp->type = 2;
7960 exp->string = PrintUInt(op1->ui == value2);
7961 if(!exp->expType)
7962 {
7963 exp->expType = op1->type;
7964 if(op1->type)
7965 op1->type->refCount++;
7966 }
7967 return 0x1;
7968 }
7969
7970 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7971 {
7972 short value2 = op2->s;
7973
7974 exp->type = 2;
7975 exp->string = PrintShort(op1->s == value2);
7976 if(!exp->expType)
7977 {
7978 exp->expType = op1->type;
7979 if(op1->type)
7980 op1->type->refCount++;
7981 }
7982 return 0x1;
7983 }
7984
7985 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7986 {
7987 unsigned short value2 = op2->us;
7988
7989 exp->type = 2;
7990 exp->string = PrintUShort(op1->us == value2);
7991 if(!exp->expType)
7992 {
7993 exp->expType = op1->type;
7994 if(op1->type)
7995 op1->type->refCount++;
7996 }
7997 return 0x1;
7998 }
7999
8000 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8001 {
8002 char value2 = op2->c;
8003
8004 exp->type = 2;
8005 exp->string = PrintChar(op1->c == value2);
8006 if(!exp->expType)
8007 {
8008 exp->expType = op1->type;
8009 if(op1->type)
8010 op1->type->refCount++;
8011 }
8012 return 0x1;
8013 }
8014
8015 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8016 {
8017 unsigned char value2 = op2->uc;
8018
8019 exp->type = 2;
8020 exp->string = PrintUChar(op1->uc == value2);
8021 if(!exp->expType)
8022 {
8023 exp->expType = op1->type;
8024 if(op1->type)
8025 op1->type->refCount++;
8026 }
8027 return 0x1;
8028 }
8029
8030 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8031 {
8032 float value2 = op2->f;
8033
8034 exp->type = 2;
8035 exp->string = PrintFloat(op1->f == value2);
8036 if(!exp->expType)
8037 {
8038 exp->expType = op1->type;
8039 if(op1->type)
8040 op1->type->refCount++;
8041 }
8042 return 0x1;
8043 }
8044
8045 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8046 {
8047 double value2 = op2->d;
8048
8049 exp->type = 2;
8050 exp->string = PrintDouble(op1->d == value2);
8051 if(!exp->expType)
8052 {
8053 exp->expType = op1->type;
8054 if(op1->type)
8055 op1->type->refCount++;
8056 }
8057 return 0x1;
8058 }
8059
8060 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8061 {
8062 int value2 = op2->i;
8063
8064 exp->type = 2;
8065 exp->string = PrintInt(op1->i != value2);
8066 if(!exp->expType)
8067 {
8068 exp->expType = op1->type;
8069 if(op1->type)
8070 op1->type->refCount++;
8071 }
8072 return 0x1;
8073 }
8074
8075 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8076 {
8077 unsigned int value2 = op2->ui;
8078
8079 exp->type = 2;
8080 exp->string = PrintUInt(op1->ui != value2);
8081 if(!exp->expType)
8082 {
8083 exp->expType = op1->type;
8084 if(op1->type)
8085 op1->type->refCount++;
8086 }
8087 return 0x1;
8088 }
8089
8090 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8091 {
8092 short value2 = op2->s;
8093
8094 exp->type = 2;
8095 exp->string = PrintShort(op1->s != value2);
8096 if(!exp->expType)
8097 {
8098 exp->expType = op1->type;
8099 if(op1->type)
8100 op1->type->refCount++;
8101 }
8102 return 0x1;
8103 }
8104
8105 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8106 {
8107 unsigned short value2 = op2->us;
8108
8109 exp->type = 2;
8110 exp->string = PrintUShort(op1->us != value2);
8111 if(!exp->expType)
8112 {
8113 exp->expType = op1->type;
8114 if(op1->type)
8115 op1->type->refCount++;
8116 }
8117 return 0x1;
8118 }
8119
8120 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8121 {
8122 char value2 = op2->c;
8123
8124 exp->type = 2;
8125 exp->string = PrintChar(op1->c != value2);
8126 if(!exp->expType)
8127 {
8128 exp->expType = op1->type;
8129 if(op1->type)
8130 op1->type->refCount++;
8131 }
8132 return 0x1;
8133 }
8134
8135 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8136 {
8137 unsigned char value2 = op2->uc;
8138
8139 exp->type = 2;
8140 exp->string = PrintUChar(op1->uc != value2);
8141 if(!exp->expType)
8142 {
8143 exp->expType = op1->type;
8144 if(op1->type)
8145 op1->type->refCount++;
8146 }
8147 return 0x1;
8148 }
8149
8150 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8151 {
8152 float value2 = op2->f;
8153
8154 exp->type = 2;
8155 exp->string = PrintFloat(op1->f != value2);
8156 if(!exp->expType)
8157 {
8158 exp->expType = op1->type;
8159 if(op1->type)
8160 op1->type->refCount++;
8161 }
8162 return 0x1;
8163 }
8164
8165 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8166 {
8167 double value2 = op2->d;
8168
8169 exp->type = 2;
8170 exp->string = PrintDouble(op1->d != value2);
8171 if(!exp->expType)
8172 {
8173 exp->expType = op1->type;
8174 if(op1->type)
8175 op1->type->refCount++;
8176 }
8177 return 0x1;
8178 }
8179
8180 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8181 {
8182 int value2 = op2->i;
8183
8184 exp->type = 2;
8185 exp->string = PrintInt(op1->i && value2);
8186 if(!exp->expType)
8187 {
8188 exp->expType = op1->type;
8189 if(op1->type)
8190 op1->type->refCount++;
8191 }
8192 return 0x1;
8193 }
8194
8195 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8196 {
8197 unsigned int value2 = op2->ui;
8198
8199 exp->type = 2;
8200 exp->string = PrintUInt(op1->ui && value2);
8201 if(!exp->expType)
8202 {
8203 exp->expType = op1->type;
8204 if(op1->type)
8205 op1->type->refCount++;
8206 }
8207 return 0x1;
8208 }
8209
8210 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8211 {
8212 short value2 = op2->s;
8213
8214 exp->type = 2;
8215 exp->string = PrintShort(op1->s && value2);
8216 if(!exp->expType)
8217 {
8218 exp->expType = op1->type;
8219 if(op1->type)
8220 op1->type->refCount++;
8221 }
8222 return 0x1;
8223 }
8224
8225 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8226 {
8227 unsigned short value2 = op2->us;
8228
8229 exp->type = 2;
8230 exp->string = PrintUShort(op1->us && value2);
8231 if(!exp->expType)
8232 {
8233 exp->expType = op1->type;
8234 if(op1->type)
8235 op1->type->refCount++;
8236 }
8237 return 0x1;
8238 }
8239
8240 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8241 {
8242 char value2 = op2->c;
8243
8244 exp->type = 2;
8245 exp->string = PrintChar(op1->c && value2);
8246 if(!exp->expType)
8247 {
8248 exp->expType = op1->type;
8249 if(op1->type)
8250 op1->type->refCount++;
8251 }
8252 return 0x1;
8253 }
8254
8255 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8256 {
8257 unsigned char value2 = op2->uc;
8258
8259 exp->type = 2;
8260 exp->string = PrintUChar(op1->uc && value2);
8261 if(!exp->expType)
8262 {
8263 exp->expType = op1->type;
8264 if(op1->type)
8265 op1->type->refCount++;
8266 }
8267 return 0x1;
8268 }
8269
8270 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8271 {
8272 float value2 = op2->f;
8273
8274 exp->type = 2;
8275 exp->string = PrintFloat(op1->f && value2);
8276 if(!exp->expType)
8277 {
8278 exp->expType = op1->type;
8279 if(op1->type)
8280 op1->type->refCount++;
8281 }
8282 return 0x1;
8283 }
8284
8285 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8286 {
8287 double value2 = op2->d;
8288
8289 exp->type = 2;
8290 exp->string = PrintDouble(op1->d && value2);
8291 if(!exp->expType)
8292 {
8293 exp->expType = op1->type;
8294 if(op1->type)
8295 op1->type->refCount++;
8296 }
8297 return 0x1;
8298 }
8299
8300 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8301 {
8302 int value2 = op2->i;
8303
8304 exp->type = 2;
8305 exp->string = PrintInt(op1->i || value2);
8306 if(!exp->expType)
8307 {
8308 exp->expType = op1->type;
8309 if(op1->type)
8310 op1->type->refCount++;
8311 }
8312 return 0x1;
8313 }
8314
8315 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8316 {
8317 unsigned int value2 = op2->ui;
8318
8319 exp->type = 2;
8320 exp->string = PrintUInt(op1->ui || value2);
8321 if(!exp->expType)
8322 {
8323 exp->expType = op1->type;
8324 if(op1->type)
8325 op1->type->refCount++;
8326 }
8327 return 0x1;
8328 }
8329
8330 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8331 {
8332 short value2 = op2->s;
8333
8334 exp->type = 2;
8335 exp->string = PrintShort(op1->s || value2);
8336 if(!exp->expType)
8337 {
8338 exp->expType = op1->type;
8339 if(op1->type)
8340 op1->type->refCount++;
8341 }
8342 return 0x1;
8343 }
8344
8345 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8346 {
8347 unsigned short value2 = op2->us;
8348
8349 exp->type = 2;
8350 exp->string = PrintUShort(op1->us || value2);
8351 if(!exp->expType)
8352 {
8353 exp->expType = op1->type;
8354 if(op1->type)
8355 op1->type->refCount++;
8356 }
8357 return 0x1;
8358 }
8359
8360 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8361 {
8362 char value2 = op2->c;
8363
8364 exp->type = 2;
8365 exp->string = PrintChar(op1->c || value2);
8366 if(!exp->expType)
8367 {
8368 exp->expType = op1->type;
8369 if(op1->type)
8370 op1->type->refCount++;
8371 }
8372 return 0x1;
8373 }
8374
8375 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8376 {
8377 unsigned char value2 = op2->uc;
8378
8379 exp->type = 2;
8380 exp->string = PrintUChar(op1->uc || value2);
8381 if(!exp->expType)
8382 {
8383 exp->expType = op1->type;
8384 if(op1->type)
8385 op1->type->refCount++;
8386 }
8387 return 0x1;
8388 }
8389
8390 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8391 {
8392 float value2 = op2->f;
8393
8394 exp->type = 2;
8395 exp->string = PrintFloat(op1->f || value2);
8396 if(!exp->expType)
8397 {
8398 exp->expType = op1->type;
8399 if(op1->type)
8400 op1->type->refCount++;
8401 }
8402 return 0x1;
8403 }
8404
8405 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8406 {
8407 double value2 = op2->d;
8408
8409 exp->type = 2;
8410 exp->string = PrintDouble(op1->d || value2);
8411 if(!exp->expType)
8412 {
8413 exp->expType = op1->type;
8414 if(op1->type)
8415 op1->type->refCount++;
8416 }
8417 return 0x1;
8418 }
8419
8420 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8421 {
8422 int value2 = op2->i;
8423
8424 exp->type = 2;
8425 exp->string = PrintInt(op1->i > value2);
8426 if(!exp->expType)
8427 {
8428 exp->expType = op1->type;
8429 if(op1->type)
8430 op1->type->refCount++;
8431 }
8432 return 0x1;
8433 }
8434
8435 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8436 {
8437 unsigned int value2 = op2->ui;
8438
8439 exp->type = 2;
8440 exp->string = PrintUInt(op1->ui > value2);
8441 if(!exp->expType)
8442 {
8443 exp->expType = op1->type;
8444 if(op1->type)
8445 op1->type->refCount++;
8446 }
8447 return 0x1;
8448 }
8449
8450 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8451 {
8452 short value2 = op2->s;
8453
8454 exp->type = 2;
8455 exp->string = PrintShort(op1->s > value2);
8456 if(!exp->expType)
8457 {
8458 exp->expType = op1->type;
8459 if(op1->type)
8460 op1->type->refCount++;
8461 }
8462 return 0x1;
8463 }
8464
8465 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8466 {
8467 unsigned short value2 = op2->us;
8468
8469 exp->type = 2;
8470 exp->string = PrintUShort(op1->us > value2);
8471 if(!exp->expType)
8472 {
8473 exp->expType = op1->type;
8474 if(op1->type)
8475 op1->type->refCount++;
8476 }
8477 return 0x1;
8478 }
8479
8480 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8481 {
8482 char value2 = op2->c;
8483
8484 exp->type = 2;
8485 exp->string = PrintChar(op1->c > value2);
8486 if(!exp->expType)
8487 {
8488 exp->expType = op1->type;
8489 if(op1->type)
8490 op1->type->refCount++;
8491 }
8492 return 0x1;
8493 }
8494
8495 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8496 {
8497 unsigned char value2 = op2->uc;
8498
8499 exp->type = 2;
8500 exp->string = PrintUChar(op1->uc > value2);
8501 if(!exp->expType)
8502 {
8503 exp->expType = op1->type;
8504 if(op1->type)
8505 op1->type->refCount++;
8506 }
8507 return 0x1;
8508 }
8509
8510 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8511 {
8512 float value2 = op2->f;
8513
8514 exp->type = 2;
8515 exp->string = PrintFloat(op1->f > value2);
8516 if(!exp->expType)
8517 {
8518 exp->expType = op1->type;
8519 if(op1->type)
8520 op1->type->refCount++;
8521 }
8522 return 0x1;
8523 }
8524
8525 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8526 {
8527 double value2 = op2->d;
8528
8529 exp->type = 2;
8530 exp->string = PrintDouble(op1->d > value2);
8531 if(!exp->expType)
8532 {
8533 exp->expType = op1->type;
8534 if(op1->type)
8535 op1->type->refCount++;
8536 }
8537 return 0x1;
8538 }
8539
8540 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8541 {
8542 int value2 = op2->i;
8543
8544 exp->type = 2;
8545 exp->string = PrintInt(op1->i < value2);
8546 if(!exp->expType)
8547 {
8548 exp->expType = op1->type;
8549 if(op1->type)
8550 op1->type->refCount++;
8551 }
8552 return 0x1;
8553 }
8554
8555 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8556 {
8557 unsigned int value2 = op2->ui;
8558
8559 exp->type = 2;
8560 exp->string = PrintUInt(op1->ui < value2);
8561 if(!exp->expType)
8562 {
8563 exp->expType = op1->type;
8564 if(op1->type)
8565 op1->type->refCount++;
8566 }
8567 return 0x1;
8568 }
8569
8570 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8571 {
8572 short value2 = op2->s;
8573
8574 exp->type = 2;
8575 exp->string = PrintShort(op1->s < value2);
8576 if(!exp->expType)
8577 {
8578 exp->expType = op1->type;
8579 if(op1->type)
8580 op1->type->refCount++;
8581 }
8582 return 0x1;
8583 }
8584
8585 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8586 {
8587 unsigned short value2 = op2->us;
8588
8589 exp->type = 2;
8590 exp->string = PrintUShort(op1->us < value2);
8591 if(!exp->expType)
8592 {
8593 exp->expType = op1->type;
8594 if(op1->type)
8595 op1->type->refCount++;
8596 }
8597 return 0x1;
8598 }
8599
8600 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8601 {
8602 char value2 = op2->c;
8603
8604 exp->type = 2;
8605 exp->string = PrintChar(op1->c < value2);
8606 if(!exp->expType)
8607 {
8608 exp->expType = op1->type;
8609 if(op1->type)
8610 op1->type->refCount++;
8611 }
8612 return 0x1;
8613 }
8614
8615 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8616 {
8617 unsigned char value2 = op2->uc;
8618
8619 exp->type = 2;
8620 exp->string = PrintUChar(op1->uc < value2);
8621 if(!exp->expType)
8622 {
8623 exp->expType = op1->type;
8624 if(op1->type)
8625 op1->type->refCount++;
8626 }
8627 return 0x1;
8628 }
8629
8630 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8631 {
8632 float value2 = op2->f;
8633
8634 exp->type = 2;
8635 exp->string = PrintFloat(op1->f < value2);
8636 if(!exp->expType)
8637 {
8638 exp->expType = op1->type;
8639 if(op1->type)
8640 op1->type->refCount++;
8641 }
8642 return 0x1;
8643 }
8644
8645 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8646 {
8647 double value2 = op2->d;
8648
8649 exp->type = 2;
8650 exp->string = PrintDouble(op1->d < value2);
8651 if(!exp->expType)
8652 {
8653 exp->expType = op1->type;
8654 if(op1->type)
8655 op1->type->refCount++;
8656 }
8657 return 0x1;
8658 }
8659
8660 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8661 {
8662 int value2 = op2->i;
8663
8664 exp->type = 2;
8665 exp->string = PrintInt(op1->i >= value2);
8666 if(!exp->expType)
8667 {
8668 exp->expType = op1->type;
8669 if(op1->type)
8670 op1->type->refCount++;
8671 }
8672 return 0x1;
8673 }
8674
8675 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8676 {
8677 unsigned int value2 = op2->ui;
8678
8679 exp->type = 2;
8680 exp->string = PrintUInt(op1->ui >= value2);
8681 if(!exp->expType)
8682 {
8683 exp->expType = op1->type;
8684 if(op1->type)
8685 op1->type->refCount++;
8686 }
8687 return 0x1;
8688 }
8689
8690 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8691 {
8692 short value2 = op2->s;
8693
8694 exp->type = 2;
8695 exp->string = PrintShort(op1->s >= value2);
8696 if(!exp->expType)
8697 {
8698 exp->expType = op1->type;
8699 if(op1->type)
8700 op1->type->refCount++;
8701 }
8702 return 0x1;
8703 }
8704
8705 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8706 {
8707 unsigned short value2 = op2->us;
8708
8709 exp->type = 2;
8710 exp->string = PrintUShort(op1->us >= value2);
8711 if(!exp->expType)
8712 {
8713 exp->expType = op1->type;
8714 if(op1->type)
8715 op1->type->refCount++;
8716 }
8717 return 0x1;
8718 }
8719
8720 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8721 {
8722 char value2 = op2->c;
8723
8724 exp->type = 2;
8725 exp->string = PrintChar(op1->c >= value2);
8726 if(!exp->expType)
8727 {
8728 exp->expType = op1->type;
8729 if(op1->type)
8730 op1->type->refCount++;
8731 }
8732 return 0x1;
8733 }
8734
8735 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8736 {
8737 unsigned char value2 = op2->uc;
8738
8739 exp->type = 2;
8740 exp->string = PrintUChar(op1->uc >= value2);
8741 if(!exp->expType)
8742 {
8743 exp->expType = op1->type;
8744 if(op1->type)
8745 op1->type->refCount++;
8746 }
8747 return 0x1;
8748 }
8749
8750 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8751 {
8752 float value2 = op2->f;
8753
8754 exp->type = 2;
8755 exp->string = PrintFloat(op1->f >= value2);
8756 if(!exp->expType)
8757 {
8758 exp->expType = op1->type;
8759 if(op1->type)
8760 op1->type->refCount++;
8761 }
8762 return 0x1;
8763 }
8764
8765 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8766 {
8767 double value2 = op2->d;
8768
8769 exp->type = 2;
8770 exp->string = PrintDouble(op1->d >= value2);
8771 if(!exp->expType)
8772 {
8773 exp->expType = op1->type;
8774 if(op1->type)
8775 op1->type->refCount++;
8776 }
8777 return 0x1;
8778 }
8779
8780 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8781 {
8782 int value2 = op2->i;
8783
8784 exp->type = 2;
8785 exp->string = PrintInt(op1->i <= value2);
8786 if(!exp->expType)
8787 {
8788 exp->expType = op1->type;
8789 if(op1->type)
8790 op1->type->refCount++;
8791 }
8792 return 0x1;
8793 }
8794
8795 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8796 {
8797 unsigned int value2 = op2->ui;
8798
8799 exp->type = 2;
8800 exp->string = PrintUInt(op1->ui <= value2);
8801 if(!exp->expType)
8802 {
8803 exp->expType = op1->type;
8804 if(op1->type)
8805 op1->type->refCount++;
8806 }
8807 return 0x1;
8808 }
8809
8810 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8811 {
8812 short value2 = op2->s;
8813
8814 exp->type = 2;
8815 exp->string = PrintShort(op1->s <= value2);
8816 if(!exp->expType)
8817 {
8818 exp->expType = op1->type;
8819 if(op1->type)
8820 op1->type->refCount++;
8821 }
8822 return 0x1;
8823 }
8824
8825 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8826 {
8827 unsigned short value2 = op2->us;
8828
8829 exp->type = 2;
8830 exp->string = PrintUShort(op1->us <= value2);
8831 if(!exp->expType)
8832 {
8833 exp->expType = op1->type;
8834 if(op1->type)
8835 op1->type->refCount++;
8836 }
8837 return 0x1;
8838 }
8839
8840 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8841 {
8842 char value2 = op2->c;
8843
8844 exp->type = 2;
8845 exp->string = PrintChar(op1->c <= value2);
8846 if(!exp->expType)
8847 {
8848 exp->expType = op1->type;
8849 if(op1->type)
8850 op1->type->refCount++;
8851 }
8852 return 0x1;
8853 }
8854
8855 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8856 {
8857 unsigned char value2 = op2->uc;
8858
8859 exp->type = 2;
8860 exp->string = PrintUChar(op1->uc <= value2);
8861 if(!exp->expType)
8862 {
8863 exp->expType = op1->type;
8864 if(op1->type)
8865 op1->type->refCount++;
8866 }
8867 return 0x1;
8868 }
8869
8870 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8871 {
8872 float value2 = op2->f;
8873
8874 exp->type = 2;
8875 exp->string = PrintFloat(op1->f <= value2);
8876 if(!exp->expType)
8877 {
8878 exp->expType = op1->type;
8879 if(op1->type)
8880 op1->type->refCount++;
8881 }
8882 return 0x1;
8883 }
8884
8885 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8886 {
8887 double value2 = op2->d;
8888
8889 exp->type = 2;
8890 exp->string = PrintDouble(op1->d <= value2);
8891 if(!exp->expType)
8892 {
8893 exp->expType = op1->type;
8894 if(op1->type)
8895 op1->type->refCount++;
8896 }
8897 return 0x1;
8898 }
8899
8900 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8901 {
8902 exp->type = 2;
8903 exp->string = PrintInt(op1->i ? op2->i : op3->i);
8904 if(!exp->expType)
8905 {
8906 exp->expType = op1->type;
8907 if(op1->type)
8908 op1->type->refCount++;
8909 }
8910 return 0x1;
8911 }
8912
8913 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8914 {
8915 exp->type = 2;
8916 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
8917 if(!exp->expType)
8918 {
8919 exp->expType = op1->type;
8920 if(op1->type)
8921 op1->type->refCount++;
8922 }
8923 return 0x1;
8924 }
8925
8926 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8927 {
8928 exp->type = 2;
8929 exp->string = PrintShort(op1->s ? op2->s : op3->s);
8930 if(!exp->expType)
8931 {
8932 exp->expType = op1->type;
8933 if(op1->type)
8934 op1->type->refCount++;
8935 }
8936 return 0x1;
8937 }
8938
8939 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8940 {
8941 exp->type = 2;
8942 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
8943 if(!exp->expType)
8944 {
8945 exp->expType = op1->type;
8946 if(op1->type)
8947 op1->type->refCount++;
8948 }
8949 return 0x1;
8950 }
8951
8952 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8953 {
8954 exp->type = 2;
8955 exp->string = PrintChar(op1->c ? op2->c : op3->c);
8956 if(!exp->expType)
8957 {
8958 exp->expType = op1->type;
8959 if(op1->type)
8960 op1->type->refCount++;
8961 }
8962 return 0x1;
8963 }
8964
8965 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8966 {
8967 exp->type = 2;
8968 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
8969 if(!exp->expType)
8970 {
8971 exp->expType = op1->type;
8972 if(op1->type)
8973 op1->type->refCount++;
8974 }
8975 return 0x1;
8976 }
8977
8978 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8979 {
8980 exp->type = 2;
8981 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
8982 if(!exp->expType)
8983 {
8984 exp->expType = op1->type;
8985 if(op1->type)
8986 op1->type->refCount++;
8987 }
8988 return 0x1;
8989 }
8990
8991 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
8992 {
8993 exp->type = 2;
8994 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
8995 if(!exp->expType)
8996 {
8997 exp->expType = op1->type;
8998 if(op1->type)
8999 op1->type->refCount++;
9000 }
9001 return 0x1;
9002 }
9003
9004 struct OpTable intOps = 
9005 {
9006 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
9007 };
9008
9009 struct OpTable uintOps = 
9010 {
9011 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
9012 };
9013
9014 struct OpTable shortOps = 
9015 {
9016 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
9017 };
9018
9019 struct OpTable ushortOps = 
9020 {
9021 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
9022 };
9023
9024 struct OpTable floatOps = 
9025 {
9026 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
9027 };
9028
9029 struct OpTable doubleOps = 
9030 {
9031 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
9032 };
9033
9034 struct OpTable charOps = 
9035 {
9036 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
9037 };
9038
9039 struct OpTable ucharOps = 
9040 {
9041 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
9042 };
9043
9044 void ReadString(char * output, char * string)
9045 {
9046 int len = strlen(string);
9047 int c, d = 0;
9048 unsigned int quoted = 0x0, escaped = 0x0;
9049
9050 for(c = 0; c < len; c++)
9051 {
9052 char ch = string[c];
9053
9054 if(escaped)
9055 {
9056 switch(ch)
9057 {
9058 case 'n':
9059 output[d] = '\n';
9060 break;
9061 case 't':
9062 output[d] = '\t';
9063 break;
9064 case 'a':
9065 output[d] = '\a';
9066 break;
9067 case 'b':
9068 output[d] = '\b';
9069 break;
9070 case 'f':
9071 output[d] = '\f';
9072 break;
9073 case 'r':
9074 output[d] = '\r';
9075 break;
9076 case 'v':
9077 output[d] = '\v';
9078 break;
9079 case '\\':
9080 output[d] = '\\';
9081 break;
9082 case '\"':
9083 output[d] = '\"';
9084 break;
9085 default:
9086 output[d++] = '\\';
9087 output[d] = ch;
9088 }
9089 d++;
9090 escaped = 0x0;
9091 }
9092 else
9093 {
9094 if(ch == '\"')
9095 quoted ^= 0x1;
9096 else if(quoted)
9097 {
9098 if(ch == '\\')
9099 escaped = 0x1;
9100 else
9101 output[d++] = ch;
9102 }
9103 }
9104 }
9105 output[d] = '\0';
9106 }
9107
9108 extern double strtod(char * , char * * );
9109
9110 struct Operand GetOperand(struct Expression * exp)
9111 {
9112 struct Operand op = 
9113 {
9114 0, 0, 0, 0, 
9115 {
9116 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
9117 }
9118 };
9119 struct Type * type = exp->expType;
9120
9121 if(type)
9122 {
9123 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9124 {
9125 if(!type->_class->registered->dataType)
9126 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9127 type = type->_class->registered->dataType;
9128 }
9129 op.kind = type->kind;
9130 op.type = exp->expType;
9131 if(exp->isConstant && exp->type == 2)
9132 {
9133 switch(op.kind)
9134 {
9135 case 1:
9136 {
9137 if(exp->constant[0] == '\'')
9138 op.c = exp->constant[1];
9139 else if(type->isSigned)
9140 {
9141 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9142 op.ops = charOps;
9143 }
9144 else
9145 {
9146 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9147 op.ops = ucharOps;
9148 }
9149 break;
9150 }
9151 case 2:
9152 if(type->isSigned)
9153 {
9154 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9155 op.ops = shortOps;
9156 }
9157 else
9158 {
9159 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9160 op.ops = ushortOps;
9161 }
9162 break;
9163 case 3:
9164 case 5:
9165 if(type->isSigned)
9166 {
9167 op.i = strtol(exp->constant, (((void *)0)), 0);
9168 op.ops = intOps;
9169 }
9170 else
9171 {
9172 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9173 op.ops = uintOps;
9174 }
9175 op.kind = 3;
9176 break;
9177 case 4:
9178 if(type->isSigned)
9179 {
9180 op.i64 = _strtoi64(exp->constant, (((void *)0)), 0);
9181 op.ops = intOps;
9182 }
9183 else
9184 {
9185 op.ui64 = _strtoui64(exp->constant, (((void *)0)), 0);
9186 op.ops = uintOps;
9187 }
9188 op.kind = 3;
9189 break;
9190 case 6:
9191 op.f = (float)strtod(exp->constant, (((void *)0)));
9192 op.ops = floatOps;
9193 break;
9194 case 7:
9195 op.d = (double)strtod(exp->constant, (((void *)0)));
9196 op.ops = doubleOps;
9197 break;
9198 case 12:
9199 case 13:
9200 case 8:
9201 op.p = (unsigned char *)strtoul(exp->constant, (((void *)0)), 0);
9202 op.kind = 13;
9203 op.ops = uintOps;
9204 break;
9205 }
9206 }
9207 }
9208 return op;
9209 }
9210
9211 int __ecereVMethodID_class_OnGetString;
9212
9213 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9214
9215 static void UnusedFunction()
9216 {
9217 int a;
9218
9219 ((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);
9220 }
9221
9222 extern int __ecereVMethodID_class_OnGetString;
9223
9224 extern int printf(char * , ...);
9225
9226 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9227 {
9228 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9229
9230 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9231 {
9232 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9233 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9234 else
9235 {
9236 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9237 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9238 struct Type * type;
9239 void * ptr = inst->data + dataMember->offset + offset;
9240 char * result = (((void *)0));
9241
9242 exp->loc = member->loc = inst->loc;
9243 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9244 if(!dataMember->dataType)
9245 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9246 type = dataMember->dataType;
9247 if(type->kind == 8)
9248 {
9249 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9250
9251 if(_class->type == 4)
9252 {
9253 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9254
9255 if(enumClass)
9256 {
9257 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9258 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9259
9260 for(item = e->values.first; item; item = item->next)
9261 {
9262 if((int)item->data == *(int *)ptr)
9263 {
9264 result = item->name;
9265 break;
9266 }
9267 }
9268 if(result)
9269 {
9270 exp->identifier = MkIdentifier(result);
9271 exp->type = 0;
9272 exp->destType = MkClassType(_class->fullName);
9273 ProcessExpressionType(exp);
9274 }
9275 }
9276 }
9277 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9278 {
9279 if(!_class->dataType)
9280 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9281 type = _class->dataType;
9282 }
9283 }
9284 if(!result)
9285 {
9286 switch(type->kind)
9287 {
9288 case 6:
9289 {
9290 FreeExpContents(exp);
9291 exp->constant = PrintFloat(*(float *)ptr);
9292 exp->type = 2;
9293 break;
9294 }
9295 case 7:
9296 {
9297 FreeExpContents(exp);
9298 exp->constant = PrintDouble(*(double *)ptr);
9299 exp->type = 2;
9300 break;
9301 }
9302 case 3:
9303 {
9304 FreeExpContents(exp);
9305 exp->constant = PrintInt(*(int *)ptr);
9306 exp->type = 2;
9307 break;
9308 }
9309 case 4:
9310 {
9311 FreeExpContents(exp);
9312 exp->constant = PrintInt64(*(long long *)ptr);
9313 exp->type = 2;
9314 break;
9315 }
9316 default:
9317 printf("error: unhandled type populating instance\n");
9318 }
9319 }
9320 ListAdd(memberList, member);
9321 }
9322 if(parentDataMember->type == 1)
9323 break;
9324 }
9325 }
9326
9327 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9328
9329 void PopulateInstance(struct Instantiation * inst)
9330 {
9331 struct Symbol * classSym = inst->_class->symbol;
9332 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9333 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9334 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9335
9336 inst->members = MkListOne(MkMembersInitList(memberList));
9337 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9338 {
9339 if(!dataMember->isProperty)
9340 {
9341 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9342 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9343 else
9344 {
9345 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9346 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9347 struct Type * type;
9348 void * ptr = inst->data + dataMember->offset;
9349 char * result = (((void *)0));
9350
9351 exp->loc = member->loc = inst->loc;
9352 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9353 if(!dataMember->dataType)
9354 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9355 type = dataMember->dataType;
9356 if(type->kind == 8)
9357 {
9358 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9359
9360 if(_class->type == 4)
9361 {
9362 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9363
9364 if(enumClass)
9365 {
9366 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9367 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9368
9369 for(item = e->values.first; item; item = item->next)
9370 {
9371 if((int)item->data == *(int *)ptr)
9372 {
9373 result = item->name;
9374 break;
9375 }
9376 }
9377 }
9378 if(result)
9379 {
9380 exp->identifier = MkIdentifier(result);
9381 exp->type = 0;
9382 exp->destType = MkClassType(_class->fullName);
9383 ProcessExpressionType(exp);
9384 }
9385 }
9386 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9387 {
9388 if(!_class->dataType)
9389 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9390 type = _class->dataType;
9391 }
9392 }
9393 if(!result)
9394 {
9395 switch(type->kind)
9396 {
9397 case 6:
9398 {
9399 exp->constant = PrintFloat(*(float *)ptr);
9400 exp->type = 2;
9401 break;
9402 }
9403 case 7:
9404 {
9405 exp->constant = PrintDouble(*(double *)ptr);
9406 exp->type = 2;
9407 break;
9408 }
9409 case 3:
9410 {
9411 exp->constant = PrintInt(*(int *)ptr);
9412 exp->type = 2;
9413 break;
9414 }
9415 case 4:
9416 {
9417 exp->constant = PrintInt64(*(long long *)ptr);
9418 exp->type = 2;
9419 break;
9420 }
9421 default:
9422 printf("error: unhandled type populating instance\n");
9423 }
9424 }
9425 ListAdd(memberList, member);
9426 }
9427 }
9428 }
9429 }
9430
9431 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);
9432
9433 extern void FreeInstance(struct Instantiation * inst);
9434
9435 void ComputeInstantiation(struct Expression * exp)
9436 {
9437 struct Instantiation * inst = exp->instance;
9438 struct MembersInit * members;
9439 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9440 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9441 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9442 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9443 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9444 int subMemberStackPos = 0;
9445 uint64 bits = 0;
9446
9447 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9448 {
9449 if(inst->data)
9450 return ;
9451 if(_class->type == 0 || _class->type == 5)
9452 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9453 else
9454 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9455 }
9456 if(inst->members)
9457 {
9458 for(members = (*inst->members).first; members; members = members->next)
9459 {
9460 switch(members->type)
9461 {
9462 case 0:
9463 {
9464 if(members->dataMembers)
9465 {
9466 struct MemberInit * member;
9467
9468 for(member = (*members->dataMembers).first; member; member = member->next)
9469 {
9470 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9471 unsigned int found = 0x0;
9472 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9473 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9474 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9475 unsigned int dataMemberOffset;
9476
9477 if(!ident)
9478 {
9479 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9480 if(curMember)
9481 {
9482 if(curMember->isProperty)
9483 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9484 else
9485 {
9486 dataMember = curMember;
9487 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9488 }
9489 found = 0x1;
9490 }
9491 }
9492 else
9493 {
9494 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9495 if(prop)
9496 {
9497 found = 0x1;
9498 if(prop->memberAccess == 1)
9499 {
9500 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9501 curClass = prop->_class;
9502 }
9503 }
9504 else
9505 {
9506 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9507 int _subMemberStackPos = 0;
9508
9509 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9510 if(dataMember)
9511 {
9512 found = 0x1;
9513 if(dataMember->memberAccess == 1)
9514 {
9515 curMember = dataMember;
9516 curClass = dataMember->_class;
9517 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9518 subMemberStackPos = _subMemberStackPos;
9519 }
9520 }
9521 }
9522 }
9523 if(found && member->initializer && member->initializer->type == 0)
9524 {
9525 struct Expression * value = member->initializer->exp;
9526 struct Type * type = (((void *)0));
9527
9528 if(prop)
9529 {
9530 type = prop->dataType;
9531 }
9532 else if(dataMember)
9533 {
9534 if(!dataMember->dataType)
9535 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9536 type = dataMember->dataType;
9537 }
9538 if(ident && ident->next)
9539 {
9540 for(ident = ident->next; ident && type; ident = ident->next)
9541 {
9542 if(type->kind == 8)
9543 {
9544 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9545 if(prop)
9546 type = prop->dataType;
9547 else
9548 {
9549 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9550 if(dataMember)
9551 type = dataMember->dataType;
9552 }
9553 }
9554 else if(type->kind == 9 || type->kind == 10)
9555 {
9556 struct Type * memberType;
9557
9558 for(memberType = type->members.first; memberType; memberType = memberType->next)
9559 {
9560 if(!strcmp(memberType->name, ident->string))
9561 {
9562 type = memberType;
9563 break;
9564 }
9565 }
9566 }
9567 }
9568 }
9569 if(value)
9570 {
9571 FreeType(value->destType);
9572 value->destType = type;
9573 if(type)
9574 type->refCount++;
9575 ComputeExpression(value);
9576 }
9577 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9578 {
9579 if(type->kind == 8)
9580 {
9581 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9582
9583 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9584 {
9585 if(!_class->dataType)
9586 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9587 type = _class->dataType;
9588 }
9589 }
9590 if(dataMember)
9591 {
9592 void * ptr = inst->data + dataMemberOffset;
9593
9594 if(value->type == 2)
9595 {
9596 switch(type->kind)
9597 {
9598 case 3:
9599 {
9600 GetInt(value, (int *)ptr);
9601 break;
9602 }
9603 case 4:
9604 {
9605 GetInt64(value, (long long *)ptr);
9606 break;
9607 }
9608 case 6:
9609 {
9610 GetFloat(value, (float *)ptr);
9611 break;
9612 }
9613 case 7:
9614 {
9615 GetDouble(value, (double *)ptr);
9616 break;
9617 }
9618 }
9619 }
9620 else if(value->type == 1)
9621 {
9622 if(type->kind == 8)
9623 {
9624 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9625
9626 if(_class->type == 1)
9627 {
9628 ComputeTypeSize(type);
9629 if(value->instance->data)
9630 memcpy(ptr, value->instance->data, type->size);
9631 }
9632 }
9633 }
9634 }
9635 else if(prop)
9636 {
9637 if(value->type == 1 && value->instance->data)
9638 {
9639 void (* Set)(void *, void *) = (void *)prop->Set;
9640
9641 Set(inst->data, value->instance->data);
9642 PopulateInstance(inst);
9643 }
9644 else if(value->type == 2)
9645 {
9646 switch(type->kind)
9647 {
9648 case 7:
9649 {
9650 void (* Set)(void *, double) = (void *)prop->Set;
9651
9652 Set(inst->data, strtod(value->constant, (((void *)0))));
9653 break;
9654 }
9655 case 6:
9656 {
9657 void (* Set)(void *, float) = (void *)prop->Set;
9658
9659 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9660 break;
9661 }
9662 case 3:
9663 {
9664 void (* Set)(void *, int) = (void *)prop->Set;
9665
9666 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9667 break;
9668 }
9669 case 4:
9670 {
9671 void (* Set)(void *, long long) = (void *)prop->Set;
9672
9673 Set(inst->data, _strtoi64(value->constant, (((void *)0)), 0));
9674 break;
9675 }
9676 }
9677 }
9678 else if(value->type == 3)
9679 {
9680 char temp[1024];
9681
9682 ReadString(temp, value->string);
9683 prop->Set(inst->data, temp);
9684 }
9685 }
9686 }
9687 else if(_class->type == 3)
9688 {
9689 if(prop)
9690 {
9691 if(value->type == 2)
9692 {
9693 if(type->kind == 8)
9694 {
9695 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9696
9697 if(_class->type == 3)
9698 {
9699 if(!_class->dataType)
9700 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9701 type = _class->dataType;
9702 }
9703 }
9704 switch(type->kind)
9705 {
9706 case 6:
9707 {
9708 float fValue;
9709 float (* Set)(float) = (void *)prop->Set;
9710
9711 GetFloat(member->initializer->exp, &fValue);
9712 exp->constant = PrintFloat(Set(fValue));
9713 exp->type = 2;
9714 break;
9715 }
9716 case 7:
9717 {
9718 double dValue;
9719 double (* Set)(double) = (void *)prop->Set;
9720
9721 GetDouble(member->initializer->exp, &dValue);
9722 exp->constant = PrintDouble(Set(dValue));
9723 exp->type = 2;
9724 break;
9725 }
9726 }
9727 }
9728 }
9729 }
9730 else if(_class->type == 2)
9731 {
9732 if(prop)
9733 {
9734 if(value->type == 1 && value->instance->data)
9735 {
9736 unsigned int (* Set)(void *) = (void *)prop->Set;
9737
9738 bits = Set(value->instance->data);
9739 }
9740 else if(value->type == 2)
9741 {
9742 }
9743 }
9744 else if(dataMember)
9745 {
9746 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
9747 struct Type * type;
9748 int part = 0;
9749
9750 GetInt(value, &part);
9751 bits = (bits & ~bitMember->mask);
9752 if(!bitMember->dataType)
9753 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
9754 type = bitMember->dataType;
9755 if(type->kind == 8 && type->_class && type->_class->registered)
9756 {
9757 if(!type->_class->registered->dataType)
9758 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9759 type = type->_class->registered->dataType;
9760 }
9761 switch(type->kind)
9762 {
9763 case 1:
9764 if(type->isSigned)
9765 bits |= ((char)part << bitMember->pos);
9766 else
9767 bits |= ((unsigned char)part << bitMember->pos);
9768 break;
9769 case 2:
9770 if(type->isSigned)
9771 bits |= ((short)part << bitMember->pos);
9772 else
9773 bits |= ((unsigned short)part << bitMember->pos);
9774 break;
9775 case 3:
9776 case 5:
9777 if(type->isSigned)
9778 bits |= (part << bitMember->pos);
9779 else
9780 bits |= ((unsigned int)part << bitMember->pos);
9781 break;
9782 case 4:
9783 if(type->isSigned)
9784 bits |= ((long long)part << bitMember->pos);
9785 else
9786 bits |= ((uint64)part << bitMember->pos);
9787 break;
9788 }
9789 }
9790 }
9791 }
9792 else
9793 {
9794 if(_class && _class->type == 3)
9795 {
9796 ComputeExpression(member->initializer->exp);
9797 exp->constant = member->initializer->exp->constant;
9798 exp->type = 2;
9799 member->initializer->exp->constant = (((void *)0));
9800 }
9801 }
9802 }
9803 }
9804 break;
9805 }
9806 }
9807 }
9808 }
9809 if(_class && _class->type == 2)
9810 {
9811 exp->constant = PrintHexUInt(bits);
9812 exp->type = 2;
9813 }
9814 if(exp->type != 1)
9815 {
9816 FreeInstance(inst);
9817 }
9818 }
9819
9820 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
9821 {
9822 if(exp->op.op == 261)
9823 {
9824 FreeExpContents(exp);
9825 exp->type = 2;
9826 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
9827 }
9828 else
9829 {
9830 if(!exp->op.exp1)
9831 {
9832 switch(exp->op.op)
9833 {
9834 case '+':
9835 {
9836 struct Expression * exp2 = exp->op.exp2;
9837
9838 exp->op.exp2 = (((void *)0));
9839 FreeExpContents(exp);
9840 FreeType(exp->expType);
9841 FreeType(exp->destType);
9842 *exp = *exp2;
9843 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
9844 break;
9845 }
9846 case '-':
9847 if(op1->ops.Neg)
9848 {
9849 FreeExpContents(exp);
9850 op1->ops.Neg(exp, op1);
9851 }
9852 break;
9853 case '~':
9854 if(op1->ops.BitNot)
9855 {
9856 FreeExpContents(exp);
9857 op1->ops.BitNot(exp, op1);
9858 }
9859 break;
9860 case '!':
9861 if(op1->ops.Not)
9862 {
9863 FreeExpContents(exp);
9864 op1->ops.Not(exp, op1);
9865 }
9866 break;
9867 }
9868 }
9869 else
9870 {
9871 switch(exp->op.op)
9872 {
9873 case '+':
9874 if(op1->ops.Add)
9875 {
9876 FreeExpContents(exp);
9877 op1->ops.Add(exp, op1, op2);
9878 }
9879 break;
9880 case '-':
9881 if(op1->ops.Sub)
9882 {
9883 FreeExpContents(exp);
9884 op1->ops.Sub(exp, op1, op2);
9885 }
9886 break;
9887 case '*':
9888 if(op1->ops.Mul)
9889 {
9890 FreeExpContents(exp);
9891 op1->ops.Mul(exp, op1, op2);
9892 }
9893 break;
9894 case '/':
9895 if(op1->ops.Div)
9896 {
9897 FreeExpContents(exp);
9898 op1->ops.Div(exp, op1, op2);
9899 }
9900 break;
9901 case '%':
9902 if(op1->ops.Mod)
9903 {
9904 FreeExpContents(exp);
9905 op1->ops.Mod(exp, op1, op2);
9906 }
9907 break;
9908 case '&':
9909 if(exp->op.exp2)
9910 {
9911 if(op1->ops.BitAnd)
9912 {
9913 FreeExpContents(exp);
9914 op1->ops.BitAnd(exp, op1, op2);
9915 }
9916 }
9917 break;
9918 case '|':
9919 if(op1->ops.BitOr)
9920 {
9921 FreeExpContents(exp);
9922 op1->ops.BitOr(exp, op1, op2);
9923 }
9924 break;
9925 case '^':
9926 if(op1->ops.BitXor)
9927 {
9928 FreeExpContents(exp);
9929 op1->ops.BitXor(exp, op1, op2);
9930 }
9931 break;
9932 case 265:
9933 if(op1->ops.LShift)
9934 {
9935 FreeExpContents(exp);
9936 op1->ops.LShift(exp, op1, op2);
9937 }
9938 break;
9939 case 266:
9940 if(op1->ops.RShift)
9941 {
9942 FreeExpContents(exp);
9943 op1->ops.RShift(exp, op1, op2);
9944 }
9945 break;
9946 case 269:
9947 if(op1->ops.Equ)
9948 {
9949 FreeExpContents(exp);
9950 op1->ops.Equ(exp, op1, op2);
9951 }
9952 break;
9953 case 270:
9954 if(op1->ops.Nqu)
9955 {
9956 FreeExpContents(exp);
9957 op1->ops.Nqu(exp, op1, op2);
9958 }
9959 break;
9960 case 271:
9961 if(op1->ops.And)
9962 {
9963 FreeExpContents(exp);
9964 op1->ops.And(exp, op1, op2);
9965 }
9966 break;
9967 case 272:
9968 if(op1->ops.Or)
9969 {
9970 FreeExpContents(exp);
9971 op1->ops.Or(exp, op1, op2);
9972 }
9973 break;
9974 case '>':
9975 if(op1->ops.Grt)
9976 {
9977 FreeExpContents(exp);
9978 op1->ops.Grt(exp, op1, op2);
9979 }
9980 break;
9981 case '<':
9982 if(op1->ops.Sma)
9983 {
9984 FreeExpContents(exp);
9985 op1->ops.Sma(exp, op1, op2);
9986 }
9987 break;
9988 case 268:
9989 if(op1->ops.GrtEqu)
9990 {
9991 FreeExpContents(exp);
9992 op1->ops.GrtEqu(exp, op1, op2);
9993 }
9994 break;
9995 case 267:
9996 if(op1->ops.SmaEqu)
9997 {
9998 FreeExpContents(exp);
9999 op1->ops.SmaEqu(exp, op1, op2);
10000 }
10001 break;
10002 }
10003 }
10004 }
10005 }
10006
10007 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10008
10009 void ComputeExpression(struct Expression * exp)
10010 {
10011 char expString[10240];
10012
10013 expString[0] = '\0';
10014 switch(exp->type)
10015 {
10016 case 1:
10017 {
10018 ComputeInstantiation(exp);
10019 break;
10020 }
10021 case 4:
10022 {
10023 struct Expression * exp1, * exp2 = (((void *)0));
10024 struct Operand op1 = 
10025 {
10026 0, 0, 0, 0, 
10027 {
10028 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
10029 }
10030 };
10031 struct Operand op2 = 
10032 {
10033 0, 0, 0, 0, 
10034 {
10035 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
10036 }
10037 };
10038
10039 if(exp->op.exp2)
10040 ComputeExpression(exp->op.exp2);
10041 if(exp->op.exp1)
10042 {
10043 ComputeExpression(exp->op.exp1);
10044 exp1 = exp->op.exp1;
10045 exp2 = exp->op.exp2;
10046 op1 = GetOperand(exp1);
10047 if(op1.type)
10048 op1.type->refCount++;
10049 if(exp2)
10050 {
10051 op2 = GetOperand(exp2);
10052 if(op2.type)
10053 op2.type->refCount++;
10054 }
10055 }
10056 else
10057 {
10058 exp1 = exp->op.exp2;
10059 op1 = GetOperand(exp1);
10060 if(op1.type)
10061 op1.type->refCount++;
10062 }
10063 CallOperator(exp, exp1, exp2, &op1, &op2);
10064 if(op1.type)
10065 FreeType(op1.type);
10066 if(op2.type)
10067 FreeType(op2.type);
10068 break;
10069 }
10070 case 5:
10071 case 34:
10072 {
10073 struct Expression * e, * n;
10074
10075 for(e = (*exp->list).first; e; e = n)
10076 {
10077 n = e->next;
10078 if(!n)
10079 {
10080 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10081
10082 ComputeExpression(e);
10083 FreeType(exp->expType);
10084 FreeType(exp->destType);
10085 *exp = *e;
10086 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10087 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10088 }
10089 else
10090 {
10091 FreeExpression(e);
10092 }
10093 }
10094 break;
10095 }
10096 case 8:
10097 {
10098 struct Expression * memberExp = exp->member.exp;
10099 struct Identifier * memberID = exp->member.member;
10100 struct Type * type;
10101
10102 ComputeExpression(exp->member.exp);
10103 type = exp->member.exp->expType;
10104 if(type)
10105 {
10106 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)));
10107 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10108 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10109 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10110
10111 if(type->kind == 19 && exp->member.exp->type == 26)
10112 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10113 if(!_class)
10114 {
10115 char string[256];
10116 struct Symbol * classSym;
10117
10118 string[0] = '\0';
10119 PrintType(type, string, 0x0, 0x1);
10120 classSym = FindClass(string);
10121 _class = classSym ? classSym->registered : (((void *)0));
10122 }
10123 if(exp->member.member)
10124 {
10125 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10126 if(!prop)
10127 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10128 }
10129 if(!prop && !member && _class && exp->member.member)
10130 {
10131 struct Symbol * classSym = FindClass(exp->member.member->string);
10132
10133 convertTo = _class;
10134 _class = classSym ? classSym->registered : (((void *)0));
10135 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10136 }
10137 if(prop)
10138 {
10139 if(prop->compiled)
10140 {
10141 struct Type * type = prop->dataType;
10142
10143 if(_class->type == 3)
10144 {
10145 if(type->kind == 8)
10146 {
10147 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10148
10149 if(_class->type == 3)
10150 {
10151 if(!_class->dataType)
10152 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10153 type = _class->dataType;
10154 }
10155 }
10156 switch(type->kind)
10157 {
10158 case 6:
10159 {
10160 float value;
10161 float (* Get)(float) = (void *)prop->Get;
10162
10163 GetFloat(exp->member.exp, &value);
10164 exp->constant = PrintFloat(Get ? Get(value) : value);
10165 exp->type = 2;
10166 break;
10167 }
10168 case 7:
10169 {
10170 double value;
10171 double (* Get)(double);
10172
10173 GetDouble(exp->member.exp, &value);
10174 if(convertTo)
10175 Get = (void *)prop->Set;
10176 else
10177 Get = (void *)prop->Get;
10178 exp->constant = PrintDouble(Get ? Get(value) : value);
10179 exp->type = 2;
10180 break;
10181 }
10182 }
10183 }
10184 else
10185 {
10186 if(convertTo)
10187 {
10188 struct Expression * value = exp->member.exp;
10189 struct Type * type;
10190
10191 if(!prop->dataType)
10192 ProcessPropertyType(prop);
10193 type = prop->dataType;
10194 if(!type)
10195 {
10196 }
10197 else if(_class->type == 1)
10198 {
10199 switch(type->kind)
10200 {
10201 case 8:
10202 {
10203 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10204
10205 if(propertyClass->type == 1 && value->type == 1)
10206 {
10207 void (* Set)(void *, void *) = (void *)prop->Set;
10208
10209 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10210 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10211 exp->instance->_class = MkSpecifierName(_class->fullName);
10212 exp->instance->loc = exp->loc;
10213 exp->type = 1;
10214 Set(exp->instance->data, value->instance->data);
10215 PopulateInstance(exp->instance);
10216 }
10217 break;
10218 }
10219 case 3:
10220 {
10221 int intValue;
10222 void (* Set)(void *, int) = (void *)prop->Set;
10223
10224 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10225 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10226 exp->instance->_class = MkSpecifierName(_class->fullName);
10227 exp->instance->loc = exp->loc;
10228 exp->type = 1;
10229 GetInt(value, &intValue);
10230 Set(exp->instance->data, intValue);
10231 PopulateInstance(exp->instance);
10232 break;
10233 }
10234 case 4:
10235 {
10236 long long intValue;
10237 void (* Set)(void *, long long) = (void *)prop->Set;
10238
10239 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10240 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10241 exp->instance->_class = MkSpecifierName(_class->fullName);
10242 exp->instance->loc = exp->loc;
10243 exp->type = 1;
10244 GetInt64(value, &intValue);
10245 Set(exp->instance->data, intValue);
10246 PopulateInstance(exp->instance);
10247 break;
10248 }
10249 case 7:
10250 {
10251 double doubleValue;
10252 void (* Set)(void *, double) = (void *)prop->Set;
10253
10254 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10255 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10256 exp->instance->_class = MkSpecifierName(_class->fullName);
10257 exp->instance->loc = exp->loc;
10258 exp->type = 1;
10259 GetDouble(value, &doubleValue);
10260 Set(exp->instance->data, doubleValue);
10261 PopulateInstance(exp->instance);
10262 break;
10263 }
10264 }
10265 }
10266 else if(_class->type == 2)
10267 {
10268 switch(type->kind)
10269 {
10270 case 8:
10271 {
10272 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10273
10274 if(propertyClass->type == 1 && value->instance->data)
10275 {
10276 unsigned int (* Set)(void *) = (void *)prop->Set;
10277 unsigned int bits = Set(value->instance->data);
10278
10279 exp->constant = PrintHexUInt(bits);
10280 exp->type = 2;
10281 break;
10282 }
10283 else if(_class->type == 2)
10284 {
10285 unsigned int value;
10286 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10287 unsigned int bits;
10288
10289 GetUInt(exp->member.exp, &value);
10290 bits = Set(value);
10291 exp->constant = PrintHexUInt(bits);
10292 exp->type = 2;
10293 }
10294 }
10295 }
10296 }
10297 }
10298 else
10299 {
10300 if(_class->type == 2)
10301 {
10302 unsigned int value;
10303
10304 GetUInt(exp->member.exp, &value);
10305 switch(type->kind)
10306 {
10307 case 8:
10308 {
10309 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10310
10311 if(_class->type == 1)
10312 {
10313 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10314
10315 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10316 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10317 exp->instance->_class = MkSpecifierName(_class->fullName);
10318 exp->instance->loc = exp->loc;
10319 exp->type = 1;
10320 Get(value, exp->instance->data);
10321 PopulateInstance(exp->instance);
10322 }
10323 else if(_class->type == 2)
10324 {
10325 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10326 uint64 bits = Get(value);
10327
10328 exp->constant = PrintHexUInt64(bits);
10329 exp->type = 2;
10330 }
10331 break;
10332 }
10333 }
10334 }
10335 else if(_class->type == 1)
10336 {
10337 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10338
10339 switch(type->kind)
10340 {
10341 case 8:
10342 {
10343 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10344
10345 if(_class->type == 1 && value)
10346 {
10347 void (* Get)(void *, void *) = (void *)prop->Get;
10348
10349 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10350 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10351 exp->instance->_class = MkSpecifierName(_class->fullName);
10352 exp->instance->loc = exp->loc;
10353 exp->type = 1;
10354 Get(value, exp->instance->data);
10355 PopulateInstance(exp->instance);
10356 }
10357 break;
10358 }
10359 }
10360 }
10361 }
10362 }
10363 }
10364 else
10365 {
10366 exp->isConstant = 0x0;
10367 }
10368 }
10369 else if(member)
10370 {
10371 }
10372 }
10373 if(exp->type != 8)
10374 {
10375 FreeExpression(memberExp);
10376 FreeIdentifier(memberID);
10377 }
10378 break;
10379 }
10380 case 10:
10381 {
10382 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10383
10384 FreeExpContents(exp);
10385 exp->constant = PrintUInt(ComputeTypeSize(type));
10386 exp->type = 2;
10387 FreeType(type);
10388 break;
10389 }
10390 case 15:
10391 {
10392 struct Symbol * classSym = exp->_class->symbol;
10393
10394 if(classSym && classSym->registered)
10395 {
10396 if(classSym->registered->fixed)
10397 {
10398 FreeSpecifier(exp->_class);
10399 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10400 exp->type = 2;
10401 }
10402 else
10403 {
10404 char className[1024];
10405
10406 strcpy(className, "__ecereClass_");
10407 FullClassNameCat(className, classSym->string, 0x1);
10408 MangleClassName(className);
10409 FreeExpContents(exp);
10410 exp->type = 9;
10411 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10412 exp->member.member = MkIdentifier("structSize");
10413 }
10414 }
10415 break;
10416 }
10417 case 11:
10418 {
10419 struct Type * type;
10420 struct Expression * e = exp;
10421
10422 if(exp->type == 11)
10423 {
10424 if(exp->cast.exp)
10425 ComputeExpression(exp->cast.exp);
10426 e = exp->cast.exp;
10427 }
10428 if(e && exp->expType)
10429 {
10430 type = exp->expType;
10431 if(type->kind == 8)
10432 {
10433 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10434
10435 if(_class && (_class->type == 3 || _class->type == 2))
10436 {
10437 if(!_class->dataType)
10438 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10439 type = _class->dataType;
10440 }
10441 }
10442 switch(type->kind)
10443 {
10444 case 1:
10445 if(type->isSigned)
10446 {
10447 char value;
10448
10449 GetChar(e, &value);
10450 FreeExpContents(exp);
10451 exp->constant = PrintChar(value);
10452 exp->type = 2;
10453 }
10454 else
10455 {
10456 unsigned char value;
10457
10458 GetUChar(e, &value);
10459 FreeExpContents(exp);
10460 exp->constant = PrintUChar(value);
10461 exp->type = 2;
10462 }
10463 break;
10464 case 2:
10465 if(type->isSigned)
10466 {
10467 short value;
10468
10469 GetShort(e, &value);
10470 FreeExpContents(exp);
10471 exp->constant = PrintShort(value);
10472 exp->type = 2;
10473 }
10474 else
10475 {
10476 unsigned short value;
10477
10478 GetUShort(e, &value);
10479 FreeExpContents(exp);
10480 exp->constant = PrintUShort(value);
10481 exp->type = 2;
10482 }
10483 break;
10484 case 3:
10485 if(type->isSigned)
10486 {
10487 int value;
10488
10489 GetInt(e, &value);
10490 FreeExpContents(exp);
10491 exp->constant = PrintInt(value);
10492 exp->type = 2;
10493 }
10494 else
10495 {
10496 unsigned int value;
10497
10498 GetUInt(e, &value);
10499 FreeExpContents(exp);
10500 exp->constant = PrintUInt(value);
10501 exp->type = 2;
10502 }
10503 break;
10504 case 4:
10505 if(type->isSigned)
10506 {
10507 long long value;
10508
10509 GetInt64(e, &value);
10510 FreeExpContents(exp);
10511 exp->constant = PrintInt64(value);
10512 exp->type = 2;
10513 }
10514 else
10515 {
10516 uint64 value;
10517
10518 GetUInt64(e, &value);
10519 FreeExpContents(exp);
10520 exp->constant = PrintUInt64(value);
10521 exp->type = 2;
10522 }
10523 break;
10524 case 6:
10525 {
10526 float value;
10527
10528 GetFloat(e, &value);
10529 FreeExpContents(exp);
10530 exp->constant = PrintFloat(value);
10531 exp->type = 2;
10532 break;
10533 }
10534 case 7:
10535 {
10536 double value;
10537
10538 GetDouble(e, &value);
10539 FreeExpContents(exp);
10540 exp->constant = PrintDouble(value);
10541 exp->type = 2;
10542 break;
10543 }
10544 }
10545 }
10546 break;
10547 }
10548 case 12:
10549 {
10550 struct Operand op1 = 
10551 {
10552 0, 0, 0, 0, 
10553 {
10554 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
10555 }
10556 };
10557 struct Operand op2 = 
10558 {
10559 0, 0, 0, 0, 
10560 {
10561 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
10562 }
10563 };
10564 struct Operand op3 = 
10565 {
10566 0, 0, 0, 0, 
10567 {
10568 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
10569 }
10570 };
10571
10572 if(exp->cond.exp)
10573 ComputeExpression((*exp->cond.exp).last);
10574 if(exp->cond.elseExp)
10575 ComputeExpression(exp->cond.elseExp);
10576 if(exp->cond.cond)
10577 ComputeExpression(exp->cond.cond);
10578 op1 = GetOperand(exp->cond.cond);
10579 if(op1.type)
10580 op1.type->refCount++;
10581 op2 = GetOperand((*exp->cond.exp).last);
10582 if(op2.type)
10583 op2.type->refCount++;
10584 op3 = GetOperand(exp->cond.elseExp);
10585 if(op3.type)
10586 op3.type->refCount++;
10587 if(op1.ops.Cond)
10588 {
10589 FreeExpContents(exp);
10590 op1.ops.Cond(exp, &op1, &op2, &op3);
10591 }
10592 if(op1.type)
10593 FreeType(op1.type);
10594 if(op2.type)
10595 FreeType(op2.type);
10596 if(op3.type)
10597 FreeType(op3.type);
10598 break;
10599 }
10600 }
10601 }
10602
10603 void ApplyAnyObjectLogic(struct Expression * e);
10604
10605 extern void CopyTypeInto(struct Type * type, struct Type * src);
10606
10607 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10608 {
10609 unsigned int result = 0x1;
10610
10611 if(destType)
10612 {
10613 struct __ecereNameSpace__ecere__sys__OldList converts = 
10614 {
10615 0, 0, 0, 0, 0
10616 };
10617 struct Conversion * convert;
10618
10619 if(destType->kind == 0)
10620 return 0x0;
10621 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
10622 result = 0x0;
10623 if(converts.count)
10624 {
10625 for(convert = converts.first; convert; convert = convert->next)
10626 {
10627 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
10628
10629 if(!empty)
10630 {
10631 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10632 int objectType = exp->expType ? exp->expType->classObjectType : 0;
10633
10634 *newExp = *exp;
10635 newExp->destType = (((void *)0));
10636 if(convert->isGet)
10637 {
10638 exp->type = 8;
10639 exp->addedThis = 0x1;
10640 exp->member.exp = newExp;
10641 FreeType(exp->member.exp->expType);
10642 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
10643 exp->member.exp->expType->classObjectType = objectType;
10644 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
10645 exp->member.memberType = 1;
10646 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10647 exp->needCast = 0x1;
10648 if(exp->expType)
10649 exp->expType->refCount++;
10650 ApplyAnyObjectLogic(exp->member.exp);
10651 }
10652 else
10653 {
10654 {
10655 exp->type = 8;
10656 exp->addedThis = 0x1;
10657 exp->member.exp = newExp;
10658 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
10659 {
10660 newExp->byReference = 0x1;
10661 }
10662 FreeType(exp->member.exp->expType);
10663 exp->member.exp->expType = (((void *)0));
10664 if(convert->convert->dataType)
10665 {
10666 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
10667 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
10668 exp->member.exp->expType->refCount = 1;
10669 exp->member.exp->expType->classObjectType = objectType;
10670 ApplyAnyObjectLogic(exp->member.exp);
10671 }
10672 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
10673 exp->member.memberType = 4;
10674 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10675 exp->needCast = 0x1;
10676 if(convert->resultType)
10677 convert->resultType->refCount++;
10678 }
10679 }
10680 }
10681 else
10682 {
10683 FreeType(exp->expType);
10684 if(convert->isGet)
10685 {
10686 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10687 exp->needCast = 0x1;
10688 if(exp->expType)
10689 exp->expType->refCount++;
10690 }
10691 else
10692 {
10693 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10694 exp->needCast = 0x1;
10695 if(convert->resultType)
10696 convert->resultType->refCount++;
10697 }
10698 }
10699 }
10700 if(exp->isConstant && inCompiler)
10701 ComputeExpression(exp);
10702 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
10703 }
10704 if(!result && exp->expType && converts.count)
10705 {
10706 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
10707 }
10708 if(!result && exp->expType && exp->destType)
10709 {
10710 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))
10711 result = 0x1;
10712 }
10713 }
10714 return result;
10715 }
10716
10717 extern struct Expression * MkExpExtensionCompound(struct Statement * compound);
10718
10719 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
10720
10721 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
10722
10723 void CheckTemplateTypes(struct Expression * exp)
10724 {
10725 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
10726 {
10727 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10728 struct Statement * compound;
10729 struct Context * context;
10730
10731 *newExp = *exp;
10732 if(exp->destType)
10733 exp->destType->refCount++;
10734 if(exp->expType)
10735 exp->expType->refCount++;
10736 newExp->prev = (((void *)0));
10737 newExp->next = (((void *)0));
10738 switch(exp->expType->kind)
10739 {
10740 case 7:
10741 exp->type = 4;
10742 exp->op.exp1 = (((void *)0));
10743 context = PushContext();
10744 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpExtensionCompound(compound = MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifier(298)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal")), MkInitializerAssignment(newExp))))), MkListOne(MkExpressionStmt(MkListOne(MkExpOp((((void *)0)), '&', MkExpIdentifier(MkIdentifier("__internal")))))))));
10745 compound->compound.context = context;
10746 PopContext(context);
10747 exp->op.op = '*';
10748 break;
10749 default:
10750 exp->type = 11;
10751 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
10752 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10753 break;
10754 }
10755 }
10756 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
10757 {
10758 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10759 struct Statement * compound;
10760 struct Context * context;
10761
10762 *newExp = *exp;
10763 if(exp->destType)
10764 exp->destType->refCount++;
10765 if(exp->expType)
10766 exp->expType->refCount++;
10767 newExp->prev = (((void *)0));
10768 newExp->next = (((void *)0));
10769 switch(exp->expType->kind)
10770 {
10771 case 7:
10772 exp->type = 4;
10773 exp->op.exp1 = (((void *)0));
10774 context = PushContext();
10775 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifier(298)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpExtensionCompound(compound = MkCompoundStmt(MkListOne(MkDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal")), MkInitializerAssignment(newExp))))), MkListOne(MkExpressionStmt(MkListOne(MkExpOp((((void *)0)), '&', MkExpIdentifier(MkIdentifier("__internal")))))))));
10776 compound->compound.context = context;
10777 PopContext(context);
10778 exp->op.op = '*';
10779 ProcessExpressionType(exp->op.exp2);
10780 break;
10781 case 8:
10782 {
10783 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
10784 {
10785 exp->type = 5;
10786 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
10787 ProcessExpressionType((*exp->list).first);
10788 break;
10789 }
10790 else
10791 {
10792 exp->type = 5;
10793 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
10794 newExp->needCast = 0x1;
10795 ProcessExpressionType((*exp->list).first);
10796 break;
10797 }
10798 }
10799 default:
10800 {
10801 if(exp->expType->kind == 20)
10802 {
10803 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
10804
10805 if(type)
10806 {
10807 FreeType(exp->destType);
10808 FreeType(exp->expType);
10809 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
10810 break;
10811 }
10812 }
10813 if(newExp->type == 8 && newExp->member.memberType == 3)
10814 {
10815 exp->type = 4;
10816 exp->op.op = '*';
10817 exp->op.exp1 = (((void *)0));
10818 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
10819 }
10820 else
10821 {
10822 char typeString[1024];
10823 struct Declarator * decl;
10824 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
10825
10826 typeString[0] = '\0';
10827 PrintType(exp->expType, typeString, 0x0, 0x0);
10828 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
10829 exp->type = 11;
10830 exp->cast.typeName = MkTypeName(specs, decl);
10831 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
10832 exp->cast.exp->needCast = 0x1;
10833 }
10834 break;
10835 }
10836 }
10837 }
10838 }
10839
10840 extern int strncmp(const char * , const char * , int n);
10841
10842 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
10843 {
10844 struct Symbol * symbol;
10845 int nsLen = strlen(nameSpace);
10846
10847 for(symbol = (struct Symbol *)__ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(tree); symbol; symbol = (struct Symbol *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)symbol)))
10848 {
10849 if(!strncmp(symbol->string, nameSpace, nsLen))
10850 {
10851 int c;
10852 char * namePart;
10853
10854 for(c = strlen(symbol->string) - 1; c >= 0; c--)
10855 if(symbol->string[c] == ':')
10856 break;
10857 namePart = symbol->string + c + 1;
10858 if(!strcmp(namePart, name))
10859 {
10860 return symbol;
10861 }
10862 }
10863 }
10864 return (((void *)0));
10865 }
10866
10867 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
10868 {
10869 int c;
10870 char nameSpace[1024];
10871 char * namePart;
10872 unsigned int gotColon = 0x0;
10873
10874 nameSpace[0] = '\0';
10875 for(c = strlen(name) - 1; c >= 0; c--)
10876 if(name[c] == ':')
10877 {
10878 gotColon = 0x1;
10879 break;
10880 }
10881 namePart = name + c + 1;
10882 while(c >= 0 && name[c] == ':')
10883 c--;
10884 if(c >= 0)
10885 {
10886 memcpy(nameSpace, name, c + 1);
10887 nameSpace[c + 1] = (char)0;
10888 return ScanWithNameSpace(tree, nameSpace, namePart);
10889 }
10890 else if(gotColon)
10891 {
10892 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
10893
10894 return symbol;
10895 }
10896 else
10897 return ScanWithNameSpace(tree, "", namePart);
10898 return (((void *)0));
10899 }
10900
10901 static void ProcessDeclaration(struct Declaration * decl);
10902
10903 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
10904 {
10905 struct Context * ctx;
10906 struct Symbol * symbol = (((void *)0));
10907
10908 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
10909 {
10910 if(ctx == globalContext && !globalNameSpace)
10911 {
10912 symbol = (((void *)0));
10913 if(thisNameSpace)
10914 {
10915 char curName[1024];
10916
10917 strcpy(curName, thisNameSpace);
10918 strcat(curName, "::");
10919 strcat(curName, name);
10920 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
10921 }
10922 if(!symbol)
10923 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
10924 }
10925 else if(isStruct)
10926 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->structSymbols, name);
10927 else
10928 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, name);
10929 if(symbol || ctx == endContext)
10930 break;
10931 }
10932 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
10933 {
10934 if(symbol->pointerExternal->type == 0)
10935 {
10936 struct FunctionDefinition * function = symbol->pointerExternal->function;
10937 struct Context * tmpContext = curContext;
10938
10939 curContext = (((void *)0));
10940 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
10941 curContext = tmpContext;
10942 symbol->pointerExternal->symbol = symbol;
10943 DeclareType(symbol->type, 0x1, 0x1);
10944 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
10945 symbol->id = curExternal->symbol->idCode;
10946 }
10947 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
10948 {
10949 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
10950 symbol->id = curExternal->symbol->idCode;
10951 }
10952 }
10953 return symbol;
10954 }
10955
10956 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
10957 {
10958 if(!type->isSigned)
10959 ListAdd(specs, MkSpecifier(296));
10960 switch(type->kind)
10961 {
10962 case 8:
10963 {
10964 if(type->_class->registered)
10965 {
10966 if(!type->_class->registered->dataType)
10967 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10968 GetTypeSpecs(type->_class->registered->dataType, specs);
10969 }
10970 break;
10971 }
10972 case 7:
10973 ListAdd(specs, MkSpecifier(298));
10974 break;
10975 case 6:
10976 ListAdd(specs, MkSpecifier(297));
10977 break;
10978 case 1:
10979 ListAdd(specs, MkSpecifier(289));
10980 break;
10981 case 2:
10982 ListAdd(specs, MkSpecifier(290));
10983 break;
10984 case 4:
10985 ListAdd(specs, MkSpecifier(293));
10986 break;
10987 case 3:
10988 default:
10989 ListAdd(specs, MkSpecifier(291));
10990 break;
10991 }
10992 }
10993
10994 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
10995
10996 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
10997 {
10998 if(type)
10999 {
11000 switch(type->kind)
11001 {
11002 case 8:
11003 if(type->_class && type->_class->string)
11004 {
11005 if(type->classObjectType == 2)
11006 strcat(string, "typed_object");
11007 else if(fullName)
11008 strcat(string, type->_class->string);
11009 else
11010 {
11011 if(type->_class->registered)
11012 strcat(string, type->_class->registered->name);
11013 else
11014 strcat(string, type->_class->string);
11015 }
11016 }
11017 break;
11018 case 13:
11019 {
11020 {
11021 _PrintType(type->type, string, 0x0, printFunction, fullName);
11022 strcat(string, " *");
11023 }
11024 break;
11025 }
11026 case 0:
11027 strcat(string, "void");
11028 break;
11029 case 3:
11030 strcat(string, type->isSigned ? "int" : "uint");
11031 break;
11032 case 4:
11033 strcat(string, type->isSigned ? "int64" : "uint64");
11034 break;
11035 case 1:
11036 strcat(string, type->isSigned ? "char" : "byte");
11037 break;
11038 case 2:
11039 strcat(string, type->isSigned ? "short" : "uint16");
11040 break;
11041 case 6:
11042 strcat(string, "float");
11043 break;
11044 case 7:
11045 strcat(string, "double");
11046 break;
11047 case 9:
11048 if(type->enumName)
11049 {
11050 strcat(string, "struct ");
11051 strcat(string, type->enumName);
11052 }
11053 else if(type->typeName)
11054 {
11055 strcat(string, type->typeName);
11056 }
11057 else
11058 {
11059 struct Type * member;
11060
11061 strcat(string, "struct {");
11062 for(member = type->members.first; member; member = member->next)
11063 {
11064 PrintType(member, string, 0x1, fullName);
11065 strcat(string, "; ");
11066 }
11067 strcat(string, "}");
11068 }
11069 break;
11070 case 10:
11071 if(type->enumName)
11072 {
11073 strcat(string, "union ");
11074 strcat(string, type->enumName);
11075 }
11076 else if(type->typeName)
11077 {
11078 strcat(string, type->typeName);
11079 }
11080 else
11081 {
11082 strcat(string, "union ");
11083 strcat(string, "(unnamed)");
11084 }
11085 break;
11086 case 15:
11087 if(type->enumName)
11088 {
11089 strcat(string, "enum ");
11090 strcat(string, type->enumName);
11091 }
11092 else if(type->typeName)
11093 {
11094 strcat(string, type->typeName);
11095 }
11096 else
11097 strcat(string, "enum");
11098 break;
11099 case 11:
11100 {
11101 if(printFunction)
11102 {
11103 if(type->dllExport)
11104 strcat(string, "dllexport ");
11105 PrintType(type->returnType, string, 0x0, fullName);
11106 strcat(string, " ");
11107 }
11108 if(printName)
11109 {
11110 if(type->name)
11111 {
11112 if(fullName)
11113 strcat(string, type->name);
11114 else
11115 {
11116 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11117
11118 if(name)
11119 name += 2;
11120 else
11121 name = type->name;
11122 strcat(string, name);
11123 }
11124 }
11125 }
11126 if(printFunction)
11127 {
11128 struct Type * param;
11129
11130 strcat(string, "(");
11131 for(param = type->params.first; param; param = param->next)
11132 {
11133 PrintType(param, string, 0x1, fullName);
11134 if(param->next)
11135 strcat(string, ", ");
11136 }
11137 strcat(string, ")");
11138 }
11139 break;
11140 }
11141 case 12:
11142 {
11143 {
11144 char baseType[1024], size[256];
11145 struct Type * arrayType = type;
11146
11147 baseType[0] = '\0';
11148 size[0] = '\0';
11149 while(arrayType->kind == 12)
11150 {
11151 strcat(size, "[");
11152 if(arrayType->enumClass)
11153 strcat(size, arrayType->enumClass->string);
11154 else if(arrayType->arraySizeExp)
11155 PrintExpression(arrayType->arraySizeExp, size);
11156 strcat(size, "]");
11157 arrayType = arrayType->arrayType;
11158 }
11159 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11160 strcat(string, baseType);
11161 strcat(string, size);
11162 }
11163 printName = 0x0;
11164 break;
11165 }
11166 case 14:
11167 strcat(string, "...");
11168 break;
11169 case 16:
11170 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11171 break;
11172 case 19:
11173 strcat(string, "subclass(");
11174 strcat(string, type->_class ? type->_class->string : "int");
11175 strcat(string, ")");
11176 break;
11177 case 20:
11178 strcat(string, type->templateParameter->identifier->string);
11179 break;
11180 case 21:
11181 strcat(string, "thisclass");
11182 break;
11183 case 17:
11184 strcat(string, "__builtin_va_list");
11185 break;
11186 }
11187 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11188 {
11189 strcat(string, " ");
11190 strcat(string, type->name);
11191 }
11192 }
11193 }
11194
11195 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11196 {
11197 struct Type * funcType;
11198
11199 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11200 ;
11201 if(funcType && funcType->kind == 11 && type != funcType)
11202 {
11203 char typeString[1024];
11204 struct Type * param;
11205
11206 PrintType(funcType->returnType, string, 0x0, fullName);
11207 strcat(string, "(");
11208 _PrintType(type, string, printName, 0x0, fullName);
11209 strcat(string, ")");
11210 strcat(string, "(");
11211 for(param = funcType->params.first; param; param = param->next)
11212 {
11213 PrintType(param, string, 0x1, fullName);
11214 if(param->next)
11215 strcat(string, ", ");
11216 }
11217 strcat(string, ")");
11218 }
11219 else
11220 _PrintType(type, string, printName, 0x1, fullName);
11221 if(type->bitFieldCount)
11222 {
11223 char count[100];
11224
11225 sprintf(count, ":%d", type->bitFieldCount);
11226 strcat(string, count);
11227 }
11228 }
11229
11230 static struct Type * FindMember(struct Type * type, char * string)
11231 {
11232 struct Type * memberType;
11233
11234 for(memberType = type->members.first; memberType; memberType = memberType->next)
11235 {
11236 if(!memberType->name)
11237 {
11238 struct Type * subType = FindMember(memberType, string);
11239
11240 if(subType)
11241 return subType;
11242 }
11243 else if(!strcmp(memberType->name, string))
11244 return memberType;
11245 }
11246 return (((void *)0));
11247 }
11248
11249 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11250 {
11251 struct Type * memberType;
11252
11253 for(memberType = type->members.first; memberType; memberType = memberType->next)
11254 {
11255 if(!memberType->name)
11256 {
11257 struct Type * subType = FindMember(memberType, string);
11258
11259 if(subType)
11260 {
11261 *offset += memberType->offset;
11262 return subType;
11263 }
11264 }
11265 else if(!strcmp(memberType->name, string))
11266 {
11267 *offset += memberType->offset;
11268 return memberType;
11269 }
11270 }
11271 return (((void *)0));
11272 }
11273
11274 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11275
11276 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11277
11278 struct Expression * ParseExpressionString(char * expression)
11279 {
11280 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11281 ((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));
11282 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11283 echoOn = 0x0;
11284 parsedExpression = (((void *)0));
11285 resetScanner();
11286 expression_yyparse();
11287 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11288 return parsedExpression;
11289 }
11290
11291 extern char *  QMkString(char *  source);
11292
11293 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11294 {
11295 void * __ecereTemp1;
11296 struct Identifier * id = exp->identifier;
11297 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11298 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11299 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11300 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11301
11302 if(_class && _class->type == 4)
11303 {
11304 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11305 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11306
11307 if(enumClass)
11308 {
11309 struct __ecereNameSpace__ecere__com__Class * baseClass;
11310
11311 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11312 {
11313 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11314
11315 for(value = e->values.first; value; value = value->next)
11316 {
11317 if(!strcmp(value->name, id->string))
11318 break;
11319 }
11320 if(value)
11321 {
11322 char constant[256];
11323
11324 FreeExpContents(exp);
11325 exp->type = 2;
11326 exp->isConstant = 0x1;
11327 if(!strcmp(baseClass->dataTypeString, "int"))
11328 sprintf(constant, "%d", value->data);
11329 else
11330 sprintf(constant, "0x%X", value->data);
11331 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11332 exp->expType = MkClassType(baseClass->fullName);
11333 break;
11334 }
11335 }
11336 }
11337 if(value)
11338 return 0x1;
11339 }
11340 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11341 {
11342 ProcessMethodType(method);
11343 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));
11344 return 0x1;
11345 }
11346 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11347 {
11348 if(!prop->dataType)
11349 ProcessPropertyType(prop);
11350 exp->expType = prop->dataType;
11351 if(prop->dataType)
11352 prop->dataType->refCount++;
11353 return 0x1;
11354 }
11355 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11356 {
11357 if(!member->dataType)
11358 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11359 exp->expType = member->dataType;
11360 if(member->dataType)
11361 member->dataType->refCount++;
11362 return 0x1;
11363 }
11364 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11365 {
11366 if(!classProp->dataType)
11367 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11368 if(classProp->constant)
11369 {
11370 FreeExpContents(exp);
11371 exp->isConstant = 0x1;
11372 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11373 {
11374 exp->type = 3;
11375 exp->constant = QMkString((char *)classProp->Get(_class));
11376 }
11377 else
11378 {
11379 char constant[256];
11380
11381 exp->type = 2;
11382 sprintf(constant, "%d", classProp->Get(_class));
11383 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11384 }
11385 }
11386 else
11387 {
11388 }
11389 exp->expType = classProp->dataType;
11390 if(classProp->dataType)
11391 classProp->dataType->refCount++;
11392 return 0x1;
11393 }
11394 return 0x0;
11395 }
11396
11397 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11398 {
11399 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11400 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11401 struct __ecereNameSpace__ecere__com__NameSpace * child;
11402
11403 if(!data)
11404 {
11405 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)))
11406 {
11407 data = ScanGlobalData(child, name);
11408 if(data)
11409 break;
11410 }
11411 }
11412 return data;
11413 }
11414
11415 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11416
11417 extern char *  strncpy(char * , const char * , int n);
11418
11419 static struct GlobalData * FindGlobalData(char * name)
11420 {
11421 int start = 0, c;
11422 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11423
11424 nameSpace = globalData;
11425 for(c = 0; name[c]; c++)
11426 {
11427 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11428 {
11429 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11430 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11431
11432 strncpy(spaceName, name + start, c - start);
11433 spaceName[c - start] = '\0';
11434 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11435 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11436 if(!newSpace)
11437 return (((void *)0));
11438 nameSpace = newSpace;
11439 if(name[c] == ':')
11440 c++;
11441 start = c + 1;
11442 }
11443 }
11444 if(c - start)
11445 {
11446 return ScanGlobalData(nameSpace, name + start);
11447 }
11448 return (((void *)0));
11449 }
11450
11451 static int definedExpStackPos;
11452
11453 static void * definedExpStack[512];
11454
11455 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11456 {
11457 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11458
11459 FreeExpContents(checkedExp);
11460 FreeType(checkedExp->expType);
11461 FreeType(checkedExp->destType);
11462 *checkedExp = *newExp;
11463 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11464 checkedExp->prev = prev;
11465 checkedExp->next = next;
11466 }
11467
11468 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11469
11470 void __ecereMethod_Expression_Clear();
11471
11472 void ApplyAnyObjectLogic(struct Expression * e)
11473 {
11474 struct Type * destType = e->destType;
11475
11476 if(destType && (destType->classObjectType == 3))
11477 {
11478 if(e && e->expType)
11479 {
11480 struct Type * type = e->expType;
11481 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11482
11483 if(type->kind == 8 && type->_class && type->_class->registered)
11484 {
11485 _class = type->_class->registered;
11486 }
11487 else if(type->kind == 19)
11488 {
11489 _class = FindClass("ecere::com::Class")->registered;
11490 }
11491 else
11492 {
11493 char string[1024] = "";
11494 struct Symbol * classSym;
11495
11496 PrintType(type, string, 0x0, 0x1);
11497 classSym = FindClass(string);
11498 if(classSym)
11499 _class = classSym->registered;
11500 }
11501 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)))
11502 {
11503 if(!_class || strcmp(_class->fullName, "char *"))
11504 {
11505 struct Expression * checkedExp = e, * newExp;
11506
11507 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11508 {
11509 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11510 {
11511 if(checkedExp->type == 25)
11512 {
11513 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11514 }
11515 else
11516 checkedExp = (*checkedExp->list).last;
11517 }
11518 else if(checkedExp->type == 11)
11519 checkedExp = checkedExp->cast.exp;
11520 }
11521 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11522 {
11523 newExp = checkedExp->op.exp2;
11524 checkedExp->op.exp2 = (((void *)0));
11525 FreeExpContents(checkedExp);
11526 if(e->expType && e->expType->passAsTemplate)
11527 {
11528 char size[100];
11529
11530 ComputeTypeSize(e->expType);
11531 sprintf(size, "%d", e->expType->size);
11532 newExp = MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(289)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp), '+', MkExpCall(MkExpIdentifier(MkIdentifier("__ENDIAN_PAD")), MkListOne(MkExpConstant(size))))));
11533 }
11534 ReplaceExpContents(checkedExp, newExp);
11535 e->byReference = 0x1;
11536 }
11537 else if(!e->byReference || (_class && _class->type == 5))
11538 {
11539 struct Expression * checkedExp, * newExp;
11540
11541 {
11542 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;
11543
11544 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11545 {
11546 struct Context * context = PushContext();
11547 struct Declarator * decl;
11548 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11549 char typeString[1024];
11550 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11551
11552 typeString[0] = '\0';
11553 *newExp = *e;
11554 newExp->prev = (((void *)0));
11555 newExp->next = (((void *)0));
11556 newExp->expType = (((void *)0));
11557 PrintType(e->expType, typeString, 0x0, 0x1);
11558 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11559 newExp->destType = ProcessType(specs, decl);
11560 curContext = context;
11561 e->type = 25;
11562 e->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalValue")), MkInitializerAssignment(newExp))))), MkListOne(MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier("__internalValue"))))));
11563 {
11564 struct Type * type = e->destType;
11565
11566 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11567 CopyTypeInto(e->destType, type);
11568 e->destType->refCount = 1;
11569 e->destType->classObjectType = 0;
11570 FreeType(type);
11571 }
11572 e->compound->compound.context = context;
11573 PopContext(context);
11574 curContext = context->parent;
11575 }
11576 }
11577 checkedExp = e;
11578 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11579 {
11580 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11581 {
11582 if(checkedExp->type == 25)
11583 {
11584 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11585 }
11586 else
11587 checkedExp = (*checkedExp->list).last;
11588 }
11589 else if(checkedExp->type == 11)
11590 checkedExp = checkedExp->cast.exp;
11591 }
11592 {
11593 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11594
11595 *operand = *checkedExp;
11596 checkedExp->destType = (((void *)0));
11597 checkedExp->expType = (((void *)0));
11598 __ecereMethod_Expression_Clear(checkedExp);
11599 checkedExp->type = 4;
11600 checkedExp->op.op = '&';
11601 checkedExp->op.exp1 = (((void *)0));
11602 checkedExp->op.exp2 = operand;
11603 }
11604 }
11605 }
11606 }
11607 }
11608 }
11609 {
11610 }
11611 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))))
11612 {
11613 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
11614 {
11615 return ;
11616 }
11617 else
11618 {
11619 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11620
11621 *thisExp = *e;
11622 thisExp->prev = (((void *)0));
11623 thisExp->next = (((void *)0));
11624 __ecereMethod_Expression_Clear(e);
11625 e->type = 5;
11626 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
11627 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
11628 ((struct Expression *)(*e->list).first)->byReference = 0x1;
11629 {
11630 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11631 CopyTypeInto(e->expType, thisExp->expType);
11632 e->expType->byReference = 0x0;
11633 e->expType->refCount = 1;
11634 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))
11635 {
11636 e->expType->classObjectType = 0;
11637 }
11638 }
11639 }
11640 }
11641 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
11642 {
11643 if(destType->kind == 14)
11644 {
11645 Compiler_Error("Unspecified type\n");
11646 }
11647 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
11648 {
11649 unsigned int byReference = e->expType->byReference;
11650 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11651 struct Declarator * decl;
11652 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11653 char typeString[1024];
11654 struct Type * type;
11655 int backupClassObjectType;
11656
11657 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
11658 type = e->expType;
11659 else
11660 type = destType;
11661 backupClassObjectType = type->classObjectType;
11662 type->classObjectType = 0;
11663 typeString[0] = '\0';
11664 PrintType(type, typeString, 0x0, 0x1);
11665 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11666 type->classObjectType = backupClassObjectType;
11667 *thisExp = *e;
11668 thisExp->prev = (((void *)0));
11669 thisExp->next = (((void *)0));
11670 __ecereMethod_Expression_Clear(e);
11671 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)))
11672 {
11673 e->type = 4;
11674 e->op.op = '*';
11675 e->op.exp1 = (((void *)0));
11676 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
11677 }
11678 else
11679 {
11680 e->type = 11;
11681 e->cast.typeName = MkTypeName(specs, decl);
11682 e->cast.exp = thisExp;
11683 e->byReference = 0x1;
11684 }
11685 e->expType = type;
11686 e->destType = destType;
11687 type->refCount++;
11688 destType->refCount++;
11689 }
11690 }
11691 }
11692
11693 extern char *  strstr(char * , const char * );
11694
11695 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
11696
11697 struct __ecereNameSpace__ecere__com__DefinedExpression
11698 {
11699 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
11700 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
11701 char *  name;
11702 char *  value;
11703 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
11704 };
11705
11706 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11707
11708 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
11709
11710 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
11711
11712 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
11713
11714 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11715
11716 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
11717
11718 extern struct Expression * CopyExpression(struct Expression * exp);
11719
11720 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
11721
11722 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
11723
11724 static void ProcessStatement(struct Statement * stmt);
11725
11726 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
11727
11728 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
11729
11730 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
11731
11732 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
11733
11734 void ProcessExpressionType(struct Expression * exp)
11735 {
11736 void * __ecereTemp2;
11737 void * __ecereTemp1;
11738 unsigned int unresolved = 0x0;
11739 struct Location oldyylloc = yylloc;
11740 unsigned int notByReference = 0x0;
11741
11742 if(!exp || exp->expType)
11743 return ;
11744 yylloc = exp->loc;
11745 switch(exp->type)
11746 {
11747 case 0:
11748 {
11749 struct Identifier * id = exp->identifier;
11750
11751 if(!id)
11752 return ;
11753 if(id->_class && id->_class->name)
11754 {
11755 id->classSym = id->_class->symbol;
11756 }
11757 if(strstr(id->string, "__ecereClass") == id->string)
11758 {
11759 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
11760 break;
11761 }
11762 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
11763 {
11764 ReplaceClassMembers(exp, thisClass);
11765 if(exp->type != 0)
11766 {
11767 ProcessExpressionType(exp);
11768 break;
11769 }
11770 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
11771 break;
11772 }
11773 else
11774 {
11775 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11776
11777 if(!symbol)
11778 {
11779 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
11780 break;
11781 else
11782 {
11783 if(thisClass)
11784 {
11785 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
11786 if(exp->type != 0)
11787 {
11788 ProcessExpressionType(exp);
11789 break;
11790 }
11791 }
11792 else if(currentClass && !id->_class)
11793 {
11794 if(ResolveIdWithClass(exp, currentClass, 0x1))
11795 break;
11796 }
11797 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
11798 }
11799 }
11800 if(symbol)
11801 {
11802 struct Type * type = symbol->type;
11803 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
11804
11805 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
11806 {
11807 struct Context * context = SetupTemplatesContext(_class);
11808
11809 type = ReplaceThisClassType(_class);
11810 FinishTemplatesContext(context);
11811 if(type)
11812 type->refCount = 0;
11813 }
11814 FreeSpecifier(id->_class);
11815 id->_class = (((void *)0));
11816 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11817 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
11818 id->classSym = (((void *)0));
11819 exp->expType = type;
11820 if(type)
11821 type->refCount++;
11822 if(type && (type->kind == 15 || (_class && _class->type == 4)))
11823 exp->isConstant = 0x1;
11824 if(symbol->isParam || !strcmp(id->string, "this"))
11825 {
11826 if(_class && _class->type == 1)
11827 exp->byReference = 0x1;
11828 }
11829 if(symbol->isIterator)
11830 {
11831 if(symbol->isIterator == 3)
11832 {
11833 exp->type = 5;
11834 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
11835 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
11836 exp->expType = (((void *)0));
11837 ProcessExpressionType(exp);
11838 }
11839 else if(symbol->isIterator != 4)
11840 {
11841 exp->type = 8;
11842 exp->member.exp = MkExpIdentifier(exp->identifier);
11843 exp->member.exp->expType = exp->expType;
11844 exp->member.member = MkIdentifier("data");
11845 exp->expType = (((void *)0));
11846 ProcessExpressionType(exp);
11847 }
11848 }
11849 break;
11850 }
11851 else
11852 {
11853 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
11854
11855 if(thisNameSpace && !(id->_class && !id->_class->name))
11856 {
11857 char name[1024];
11858
11859 strcpy(name, thisNameSpace);
11860 strcat(name, "::");
11861 strcat(name, id->string);
11862 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
11863 }
11864 if(!definedExp)
11865 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
11866 if(definedExp)
11867 {
11868 int c;
11869
11870 for(c = 0; c < definedExpStackPos; c++)
11871 if(definedExpStack[c] == definedExp)
11872 break;
11873 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
11874 {
11875 struct Location backupYylloc = yylloc;
11876
11877 definedExpStack[definedExpStackPos++] = definedExp;
11878 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11879 ((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));
11880 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11881 echoOn = 0x0;
11882 parsedExpression = (((void *)0));
11883 resetScanner();
11884 expression_yyparse();
11885 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11886 yylloc = backupYylloc;
11887 if(parsedExpression)
11888 {
11889 FreeIdentifier(id);
11890 exp->type = 5;
11891 exp->list = MkListOne(parsedExpression);
11892 parsedExpression->loc = yylloc;
11893 ProcessExpressionType(exp);
11894 definedExpStackPos--;
11895 return ;
11896 }
11897 definedExpStackPos--;
11898 }
11899 else
11900 {
11901 if(inCompiler)
11902 {
11903 Compiler_Error("Recursion in defined expression %s\n", id->string);
11904 }
11905 }
11906 }
11907 else
11908 {
11909 struct GlobalData * data = (((void *)0));
11910
11911 if(thisNameSpace && !(id->_class && !id->_class->name))
11912 {
11913 char name[1024];
11914
11915 strcpy(name, thisNameSpace);
11916 strcat(name, "::");
11917 strcat(name, id->string);
11918 data = FindGlobalData(name);
11919 }
11920 if(!data)
11921 data = FindGlobalData(id->string);
11922 if(data)
11923 {
11924 DeclareGlobalData(data);
11925 exp->expType = data->dataType;
11926 if(data->dataType)
11927 data->dataType->refCount++;
11928 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11929 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
11930 FreeSpecifier(id->_class);
11931 id->_class = (((void *)0));
11932 break;
11933 }
11934 else
11935 {
11936 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
11937
11938 if(thisNameSpace && !(id->_class && !id->_class->name))
11939 {
11940 char name[1024];
11941
11942 strcpy(name, thisNameSpace);
11943 strcat(name, "::");
11944 strcat(name, id->string);
11945 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
11946 }
11947 if(!function)
11948 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
11949 if(function)
11950 {
11951 char name[1024];
11952
11953 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11954 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
11955 name[0] = (char)0;
11956 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
11957 strcpy(name, "__ecereFunction_");
11958 FullClassNameCat(name, id->string, 0x0);
11959 if(DeclareFunction(function, name))
11960 {
11961 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
11962 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
11963 }
11964 exp->expType = function->dataType;
11965 if(function->dataType)
11966 function->dataType->refCount++;
11967 FreeSpecifier(id->_class);
11968 id->_class = (((void *)0));
11969 break;
11970 }
11971 }
11972 }
11973 }
11974 }
11975 unresolved = 0x1;
11976 break;
11977 }
11978 case 1:
11979 {
11980 struct __ecereNameSpace__ecere__com__Class * _class;
11981
11982 if(!exp->instance->_class)
11983 {
11984 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
11985 {
11986 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
11987 }
11988 }
11989 ProcessInstantiationType(exp->instance);
11990 exp->isConstant = exp->instance->isConstant;
11991 if(exp->instance->_class)
11992 {
11993 exp->expType = MkClassType(exp->instance->_class->name);
11994 }
11995 break;
11996 }
11997 case 2:
11998 {
11999 if(!exp->expType)
12000 {
12001 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12002
12003 exp->expType = type;
12004 if(exp->constant[0] == '\'')
12005 {
12006 if((int)((unsigned char *)exp->constant)[1] > 127)
12007 {
12008 int nb;
12009 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12010
12011 if(nb < 2)
12012 ch = exp->constant[1];
12013 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12014 exp->constant = PrintUInt(ch);
12015 type->kind = 8;
12016 type->_class = FindClass("unichar");
12017 type->isSigned = 0x0;
12018 }
12019 else
12020 {
12021 type->kind = 1;
12022 type->isSigned = 0x1;
12023 }
12024 }
12025 else if(strchr(exp->constant, '.'))
12026 {
12027 char ch = exp->constant[strlen(exp->constant) - 1];
12028
12029 if(ch == 'f')
12030 type->kind = 6;
12031 else
12032 type->kind = 7;
12033 type->isSigned = 0x1;
12034 }
12035 else
12036 {
12037 if(exp->constant[0] == '0' && exp->constant[1])
12038 type->isSigned = 0x0;
12039 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12040 type->isSigned = 0x0;
12041 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12042 type->isSigned = 0x0;
12043 else
12044 type->isSigned = 0x1;
12045 type->kind = 3;
12046 }
12047 exp->isConstant = 0x1;
12048 }
12049 break;
12050 }
12051 case 3:
12052 {
12053 exp->isConstant = 0x1;
12054 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));
12055 break;
12056 }
12057 case 13:
12058 case 28:
12059 ProcessExpressionType(exp->_new.size);
12060 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));
12061 DeclareType(exp->expType->type, 0x0, 0x0);
12062 break;
12063 case 14:
12064 case 29:
12065 ProcessExpressionType(exp->_renew.size);
12066 ProcessExpressionType(exp->_renew.exp);
12067 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));
12068 DeclareType(exp->expType->type, 0x0, 0x0);
12069 break;
12070 case 4:
12071 {
12072 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12073 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12074 unsigned int useDestType = 0x0, useSideType = 0x0;
12075 struct Location oldyylloc = yylloc;
12076 unsigned int useSideUnit = 0x0;
12077 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12078
12079 switch(exp->op.op)
12080 {
12081 case '=':
12082 case 273:
12083 case 274:
12084 case 275:
12085 case 276:
12086 case 277:
12087 case 278:
12088 case 279:
12089 case 280:
12090 case 281:
12091 case 282:
12092 assign = 0x1;
12093 break;
12094 case '!':
12095 break;
12096 case 271:
12097 case 272:
12098 boolOps = 0x1;
12099 boolResult = 0x1;
12100 break;
12101 case 269:
12102 case '<':
12103 case '>':
12104 case 267:
12105 case 268:
12106 case 270:
12107 boolResult = 0x1;
12108 useSideType = 0x1;
12109 break;
12110 case '+':
12111 case '-':
12112 useSideUnit = 0x1;
12113 case '|':
12114 case '&':
12115 case '^':
12116 case '/':
12117 case '%':
12118 case '*':
12119 if(exp->op.op != '*' || exp->op.exp1)
12120 {
12121 useSideType = 0x1;
12122 useDestType = 0x1;
12123 }
12124 break;
12125 }
12126 if(exp->op.op == '&')
12127 {
12128 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12129 {
12130 struct Identifier * id = exp->op.exp2->identifier;
12131 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12132
12133 if(symbol && symbol->isIterator == 2)
12134 {
12135 exp->type = 8;
12136 exp->member.exp = exp->op.exp2;
12137 exp->member.member = MkIdentifier("key");
12138 exp->expType = (((void *)0));
12139 exp->op.exp2->expType = symbol->type;
12140 symbol->type->refCount++;
12141 ProcessExpressionType(exp);
12142 FreeType(dummy);
12143 break;
12144 }
12145 }
12146 }
12147 if(exp->op.exp1)
12148 {
12149 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))
12150 {
12151 if(exp->op.exp1->destType)
12152 FreeType(exp->op.exp1->destType);
12153 exp->op.exp1->destType = exp->destType;
12154 if(exp->destType)
12155 exp->destType->refCount++;
12156 }
12157 else if(!assign)
12158 {
12159 if(exp->op.exp1->destType)
12160 FreeType(exp->op.exp1->destType);
12161 exp->op.exp1->destType = dummy;
12162 dummy->refCount++;
12163 }
12164 if(exp->op.exp1->destType && exp->op.op != '=')
12165 exp->op.exp1->destType->count++;
12166 ProcessExpressionType(exp->op.exp1);
12167 if(exp->op.exp1->destType && exp->op.op != '=')
12168 exp->op.exp1->destType->count--;
12169 if(exp->op.exp1->destType == dummy)
12170 {
12171 FreeType(dummy);
12172 exp->op.exp1->destType = (((void *)0));
12173 }
12174 type1 = exp->op.exp1->expType;
12175 }
12176 if(exp->op.exp2)
12177 {
12178 char expString[10240];
12179
12180 expString[0] = '\0';
12181 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12182 {
12183 if(exp->op.exp1)
12184 {
12185 exp->op.exp2->destType = exp->op.exp1->expType;
12186 if(exp->op.exp1->expType)
12187 exp->op.exp1->expType->refCount++;
12188 }
12189 else
12190 {
12191 exp->op.exp2->destType = exp->destType;
12192 if(exp->destType)
12193 exp->destType->refCount++;
12194 }
12195 if(type1)
12196 type1->refCount++;
12197 exp->expType = type1;
12198 }
12199 else if(assign)
12200 {
12201 if(inCompiler)
12202 PrintExpression(exp->op.exp2, expString);
12203 if(type1 && type1->kind == 13)
12204 {
12205 if(exp->op.op == 273 || exp->op.op == 274 || exp->op.op == 275 || exp->op.op == 278 || exp->op.op == 279 || exp->op.op == 280 || exp->op.op == 282)
12206 Compiler_Error("operator %s illegal on pointer\n", exp->op.op);
12207 else if(exp->op.op == '=')
12208 {
12209 if(exp->op.exp2->destType)
12210 FreeType(exp->op.exp2->destType);
12211 exp->op.exp2->destType = type1;
12212 if(type1)
12213 type1->refCount++;
12214 }
12215 }
12216 else
12217 {
12218 if(exp->op.op == 273 || exp->op.op == 274 || exp->op.op == 275 || exp->op.op == 278 || exp->op.op == 279)
12219 ;
12220 else
12221 {
12222 if(exp->op.exp2->destType)
12223 FreeType(exp->op.exp2->destType);
12224 exp->op.exp2->destType = type1;
12225 if(type1)
12226 type1->refCount++;
12227 }
12228 }
12229 if(type1)
12230 type1->refCount++;
12231 exp->expType = type1;
12232 }
12233 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)))
12234 {
12235 if(exp->op.exp2->destType)
12236 FreeType(exp->op.exp2->destType);
12237 exp->op.exp2->destType = exp->destType;
12238 if(exp->destType)
12239 exp->destType->refCount++;
12240 }
12241 else
12242 {
12243 if(exp->op.exp2->destType)
12244 FreeType(exp->op.exp2->destType);
12245 exp->op.exp2->destType = dummy;
12246 dummy->refCount++;
12247 }
12248 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12249 {
12250 FreeType(exp->op.exp2->destType);
12251 exp->op.exp2->destType = type1;
12252 type1->refCount++;
12253 }
12254 if(exp->op.exp2->destType && exp->op.op != '=')
12255 exp->op.exp2->destType->count++;
12256 ProcessExpressionType(exp->op.exp2);
12257 if(exp->op.exp2->destType && exp->op.op != '=')
12258 exp->op.exp2->destType->count--;
12259 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12260 {
12261 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)
12262 {
12263 if(exp->op.op != '=' && type1->type->kind == 0)
12264 Compiler_Error("void *: unknown size\n");
12265 }
12266 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)))
12267 {
12268 if(exp->op.op == 276)
12269 Compiler_Error("cannot add two pointers\n");
12270 }
12271 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))
12272 {
12273 if(exp->op.op == 276)
12274 Compiler_Error("cannot add two pointers\n");
12275 }
12276 else if(inCompiler)
12277 {
12278 char type1String[1024];
12279 char type2String[1024];
12280
12281 type1String[0] = '\0';
12282 type2String[0] = '\0';
12283 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12284 PrintType(type1, type2String, 0x0, 0x1);
12285 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12286 Compiler_Warning("incompatible expression %s (%s); expected %s\n", expString, type1String, type2String);
12287 }
12288 }
12289 if(exp->op.exp2->destType == dummy)
12290 {
12291 FreeType(dummy);
12292 exp->op.exp2->destType = (((void *)0));
12293 }
12294 type2 = exp->op.exp2->expType;
12295 }
12296 dummy->kind = 0;
12297 if(exp->op.op == 261)
12298 {
12299 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12300 exp->isConstant = 0x1;
12301 }
12302 else if(exp->op.op == '*' && !exp->op.exp1)
12303 {
12304 exp->expType = Dereference(type2);
12305 if(type2 && type2->kind == 8)
12306 notByReference = 0x1;
12307 }
12308 else if(exp->op.op == '&' && !exp->op.exp1)
12309 exp->expType = Reference(type2);
12310 else if(!assign)
12311 {
12312 if(boolOps)
12313 {
12314 if(exp->op.exp1)
12315 {
12316 if(exp->op.exp1->destType)
12317 FreeType(exp->op.exp1->destType);
12318 exp->op.exp1->destType = MkClassType("bool");
12319 exp->op.exp1->destType->truth = 0x1;
12320 if(!exp->op.exp1->expType)
12321 ProcessExpressionType(exp->op.exp1);
12322 else
12323 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12324 FreeType(exp->op.exp1->expType);
12325 exp->op.exp1->expType = MkClassType("bool");
12326 exp->op.exp1->expType->truth = 0x1;
12327 }
12328 if(exp->op.exp2)
12329 {
12330 if(exp->op.exp2->destType)
12331 FreeType(exp->op.exp2->destType);
12332 exp->op.exp2->destType = MkClassType("bool");
12333 exp->op.exp2->destType->truth = 0x1;
12334 if(!exp->op.exp2->expType)
12335 ProcessExpressionType(exp->op.exp2);
12336 else
12337 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12338 FreeType(exp->op.exp2->expType);
12339 exp->op.exp2->expType = MkClassType("bool");
12340 exp->op.exp2->expType->truth = 0x1;
12341 }
12342 }
12343 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")))))
12344 {
12345 if(type1 && type2 && ((type1->kind == 8 && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && strcmp(type2->_class->string, "String"))))
12346 {
12347 if(exp->op.exp2->destType)
12348 FreeType(exp->op.exp2->destType);
12349 exp->op.exp2->destType = type1;
12350 type1->refCount++;
12351 if(exp->op.exp1->destType)
12352 FreeType(exp->op.exp1->destType);
12353 exp->op.exp1->destType = type2;
12354 type2->refCount++;
12355 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)
12356 Compiler_Warning("operating on %s and %s with an untyped result, assuming %s\n", type1->_class->string, type2->_class->string, type1->_class->string);
12357 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12358 {
12359 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12360
12361 if(argExp)
12362 {
12363 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12364
12365 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12366 ProcessExpressionType(exp->op.exp1);
12367 if(type2->kind != 13)
12368 {
12369 ProcessExpressionType(classExp);
12370 exp->op.exp2 = MkExpBrackets(MkListOne(MkExpOp(exp->op.exp2, '*', MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), 269, MkExpConstant("5")), 272, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), 269, MkExpConstant("0"))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(301)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize"))))))));
12371 if(!exp->op.exp2->expType)
12372 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12373 ProcessExpressionType(exp->op.exp2);
12374 }
12375 }
12376 }
12377 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)))
12378 {
12379 if(type1->kind != 8 && type1->type->kind == 0)
12380 Compiler_Error("void *: unknown size\n");
12381 exp->expType = type1;
12382 if(type1)
12383 type1->refCount++;
12384 }
12385 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)))
12386 {
12387 if(type2->kind != 8 && type2->type->kind == 0)
12388 Compiler_Error("void *: unknown size\n");
12389 exp->expType = type2;
12390 if(type2)
12391 type2->refCount++;
12392 }
12393 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))
12394 {
12395 Compiler_Warning("different levels of indirection\n");
12396 }
12397 else
12398 {
12399 unsigned int success = 0x0;
12400
12401 if(type1->kind == 13 && type2->kind == 13)
12402 {
12403 if(exp->op.op == '+')
12404 Compiler_Error("cannot add two pointers\n");
12405 else if(exp->op.op == '-')
12406 {
12407 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12408 {
12409 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12410 success = 0x1;
12411 if(type1->type->kind == 20)
12412 {
12413 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12414
12415 if(argExp)
12416 {
12417 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12418
12419 ProcessExpressionType(classExp);
12420 exp->type = 5;
12421 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")), 269, MkExpIdentifier(MkIdentifier("noHeadClass"))), 272, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), 269, MkExpIdentifier(MkIdentifier("normalClass")))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(301)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize")))))));
12422 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12423 FreeType(dummy);
12424 return ;
12425 }
12426 }
12427 }
12428 }
12429 }
12430 if(!success && exp->op.exp1->type == 2)
12431 {
12432 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12433 {
12434 exp->expType = exp->op.exp1->destType;
12435 if(exp->op.exp1->destType)
12436 exp->op.exp1->destType->refCount++;
12437 success = 0x1;
12438 }
12439 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12440 {
12441 exp->expType = exp->op.exp2->destType;
12442 if(exp->op.exp2->destType)
12443 exp->op.exp2->destType->refCount++;
12444 success = 0x1;
12445 }
12446 }
12447 else if(!success)
12448 {
12449 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12450 {
12451 exp->expType = exp->op.exp2->destType;
12452 if(exp->op.exp2->destType)
12453 exp->op.exp2->destType->refCount++;
12454 success = 0x1;
12455 }
12456 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12457 {
12458 exp->expType = exp->op.exp1->destType;
12459 if(exp->op.exp1->destType)
12460 exp->op.exp1->destType->refCount++;
12461 success = 0x1;
12462 }
12463 }
12464 if(!success)
12465 {
12466 char expString1[10240];
12467 char expString2[10240];
12468 char type1[1024];
12469 char type2[1024];
12470
12471 expString1[0] = '\0';
12472 expString2[0] = '\0';
12473 type1[0] = '\0';
12474 type2[0] = '\0';
12475 if(inCompiler)
12476 {
12477 PrintExpression(exp->op.exp1, expString1);
12478 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12479 PrintExpression(exp->op.exp2, expString2);
12480 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12481 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12482 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12483 }
12484 Compiler_Warning("incompatible expressions %s (%s) and %s (%s)\n", expString1, type1, expString2, type2);
12485 }
12486 }
12487 }
12488 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12489 {
12490 if(exp->op.exp1->destType)
12491 FreeType(exp->op.exp1->destType);
12492 exp->op.exp1->destType = type2->_class->registered->dataType;
12493 if(type2->_class->registered->dataType)
12494 type2->_class->registered->dataType->refCount++;
12495 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12496 exp->expType = type2;
12497 if(type2)
12498 type2->refCount++;
12499 }
12500 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12501 {
12502 if(exp->op.exp2->destType)
12503 FreeType(exp->op.exp2->destType);
12504 exp->op.exp2->destType = type1->_class->registered->dataType;
12505 if(type1->_class->registered->dataType)
12506 type1->_class->registered->dataType->refCount++;
12507 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12508 exp->expType = type1;
12509 if(type1)
12510 type1->refCount++;
12511 }
12512 else if(type1)
12513 {
12514 unsigned int valid = 0x0;
12515
12516 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12517 {
12518 if(exp->op.exp2->destType)
12519 FreeType(exp->op.exp2->destType);
12520 if(!type1->_class->registered->dataType)
12521 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12522 exp->op.exp2->destType = type1->_class->registered->dataType;
12523 exp->op.exp2->destType->refCount++;
12524 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12525 type2 = exp->op.exp2->destType;
12526 exp->expType = type2;
12527 type2->refCount++;
12528 }
12529 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12530 {
12531 if(exp->op.exp1->destType)
12532 FreeType(exp->op.exp1->destType);
12533 if(!type2->_class->registered->dataType)
12534 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12535 exp->op.exp1->destType = type2->_class->registered->dataType;
12536 exp->op.exp1->destType->refCount++;
12537 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12538 type1 = exp->op.exp1->destType;
12539 exp->expType = type1;
12540 type1->refCount++;
12541 }
12542 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12543 {
12544 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12545 {
12546 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12547 {
12548 exp->expType = exp->op.exp1->expType;
12549 if(exp->op.exp2->expType)
12550 exp->op.exp1->expType->refCount++;
12551 valid = 0x1;
12552 }
12553 }
12554 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12555 {
12556 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12557 {
12558 exp->expType = exp->op.exp2->expType;
12559 if(exp->op.exp2->expType)
12560 exp->op.exp2->expType->refCount++;
12561 valid = 0x1;
12562 }
12563 }
12564 }
12565 if(!valid)
12566 {
12567 if(exp->op.exp2->destType)
12568 FreeType(exp->op.exp2->destType);
12569 exp->op.exp2->destType = type1;
12570 type1->refCount++;
12571 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12572 {
12573 exp->expType = exp->op.exp2->destType;
12574 if(exp->op.exp2->destType)
12575 exp->op.exp2->destType->refCount++;
12576 }
12577 else if(type1 && type2)
12578 {
12579 char expString1[10240];
12580 char expString2[10240];
12581 char type1String[1024];
12582 char type2String[1024];
12583
12584 expString1[0] = '\0';
12585 expString2[0] = '\0';
12586 type1String[0] = '\0';
12587 type2String[0] = '\0';
12588 if(inCompiler)
12589 {
12590 PrintExpression(exp->op.exp1, expString1);
12591 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12592 PrintExpression(exp->op.exp2, expString2);
12593 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12594 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12595 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12596 }
12597 Compiler_Warning("incompatible expressions %s (%s) and %s (%s)\n", expString1, type1String, expString2, type2String);
12598 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12599 {
12600 exp->expType = exp->op.exp1->expType;
12601 if(exp->op.exp1->expType)
12602 exp->op.exp1->expType->refCount++;
12603 }
12604 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12605 {
12606 exp->expType = exp->op.exp2->expType;
12607 if(exp->op.exp2->expType)
12608 exp->op.exp2->expType->refCount++;
12609 }
12610 }
12611 }
12612 }
12613 else if(type2)
12614 {
12615 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12616 {
12617 struct Type * oldType = exp->op.exp1->expType;
12618
12619 exp->op.exp1->expType = (((void *)0));
12620 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12621 FreeType(oldType);
12622 else
12623 exp->op.exp1->expType = oldType;
12624 }
12625 if(exp->op.exp1->destType)
12626 FreeType(exp->op.exp1->destType);
12627 exp->op.exp1->destType = type2;
12628 type2->refCount++;
12629 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12630 {
12631 exp->expType = exp->op.exp1->destType;
12632 if(exp->op.exp1->destType)
12633 exp->op.exp1->destType->refCount++;
12634 }
12635 }
12636 }
12637 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12638 {
12639 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12640 {
12641 if(exp->op.exp1->destType)
12642 FreeType(exp->op.exp1->destType);
12643 exp->op.exp1->destType = type2->_class->registered->dataType;
12644 if(type2->_class->registered->dataType)
12645 type2->_class->registered->dataType->refCount++;
12646 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12647 }
12648 if(exp->op.op == '!')
12649 {
12650 exp->expType = MkClassType("bool");
12651 exp->expType->truth = 0x1;
12652 }
12653 else
12654 {
12655 exp->expType = type2;
12656 if(type2)
12657 type2->refCount++;
12658 }
12659 }
12660 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
12661 {
12662 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12663 {
12664 if(exp->op.exp2->destType)
12665 FreeType(exp->op.exp2->destType);
12666 exp->op.exp2->destType = type1->_class->registered->dataType;
12667 if(type1->_class->registered->dataType)
12668 type1->_class->registered->dataType->refCount++;
12669 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12670 }
12671 exp->expType = type1;
12672 if(type1)
12673 type1->refCount++;
12674 }
12675 }
12676 yylloc = exp->loc;
12677 if(exp->op.exp1 && !exp->op.exp1->expType)
12678 {
12679 char expString[10000];
12680
12681 expString[0] = '\0';
12682 if(inCompiler)
12683 {
12684 PrintExpression(exp->op.exp1, expString);
12685 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12686 }
12687 if(expString[0])
12688 Compiler_Error("couldn't determine type of %s\n", expString);
12689 }
12690 if(exp->op.exp2 && !exp->op.exp2->expType)
12691 {
12692 char expString[10240];
12693
12694 expString[0] = '\0';
12695 if(inCompiler)
12696 {
12697 PrintExpression(exp->op.exp2, expString);
12698 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12699 }
12700 if(expString[0])
12701 Compiler_Error("couldn't determine type of %s\n", expString);
12702 }
12703 if(boolResult)
12704 {
12705 FreeType(exp->expType);
12706 exp->expType = MkClassType("bool");
12707 exp->expType->truth = 0x1;
12708 }
12709 if(exp->op.op != 261)
12710 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
12711 if(exp->op.op == 261 && exp->op.exp2->expType)
12712 {
12713 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
12714 }
12715 yylloc = oldyylloc;
12716 FreeType(dummy);
12717 break;
12718 }
12719 case 5:
12720 case 34:
12721 {
12722 struct Expression * e;
12723
12724 exp->isConstant = 0x1;
12725 for(e = (*exp->list).first; e; e = e->next)
12726 {
12727 unsigned int inced = 0x0;
12728
12729 if(!e->next)
12730 {
12731 FreeType(e->destType);
12732 e->destType = exp->destType;
12733 if(e->destType)
12734 {
12735 exp->destType->refCount++;
12736 e->destType->count++;
12737 inced = 0x1;
12738 }
12739 }
12740 ProcessExpressionType(e);
12741 if(inced)
12742 exp->destType->count--;
12743 if(!exp->expType && !e->next)
12744 {
12745 exp->expType = e->expType;
12746 if(e->expType)
12747 e->expType->refCount++;
12748 }
12749 if(!e->isConstant)
12750 exp->isConstant = 0x0;
12751 }
12752 e = (*exp->list).first;
12753 if(!e->next && e->type == 8)
12754 {
12755 struct Expression * next = exp->next, * prev = exp->prev;
12756
12757 FreeType(exp->expType);
12758 FreeType(exp->destType);
12759 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
12760 *exp = *e;
12761 exp->prev = prev;
12762 exp->next = next;
12763 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
12764 ProcessExpressionType(exp);
12765 }
12766 break;
12767 }
12768 case 6:
12769 {
12770 struct Expression * e;
12771
12772 exp->isConstant = 0x1;
12773 ProcessExpressionType(exp->index.exp);
12774 if(!exp->index.exp->isConstant)
12775 exp->isConstant = 0x0;
12776 if(exp->index.exp->expType)
12777 {
12778 struct Type * source = exp->index.exp->expType;
12779
12780 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)
12781 {
12782 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
12783
12784 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
12785 if(exp->index.index && (*exp->index.index).last)
12786 {
12787 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
12788 }
12789 }
12790 }
12791 for(e = (*exp->index.index).first; e; e = e->next)
12792 {
12793 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
12794 {
12795 if(e->destType)
12796 FreeType(e->destType);
12797 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
12798 }
12799 ProcessExpressionType(e);
12800 if(!e->next)
12801 {
12802 }
12803 if(!e->isConstant)
12804 exp->isConstant = 0x0;
12805 }
12806 if(!exp->expType)
12807 exp->expType = Dereference(exp->index.exp->expType);
12808 if(exp->expType)
12809 DeclareType(exp->expType, 0x0, 0x0);
12810 break;
12811 }
12812 case 7:
12813 {
12814 struct Expression * e;
12815 struct Type * functionType;
12816 struct Type * methodType = (((void *)0));
12817 char name[1024];
12818
12819 name[0] = '\0';
12820 if(inCompiler)
12821 {
12822 PrintExpression(exp->call.exp, name);
12823 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
12824 {
12825 PrintExpression(exp->call.exp, name);
12826 }
12827 }
12828 if(exp->call.exp->type == 0)
12829 {
12830 struct Expression * idExp = exp->call.exp;
12831 struct Identifier * id = idExp->identifier;
12832
12833 if(!strcmp(id->string, "__ENDIAN_PAD"))
12834 {
12835 exp->expType = ProcessTypeString("int", 0x1);
12836 if(exp->call.arguments && (*exp->call.arguments).first)
12837 ProcessExpressionType((*exp->call.arguments).first);
12838 break;
12839 }
12840 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
12841 {
12842 struct Expression * a = (((void *)0));
12843 struct Expression * b = (((void *)0));
12844 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
12845
12846 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
12847 {
12848 a = (*exp->call.arguments).first;
12849 b = (*exp->call.arguments).last;
12850 tempExp1 = a;
12851 tempExp2 = b;
12852 }
12853 else if((*exp->call.arguments).count == 1)
12854 {
12855 a = (*exp->call.arguments).first;
12856 tempExp1 = a;
12857 }
12858 if(a)
12859 {
12860 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
12861 idExp->identifier = (((void *)0));
12862 FreeExpContents(exp);
12863 ProcessExpressionType(a);
12864 if(b)
12865 ProcessExpressionType(b);
12866 exp->type = 5;
12867 exp->list = MkList();
12868 if(a->expType && (!b || b->expType))
12869 {
12870 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
12871 {
12872 if(inCompiler)
12873 {
12874 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12875 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
12876 struct Declaration * decl;
12877 char temp1[1024], temp2[1024];
12878
12879 GetTypeSpecs(a->expType, specs);
12880 if(a && !a->isConstant && a->type != 0)
12881 {
12882 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
12883 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
12884 tempExp1 = QMkExpId(temp1);
12885 tempExp1->expType = a->expType;
12886 if(a->expType)
12887 a->expType->refCount++;
12888 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
12889 }
12890 if(b && !b->isConstant && b->type != 0)
12891 {
12892 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
12893 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
12894 tempExp2 = QMkExpId(temp2);
12895 tempExp2->expType = b->expType;
12896 if(b->expType)
12897 b->expType->refCount++;
12898 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
12899 }
12900 decl = MkDeclaration(specs, decls);
12901 if(!curCompound->compound.declarations)
12902 curCompound->compound.declarations = MkList();
12903 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
12904 }
12905 }
12906 }
12907 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
12908 {
12909 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
12910
12911 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
12912 exp->expType = a->expType;
12913 if(a->expType)
12914 a->expType->refCount++;
12915 }
12916 else if(!strcmp(id->string, "Abs"))
12917 {
12918 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
12919 exp->expType = a->expType;
12920 if(a->expType)
12921 a->expType->refCount++;
12922 }
12923 else if(!strcmp(id->string, "Sgn"))
12924 {
12925 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"))))));
12926 exp->expType = ProcessTypeString("int", 0x0);
12927 }
12928 FreeExpression(tempExp1);
12929 if(tempExp2)
12930 FreeExpression(tempExp2);
12931 FreeIdentifier(id);
12932 break;
12933 }
12934 }
12935 }
12936 {
12937 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12938
12939 if(!exp->call.exp->destType)
12940 {
12941 exp->call.exp->destType = dummy;
12942 dummy->refCount++;
12943 }
12944 ProcessExpressionType(exp->call.exp);
12945 if(exp->call.exp->destType == dummy)
12946 {
12947 FreeType(dummy);
12948 exp->call.exp->destType = (((void *)0));
12949 }
12950 FreeType(dummy);
12951 }
12952 functionType = exp->call.exp->expType;
12953 if(functionType && functionType->kind == 16)
12954 {
12955 methodType = functionType;
12956 functionType = methodType->method->dataType;
12957 if(exp->call.exp->expType->usedClass)
12958 {
12959 char typeString[1024];
12960
12961 typeString[0] = '\0';
12962 PrintType(functionType, typeString, 0x1, 0x1);
12963 if(strstr(typeString, "thisclass"))
12964 {
12965 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12966 struct Declarator * decl;
12967
12968 {
12969 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
12970
12971 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12972 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
12973 thisClassParams = 0x0;
12974 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
12975 {
12976 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
12977
12978 thisClass = exp->call.exp->expType->usedClass;
12979 ProcessDeclarator(decl);
12980 thisClass = backupThisClass;
12981 }
12982 thisClassParams = 0x1;
12983 functionType = ProcessType(specs, decl);
12984 functionType->refCount = 0;
12985 FinishTemplatesContext(context);
12986 }
12987 FreeList(specs, FreeSpecifier);
12988 FreeDeclarator(decl);
12989 }
12990 }
12991 }
12992 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
12993 {
12994 struct Type * type = functionType->type;
12995
12996 if(!functionType->refCount)
12997 {
12998 functionType->type = (((void *)0));
12999 FreeType(functionType);
13000 }
13001 functionType = type;
13002 }
13003 if(functionType && functionType->kind != 11)
13004 {
13005 Compiler_Error("called object %s is not a function\n", name);
13006 }
13007 else if(functionType)
13008 {
13009 unsigned int emptyParams = 0x0, noParams = 0x0;
13010 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13011 struct Type * type = functionType->params.first;
13012 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13013 int extra = 0;
13014 struct Location oldyylloc = yylloc;
13015
13016 if(!type)
13017 emptyParams = 0x1;
13018 if(functionType->extraParam && e)
13019 {
13020 e->destType = MkClassType(functionType->thisClass->string);
13021 e = e->next;
13022 }
13023 if(!functionType->staticMethod)
13024 {
13025 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13026 {
13027 type = MkClassType(memberExp->member.exp->expType->_class->string);
13028 if(e)
13029 {
13030 e->destType = type;
13031 e = e->next;
13032 type = functionType->params.first;
13033 }
13034 else
13035 type->refCount = 0;
13036 }
13037 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13038 {
13039 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13040 if(e)
13041 {
13042 e->destType = type;
13043 e = e->next;
13044 type = functionType->params.first;
13045 }
13046 else
13047 type->refCount = 0;
13048 }
13049 }
13050 if(type && type->kind == 0)
13051 {
13052 noParams = 0x1;
13053 if(!type->refCount)
13054 FreeType(type);
13055 type = (((void *)0));
13056 }
13057 for(; e; e = e->next)
13058 {
13059 if(!type && !emptyParams)
13060 {
13061 yylloc = e->loc;
13062 if(methodType && methodType->methodClass)
13063 Compiler_Error("too many arguments for method %s::%s (%d given, expected %d)\n", methodType->methodClass->fullName, methodType->method->name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13064 else
13065 Compiler_Error("too many arguments for function %s (%d given, expected %d)\n", name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13066 break;
13067 }
13068 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13069 {
13070 struct Type * templatedType = (((void *)0));
13071 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13072 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13073 int id = 0;
13074
13075 if(_class && _class->templateArgs)
13076 {
13077 struct __ecereNameSpace__ecere__com__Class * sClass;
13078
13079 for(sClass = _class; sClass; sClass = sClass->base)
13080 {
13081 if(sClass->templateClass)
13082 sClass = sClass->templateClass;
13083 id = 0;
13084 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13085 {
13086 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13087 {
13088 struct __ecereNameSpace__ecere__com__Class * nextClass;
13089
13090 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13091 {
13092 if(nextClass->templateClass)
13093 nextClass = nextClass->templateClass;
13094 id += nextClass->templateParams.count;
13095 }
13096 break;
13097 }
13098 id++;
13099 }
13100 if(curParam)
13101 break;
13102 }
13103 }
13104 if(curParam && _class->templateArgs[id].dataTypeString)
13105 {
13106 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13107
13108 {
13109 struct Context * context = SetupTemplatesContext(_class);
13110
13111 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13112 FinishTemplatesContext(context);
13113 }
13114 e->destType = templatedType;
13115 if(templatedType)
13116 {
13117 templatedType->passAsTemplate = 0x1;
13118 }
13119 }
13120 else
13121 {
13122 e->destType = type;
13123 if(type)
13124 type->refCount++;
13125 }
13126 }
13127 else
13128 {
13129 e->destType = type;
13130 if(type)
13131 type->refCount++;
13132 }
13133 if(type && type->kind != 14)
13134 {
13135 struct Type * next = type->next;
13136
13137 if(!type->refCount)
13138 FreeType(type);
13139 type = next;
13140 }
13141 }
13142 if(type && type->kind != 14)
13143 {
13144 if(methodType && methodType->methodClass)
13145 Compiler_Warning("not enough arguments for method %s::%s (%d given, expected %d)\n", methodType->methodClass->fullName, methodType->method->name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13146 else
13147 Compiler_Warning("not enough arguments for function %s (%d given, expected %d)\n", name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13148 }
13149 yylloc = oldyylloc;
13150 if(type && !type->refCount)
13151 FreeType(type);
13152 }
13153 else
13154 {
13155 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13156 if(exp->call.exp->type == 0)
13157 {
13158 char * string = exp->call.exp->identifier->string;
13159
13160 if(inCompiler)
13161 {
13162 struct Symbol * symbol;
13163 struct Location oldyylloc = yylloc;
13164
13165 yylloc = exp->call.exp->identifier->loc;
13166 if(strstr(string, "__builtin_") == string)
13167 ;
13168 else
13169 Compiler_Warning("%s undefined; assuming extern returning int\n", string);
13170 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));
13171 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13172 yylloc = oldyylloc;
13173 }
13174 }
13175 else if(exp->call.exp->type == 8)
13176 {
13177 }
13178 else
13179 Compiler_Warning("callable object undefined; extern assuming returning int\n");
13180 if(!functionType->returnType)
13181 {
13182 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13183 }
13184 }
13185 if(functionType && functionType->kind == 11)
13186 {
13187 exp->expType = functionType->returnType;
13188 if(functionType->returnType)
13189 functionType->returnType->refCount++;
13190 if(!functionType->refCount)
13191 FreeType(functionType);
13192 }
13193 if(exp->call.arguments)
13194 {
13195 for(e = (*exp->call.arguments).first; e; e = e->next)
13196 {
13197 struct Type * destType = e->destType;
13198
13199 ProcessExpressionType(e);
13200 }
13201 }
13202 break;
13203 }
13204 case 8:
13205 {
13206 struct Type * type;
13207 struct Location oldyylloc = yylloc;
13208 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13209
13210 exp->thisPtr = thisPtr;
13211 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13212 {
13213 exp->member.member->classSym = exp->member.member->_class->symbol;
13214 }
13215 ProcessExpressionType(exp->member.exp);
13216 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)
13217 {
13218 exp->isConstant = 0x0;
13219 }
13220 else
13221 exp->isConstant = exp->member.exp->isConstant;
13222 type = exp->member.exp->expType;
13223 yylloc = exp->loc;
13224 if(type && (type->kind == 20))
13225 {
13226 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13227 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13228
13229 if(_class)
13230 {
13231 for(param = _class->templateParams.first; param; param = param->next)
13232 {
13233 if(param->type == 1 && !strcmp(param->name, exp->member.member->string))
13234 break;
13235 }
13236 }
13237 if(param && param->defaultArg.member)
13238 {
13239 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13240
13241 if(argExp)
13242 {
13243 struct Expression * expMember = exp->member.exp;
13244 struct Declarator * decl;
13245 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13246 char thisClassTypeString[1024];
13247
13248 FreeIdentifier(exp->member.member);
13249 ProcessExpressionType(argExp);
13250 {
13251 char * colon = strstr(param->defaultArg.memberString, "::");
13252
13253 if(colon)
13254 {
13255 char className[1024];
13256 struct __ecereNameSpace__ecere__com__Class * sClass;
13257
13258 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13259 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13260 }
13261 else
13262 strcpy(thisClassTypeString, _class->fullName);
13263 }
13264 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13265 exp->expType = ProcessType(specs, decl);
13266 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13267 {
13268 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13269 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13270 int c;
13271 int paramCount = 0;
13272 int lastParam = -1;
13273 char templateString[1024];
13274 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13275
13276 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13277 for(cClass = expClass; cClass; cClass = cClass->base)
13278 {
13279 int p = 0;
13280
13281 for(param = cClass->templateParams.first; param; param = param->next)
13282 {
13283 int id = p;
13284 struct __ecereNameSpace__ecere__com__Class * sClass;
13285 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13286
13287 for(sClass = cClass->base; sClass; sClass = sClass->base)
13288 id += sClass->templateParams.count;
13289 arg = expClass->templateArgs[id];
13290 for(sClass = _class; sClass; sClass = sClass->base)
13291 {
13292 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13293 int p = 0;
13294 struct __ecereNameSpace__ecere__com__Class * nextClass;
13295
13296 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13297 p += nextClass->templateParams.count;
13298 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13299 {
13300 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13301 {
13302 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13303 {
13304 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13305 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13306 break;
13307 }
13308 }
13309 }
13310 }
13311 {
13312 char argument[256];
13313
13314 argument[0] = '\0';
13315 switch(param->type)
13316 {
13317 case 2:
13318 {
13319 char expString[1024];
13320 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13321 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13322 struct Expression * exp;
13323 char * string = PrintHexUInt64(arg.expression.ui64);
13324
13325 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13326 ProcessExpressionType(exp);
13327 ComputeExpression(exp);
13328 expString[0] = '\0';
13329 PrintExpression(exp, expString);
13330 strcat(argument, expString);
13331 FreeExpression(exp);
13332 break;
13333 }
13334 case 1:
13335 {
13336 strcat(argument, arg.member->name);
13337 break;
13338 }
13339 case 0:
13340 {
13341 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13342 {
13343 if(!strcmp(arg.dataTypeString, "thisclass"))
13344 strcat(argument, thisClassTypeString);
13345 else
13346 strcat(argument, arg.dataTypeString);
13347 }
13348 break;
13349 }
13350 }
13351 if(argument[0])
13352 {
13353 if(paramCount)
13354 strcat(templateString, ", ");
13355 if(lastParam != p - 1)
13356 {
13357 strcat(templateString, param->name);
13358 strcat(templateString, " = ");
13359 }
13360 strcat(templateString, argument);
13361 paramCount++;
13362 lastParam = p;
13363 }
13364 p++;
13365 }
13366 }
13367 }
13368 {
13369 int len = strlen(templateString);
13370
13371 if(templateString[len - 1] == '>')
13372 templateString[len++] = ' ';
13373 templateString[len++] = '>';
13374 templateString[len++] = '\0';
13375 }
13376 {
13377 struct Context * context = SetupTemplatesContext(_class);
13378
13379 FreeType(exp->expType);
13380 exp->expType = ProcessTypeString(templateString, 0x0);
13381 FinishTemplatesContext(context);
13382 }
13383 }
13384 exp->type = 5;
13385 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")))))))));
13386 }
13387 }
13388 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13389 {
13390 type = ProcessTemplateParameterType(type->templateParameter);
13391 }
13392 }
13393 if(type && (type->kind == 20))
13394 ;
13395 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13396 {
13397 struct Identifier * id = exp->member.member;
13398 int typeKind = type->kind;
13399 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));
13400
13401 if(typeKind == 19 && exp->member.exp->type == 26)
13402 {
13403 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13404 typeKind = 8;
13405 }
13406 if(id && (typeKind == 3 || typeKind == 15))
13407 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13408 if(_class && id)
13409 {
13410 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13411 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13412 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13413 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13414 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13415
13416 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13417 exp->member.memberType = 1;
13418 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13419 Compiler_Error("invalid class specifier %s for object of class %s\n", _class->fullName, type->_class->string);
13420 if(typeKind != 19)
13421 {
13422 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13423 {
13424 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13425 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13426 {
13427 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13428 if(prop)
13429 member = (((void *)0));
13430 }
13431 if(!member && !prop)
13432 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13433 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13434 exp->member.thisPtr = 0x1;
13435 }
13436 else
13437 {
13438 if(!id->classSym)
13439 {
13440 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13441 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13442 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13443 }
13444 if(!prop && !member)
13445 {
13446 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13447 if(!method)
13448 {
13449 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13450 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13451 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13452 }
13453 }
13454 if(member && prop)
13455 {
13456 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13457 prop = (((void *)0));
13458 else
13459 member = (((void *)0));
13460 }
13461 }
13462 }
13463 if(!prop && !member)
13464 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13465 if(!prop && !member && !method)
13466 {
13467 if(typeKind == 19)
13468 {
13469 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13470 if(classProp)
13471 {
13472 exp->member.memberType = 5;
13473 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13474 }
13475 else
13476 {
13477 char structName[1024];
13478 struct Identifier * id = exp->member.member;
13479 struct Expression * classExp = exp->member.exp;
13480
13481 type->refCount++;
13482 FreeType(classExp->expType);
13483 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13484 strcpy(structName, "__ecereClassData_");
13485 FullClassNameCat(structName, type->_class->string, 0x0);
13486 exp->type = 9;
13487 exp->member.member = id;
13488 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(289)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(type->_class->string)), (((void *)0))), MkIdentifier("offsetClass"))))))));
13489 FreeType(type);
13490 ProcessExpressionType(exp);
13491 return ;
13492 }
13493 }
13494 else
13495 {
13496 struct Symbol * classSym = FindClass(id->string);
13497
13498 if(classSym)
13499 {
13500 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13501
13502 if(convertClass)
13503 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13504 }
13505 }
13506 }
13507 if(prop)
13508 {
13509 exp->member.memberType = 1;
13510 if(!prop->dataType)
13511 ProcessPropertyType(prop);
13512 exp->expType = prop->dataType;
13513 if(prop->dataType)
13514 prop->dataType->refCount++;
13515 }
13516 else if(member)
13517 {
13518 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13519 {
13520 FreeExpContents(exp);
13521 exp->type = 0;
13522 exp->identifier = MkIdentifier("class");
13523 ProcessExpressionType(exp);
13524 return ;
13525 }
13526 exp->member.memberType = 3;
13527 DeclareStruct(_class->fullName, 0x0);
13528 if(!member->dataType)
13529 {
13530 struct Context * context = SetupTemplatesContext(_class);
13531
13532 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13533 FinishTemplatesContext(context);
13534 }
13535 exp->expType = member->dataType;
13536 if(member->dataType)
13537 member->dataType->refCount++;
13538 }
13539 else if(revConvert)
13540 {
13541 exp->member.memberType = 4;
13542 exp->expType = MkClassType(revConvert->_class->fullName);
13543 }
13544 else if(method)
13545 {
13546 if(inCompiler)
13547 {
13548 exp->member.memberType = 2;
13549 }
13550 if(!method->dataType)
13551 ProcessMethodType(method);
13552 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));
13553 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13554 exp->expType->usedClass = _class;
13555 }
13556 else if(!classProp)
13557 {
13558 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13559 {
13560 FreeExpContents(exp);
13561 exp->type = 0;
13562 exp->identifier = MkIdentifier("class");
13563 ProcessExpressionType(exp);
13564 return ;
13565 }
13566 yylloc = exp->member.member->loc;
13567 Compiler_Error("couldn't find member %s in class %s\n", id->string, _class->fullName);
13568 if(inCompiler)
13569 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13570 }
13571 if(_class && exp->expType)
13572 {
13573 struct __ecereNameSpace__ecere__com__Class * tClass;
13574
13575 tClass = _class;
13576 while(tClass && !tClass->templateClass)
13577 tClass = tClass->base;
13578 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13579 {
13580 int id = 0;
13581 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam;
13582 struct __ecereNameSpace__ecere__com__Class * sClass;
13583
13584 for(sClass = tClass; sClass; sClass = sClass->base)
13585 {
13586 id = 0;
13587 if(sClass->templateClass)
13588 sClass = sClass->templateClass;
13589 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13590 {
13591 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13592 {
13593 for(sClass = sClass->base; sClass; sClass = sClass->base)
13594 id += sClass->templateParams.count;
13595 break;
13596 }
13597 id++;
13598 }
13599 if(curParam)
13600 break;
13601 }
13602 if(curParam && tClass->templateArgs[id].dataTypeString)
13603 {
13604 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13605 struct Context * context = SetupTemplatesContext(tClass);
13606
13607 FreeType(exp->expType);
13608 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13609 if(exp->expType)
13610 {
13611 if(exp->expType->kind == 21)
13612 {
13613 FreeType(exp->expType);
13614 exp->expType = ReplaceThisClassType(_class);
13615 }
13616 if(tClass->templateClass)
13617 exp->expType->passAsTemplate = 0x1;
13618 if(!exp->destType)
13619 {
13620 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13621 if(exp->destType->kind == 21)
13622 {
13623 FreeType(exp->destType);
13624 exp->destType = ReplaceThisClassType(_class);
13625 }
13626 }
13627 }
13628 FinishTemplatesContext(context);
13629 }
13630 }
13631 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13632 {
13633 int id = 0;
13634 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam;
13635 struct __ecereNameSpace__ecere__com__Class * sClass;
13636
13637 for(sClass = tClass; sClass; sClass = sClass->base)
13638 {
13639 id = 0;
13640 if(sClass->templateClass)
13641 sClass = sClass->templateClass;
13642 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13643 {
13644 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13645 {
13646 for(sClass = sClass->base; sClass; sClass = sClass->base)
13647 id += sClass->templateParams.count;
13648 break;
13649 }
13650 id++;
13651 }
13652 if(curParam)
13653 break;
13654 }
13655 if(curParam)
13656 {
13657 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13658 struct Context * context = SetupTemplatesContext(tClass);
13659 struct Type * basicType;
13660
13661 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
13662 if(basicType)
13663 {
13664 if(basicType->kind == 21)
13665 {
13666 FreeType(basicType);
13667 basicType = ReplaceThisClassType(_class);
13668 }
13669 FreeType(exp->expType);
13670 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));
13671 if(!exp->destType)
13672 {
13673 exp->destType = exp->expType;
13674 exp->destType->refCount++;
13675 }
13676 {
13677 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13678 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13679 struct Declarator * decl;
13680
13681 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
13682 *newExp = *exp;
13683 if(exp->destType)
13684 exp->destType->refCount++;
13685 if(exp->expType)
13686 exp->expType->refCount++;
13687 exp->type = 11;
13688 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
13689 exp->cast.exp = newExp;
13690 }
13691 }
13692 FinishTemplatesContext(context);
13693 }
13694 }
13695 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
13696 {
13697 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13698
13699 if(expClass)
13700 {
13701 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13702 int c;
13703 int p = 0;
13704 int paramCount = 0;
13705 int lastParam = -1;
13706 char templateString[1024];
13707 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13708
13709 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13710 while(cClass != expClass)
13711 {
13712 struct __ecereNameSpace__ecere__com__Class * sClass;
13713
13714 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
13715 ;
13716 cClass = sClass;
13717 for(param = cClass->templateParams.first; param; param = param->next)
13718 {
13719 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
13720 int c;
13721 int cp = 0;
13722 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
13723 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13724
13725 while(cClassCur != tClass && !paramCur)
13726 {
13727 struct __ecereNameSpace__ecere__com__Class * sClassCur;
13728
13729 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
13730 ;
13731 cClassCur = sClassCur;
13732 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
13733 {
13734 if(!strcmp(paramCur->name, param->name))
13735 {
13736 break;
13737 }
13738 cp++;
13739 }
13740 }
13741 if(paramCur && paramCur->type == 0)
13742 arg = tClass->templateArgs[cp];
13743 else
13744 arg = expClass->templateArgs[p];
13745 {
13746 char argument[256];
13747
13748 argument[0] = '\0';
13749 switch(param->type)
13750 {
13751 case 2:
13752 {
13753 char expString[1024];
13754 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13755 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13756 struct Expression * exp;
13757 char * string = PrintHexUInt64(arg.expression.ui64);
13758
13759 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13760 ProcessExpressionType(exp);
13761 ComputeExpression(exp);
13762 expString[0] = '\0';
13763 PrintExpression(exp, expString);
13764 strcat(argument, expString);
13765 FreeExpression(exp);
13766 break;
13767 }
13768 case 1:
13769 {
13770 strcat(argument, arg.member->name);
13771 break;
13772 }
13773 case 0:
13774 {
13775 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13776 strcat(argument, arg.dataTypeString);
13777 break;
13778 }
13779 }
13780 if(argument[0])
13781 {
13782 if(paramCount)
13783 strcat(templateString, ", ");
13784 if(lastParam != p - 1)
13785 {
13786 strcat(templateString, param->name);
13787 strcat(templateString, " = ");
13788 }
13789 strcat(templateString, argument);
13790 paramCount++;
13791 lastParam = p;
13792 }
13793 }
13794 p++;
13795 }
13796 }
13797 {
13798 int len = strlen(templateString);
13799
13800 if(templateString[len - 1] == '>')
13801 templateString[len++] = ' ';
13802 templateString[len++] = '>';
13803 templateString[len++] = '\0';
13804 }
13805 FreeType(exp->expType);
13806 {
13807 struct Context * context = SetupTemplatesContext(tClass);
13808
13809 exp->expType = ProcessTypeString(templateString, 0x0);
13810 FinishTemplatesContext(context);
13811 }
13812 }
13813 }
13814 }
13815 }
13816 else
13817 Compiler_Error("undefined class %s\n", (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->string : (type->_class ? type->_class->string : (((void *)0)))) : "(null)");
13818 }
13819 else if(type && (type->kind == 9 || type->kind == 10))
13820 {
13821 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
13822
13823 if(memberType)
13824 {
13825 exp->expType = memberType;
13826 if(memberType)
13827 memberType->refCount++;
13828 }
13829 }
13830 else
13831 {
13832 char expString[10240];
13833
13834 expString[0] = '\0';
13835 if(inCompiler)
13836 {
13837 PrintExpression(exp, expString);
13838 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13839 }
13840 Compiler_Error("member operator on non-structure type expression %s\n", expString);
13841 }
13842 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
13843 {
13844 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13845 {
13846 struct Identifier * id = exp->member.member;
13847 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));
13848
13849 if(_class)
13850 {
13851 FreeType(exp->expType);
13852 exp->expType = ReplaceThisClassType(_class);
13853 }
13854 }
13855 }
13856 yylloc = oldyylloc;
13857 break;
13858 }
13859 case 9:
13860 {
13861 struct Type * destType = exp->destType;
13862
13863 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13864 {
13865 exp->member.member->classSym = exp->member.member->_class->symbol;
13866 }
13867 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
13868 exp->type = 8;
13869 if(destType)
13870 destType->count++;
13871 ProcessExpressionType(exp);
13872 if(destType)
13873 destType->count--;
13874 break;
13875 }
13876 case 15:
13877 {
13878 struct Symbol * classSym = exp->_class->symbol;
13879
13880 if(classSym && classSym->registered)
13881 {
13882 if(classSym->registered->type == 5)
13883 {
13884 char name[1024];
13885
13886 name[0] = '\0';
13887 DeclareStruct(classSym->string, 0x0);
13888 FreeSpecifier(exp->_class);
13889 exp->type = 10;
13890 FullClassNameCat(name, classSym->string, 0x0);
13891 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
13892 }
13893 else
13894 {
13895 if(classSym->registered->fixed)
13896 {
13897 FreeSpecifier(exp->_class);
13898 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
13899 exp->type = 2;
13900 }
13901 else
13902 {
13903 char className[1024];
13904
13905 strcpy(className, "__ecereClass_");
13906 FullClassNameCat(className, classSym->string, 0x1);
13907 MangleClassName(className);
13908 DeclareClass(classSym, className);
13909 FreeExpContents(exp);
13910 exp->type = 9;
13911 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
13912 exp->member.member = MkIdentifier("structSize");
13913 }
13914 }
13915 }
13916 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13917 break;
13918 }
13919 case 10:
13920 {
13921 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
13922
13923 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13924 exp->isConstant = 0x1;
13925 DeclareType(type, 0x0, 0x0);
13926 FreeType(type);
13927 break;
13928 }
13929 case 11:
13930 {
13931 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
13932
13933 type->count = (unsigned int)1;
13934 FreeType(exp->cast.exp->destType);
13935 exp->cast.exp->destType = type;
13936 type->refCount++;
13937 ProcessExpressionType(exp->cast.exp);
13938 type->count = (unsigned int)0;
13939 exp->expType = type;
13940 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
13941 {
13942 void * prev = exp->prev, * next = exp->next;
13943 struct Type * expType = exp->cast.exp->destType;
13944 struct Expression * castExp = exp->cast.exp;
13945 struct Type * destType = exp->destType;
13946
13947 if(expType)
13948 expType->refCount++;
13949 FreeType(exp->expType);
13950 FreeTypeName(exp->cast.typeName);
13951 *exp = *castExp;
13952 FreeType(exp->expType);
13953 FreeType(exp->destType);
13954 exp->expType = expType;
13955 exp->destType = destType;
13956 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
13957 exp->prev = prev;
13958 exp->next = next;
13959 }
13960 else
13961 {
13962 exp->isConstant = exp->cast.exp->isConstant;
13963 }
13964 break;
13965 }
13966 case 35:
13967 {
13968 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
13969
13970 type->refCount++;
13971 exp->expType = type;
13972 break;
13973 }
13974 case 36:
13975 {
13976 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
13977
13978 ProcessExpressionType(exp->vaArg.exp);
13979 type->refCount++;
13980 exp->expType = type;
13981 break;
13982 }
13983 case 12:
13984 {
13985 struct Expression * e;
13986
13987 exp->isConstant = 0x1;
13988 FreeType(exp->cond.cond->destType);
13989 exp->cond.cond->destType = MkClassType("bool");
13990 exp->cond.cond->destType->truth = 0x1;
13991 ProcessExpressionType(exp->cond.cond);
13992 if(!exp->cond.cond->isConstant)
13993 exp->isConstant = 0x0;
13994 for(e = (*exp->cond.exp).first; e; e = e->next)
13995 {
13996 if(!e->next)
13997 {
13998 FreeType(e->destType);
13999 e->destType = exp->destType;
14000 if(e->destType)
14001 e->destType->refCount++;
14002 }
14003 ProcessExpressionType(e);
14004 if(!e->next)
14005 {
14006 exp->expType = e->expType;
14007 if(e->expType)
14008 e->expType->refCount++;
14009 }
14010 if(!e->isConstant)
14011 exp->isConstant = 0x0;
14012 }
14013 FreeType(exp->cond.elseExp->destType);
14014 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14015 if(exp->cond.elseExp->destType)
14016 exp->cond.elseExp->destType->refCount++;
14017 ProcessExpressionType(exp->cond.elseExp);
14018 if(!exp->cond.elseExp->isConstant)
14019 exp->isConstant = 0x0;
14020 break;
14021 }
14022 case 25:
14023 {
14024 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14025 {
14026 struct Statement * last = (*exp->compound->compound.statements).last;
14027
14028 if(last->type == 3 && last->expressions && (*last->expressions).last)
14029 {
14030 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14031 if(exp->destType)
14032 exp->destType->refCount++;
14033 }
14034 ProcessStatement(exp->compound);
14035 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14036 if(((struct Expression *)(*last->expressions).last)->expType)
14037 exp->expType->refCount++;
14038 }
14039 break;
14040 }
14041 case 26:
14042 {
14043 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14044
14045 if(spec && spec->type == 1)
14046 {
14047 exp->expType = MkClassType(spec->name);
14048 exp->expType->kind = 19;
14049 exp->byReference = 0x1;
14050 }
14051 else
14052 {
14053 exp->expType = MkClassType("ecere::com::Class");
14054 exp->byReference = 0x1;
14055 }
14056 break;
14057 }
14058 case 27:
14059 {
14060 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14061
14062 if(_class)
14063 {
14064 struct Identifier * id = exp->classData.id;
14065 char structName[1024];
14066 struct Expression * classExp;
14067
14068 strcpy(structName, "__ecereClassData_");
14069 FullClassNameCat(structName, _class->fullName, 0x0);
14070 exp->type = 9;
14071 exp->member.member = id;
14072 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14073 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14074 else
14075 classExp = MkExpIdentifier(MkIdentifier("class"));
14076 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(289)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(_class->fullName)), (((void *)0))), MkIdentifier("offsetClass"))))))));
14077 ProcessExpressionType(exp);
14078 return ;
14079 }
14080 break;
14081 }
14082 case 37:
14083 {
14084 struct Type * type = (((void *)0));
14085 char * typeString = (((void *)0));
14086 char typeStringBuf[1024];
14087
14088 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))
14089 {
14090 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14091
14092 typeString = templateClass->templateArgs[2].dataTypeString;
14093 }
14094 else if(exp->list)
14095 {
14096 struct Expression * e;
14097
14098 for(e = (*exp->list).first; e; e = e->next)
14099 {
14100 ProcessExpressionType(e);
14101 if(e->expType)
14102 {
14103 if(!type)
14104 {
14105 type = e->expType;
14106 type->refCount++;
14107 }
14108 else
14109 {
14110 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14111 {
14112 FreeType(type);
14113 type = e->expType;
14114 e->expType = (((void *)0));
14115 e = (*exp->list).first;
14116 ProcessExpressionType(e);
14117 if(e->expType)
14118 {
14119 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14120 {
14121 FreeType(e->expType);
14122 e->expType = (((void *)0));
14123 FreeType(type);
14124 type = (((void *)0));
14125 break;
14126 }
14127 }
14128 }
14129 }
14130 if(e->expType)
14131 {
14132 FreeType(e->expType);
14133 e->expType = (((void *)0));
14134 }
14135 }
14136 }
14137 if(type)
14138 {
14139 typeStringBuf[0] = '\0';
14140 PrintType(type, typeStringBuf, 0x0, 0x1);
14141 typeString = typeStringBuf;
14142 FreeType(type);
14143 type = (((void *)0));
14144 }
14145 }
14146 if(typeString)
14147 {
14148 char templateString[1024];
14149 struct __ecereNameSpace__ecere__sys__OldList * declarations = MkList();
14150 struct __ecereNameSpace__ecere__sys__OldList * instMembers = MkList();
14151 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14152 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14153 char count[128];
14154 struct Expression * e;
14155 struct Expression * expExt;
14156 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14157 struct Context * context = PushContext();
14158
14159 sprintf(templateString, "Container<%s>", typeString);
14160 ListAdd(instMembers, MkMemberInit(MkListOne(MkIdentifier("data")), MkInitializerAssignment(MkExpIdentifier(MkIdentifier("__internalList")))));
14161 sprintf(count, "%d", (*exp->list).count);
14162 ListAdd(instMembers, MkMemberInit(MkListOne(MkIdentifier("count")), MkInitializerAssignment(MkExpConstant(count))));
14163 ListAdd(instMembers, MkMemberInit(MkListOne(MkIdentifier("type")), MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl)))));
14164 ListAdd(instMembers, MkMemberInit(MkListOne(MkIdentifier("_vTbl")), MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl")))));
14165 ListAdd(instMembers, MkMemberInit(MkListOne(MkIdentifier("_class")), MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))))));
14166 if(exp->list)
14167 {
14168 type = ProcessTypeString(typeString, 0x0);
14169 while(e = (*exp->list).first)
14170 {
14171 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14172 e->destType = type;
14173 type->refCount++;
14174 ProcessExpressionType(e);
14175 ListAdd(initializers, MkInitializerAssignment(e));
14176 }
14177 FreeType(type);
14178 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14179 }
14180 ListAdd(declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalList"))), (((void *)0))), MkInitializerList(initializers)))));
14181 ListAdd(declarations, MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName("BuiltInContainer")), MkExpIdentifier(MkIdentifier("__internalContainer")), MkListOne(MkMembersInitList(instMembers)))));
14182 exp->expType = ProcessTypeString(templateString, 0x0);
14183 exp->type = 5;
14184 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), (expExt = MkExpExtensionCompound(MkCompoundStmt(declarations, MkListOne(MkExpressionStmt(MkListOne(MkExpOp((((void *)0)), '&', MkExpIdentifier(MkIdentifier("__internalContainer")))))))))));
14185 expExt->compound->compound.context = context;
14186 PopContext(context);
14187 ProcessExpressionType(expExt);
14188 }
14189 else
14190 {
14191 exp->expType = ProcessTypeString("Container", 0x0);
14192 Compiler_Error("Couldn't determine type of array elements\n");
14193 }
14194 break;
14195 }
14196 }
14197 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14198 {
14199 FreeType(exp->expType);
14200 exp->expType = ReplaceThisClassType(thisClass);
14201 }
14202 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14203 {
14204 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14205
14206 if(symbol)
14207 {
14208 if(exp->expType->kind != 15)
14209 {
14210 struct Type * member;
14211
14212 exp->expType->members = symbol->type->members;
14213 for(member = symbol->type->members.first; member; member = member->next)
14214 member->refCount++;
14215 }
14216 else
14217 {
14218 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14219
14220 for(member = symbol->type->members.first; member; member = member->next)
14221 {
14222 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14223
14224 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14225 }
14226 }
14227 }
14228 }
14229 yylloc = exp->loc;
14230 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14231 ;
14232 else if(exp->destType && !exp->destType->keepCast)
14233 {
14234 if(!CheckExpressionType(exp, exp->destType, 0x0))
14235 {
14236 if(!exp->destType->count || unresolved)
14237 {
14238 if(!exp->expType)
14239 {
14240 yylloc = exp->loc;
14241 if(exp->destType->kind != 14)
14242 {
14243 char type2[1024];
14244
14245 type2[0] = '\0';
14246 if(inCompiler)
14247 {
14248 char expString[10240];
14249
14250 expString[0] = '\0';
14251 PrintType(exp->destType, type2, 0x0, 0x1);
14252 if(inCompiler)
14253 {
14254 PrintExpression(exp, expString);
14255 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14256 }
14257 if(unresolved)
14258 Compiler_Error("unresolved identifier %s; expected %s\n", expString, type2);
14259 else if(exp->type != 16)
14260 Compiler_Error("couldn't determine type of %s; expected %s\n", expString, type2);
14261 }
14262 }
14263 else
14264 {
14265 char expString[10240];
14266
14267 expString[0] = '\0';
14268 if(inCompiler)
14269 {
14270 PrintExpression(exp, expString);
14271 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14272 }
14273 if(unresolved)
14274 Compiler_Error("unresolved identifier %s\n", expString);
14275 else if(exp->type != 16)
14276 Compiler_Error("couldn't determine type of %s\n", expString);
14277 }
14278 }
14279 else
14280 {
14281 char type1[1024];
14282 char type2[1024];
14283
14284 type1[0] = '\0';
14285 type2[0] = '\0';
14286 if(inCompiler)
14287 {
14288 PrintType(exp->expType, type1, 0x0, 0x1);
14289 PrintType(exp->destType, type2, 0x0, 0x1);
14290 }
14291 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)))
14292 ;
14293 else
14294 {
14295 char expString[10240];
14296
14297 expString[0] = '\0';
14298 if(inCompiler)
14299 {
14300 PrintExpression(exp, expString);
14301 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14302 }
14303 Compiler_Warning("incompatible expression %s (%s); expected %s\n", expString, type1, type2);
14304 FreeType(exp->expType);
14305 exp->destType->refCount++;
14306 exp->expType = exp->destType;
14307 }
14308 }
14309 }
14310 }
14311 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14312 {
14313 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14314 char typeString[1024];
14315 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14316 struct Declarator * decl;
14317
14318 typeString[0] = '\0';
14319 *newExp = *exp;
14320 if(exp->expType)
14321 exp->expType->refCount++;
14322 if(exp->expType)
14323 exp->expType->refCount++;
14324 exp->type = 11;
14325 newExp->destType = exp->expType;
14326 PrintType(exp->expType, typeString, 0x0, 0x0);
14327 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14328 exp->cast.typeName = MkTypeName(specs, decl);
14329 exp->cast.exp = newExp;
14330 }
14331 }
14332 else if(unresolved)
14333 {
14334 if(exp->identifier->_class && exp->identifier->_class->name)
14335 Compiler_Error("unresolved identifier %s::%s\n", exp->identifier->_class->name, exp->identifier->string);
14336 else if(exp->identifier->string && exp->identifier->string[0])
14337 Compiler_Error("unresolved identifier %s\n", exp->identifier->string);
14338 }
14339 else if(!exp->expType && exp->type != 16)
14340 {
14341 char expString[10240];
14342
14343 expString[0] = '\0';
14344 if(inCompiler)
14345 {
14346 PrintExpression(exp, expString);
14347 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14348 }
14349 Compiler_Error("couldn't determine type of %s\n", expString);
14350 }
14351 ApplyAnyObjectLogic(exp);
14352 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14353 {
14354 exp->byReference = 0x1;
14355 }
14356 yylloc = oldyylloc;
14357 }
14358
14359 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)
14360 {
14361 if(*curMember)
14362 {
14363 *curMember = (*curMember)->next;
14364 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14365 {
14366 *curMember = subMemberStack[--(*subMemberStackPos)];
14367 *curMember = (*curMember)->next;
14368 }
14369 while((*curMember) && (*curMember)->isProperty)
14370 *curMember = (*curMember)->next;
14371 if(subMemberStackPos)
14372 {
14373 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14374 {
14375 subMemberStack[(*subMemberStackPos)++] = *curMember;
14376 *curMember = (*curMember)->members.first;
14377 while(*curMember && (*curMember)->isProperty)
14378 *curMember = (*curMember)->next;
14379 }
14380 }
14381 }
14382 while(!*curMember)
14383 {
14384 if(!*curMember)
14385 {
14386 if(subMemberStackPos && *subMemberStackPos)
14387 {
14388 *curMember = subMemberStack[--(*subMemberStackPos)];
14389 *curMember = (*curMember)->next;
14390 }
14391 else
14392 {
14393 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14394
14395 if(*curClass == _class)
14396 break;
14397 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14398 ;
14399 *curMember = (*curClass)->membersAndProperties.first;
14400 }
14401 while((*curMember) && (*curMember)->isProperty)
14402 *curMember = (*curMember)->next;
14403 if(subMemberStackPos)
14404 {
14405 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14406 {
14407 subMemberStack[(*subMemberStackPos)++] = *curMember;
14408 *curMember = (*curMember)->members.first;
14409 while(*curMember && (*curMember)->isProperty)
14410 *curMember = (*curMember)->next;
14411 }
14412 }
14413 }
14414 }
14415 }
14416
14417 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14418 {
14419 switch(init->type)
14420 {
14421 case 0:
14422 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14423 {
14424 if(init->exp && !init->exp->destType)
14425 {
14426 FreeType(init->exp->destType);
14427 init->exp->destType = type;
14428 if(type)
14429 type->refCount++;
14430 }
14431 if(init->exp)
14432 {
14433 ProcessExpressionType(init->exp);
14434 init->isConstant = init->exp->isConstant;
14435 }
14436 break;
14437 }
14438 else
14439 {
14440 struct Expression * exp = init->exp;
14441 struct Instantiation * inst = exp->instance;
14442 struct MembersInit * members;
14443
14444 init->type = 1;
14445 init->list = MkList();
14446 if(inst->members)
14447 {
14448 for(members = (*inst->members).first; members; members = members->next)
14449 {
14450 if(members->type == 0)
14451 {
14452 struct MemberInit * member;
14453
14454 for(member = (*members->dataMembers).first; member; member = member->next)
14455 {
14456 ListAdd(init->list, member->initializer);
14457 member->initializer = (((void *)0));
14458 }
14459 }
14460 }
14461 }
14462 FreeExpression(exp);
14463 }
14464 case 1:
14465 {
14466 struct Initializer * i;
14467 struct Type * initializerType = (((void *)0));
14468 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14469 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14470 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14471 int subMemberStackPos = 0;
14472
14473 if(type && type->kind == 12)
14474 initializerType = Dereference(type);
14475 else if(type && (type->kind == 9 || type->kind == 10))
14476 initializerType = type->members.first;
14477 for(i = (*init->list).first; i; i = i->next)
14478 {
14479 if(type && type->kind == 8 && type->_class && type->_class->registered)
14480 {
14481 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14482 if(curMember)
14483 {
14484 if(!curMember->dataType)
14485 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14486 initializerType = curMember->dataType;
14487 }
14488 }
14489 ProcessInitializer(i, initializerType);
14490 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14491 initializerType = initializerType->next;
14492 if(!i->isConstant)
14493 init->isConstant = 0x0;
14494 }
14495 if(type && type->kind == 12)
14496 FreeType(initializerType);
14497 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14498 {
14499 Compiler_Error("Assigning list initializer to non list\n");
14500 }
14501 break;
14502 }
14503 }
14504 }
14505
14506 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14507
14508 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14509
14510 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14511 {
14512 switch(spec->type)
14513 {
14514 case 0:
14515 {
14516 if(spec->specifier == 321)
14517 {
14518 if(thisClass)
14519 {
14520 spec->type = 1;
14521 spec->name = ReplaceThisClass(thisClass);
14522 spec->symbol = FindClass(spec->name);
14523 ProcessSpecifier(spec, declareStruct);
14524 }
14525 }
14526 break;
14527 }
14528 case 1:
14529 {
14530 struct Symbol * symbol = FindType(curContext, spec->name);
14531
14532 if(symbol)
14533 DeclareType(symbol->type, 0x1, 0x1);
14534 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14535 DeclareStruct(spec->name, 0x0);
14536 break;
14537 }
14538 case 2:
14539 {
14540 struct Enumerator * e;
14541
14542 if(spec->list)
14543 {
14544 for(e = (*spec->list).first; e; e = e->next)
14545 {
14546 if(e->exp)
14547 ProcessExpressionType(e->exp);
14548 }
14549 }
14550 break;
14551 }
14552 case 3:
14553 case 4:
14554 {
14555 if(spec->definitions)
14556 {
14557 struct ClassDef * def;
14558 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14559
14560 ProcessClass(spec->definitions, symbol);
14561 }
14562 break;
14563 }
14564 }
14565 }
14566
14567 static void ProcessDeclarator(struct Declarator * decl)
14568 {
14569 switch(decl->type)
14570 {
14571 case 1:
14572 if(decl->identifier->classSym)
14573 {
14574 FreeSpecifier(decl->identifier->_class);
14575 decl->identifier->_class = (((void *)0));
14576 }
14577 break;
14578 case 3:
14579 if(decl->array.exp)
14580 ProcessExpressionType(decl->array.exp);
14581 case 0:
14582 case 2:
14583 case 4:
14584 case 5:
14585 case 6:
14586 case 7:
14587 if(decl->declarator)
14588 ProcessDeclarator(decl->declarator);
14589 if(decl->type == 4)
14590 {
14591 struct Identifier * id = GetDeclId(decl);
14592
14593 if(id && id->_class)
14594 {
14595 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14596
14597 if(!decl->function.parameters)
14598 decl->function.parameters = MkList();
14599 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14600 id->_class = (((void *)0));
14601 }
14602 if(decl->function.parameters)
14603 {
14604 struct TypeName * param;
14605
14606 for(param = (*decl->function.parameters).first; param; param = param->next)
14607 {
14608 if(param->qualifiers && (*param->qualifiers).first)
14609 {
14610 struct Specifier * spec = (*param->qualifiers).first;
14611
14612 if(spec && spec->specifier == 337)
14613 {
14614 struct Declarator * d = param->declarator;
14615 struct TypeName * newParam = (newParam = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), newParam->qualifiers = MkListOne(MkSpecifier(301)), newParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d), newParam);
14616
14617 FreeList(param->qualifiers, FreeSpecifier);
14618 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14619 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14620 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14621 param = newParam;
14622 }
14623 else if(spec && spec->specifier == 338)
14624 {
14625 struct Declarator * d = param->declarator;
14626
14627 FreeList(param->qualifiers, FreeSpecifier);
14628 param->qualifiers = MkListOne(MkSpecifier(301));
14629 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14630 }
14631 else if(spec->specifier == 321)
14632 {
14633 if(thisClass)
14634 {
14635 spec->type = 1;
14636 spec->name = ReplaceThisClass(thisClass);
14637 spec->symbol = FindClass(spec->name);
14638 ProcessSpecifier(spec, 0x0);
14639 }
14640 }
14641 }
14642 if(param->declarator)
14643 ProcessDeclarator(param->declarator);
14644 }
14645 }
14646 }
14647 break;
14648 }
14649 }
14650
14651 extern struct Identifier * CopyIdentifier(struct Identifier * id);
14652
14653 extern void FreeInitDeclarator(struct InitDeclarator * decl);
14654
14655 static void ProcessDeclaration(struct Declaration * decl)
14656 {
14657 yylloc = decl->loc;
14658 switch(decl->type)
14659 {
14660 case 1:
14661 {
14662 unsigned int declareStruct = 0x0;
14663
14664 if(decl->declarators)
14665 {
14666 struct InitDeclarator * d;
14667
14668 for(d = (*decl->declarators).first; d; d = d->next)
14669 {
14670 struct Type * type, * subType;
14671
14672 ProcessDeclarator(d->declarator);
14673 type = ProcessType(decl->specifiers, d->declarator);
14674 if(d->initializer)
14675 {
14676 ProcessInitializer(d->initializer, type);
14677 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
14678 {
14679 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
14680 {
14681 struct Instantiation * inst = d->initializer->exp->instance;
14682
14683 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
14684 d->initializer->exp->instance = (((void *)0));
14685 if(decl->specifiers)
14686 FreeList(decl->specifiers, FreeSpecifier);
14687 FreeList(decl->declarators, FreeInitDeclarator);
14688 d = (((void *)0));
14689 decl->type = 2;
14690 decl->inst = inst;
14691 }
14692 }
14693 }
14694 for(subType = type; subType; )
14695 {
14696 if(subType->kind == 8)
14697 {
14698 declareStruct = 0x1;
14699 break;
14700 }
14701 else if(subType->kind == 13)
14702 break;
14703 else if(subType->kind == 12)
14704 subType = subType->arrayType;
14705 else
14706 break;
14707 }
14708 FreeType(type);
14709 if(!d)
14710 break;
14711 }
14712 }
14713 if(decl->specifiers)
14714 {
14715 struct Specifier * s;
14716
14717 for(s = (*decl->specifiers).first; s; s = s->next)
14718 {
14719 ProcessSpecifier(s, declareStruct);
14720 }
14721 }
14722 break;
14723 }
14724 case 2:
14725 {
14726 ProcessInstantiationType(decl->inst);
14727 break;
14728 }
14729 case 0:
14730 {
14731 struct Specifier * spec;
14732 struct Declarator * d;
14733 unsigned int declareStruct = 0x0;
14734
14735 if(decl->declarators)
14736 {
14737 for(d = (*decl->declarators).first; d; d = d->next)
14738 {
14739 struct Type * type = ProcessType(decl->specifiers, d->declarator);
14740 struct Type * subType;
14741
14742 ProcessDeclarator(d);
14743 for(subType = type; subType; )
14744 {
14745 if(subType->kind == 8)
14746 {
14747 declareStruct = 0x1;
14748 break;
14749 }
14750 else if(subType->kind == 13)
14751 break;
14752 else if(subType->kind == 12)
14753 subType = subType->arrayType;
14754 else
14755 break;
14756 }
14757 FreeType(type);
14758 }
14759 }
14760 if(decl->specifiers)
14761 {
14762 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
14763 ProcessSpecifier(spec, declareStruct);
14764 }
14765 break;
14766 }
14767 }
14768 }
14769
14770 static struct FunctionDefinition * curFunction;
14771
14772 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
14773 {
14774 char propName[1024], propNameM[1024];
14775 char getName[1024], setName[1024];
14776 struct __ecereNameSpace__ecere__sys__OldList * args;
14777
14778 DeclareProperty(prop, setName, getName);
14779 strcpy(propName, "__ecereProp_");
14780 FullClassNameCat(propName, prop->_class->fullName, 0x0);
14781 strcat(propName, "_");
14782 FullClassNameCat(propName, prop->name, 0x1);
14783 MangleClassName(propName);
14784 strcpy(propNameM, "__ecerePropM_");
14785 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
14786 strcat(propNameM, "_");
14787 FullClassNameCat(propNameM, prop->name, 0x1);
14788 MangleClassName(propNameM);
14789 if(prop->isWatchable)
14790 {
14791 args = MkList();
14792 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14793 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14794 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14795 args = MkList();
14796 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14797 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14798 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
14799 }
14800 {
14801 args = MkList();
14802 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14803 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
14804 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14805 args = MkList();
14806 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
14807 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
14808 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
14809 }
14810 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
14811 curFunction->propSet->fireWatchersDone = 0x1;
14812 }
14813
14814 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
14815
14816 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
14817
14818 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
14819
14820 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
14821
14822 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
14823
14824 extern void FreePropertyWatch(struct PropertyWatch * watcher);
14825
14826 static void ProcessStatement(struct Statement * stmt)
14827 {
14828 yylloc = stmt->loc;
14829 switch(stmt->type)
14830 {
14831 case 0:
14832 ProcessStatement(stmt->labeled.stmt);
14833 break;
14834 case 1:
14835 if(stmt->caseStmt.exp)
14836 {
14837 FreeType(stmt->caseStmt.exp->destType);
14838 stmt->caseStmt.exp->destType = curSwitchType;
14839 if(curSwitchType)
14840 curSwitchType->refCount++;
14841 ProcessExpressionType(stmt->caseStmt.exp);
14842 ComputeExpression(stmt->caseStmt.exp);
14843 }
14844 if(stmt->caseStmt.stmt)
14845 ProcessStatement(stmt->caseStmt.stmt);
14846 break;
14847 case 2:
14848 {
14849 if(stmt->compound.context)
14850 {
14851 struct Declaration * decl;
14852 struct Statement * s;
14853 struct Statement * prevCompound = curCompound;
14854 struct Context * prevContext = curContext;
14855
14856 if(!stmt->compound.isSwitch)
14857 {
14858 curCompound = stmt;
14859 curContext = stmt->compound.context;
14860 }
14861 if(stmt->compound.declarations)
14862 {
14863 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
14864 ProcessDeclaration(decl);
14865 }
14866 if(stmt->compound.statements)
14867 {
14868 for(s = (*stmt->compound.statements).first; s; s = s->next)
14869 ProcessStatement(s);
14870 }
14871 curContext = prevContext;
14872 curCompound = prevCompound;
14873 }
14874 break;
14875 }
14876 case 3:
14877 {
14878 struct Expression * exp;
14879
14880 if(stmt->expressions)
14881 {
14882 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
14883 ProcessExpressionType(exp);
14884 }
14885 break;
14886 }
14887 case 4:
14888 {
14889 struct Expression * exp;
14890
14891 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
14892 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
14893 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
14894 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
14895 {
14896 ProcessExpressionType(exp);
14897 }
14898 if(stmt->ifStmt.stmt)
14899 ProcessStatement(stmt->ifStmt.stmt);
14900 if(stmt->ifStmt.elseStmt)
14901 ProcessStatement(stmt->ifStmt.elseStmt);
14902 break;
14903 }
14904 case 5:
14905 {
14906 struct Type * oldSwitchType = curSwitchType;
14907
14908 if(stmt->switchStmt.exp)
14909 {
14910 struct Expression * exp;
14911
14912 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
14913 {
14914 if(!exp->next)
14915 {
14916 ProcessExpressionType(exp);
14917 }
14918 if(!exp->next)
14919 curSwitchType = exp->expType;
14920 }
14921 }
14922 ProcessStatement(stmt->switchStmt.stmt);
14923 curSwitchType = oldSwitchType;
14924 break;
14925 }
14926 case 6:
14927 {
14928 if(stmt->whileStmt.exp)
14929 {
14930 struct Expression * exp;
14931
14932 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
14933 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
14934 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
14935 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
14936 {
14937 ProcessExpressionType(exp);
14938 }
14939 }
14940 if(stmt->whileStmt.stmt)
14941 ProcessStatement(stmt->whileStmt.stmt);
14942 break;
14943 }
14944 case 7:
14945 {
14946 if(stmt->doWhile.exp)
14947 {
14948 struct Expression * exp;
14949
14950 if((*stmt->doWhile.exp).last)
14951 {
14952 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
14953 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
14954 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
14955 }
14956 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
14957 {
14958 ProcessExpressionType(exp);
14959 }
14960 }
14961 if(stmt->doWhile.stmt)
14962 ProcessStatement(stmt->doWhile.stmt);
14963 break;
14964 }
14965 case 8:
14966 {
14967 struct Expression * exp;
14968
14969 if(stmt->forStmt.init)
14970 ProcessStatement(stmt->forStmt.init);
14971 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
14972 {
14973 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
14974 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
14975 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
14976 }
14977 if(stmt->forStmt.check)
14978 ProcessStatement(stmt->forStmt.check);
14979 if(stmt->forStmt.increment)
14980 {
14981 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
14982 ProcessExpressionType(exp);
14983 }
14984 if(stmt->forStmt.stmt)
14985 ProcessStatement(stmt->forStmt.stmt);
14986 break;
14987 }
14988 case 18:
14989 {
14990 struct Identifier * id = stmt->forEachStmt.id;
14991 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
14992 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
14993 struct Statement * block = stmt->forEachStmt.stmt;
14994 char iteratorType[1024];
14995 struct Type * source;
14996 struct Expression * e;
14997 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));
14998 struct Expression * arrayExp;
14999 char * typeString = (((void *)0));
15000 int builtinCount = 0;
15001
15002 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15003 {
15004 if(!e->next)
15005 {
15006 FreeType(e->destType);
15007 e->destType = ProcessTypeString("Container", 0x0);
15008 }
15009 if(!isBuiltin || e->next)
15010 ProcessExpressionType(e);
15011 }
15012 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15013 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15014 {
15015 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15016 struct Symbol * symbol;
15017 struct Expression * expIt = (((void *)0));
15018 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15019 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15020 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15021 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15022
15023 stmt->type = 2;
15024 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15025 stmt->compound.context->parent = curContext;
15026 curContext = stmt->compound.context;
15027 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15028 {
15029 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15030 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15031
15032 isCustomAVLTree = 0x1;
15033 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15034 isAVLTree = 0x1;
15035 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15036 isMap = 0x1;
15037 }
15038 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15039 isArray = 0x1;
15040 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15041 {
15042 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15043
15044 isLinkList = 0x1;
15045 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15046 }
15047 if(isArray)
15048 {
15049 struct Declarator * decl;
15050 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15051
15052 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15053 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15054 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15055 }
15056 else if(isBuiltin)
15057 {
15058 struct Type * type = (((void *)0));
15059 char typeStringBuf[1024];
15060
15061 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15062 if(((struct Expression *)(*exp).last)->type == 11)
15063 {
15064 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15065
15066 if(typeName)
15067 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15068 }
15069 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)
15070 {
15071 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15072
15073 typeString = templateClass->templateArgs[2].dataTypeString;
15074 }
15075 else if(arrayExp->list)
15076 {
15077 struct Expression * e;
15078
15079 for(e = (*arrayExp->list).first; e; e = e->next)
15080 {
15081 ProcessExpressionType(e);
15082 if(e->expType)
15083 {
15084 if(!type)
15085 {
15086 type = e->expType;
15087 type->refCount++;
15088 }
15089 else
15090 {
15091 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15092 {
15093 FreeType(type);
15094 type = e->expType;
15095 e->expType = (((void *)0));
15096 e = (*arrayExp->list).first;
15097 ProcessExpressionType(e);
15098 if(e->expType)
15099 {
15100 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15101 {
15102 FreeType(e->expType);
15103 e->expType = (((void *)0));
15104 FreeType(type);
15105 type = (((void *)0));
15106 break;
15107 }
15108 }
15109 }
15110 }
15111 if(e->expType)
15112 {
15113 FreeType(e->expType);
15114 e->expType = (((void *)0));
15115 }
15116 }
15117 }
15118 if(type)
15119 {
15120 typeStringBuf[0] = '\0';
15121 PrintType(type, typeStringBuf, 0x0, 0x1);
15122 typeString = typeStringBuf;
15123 FreeType(type);
15124 }
15125 }
15126 if(typeString)
15127 {
15128 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15129 struct Declarator * decl;
15130 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15131
15132 if(arrayExp->list)
15133 {
15134 struct Expression * e;
15135
15136 builtinCount = (*arrayExp->list).count;
15137 type = ProcessTypeString(typeString, 0x0);
15138 while(e = (*arrayExp->list).first)
15139 {
15140 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15141 e->destType = type;
15142 type->refCount++;
15143 ProcessExpressionType(e);
15144 ListAdd(initializers, MkInitializerAssignment(e));
15145 }
15146 FreeType(type);
15147 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15148 }
15149 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15150 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15151 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15152 FreeList(exp, FreeExpression);
15153 }
15154 else
15155 {
15156 arrayExp->expType = ProcessTypeString("Container", 0x0);
15157 Compiler_Error("Couldn't determine type of array elements\n");
15158 }
15159 }
15160 else if(isLinkList && !isList)
15161 {
15162 struct Declarator * decl;
15163 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15164
15165 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15166 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15167 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15168 }
15169 else if(_class->templateArgs)
15170 {
15171 if(isMap)
15172 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15173 else
15174 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15175 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15176 }
15177 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15178 if(block && block->type == 2 && block->compound.context)
15179 {
15180 block->compound.context->parent = stmt->compound.context;
15181 }
15182 if(filter)
15183 {
15184 block = MkIfStmt(filter, block, (((void *)0)));
15185 }
15186 if(isArray)
15187 {
15188 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)), 263, (((void *)0)))), block));
15189 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15190 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15191 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15192 }
15193 else if(isBuiltin)
15194 {
15195 char count[128];
15196
15197 sprintf(count, "%d", builtinCount);
15198 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)), 263, (((void *)0)))), block));
15199 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15200 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15201 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15202 }
15203 else if(isLinkList && !isList)
15204 {
15205 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15206 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15207
15208 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15209 {
15210 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));
15211 }
15212 else
15213 {
15214 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15215 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15216
15217 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));
15218 }
15219 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15220 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15221 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15222 }
15223 else
15224 {
15225 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15226 }
15227 ProcessExpressionType(expIt);
15228 if((*stmt->compound.declarations).first)
15229 ProcessDeclaration((*stmt->compound.declarations).first);
15230 if(symbol)
15231 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15232 ProcessStatement(stmt);
15233 curContext = stmt->compound.context->parent;
15234 break;
15235 }
15236 else
15237 {
15238 Compiler_Error("Expression is not a container\n");
15239 }
15240 break;
15241 }
15242 case 9:
15243 break;
15244 case 10:
15245 break;
15246 case 11:
15247 break;
15248 case 12:
15249 {
15250 struct Expression * exp;
15251
15252 if(stmt->expressions)
15253 {
15254 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15255 {
15256 if(!exp->next)
15257 {
15258 if(curFunction && !curFunction->type)
15259 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15260 FreeType(exp->destType);
15261 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15262 if(exp->destType)
15263 exp->destType->refCount++;
15264 }
15265 ProcessExpressionType(exp);
15266 }
15267 }
15268 break;
15269 }
15270 case 14:
15271 {
15272 ProcessDeclaration(stmt->decl);
15273 break;
15274 }
15275 case 13:
15276 {
15277 struct AsmField * field;
15278
15279 if(stmt->asmStmt.inputFields)
15280 {
15281 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15282 if(field->expression)
15283 ProcessExpressionType(field->expression);
15284 }
15285 if(stmt->asmStmt.outputFields)
15286 {
15287 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15288 if(field->expression)
15289 ProcessExpressionType(field->expression);
15290 }
15291 if(stmt->asmStmt.clobberedFields)
15292 {
15293 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15294 {
15295 if(field->expression)
15296 ProcessExpressionType(field->expression);
15297 }
15298 }
15299 break;
15300 }
15301 case 17:
15302 {
15303 struct PropertyWatch * propWatch;
15304 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15305 struct Expression * object = stmt->_watch.object;
15306 struct Expression * watcher = stmt->_watch.watcher;
15307
15308 if(watcher)
15309 ProcessExpressionType(watcher);
15310 if(object)
15311 ProcessExpressionType(object);
15312 if(inCompiler)
15313 {
15314 if(watcher || thisClass)
15315 {
15316 struct External * external = curExternal;
15317 struct Context * context = curContext;
15318
15319 stmt->type = 3;
15320 stmt->expressions = MkList();
15321 curExternal = external->prev;
15322 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15323 {
15324 struct ClassFunction * func;
15325 char watcherName[1024];
15326 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15327 struct External * createdExternal;
15328 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15329
15330 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15331 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15332 if(propWatch->deleteWatch)
15333 strcat(watcherName, "_delete");
15334 else
15335 {
15336 struct Identifier * propID;
15337
15338 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15339 {
15340 strcat(watcherName, "_");
15341 strcat(watcherName, propID->string);
15342 }
15343 }
15344 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15345 {
15346 func = MkClassFunction(MkListOne(MkSpecifier(301)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15347 ProcessClassFunctionBody(func, propWatch->compound);
15348 propWatch->compound = (((void *)0));
15349 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15350 createdExternal->symbol->idCode = external->symbol->idCode;
15351 curExternal = createdExternal;
15352 ProcessFunction(createdExternal->function);
15353 {
15354 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15355
15356 externalDecl->declaration = decl;
15357 if(decl->symbol && !decl->symbol->pointerExternal)
15358 decl->symbol->pointerExternal = externalDecl;
15359 }
15360 if(propWatch->deleteWatch)
15361 {
15362 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15363
15364 ListAdd(args, CopyExpression(object));
15365 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15366 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15367 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15368 }
15369 else
15370 {
15371 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15372 struct Identifier * propID;
15373
15374 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15375 {
15376 char propName[1024];
15377 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15378
15379 if(prop)
15380 {
15381 char getName[1024], setName[1024];
15382 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15383
15384 DeclareProperty(prop, setName, getName);
15385 strcpy(propName, "__ecereProp_");
15386 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15387 strcat(propName, "_");
15388 FullClassNameCat(propName, prop->name, 0x1);
15389 ListAdd(args, CopyExpression(object));
15390 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15391 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15392 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15393 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15394 }
15395 else
15396 Compiler_Error("Property %s not found in class %s\n", prop->name, _class->fullName);
15397 }
15398 }
15399 }
15400 else
15401 Compiler_Error("Invalid watched object\n");
15402 }
15403 curExternal = external;
15404 curContext = context;
15405 if(watcher)
15406 FreeExpression(watcher);
15407 if(object)
15408 FreeExpression(object);
15409 FreeList(watches, FreePropertyWatch);
15410 }
15411 else
15412 Compiler_Error("No observer specified and not inside a _class\n");
15413 }
15414 else
15415 {
15416 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15417 {
15418 ProcessStatement(propWatch->compound);
15419 }
15420 }
15421 break;
15422 }
15423 case 15:
15424 {
15425 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15426 struct Expression * object = stmt->_watch.object;
15427 struct __ecereNameSpace__ecere__com__Class * _class;
15428
15429 if(object)
15430 ProcessExpressionType(object);
15431 if(inCompiler)
15432 {
15433 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15434 if(_class)
15435 {
15436 struct Identifier * propID;
15437
15438 stmt->type = 3;
15439 stmt->expressions = MkList();
15440 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15441 {
15442 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15443 }
15444 else if(!watches)
15445 {
15446 }
15447 if(watches)
15448 {
15449 for(propID = (*watches).first; propID; propID = propID->next)
15450 {
15451 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15452
15453 if(prop)
15454 {
15455 CreateFireWatcher(prop, object, stmt);
15456 }
15457 else
15458 Compiler_Error("Property %s not found in class %s\n", propID->string, _class->fullName);
15459 }
15460 }
15461 else
15462 {
15463 struct __ecereNameSpace__ecere__com__Property * prop;
15464 struct __ecereNameSpace__ecere__com__Class * base;
15465
15466 for(base = _class; base; base = base->base)
15467 {
15468 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15469 {
15470 if(prop->isProperty && prop->isWatchable)
15471 {
15472 CreateFireWatcher(prop, object, stmt);
15473 }
15474 }
15475 }
15476 }
15477 if(object)
15478 FreeExpression(object);
15479 FreeList(watches, FreeIdentifier);
15480 }
15481 else
15482 Compiler_Error("Invalid object specified and not inside a class\n");
15483 }
15484 break;
15485 }
15486 case 16:
15487 {
15488 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15489 struct Expression * object = stmt->_watch.object;
15490 struct Expression * watcher = stmt->_watch.watcher;
15491 struct __ecereNameSpace__ecere__com__Class * _class;
15492
15493 if(object)
15494 ProcessExpressionType(object);
15495 if(watcher)
15496 ProcessExpressionType(watcher);
15497 if(inCompiler)
15498 {
15499 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15500 if(watcher || thisClass)
15501 {
15502 if(_class)
15503 {
15504 struct Identifier * propID;
15505
15506 stmt->type = 3;
15507 stmt->expressions = MkList();
15508 if(!watches)
15509 {
15510 struct __ecereNameSpace__ecere__sys__OldList * args;
15511
15512 args = MkList();
15513 ListAdd(args, CopyExpression(object));
15514 ListAdd(args, MkExpConstant("0"));
15515 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15516 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15517 }
15518 else
15519 {
15520 for(propID = (*watches).first; propID; propID = propID->next)
15521 {
15522 char propName[1024];
15523 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15524
15525 if(prop)
15526 {
15527 char getName[1024], setName[1024];
15528 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15529
15530 DeclareProperty(prop, setName, getName);
15531 strcpy(propName, "__ecereProp_");
15532 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15533 strcat(propName, "_");
15534 FullClassNameCat(propName, prop->name, 0x1);
15535 MangleClassName(propName);
15536 ListAdd(args, CopyExpression(object));
15537 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15538 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15539 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15540 }
15541 else
15542 Compiler_Error("Property %s not found in class %s\n", prop->name, _class->fullName);
15543 }
15544 }
15545 if(object)
15546 FreeExpression(object);
15547 if(watcher)
15548 FreeExpression(watcher);
15549 FreeList(watches, FreeIdentifier);
15550 }
15551 else
15552 Compiler_Error("Invalid object specified and not inside a class\n");
15553 }
15554 else
15555 Compiler_Error("No observer specified and not inside a class\n");
15556 }
15557 break;
15558 }
15559 }
15560 }
15561
15562 extern struct Expression * QBrackets(struct Expression * exp);
15563
15564 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15565
15566 extern struct Declarator * QMkPtrDecl(char *  id);
15567
15568 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15569
15570 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15571
15572 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15573
15574 static void ProcessFunction(struct FunctionDefinition * function)
15575 {
15576 void * __ecereTemp2;
15577 void * __ecereTemp1;
15578 struct Identifier * id = GetDeclId(function->declarator);
15579 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15580 struct Type * type = symbol ? symbol->type : (((void *)0));
15581 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15582 struct Context * oldTopContext = topContext;
15583
15584 yylloc = function->loc;
15585 if(type && type->thisClass)
15586 {
15587 struct Symbol * classSym = type->thisClass;
15588 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15589 char className[1024];
15590 char structName[1024];
15591 struct Declarator * funcDecl;
15592 struct Symbol * thisSymbol;
15593 unsigned int typedObject = 0x0;
15594
15595 if(_class && !_class->base)
15596 {
15597 _class = currentClass;
15598 if(_class && !_class->symbol)
15599 _class->symbol = FindClass(_class->fullName);
15600 classSym = _class ? _class->symbol : (((void *)0));
15601 typedObject = 0x1;
15602 }
15603 thisClass = _class;
15604 if(inCompiler && _class)
15605 {
15606 if(type->kind == 11)
15607 {
15608 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15609 {
15610 struct Type * param = symbol->type->params.first;
15611
15612 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15613 FreeType(param);
15614 }
15615 if(type->classObjectType != 1)
15616 {
15617 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15618 symbol->type->staticMethod = 0x1;
15619 symbol->type->thisClass = (((void *)0));
15620 symbol->type->extraParam = 0x0;
15621 }
15622 }
15623 strcpy(className, "__ecereClass_");
15624 FullClassNameCat(className, _class->fullName, 0x1);
15625 MangleClassName(className);
15626 structName[0] = (char)0;
15627 FullClassNameCat(structName, _class->fullName, 0x0);
15628 funcDecl = GetFuncDecl(function->declarator);
15629 if(funcDecl)
15630 {
15631 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15632 {
15633 struct TypeName * param = (*funcDecl->function.parameters).first;
15634
15635 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == 301 && !param->declarator)
15636 {
15637 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15638 FreeTypeName(param);
15639 }
15640 }
15641 if(!function->propertyNoThis)
15642 {
15643 struct TypeName * thisParam;
15644
15645 if(type->classObjectType != 1)
15646 {
15647 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15648 if(!funcDecl->function.parameters)
15649 funcDecl->function.parameters = MkList();
15650 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15651 }
15652 if(typedObject)
15653 {
15654 if(type->classObjectType != 1)
15655 {
15656 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
15657 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
15658 }
15659 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));
15660 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15661 }
15662 }
15663 }
15664 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15665 {
15666 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15667
15668 funcDecl = GetFuncDecl(initDecl->declarator);
15669 if(funcDecl)
15670 {
15671 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15672 {
15673 struct TypeName * param = (*funcDecl->function.parameters).first;
15674
15675 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == 301 && !param->declarator)
15676 {
15677 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
15678 FreeTypeName(param);
15679 }
15680 }
15681 if(type->classObjectType != 1)
15682 {
15683 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
15684 {
15685 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
15686
15687 if(!funcDecl->function.parameters)
15688 funcDecl->function.parameters = MkList();
15689 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
15690 }
15691 }
15692 }
15693 }
15694 }
15695 if(function->body)
15696 {
15697 if(type->classObjectType != 1)
15698 {
15699 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));
15700 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15701 if(typedObject && thisSymbol->type)
15702 {
15703 thisSymbol->type->classObjectType = 2;
15704 thisSymbol->type->byReference = type->byReference;
15705 }
15706 }
15707 }
15708 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
15709 {
15710 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15711
15712 {
15713 struct __ecereNameSpace__ecere__com__Class * base;
15714
15715 for(base = _class; base && base->type != 1000; base = base->next)
15716 {
15717 for(member = base->membersAndProperties.first; member; member = member->next)
15718 if(!member->isProperty)
15719 break;
15720 if(member)
15721 break;
15722 }
15723 }
15724 for(member = _class->membersAndProperties.first; member; member = member->next)
15725 if(!member->isProperty)
15726 break;
15727 if(member)
15728 {
15729 char pointerName[1024];
15730 struct Declaration * decl;
15731 struct Initializer * initializer;
15732 struct Expression * exp, * bytePtr;
15733
15734 strcpy(pointerName, "__ecerePointer_");
15735 FullClassNameCat(pointerName, _class->fullName, 0x0);
15736 {
15737 char className[1024];
15738
15739 strcpy(className, "__ecereClass_");
15740 FullClassNameCat(className, classSym->string, 0x1);
15741 MangleClassName(className);
15742 DeclareClass(classSym, className);
15743 }
15744 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
15745 if(_class->fixed)
15746 {
15747 char string[256];
15748
15749 sprintf(string, "%d", _class->offset);
15750 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
15751 }
15752 else
15753 {
15754 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
15755 }
15756 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
15757 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));
15758 if(function->body)
15759 {
15760 yylloc = function->body->loc;
15761 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
15762 {
15763 struct Context * prevContext = curContext;
15764
15765 curContext = function->body->compound.context;
15766 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
15767 curContext = prevContext;
15768 }
15769 decl->symbol = (((void *)0));
15770 if(!function->body->compound.declarations)
15771 function->body->compound.declarations = MkList();
15772 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
15773 }
15774 }
15775 }
15776 }
15777 else
15778 thisClass = (((void *)0));
15779 if(id)
15780 {
15781 FreeSpecifier(id->_class);
15782 id->_class = (((void *)0));
15783 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
15784 {
15785 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
15786
15787 id = GetDeclId(initDecl->declarator);
15788 FreeSpecifier(id->_class);
15789 id->_class = (((void *)0));
15790 }
15791 }
15792 if(function->body)
15793 topContext = function->body->compound.context;
15794 {
15795 struct FunctionDefinition * oldFunction = curFunction;
15796
15797 curFunction = function;
15798 if(function->body)
15799 ProcessStatement(function->body);
15800 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
15801 {
15802 struct Statement * prevCompound = curCompound;
15803 struct Context * prevContext = curContext;
15804 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
15805
15806 if(!function->body->compound.statements)
15807 function->body->compound.statements = MkList();
15808 ListAdd(function->body->compound.statements, fireWatchers);
15809 curCompound = function->body;
15810 curContext = function->body->compound.context;
15811 ProcessStatement(fireWatchers);
15812 curContext = prevContext;
15813 curCompound = prevCompound;
15814 }
15815 curFunction = oldFunction;
15816 }
15817 if(function->declarator)
15818 {
15819 ProcessDeclarator(function->declarator);
15820 }
15821 topContext = oldTopContext;
15822 thisClass = oldThisClass;
15823 }
15824
15825 extern void FreeSymbol(struct Symbol * symbol);
15826
15827 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
15828
15829 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
15830 {
15831 struct ClassDef * def;
15832 struct External * external = curExternal;
15833 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
15834
15835 for(def = definitions->first; def; def = def->next)
15836 {
15837 if(def->type == 0)
15838 {
15839 if(def->function->declarator)
15840 curExternal = def->function->declarator->symbol->pointerExternal;
15841 else
15842 curExternal = external;
15843 ProcessFunction((struct FunctionDefinition *)def->function);
15844 }
15845 else if(def->type == 2)
15846 {
15847 if(def->decl->type == 2)
15848 {
15849 thisClass = regClass;
15850 ProcessInstantiationType(def->decl->inst);
15851 thisClass = (((void *)0));
15852 }
15853 else
15854 {
15855 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
15856
15857 if(regClass)
15858 thisClass = regClass;
15859 ProcessDeclaration(def->decl);
15860 thisClass = backThisClass;
15861 }
15862 }
15863 else if(def->type == 1 && def->defProperties)
15864 {
15865 struct MemberInit * defProperty;
15866 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);
15867
15868 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15869 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
15870 {
15871 thisClass = regClass;
15872 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
15873 thisClass = (((void *)0));
15874 }
15875 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15876 FreeSymbol(thisSymbol);
15877 }
15878 else if(def->type == 3 && def->propertyDef)
15879 {
15880 struct PropertyDef * prop = def->propertyDef;
15881
15882 thisClass = regClass;
15883 if(prop->setStmt)
15884 {
15885 if(regClass)
15886 {
15887 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15888
15889 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15890 }
15891 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
15892 ProcessStatement(prop->setStmt);
15893 }
15894 if(prop->getStmt)
15895 {
15896 if(regClass)
15897 {
15898 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15899
15900 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15901 }
15902 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
15903 ProcessStatement(prop->getStmt);
15904 }
15905 if(prop->issetStmt)
15906 {
15907 if(regClass)
15908 {
15909 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15910
15911 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15912 }
15913 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
15914 ProcessStatement(prop->issetStmt);
15915 }
15916 thisClass = (((void *)0));
15917 }
15918 else if(def->type == 4 && def->propertyWatch)
15919 {
15920 struct PropertyWatch * propertyWatch = def->propertyWatch;
15921
15922 thisClass = regClass;
15923 if(propertyWatch->compound)
15924 {
15925 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
15926
15927 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
15928 curExternal = (((void *)0));
15929 ProcessStatement(propertyWatch->compound);
15930 }
15931 thisClass = (((void *)0));
15932 }
15933 }
15934 }
15935
15936 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
15937
15938 void ComputeDataTypes()
15939 {
15940 void * __ecereTemp1;
15941 struct External * external;
15942 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
15943
15944 currentClass = (((void *)0));
15945 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
15946 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
15947 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
15948 curExternal = temp;
15949 DeclareStruct("ecere::com::Class", 0x0);
15950 DeclareStruct("ecere::com::Instance", 0x0);
15951 DeclareStruct("ecere::com::Property", 0x0);
15952 DeclareStruct("ecere::com::DataMember", 0x0);
15953 DeclareStruct("ecere::com::Method", 0x0);
15954 DeclareStruct("ecere::com::SerialBuffer", 0x0);
15955 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
15956 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
15957 for(external = (*ast).first; external; external = external->next)
15958 {
15959 afterExternal = curExternal = external;
15960 if(external->type == 0)
15961 {
15962 currentClass = external->function->_class;
15963 ProcessFunction(external->function);
15964 }
15965 else if(external->type == 1)
15966 {
15967 currentClass = (((void *)0));
15968 ProcessDeclaration(external->declaration);
15969 }
15970 else if(external->type == 2)
15971 {
15972 struct ClassDefinition * _class = external->_class;
15973
15974 currentClass = external->symbol->registered;
15975 if(_class->definitions)
15976 {
15977 ProcessClass(_class->definitions, _class->symbol);
15978 }
15979 if(inCompiler)
15980 {
15981 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
15982 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
15983 }
15984 }
15985 else if(external->type == 4)
15986 {
15987 thisNameSpace = external->id->string;
15988 }
15989 }
15990 currentClass = (((void *)0));
15991 thisNameSpace = (((void *)0));
15992 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
15993 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
15994 }
15995
15996 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);
15997
15998 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);
15999
16000 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
16001
16002 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16003 {
16004 struct __ecereNameSpace__ecere__com__Class * class;
16005
16006 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16007 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16008 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16009 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16010 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoi64", "int64 _strtoi64(char * string, char * * endString, int base)", _strtoi64, module, 2);
16011 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoui64", "uint64 _strtoui64(char * string, char * * endString, int base)", _strtoui64, module, 2);
16012 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16013 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16014 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16015 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16016 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16017 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16018 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16019 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16020 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16021 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16022 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16023 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16024 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16025 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16026 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16027 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16028 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16029 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16030 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16031 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16032 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16033 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16034 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16035 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16036 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16037 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16038 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16039 __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);
16040 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16041 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16042 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16043 __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);
16044 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16045 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16046 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16047 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16048 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16049 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16050 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16051 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16052 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16053 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16054 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16055 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16056 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16057 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16058 __ecereClass_Conversion = class;
16059 __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);
16060 __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);
16061 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16062 __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);
16063 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16064 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16065 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16066 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16067 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16068 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16069 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16070 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16071 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16072 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16073 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16074 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16075 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16076 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16077 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16078 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16079 }
16080
16081 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16082 {
16083
16084 }
16085