compiler/libec: (#1029) Fixed crash serializing null class instances
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 /* Code generated from eC source file: pass15.ec */
2 #if defined(__GNUC__)
3 typedef long long int64;
4 typedef unsigned long long uint64;
5 #ifndef _WIN32
6 #define __declspec(x)
7 #endif
8 #elif defined(__TINYC__)
9 #include <stdarg.h>
10 #define __builtin_va_list va_list
11 #define __builtin_va_start va_start
12 #define __builtin_va_end va_end
13 #ifdef _WIN32
14 #define strcasecmp stricmp
15 #define strncasecmp strnicmp
16 #define __declspec(x) __attribute__((x))
17 #else
18 #define __declspec(x)
19 #endif
20 typedef long long int64;
21 typedef unsigned long long uint64;
22 #else
23 typedef __int64 int64;
24 typedef unsigned __int64 uint64;
25 #endif
26 #ifdef __BIG_ENDIAN__
27 #define __ENDIAN_PAD(x) (8 - (x))
28 #else
29 #define __ENDIAN_PAD(x) 0
30 #endif
31 #include <stdint.h>
32 #include <sys/types.h>
33
34 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
35 #define _64BIT 1
36 #else
37 #define _64BIT 0
38 #endif
39
40 #define arch_PointerSize                  sizeof(void *)
41 #define structSize_Instance               (_64BIT ? 24 : 12)
42 #define structSize_Module                 (_64BIT ? 560 : 300)
43 #define structSize_NamedLink              (_64BIT ? 32 : 16)
44
45 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
46
47 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
48
49 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
50
51 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
52
53 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
54
55 struct __ecereNameSpace__ecere__sys__BTNode;
56
57 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
58
59 struct __ecereNameSpace__ecere__sys__BinaryTree
60 {
61 struct __ecereNameSpace__ecere__sys__BTNode * root;
62 int count;
63 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
64 void (*  FreeKey)(void *  key);
65 } __attribute__ ((gcc_struct));
66
67 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
68
69 struct __ecereNameSpace__ecere__sys__OldList
70 {
71 void *  first;
72 void *  last;
73 int count;
74 unsigned int offset;
75 unsigned int circ;
76 } __attribute__ ((gcc_struct));
77
78 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
79
80 struct __ecereNameSpace__ecere__com__Method
81 {
82 char *  name;
83 struct __ecereNameSpace__ecere__com__Method * parent;
84 struct __ecereNameSpace__ecere__com__Method * left;
85 struct __ecereNameSpace__ecere__com__Method * right;
86 int depth;
87 int (*  function)();
88 int vid;
89 int type;
90 struct __ecereNameSpace__ecere__com__Class * _class;
91 void *  symbol;
92 char *  dataTypeString;
93 struct Type * dataType;
94 int memberAccess;
95 } __attribute__ ((gcc_struct));
96
97 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
98
99 struct __ecereNameSpace__ecere__com__Property
100 {
101 struct __ecereNameSpace__ecere__com__Property * prev;
102 struct __ecereNameSpace__ecere__com__Property * next;
103 char *  name;
104 unsigned int isProperty;
105 int memberAccess;
106 int id;
107 struct __ecereNameSpace__ecere__com__Class * _class;
108 char *  dataTypeString;
109 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
110 struct Type * dataType;
111 void (*  Set)(void * , int);
112 int (*  Get)(void * );
113 unsigned int (*  IsSet)(void * );
114 void *  data;
115 void *  symbol;
116 int vid;
117 unsigned int conversion;
118 unsigned int watcherOffset;
119 char *  category;
120 unsigned int compiled;
121 unsigned int selfWatchable;
122 unsigned int isWatchable;
123 } __attribute__ ((gcc_struct));
124
125 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
126
127 struct CodePosition
128 {
129 int line;
130 int charPos;
131 int pos;
132 int included;
133 } __attribute__ ((gcc_struct));
134
135 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
136
137 struct Location
138 {
139 struct CodePosition start;
140 struct CodePosition end;
141 } __attribute__ ((gcc_struct));
142
143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
144
145 struct Attrib;
146
147 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
148
149 struct ExtDecl
150 {
151 struct Location loc;
152 int type;
153 union
154 {
155 char * s;
156 struct Attrib * attr;
157 } __attribute__ ((gcc_struct));
158 } __attribute__ ((gcc_struct));
159
160 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
161
162 struct ClassDefinition
163 {
164 struct ClassDefinition * prev;
165 struct ClassDefinition * next;
166 struct Location loc;
167 struct Specifier * _class;
168 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
169 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
170 struct Symbol * symbol;
171 struct Location blockStart;
172 struct Location nameLoc;
173 int endid;
174 int declMode;
175 unsigned int deleteWatchable;
176 } __attribute__ ((gcc_struct));
177
178 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
179
180 struct Context
181 {
182 struct Context * parent;
183 struct __ecereNameSpace__ecere__sys__BinaryTree types;
184 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
185 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
186 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
187 int nextID;
188 int simpleID;
189 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
190 struct ClassDefinition * classDef;
191 unsigned int templateTypesOnly;
192 unsigned int hasNameSpace;
193 } __attribute__ ((gcc_struct));
194
195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
196
197 struct Instantiation
198 {
199 struct Instantiation * prev;
200 struct Instantiation * next;
201 struct Location loc;
202 struct Specifier * _class;
203 struct Expression * exp;
204 struct __ecereNameSpace__ecere__sys__OldList *  members;
205 struct Symbol * symbol;
206 unsigned int fullSet;
207 unsigned int isConstant;
208 unsigned char *  data;
209 struct Location nameLoc;
210 struct Location insideLoc;
211 unsigned int built;
212 } __attribute__ ((gcc_struct));
213
214 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
215
216 struct Declaration
217 {
218 struct Declaration * prev;
219 struct Declaration * next;
220 struct Location loc;
221 int type;
222 union
223 {
224 struct
225 {
226 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
227 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
228 } __attribute__ ((gcc_struct));
229 struct Instantiation * inst;
230 struct
231 {
232 struct Identifier * id;
233 struct Expression * exp;
234 } __attribute__ ((gcc_struct));
235 } __attribute__ ((gcc_struct));
236 struct Specifier * extStorage;
237 struct Symbol * symbol;
238 int declMode;
239 } __attribute__ ((gcc_struct));
240
241 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
242
243 struct Statement
244 {
245 struct Statement * prev;
246 struct Statement * next;
247 struct Location loc;
248 int type;
249 union
250 {
251 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
252 struct
253 {
254 struct Identifier * id;
255 struct Statement * stmt;
256 } __attribute__ ((gcc_struct)) labeled;
257 struct
258 {
259 struct Expression * exp;
260 struct Statement * stmt;
261 } __attribute__ ((gcc_struct)) caseStmt;
262 struct
263 {
264 struct __ecereNameSpace__ecere__sys__OldList * declarations;
265 struct __ecereNameSpace__ecere__sys__OldList * statements;
266 struct Context * context;
267 unsigned int isSwitch;
268 } __attribute__ ((gcc_struct)) compound;
269 struct
270 {
271 struct __ecereNameSpace__ecere__sys__OldList * exp;
272 struct Statement * stmt;
273 struct Statement * elseStmt;
274 } __attribute__ ((gcc_struct)) ifStmt;
275 struct
276 {
277 struct __ecereNameSpace__ecere__sys__OldList * exp;
278 struct Statement * stmt;
279 } __attribute__ ((gcc_struct)) switchStmt;
280 struct
281 {
282 struct __ecereNameSpace__ecere__sys__OldList * exp;
283 struct Statement * stmt;
284 } __attribute__ ((gcc_struct)) whileStmt;
285 struct
286 {
287 struct __ecereNameSpace__ecere__sys__OldList * exp;
288 struct Statement * stmt;
289 } __attribute__ ((gcc_struct)) doWhile;
290 struct
291 {
292 struct Statement * init;
293 struct Statement * check;
294 struct __ecereNameSpace__ecere__sys__OldList * increment;
295 struct Statement * stmt;
296 } __attribute__ ((gcc_struct)) forStmt;
297 struct
298 {
299 struct Identifier * id;
300 } __attribute__ ((gcc_struct)) gotoStmt;
301 struct
302 {
303 struct Specifier * spec;
304 char * statements;
305 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
306 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
307 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
308 } __attribute__ ((gcc_struct)) asmStmt;
309 struct
310 {
311 struct Expression * watcher;
312 struct Expression * object;
313 struct __ecereNameSpace__ecere__sys__OldList * watches;
314 } __attribute__ ((gcc_struct)) _watch;
315 struct
316 {
317 struct Identifier * id;
318 struct __ecereNameSpace__ecere__sys__OldList * exp;
319 struct __ecereNameSpace__ecere__sys__OldList * filter;
320 struct Statement * stmt;
321 } __attribute__ ((gcc_struct)) forEachStmt;
322 struct Declaration * decl;
323 } __attribute__ ((gcc_struct));
324 } __attribute__ ((gcc_struct));
325
326 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
327
328 struct TypeName
329 {
330 struct TypeName * prev;
331 struct TypeName * next;
332 struct Location loc;
333 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
334 struct Declarator * declarator;
335 int classObjectType;
336 struct Expression * bitCount;
337 } __attribute__ ((gcc_struct));
338
339 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
340
341 struct Initializer
342 {
343 struct Initializer * prev;
344 struct Initializer * next;
345 struct Location loc;
346 int type;
347 union
348 {
349 struct Expression * exp;
350 struct __ecereNameSpace__ecere__sys__OldList *  list;
351 } __attribute__ ((gcc_struct));
352 unsigned int isConstant;
353 } __attribute__ ((gcc_struct));
354
355 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
356
357 struct __ecereNameSpace__ecere__com__DataValue
358 {
359 union
360 {
361 char c;
362 unsigned char uc;
363 short s;
364 unsigned short us;
365 int i;
366 unsigned int ui;
367 void *  p;
368 float f;
369 double d;
370 long long i64;
371 uint64 ui64;
372 } __attribute__ ((gcc_struct));
373 } __attribute__ ((gcc_struct));
374
375 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
376
377 struct Expression
378 {
379 struct Expression * prev;
380 struct Expression * next;
381 struct Location loc;
382 int type;
383 union
384 {
385 struct
386 {
387 char *  constant;
388 struct Identifier * identifier;
389 } __attribute__ ((gcc_struct));
390 struct Statement * compound;
391 struct Instantiation * instance;
392 char *  string;
393 struct __ecereNameSpace__ecere__sys__OldList *  list;
394 struct
395 {
396 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
397 struct Declarator * decl;
398 } __attribute__ ((gcc_struct)) _classExp;
399 struct
400 {
401 struct Identifier * id;
402 } __attribute__ ((gcc_struct)) classData;
403 struct
404 {
405 struct Expression * exp;
406 struct __ecereNameSpace__ecere__sys__OldList * arguments;
407 struct Location argLoc;
408 } __attribute__ ((gcc_struct)) call;
409 struct
410 {
411 struct Expression * exp;
412 struct __ecereNameSpace__ecere__sys__OldList * index;
413 } __attribute__ ((gcc_struct)) index;
414 struct
415 {
416 struct Expression * exp;
417 struct Identifier * member;
418 int memberType;
419 unsigned int thisPtr;
420 } __attribute__ ((gcc_struct)) member;
421 struct
422 {
423 int op;
424 struct Expression * exp1;
425 struct Expression * exp2;
426 } __attribute__ ((gcc_struct)) op;
427 struct TypeName * typeName;
428 struct Specifier * _class;
429 struct
430 {
431 struct TypeName * typeName;
432 struct Expression * exp;
433 } __attribute__ ((gcc_struct)) cast;
434 struct
435 {
436 struct Expression * cond;
437 struct __ecereNameSpace__ecere__sys__OldList * exp;
438 struct Expression * elseExp;
439 } __attribute__ ((gcc_struct)) cond;
440 struct
441 {
442 struct TypeName * typeName;
443 struct Expression * size;
444 } __attribute__ ((gcc_struct)) _new;
445 struct
446 {
447 struct TypeName * typeName;
448 struct Expression * size;
449 struct Expression * exp;
450 } __attribute__ ((gcc_struct)) _renew;
451 struct
452 {
453 char * table;
454 struct Identifier * id;
455 } __attribute__ ((gcc_struct)) db;
456 struct
457 {
458 struct Expression * ds;
459 struct Expression * name;
460 } __attribute__ ((gcc_struct)) dbopen;
461 struct
462 {
463 struct TypeName * typeName;
464 struct Initializer * initializer;
465 } __attribute__ ((gcc_struct)) initializer;
466 struct
467 {
468 struct Expression * exp;
469 struct TypeName * typeName;
470 } __attribute__ ((gcc_struct)) vaArg;
471 } __attribute__ ((gcc_struct));
472 unsigned int debugValue;
473 struct __ecereNameSpace__ecere__com__DataValue val;
474 uint64 address;
475 unsigned int hasAddress;
476 struct Type * expType;
477 struct Type * destType;
478 unsigned int usage;
479 int tempCount;
480 unsigned int byReference;
481 unsigned int isConstant;
482 unsigned int addedThis;
483 unsigned int needCast;
484 unsigned int thisPtr;
485 } __attribute__ ((gcc_struct));
486
487 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
488
489 struct TemplateDatatype
490 {
491 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
492 struct Declarator * decl;
493 } __attribute__ ((gcc_struct));
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
496
497 struct TemplateArgument;
498
499 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
500
501 struct TemplateParameter
502 {
503 struct TemplateParameter * prev;
504 struct TemplateParameter * next;
505 struct Location loc;
506 int type;
507 struct Identifier * identifier;
508 union
509 {
510 struct TemplateDatatype * dataType;
511 int memberType;
512 } __attribute__ ((gcc_struct));
513 struct TemplateArgument * defaultArgument;
514 char *  dataTypeString;
515 struct Type * baseType;
516 } __attribute__ ((gcc_struct));
517
518 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
519
520 struct Specifier
521 {
522 struct Specifier * prev;
523 struct Specifier * next;
524 struct Location loc;
525 int type;
526 union
527 {
528 int specifier;
529 struct
530 {
531 struct ExtDecl * extDecl;
532 char *  name;
533 struct Symbol * symbol;
534 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
535 } __attribute__ ((gcc_struct));
536 struct
537 {
538 struct Identifier * id;
539 struct __ecereNameSpace__ecere__sys__OldList *  list;
540 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
541 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
542 unsigned int addNameSpace;
543 struct Context * ctx;
544 struct ExtDecl * extDeclStruct;
545 } __attribute__ ((gcc_struct));
546 struct Expression * expression;
547 struct Specifier * _class;
548 struct TemplateParameter * templateParameter;
549 } __attribute__ ((gcc_struct));
550 } __attribute__ ((gcc_struct));
551
552 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
553
554 struct Identifier
555 {
556 struct Identifier * prev;
557 struct Identifier * next;
558 struct Location loc;
559 struct Symbol * classSym;
560 struct Specifier * _class;
561 char *  string;
562 struct Identifier * badID;
563 } __attribute__ ((gcc_struct));
564
565 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
566
567 struct Pointer;
568
569 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
570
571 struct Declarator
572 {
573 struct Declarator * prev;
574 struct Declarator * next;
575 struct Location loc;
576 int type;
577 struct Symbol * symbol;
578 struct Declarator * declarator;
579 union
580 {
581 struct Identifier * identifier;
582 struct
583 {
584 struct Expression * exp;
585 struct Expression * posExp;
586 struct Attrib * attrib;
587 } __attribute__ ((gcc_struct)) structDecl;
588 struct
589 {
590 struct Expression * exp;
591 struct Specifier * enumClass;
592 } __attribute__ ((gcc_struct)) array;
593 struct
594 {
595 struct __ecereNameSpace__ecere__sys__OldList * parameters;
596 } __attribute__ ((gcc_struct)) function;
597 struct
598 {
599 struct Pointer * pointer;
600 } __attribute__ ((gcc_struct)) pointer;
601 struct
602 {
603 struct ExtDecl * extended;
604 } __attribute__ ((gcc_struct)) extended;
605 } __attribute__ ((gcc_struct));
606 } __attribute__ ((gcc_struct));
607
608 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
609
610 struct FunctionDefinition
611 {
612 struct FunctionDefinition * prev;
613 struct FunctionDefinition * next;
614 struct Location loc;
615 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
616 struct Declarator * declarator;
617 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
618 struct Statement * body;
619 struct __ecereNameSpace__ecere__com__Class * _class;
620 struct __ecereNameSpace__ecere__sys__OldList attached;
621 int declMode;
622 struct Type * type;
623 struct Symbol * propSet;
624 int tempCount;
625 unsigned int propertyNoThis;
626 } __attribute__ ((gcc_struct));
627
628 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
629
630 struct DBTableDef;
631
632 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
633
634 struct External
635 {
636 struct External * prev;
637 struct External * next;
638 struct Location loc;
639 int type;
640 struct Symbol * symbol;
641 union
642 {
643 struct FunctionDefinition * function;
644 struct ClassDefinition * _class;
645 struct Declaration * declaration;
646 char *  importString;
647 struct Identifier * id;
648 struct DBTableDef * table;
649 } __attribute__ ((gcc_struct));
650 int importType;
651 } __attribute__ ((gcc_struct));
652
653 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
654
655 struct ModuleImport
656 {
657 struct ModuleImport * prev;
658 struct ModuleImport * next;
659 char *  name;
660 struct __ecereNameSpace__ecere__sys__OldList classes;
661 struct __ecereNameSpace__ecere__sys__OldList functions;
662 int importType;
663 int importAccess;
664 } __attribute__ ((gcc_struct));
665
666 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
667
668 struct ClassImport
669 {
670 struct ClassImport * prev;
671 struct ClassImport * next;
672 char *  name;
673 struct __ecereNameSpace__ecere__sys__OldList methods;
674 struct __ecereNameSpace__ecere__sys__OldList properties;
675 unsigned int itself;
676 unsigned int isRemote;
677 } __attribute__ ((gcc_struct));
678
679 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
680
681 struct Symbol
682 {
683 char *  string;
684 struct Symbol * parent;
685 struct Symbol * left;
686 struct Symbol * right;
687 int depth;
688 struct Type * type;
689 union
690 {
691 struct __ecereNameSpace__ecere__com__Method * method;
692 struct __ecereNameSpace__ecere__com__Property * _property;
693 struct __ecereNameSpace__ecere__com__Class * registered;
694 } __attribute__ ((gcc_struct));
695 int id;
696 int idCode;
697 union
698 {
699 struct
700 {
701 struct External * pointerExternal;
702 struct External * structExternal;
703 } __attribute__ ((gcc_struct));
704 struct
705 {
706 struct External * externalGet;
707 struct External * externalSet;
708 struct External * externalPtr;
709 struct External * externalIsSet;
710 } __attribute__ ((gcc_struct));
711 struct
712 {
713 struct External * methodExternal;
714 struct External * methodCodeExternal;
715 } __attribute__ ((gcc_struct));
716 } __attribute__ ((gcc_struct));
717 unsigned int imported;
718 unsigned int declaredStructSym;
719 struct __ecereNameSpace__ecere__com__Class * _class;
720 unsigned int declaredStruct;
721 unsigned int needConstructor;
722 unsigned int needDestructor;
723 char *  constructorName;
724 char *  structName;
725 char *  className;
726 char *  destructorName;
727 struct ModuleImport * module;
728 struct ClassImport * _import;
729 struct Location nameLoc;
730 unsigned int isParam;
731 unsigned int isRemote;
732 unsigned int isStruct;
733 unsigned int fireWatchersDone;
734 int declaring;
735 unsigned int classData;
736 unsigned int isStatic;
737 char *  shortName;
738 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
739 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
740 struct Context * ctx;
741 int isIterator;
742 struct Expression * propCategory;
743 } __attribute__ ((gcc_struct));
744
745 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
746
747 struct Type
748 {
749 struct Type * prev;
750 struct Type * next;
751 int refCount;
752 union
753 {
754 struct Symbol * _class;
755 struct
756 {
757 struct __ecereNameSpace__ecere__sys__OldList members;
758 char *  enumName;
759 } __attribute__ ((gcc_struct));
760 struct
761 {
762 struct Type * returnType;
763 struct __ecereNameSpace__ecere__sys__OldList params;
764 struct Symbol * thisClass;
765 unsigned int staticMethod;
766 struct TemplateParameter * thisClassTemplate;
767 } __attribute__ ((gcc_struct));
768 struct
769 {
770 struct __ecereNameSpace__ecere__com__Method * method;
771 struct __ecereNameSpace__ecere__com__Class * methodClass;
772 struct __ecereNameSpace__ecere__com__Class * usedClass;
773 } __attribute__ ((gcc_struct));
774 struct
775 {
776 struct Type * arrayType;
777 int arraySize;
778 struct Expression * arraySizeExp;
779 unsigned int freeExp;
780 struct Symbol * enumClass;
781 } __attribute__ ((gcc_struct));
782 struct Type * type;
783 struct TemplateParameter * templateParameter;
784 } __attribute__ ((gcc_struct));
785 int kind;
786 unsigned int size;
787 char *  name;
788 char *  typeName;
789 int classObjectType;
790 int alignment;
791 unsigned int offset;
792 int bitFieldCount;
793 int count;
794 unsigned int isSigned : 1;
795 unsigned int constant : 1;
796 unsigned int truth : 1;
797 unsigned int byReference : 1;
798 unsigned int extraParam : 1;
799 unsigned int directClassAccess : 1;
800 unsigned int computing : 1;
801 unsigned int keepCast : 1;
802 unsigned int passAsTemplate : 1;
803 unsigned int dllExport : 1;
804 unsigned int attrStdcall : 1;
805 unsigned int declaredWithStruct : 1;
806 unsigned int typedByReference : 1;
807 } __attribute__ ((gcc_struct));
808
809 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
810
811 struct __ecereNameSpace__ecere__com__Class
812 {
813 struct __ecereNameSpace__ecere__com__Class * prev;
814 struct __ecereNameSpace__ecere__com__Class * next;
815 char *  name;
816 int offset;
817 int structSize;
818 int (* *  _vTbl)();
819 int vTblSize;
820 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
821 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
822 int offsetClass;
823 int sizeClass;
824 struct __ecereNameSpace__ecere__com__Class * base;
825 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
826 struct __ecereNameSpace__ecere__sys__BinaryTree members;
827 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
828 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
829 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
830 struct __ecereNameSpace__ecere__sys__OldList derivatives;
831 int memberID;
832 int startMemberID;
833 int type;
834 struct __ecereNameSpace__ecere__com__Instance * module;
835 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
836 char *  dataTypeString;
837 struct Type * dataType;
838 int typeSize;
839 int defaultAlignment;
840 void (*  Initialize)();
841 int memberOffset;
842 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
843 char *  designerClass;
844 unsigned int noExpansion;
845 char *  defaultProperty;
846 unsigned int comRedefinition;
847 int count;
848 unsigned int isRemote;
849 unsigned int internalDecl;
850 void *  data;
851 unsigned int computeSize;
852 int structAlignment;
853 int destructionWatchOffset;
854 unsigned int fixed;
855 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
856 int inheritanceAccess;
857 char *  fullName;
858 void *  symbol;
859 struct __ecereNameSpace__ecere__sys__OldList conversions;
860 struct __ecereNameSpace__ecere__sys__OldList templateParams;
861 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
862 struct __ecereNameSpace__ecere__com__Class * templateClass;
863 struct __ecereNameSpace__ecere__sys__OldList templatized;
864 int numParams;
865 unsigned int isInstanceClass;
866 unsigned int byValueSystemClass;
867 } __attribute__ ((gcc_struct));
868
869 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
870
871 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
872
873 struct __ecereNameSpace__ecere__com__Instance
874 {
875 int (* *  _vTbl)();
876 struct __ecereNameSpace__ecere__com__Class * _class;
877 int _refCount;
878 } __attribute__ ((gcc_struct));
879
880 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
881
882 struct __ecereNameSpace__ecere__com__DataMember
883 {
884 struct __ecereNameSpace__ecere__com__DataMember * prev;
885 struct __ecereNameSpace__ecere__com__DataMember * next;
886 char *  name;
887 unsigned int isProperty;
888 int memberAccess;
889 int id;
890 struct __ecereNameSpace__ecere__com__Class * _class;
891 char *  dataTypeString;
892 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
893 struct Type * dataType;
894 int type;
895 int offset;
896 int memberID;
897 struct __ecereNameSpace__ecere__sys__OldList members;
898 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
899 int memberOffset;
900 int structAlignment;
901 } __attribute__ ((gcc_struct));
902
903 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
904
905 struct __ecereNameSpace__ecere__com__SerialBuffer
906 {
907 unsigned char *  _buffer;
908 unsigned int count;
909 unsigned int _size;
910 unsigned int pos;
911 } __attribute__ ((gcc_struct));
912
913 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
914
915 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
916 {
917 union
918 {
919 struct
920 {
921 char *  dataTypeString;
922 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
923 } __attribute__ ((gcc_struct));
924 struct __ecereNameSpace__ecere__com__DataValue expression;
925 struct
926 {
927 char *  memberString;
928 union
929 {
930 struct __ecereNameSpace__ecere__com__DataMember * member;
931 struct __ecereNameSpace__ecere__com__Property * prop;
932 struct __ecereNameSpace__ecere__com__Method * method;
933 } __attribute__ ((gcc_struct));
934 } __attribute__ ((gcc_struct));
935 } __attribute__ ((gcc_struct));
936 } __attribute__ ((gcc_struct));
937
938 void exit(int status);
939
940 void * calloc(size_t nmemb, size_t size);
941
942 void free(void * ptr);
943
944 void * malloc(size_t size);
945
946 void * realloc(void * ptr, size_t size);
947
948 long int strtol(const char * nptr, char ** endptr, int base);
949
950 long long int strtoll(const char * nptr, char ** endptr, int base);
951
952 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
953
954 enum yytokentype
955 {
956 IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366
957 };
958
959 typedef union YYSTYPE
960 {
961 int specifierType;
962 int i;
963 int declMode;
964 struct Identifier * id;
965 struct Expression * exp;
966 struct Specifier * specifier;
967 struct __ecereNameSpace__ecere__sys__OldList * list;
968 struct Enumerator * enumerator;
969 struct Declarator * declarator;
970 struct Pointer * pointer;
971 struct Initializer * initializer;
972 struct InitDeclarator * initDeclarator;
973 struct TypeName * typeName;
974 struct Declaration * declaration;
975 struct Statement * stmt;
976 struct FunctionDefinition * function;
977 struct External * external;
978 struct Context * context;
979 struct AsmField * asmField;
980 struct Attrib * attrib;
981 struct ExtDecl * extDecl;
982 struct Attribute * attribute;
983 struct Instantiation * instance;
984 struct MembersInit * membersInit;
985 struct MemberInit * memberInit;
986 struct ClassFunction * classFunction;
987 struct ClassDefinition * _class;
988 struct ClassDef * classDef;
989 struct PropertyDef * prop;
990 char * string;
991 struct Symbol * symbol;
992 struct PropertyWatch * propertyWatch;
993 struct TemplateParameter * templateParameter;
994 struct TemplateArgument * templateArgument;
995 struct TemplateDatatype * templateDatatype;
996 struct DBTableEntry * dbtableEntry;
997 struct DBIndexItem * dbindexItem;
998 struct DBTableDef * dbtableDef;
999 } __attribute__ ((gcc_struct)) YYSTYPE;
1000
1001 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1002
1003 struct Enumerator
1004 {
1005 struct Enumerator * prev;
1006 struct Enumerator * next;
1007 struct Location loc;
1008 struct Identifier * id;
1009 struct Expression * exp;
1010 } __attribute__ ((gcc_struct));
1011
1012 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1013
1014 struct InitDeclarator
1015 {
1016 struct InitDeclarator * prev;
1017 struct InitDeclarator * next;
1018 struct Location loc;
1019 struct Declarator * declarator;
1020 struct Initializer * initializer;
1021 } __attribute__ ((gcc_struct));
1022
1023 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1024
1025 struct AsmField
1026 {
1027 struct AsmField * prev;
1028 struct AsmField * next;
1029 struct Location loc;
1030 char *  command;
1031 struct Expression * expression;
1032 } __attribute__ ((gcc_struct));
1033
1034 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1035
1036 struct Attribute;
1037
1038 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1039
1040 struct ClassFunction
1041 {
1042 struct ClassFunction * prev;
1043 struct ClassFunction * next;
1044 struct Location loc;
1045 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1046 struct Declarator * declarator;
1047 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1048 struct Statement * body;
1049 struct __ecereNameSpace__ecere__com__Class * _class;
1050 struct __ecereNameSpace__ecere__sys__OldList attached;
1051 int declMode;
1052 struct Type * type;
1053 struct Symbol * propSet;
1054 unsigned int isVirtual;
1055 unsigned int isConstructor;
1056 unsigned int isDestructor;
1057 unsigned int dontMangle;
1058 int id;
1059 int idCode;
1060 } __attribute__ ((gcc_struct));
1061
1062 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1063
1064 struct MembersInit
1065 {
1066 struct MembersInit * prev;
1067 struct MembersInit * next;
1068 struct Location loc;
1069 int type;
1070 union
1071 {
1072 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1073 struct ClassFunction * function;
1074 } __attribute__ ((gcc_struct));
1075 } __attribute__ ((gcc_struct));
1076
1077 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1078
1079 struct MemberInit
1080 {
1081 struct MemberInit * prev;
1082 struct MemberInit * next;
1083 struct Location loc;
1084 struct Location realLoc;
1085 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1086 struct Initializer * initializer;
1087 unsigned int used;
1088 unsigned int variable;
1089 unsigned int takeOutExp;
1090 } __attribute__ ((gcc_struct));
1091
1092 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1093
1094 struct PropertyDef
1095 {
1096 struct PropertyDef * prev;
1097 struct PropertyDef * next;
1098 struct Location loc;
1099 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1100 struct Declarator * declarator;
1101 struct Identifier * id;
1102 struct Statement * getStmt;
1103 struct Statement * setStmt;
1104 struct Statement * issetStmt;
1105 struct Symbol * symbol;
1106 unsigned int conversion;
1107 unsigned int isWatchable;
1108 struct Expression * category;
1109 } __attribute__ ((gcc_struct));
1110
1111 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1112
1113 struct PropertyWatch
1114 {
1115 struct PropertyWatch * prev;
1116 struct PropertyWatch * next;
1117 struct Location loc;
1118 struct Statement * compound;
1119 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1120 unsigned int deleteWatch;
1121 } __attribute__ ((gcc_struct));
1122
1123 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1124
1125 struct ClassDef
1126 {
1127 struct ClassDef * prev;
1128 struct ClassDef * next;
1129 struct Location loc;
1130 int type;
1131 union
1132 {
1133 struct Declaration * decl;
1134 struct ClassFunction * function;
1135 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1136 struct PropertyDef * propertyDef;
1137 struct PropertyWatch * propertyWatch;
1138 char *  designer;
1139 struct Identifier * defaultProperty;
1140 struct
1141 {
1142 struct Identifier * id;
1143 struct Initializer * initializer;
1144 } __attribute__ ((gcc_struct));
1145 } __attribute__ ((gcc_struct));
1146 int memberAccess;
1147 void *  object;
1148 } __attribute__ ((gcc_struct));
1149
1150 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1151
1152 struct DBTableEntry;
1153
1154 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1155
1156 struct DBIndexItem;
1157
1158 extern YYSTYPE yylval;
1159
1160 extern struct Location yylloc;
1161
1162 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1163
1164 extern int returnCode;
1165
1166 extern struct Expression * parsedExpression;
1167
1168 extern unsigned int yydebug;
1169
1170 void SetYydebug(unsigned int b)
1171 {
1172 yydebug = b;
1173 }
1174
1175 extern unsigned int echoOn;
1176
1177 void resetScanner();
1178
1179 int propWatcherID;
1180
1181 int expression_yyparse();
1182
1183 static struct Statement * curCompound;
1184
1185 struct External * curExternal, * afterExternal;
1186
1187 static struct Type * curSwitchType;
1188
1189 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1190
1191 struct __ecereNameSpace__ecere__com__Class * thisClass;
1192
1193 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1194 {
1195 thisClass = c;
1196 }
1197
1198 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1199 {
1200 return thisClass;
1201 }
1202
1203 static char * thisNameSpace;
1204
1205 struct __ecereNameSpace__ecere__com__Class * containerClass;
1206
1207 unsigned int thisClassParams = 0x1;
1208
1209 unsigned int internalValueCounter;
1210
1211 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1212
1213 extern size_t strlen(const char * );
1214
1215 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1216
1217 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1218
1219 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1220
1221 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1222
1223 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1224
1225 void PrintExpression(struct Expression * exp, char * string)
1226 {
1227 {
1228 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1229 int count;
1230
1231 if(exp)
1232 OutputExpression(exp, f);
1233 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1234 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1235
1236 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1237 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1238 count = strlen(string);
1239 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1240 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1241
1242 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1243 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1244 string[count] = '\0';
1245 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1246 }
1247 }
1248
1249 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1250
1251 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1252
1253 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1254 {
1255 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1256 {
1257 if(!param->baseType)
1258 {
1259 if(param->dataTypeString)
1260 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1261 else
1262 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1263 }
1264 return param->baseType;
1265 }
1266 return (((void *)0));
1267 }
1268
1269 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1270 {
1271 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1272 return 0x1;
1273 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1274 {
1275 return 0x0;
1276 }
1277 if(type1->kind == type2->kind)
1278 {
1279 switch(type1->kind)
1280 {
1281 case 1:
1282 case 2:
1283 case 3:
1284 case 4:
1285 case 22:
1286 case 23:
1287 if(type1->passAsTemplate && !type2->passAsTemplate)
1288 return 0x1;
1289 return type1->isSigned != type2->isSigned;
1290 case 8:
1291 return type1->_class != type2->_class;
1292 case 13:
1293 return NeedCast(type1->type, type2->type);
1294 default:
1295 return 0x1;
1296 }
1297 }
1298 return 0x1;
1299 }
1300
1301 extern int strcmp(const char * , const char * );
1302
1303 extern struct Context * curContext;
1304
1305 extern struct Context * topContext;
1306
1307 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1308
1309 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);
1310
1311 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1312
1313 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);
1314
1315 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);
1316
1317 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1318
1319 struct __ecereNameSpace__ecere__com__ClassProperty
1320 {
1321 char *  name;
1322 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1323 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1324 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1325 int depth;
1326 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1327 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1328 char *  dataTypeString;
1329 struct Type * dataType;
1330 unsigned int constant;
1331 } __attribute__ ((gcc_struct));
1332
1333 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1334
1335 extern struct Expression * QMkExpId(char *  id);
1336
1337 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1338
1339 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1340 {
1341 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1342 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1343 char *  name;
1344 int type;
1345 union
1346 {
1347 char *  dataTypeString;
1348 int memberType;
1349 } __attribute__ ((gcc_struct));
1350 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1351 void *  param;
1352 } __attribute__ ((gcc_struct));
1353
1354 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1355
1356 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1357
1358 extern void FreeIdentifier(struct Identifier * id);
1359
1360 void ProcessExpressionType(struct Expression * exp);
1361
1362 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1363
1364 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1365
1366 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1367
1368 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1369
1370 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1371
1372 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1373
1374 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1375
1376 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1377
1378 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1379 {
1380 if(exp->type == 0 && exp->identifier)
1381 {
1382 struct Identifier * id = exp->identifier;
1383 struct Context * ctx;
1384 struct Symbol * symbol = (((void *)0));
1385
1386 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1387 {
1388 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1389 {
1390 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1391 if(symbol)
1392 break;
1393 }
1394 }
1395 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1396 {
1397 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1398 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1399 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1400 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1401
1402 if(!prop)
1403 {
1404 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1405 }
1406 if(!prop && !method)
1407 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1408 if(!prop && !method && !member)
1409 {
1410 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1411 }
1412 if(prop || method || member || classProp)
1413 {
1414 exp->type = 8;
1415 exp->member.member = id;
1416 exp->member.memberType = 0;
1417 exp->member.exp = QMkExpId("this");
1418 exp->addedThis = 0x1;
1419 }
1420 else if(_class && _class->templateParams.first)
1421 {
1422 struct __ecereNameSpace__ecere__com__Class * sClass;
1423
1424 for(sClass = _class; sClass; sClass = sClass->base)
1425 {
1426 if(sClass->templateParams.first)
1427 {
1428 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1429
1430 for(param = sClass->templateParams.first; param; param = param->next)
1431 {
1432 if(param->type == 2 && !strcmp(param->name, id->string))
1433 {
1434 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1435
1436 if(argExp)
1437 {
1438 struct Declarator * decl;
1439 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1440
1441 FreeIdentifier(exp->member.member);
1442 ProcessExpressionType(argExp);
1443 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1444 exp->expType = ProcessType(specs, decl);
1445 exp->type = 5;
1446 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1447 }
1448 }
1449 }
1450 }
1451 }
1452 }
1453 }
1454 }
1455 }
1456
1457 extern int sprintf(char * , char * , ...);
1458
1459 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1460
1461 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1462
1463 char * PrintInt(long long result)
1464 {
1465 char temp[100];
1466
1467 if(result > (((long long)0x7fffffffffffffffLL)))
1468 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1469 else
1470 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1471 return __ecereNameSpace__ecere__sys__CopyString(temp);
1472 }
1473
1474 char * PrintUInt(uint64 result)
1475 {
1476 char temp[100];
1477
1478 if(result > (0xffffffff))
1479 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1480 else if(result > (((int)0x7fffffff)))
1481 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1482 else
1483 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1484 return __ecereNameSpace__ecere__sys__CopyString(temp);
1485 }
1486
1487 char * PrintInt64(long long result)
1488 {
1489 char temp[100];
1490
1491 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1492 return __ecereNameSpace__ecere__sys__CopyString(temp);
1493 }
1494
1495 char * PrintUInt64(uint64 result)
1496 {
1497 char temp[100];
1498
1499 if(result > (((long long)0x7fffffffffffffffLL)))
1500 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1501 else
1502 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1503 return __ecereNameSpace__ecere__sys__CopyString(temp);
1504 }
1505
1506 char * PrintHexUInt(uint64 result)
1507 {
1508 char temp[100];
1509
1510 if(result > (0xffffffff))
1511 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1512 else
1513 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1514 return __ecereNameSpace__ecere__sys__CopyString(temp);
1515 }
1516
1517 char * PrintHexUInt64(uint64 result)
1518 {
1519 char temp[100];
1520
1521 if(result > (0xffffffff))
1522 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1523 else
1524 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1525 return __ecereNameSpace__ecere__sys__CopyString(temp);
1526 }
1527
1528 char * PrintShort(short result)
1529 {
1530 char temp[100];
1531
1532 sprintf(temp, "%d", (unsigned short)result);
1533 return __ecereNameSpace__ecere__sys__CopyString(temp);
1534 }
1535
1536 char * PrintUShort(unsigned short result)
1537 {
1538 char temp[100];
1539
1540 if(result > (unsigned short)32767)
1541 sprintf(temp, "0x%X", (int)result);
1542 else
1543 sprintf(temp, "%d", (int)result);
1544 return __ecereNameSpace__ecere__sys__CopyString(temp);
1545 }
1546
1547 extern int isprint(int c);
1548
1549 char * PrintChar(char result)
1550 {
1551 char temp[100];
1552
1553 if(result > (char)0 && isprint(result))
1554 sprintf(temp, "'%c'", result);
1555 else if(result < (char)0)
1556 sprintf(temp, "%d", (int)result);
1557 else
1558 sprintf(temp, "0x%X", (unsigned char)result);
1559 return __ecereNameSpace__ecere__sys__CopyString(temp);
1560 }
1561
1562 char * PrintUChar(unsigned char result)
1563 {
1564 char temp[100];
1565
1566 sprintf(temp, "0x%X", result);
1567 return __ecereNameSpace__ecere__sys__CopyString(temp);
1568 }
1569
1570 char * PrintFloat(float result)
1571 {
1572 char temp[350];
1573
1574 sprintf(temp, "%.16ff", result);
1575 return __ecereNameSpace__ecere__sys__CopyString(temp);
1576 }
1577
1578 char * PrintDouble(double result)
1579 {
1580 char temp[350];
1581
1582 sprintf(temp, "%.16f", result);
1583 return __ecereNameSpace__ecere__sys__CopyString(temp);
1584 }
1585
1586 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1587
1588 struct OpTable
1589 {
1590 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1591 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1592 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1593 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1594 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1595 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1596 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1597 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1598 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1599 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1600 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1601 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1602 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1603 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1604 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1605 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1606 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1607 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1608 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1609 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1610 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1611 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1612 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1613 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1614 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1615 unsigned int (*  Not)(struct Expression *, struct Operand *);
1616 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1617 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1618 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1619 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1620 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1621 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1622 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1623 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1624 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1625 } __attribute__ ((gcc_struct));
1626
1627 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1628
1629 struct Operand
1630 {
1631 int kind;
1632 struct Type * type;
1633 unsigned int ptrSize;
1634 union
1635 {
1636 char c;
1637 unsigned char uc;
1638 short s;
1639 unsigned short us;
1640 int i;
1641 unsigned int ui;
1642 float f;
1643 double d;
1644 long long i64;
1645 uint64 ui64;
1646 } __attribute__ ((gcc_struct));
1647 struct OpTable ops;
1648 } __attribute__ ((gcc_struct));
1649
1650 struct Operand GetOperand(struct Expression * exp);
1651
1652 unsigned int GetInt(struct Expression * exp, int * value2)
1653 {
1654 struct Operand op2 = GetOperand(exp);
1655
1656 if(op2.kind == 3 && op2.type->isSigned)
1657 *value2 = op2.i;
1658 else if(op2.kind == 3)
1659 *value2 = (int)op2.ui;
1660 else if(op2.kind == 4 && op2.type->isSigned)
1661 *value2 = (int)op2.i64;
1662 else if(op2.kind == 4)
1663 *value2 = (int)op2.ui64;
1664 else if(op2.kind == 23 && op2.type->isSigned)
1665 *value2 = (int)op2.i64;
1666 else if(op2.kind == 23)
1667 *value2 = (int)op2.ui64;
1668 else if(op2.kind == 22 && op2.type->isSigned)
1669 *value2 = (int)op2.i64;
1670 else if(op2.kind == 22)
1671 *value2 = (int)op2.ui64;
1672 else if(op2.kind == 2 && op2.type->isSigned)
1673 *value2 = (int)op2.s;
1674 else if(op2.kind == 2)
1675 *value2 = (int)op2.us;
1676 else if(op2.kind == 1 && op2.type->isSigned)
1677 *value2 = (int)op2.c;
1678 else if(op2.kind == 1)
1679 *value2 = (int)op2.uc;
1680 else if(op2.kind == 6)
1681 *value2 = (int)op2.f;
1682 else if(op2.kind == 7)
1683 *value2 = (int)op2.d;
1684 else if(op2.kind == 13)
1685 *value2 = (int)op2.ui64;
1686 else
1687 return 0x0;
1688 return 0x1;
1689 }
1690
1691 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1692 {
1693 struct Operand op2 = GetOperand(exp);
1694
1695 if(op2.kind == 3 && op2.type->isSigned)
1696 *value2 = (unsigned int)op2.i;
1697 else if(op2.kind == 3)
1698 *value2 = op2.ui;
1699 else if(op2.kind == 4 && op2.type->isSigned)
1700 *value2 = (unsigned int)op2.i64;
1701 else if(op2.kind == 4)
1702 *value2 = (unsigned int)op2.ui64;
1703 else if(op2.kind == 23 && op2.type->isSigned)
1704 *value2 = (unsigned int)op2.i64;
1705 else if(op2.kind == 23)
1706 *value2 = (unsigned int)op2.ui64;
1707 else if(op2.kind == 22 && op2.type->isSigned)
1708 *value2 = (unsigned int)op2.i64;
1709 else if(op2.kind == 22)
1710 *value2 = (unsigned int)op2.ui64;
1711 else if(op2.kind == 2 && op2.type->isSigned)
1712 *value2 = (unsigned int)op2.s;
1713 else if(op2.kind == 2)
1714 *value2 = (unsigned int)op2.us;
1715 else if(op2.kind == 1 && op2.type->isSigned)
1716 *value2 = (unsigned int)op2.c;
1717 else if(op2.kind == 1)
1718 *value2 = (unsigned int)op2.uc;
1719 else if(op2.kind == 6)
1720 *value2 = (unsigned int)op2.f;
1721 else if(op2.kind == 7)
1722 *value2 = (unsigned int)op2.d;
1723 else if(op2.kind == 13)
1724 *value2 = (unsigned int)op2.ui64;
1725 else
1726 return 0x0;
1727 return 0x1;
1728 }
1729
1730 unsigned int GetInt64(struct Expression * exp, long long * value2)
1731 {
1732 struct Operand op2 = GetOperand(exp);
1733
1734 if(op2.kind == 3 && op2.type->isSigned)
1735 *value2 = (long long)op2.i;
1736 else if(op2.kind == 3)
1737 *value2 = (long long)op2.ui;
1738 else if(op2.kind == 4 && op2.type->isSigned)
1739 *value2 = op2.i64;
1740 else if(op2.kind == 4)
1741 *value2 = (long long)op2.ui64;
1742 else if(op2.kind == 23 && op2.type->isSigned)
1743 *value2 = op2.i64;
1744 else if(op2.kind == 23)
1745 *value2 = (long long)op2.ui64;
1746 else if(op2.kind == 22 && op2.type->isSigned)
1747 *value2 = op2.i64;
1748 else if(op2.kind == 22)
1749 *value2 = (long long)op2.ui64;
1750 else if(op2.kind == 2 && op2.type->isSigned)
1751 *value2 = (long long)op2.s;
1752 else if(op2.kind == 2)
1753 *value2 = (long long)op2.us;
1754 else if(op2.kind == 1 && op2.type->isSigned)
1755 *value2 = (long long)op2.c;
1756 else if(op2.kind == 1)
1757 *value2 = (long long)op2.uc;
1758 else if(op2.kind == 6)
1759 *value2 = (long long)op2.f;
1760 else if(op2.kind == 7)
1761 *value2 = (long long)op2.d;
1762 else if(op2.kind == 13)
1763 *value2 = (long long)op2.ui64;
1764 else
1765 return 0x0;
1766 return 0x1;
1767 }
1768
1769 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1770 {
1771 struct Operand op2 = GetOperand(exp);
1772
1773 if(op2.kind == 3 && op2.type->isSigned)
1774 *value2 = (uint64)op2.i;
1775 else if(op2.kind == 3)
1776 *value2 = (uint64)op2.ui;
1777 else if(op2.kind == 4 && op2.type->isSigned)
1778 *value2 = (uint64)op2.i64;
1779 else if(op2.kind == 4)
1780 *value2 = op2.ui64;
1781 else if(op2.kind == 23 && op2.type->isSigned)
1782 *value2 = (uint64)op2.i64;
1783 else if(op2.kind == 23)
1784 *value2 = op2.ui64;
1785 else if(op2.kind == 22 && op2.type->isSigned)
1786 *value2 = (uint64)op2.i64;
1787 else if(op2.kind == 22)
1788 *value2 = op2.ui64;
1789 else if(op2.kind == 2 && op2.type->isSigned)
1790 *value2 = (uint64)op2.s;
1791 else if(op2.kind == 2)
1792 *value2 = (uint64)op2.us;
1793 else if(op2.kind == 1 && op2.type->isSigned)
1794 *value2 = (uint64)op2.c;
1795 else if(op2.kind == 1)
1796 *value2 = (uint64)op2.uc;
1797 else if(op2.kind == 6)
1798 *value2 = (uint64)op2.f;
1799 else if(op2.kind == 7)
1800 *value2 = (uint64)op2.d;
1801 else if(op2.kind == 13)
1802 *value2 = op2.ui64;
1803 else
1804 return 0x0;
1805 return 0x1;
1806 }
1807
1808 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1809 {
1810 struct Operand op2 = GetOperand(exp);
1811
1812 if(op2.kind == 3 && op2.type->isSigned)
1813 *value2 = (intptr_t)op2.i;
1814 else if(op2.kind == 3)
1815 *value2 = (intptr_t)op2.ui;
1816 else if(op2.kind == 4 && op2.type->isSigned)
1817 *value2 = (intptr_t)op2.i64;
1818 else if(op2.kind == 4)
1819 *value2 = (intptr_t)op2.ui64;
1820 else if(op2.kind == 23 && op2.type->isSigned)
1821 *value2 = (intptr_t)op2.i64;
1822 else if(op2.kind == 23)
1823 *value2 = (intptr_t)op2.ui64;
1824 else if(op2.kind == 22 && op2.type->isSigned)
1825 *value2 = (intptr_t)op2.i64;
1826 else if(op2.kind == 22)
1827 *value2 = (intptr_t)op2.ui64;
1828 else if(op2.kind == 2 && op2.type->isSigned)
1829 *value2 = (intptr_t)op2.s;
1830 else if(op2.kind == 2)
1831 *value2 = (intptr_t)op2.us;
1832 else if(op2.kind == 1 && op2.type->isSigned)
1833 *value2 = (intptr_t)op2.c;
1834 else if(op2.kind == 1)
1835 *value2 = (intptr_t)op2.uc;
1836 else if(op2.kind == 6)
1837 *value2 = (intptr_t)op2.f;
1838 else if(op2.kind == 7)
1839 *value2 = (intptr_t)op2.d;
1840 else if(op2.kind == 13)
1841 *value2 = (intptr_t)op2.ui64;
1842 else
1843 return 0x0;
1844 return 0x1;
1845 }
1846
1847 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1848 {
1849 struct Operand op2 = GetOperand(exp);
1850
1851 if(op2.kind == 3 && op2.type->isSigned)
1852 *value2 = (uintptr_t)op2.i;
1853 else if(op2.kind == 3)
1854 *value2 = (uintptr_t)op2.ui;
1855 else if(op2.kind == 4 && op2.type->isSigned)
1856 *value2 = (uintptr_t)op2.i64;
1857 else if(op2.kind == 4)
1858 *value2 = (uintptr_t)op2.ui64;
1859 else if(op2.kind == 23 && op2.type->isSigned)
1860 *value2 = (uintptr_t)op2.i64;
1861 else if(op2.kind == 23)
1862 *value2 = (uintptr_t)op2.ui64;
1863 else if(op2.kind == 22 && op2.type->isSigned)
1864 *value2 = (uintptr_t)op2.i64;
1865 else if(op2.kind == 22)
1866 *value2 = (uintptr_t)op2.ui64;
1867 else if(op2.kind == 2 && op2.type->isSigned)
1868 *value2 = (uintptr_t)op2.s;
1869 else if(op2.kind == 2)
1870 *value2 = (uintptr_t)op2.us;
1871 else if(op2.kind == 1 && op2.type->isSigned)
1872 *value2 = (uintptr_t)op2.c;
1873 else if(op2.kind == 1)
1874 *value2 = (uintptr_t)op2.uc;
1875 else if(op2.kind == 6)
1876 *value2 = (uintptr_t)op2.f;
1877 else if(op2.kind == 7)
1878 *value2 = (uintptr_t)op2.d;
1879 else if(op2.kind == 13)
1880 *value2 = (uintptr_t)op2.ui64;
1881 else
1882 return 0x0;
1883 return 0x1;
1884 }
1885
1886 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
1887 {
1888 struct Operand op2 = GetOperand(exp);
1889
1890 if(op2.kind == 3 && op2.type->isSigned)
1891 *value2 = (ssize_t)op2.i;
1892 else if(op2.kind == 3)
1893 *value2 = (ssize_t)op2.ui;
1894 else if(op2.kind == 4 && op2.type->isSigned)
1895 *value2 = (ssize_t)op2.i64;
1896 else if(op2.kind == 4)
1897 *value2 = (ssize_t)op2.ui64;
1898 else if(op2.kind == 23 && op2.type->isSigned)
1899 *value2 = (ssize_t)op2.i64;
1900 else if(op2.kind == 23)
1901 *value2 = (ssize_t)op2.ui64;
1902 else if(op2.kind == 22 && op2.type->isSigned)
1903 *value2 = (ssize_t)op2.i64;
1904 else if(op2.kind == 22)
1905 *value2 = (ssize_t)op2.ui64;
1906 else if(op2.kind == 2 && op2.type->isSigned)
1907 *value2 = (ssize_t)op2.s;
1908 else if(op2.kind == 2)
1909 *value2 = (ssize_t)op2.us;
1910 else if(op2.kind == 1 && op2.type->isSigned)
1911 *value2 = (ssize_t)op2.c;
1912 else if(op2.kind == 1)
1913 *value2 = (ssize_t)op2.uc;
1914 else if(op2.kind == 6)
1915 *value2 = (ssize_t)op2.f;
1916 else if(op2.kind == 7)
1917 *value2 = (ssize_t)op2.d;
1918 else if(op2.kind == 13)
1919 *value2 = (ssize_t)op2.ui64;
1920 else
1921 return 0x0;
1922 return 0x1;
1923 }
1924
1925 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
1926 {
1927 struct Operand op2 = GetOperand(exp);
1928
1929 if(op2.kind == 3 && op2.type->isSigned)
1930 *value2 = (size_t)op2.i;
1931 else if(op2.kind == 3)
1932 *value2 = (size_t)op2.ui;
1933 else if(op2.kind == 4 && op2.type->isSigned)
1934 *value2 = (size_t)op2.i64;
1935 else if(op2.kind == 4)
1936 *value2 = (size_t)op2.ui64;
1937 else if(op2.kind == 23 && op2.type->isSigned)
1938 *value2 = (size_t)op2.i64;
1939 else if(op2.kind == 23)
1940 *value2 = (size_t)op2.ui64;
1941 else if(op2.kind == 22 && op2.type->isSigned)
1942 *value2 = (size_t)op2.i64;
1943 else if(op2.kind == 22)
1944 *value2 = (size_t)op2.ui64;
1945 else if(op2.kind == 2 && op2.type->isSigned)
1946 *value2 = (size_t)op2.s;
1947 else if(op2.kind == 2)
1948 *value2 = (size_t)op2.us;
1949 else if(op2.kind == 1 && op2.type->isSigned)
1950 *value2 = (size_t)op2.c;
1951 else if(op2.kind == 1)
1952 *value2 = (size_t)op2.uc;
1953 else if(op2.kind == 6)
1954 *value2 = (size_t)op2.f;
1955 else if(op2.kind == 7)
1956 *value2 = (size_t)op2.d;
1957 else if(op2.kind == 13)
1958 *value2 = (size_t)op2.ui64;
1959 else
1960 return 0x0;
1961 return 0x1;
1962 }
1963
1964 unsigned int GetShort(struct Expression * exp, short * value2)
1965 {
1966 struct Operand op2 = GetOperand(exp);
1967
1968 if(op2.kind == 3 && op2.type->isSigned)
1969 *value2 = (short)op2.i;
1970 else if(op2.kind == 3)
1971 *value2 = (short)op2.ui;
1972 else if(op2.kind == 4 && op2.type->isSigned)
1973 *value2 = (short)op2.i64;
1974 else if(op2.kind == 4)
1975 *value2 = (short)op2.ui64;
1976 else if(op2.kind == 23 && op2.type->isSigned)
1977 *value2 = (short)op2.i64;
1978 else if(op2.kind == 23)
1979 *value2 = (short)op2.ui64;
1980 else if(op2.kind == 22 && op2.type->isSigned)
1981 *value2 = (short)op2.i64;
1982 else if(op2.kind == 22)
1983 *value2 = (short)op2.ui64;
1984 else if(op2.kind == 2 && op2.type->isSigned)
1985 *value2 = op2.s;
1986 else if(op2.kind == 2)
1987 *value2 = (short)op2.us;
1988 else if(op2.kind == 1 && op2.type->isSigned)
1989 *value2 = (short)op2.c;
1990 else if(op2.kind == 1)
1991 *value2 = (short)op2.uc;
1992 else if(op2.kind == 6)
1993 *value2 = (short)op2.f;
1994 else if(op2.kind == 7)
1995 *value2 = (short)op2.d;
1996 else if(op2.kind == 13)
1997 *value2 = (short)op2.ui64;
1998 else
1999 return 0x0;
2000 return 0x1;
2001 }
2002
2003 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2004 {
2005 struct Operand op2 = GetOperand(exp);
2006
2007 if(op2.kind == 3 && op2.type->isSigned)
2008 *value2 = (unsigned short)op2.i;
2009 else if(op2.kind == 3)
2010 *value2 = (unsigned short)op2.ui;
2011 else if(op2.kind == 4 && op2.type->isSigned)
2012 *value2 = (unsigned short)op2.i64;
2013 else if(op2.kind == 4)
2014 *value2 = (unsigned short)op2.ui64;
2015 else if(op2.kind == 23 && op2.type->isSigned)
2016 *value2 = (unsigned short)op2.i64;
2017 else if(op2.kind == 23)
2018 *value2 = (unsigned short)op2.ui64;
2019 else if(op2.kind == 22 && op2.type->isSigned)
2020 *value2 = (unsigned short)op2.i64;
2021 else if(op2.kind == 22)
2022 *value2 = (unsigned short)op2.ui64;
2023 else if(op2.kind == 2 && op2.type->isSigned)
2024 *value2 = (unsigned short)op2.s;
2025 else if(op2.kind == 2)
2026 *value2 = op2.us;
2027 else if(op2.kind == 1 && op2.type->isSigned)
2028 *value2 = (unsigned short)op2.c;
2029 else if(op2.kind == 1)
2030 *value2 = (unsigned short)op2.uc;
2031 else if(op2.kind == 6)
2032 *value2 = (unsigned short)op2.f;
2033 else if(op2.kind == 7)
2034 *value2 = (unsigned short)op2.d;
2035 else if(op2.kind == 13)
2036 *value2 = (unsigned short)op2.ui64;
2037 else
2038 return 0x0;
2039 return 0x1;
2040 }
2041
2042 unsigned int GetChar(struct Expression * exp, char * value2)
2043 {
2044 struct Operand op2 = GetOperand(exp);
2045
2046 if(op2.kind == 3 && op2.type->isSigned)
2047 *value2 = (char)op2.i;
2048 else if(op2.kind == 3)
2049 *value2 = (char)op2.ui;
2050 else if(op2.kind == 4 && op2.type->isSigned)
2051 *value2 = (char)op2.i64;
2052 else if(op2.kind == 4)
2053 *value2 = (char)op2.ui64;
2054 else if(op2.kind == 23 && op2.type->isSigned)
2055 *value2 = (char)op2.i64;
2056 else if(op2.kind == 23)
2057 *value2 = (char)op2.ui64;
2058 else if(op2.kind == 22 && op2.type->isSigned)
2059 *value2 = (char)op2.i64;
2060 else if(op2.kind == 22)
2061 *value2 = (char)op2.ui64;
2062 else if(op2.kind == 2 && op2.type->isSigned)
2063 *value2 = (char)op2.s;
2064 else if(op2.kind == 2)
2065 *value2 = (char)op2.us;
2066 else if(op2.kind == 1 && op2.type->isSigned)
2067 *value2 = op2.c;
2068 else if(op2.kind == 1)
2069 *value2 = (char)op2.uc;
2070 else if(op2.kind == 6)
2071 *value2 = (char)op2.f;
2072 else if(op2.kind == 7)
2073 *value2 = (char)op2.d;
2074 else if(op2.kind == 13)
2075 *value2 = (char)op2.ui64;
2076 else
2077 return 0x0;
2078 return 0x1;
2079 }
2080
2081 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2082 {
2083 struct Operand op2 = GetOperand(exp);
2084
2085 if(op2.kind == 3 && op2.type->isSigned)
2086 *value2 = (unsigned char)op2.i;
2087 else if(op2.kind == 3)
2088 *value2 = (unsigned char)op2.ui;
2089 else if(op2.kind == 4 && op2.type->isSigned)
2090 *value2 = (unsigned char)op2.i64;
2091 else if(op2.kind == 4)
2092 *value2 = (unsigned char)op2.ui64;
2093 else if(op2.kind == 23 && op2.type->isSigned)
2094 *value2 = (unsigned char)op2.i64;
2095 else if(op2.kind == 23)
2096 *value2 = (unsigned char)op2.ui64;
2097 else if(op2.kind == 22 && op2.type->isSigned)
2098 *value2 = (unsigned char)op2.i64;
2099 else if(op2.kind == 22)
2100 *value2 = (unsigned char)op2.ui64;
2101 else if(op2.kind == 2 && op2.type->isSigned)
2102 *value2 = (unsigned char)op2.s;
2103 else if(op2.kind == 2)
2104 *value2 = (unsigned char)op2.us;
2105 else if(op2.kind == 1 && op2.type->isSigned)
2106 *value2 = (unsigned char)op2.c;
2107 else if(op2.kind == 1)
2108 *value2 = op2.uc;
2109 else if(op2.kind == 6)
2110 *value2 = (unsigned char)op2.f;
2111 else if(op2.kind == 7)
2112 *value2 = (unsigned char)op2.d;
2113 else if(op2.kind == 13)
2114 *value2 = (unsigned char)op2.ui64;
2115 else
2116 return 0x0;
2117 return 0x1;
2118 }
2119
2120 unsigned int GetFloat(struct Expression * exp, float * value2)
2121 {
2122 struct Operand op2 = GetOperand(exp);
2123
2124 if(op2.kind == 3 && op2.type->isSigned)
2125 *value2 = (float)(float)op2.i;
2126 else if(op2.kind == 3)
2127 *value2 = (float)(float)op2.ui;
2128 else if(op2.kind == 4 && op2.type->isSigned)
2129 *value2 = (float)(float)op2.i64;
2130 else if(op2.kind == 4)
2131 *value2 = (float)(float)op2.ui64;
2132 else if(op2.kind == 23 && op2.type->isSigned)
2133 *value2 = (float)(float)op2.i64;
2134 else if(op2.kind == 23)
2135 *value2 = (float)(float)op2.ui64;
2136 else if(op2.kind == 22 && op2.type->isSigned)
2137 *value2 = (float)(float)op2.i64;
2138 else if(op2.kind == 22)
2139 *value2 = (float)(float)op2.ui64;
2140 else if(op2.kind == 2 && op2.type->isSigned)
2141 *value2 = (float)(float)op2.s;
2142 else if(op2.kind == 2)
2143 *value2 = (float)(float)op2.us;
2144 else if(op2.kind == 1 && op2.type->isSigned)
2145 *value2 = (float)(float)op2.c;
2146 else if(op2.kind == 1)
2147 *value2 = (float)(float)op2.uc;
2148 else if(op2.kind == 6)
2149 *value2 = (float)op2.f;
2150 else if(op2.kind == 7)
2151 *value2 = (float)op2.d;
2152 else if(op2.kind == 13)
2153 *value2 = (float)(float)op2.ui64;
2154 else
2155 return 0x0;
2156 return 0x1;
2157 }
2158
2159 unsigned int GetDouble(struct Expression * exp, double * value2)
2160 {
2161 struct Operand op2 = GetOperand(exp);
2162
2163 if(op2.kind == 3 && op2.type->isSigned)
2164 *value2 = (double)(double)op2.i;
2165 else if(op2.kind == 3)
2166 *value2 = (double)(double)op2.ui;
2167 else if(op2.kind == 4 && op2.type->isSigned)
2168 *value2 = (double)(double)op2.i64;
2169 else if(op2.kind == 4)
2170 *value2 = (double)(double)op2.ui64;
2171 else if(op2.kind == 23 && op2.type->isSigned)
2172 *value2 = (double)(double)op2.i64;
2173 else if(op2.kind == 23)
2174 *value2 = (double)(double)op2.ui64;
2175 else if(op2.kind == 22 && op2.type->isSigned)
2176 *value2 = (double)(double)op2.i64;
2177 else if(op2.kind == 22)
2178 *value2 = (double)(double)op2.ui64;
2179 else if(op2.kind == 2 && op2.type->isSigned)
2180 *value2 = (double)(double)op2.s;
2181 else if(op2.kind == 2)
2182 *value2 = (double)(double)op2.us;
2183 else if(op2.kind == 1 && op2.type->isSigned)
2184 *value2 = (double)(double)op2.c;
2185 else if(op2.kind == 1)
2186 *value2 = (double)(double)op2.uc;
2187 else if(op2.kind == 6)
2188 *value2 = (double)op2.f;
2189 else if(op2.kind == 7)
2190 *value2 = (double)op2.d;
2191 else if(op2.kind == 13)
2192 *value2 = (double)(double)op2.ui64;
2193 else
2194 return 0x0;
2195 return 0x1;
2196 }
2197
2198 void ComputeExpression(struct Expression * exp);
2199
2200 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2201
2202 extern int targetBits;
2203
2204 int ComputeTypeSize(struct Type * type);
2205
2206 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2207
2208 struct __ecereNameSpace__ecere__com__BitMember
2209 {
2210 struct __ecereNameSpace__ecere__com__BitMember * prev;
2211 struct __ecereNameSpace__ecere__com__BitMember * next;
2212 char *  name;
2213 unsigned int isProperty;
2214 int memberAccess;
2215 int id;
2216 struct __ecereNameSpace__ecere__com__Class * _class;
2217 char *  dataTypeString;
2218 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2219 struct Type * dataType;
2220 int type;
2221 int size;
2222 int pos;
2223 uint64 mask;
2224 } __attribute__ ((gcc_struct));
2225
2226 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2227
2228 struct __ecereNameSpace__ecere__sys__OldLink
2229 {
2230 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2231 struct __ecereNameSpace__ecere__sys__OldLink * next;
2232 void *  data;
2233 } __attribute__ ((gcc_struct));
2234
2235 void FinishTemplatesContext(struct Context * context);
2236
2237 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2238 {
2239 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2240 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2241
2242 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || (!_class->structSize || _class->structSize == _class->offset)) && _class->computeSize))
2243 {
2244 int c;
2245 int unionMemberOffset = 0;
2246 int bitFields = 0;
2247
2248 if(member)
2249 {
2250 member->memberOffset = 0;
2251 if(targetBits < sizeof(void *) * 8)
2252 member->structAlignment = 0;
2253 }
2254 else if(targetBits < sizeof(void *) * 8)
2255 _class->structAlignment = 0;
2256 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2257 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2258 if(!member && _class->destructionWatchOffset)
2259 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2260 {
2261 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2262
2263 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2264 {
2265 if(!dataMember->isProperty)
2266 {
2267 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2268 {
2269 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2270 }
2271 }
2272 }
2273 }
2274 {
2275 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2276
2277 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2278 {
2279 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2280 {
2281 if(!isMember && _class->type == 2 && dataMember->dataType)
2282 {
2283 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2284 uint64 mask = 0;
2285 int d;
2286
2287 ComputeTypeSize(dataMember->dataType);
2288 if(bitMember->pos == -1)
2289 bitMember->pos = _class->memberOffset;
2290 if(!bitMember->size)
2291 bitMember->size = dataMember->dataType->size * 8;
2292 _class->memberOffset = bitMember->pos + bitMember->size;
2293 for(d = 0; d < bitMember->size; d++)
2294 {
2295 if(d)
2296 mask <<= 1;
2297 mask |= 1;
2298 }
2299 bitMember->mask = mask << bitMember->pos;
2300 }
2301 else if(dataMember->type == 0 && dataMember->dataType)
2302 {
2303 int size;
2304 int alignment = 0;
2305
2306 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2307 ComputeTypeSize(dataMember->dataType);
2308 if(dataMember->dataType->bitFieldCount)
2309 {
2310 bitFields += dataMember->dataType->bitFieldCount;
2311 size = 0;
2312 }
2313 else
2314 {
2315 if(bitFields)
2316 {
2317 int size = (bitFields + 7) / 8;
2318
2319 if(isMember)
2320 {
2321 int __simpleStruct0;
2322
2323 if(alignment)
2324 {
2325 int __simpleStruct0;
2326
2327 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2328 if(member->memberOffset % alignment)
2329 member->memberOffset += alignment - (member->memberOffset % alignment);
2330 }
2331 dataMember->offset = member->memberOffset;
2332 if(member->type == 1)
2333 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2334 else
2335 {
2336 member->memberOffset += size;
2337 }
2338 }
2339 else
2340 {
2341 if(alignment)
2342 {
2343 int __simpleStruct0;
2344
2345 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2346 if(_class->memberOffset % alignment)
2347 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2348 }
2349 dataMember->offset = _class->memberOffset;
2350 _class->memberOffset += size;
2351 }
2352 bitFields = 0;
2353 }
2354 size = dataMember->dataType->size;
2355 alignment = dataMember->dataType->alignment;
2356 }
2357 if(isMember)
2358 {
2359 int __simpleStruct0;
2360
2361 if(alignment)
2362 {
2363 int __simpleStruct0;
2364
2365 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2366 if(member->memberOffset % alignment)
2367 member->memberOffset += alignment - (member->memberOffset % alignment);
2368 }
2369 dataMember->offset = member->memberOffset;
2370 if(member->type == 1)
2371 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2372 else
2373 {
2374 member->memberOffset += size;
2375 }
2376 }
2377 else
2378 {
2379 if(alignment)
2380 {
2381 int __simpleStruct0;
2382
2383 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2384 if(_class->memberOffset % alignment)
2385 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2386 }
2387 dataMember->offset = _class->memberOffset;
2388 _class->memberOffset += size;
2389 }
2390 }
2391 else
2392 {
2393 int alignment;
2394
2395 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2396 alignment = dataMember->structAlignment;
2397 if(isMember)
2398 {
2399 int __simpleStruct0;
2400
2401 if(alignment)
2402 {
2403 int __simpleStruct0;
2404
2405 if(member->memberOffset % alignment)
2406 member->memberOffset += alignment - (member->memberOffset % alignment);
2407 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2408 }
2409 dataMember->offset = member->memberOffset;
2410 if(member->type == 1)
2411 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2412 else
2413 member->memberOffset += dataMember->memberOffset;
2414 }
2415 else
2416 {
2417 if(alignment)
2418 {
2419 int __simpleStruct0;
2420
2421 if(_class->memberOffset % alignment)
2422 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2423 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2424 }
2425 dataMember->offset = _class->memberOffset;
2426 _class->memberOffset += dataMember->memberOffset;
2427 }
2428 }
2429 }
2430 }
2431 if(bitFields)
2432 {
2433 int alignment = 0;
2434 int size = (bitFields + 7) / 8;
2435
2436 if(isMember)
2437 {
2438 int __simpleStruct0;
2439
2440 if(alignment)
2441 {
2442 int __simpleStruct0;
2443
2444 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2445 if(member->memberOffset % alignment)
2446 member->memberOffset += alignment - (member->memberOffset % alignment);
2447 }
2448 if(member->type == 1)
2449 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2450 else
2451 {
2452 member->memberOffset += size;
2453 }
2454 }
2455 else
2456 {
2457 if(alignment)
2458 {
2459 int __simpleStruct0;
2460
2461 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2462 if(_class->memberOffset % alignment)
2463 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2464 }
2465 _class->memberOffset += size;
2466 }
2467 bitFields = 0;
2468 }
2469 }
2470 if(member && member->type == 1)
2471 {
2472 member->memberOffset = unionMemberOffset;
2473 }
2474 if(!isMember)
2475 {
2476 if(_class->type != 2)
2477 {
2478 int extra = 0;
2479
2480 if(_class->structAlignment)
2481 {
2482 if(_class->memberOffset % _class->structAlignment)
2483 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2484 }
2485 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2486 if(!member)
2487 {
2488 struct __ecereNameSpace__ecere__com__Property * prop;
2489
2490 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2491 {
2492 if(prop->isProperty && prop->isWatchable)
2493 {
2494 prop->watcherOffset = _class->structSize;
2495 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2496 }
2497 }
2498 }
2499 {
2500 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2501
2502 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2503 {
2504 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2505
2506 if(deriv->computeSize)
2507 {
2508 deriv->offset = _class->structSize;
2509 deriv->memberOffset = 0;
2510 deriv->structSize = deriv->offset;
2511 ComputeClassMembers(deriv, 0x0);
2512 }
2513 }
2514 }
2515 }
2516 }
2517 }
2518 if(context)
2519 FinishTemplatesContext(context);
2520 }
2521
2522 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2523
2524 struct __ecereNameSpace__ecere__com__NameSpace
2525 {
2526 char *  name;
2527 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2528 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2529 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2530 int depth;
2531 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2532 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2533 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2534 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2535 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2536 } __attribute__ ((gcc_struct));
2537
2538 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2539
2540 struct __ecereNameSpace__ecere__com__Module
2541 {
2542 struct __ecereNameSpace__ecere__com__Instance * application;
2543 struct __ecereNameSpace__ecere__sys__OldList classes;
2544 struct __ecereNameSpace__ecere__sys__OldList defines;
2545 struct __ecereNameSpace__ecere__sys__OldList functions;
2546 struct __ecereNameSpace__ecere__sys__OldList modules;
2547 struct __ecereNameSpace__ecere__com__Instance * prev;
2548 struct __ecereNameSpace__ecere__com__Instance * next;
2549 char *  name;
2550 void *  library;
2551 void *  Unload;
2552 int importType;
2553 int origImportType;
2554 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2555 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2556 } __attribute__ ((gcc_struct));
2557
2558 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2559 {
2560 struct __ecereNameSpace__ecere__com__Class * _class;
2561 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2562
2563 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2564 ComputeModuleClasses(subModule->data);
2565 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2566 ComputeClassMembers(_class, 0x0);
2567 }
2568
2569 extern unsigned int inCompiler;
2570
2571 extern void Compiler_Error(char *  format, ...);
2572
2573 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2574
2575 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2576
2577 int ComputeTypeSize(struct Type * type)
2578 {
2579 unsigned int size = type ? type->size : 0;
2580
2581 if(!size && type && !type->computing)
2582 {
2583 type->computing = 0x1;
2584 switch(type->kind)
2585 {
2586 case 1:
2587 type->alignment = size = sizeof(char);
2588 break;
2589 case 3:
2590 type->alignment = size = sizeof(int);
2591 break;
2592 case 4:
2593 type->alignment = size = sizeof(long long);
2594 break;
2595 case 22:
2596 type->alignment = size = targetBits / 8;
2597 break;
2598 case 23:
2599 type->alignment = size = targetBits / 8;
2600 break;
2601 case 5:
2602 type->alignment = size = sizeof(long);
2603 break;
2604 case 2:
2605 type->alignment = size = sizeof(short);
2606 break;
2607 case 6:
2608 type->alignment = size = sizeof(float);
2609 break;
2610 case 7:
2611 type->alignment = size = sizeof(double);
2612 break;
2613 case 8:
2614 {
2615 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2616
2617 if(_class && _class->type == 1)
2618 {
2619 ComputeClassMembers(_class, 0x0);
2620 type->alignment = _class->structAlignment;
2621 size = _class->structSize;
2622 if(type->alignment && size % type->alignment)
2623 size += type->alignment - (size % type->alignment);
2624 }
2625 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2626 {
2627 if(!_class->dataType)
2628 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2629 size = type->alignment = ComputeTypeSize(_class->dataType);
2630 }
2631 else
2632 size = type->alignment = targetBits / 8;
2633 break;
2634 }
2635 case 13:
2636 case 19:
2637 size = type->alignment = targetBits / 8;
2638 break;
2639 case 12:
2640 if(type->arraySizeExp)
2641 {
2642 ProcessExpressionType(type->arraySizeExp);
2643 ComputeExpression(type->arraySizeExp);
2644 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)))
2645 {
2646 struct Location oldLoc = yylloc;
2647 char expression[10240];
2648
2649 expression[0] = '\0';
2650 type->arraySizeExp->expType = (((void *)0));
2651 yylloc = type->arraySizeExp->loc;
2652 if(inCompiler)
2653 PrintExpression(type->arraySizeExp, expression);
2654 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2655 yylloc = oldLoc;
2656 }
2657 GetInt(type->arraySizeExp, &type->arraySize);
2658 }
2659 else if(type->enumClass)
2660 {
2661 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2662 {
2663 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2664 }
2665 else
2666 type->arraySize = 0;
2667 }
2668 else
2669 {
2670 type->arraySize = 0;
2671 }
2672 size = ComputeTypeSize(type->type) * type->arraySize;
2673 if(type->type)
2674 type->alignment = type->type->alignment;
2675 break;
2676 case 9:
2677 {
2678 struct Type * member;
2679
2680 for(member = type->members.first; member; member = member->next)
2681 {
2682 int __simpleStruct0, __simpleStruct1;
2683 unsigned int addSize = ComputeTypeSize(member);
2684
2685 member->offset = size;
2686 if(member->alignment && size % member->alignment)
2687 member->offset += member->alignment - (size % member->alignment);
2688 size = member->offset;
2689 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2690 size += addSize;
2691 }
2692 if(type->alignment && size % type->alignment)
2693 size += type->alignment - (size % type->alignment);
2694 break;
2695 }
2696 case 10:
2697 {
2698 struct Type * member;
2699
2700 for(member = type->members.first; member; member = member->next)
2701 {
2702 int __simpleStruct0, __simpleStruct1;
2703 unsigned int addSize = ComputeTypeSize(member);
2704
2705 member->offset = size;
2706 if(member->alignment && size % member->alignment)
2707 member->offset += member->alignment - (size % member->alignment);
2708 size = member->offset;
2709 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2710 size = ((size > addSize) ? size : addSize);
2711 }
2712 if(type->alignment && size % type->alignment)
2713 size += type->alignment - (size % type->alignment);
2714 break;
2715 }
2716 case 20:
2717 {
2718 struct TemplateParameter * param = type->templateParameter;
2719 struct Type * baseType = ProcessTemplateParameterType(param);
2720
2721 if(baseType)
2722 {
2723 size = ComputeTypeSize(baseType);
2724 type->alignment = baseType->alignment;
2725 }
2726 else
2727 type->alignment = size = sizeof(uint64);
2728 break;
2729 }
2730 case 15:
2731 {
2732 type->alignment = size = sizeof(enum
2733 {
2734 test
2735 });
2736 break;
2737 }
2738 case 21:
2739 {
2740 type->alignment = size = targetBits / 8;
2741 break;
2742 }
2743 }
2744 type->size = size;
2745 type->computing = 0x0;
2746 }
2747 return size;
2748 }
2749
2750 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2751
2752 extern struct Identifier * MkIdentifier(char *  string);
2753
2754 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2755
2756 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2757
2758 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2759
2760 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2761
2762 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2763
2764 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2765
2766 extern void FreeType(struct Type * type);
2767
2768 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2769
2770 extern struct Specifier * MkSpecifier(int specifier);
2771
2772 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2773
2774 extern struct Expression * MkExpConstant(char *  string);
2775
2776 int AddMembers(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember, unsigned int * retSize, struct __ecereNameSpace__ecere__com__Class * topClass, unsigned int * addedPadding)
2777 {
2778 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2779 unsigned int totalSize = 0;
2780 unsigned int maxSize = 0;
2781 int alignment, size;
2782 struct __ecereNameSpace__ecere__com__DataMember * member;
2783 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2784
2785 if(addedPadding)
2786 *addedPadding = 0x0;
2787 if(!isMember && _class->base)
2788 {
2789 maxSize = _class->structSize;
2790 {
2791 if(_class->type == 1 || _class->type == 5)
2792 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2793 else
2794 {
2795 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2796
2797 if(maxSize > baseSize)
2798 maxSize -= baseSize;
2799 else
2800 maxSize = 0;
2801 }
2802 }
2803 }
2804 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2805 {
2806 if(!member->isProperty)
2807 {
2808 switch(member->type)
2809 {
2810 case 0:
2811 {
2812 if(member->dataTypeString)
2813 {
2814 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2815 struct Declarator * decl;
2816
2817 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2818 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2819 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2820 if(!member->dataType)
2821 member->dataType = ProcessType(specs, decl);
2822 ReplaceThisClassSpecifiers(specs, topClass);
2823 {
2824 struct Type * type = ProcessType(specs, decl);
2825
2826 DeclareType(member->dataType, 0x0, 0x0);
2827 FreeType(type);
2828 }
2829 ComputeTypeSize(member->dataType);
2830 size = member->dataType->size;
2831 alignment = member->dataType->alignment;
2832 if(alignment)
2833 {
2834 if(totalSize % alignment)
2835 totalSize += alignment - (totalSize % alignment);
2836 }
2837 totalSize += size;
2838 }
2839 break;
2840 }
2841 case 1:
2842 case 2:
2843 {
2844 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2845
2846 size = 0;
2847 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
2848 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2849 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2850 alignment = member->structAlignment;
2851 if(alignment)
2852 {
2853 if(totalSize % alignment)
2854 totalSize += alignment - (totalSize % alignment);
2855 }
2856 totalSize += size;
2857 break;
2858 }
2859 }
2860 }
2861 }
2862 if(retSize)
2863 {
2864 unsigned int __simpleStruct0;
2865
2866 if(topMember && topMember->type == 1)
2867 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2868 else
2869 *retSize += totalSize;
2870 }
2871 else if(totalSize < maxSize && _class->type != 1000)
2872 {
2873 int autoPadding = 0;
2874
2875 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
2876 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
2877 if(totalSize + autoPadding < maxSize)
2878 {
2879 char sizeString[50];
2880
2881 sprintf(sizeString, "%d", maxSize - totalSize);
2882 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2883 if(addedPadding)
2884 *addedPadding = 0x1;
2885 }
2886 }
2887 if(context)
2888 FinishTemplatesContext(context);
2889 return topMember ? topMember->memberID : _class->memberID;
2890 }
2891
2892 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2893 {
2894 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2895 unsigned int totalSize = 0;
2896 struct __ecereNameSpace__ecere__com__DataMember * member;
2897 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2898
2899 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2900 DeclareMembers(_class->base, 0x0);
2901 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2902 {
2903 if(!member->isProperty)
2904 {
2905 switch(member->type)
2906 {
2907 case 0:
2908 {
2909 if(!member->dataType && member->dataTypeString)
2910 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2911 if(member->dataType)
2912 DeclareType(member->dataType, 0x0, 0x0);
2913 break;
2914 }
2915 case 1:
2916 case 2:
2917 {
2918 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2919 break;
2920 }
2921 }
2922 }
2923 }
2924 if(context)
2925 FinishTemplatesContext(context);
2926 return topMember ? topMember->memberID : _class->memberID;
2927 }
2928
2929 extern struct Symbol * FindClass(char *  name);
2930
2931 extern char *  strchr(const char * , int);
2932
2933 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2934
2935 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
2936
2937 extern void FreeClassDef(struct ClassDef * def);
2938
2939 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2940
2941 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2942
2943 extern char *  strcpy(char * , const char * );
2944
2945 extern void MangleClassName(char *  className);
2946
2947 extern void DeclareClass(struct Symbol * classSym, char *  className);
2948
2949 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2950
2951 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2952
2953 void DeclareStruct(char * name, unsigned int skipNoHead)
2954 {
2955 struct External * external = (((void *)0));
2956 struct Symbol * classSym = FindClass(name);
2957
2958 if(!inCompiler || !classSym)
2959 return ;
2960 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2961 return ;
2962 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2963 {
2964 struct Declaration * decl;
2965 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2966 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2967 char structName[1024];
2968
2969 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2970 classSym->declaring++;
2971 if(strchr(classSym->string, '<'))
2972 {
2973 if(classSym->registered->templateClass)
2974 {
2975 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2976 classSym->declaring--;
2977 }
2978 return ;
2979 }
2980 DeclareMembers(classSym->registered, 0x0);
2981 structName[0] = (char)0;
2982 FullClassNameCat(structName, name, 0x0);
2983 if(!skipNoHead)
2984 {
2985 unsigned int addedPadding = 0x0;
2986
2987 classSym->declaredStructSym = 0x1;
2988 declarations = MkList();
2989 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
2990 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
2991 {
2992 FreeList(declarations, FreeClassDef);
2993 declarations = (((void *)0));
2994 }
2995 }
2996 if(skipNoHead || declarations)
2997 {
2998 if(external && external->declaration)
2999 {
3000 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
3001 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3002 {
3003 if(classSym->structExternal)
3004 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3005 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3006 classSym->id = curExternal->symbol->idCode;
3007 classSym->idCode = curExternal->symbol->idCode;
3008 }
3009 }
3010 else
3011 {
3012 if(!external)
3013 external = MkExternalDeclaration((((void *)0)));
3014 specifiers = MkList();
3015 declarators = MkList();
3016 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3017 external->declaration = decl = MkDeclaration(specifiers, declarators);
3018 if(decl->symbol && !decl->symbol->pointerExternal)
3019 decl->symbol->pointerExternal = external;
3020 if(classSym->registered && classSym->registered->type == 1)
3021 {
3022 char className[1024];
3023
3024 strcpy(className, "__ecereClass_");
3025 FullClassNameCat(className, classSym->string, 0x1);
3026 MangleClassName(className);
3027 DeclareClass(classSym, className);
3028 external->symbol = classSym;
3029 classSym->pointerExternal = external;
3030 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3031 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3032 }
3033 else
3034 {
3035 char className[1024];
3036
3037 strcpy(className, "__ecereClass_");
3038 FullClassNameCat(className, classSym->string, 0x1);
3039 MangleClassName(className);
3040 classSym->structExternal = external;
3041 DeclareClass(classSym, className);
3042 external->symbol = classSym;
3043 }
3044 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3045 }
3046 }
3047 classSym->declaring--;
3048 }
3049 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3050 {
3051 classSym->declaring++;
3052 {
3053 if(classSym->registered)
3054 DeclareMembers(classSym->registered, 0x0);
3055 }
3056 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3057 {
3058 if(classSym->structExternal)
3059 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3060 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3061 classSym->id = curExternal->symbol->idCode;
3062 classSym->idCode = curExternal->symbol->idCode;
3063 }
3064 classSym->declaring--;
3065 }
3066 }
3067
3068 extern char *  strcat(char * , const char * );
3069
3070 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3071
3072 extern struct ModuleImport * mainModule;
3073
3074 extern struct Specifier * MkSpecifierName(char *  name);
3075
3076 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3077
3078 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3079
3080 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3081
3082 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3083
3084 extern void FreeDeclarator(struct Declarator * decl);
3085
3086 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3087
3088 struct PropertyImport
3089 {
3090 struct PropertyImport * prev;
3091 struct PropertyImport * next;
3092 char *  name;
3093 unsigned int isVirtual;
3094 unsigned int hasSet;
3095 unsigned int hasGet;
3096 } __attribute__ ((gcc_struct));
3097
3098 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3099
3100 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3101 {
3102 struct Symbol * symbol = prop->symbol;
3103 char propName[1024];
3104
3105 strcpy(setName, "__ecereProp_");
3106 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3107 strcat(setName, "_Set_");
3108 FullClassNameCat(setName, prop->name, 0x1);
3109 strcpy(getName, "__ecereProp_");
3110 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3111 strcat(getName, "_Get_");
3112 FullClassNameCat(getName, prop->name, 0x1);
3113 strcpy(propName, "__ecereProp_");
3114 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3115 strcat(propName, "_");
3116 FullClassNameCat(propName, prop->name, 0x1);
3117 MangleClassName(getName);
3118 MangleClassName(setName);
3119 MangleClassName(propName);
3120 if(prop->_class->type == 1)
3121 DeclareStruct(prop->_class->fullName, 0x0);
3122 if(!symbol || curExternal->symbol->idCode < symbol->id)
3123 {
3124 unsigned int imported = 0x0;
3125 unsigned int dllImport = 0x0;
3126
3127 if(!symbol || symbol->_import)
3128 {
3129 if(!symbol)
3130 {
3131 struct Symbol * classSym;
3132
3133 if(!prop->_class->symbol)
3134 prop->_class->symbol = FindClass(prop->_class->fullName);
3135 classSym = prop->_class->symbol;
3136 if(classSym && !classSym->_import)
3137 {
3138 struct ModuleImport * module;
3139
3140 if(prop->_class->module)
3141 module = FindModule(prop->_class->module);
3142 else
3143 module = mainModule;
3144 classSym->_import = __extension__ ({
3145 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3146
3147 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3148 });
3149 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3150 }
3151 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3152 symbol->_import = (struct ClassImport *)__extension__ ({
3153 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3154
3155 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3156 });
3157 if(classSym)
3158 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3159 }
3160 imported = 0x1;
3161 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + structSize_Instance)))->importType != 1)
3162 dllImport = 0x1;
3163 }
3164 if(!symbol->type)
3165 {
3166 struct Context * context = SetupTemplatesContext(prop->_class);
3167
3168 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3169 FinishTemplatesContext(context);
3170 }
3171 if(prop->Get)
3172 {
3173 if(!symbol->externalGet || symbol->externalGet->type == 0)
3174 {
3175 struct Declaration * decl;
3176 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3177 struct Declarator * d;
3178 struct __ecereNameSpace__ecere__sys__OldList * params;
3179 struct Specifier * spec;
3180 struct External * external;
3181 struct Declarator * typeDecl;
3182 unsigned int simple = 0x0;
3183
3184 specifiers = MkList();
3185 declarators = MkList();
3186 params = MkList();
3187 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3188 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3189 if(dllImport)
3190 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3191 {
3192 struct Context * context = SetupTemplatesContext(prop->_class);
3193
3194 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3195 FinishTemplatesContext(context);
3196 }
3197 for(spec = (*specifiers).first; spec; spec = spec->next)
3198 {
3199 if(spec->type == 1)
3200 {
3201 if((!typeDecl || typeDecl->type == 1))
3202 {
3203 struct Symbol * classSym = spec->symbol;
3204
3205 symbol->_class = classSym->registered;
3206 if(classSym->registered && classSym->registered->type == 1)
3207 {
3208 DeclareStruct(spec->name, 0x0);
3209 simple = 0x1;
3210 }
3211 }
3212 }
3213 }
3214 if(!simple)
3215 d = PlugDeclarator(typeDecl, d);
3216 else
3217 {
3218 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3219 specifiers = MkList();
3220 }
3221 d = MkDeclaratorFunction(d, params);
3222 if(dllImport)
3223 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3224 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3225 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3226 if(simple)
3227 ListAdd(specifiers, MkSpecifier(VOID));
3228 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3229 decl = MkDeclaration(specifiers, declarators);
3230 external = MkExternalDeclaration(decl);
3231 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3232 external->symbol = symbol;
3233 symbol->externalGet = external;
3234 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3235 if(typeDecl)
3236 FreeDeclarator(typeDecl);
3237 }
3238 else
3239 {
3240 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3241 }
3242 }
3243 if(prop->Set)
3244 {
3245 if(!symbol->externalSet || symbol->externalSet->type == 0)
3246 {
3247 struct Declaration * decl;
3248 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3249 struct Declarator * d;
3250 struct __ecereNameSpace__ecere__sys__OldList * params;
3251 struct Specifier * spec;
3252 struct External * external;
3253 struct Declarator * typeDecl;
3254
3255 declarators = MkList();
3256 params = MkList();
3257 if(!prop->conversion || prop->_class->type == 1)
3258 {
3259 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3260 }
3261 specifiers = MkList();
3262 {
3263 struct Context * context = SetupTemplatesContext(prop->_class);
3264
3265 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3266 FinishTemplatesContext(context);
3267 }
3268 ListAdd(params, MkTypeName(specifiers, d));
3269 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3270 if(dllImport)
3271 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3272 d = MkDeclaratorFunction(d, params);
3273 for(spec = (*specifiers).first; spec; spec = spec->next)
3274 {
3275 if(spec->type == 1)
3276 {
3277 if((!typeDecl || typeDecl->type == 1))
3278 {
3279 struct Symbol * classSym = spec->symbol;
3280
3281 symbol->_class = classSym->registered;
3282 if(classSym->registered && classSym->registered->type == 1)
3283 DeclareStruct(spec->name, 0x0);
3284 }
3285 }
3286 }
3287 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3288 specifiers = MkList();
3289 if(dllImport)
3290 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3291 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3292 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3293 if(!prop->conversion || prop->_class->type == 1)
3294 ListAdd(specifiers, MkSpecifier(VOID));
3295 else
3296 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3297 decl = MkDeclaration(specifiers, declarators);
3298 external = MkExternalDeclaration(decl);
3299 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3300 external->symbol = symbol;
3301 symbol->externalSet = external;
3302 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3303 }
3304 else
3305 {
3306 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3307 }
3308 }
3309 if(!symbol->externalPtr)
3310 {
3311 struct Declaration * decl;
3312 struct External * external;
3313 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3314
3315 if(imported)
3316 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3317 else
3318 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3319 ListAdd(specifiers, MkSpecifierName("Property"));
3320 {
3321 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3322
3323 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3324 if(!imported)
3325 {
3326 strcpy(propName, "__ecerePropM_");
3327 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3328 strcat(propName, "_");
3329 FullClassNameCat(propName, prop->name, 0x1);
3330 MangleClassName(propName);
3331 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3332 }
3333 decl = MkDeclaration(specifiers, list);
3334 }
3335 external = MkExternalDeclaration(decl);
3336 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3337 external->symbol = symbol;
3338 symbol->externalPtr = external;
3339 }
3340 else
3341 {
3342 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3343 }
3344 symbol->id = curExternal->symbol->idCode;
3345 }
3346 }
3347
3348 struct Type * Dereference(struct Type * source)
3349 {
3350 struct Type * type = (((void *)0));
3351
3352 if(source)
3353 {
3354 if(source->kind == 13 || source->kind == 12)
3355 {
3356 type = source->type;
3357 source->type->refCount++;
3358 }
3359 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3360 {
3361 type = __extension__ ({
3362 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3363
3364 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3365 });
3366 }
3367 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3368 {
3369 type = source;
3370 source->refCount++;
3371 }
3372 else
3373 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3374 }
3375 return type;
3376 }
3377
3378 static struct Type * Reference(struct Type * source)
3379 {
3380 struct Type * type = (((void *)0));
3381
3382 if(source)
3383 {
3384 type = __extension__ ({
3385 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3386
3387 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3388 });
3389 source->refCount++;
3390 }
3391 return type;
3392 }
3393
3394 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);
3395
3396 extern void *  memcpy(void * , const void * , size_t size);
3397
3398 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3399
3400 extern void FreeExpression(struct Expression * exp);
3401
3402 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3403
3404 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);
3405
3406 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3407
3408 extern struct Type * MkClassType(char *  name);
3409
3410 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);
3411
3412 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)
3413 {
3414 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3415 unsigned int found = 0x0;
3416 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3417 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3418 unsigned int freeType = 0x0;
3419
3420 yylloc = member->loc;
3421 if(!ident)
3422 {
3423 if(curMember)
3424 {
3425 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3426 if(*curMember)
3427 {
3428 found = 0x1;
3429 dataMember = *curMember;
3430 }
3431 }
3432 }
3433 else
3434 {
3435 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3436 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3437 int _subMemberStackPos = 0;
3438
3439 if(!thisMember)
3440 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3441 if(thisMember)
3442 {
3443 dataMember = thisMember;
3444 if(curMember && thisMember->memberAccess == 1)
3445 {
3446 *curMember = thisMember;
3447 *curClass = thisMember->_class;
3448 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3449 *subMemberStackPos = _subMemberStackPos;
3450 }
3451 found = 0x1;
3452 }
3453 else
3454 {
3455 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3456 if(method && method->type == 1)
3457 found = 0x1;
3458 else
3459 method = (((void *)0));
3460 }
3461 }
3462 if(found)
3463 {
3464 struct Type * type = (((void *)0));
3465
3466 if(dataMember)
3467 {
3468 if(!dataMember->dataType && dataMember->dataTypeString)
3469 {
3470 struct Context * context = SetupTemplatesContext(_class);
3471
3472 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3473 FinishTemplatesContext(context);
3474 }
3475 type = dataMember->dataType;
3476 }
3477 else if(method)
3478 {
3479 if(!method->dataType)
3480 ProcessMethodType(method);
3481 type = method->dataType;
3482 }
3483 if(ident && ident->next)
3484 {
3485 for(ident = ident->next; ident && type; ident = ident->next)
3486 {
3487 if(type->kind == 8)
3488 {
3489 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3490 if(!dataMember)
3491 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3492 if(dataMember)
3493 type = dataMember->dataType;
3494 }
3495 else if(type->kind == 9 || type->kind == 10)
3496 {
3497 struct Type * memberType;
3498
3499 for(memberType = type->members.first; memberType; memberType = memberType->next)
3500 {
3501 if(!strcmp(memberType->name, ident->string))
3502 {
3503 type = memberType;
3504 break;
3505 }
3506 }
3507 }
3508 }
3509 }
3510 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3511 {
3512 int id = 0;
3513 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3514 struct __ecereNameSpace__ecere__com__Class * sClass;
3515
3516 for(sClass = _class; sClass; sClass = sClass->base)
3517 {
3518 id = 0;
3519 if(sClass->templateClass)
3520 sClass = sClass->templateClass;
3521 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3522 {
3523 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3524 {
3525 for(sClass = sClass->base; sClass; sClass = sClass->base)
3526 {
3527 if(sClass->templateClass)
3528 sClass = sClass->templateClass;
3529 id += sClass->templateParams.count;
3530 }
3531 break;
3532 }
3533 id++;
3534 }
3535 if(curParam)
3536 break;
3537 }
3538 if(curParam)
3539 {
3540 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3541
3542 if(arg.dataTypeString)
3543 {
3544 type = ProcessTypeString(arg.dataTypeString, 0x0);
3545 freeType = 0x1;
3546 if(type && _class->templateClass)
3547 type->passAsTemplate = 0x1;
3548 if(type)
3549 {
3550 }
3551 }
3552 }
3553 }
3554 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3555 {
3556 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3557 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3558 int c;
3559 int paramCount = 0;
3560 int lastParam = -1;
3561 char templateString[1024];
3562 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3563
3564 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3565 for(cClass = expClass; cClass; cClass = cClass->base)
3566 {
3567 int p = 0;
3568
3569 if(cClass->templateClass)
3570 cClass = cClass->templateClass;
3571 for(param = cClass->templateParams.first; param; param = param->next)
3572 {
3573 int id = p;
3574 struct __ecereNameSpace__ecere__com__Class * sClass;
3575 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3576
3577 for(sClass = cClass->base; sClass; sClass = sClass->base)
3578 {
3579 if(sClass->templateClass)
3580 sClass = sClass->templateClass;
3581 id += sClass->templateParams.count;
3582 }
3583 arg = expClass->templateArgs[id];
3584 for(sClass = _class; sClass; sClass = sClass->base)
3585 {
3586 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3587 int p = 0;
3588 struct __ecereNameSpace__ecere__com__Class * nextClass;
3589
3590 if(sClass->templateClass)
3591 sClass = sClass->templateClass;
3592 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3593 {
3594 if(nextClass->templateClass)
3595 nextClass = nextClass->templateClass;
3596 p += nextClass->templateParams.count;
3597 }
3598 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3599 {
3600 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3601 {
3602 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3603 {
3604 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3605 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3606 break;
3607 }
3608 }
3609 }
3610 }
3611 {
3612 char argument[256];
3613
3614 argument[0] = '\0';
3615 switch(param->type)
3616 {
3617 case 2:
3618 {
3619 char expString[1024];
3620 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3621 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3622 struct Expression * exp;
3623 char * string = PrintHexUInt64(arg.expression.ui64);
3624
3625 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3626 ProcessExpressionType(exp);
3627 ComputeExpression(exp);
3628 expString[0] = '\0';
3629 PrintExpression(exp, expString);
3630 strcat(argument, expString);
3631 FreeExpression(exp);
3632 break;
3633 }
3634 case 1:
3635 {
3636 strcat(argument, arg.member->name);
3637 break;
3638 }
3639 case 0:
3640 {
3641 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3642 strcat(argument, arg.dataTypeString);
3643 break;
3644 }
3645 }
3646 if(argument[0])
3647 {
3648 if(paramCount)
3649 strcat(templateString, ", ");
3650 if(lastParam != p - 1)
3651 {
3652 strcat(templateString, param->name);
3653 strcat(templateString, " = ");
3654 }
3655 strcat(templateString, argument);
3656 paramCount++;
3657 lastParam = p;
3658 }
3659 p++;
3660 }
3661 }
3662 }
3663 {
3664 int len = strlen(templateString);
3665
3666 if(templateString[len - 1] == '<')
3667 len--;
3668 else
3669 {
3670 if(templateString[len - 1] == '>')
3671 templateString[len++] = ' ';
3672 templateString[len++] = '>';
3673 }
3674 templateString[len++] = '\0';
3675 }
3676 {
3677 struct Context * context = SetupTemplatesContext(_class);
3678
3679 if(freeType)
3680 FreeType(type);
3681 type = ProcessTypeString(templateString, 0x0);
3682 freeType = 0x1;
3683 FinishTemplatesContext(context);
3684 }
3685 }
3686 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3687 {
3688 ProcessExpressionType(member->initializer->exp);
3689 if(!member->initializer->exp->expType)
3690 {
3691 if(inCompiler)
3692 {
3693 char expString[10240];
3694
3695 expString[0] = '\0';
3696 PrintExpression(member->initializer->exp, expString);
3697 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3698 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3699 }
3700 }
3701 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3702 {
3703 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3704 }
3705 }
3706 else if(member->initializer)
3707 {
3708 ProcessInitializer(member->initializer, type);
3709 }
3710 if(freeType)
3711 FreeType(type);
3712 }
3713 else
3714 {
3715 if(_class && _class->type == 3)
3716 {
3717 if(member->initializer)
3718 {
3719 struct Type * type = MkClassType(_class->fullName);
3720
3721 ProcessInitializer(member->initializer, type);
3722 FreeType(type);
3723 }
3724 }
3725 else
3726 {
3727 if(member->initializer)
3728 {
3729 ProcessInitializer(member->initializer, (((void *)0)));
3730 }
3731 if(ident)
3732 {
3733 if(method)
3734 {
3735 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3736 }
3737 else if(_class)
3738 {
3739 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3740 if(inCompiler)
3741 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3742 }
3743 }
3744 else if(_class)
3745 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3746 }
3747 }
3748 }
3749
3750 extern struct Identifier * GetDeclId(struct Declarator * decl);
3751
3752 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);
3753
3754 extern void FreeSpecifier(struct Specifier * spec);
3755
3756 static void ProcessFunction(struct FunctionDefinition * function);
3757
3758 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3759
3760 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3761
3762 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3763
3764 extern void FreeClassFunction(struct ClassFunction * func);
3765
3766 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3767
3768 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3769
3770 void ProcessInstantiationType(struct Instantiation * inst)
3771 {
3772 yylloc = inst->loc;
3773 if(inst->_class)
3774 {
3775 struct MembersInit * members;
3776 struct Symbol * classSym;
3777 struct __ecereNameSpace__ecere__com__Class * _class;
3778
3779 classSym = inst->_class->symbol;
3780 _class = classSym ? classSym->registered : (((void *)0));
3781 if(!_class || _class->type != 5)
3782 DeclareStruct(inst->_class->name, 0x0);
3783 afterExternal = afterExternal ? afterExternal : curExternal;
3784 if(inst->exp)
3785 ProcessExpressionType(inst->exp);
3786 inst->isConstant = 0x1;
3787 if(inst->members)
3788 {
3789 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3790 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3791 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3792 int subMemberStackPos = 0;
3793
3794 for(members = (*inst->members).first; members; members = members->next)
3795 {
3796 switch(members->type)
3797 {
3798 case 1:
3799 {
3800 char name[1024];
3801 static unsigned int instMethodID = 0;
3802 struct External * external = curExternal;
3803 struct Context * context = curContext;
3804 struct Declarator * declarator = members->function->declarator;
3805 struct Identifier * nameID = GetDeclId(declarator);
3806 char * unmangled = nameID ? nameID->string : (((void *)0));
3807 struct Expression * exp;
3808 struct External * createdExternal = (((void *)0));
3809
3810 if(inCompiler)
3811 {
3812 char number[16];
3813
3814 strcpy(name, "__ecereInstMeth_");
3815 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3816 strcat(name, "_");
3817 strcat(name, nameID->string);
3818 strcat(name, "_");
3819 sprintf(number, "_%08d", instMethodID++);
3820 strcat(name, number);
3821 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3822 }
3823 if(declarator)
3824 {
3825 struct Symbol * symbol = declarator->symbol;
3826 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3827
3828 if(method && method->type == 1)
3829 {
3830 symbol->method = method;
3831 ProcessMethodType(method);
3832 if(!symbol->type->thisClass)
3833 {
3834 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3835 {
3836 if(!currentClass->symbol)
3837 currentClass->symbol = FindClass(currentClass->fullName);
3838 symbol->type->thisClass = currentClass->symbol;
3839 }
3840 else
3841 {
3842 if(!_class->symbol)
3843 _class->symbol = FindClass(_class->fullName);
3844 symbol->type->thisClass = _class->symbol;
3845 }
3846 }
3847 DeclareType(symbol->type, 0x1, 0x1);
3848 }
3849 else if(classSym)
3850 {
3851 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3852 }
3853 }
3854 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3855 if(nameID)
3856 {
3857 FreeSpecifier(nameID->_class);
3858 nameID->_class = (((void *)0));
3859 }
3860 if(inCompiler)
3861 {
3862 struct Type * type = declarator->symbol->type;
3863 struct External * oldExternal = curExternal;
3864
3865 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3866 {
3867 struct External * externalDecl;
3868
3869 externalDecl = MkExternalDeclaration((((void *)0)));
3870 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3871 if(createdExternal->function)
3872 {
3873 ProcessFunction(createdExternal->function);
3874 {
3875 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3876
3877 externalDecl->declaration = decl;
3878 if(decl->symbol && !decl->symbol->pointerExternal)
3879 decl->symbol->pointerExternal = externalDecl;
3880 declarator->symbol->pointerExternal = externalDecl;
3881 }
3882 }
3883 }
3884 }
3885 else if(declarator)
3886 {
3887 curExternal = declarator->symbol->pointerExternal;
3888 ProcessFunction((struct FunctionDefinition *)members->function);
3889 }
3890 curExternal = external;
3891 curContext = context;
3892 if(inCompiler)
3893 {
3894 FreeClassFunction(members->function);
3895 exp = QMkExpId(name);
3896 members->type = 0;
3897 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3898 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3899 }
3900 break;
3901 }
3902 case 0:
3903 {
3904 if(members->dataMembers && classSym)
3905 {
3906 struct MemberInit * member;
3907 struct Location oldyyloc = yylloc;
3908
3909 for(member = (*members->dataMembers).first; member; member = member->next)
3910 {
3911 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3912 if(member->initializer && !member->initializer->isConstant)
3913 inst->isConstant = 0x0;
3914 }
3915 yylloc = oldyyloc;
3916 }
3917 break;
3918 }
3919 }
3920 }
3921 }
3922 }
3923 }
3924
3925 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3926 {
3927 if(inCompiler)
3928 {
3929 if(type->kind == 11)
3930 {
3931 struct Type * param;
3932
3933 if(declareParams)
3934 {
3935 for(param = type->params.first; param; param = param->next)
3936 DeclareType(param, declarePointers, 0x1);
3937 }
3938 DeclareType(type->returnType, declarePointers, 0x1);
3939 }
3940 else if(type->kind == 13 && declarePointers)
3941 DeclareType(type->type, declarePointers, 0x0);
3942 else if(type->kind == 8)
3943 {
3944 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3945 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3946 }
3947 else if(type->kind == 9 || type->kind == 10)
3948 {
3949 struct Type * member;
3950
3951 for(member = type->members.first; member; member = member->next)
3952 DeclareType(member, 0x0, 0x0);
3953 }
3954 else if(type->kind == 12)
3955 DeclareType(type->arrayType, declarePointers, 0x0);
3956 }
3957 }
3958
3959 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3960
3961 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3962 {
3963 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3964 int id = 0;
3965 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3966 struct __ecereNameSpace__ecere__com__Class * sClass;
3967
3968 for(sClass = _class; sClass; sClass = sClass->base)
3969 {
3970 id = 0;
3971 if(sClass->templateClass)
3972 sClass = sClass->templateClass;
3973 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3974 {
3975 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3976 {
3977 for(sClass = sClass->base; sClass; sClass = sClass->base)
3978 {
3979 if(sClass->templateClass)
3980 sClass = sClass->templateClass;
3981 id += sClass->templateParams.count;
3982 }
3983 break;
3984 }
3985 id++;
3986 }
3987 if(curParam)
3988 break;
3989 }
3990 if(curParam)
3991 {
3992 arg = &_class->templateArgs[id];
3993 if(arg && param->type == 0)
3994 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3995 }
3996 return arg;
3997 }
3998
3999 extern struct Context * PushContext(void);
4000
4001 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
4002
4003 struct TemplatedType
4004 {
4005 uintptr_t key;
4006 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4007 struct __ecereNameSpace__ecere__sys__BTNode * left;
4008 struct __ecereNameSpace__ecere__sys__BTNode * right;
4009 int depth;
4010 struct TemplateParameter * param;
4011 } __attribute__ ((gcc_struct));
4012
4013 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4014
4015 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4016 {
4017 struct Context * context = PushContext();
4018
4019 context->templateTypesOnly = 0x1;
4020 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4021 {
4022 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4023
4024 for(; param; param = param->next)
4025 {
4026 if(param->type == 0 && param->identifier)
4027 {
4028 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4029
4030 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4031 }
4032 }
4033 }
4034 else if(_class)
4035 {
4036 struct __ecereNameSpace__ecere__com__Class * sClass;
4037
4038 for(sClass = _class; sClass; sClass = sClass->base)
4039 {
4040 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4041
4042 for(p = sClass->templateParams.first; p; p = p->next)
4043 {
4044 if(p->type == 0)
4045 {
4046 struct TemplateParameter * param = p->param;
4047 struct TemplatedType * type;
4048
4049 if(!param)
4050 {
4051 p->param = param = __extension__ ({
4052 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4053
4054 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4055 });
4056 }
4057 type = __extension__ ({
4058 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4059
4060 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4061 });
4062 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4063 }
4064 }
4065 }
4066 }
4067 return context;
4068 }
4069
4070 extern void PopContext(struct Context * ctx);
4071
4072 extern void FreeContext(struct Context * context);
4073
4074 void FinishTemplatesContext(struct Context * context)
4075 {
4076 PopContext(context);
4077 FreeContext(context);
4078 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4079 }
4080
4081 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4082 {
4083 if(!method->dataType)
4084 {
4085 struct Context * context = SetupTemplatesContext(method->_class);
4086
4087 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4088 FinishTemplatesContext(context);
4089 if(method->type != 1 && method->dataType)
4090 {
4091 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4092 {
4093 if(!method->_class->symbol)
4094 method->_class->symbol = FindClass(method->_class->fullName);
4095 method->dataType->thisClass = method->_class->symbol;
4096 }
4097 }
4098 }
4099 }
4100
4101 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4102 {
4103 if(!prop->dataType)
4104 {
4105 struct Context * context = SetupTemplatesContext(prop->_class);
4106
4107 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4108 FinishTemplatesContext(context);
4109 }
4110 }
4111
4112 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4113
4114 extern void FreeTypeName(struct TypeName * typeName);
4115
4116 static void ProcessDeclarator(struct Declarator * decl);
4117
4118 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4119
4120 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4121
4122 struct MethodImport
4123 {
4124 struct MethodImport * prev;
4125 struct MethodImport * next;
4126 char *  name;
4127 unsigned int isVirtual;
4128 } __attribute__ ((gcc_struct));
4129
4130 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4131
4132 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4133 {
4134 struct Symbol * symbol = method->symbol;
4135
4136 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4137 {
4138 unsigned int imported = 0x0;
4139 unsigned int dllImport = 0x0;
4140
4141 if(!method->dataType)
4142 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4143 if(!symbol || symbol->_import || method->type == 1)
4144 {
4145 if(!symbol || method->type == 1)
4146 {
4147 struct Symbol * classSym;
4148
4149 if(!method->_class->symbol)
4150 method->_class->symbol = FindClass(method->_class->fullName);
4151 classSym = method->_class->symbol;
4152 if(!classSym->_import)
4153 {
4154 struct ModuleImport * module;
4155
4156 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4157 module = FindModule(method->_class->module);
4158 else
4159 module = mainModule;
4160 classSym->_import = __extension__ ({
4161 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4162
4163 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4164 });
4165 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4166 }
4167 if(!symbol)
4168 {
4169 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4170 }
4171 if(!symbol->_import)
4172 {
4173 symbol->_import = (struct ClassImport *)__extension__ ({
4174 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4175
4176 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4177 });
4178 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4179 }
4180 if(!symbol)
4181 {
4182 symbol->type = method->dataType;
4183 if(symbol->type)
4184 symbol->type->refCount++;
4185 }
4186 }
4187 if(!method->dataType->dllExport)
4188 {
4189 imported = 0x1;
4190 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->importType != 1)
4191 dllImport = 0x1;
4192 }
4193 }
4194 if(method->type != 1 && method->dataType)
4195 DeclareType(method->dataType, 0x1, 0x1);
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 if(dllImport)
4207 ListAdd(specifiers, MkSpecifier(EXTERN));
4208 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4209 ListAdd(specifiers, MkSpecifier(STATIC));
4210 if(method->type == 1)
4211 {
4212 ListAdd(specifiers, MkSpecifier(INT));
4213 d = MkDeclaratorIdentifier(MkIdentifier(name));
4214 }
4215 else
4216 {
4217 d = MkDeclaratorIdentifier(MkIdentifier(name));
4218 if(dllImport)
4219 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4220 {
4221 struct Context * context = SetupTemplatesContext(method->_class);
4222
4223 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4224 FinishTemplatesContext(context);
4225 }
4226 funcDecl = GetFuncDecl(d);
4227 if(dllImport)
4228 {
4229 struct Specifier * spec, * next;
4230
4231 for(spec = (*specifiers).first; spec; spec = next)
4232 {
4233 next = spec->next;
4234 if(spec->type == 5)
4235 {
4236 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4237 FreeSpecifier(spec);
4238 }
4239 }
4240 }
4241 if(method->dataType && !method->dataType->staticMethod)
4242 {
4243 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4244 {
4245 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4246 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")));
4247 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4248 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4249
4250 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4251 {
4252 struct TypeName * param = (*funcDecl->function.parameters).first;
4253
4254 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4255 FreeTypeName(param);
4256 }
4257 if(!funcDecl->function.parameters)
4258 funcDecl->function.parameters = MkList();
4259 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4260 }
4261 }
4262 }
4263 ProcessDeclarator(d);
4264 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4265 decl = MkDeclaration(specifiers, declarators);
4266 ReplaceThisClassSpecifiers(specifiers, method->_class);
4267 if(symbol->pointerExternal)
4268 {
4269 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4270
4271 {
4272 *functionSymbol = *symbol;
4273 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4274 if(functionSymbol->type)
4275 functionSymbol->type->refCount++;
4276 }
4277 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4278 symbol->pointerExternal->symbol = functionSymbol;
4279 }
4280 external = MkExternalDeclaration(decl);
4281 if(curExternal)
4282 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4283 external->symbol = symbol;
4284 symbol->pointerExternal = external;
4285 }
4286 else if(ast)
4287 {
4288 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4289 }
4290 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4291 }
4292 }
4293
4294 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4295 {
4296 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4297 {
4298 unsigned int first = 0x1;
4299 int p = 0;
4300 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4301 int lastParam = -1;
4302 char className[1024];
4303
4304 strcpy(className, _class->fullName);
4305 for(param = _class->templateParams.first; param; param = param->next)
4306 {
4307 {
4308 if(first)
4309 strcat(className, "<");
4310 if(!first)
4311 strcat(className, ", ");
4312 if(lastParam + 1 != p)
4313 {
4314 strcat(className, param->name);
4315 strcat(className, " = ");
4316 }
4317 strcat(className, param->name);
4318 first = 0x0;
4319 lastParam = p;
4320 }
4321 p++;
4322 }
4323 if(!first)
4324 {
4325 int len = strlen(className);
4326
4327 if(className[len - 1] == '>')
4328 className[len++] = ' ';
4329 className[len++] = '>';
4330 className[len++] = '\0';
4331 }
4332 return __ecereNameSpace__ecere__sys__CopyString(className);
4333 }
4334 else
4335 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4336 }
4337
4338 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4339 {
4340 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4341 {
4342 unsigned int first = 0x1;
4343 int p = 0;
4344 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4345 int lastParam = -1;
4346 char className[1024];
4347
4348 strcpy(className, _class->fullName);
4349 for(param = _class->templateParams.first; param; param = param->next)
4350 {
4351 {
4352 if(first)
4353 strcat(className, "<");
4354 if(!first)
4355 strcat(className, ", ");
4356 if(lastParam + 1 != p)
4357 {
4358 strcat(className, param->name);
4359 strcat(className, " = ");
4360 }
4361 strcat(className, param->name);
4362 first = 0x0;
4363 lastParam = p;
4364 }
4365 p++;
4366 }
4367 if(!first)
4368 {
4369 int len = strlen(className);
4370
4371 if(className[len - 1] == '>')
4372 className[len++] = ' ';
4373 className[len++] = '>';
4374 className[len++] = '\0';
4375 }
4376 return MkClassType(className);
4377 }
4378 else
4379 {
4380 return MkClassType(_class->fullName);
4381 }
4382 }
4383
4384 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4385 {
4386 if(specs != (((void *)0)) && _class)
4387 {
4388 struct Specifier * spec;
4389
4390 for(spec = specs->first; spec; spec = spec->next)
4391 {
4392 if(spec->type == 0 && spec->specifier == THISCLASS)
4393 {
4394 spec->type = 1;
4395 spec->name = ReplaceThisClass(_class);
4396 spec->symbol = FindClass(spec->name);
4397 }
4398 }
4399 }
4400 }
4401
4402 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4403
4404 struct __ecereNameSpace__ecere__com__GlobalFunction
4405 {
4406 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4407 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4408 char *  name;
4409 int (*  function)();
4410 struct __ecereNameSpace__ecere__com__Instance * module;
4411 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4412 char *  dataTypeString;
4413 struct Type * dataType;
4414 void *  symbol;
4415 } __attribute__ ((gcc_struct));
4416
4417 extern struct Context * globalContext;
4418
4419 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4420
4421 struct FunctionImport
4422 {
4423 struct FunctionImport * prev;
4424 struct FunctionImport * next;
4425 char *  name;
4426 } __attribute__ ((gcc_struct));
4427
4428 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4429 {
4430 struct Symbol * symbol = function->symbol;
4431
4432 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4433 {
4434 unsigned int imported = 0x0;
4435 unsigned int dllImport = 0x0;
4436
4437 if(!function->dataType)
4438 {
4439 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4440 if(!function->dataType->thisClass)
4441 function->dataType->staticMethod = 0x1;
4442 }
4443 if(inCompiler)
4444 {
4445 if(!symbol)
4446 {
4447 struct ModuleImport * module = FindModule(function->module);
4448
4449 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4450 if(module->name)
4451 {
4452 if(!function->dataType->dllExport)
4453 {
4454 symbol->_import = (struct ClassImport *)__extension__ ({
4455 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4456
4457 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4458 });
4459 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4460 }
4461 }
4462 {
4463 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4464 if(!symbol->type->thisClass)
4465 symbol->type->staticMethod = 0x1;
4466 }
4467 }
4468 imported = symbol->_import ? 0x1 : 0x0;
4469 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4470 dllImport = 0x1;
4471 }
4472 DeclareType(function->dataType, 0x1, 0x1);
4473 if(inCompiler)
4474 {
4475 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4476 {
4477 struct Declaration * decl;
4478 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4479 struct Declarator * d;
4480 struct Declarator * funcDecl;
4481 struct External * external;
4482
4483 specifiers = MkList();
4484 declarators = MkList();
4485 ListAdd(specifiers, MkSpecifier(EXTERN));
4486 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4487 if(dllImport)
4488 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4489 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4490 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4491 {
4492 struct Specifier * spec;
4493
4494 for(spec = (*specifiers).first; spec; spec = spec->next)
4495 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4496 {
4497 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4498 FreeSpecifier(spec);
4499 break;
4500 }
4501 }
4502 funcDecl = GetFuncDecl(d);
4503 if(funcDecl && !funcDecl->function.parameters)
4504 {
4505 funcDecl->function.parameters = MkList();
4506 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4507 }
4508 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4509 {
4510 struct Context * oldCtx = curContext;
4511
4512 curContext = globalContext;
4513 decl = MkDeclaration(specifiers, declarators);
4514 curContext = oldCtx;
4515 }
4516 if(symbol->pointerExternal)
4517 {
4518 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4519
4520 {
4521 *functionSymbol = *symbol;
4522 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4523 if(functionSymbol->type)
4524 functionSymbol->type->refCount++;
4525 }
4526 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4527 symbol->pointerExternal->symbol = functionSymbol;
4528 }
4529 external = MkExternalDeclaration(decl);
4530 if(curExternal)
4531 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4532 external->symbol = symbol;
4533 symbol->pointerExternal = external;
4534 }
4535 else
4536 {
4537 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4538 }
4539 if(curExternal)
4540 symbol->id = curExternal->symbol->idCode;
4541 }
4542 }
4543 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4544 }
4545
4546 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4547
4548 struct GlobalData
4549 {
4550 uintptr_t key;
4551 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4552 struct __ecereNameSpace__ecere__sys__BTNode * left;
4553 struct __ecereNameSpace__ecere__sys__BTNode * right;
4554 int depth;
4555 struct __ecereNameSpace__ecere__com__Instance * module;
4556 char *  dataTypeString;
4557 struct Type * dataType;
4558 void *  symbol;
4559 char *  fullName;
4560 } __attribute__ ((gcc_struct));
4561
4562 void DeclareGlobalData(struct GlobalData * data)
4563 {
4564 struct Symbol * symbol = data->symbol;
4565
4566 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4567 {
4568 if(inCompiler)
4569 {
4570 if(!symbol)
4571 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4572 }
4573 if(!data->dataType)
4574 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4575 DeclareType(data->dataType, 0x1, 0x1);
4576 if(inCompiler)
4577 {
4578 if(!symbol->pointerExternal)
4579 {
4580 struct Declaration * decl;
4581 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4582 struct Declarator * d;
4583 struct External * external;
4584
4585 specifiers = MkList();
4586 declarators = MkList();
4587 ListAdd(specifiers, MkSpecifier(EXTERN));
4588 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4589 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4590 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4591 decl = MkDeclaration(specifiers, declarators);
4592 external = MkExternalDeclaration(decl);
4593 if(curExternal)
4594 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4595 external->symbol = symbol;
4596 symbol->pointerExternal = external;
4597 }
4598 else
4599 {
4600 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4601 }
4602 if(curExternal)
4603 symbol->id = curExternal->symbol->idCode;
4604 }
4605 }
4606 }
4607
4608 struct Conversion
4609 {
4610 struct Conversion * prev, * next;
4611 struct __ecereNameSpace__ecere__com__Property * convert;
4612 unsigned int isGet;
4613 struct Type * resultType;
4614 } __attribute__ ((gcc_struct));
4615
4616 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4617
4618 extern void Compiler_Warning(char *  format, ...);
4619
4620 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4621
4622 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)
4623 {
4624 if(source && dest)
4625 {
4626 if(source->kind == 20 && dest->kind != 20)
4627 {
4628 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4629
4630 if(type)
4631 source = type;
4632 }
4633 if(dest->kind == 20 && source->kind != 20)
4634 {
4635 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4636
4637 if(type)
4638 dest = type;
4639 }
4640 if(dest->classObjectType == 2)
4641 {
4642 if(source->classObjectType != 3)
4643 return 0x1;
4644 else
4645 {
4646 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4647 {
4648 return 0x1;
4649 }
4650 }
4651 }
4652 else
4653 {
4654 if(source->classObjectType == 3)
4655 return 0x1;
4656 if(dest->classObjectType == 3 && source->classObjectType != 2)
4657 return 0x1;
4658 }
4659 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4660 {
4661 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4662 return 0x1;
4663 }
4664 if(dest->kind == 14 && source->kind != 0)
4665 return 0x1;
4666 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))
4667 return 0x1;
4668 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))
4669 return 0x1;
4670 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4671 {
4672 if(source->_class->registered && source->_class->registered->type == 3)
4673 {
4674 if(conversions != (((void *)0)))
4675 {
4676 if(source->_class->registered == dest->_class->registered)
4677 return 0x1;
4678 }
4679 else
4680 {
4681 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4682
4683 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4684 ;
4685 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4686 ;
4687 if(sourceBase == destBase)
4688 return 0x1;
4689 }
4690 }
4691 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))
4692 return 0x1;
4693 else
4694 {
4695 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && ((source->_class && source->_class->registered && source->_class->registered->type != 4) || source->kind == 8))
4696 {
4697 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4698 {
4699 return 0x1;
4700 }
4701 }
4702 }
4703 }
4704 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4705 return 0x1;
4706 if(doConversion)
4707 {
4708 if(source->kind == 8)
4709 {
4710 struct __ecereNameSpace__ecere__com__Class * _class;
4711
4712 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4713 {
4714 struct __ecereNameSpace__ecere__com__Property * convert;
4715
4716 for(convert = _class->conversions.first; convert; convert = convert->next)
4717 {
4718 if(convert->memberAccess == 1 || _class->module == privateModule)
4719 {
4720 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4721
4722 if(!convert->dataType)
4723 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4724 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4725 {
4726 if(!conversions && !convert->Get)
4727 return 0x1;
4728 else if(conversions != (((void *)0)))
4729 {
4730 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))
4731 return 0x1;
4732 else
4733 {
4734 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4735
4736 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4737 return 0x1;
4738 }
4739 }
4740 }
4741 }
4742 }
4743 }
4744 }
4745 if(dest->kind == 8)
4746 {
4747 struct __ecereNameSpace__ecere__com__Class * _class;
4748
4749 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4750 {
4751 struct __ecereNameSpace__ecere__com__Property * convert;
4752
4753 for(convert = _class->conversions.first; convert; convert = convert->next)
4754 {
4755 if(convert->memberAccess == 1 || _class->module == privateModule)
4756 {
4757 if(!convert->dataType)
4758 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4759 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4760 {
4761 if(!conversions && !convert->Set)
4762 return 0x1;
4763 else if(conversions != (((void *)0)))
4764 {
4765 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))
4766 return 0x1;
4767 else
4768 {
4769 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4770
4771 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4772 return 0x1;
4773 }
4774 }
4775 }
4776 }
4777 }
4778 }
4779 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4780 {
4781 if(!dest->_class->registered->dataType)
4782 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4783 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4784 {
4785 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4786 {
4787 return 0x1;
4788 }
4789 }
4790 }
4791 }
4792 if(source->kind == 8)
4793 {
4794 struct __ecereNameSpace__ecere__com__Class * _class;
4795
4796 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4797 {
4798 struct __ecereNameSpace__ecere__com__Property * convert;
4799
4800 for(convert = _class->conversions.first; convert; convert = convert->next)
4801 {
4802 if(convert->memberAccess == 1 || _class->module == privateModule)
4803 {
4804 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4805
4806 if(!convert->dataType)
4807 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4808 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4809 {
4810 if(!conversions && !convert->Get)
4811 return 0x1;
4812 else if(conversions != (((void *)0)))
4813 {
4814 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))
4815 return 0x1;
4816 else
4817 {
4818 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4819
4820 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4821 return 0x1;
4822 }
4823 }
4824 }
4825 }
4826 }
4827 }
4828 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4829 {
4830 if(!source->_class->registered->dataType)
4831 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4832 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4833 {
4834 return 0x1;
4835 }
4836 }
4837 }
4838 }
4839 if(source->kind == 8 || source->kind == 19)
4840 ;
4841 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4842 return 0x1;
4843 else if(dest->kind == 7 && source->kind == 6)
4844 return 0x1;
4845 else if(dest->kind == 2 && source->kind == 1)
4846 return 0x1;
4847 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 23))
4848 return 0x1;
4849 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 22 || source->kind == 23))
4850 return 0x1;
4851 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 23 || source->kind == 4))
4852 return 0x1;
4853 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4 || source->kind == 22))
4854 return 0x1;
4855 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22 || dest->kind == 23))
4856 return 0x1;
4857 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || source->kind == 4 || source->kind == 22 || source->kind == 23))
4858 return 0x1;
4859 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)))
4860 {
4861 struct Type * paramSource, * paramDest;
4862
4863 if(dest->kind == 16)
4864 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4865 if(source->kind == 16)
4866 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4867 if(dest->kind == 13 && dest->type->kind == 11)
4868 dest = dest->type;
4869 if(source->kind == 13 && source->type->kind == 11)
4870 source = source->type;
4871 if(dest->kind == 16)
4872 dest = dest->method->dataType;
4873 if(source->kind == 16)
4874 source = source->method->dataType;
4875 paramSource = source->params.first;
4876 if(paramSource && paramSource->kind == 0)
4877 paramSource = (((void *)0));
4878 paramDest = dest->params.first;
4879 if(paramDest && paramDest->kind == 0)
4880 paramDest = (((void *)0));
4881 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4882 {
4883 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))))
4884 {
4885 if(paramDest && paramDest->kind == 8)
4886 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4887 else
4888 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4889 return 0x0;
4890 }
4891 paramDest = paramDest->next;
4892 }
4893 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4894 {
4895 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4896 {
4897 if(dest->thisClass)
4898 {
4899 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4900 {
4901 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4902 return 0x0;
4903 }
4904 }
4905 else
4906 {
4907 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4908 {
4909 if(owningClassDest)
4910 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4911 else
4912 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4913 return 0x0;
4914 }
4915 }
4916 paramSource = paramSource->next;
4917 }
4918 else
4919 {
4920 if(dest->thisClass)
4921 {
4922 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4923 {
4924 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4925 return 0x0;
4926 }
4927 }
4928 else
4929 {
4930 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4931 {
4932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4933 return 0x0;
4934 }
4935 }
4936 }
4937 }
4938 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4939 {
4940 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4941 return 0x0;
4942 }
4943 for(; paramDest; paramDest = paramDest->next)
4944 {
4945 if(!paramSource)
4946 {
4947 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4948 return 0x0;
4949 }
4950 {
4951 struct Type * paramDestType = paramDest;
4952 struct Type * paramSourceType = paramSource;
4953 struct Type * type = paramDestType;
4954
4955 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4956 {
4957 int id = 0;
4958 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4959 struct __ecereNameSpace__ecere__com__Class * sClass;
4960
4961 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4962 {
4963 id = 0;
4964 if(sClass->templateClass)
4965 sClass = sClass->templateClass;
4966 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4967 {
4968 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4969 {
4970 for(sClass = sClass->base; sClass; sClass = sClass->base)
4971 {
4972 if(sClass->templateClass)
4973 sClass = sClass->templateClass;
4974 id += sClass->templateParams.count;
4975 }
4976 break;
4977 }
4978 id++;
4979 }
4980 if(curParam)
4981 break;
4982 }
4983 if(curParam)
4984 {
4985 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4986
4987 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4988 }
4989 }
4990 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)))
4991 {
4992 char type[1024];
4993
4994 type[0] = (char)0;
4995 PrintType(paramDest, type, 0x0, 0x1);
4996 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4997 if(paramDestType != paramDest)
4998 FreeType(paramDestType);
4999 return 0x0;
5000 }
5001 if(paramDestType != paramDest)
5002 FreeType(paramDestType);
5003 }
5004 paramSource = paramSource->next;
5005 }
5006 if(paramSource)
5007 {
5008 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
5009 return 0x0;
5010 }
5011 return 0x1;
5012 }
5013 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5014 {
5015 return 0x1;
5016 }
5017 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5018 {
5019 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5020 return 0x1;
5021 }
5022 }
5023 return 0x0;
5024 }
5025
5026 static void FreeConvert(struct Conversion * convert)
5027 {
5028 if(convert->resultType)
5029 FreeType(convert->resultType);
5030 }
5031
5032 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5033
5034 struct __ecereNameSpace__ecere__com__BTNamedLink
5035 {
5036 char *  name;
5037 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5038 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5039 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5040 int depth;
5041 void *  data;
5042 } __attribute__ ((gcc_struct));
5043
5044 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5045
5046 struct __ecereNameSpace__ecere__com__EnumClassData
5047 {
5048 struct __ecereNameSpace__ecere__sys__OldList values;
5049 int largest;
5050 } __attribute__ ((gcc_struct));
5051
5052 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5053
5054 struct __ecereNameSpace__ecere__sys__NamedLink
5055 {
5056 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5057 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5058 char *  name;
5059 void *  data;
5060 } __attribute__ ((gcc_struct));
5061
5062 extern void FreeExpContents(struct Expression * exp);
5063
5064 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5065
5066 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5067
5068 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5069
5070 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5071
5072 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5073
5074 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5075 {
5076 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5077
5078 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)))
5079 {
5080 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5081
5082 if(_class->type == 4)
5083 {
5084 struct __ecereNameSpace__ecere__sys__OldList converts = 
5085 {
5086 0, 0, 0, 0, 0
5087 };
5088 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5089
5090 type->kind = 8;
5091 if(!_class->symbol)
5092 _class->symbol = FindClass(_class->fullName);
5093 type->_class = _class->symbol;
5094 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5095 {
5096 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5097 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5098
5099 if(enumClass)
5100 {
5101 struct __ecereNameSpace__ecere__com__Class * baseClass;
5102
5103 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5104 {
5105 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5106
5107 for(value = e->values.first; value; value = value->next)
5108 {
5109 if(!strcmp(value->name, string))
5110 break;
5111 }
5112 if(value)
5113 {
5114 FreeExpContents(sourceExp);
5115 FreeType(sourceExp->expType);
5116 sourceExp->isConstant = 0x1;
5117 sourceExp->expType = MkClassType(baseClass->fullName);
5118 {
5119 char constant[256];
5120
5121 sourceExp->type = 2;
5122 if(!strcmp(baseClass->dataTypeString, "int"))
5123 sprintf(constant, "%d", (int)value->data);
5124 else
5125 sprintf(constant, "0x%X", (int)value->data);
5126 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5127 }
5128 while(converts.first)
5129 {
5130 struct Conversion * convert = converts.first;
5131
5132 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5133 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5134 }
5135 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5136 return 0x1;
5137 }
5138 }
5139 }
5140 }
5141 if(converts.first)
5142 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5143 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5144 }
5145 }
5146 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)))
5147 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5148 return 0x1;
5149 return 0x0;
5150 }
5151
5152 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5153
5154 struct __ecereNameSpace__ecere__com__SubModule
5155 {
5156 struct __ecereNameSpace__ecere__com__SubModule * prev;
5157 struct __ecereNameSpace__ecere__com__SubModule * next;
5158 struct __ecereNameSpace__ecere__com__Instance * module;
5159 int importMode;
5160 } __attribute__ ((gcc_struct));
5161
5162 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5163 {
5164 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5165
5166 if(searchFor == searchIn)
5167 return 0x1;
5168 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5169 {
5170 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5171 {
5172 if(ModuleVisibility(subModule->module, searchFor))
5173 return 0x1;
5174 }
5175 }
5176 return 0x0;
5177 }
5178
5179 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5180
5181 struct __ecereNameSpace__ecere__com__Application
5182 {
5183 int argc;
5184 char * *  argv;
5185 int exitCode;
5186 unsigned int isGUIApp;
5187 struct __ecereNameSpace__ecere__sys__OldList allModules;
5188 char *  parsedCommand;
5189 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5190 } __attribute__ ((gcc_struct));
5191
5192 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5193 {
5194 struct __ecereNameSpace__ecere__com__Instance * module;
5195
5196 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->systemNameSpace, sourceExp, dest, string, conversions))
5197 return 0x1;
5198 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->privateNameSpace, sourceExp, dest, string, conversions))
5199 return 0x1;
5200 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5201 return 0x1;
5202 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->next)
5203 {
5204 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5205 return 0x1;
5206 }
5207 return 0x0;
5208 }
5209
5210 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5211
5212 void ReadString(char *  output, char *  string);
5213
5214 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5215
5216 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5217
5218 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5219
5220 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5221 {
5222 struct Type * source = sourceExp->expType;
5223 struct Type * realDest = dest;
5224 struct Type * backupSourceExpType = (((void *)0));
5225
5226 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5227 return 0x1;
5228 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5229 {
5230 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5231 {
5232 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5233
5234 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5235 ;
5236 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5237 ;
5238 if(sourceBase == destBase)
5239 return 0x1;
5240 }
5241 }
5242 if(source)
5243 {
5244 struct __ecereNameSpace__ecere__sys__OldList * specs;
5245 unsigned int flag = 0x0;
5246 long long value = (((int)0x7fffffff));
5247
5248 source->refCount++;
5249 dest->refCount++;
5250 if(sourceExp->type == 2)
5251 {
5252 if(source->isSigned)
5253 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5254 else
5255 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5256 }
5257 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5258 {
5259 if(source->isSigned)
5260 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5261 else
5262 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5263 }
5264 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5265 {
5266 FreeType(source);
5267 source = __extension__ ({
5268 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5269
5270 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5271 });
5272 }
5273 if(dest->kind == 8)
5274 {
5275 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5276
5277 if(_class && _class->type == 3)
5278 {
5279 if(source->kind != 8)
5280 {
5281 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5282 struct Type * tempDest, * tempSource;
5283
5284 for(; _class->base->type != 1000; _class = _class->base)
5285 ;
5286 tempSource = dest;
5287 tempDest = tempType;
5288 tempType->kind = 8;
5289 if(!_class->symbol)
5290 _class->symbol = FindClass(_class->fullName);
5291 tempType->_class = _class->symbol;
5292 tempType->truth = dest->truth;
5293 if(tempType->_class)
5294 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5295 backupSourceExpType = sourceExp->expType;
5296 sourceExp->expType = dest;
5297 dest->refCount++;
5298 flag = 0x1;
5299 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5300 }
5301 }
5302 if(_class && _class->type == 2 && source->kind != 8)
5303 {
5304 if(!dest->_class->registered->dataType)
5305 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5306 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5307 {
5308 FreeType(source);
5309 FreeType(sourceExp->expType);
5310 source = sourceExp->expType = MkClassType(dest->_class->string);
5311 source->refCount++;
5312 }
5313 }
5314 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5315 {
5316 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5317 struct Declarator * decl;
5318 char string[1024];
5319
5320 ReadString(string, sourceExp->string);
5321 decl = SpecDeclFromString(string, specs, (((void *)0)));
5322 FreeExpContents(sourceExp);
5323 FreeType(sourceExp->expType);
5324 sourceExp->type = 26;
5325 sourceExp->_classExp.specifiers = specs;
5326 sourceExp->_classExp.decl = decl;
5327 sourceExp->expType = dest;
5328 dest->refCount++;
5329 FreeType(source);
5330 FreeType(dest);
5331 if(backupSourceExpType)
5332 FreeType(backupSourceExpType);
5333 return 0x1;
5334 }
5335 }
5336 else if(source->kind == 8)
5337 {
5338 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5339
5340 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5341 {
5342 if(dest->kind != 8)
5343 {
5344 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5345 struct Type * tempDest, * tempSource;
5346
5347 if(!source->_class->registered->dataType)
5348 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5349 for(; _class->base->type != 1000; _class = _class->base)
5350 ;
5351 tempDest = source;
5352 tempSource = tempType;
5353 tempType->kind = 8;
5354 tempType->_class = FindClass(_class->fullName);
5355 tempType->truth = source->truth;
5356 tempType->classObjectType = source->classObjectType;
5357 if(tempType->_class)
5358 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5359 if(conversions->last)
5360 {
5361 ((struct Conversion *)conversions->last)->resultType = dest;
5362 dest->refCount++;
5363 }
5364 FreeType(sourceExp->expType);
5365 sourceExp->expType = MkClassType(_class->fullName);
5366 sourceExp->expType->truth = source->truth;
5367 sourceExp->expType->classObjectType = source->classObjectType;
5368 if(!sourceExp->destType)
5369 {
5370 FreeType(sourceExp->destType);
5371 sourceExp->destType = sourceExp->expType;
5372 if(sourceExp->expType)
5373 sourceExp->expType->refCount++;
5374 }
5375 if(!_class->dataType)
5376 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5377 FreeType(dest);
5378 dest = MkClassType(source->_class->string);
5379 dest->truth = source->truth;
5380 dest->classObjectType = source->classObjectType;
5381 FreeType(source);
5382 source = _class->dataType;
5383 source->refCount++;
5384 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5385 }
5386 }
5387 }
5388 if(!flag)
5389 {
5390 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5391 {
5392 FreeType(source);
5393 FreeType(dest);
5394 return 0x1;
5395 }
5396 }
5397 if(dest->kind == 8)
5398 {
5399 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5400
5401 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5402 {
5403 if(_class->type == 0 || _class->type == 5)
5404 {
5405 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5406
5407 *newExp = *sourceExp;
5408 if(sourceExp->destType)
5409 sourceExp->destType->refCount++;
5410 if(sourceExp->expType)
5411 sourceExp->expType->refCount++;
5412 sourceExp->type = 11;
5413 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5414 sourceExp->cast.exp = newExp;
5415 FreeType(sourceExp->expType);
5416 sourceExp->expType = (((void *)0));
5417 ProcessExpressionType(sourceExp);
5418 if(!inCompiler)
5419 {
5420 FreeType(sourceExp->expType);
5421 sourceExp->expType = dest;
5422 }
5423 FreeType(source);
5424 if(inCompiler)
5425 FreeType(dest);
5426 if(backupSourceExpType)
5427 FreeType(backupSourceExpType);
5428 return 0x1;
5429 }
5430 if(!_class->dataType)
5431 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5432 FreeType(dest);
5433 dest = _class->dataType;
5434 dest->refCount++;
5435 }
5436 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5437 {
5438 specs = MkListOne(MkSpecifier(DOUBLE));
5439 }
5440 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5441 {
5442 specs = MkListOne(MkSpecifier(FLOAT));
5443 }
5444 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5445 {
5446 specs = MkList();
5447 if(!dest->isSigned)
5448 ListAdd(specs, MkSpecifier(UNSIGNED));
5449 ListAdd(specs, MkSpecifier(INT64));
5450 }
5451 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5452 {
5453 specs = MkList();
5454 if(!dest->isSigned)
5455 ListAdd(specs, MkSpecifier(UNSIGNED));
5456 ListAdd(specs, MkSpecifier(INT));
5457 }
5458 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5459 {
5460 specs = MkList();
5461 if(!dest->isSigned)
5462 ListAdd(specs, MkSpecifier(UNSIGNED));
5463 ListAdd(specs, MkSpecifier(SHORT));
5464 }
5465 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5466 {
5467 specs = MkList();
5468 if(!dest->isSigned)
5469 ListAdd(specs, MkSpecifier(UNSIGNED));
5470 ListAdd(specs, MkSpecifier(CHAR));
5471 }
5472 else
5473 {
5474 FreeType(source);
5475 FreeType(dest);
5476 if(backupSourceExpType)
5477 {
5478 if(sourceExp->expType)
5479 FreeType(sourceExp->expType);
5480 sourceExp->expType = backupSourceExpType;
5481 }
5482 return 0x0;
5483 }
5484 }
5485 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))
5486 {
5487 specs = MkListOne(MkSpecifier(DOUBLE));
5488 }
5489 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5490 {
5491 specs = MkListOne(MkSpecifier(FLOAT));
5492 }
5493 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)))
5494 {
5495 specs = MkList();
5496 if(!dest->isSigned)
5497 ListAdd(specs, MkSpecifier(UNSIGNED));
5498 ListAdd(specs, MkSpecifier(CHAR));
5499 }
5500 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)))))
5501 {
5502 specs = MkList();
5503 if(!dest->isSigned)
5504 ListAdd(specs, MkSpecifier(UNSIGNED));
5505 ListAdd(specs, MkSpecifier(SHORT));
5506 }
5507 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5508 {
5509 specs = MkList();
5510 if(!dest->isSigned)
5511 ListAdd(specs, MkSpecifier(UNSIGNED));
5512 ListAdd(specs, MkSpecifier(INT));
5513 }
5514 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5515 {
5516 specs = MkList();
5517 if(!dest->isSigned)
5518 ListAdd(specs, MkSpecifier(UNSIGNED));
5519 ListAdd(specs, MkSpecifier(INT64));
5520 }
5521 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5522 {
5523 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5524 }
5525 else
5526 {
5527 FreeType(source);
5528 FreeType(dest);
5529 if(backupSourceExpType)
5530 {
5531 if(sourceExp->expType)
5532 FreeType(sourceExp->expType);
5533 sourceExp->expType = backupSourceExpType;
5534 }
5535 return 0x0;
5536 }
5537 if(!flag)
5538 {
5539 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5540
5541 *newExp = *sourceExp;
5542 newExp->prev = (((void *)0));
5543 newExp->next = (((void *)0));
5544 if(sourceExp->destType)
5545 sourceExp->destType->refCount++;
5546 if(sourceExp->expType)
5547 sourceExp->expType->refCount++;
5548 sourceExp->type = 11;
5549 if(realDest->kind == 8)
5550 {
5551 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5552 FreeList(specs, FreeSpecifier);
5553 }
5554 else
5555 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5556 if(newExp->type == 4)
5557 {
5558 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5559 }
5560 else
5561 sourceExp->cast.exp = newExp;
5562 FreeType(sourceExp->expType);
5563 sourceExp->expType = (((void *)0));
5564 ProcessExpressionType(sourceExp);
5565 }
5566 else
5567 FreeList(specs, FreeSpecifier);
5568 FreeType(dest);
5569 FreeType(source);
5570 if(backupSourceExpType)
5571 FreeType(backupSourceExpType);
5572 return 0x1;
5573 }
5574 else
5575 {
5576 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5577 sourceExp = (*sourceExp->list).last;
5578 if(sourceExp->type == 0)
5579 {
5580 struct Identifier * id = sourceExp->identifier;
5581
5582 if(dest->kind == 8)
5583 {
5584 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5585 {
5586 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5587 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5588
5589 if(enumClass)
5590 {
5591 for(; _class && _class->type == 4; _class = _class->base)
5592 {
5593 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5594 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5595
5596 for(value = e->values.first; value; value = value->next)
5597 {
5598 if(!strcmp(value->name, id->string))
5599 break;
5600 }
5601 if(value)
5602 {
5603 FreeExpContents(sourceExp);
5604 FreeType(sourceExp->expType);
5605 sourceExp->isConstant = 0x1;
5606 sourceExp->expType = MkClassType(_class->fullName);
5607 {
5608 char constant[256];
5609
5610 sourceExp->type = 2;
5611 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5612 sprintf(constant, "%d", (int)value->data);
5613 else
5614 sprintf(constant, "0x%X", (int)value->data);
5615 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5616 }
5617 return 0x1;
5618 }
5619 }
5620 }
5621 }
5622 }
5623 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5624 return 0x1;
5625 }
5626 }
5627 return 0x0;
5628 }
5629
5630 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5631 {
5632 int value2 = op2->i;
5633
5634 exp->type = 2;
5635 exp->string = PrintInt(op1->i + value2);
5636 if(!exp->expType)
5637 {
5638 exp->expType = op1->type;
5639 if(op1->type)
5640 op1->type->refCount++;
5641 }
5642 return 0x1;
5643 }
5644
5645 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5646 {
5647 unsigned int value2 = op2->ui;
5648
5649 exp->type = 2;
5650 exp->string = PrintUInt(op1->ui + value2);
5651 if(!exp->expType)
5652 {
5653 exp->expType = op1->type;
5654 if(op1->type)
5655 op1->type->refCount++;
5656 }
5657 return 0x1;
5658 }
5659
5660 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5661 {
5662 short value2 = op2->s;
5663
5664 exp->type = 2;
5665 exp->string = PrintShort(op1->s + value2);
5666 if(!exp->expType)
5667 {
5668 exp->expType = op1->type;
5669 if(op1->type)
5670 op1->type->refCount++;
5671 }
5672 return 0x1;
5673 }
5674
5675 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5676 {
5677 unsigned short value2 = op2->us;
5678
5679 exp->type = 2;
5680 exp->string = PrintUShort(op1->us + value2);
5681 if(!exp->expType)
5682 {
5683 exp->expType = op1->type;
5684 if(op1->type)
5685 op1->type->refCount++;
5686 }
5687 return 0x1;
5688 }
5689
5690 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5691 {
5692 char value2 = op2->c;
5693
5694 exp->type = 2;
5695 exp->string = PrintChar(op1->c + value2);
5696 if(!exp->expType)
5697 {
5698 exp->expType = op1->type;
5699 if(op1->type)
5700 op1->type->refCount++;
5701 }
5702 return 0x1;
5703 }
5704
5705 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5706 {
5707 unsigned char value2 = op2->uc;
5708
5709 exp->type = 2;
5710 exp->string = PrintUChar(op1->uc + value2);
5711 if(!exp->expType)
5712 {
5713 exp->expType = op1->type;
5714 if(op1->type)
5715 op1->type->refCount++;
5716 }
5717 return 0x1;
5718 }
5719
5720 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5721 {
5722 float value2 = op2->f;
5723
5724 exp->type = 2;
5725 exp->string = PrintFloat(op1->f + value2);
5726 if(!exp->expType)
5727 {
5728 exp->expType = op1->type;
5729 if(op1->type)
5730 op1->type->refCount++;
5731 }
5732 return 0x1;
5733 }
5734
5735 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5736 {
5737 double value2 = op2->d;
5738
5739 exp->type = 2;
5740 exp->string = PrintDouble(op1->d + value2);
5741 if(!exp->expType)
5742 {
5743 exp->expType = op1->type;
5744 if(op1->type)
5745 op1->type->refCount++;
5746 }
5747 return 0x1;
5748 }
5749
5750 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5751 {
5752 int value2 = op2->i;
5753
5754 exp->type = 2;
5755 exp->string = PrintInt(op1->i - value2);
5756 if(!exp->expType)
5757 {
5758 exp->expType = op1->type;
5759 if(op1->type)
5760 op1->type->refCount++;
5761 }
5762 return 0x1;
5763 }
5764
5765 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5766 {
5767 unsigned int value2 = op2->ui;
5768
5769 exp->type = 2;
5770 exp->string = PrintUInt(op1->ui - value2);
5771 if(!exp->expType)
5772 {
5773 exp->expType = op1->type;
5774 if(op1->type)
5775 op1->type->refCount++;
5776 }
5777 return 0x1;
5778 }
5779
5780 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5781 {
5782 short value2 = op2->s;
5783
5784 exp->type = 2;
5785 exp->string = PrintShort(op1->s - value2);
5786 if(!exp->expType)
5787 {
5788 exp->expType = op1->type;
5789 if(op1->type)
5790 op1->type->refCount++;
5791 }
5792 return 0x1;
5793 }
5794
5795 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5796 {
5797 unsigned short value2 = op2->us;
5798
5799 exp->type = 2;
5800 exp->string = PrintUShort(op1->us - value2);
5801 if(!exp->expType)
5802 {
5803 exp->expType = op1->type;
5804 if(op1->type)
5805 op1->type->refCount++;
5806 }
5807 return 0x1;
5808 }
5809
5810 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5811 {
5812 char value2 = op2->c;
5813
5814 exp->type = 2;
5815 exp->string = PrintChar(op1->c - value2);
5816 if(!exp->expType)
5817 {
5818 exp->expType = op1->type;
5819 if(op1->type)
5820 op1->type->refCount++;
5821 }
5822 return 0x1;
5823 }
5824
5825 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5826 {
5827 unsigned char value2 = op2->uc;
5828
5829 exp->type = 2;
5830 exp->string = PrintUChar(op1->uc - value2);
5831 if(!exp->expType)
5832 {
5833 exp->expType = op1->type;
5834 if(op1->type)
5835 op1->type->refCount++;
5836 }
5837 return 0x1;
5838 }
5839
5840 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5841 {
5842 float value2 = op2->f;
5843
5844 exp->type = 2;
5845 exp->string = PrintFloat(op1->f - value2);
5846 if(!exp->expType)
5847 {
5848 exp->expType = op1->type;
5849 if(op1->type)
5850 op1->type->refCount++;
5851 }
5852 return 0x1;
5853 }
5854
5855 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5856 {
5857 double value2 = op2->d;
5858
5859 exp->type = 2;
5860 exp->string = PrintDouble(op1->d - value2);
5861 if(!exp->expType)
5862 {
5863 exp->expType = op1->type;
5864 if(op1->type)
5865 op1->type->refCount++;
5866 }
5867 return 0x1;
5868 }
5869
5870 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5871 {
5872 int value2 = op2->i;
5873
5874 exp->type = 2;
5875 exp->string = PrintInt(op1->i * value2);
5876 if(!exp->expType)
5877 {
5878 exp->expType = op1->type;
5879 if(op1->type)
5880 op1->type->refCount++;
5881 }
5882 return 0x1;
5883 }
5884
5885 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5886 {
5887 unsigned int value2 = op2->ui;
5888
5889 exp->type = 2;
5890 exp->string = PrintUInt(op1->ui * value2);
5891 if(!exp->expType)
5892 {
5893 exp->expType = op1->type;
5894 if(op1->type)
5895 op1->type->refCount++;
5896 }
5897 return 0x1;
5898 }
5899
5900 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5901 {
5902 short value2 = op2->s;
5903
5904 exp->type = 2;
5905 exp->string = PrintShort(op1->s * value2);
5906 if(!exp->expType)
5907 {
5908 exp->expType = op1->type;
5909 if(op1->type)
5910 op1->type->refCount++;
5911 }
5912 return 0x1;
5913 }
5914
5915 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5916 {
5917 unsigned short value2 = op2->us;
5918
5919 exp->type = 2;
5920 exp->string = PrintUShort(op1->us * value2);
5921 if(!exp->expType)
5922 {
5923 exp->expType = op1->type;
5924 if(op1->type)
5925 op1->type->refCount++;
5926 }
5927 return 0x1;
5928 }
5929
5930 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5931 {
5932 char value2 = op2->c;
5933
5934 exp->type = 2;
5935 exp->string = PrintChar(op1->c * value2);
5936 if(!exp->expType)
5937 {
5938 exp->expType = op1->type;
5939 if(op1->type)
5940 op1->type->refCount++;
5941 }
5942 return 0x1;
5943 }
5944
5945 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5946 {
5947 unsigned char value2 = op2->uc;
5948
5949 exp->type = 2;
5950 exp->string = PrintUChar(op1->uc * value2);
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 FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5961 {
5962 float value2 = op2->f;
5963
5964 exp->type = 2;
5965 exp->string = PrintFloat(op1->f * value2);
5966 if(!exp->expType)
5967 {
5968 exp->expType = op1->type;
5969 if(op1->type)
5970 op1->type->refCount++;
5971 }
5972 return 0x1;
5973 }
5974
5975 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5976 {
5977 double value2 = op2->d;
5978
5979 exp->type = 2;
5980 exp->string = PrintDouble(op1->d * value2);
5981 if(!exp->expType)
5982 {
5983 exp->expType = op1->type;
5984 if(op1->type)
5985 op1->type->refCount++;
5986 }
5987 return 0x1;
5988 }
5989
5990 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5991 {
5992 int value2 = op2->i;
5993
5994 exp->type = 2;
5995 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5996 if(!exp->expType)
5997 {
5998 exp->expType = op1->type;
5999 if(op1->type)
6000 op1->type->refCount++;
6001 }
6002 return 0x1;
6003 }
6004
6005 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6006 {
6007 unsigned int value2 = op2->ui;
6008
6009 exp->type = 2;
6010 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6011 if(!exp->expType)
6012 {
6013 exp->expType = op1->type;
6014 if(op1->type)
6015 op1->type->refCount++;
6016 }
6017 return 0x1;
6018 }
6019
6020 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6021 {
6022 short value2 = op2->s;
6023
6024 exp->type = 2;
6025 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6026 if(!exp->expType)
6027 {
6028 exp->expType = op1->type;
6029 if(op1->type)
6030 op1->type->refCount++;
6031 }
6032 return 0x1;
6033 }
6034
6035 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6036 {
6037 unsigned short value2 = op2->us;
6038
6039 exp->type = 2;
6040 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6041 if(!exp->expType)
6042 {
6043 exp->expType = op1->type;
6044 if(op1->type)
6045 op1->type->refCount++;
6046 }
6047 return 0x1;
6048 }
6049
6050 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6051 {
6052 char value2 = op2->c;
6053
6054 exp->type = 2;
6055 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6056 if(!exp->expType)
6057 {
6058 exp->expType = op1->type;
6059 if(op1->type)
6060 op1->type->refCount++;
6061 }
6062 return 0x1;
6063 }
6064
6065 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6066 {
6067 unsigned char value2 = op2->uc;
6068
6069 exp->type = 2;
6070 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6071 if(!exp->expType)
6072 {
6073 exp->expType = op1->type;
6074 if(op1->type)
6075 op1->type->refCount++;
6076 }
6077 return 0x1;
6078 }
6079
6080 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6081 {
6082 float value2 = op2->f;
6083
6084 exp->type = 2;
6085 exp->string = PrintFloat(value2 ? (op1->f / value2) : 0);
6086 if(!exp->expType)
6087 {
6088 exp->expType = op1->type;
6089 if(op1->type)
6090 op1->type->refCount++;
6091 }
6092 return 0x1;
6093 }
6094
6095 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6096 {
6097 double value2 = op2->d;
6098
6099 exp->type = 2;
6100 exp->string = PrintDouble(value2 ? (op1->d / value2) : 0);
6101 if(!exp->expType)
6102 {
6103 exp->expType = op1->type;
6104 if(op1->type)
6105 op1->type->refCount++;
6106 }
6107 return 0x1;
6108 }
6109
6110 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6111 {
6112 int value2 = op2->i;
6113
6114 exp->type = 2;
6115 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6116 if(!exp->expType)
6117 {
6118 exp->expType = op1->type;
6119 if(op1->type)
6120 op1->type->refCount++;
6121 }
6122 return 0x1;
6123 }
6124
6125 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6126 {
6127 unsigned int value2 = op2->ui;
6128
6129 exp->type = 2;
6130 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6131 if(!exp->expType)
6132 {
6133 exp->expType = op1->type;
6134 if(op1->type)
6135 op1->type->refCount++;
6136 }
6137 return 0x1;
6138 }
6139
6140 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6141 {
6142 short value2 = op2->s;
6143
6144 exp->type = 2;
6145 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
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 UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6156 {
6157 unsigned short value2 = op2->us;
6158
6159 exp->type = 2;
6160 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6161 if(!exp->expType)
6162 {
6163 exp->expType = op1->type;
6164 if(op1->type)
6165 op1->type->refCount++;
6166 }
6167 return 0x1;
6168 }
6169
6170 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6171 {
6172 char value2 = op2->c;
6173
6174 exp->type = 2;
6175 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6176 if(!exp->expType)
6177 {
6178 exp->expType = op1->type;
6179 if(op1->type)
6180 op1->type->refCount++;
6181 }
6182 return 0x1;
6183 }
6184
6185 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6186 {
6187 unsigned char value2 = op2->uc;
6188
6189 exp->type = 2;
6190 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6191 if(!exp->expType)
6192 {
6193 exp->expType = op1->type;
6194 if(op1->type)
6195 op1->type->refCount++;
6196 }
6197 return 0x1;
6198 }
6199
6200 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6201 {
6202 exp->type = 2;
6203 exp->string = PrintInt((-op1->i));
6204 if(!exp->expType)
6205 {
6206 exp->expType = op1->type;
6207 if(op1->type)
6208 op1->type->refCount++;
6209 }
6210 return 0x1;
6211 }
6212
6213 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6214 {
6215 exp->type = 2;
6216 exp->string = PrintUInt((unsigned int)(-op1->ui));
6217 if(!exp->expType)
6218 {
6219 exp->expType = op1->type;
6220 if(op1->type)
6221 op1->type->refCount++;
6222 }
6223 return 0x1;
6224 }
6225
6226 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6227 {
6228 exp->type = 2;
6229 exp->string = PrintShort((-op1->s));
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 UShortNeg(struct Expression * exp, struct Operand * op1)
6240 {
6241 exp->type = 2;
6242 exp->string = PrintUShort((unsigned short)(-op1->us));
6243 if(!exp->expType)
6244 {
6245 exp->expType = op1->type;
6246 if(op1->type)
6247 op1->type->refCount++;
6248 }
6249 return 0x1;
6250 }
6251
6252 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6253 {
6254 exp->type = 2;
6255 exp->string = PrintChar((-op1->c));
6256 if(!exp->expType)
6257 {
6258 exp->expType = op1->type;
6259 if(op1->type)
6260 op1->type->refCount++;
6261 }
6262 return 0x1;
6263 }
6264
6265 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6266 {
6267 exp->type = 2;
6268 exp->string = PrintUChar((unsigned char)(-op1->uc));
6269 if(!exp->expType)
6270 {
6271 exp->expType = op1->type;
6272 if(op1->type)
6273 op1->type->refCount++;
6274 }
6275 return 0x1;
6276 }
6277
6278 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6279 {
6280 exp->type = 2;
6281 exp->string = PrintFloat((float)(-op1->f));
6282 if(!exp->expType)
6283 {
6284 exp->expType = op1->type;
6285 if(op1->type)
6286 op1->type->refCount++;
6287 }
6288 return 0x1;
6289 }
6290
6291 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6292 {
6293 exp->type = 2;
6294 exp->string = PrintDouble((double)(-op1->d));
6295 if(!exp->expType)
6296 {
6297 exp->expType = op1->type;
6298 if(op1->type)
6299 op1->type->refCount++;
6300 }
6301 return 0x1;
6302 }
6303
6304 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6305 {
6306 exp->type = 2;
6307 exp->string = PrintInt((++op1->i));
6308 if(!exp->expType)
6309 {
6310 exp->expType = op1->type;
6311 if(op1->type)
6312 op1->type->refCount++;
6313 }
6314 return 0x1;
6315 }
6316
6317 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6318 {
6319 exp->type = 2;
6320 exp->string = PrintUInt((++op1->ui));
6321 if(!exp->expType)
6322 {
6323 exp->expType = op1->type;
6324 if(op1->type)
6325 op1->type->refCount++;
6326 }
6327 return 0x1;
6328 }
6329
6330 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6331 {
6332 exp->type = 2;
6333 exp->string = PrintShort((++op1->s));
6334 if(!exp->expType)
6335 {
6336 exp->expType = op1->type;
6337 if(op1->type)
6338 op1->type->refCount++;
6339 }
6340 return 0x1;
6341 }
6342
6343 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6344 {
6345 exp->type = 2;
6346 exp->string = PrintUShort((++op1->us));
6347 if(!exp->expType)
6348 {
6349 exp->expType = op1->type;
6350 if(op1->type)
6351 op1->type->refCount++;
6352 }
6353 return 0x1;
6354 }
6355
6356 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6357 {
6358 exp->type = 2;
6359 exp->string = PrintChar((++op1->c));
6360 if(!exp->expType)
6361 {
6362 exp->expType = op1->type;
6363 if(op1->type)
6364 op1->type->refCount++;
6365 }
6366 return 0x1;
6367 }
6368
6369 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6370 {
6371 exp->type = 2;
6372 exp->string = PrintUChar((++op1->uc));
6373 if(!exp->expType)
6374 {
6375 exp->expType = op1->type;
6376 if(op1->type)
6377 op1->type->refCount++;
6378 }
6379 return 0x1;
6380 }
6381
6382 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6383 {
6384 exp->type = 2;
6385 exp->string = PrintFloat((float)(++op1->f));
6386 if(!exp->expType)
6387 {
6388 exp->expType = op1->type;
6389 if(op1->type)
6390 op1->type->refCount++;
6391 }
6392 return 0x1;
6393 }
6394
6395 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6396 {
6397 exp->type = 2;
6398 exp->string = PrintDouble((double)(++op1->d));
6399 if(!exp->expType)
6400 {
6401 exp->expType = op1->type;
6402 if(op1->type)
6403 op1->type->refCount++;
6404 }
6405 return 0x1;
6406 }
6407
6408 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6409 {
6410 exp->type = 2;
6411 exp->string = PrintInt((--op1->i));
6412 if(!exp->expType)
6413 {
6414 exp->expType = op1->type;
6415 if(op1->type)
6416 op1->type->refCount++;
6417 }
6418 return 0x1;
6419 }
6420
6421 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6422 {
6423 exp->type = 2;
6424 exp->string = PrintUInt((--op1->ui));
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 ShortDec(struct Expression * exp, struct Operand * op1)
6435 {
6436 exp->type = 2;
6437 exp->string = PrintShort((--op1->s));
6438 if(!exp->expType)
6439 {
6440 exp->expType = op1->type;
6441 if(op1->type)
6442 op1->type->refCount++;
6443 }
6444 return 0x1;
6445 }
6446
6447 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6448 {
6449 exp->type = 2;
6450 exp->string = PrintUShort((--op1->us));
6451 if(!exp->expType)
6452 {
6453 exp->expType = op1->type;
6454 if(op1->type)
6455 op1->type->refCount++;
6456 }
6457 return 0x1;
6458 }
6459
6460 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6461 {
6462 exp->type = 2;
6463 exp->string = PrintChar((--op1->c));
6464 if(!exp->expType)
6465 {
6466 exp->expType = op1->type;
6467 if(op1->type)
6468 op1->type->refCount++;
6469 }
6470 return 0x1;
6471 }
6472
6473 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6474 {
6475 exp->type = 2;
6476 exp->string = PrintUChar((--op1->uc));
6477 if(!exp->expType)
6478 {
6479 exp->expType = op1->type;
6480 if(op1->type)
6481 op1->type->refCount++;
6482 }
6483 return 0x1;
6484 }
6485
6486 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6487 {
6488 exp->type = 2;
6489 exp->string = PrintFloat((float)(--op1->f));
6490 if(!exp->expType)
6491 {
6492 exp->expType = op1->type;
6493 if(op1->type)
6494 op1->type->refCount++;
6495 }
6496 return 0x1;
6497 }
6498
6499 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6500 {
6501 exp->type = 2;
6502 exp->string = PrintDouble((double)(--op1->d));
6503 if(!exp->expType)
6504 {
6505 exp->expType = op1->type;
6506 if(op1->type)
6507 op1->type->refCount++;
6508 }
6509 return 0x1;
6510 }
6511
6512 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6513 {
6514 int value2 = op2->i;
6515
6516 exp->type = 2;
6517 exp->string = PrintInt(op1->i = value2);
6518 if(!exp->expType)
6519 {
6520 exp->expType = op1->type;
6521 if(op1->type)
6522 op1->type->refCount++;
6523 }
6524 return 0x1;
6525 }
6526
6527 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6528 {
6529 unsigned int value2 = op2->ui;
6530
6531 exp->type = 2;
6532 exp->string = PrintUInt(op1->ui = value2);
6533 if(!exp->expType)
6534 {
6535 exp->expType = op1->type;
6536 if(op1->type)
6537 op1->type->refCount++;
6538 }
6539 return 0x1;
6540 }
6541
6542 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6543 {
6544 short value2 = op2->s;
6545
6546 exp->type = 2;
6547 exp->string = PrintShort(op1->s = value2);
6548 if(!exp->expType)
6549 {
6550 exp->expType = op1->type;
6551 if(op1->type)
6552 op1->type->refCount++;
6553 }
6554 return 0x1;
6555 }
6556
6557 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6558 {
6559 unsigned short value2 = op2->us;
6560
6561 exp->type = 2;
6562 exp->string = PrintUShort(op1->us = value2);
6563 if(!exp->expType)
6564 {
6565 exp->expType = op1->type;
6566 if(op1->type)
6567 op1->type->refCount++;
6568 }
6569 return 0x1;
6570 }
6571
6572 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6573 {
6574 char value2 = op2->c;
6575
6576 exp->type = 2;
6577 exp->string = PrintChar(op1->c = value2);
6578 if(!exp->expType)
6579 {
6580 exp->expType = op1->type;
6581 if(op1->type)
6582 op1->type->refCount++;
6583 }
6584 return 0x1;
6585 }
6586
6587 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6588 {
6589 unsigned char value2 = op2->uc;
6590
6591 exp->type = 2;
6592 exp->string = PrintUChar(op1->uc = value2);
6593 if(!exp->expType)
6594 {
6595 exp->expType = op1->type;
6596 if(op1->type)
6597 op1->type->refCount++;
6598 }
6599 return 0x1;
6600 }
6601
6602 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6603 {
6604 float value2 = op2->f;
6605
6606 exp->type = 2;
6607 exp->string = PrintFloat(op1->f = value2);
6608 if(!exp->expType)
6609 {
6610 exp->expType = op1->type;
6611 if(op1->type)
6612 op1->type->refCount++;
6613 }
6614 return 0x1;
6615 }
6616
6617 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6618 {
6619 double value2 = op2->d;
6620
6621 exp->type = 2;
6622 exp->string = PrintDouble(op1->d = value2);
6623 if(!exp->expType)
6624 {
6625 exp->expType = op1->type;
6626 if(op1->type)
6627 op1->type->refCount++;
6628 }
6629 return 0x1;
6630 }
6631
6632 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6633 {
6634 int value2 = op2->i;
6635
6636 exp->type = 2;
6637 exp->string = PrintInt(op1->i += value2);
6638 if(!exp->expType)
6639 {
6640 exp->expType = op1->type;
6641 if(op1->type)
6642 op1->type->refCount++;
6643 }
6644 return 0x1;
6645 }
6646
6647 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6648 {
6649 unsigned int value2 = op2->ui;
6650
6651 exp->type = 2;
6652 exp->string = PrintUInt(op1->ui += value2);
6653 if(!exp->expType)
6654 {
6655 exp->expType = op1->type;
6656 if(op1->type)
6657 op1->type->refCount++;
6658 }
6659 return 0x1;
6660 }
6661
6662 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6663 {
6664 short value2 = op2->s;
6665
6666 exp->type = 2;
6667 exp->string = PrintShort(op1->s += value2);
6668 if(!exp->expType)
6669 {
6670 exp->expType = op1->type;
6671 if(op1->type)
6672 op1->type->refCount++;
6673 }
6674 return 0x1;
6675 }
6676
6677 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6678 {
6679 unsigned short value2 = op2->us;
6680
6681 exp->type = 2;
6682 exp->string = PrintUShort(op1->us += value2);
6683 if(!exp->expType)
6684 {
6685 exp->expType = op1->type;
6686 if(op1->type)
6687 op1->type->refCount++;
6688 }
6689 return 0x1;
6690 }
6691
6692 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6693 {
6694 char value2 = op2->c;
6695
6696 exp->type = 2;
6697 exp->string = PrintChar(op1->c += value2);
6698 if(!exp->expType)
6699 {
6700 exp->expType = op1->type;
6701 if(op1->type)
6702 op1->type->refCount++;
6703 }
6704 return 0x1;
6705 }
6706
6707 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6708 {
6709 unsigned char value2 = op2->uc;
6710
6711 exp->type = 2;
6712 exp->string = PrintUChar(op1->uc += value2);
6713 if(!exp->expType)
6714 {
6715 exp->expType = op1->type;
6716 if(op1->type)
6717 op1->type->refCount++;
6718 }
6719 return 0x1;
6720 }
6721
6722 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6723 {
6724 float value2 = op2->f;
6725
6726 exp->type = 2;
6727 exp->string = PrintFloat(op1->f += value2);
6728 if(!exp->expType)
6729 {
6730 exp->expType = op1->type;
6731 if(op1->type)
6732 op1->type->refCount++;
6733 }
6734 return 0x1;
6735 }
6736
6737 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6738 {
6739 double value2 = op2->d;
6740
6741 exp->type = 2;
6742 exp->string = PrintDouble(op1->d += value2);
6743 if(!exp->expType)
6744 {
6745 exp->expType = op1->type;
6746 if(op1->type)
6747 op1->type->refCount++;
6748 }
6749 return 0x1;
6750 }
6751
6752 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6753 {
6754 int value2 = op2->i;
6755
6756 exp->type = 2;
6757 exp->string = PrintInt(op1->i -= value2);
6758 if(!exp->expType)
6759 {
6760 exp->expType = op1->type;
6761 if(op1->type)
6762 op1->type->refCount++;
6763 }
6764 return 0x1;
6765 }
6766
6767 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6768 {
6769 unsigned int value2 = op2->ui;
6770
6771 exp->type = 2;
6772 exp->string = PrintUInt(op1->ui -= value2);
6773 if(!exp->expType)
6774 {
6775 exp->expType = op1->type;
6776 if(op1->type)
6777 op1->type->refCount++;
6778 }
6779 return 0x1;
6780 }
6781
6782 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6783 {
6784 short value2 = op2->s;
6785
6786 exp->type = 2;
6787 exp->string = PrintShort(op1->s -= value2);
6788 if(!exp->expType)
6789 {
6790 exp->expType = op1->type;
6791 if(op1->type)
6792 op1->type->refCount++;
6793 }
6794 return 0x1;
6795 }
6796
6797 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6798 {
6799 unsigned short value2 = op2->us;
6800
6801 exp->type = 2;
6802 exp->string = PrintUShort(op1->us -= value2);
6803 if(!exp->expType)
6804 {
6805 exp->expType = op1->type;
6806 if(op1->type)
6807 op1->type->refCount++;
6808 }
6809 return 0x1;
6810 }
6811
6812 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6813 {
6814 char value2 = op2->c;
6815
6816 exp->type = 2;
6817 exp->string = PrintChar(op1->c -= value2);
6818 if(!exp->expType)
6819 {
6820 exp->expType = op1->type;
6821 if(op1->type)
6822 op1->type->refCount++;
6823 }
6824 return 0x1;
6825 }
6826
6827 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6828 {
6829 unsigned char value2 = op2->uc;
6830
6831 exp->type = 2;
6832 exp->string = PrintUChar(op1->uc -= value2);
6833 if(!exp->expType)
6834 {
6835 exp->expType = op1->type;
6836 if(op1->type)
6837 op1->type->refCount++;
6838 }
6839 return 0x1;
6840 }
6841
6842 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6843 {
6844 float value2 = op2->f;
6845
6846 exp->type = 2;
6847 exp->string = PrintFloat(op1->f -= value2);
6848 if(!exp->expType)
6849 {
6850 exp->expType = op1->type;
6851 if(op1->type)
6852 op1->type->refCount++;
6853 }
6854 return 0x1;
6855 }
6856
6857 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6858 {
6859 double value2 = op2->d;
6860
6861 exp->type = 2;
6862 exp->string = PrintDouble(op1->d -= value2);
6863 if(!exp->expType)
6864 {
6865 exp->expType = op1->type;
6866 if(op1->type)
6867 op1->type->refCount++;
6868 }
6869 return 0x1;
6870 }
6871
6872 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6873 {
6874 int value2 = op2->i;
6875
6876 exp->type = 2;
6877 exp->string = PrintInt(op1->i *= value2);
6878 if(!exp->expType)
6879 {
6880 exp->expType = op1->type;
6881 if(op1->type)
6882 op1->type->refCount++;
6883 }
6884 return 0x1;
6885 }
6886
6887 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6888 {
6889 unsigned int value2 = op2->ui;
6890
6891 exp->type = 2;
6892 exp->string = PrintUInt(op1->ui *= value2);
6893 if(!exp->expType)
6894 {
6895 exp->expType = op1->type;
6896 if(op1->type)
6897 op1->type->refCount++;
6898 }
6899 return 0x1;
6900 }
6901
6902 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6903 {
6904 short value2 = op2->s;
6905
6906 exp->type = 2;
6907 exp->string = PrintShort(op1->s *= value2);
6908 if(!exp->expType)
6909 {
6910 exp->expType = op1->type;
6911 if(op1->type)
6912 op1->type->refCount++;
6913 }
6914 return 0x1;
6915 }
6916
6917 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6918 {
6919 unsigned short value2 = op2->us;
6920
6921 exp->type = 2;
6922 exp->string = PrintUShort(op1->us *= value2);
6923 if(!exp->expType)
6924 {
6925 exp->expType = op1->type;
6926 if(op1->type)
6927 op1->type->refCount++;
6928 }
6929 return 0x1;
6930 }
6931
6932 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6933 {
6934 char value2 = op2->c;
6935
6936 exp->type = 2;
6937 exp->string = PrintChar(op1->c *= value2);
6938 if(!exp->expType)
6939 {
6940 exp->expType = op1->type;
6941 if(op1->type)
6942 op1->type->refCount++;
6943 }
6944 return 0x1;
6945 }
6946
6947 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6948 {
6949 unsigned char value2 = op2->uc;
6950
6951 exp->type = 2;
6952 exp->string = PrintUChar(op1->uc *= value2);
6953 if(!exp->expType)
6954 {
6955 exp->expType = op1->type;
6956 if(op1->type)
6957 op1->type->refCount++;
6958 }
6959 return 0x1;
6960 }
6961
6962 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6963 {
6964 float value2 = op2->f;
6965
6966 exp->type = 2;
6967 exp->string = PrintFloat(op1->f *= value2);
6968 if(!exp->expType)
6969 {
6970 exp->expType = op1->type;
6971 if(op1->type)
6972 op1->type->refCount++;
6973 }
6974 return 0x1;
6975 }
6976
6977 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6978 {
6979 double value2 = op2->d;
6980
6981 exp->type = 2;
6982 exp->string = PrintDouble(op1->d *= value2);
6983 if(!exp->expType)
6984 {
6985 exp->expType = op1->type;
6986 if(op1->type)
6987 op1->type->refCount++;
6988 }
6989 return 0x1;
6990 }
6991
6992 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6993 {
6994 int value2 = op2->i;
6995
6996 exp->type = 2;
6997 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6998 if(!exp->expType)
6999 {
7000 exp->expType = op1->type;
7001 if(op1->type)
7002 op1->type->refCount++;
7003 }
7004 return 0x1;
7005 }
7006
7007 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7008 {
7009 unsigned int value2 = op2->ui;
7010
7011 exp->type = 2;
7012 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7013 if(!exp->expType)
7014 {
7015 exp->expType = op1->type;
7016 if(op1->type)
7017 op1->type->refCount++;
7018 }
7019 return 0x1;
7020 }
7021
7022 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7023 {
7024 short value2 = op2->s;
7025
7026 exp->type = 2;
7027 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7028 if(!exp->expType)
7029 {
7030 exp->expType = op1->type;
7031 if(op1->type)
7032 op1->type->refCount++;
7033 }
7034 return 0x1;
7035 }
7036
7037 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7038 {
7039 unsigned short value2 = op2->us;
7040
7041 exp->type = 2;
7042 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7043 if(!exp->expType)
7044 {
7045 exp->expType = op1->type;
7046 if(op1->type)
7047 op1->type->refCount++;
7048 }
7049 return 0x1;
7050 }
7051
7052 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7053 {
7054 char value2 = op2->c;
7055
7056 exp->type = 2;
7057 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7058 if(!exp->expType)
7059 {
7060 exp->expType = op1->type;
7061 if(op1->type)
7062 op1->type->refCount++;
7063 }
7064 return 0x1;
7065 }
7066
7067 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7068 {
7069 unsigned char value2 = op2->uc;
7070
7071 exp->type = 2;
7072 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7073 if(!exp->expType)
7074 {
7075 exp->expType = op1->type;
7076 if(op1->type)
7077 op1->type->refCount++;
7078 }
7079 return 0x1;
7080 }
7081
7082 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7083 {
7084 float value2 = op2->f;
7085
7086 exp->type = 2;
7087 exp->string = PrintFloat(value2 ? (op1->f /= value2) : 0);
7088 if(!exp->expType)
7089 {
7090 exp->expType = op1->type;
7091 if(op1->type)
7092 op1->type->refCount++;
7093 }
7094 return 0x1;
7095 }
7096
7097 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7098 {
7099 double value2 = op2->d;
7100
7101 exp->type = 2;
7102 exp->string = PrintDouble(value2 ? (op1->d /= value2) : 0);
7103 if(!exp->expType)
7104 {
7105 exp->expType = op1->type;
7106 if(op1->type)
7107 op1->type->refCount++;
7108 }
7109 return 0x1;
7110 }
7111
7112 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7113 {
7114 int value2 = op2->i;
7115
7116 exp->type = 2;
7117 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7118 if(!exp->expType)
7119 {
7120 exp->expType = op1->type;
7121 if(op1->type)
7122 op1->type->refCount++;
7123 }
7124 return 0x1;
7125 }
7126
7127 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7128 {
7129 unsigned int value2 = op2->ui;
7130
7131 exp->type = 2;
7132 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7133 if(!exp->expType)
7134 {
7135 exp->expType = op1->type;
7136 if(op1->type)
7137 op1->type->refCount++;
7138 }
7139 return 0x1;
7140 }
7141
7142 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7143 {
7144 short value2 = op2->s;
7145
7146 exp->type = 2;
7147 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7148 if(!exp->expType)
7149 {
7150 exp->expType = op1->type;
7151 if(op1->type)
7152 op1->type->refCount++;
7153 }
7154 return 0x1;
7155 }
7156
7157 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7158 {
7159 unsigned short value2 = op2->us;
7160
7161 exp->type = 2;
7162 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7163 if(!exp->expType)
7164 {
7165 exp->expType = op1->type;
7166 if(op1->type)
7167 op1->type->refCount++;
7168 }
7169 return 0x1;
7170 }
7171
7172 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7173 {
7174 char value2 = op2->c;
7175
7176 exp->type = 2;
7177 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7178 if(!exp->expType)
7179 {
7180 exp->expType = op1->type;
7181 if(op1->type)
7182 op1->type->refCount++;
7183 }
7184 return 0x1;
7185 }
7186
7187 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7188 {
7189 unsigned char value2 = op2->uc;
7190
7191 exp->type = 2;
7192 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7193 if(!exp->expType)
7194 {
7195 exp->expType = op1->type;
7196 if(op1->type)
7197 op1->type->refCount++;
7198 }
7199 return 0x1;
7200 }
7201
7202 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7203 {
7204 int value2 = op2->i;
7205
7206 exp->type = 2;
7207 exp->string = PrintInt(op1->i & value2);
7208 if(!exp->expType)
7209 {
7210 exp->expType = op1->type;
7211 if(op1->type)
7212 op1->type->refCount++;
7213 }
7214 return 0x1;
7215 }
7216
7217 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7218 {
7219 unsigned int value2 = op2->ui;
7220
7221 exp->type = 2;
7222 exp->string = PrintUInt(op1->ui & value2);
7223 if(!exp->expType)
7224 {
7225 exp->expType = op1->type;
7226 if(op1->type)
7227 op1->type->refCount++;
7228 }
7229 return 0x1;
7230 }
7231
7232 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7233 {
7234 short value2 = op2->s;
7235
7236 exp->type = 2;
7237 exp->string = PrintShort(op1->s & value2);
7238 if(!exp->expType)
7239 {
7240 exp->expType = op1->type;
7241 if(op1->type)
7242 op1->type->refCount++;
7243 }
7244 return 0x1;
7245 }
7246
7247 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7248 {
7249 unsigned short value2 = op2->us;
7250
7251 exp->type = 2;
7252 exp->string = PrintUShort(op1->us & value2);
7253 if(!exp->expType)
7254 {
7255 exp->expType = op1->type;
7256 if(op1->type)
7257 op1->type->refCount++;
7258 }
7259 return 0x1;
7260 }
7261
7262 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7263 {
7264 char value2 = op2->c;
7265
7266 exp->type = 2;
7267 exp->string = PrintChar(op1->c & value2);
7268 if(!exp->expType)
7269 {
7270 exp->expType = op1->type;
7271 if(op1->type)
7272 op1->type->refCount++;
7273 }
7274 return 0x1;
7275 }
7276
7277 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7278 {
7279 unsigned char value2 = op2->uc;
7280
7281 exp->type = 2;
7282 exp->string = PrintUChar(op1->uc & value2);
7283 if(!exp->expType)
7284 {
7285 exp->expType = op1->type;
7286 if(op1->type)
7287 op1->type->refCount++;
7288 }
7289 return 0x1;
7290 }
7291
7292 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7293 {
7294 int value2 = op2->i;
7295
7296 exp->type = 2;
7297 exp->string = PrintInt(op1->i | value2);
7298 if(!exp->expType)
7299 {
7300 exp->expType = op1->type;
7301 if(op1->type)
7302 op1->type->refCount++;
7303 }
7304 return 0x1;
7305 }
7306
7307 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7308 {
7309 unsigned int value2 = op2->ui;
7310
7311 exp->type = 2;
7312 exp->string = PrintUInt(op1->ui | value2);
7313 if(!exp->expType)
7314 {
7315 exp->expType = op1->type;
7316 if(op1->type)
7317 op1->type->refCount++;
7318 }
7319 return 0x1;
7320 }
7321
7322 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7323 {
7324 short value2 = op2->s;
7325
7326 exp->type = 2;
7327 exp->string = PrintShort(op1->s | value2);
7328 if(!exp->expType)
7329 {
7330 exp->expType = op1->type;
7331 if(op1->type)
7332 op1->type->refCount++;
7333 }
7334 return 0x1;
7335 }
7336
7337 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7338 {
7339 unsigned short value2 = op2->us;
7340
7341 exp->type = 2;
7342 exp->string = PrintUShort(op1->us | value2);
7343 if(!exp->expType)
7344 {
7345 exp->expType = op1->type;
7346 if(op1->type)
7347 op1->type->refCount++;
7348 }
7349 return 0x1;
7350 }
7351
7352 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7353 {
7354 char value2 = op2->c;
7355
7356 exp->type = 2;
7357 exp->string = PrintChar(op1->c | value2);
7358 if(!exp->expType)
7359 {
7360 exp->expType = op1->type;
7361 if(op1->type)
7362 op1->type->refCount++;
7363 }
7364 return 0x1;
7365 }
7366
7367 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7368 {
7369 unsigned char value2 = op2->uc;
7370
7371 exp->type = 2;
7372 exp->string = PrintUChar(op1->uc | value2);
7373 if(!exp->expType)
7374 {
7375 exp->expType = op1->type;
7376 if(op1->type)
7377 op1->type->refCount++;
7378 }
7379 return 0x1;
7380 }
7381
7382 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7383 {
7384 int value2 = op2->i;
7385
7386 exp->type = 2;
7387 exp->string = PrintInt(op1->i ^ value2);
7388 if(!exp->expType)
7389 {
7390 exp->expType = op1->type;
7391 if(op1->type)
7392 op1->type->refCount++;
7393 }
7394 return 0x1;
7395 }
7396
7397 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7398 {
7399 unsigned int value2 = op2->ui;
7400
7401 exp->type = 2;
7402 exp->string = PrintUInt(op1->ui ^ value2);
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 ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7413 {
7414 short value2 = op2->s;
7415
7416 exp->type = 2;
7417 exp->string = PrintShort(op1->s ^ 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 UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7428 {
7429 unsigned short value2 = op2->us;
7430
7431 exp->type = 2;
7432 exp->string = PrintUShort(op1->us ^ 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 CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7443 {
7444 char value2 = op2->c;
7445
7446 exp->type = 2;
7447 exp->string = PrintChar(op1->c ^ 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 UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7458 {
7459 unsigned char value2 = op2->uc;
7460
7461 exp->type = 2;
7462 exp->string = PrintUChar(op1->uc ^ 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 IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7473 {
7474 int value2 = op2->i;
7475
7476 exp->type = 2;
7477 exp->string = PrintInt(op1->i << 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 UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7488 {
7489 unsigned int value2 = op2->ui;
7490
7491 exp->type = 2;
7492 exp->string = PrintUInt(op1->ui << 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 ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7503 {
7504 short value2 = op2->s;
7505
7506 exp->type = 2;
7507 exp->string = PrintShort(op1->s << 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 UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7518 {
7519 unsigned short value2 = op2->us;
7520
7521 exp->type = 2;
7522 exp->string = PrintUShort(op1->us << 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 CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7533 {
7534 char value2 = op2->c;
7535
7536 exp->type = 2;
7537 exp->string = PrintChar(op1->c << 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 UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7548 {
7549 unsigned char value2 = op2->uc;
7550
7551 exp->type = 2;
7552 exp->string = PrintUChar(op1->uc << 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 IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7563 {
7564 int value2 = op2->i;
7565
7566 exp->type = 2;
7567 exp->string = PrintInt(op1->i >> 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 UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7578 {
7579 unsigned int value2 = op2->ui;
7580
7581 exp->type = 2;
7582 exp->string = PrintUInt(op1->ui >> 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 ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7593 {
7594 short value2 = op2->s;
7595
7596 exp->type = 2;
7597 exp->string = PrintShort(op1->s >> 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 UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7608 {
7609 unsigned short value2 = op2->us;
7610
7611 exp->type = 2;
7612 exp->string = PrintUShort(op1->us >> 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 CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7623 {
7624 char value2 = op2->c;
7625
7626 exp->type = 2;
7627 exp->string = PrintChar(op1->c >> 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 UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7638 {
7639 unsigned char value2 = op2->uc;
7640
7641 exp->type = 2;
7642 exp->string = PrintUChar(op1->uc >> 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 IntBitNot(struct Expression * exp, struct Operand * op1)
7653 {
7654 exp->type = 2;
7655 exp->string = PrintInt((~op1->i));
7656 if(!exp->expType)
7657 {
7658 exp->expType = op1->type;
7659 if(op1->type)
7660 op1->type->refCount++;
7661 }
7662 return 0x1;
7663 }
7664
7665 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7666 {
7667 exp->type = 2;
7668 exp->string = PrintUInt((unsigned int)(~op1->ui));
7669 if(!exp->expType)
7670 {
7671 exp->expType = op1->type;
7672 if(op1->type)
7673 op1->type->refCount++;
7674 }
7675 return 0x1;
7676 }
7677
7678 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7679 {
7680 exp->type = 2;
7681 exp->string = PrintShort((short)(~op1->s));
7682 if(!exp->expType)
7683 {
7684 exp->expType = op1->type;
7685 if(op1->type)
7686 op1->type->refCount++;
7687 }
7688 return 0x1;
7689 }
7690
7691 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7692 {
7693 exp->type = 2;
7694 exp->string = PrintUShort((unsigned short)(~op1->us));
7695 if(!exp->expType)
7696 {
7697 exp->expType = op1->type;
7698 if(op1->type)
7699 op1->type->refCount++;
7700 }
7701 return 0x1;
7702 }
7703
7704 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7705 {
7706 exp->type = 2;
7707 exp->string = PrintChar((char)(~op1->c));
7708 if(!exp->expType)
7709 {
7710 exp->expType = op1->type;
7711 if(op1->type)
7712 op1->type->refCount++;
7713 }
7714 return 0x1;
7715 }
7716
7717 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7718 {
7719 exp->type = 2;
7720 exp->string = PrintUChar((unsigned char)(~op1->uc));
7721 if(!exp->expType)
7722 {
7723 exp->expType = op1->type;
7724 if(op1->type)
7725 op1->type->refCount++;
7726 }
7727 return 0x1;
7728 }
7729
7730 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7731 {
7732 int value2 = op2->i;
7733
7734 exp->type = 2;
7735 exp->string = PrintInt(op1->i &= value2);
7736 if(!exp->expType)
7737 {
7738 exp->expType = op1->type;
7739 if(op1->type)
7740 op1->type->refCount++;
7741 }
7742 return 0x1;
7743 }
7744
7745 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7746 {
7747 unsigned int value2 = op2->ui;
7748
7749 exp->type = 2;
7750 exp->string = PrintUInt(op1->ui &= value2);
7751 if(!exp->expType)
7752 {
7753 exp->expType = op1->type;
7754 if(op1->type)
7755 op1->type->refCount++;
7756 }
7757 return 0x1;
7758 }
7759
7760 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7761 {
7762 short value2 = op2->s;
7763
7764 exp->type = 2;
7765 exp->string = PrintShort(op1->s &= value2);
7766 if(!exp->expType)
7767 {
7768 exp->expType = op1->type;
7769 if(op1->type)
7770 op1->type->refCount++;
7771 }
7772 return 0x1;
7773 }
7774
7775 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7776 {
7777 unsigned short value2 = op2->us;
7778
7779 exp->type = 2;
7780 exp->string = PrintUShort(op1->us &= value2);
7781 if(!exp->expType)
7782 {
7783 exp->expType = op1->type;
7784 if(op1->type)
7785 op1->type->refCount++;
7786 }
7787 return 0x1;
7788 }
7789
7790 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7791 {
7792 char value2 = op2->c;
7793
7794 exp->type = 2;
7795 exp->string = PrintChar(op1->c &= value2);
7796 if(!exp->expType)
7797 {
7798 exp->expType = op1->type;
7799 if(op1->type)
7800 op1->type->refCount++;
7801 }
7802 return 0x1;
7803 }
7804
7805 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7806 {
7807 unsigned char value2 = op2->uc;
7808
7809 exp->type = 2;
7810 exp->string = PrintUChar(op1->uc &= value2);
7811 if(!exp->expType)
7812 {
7813 exp->expType = op1->type;
7814 if(op1->type)
7815 op1->type->refCount++;
7816 }
7817 return 0x1;
7818 }
7819
7820 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7821 {
7822 int value2 = op2->i;
7823
7824 exp->type = 2;
7825 exp->string = PrintInt(op1->i |= value2);
7826 if(!exp->expType)
7827 {
7828 exp->expType = op1->type;
7829 if(op1->type)
7830 op1->type->refCount++;
7831 }
7832 return 0x1;
7833 }
7834
7835 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7836 {
7837 unsigned int value2 = op2->ui;
7838
7839 exp->type = 2;
7840 exp->string = PrintUInt(op1->ui |= value2);
7841 if(!exp->expType)
7842 {
7843 exp->expType = op1->type;
7844 if(op1->type)
7845 op1->type->refCount++;
7846 }
7847 return 0x1;
7848 }
7849
7850 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7851 {
7852 short value2 = op2->s;
7853
7854 exp->type = 2;
7855 exp->string = PrintShort(op1->s |= value2);
7856 if(!exp->expType)
7857 {
7858 exp->expType = op1->type;
7859 if(op1->type)
7860 op1->type->refCount++;
7861 }
7862 return 0x1;
7863 }
7864
7865 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7866 {
7867 unsigned short value2 = op2->us;
7868
7869 exp->type = 2;
7870 exp->string = PrintUShort(op1->us |= value2);
7871 if(!exp->expType)
7872 {
7873 exp->expType = op1->type;
7874 if(op1->type)
7875 op1->type->refCount++;
7876 }
7877 return 0x1;
7878 }
7879
7880 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7881 {
7882 char value2 = op2->c;
7883
7884 exp->type = 2;
7885 exp->string = PrintChar(op1->c |= value2);
7886 if(!exp->expType)
7887 {
7888 exp->expType = op1->type;
7889 if(op1->type)
7890 op1->type->refCount++;
7891 }
7892 return 0x1;
7893 }
7894
7895 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7896 {
7897 unsigned char value2 = op2->uc;
7898
7899 exp->type = 2;
7900 exp->string = PrintUChar(op1->uc |= value2);
7901 if(!exp->expType)
7902 {
7903 exp->expType = op1->type;
7904 if(op1->type)
7905 op1->type->refCount++;
7906 }
7907 return 0x1;
7908 }
7909
7910 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7911 {
7912 int value2 = op2->i;
7913
7914 exp->type = 2;
7915 exp->string = PrintInt(op1->i ^= value2);
7916 if(!exp->expType)
7917 {
7918 exp->expType = op1->type;
7919 if(op1->type)
7920 op1->type->refCount++;
7921 }
7922 return 0x1;
7923 }
7924
7925 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7926 {
7927 unsigned int value2 = op2->ui;
7928
7929 exp->type = 2;
7930 exp->string = PrintUInt(op1->ui ^= value2);
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 ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7941 {
7942 short value2 = op2->s;
7943
7944 exp->type = 2;
7945 exp->string = PrintShort(op1->s ^= 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 UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7956 {
7957 unsigned short value2 = op2->us;
7958
7959 exp->type = 2;
7960 exp->string = PrintUShort(op1->us ^= 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 CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7971 {
7972 char value2 = op2->c;
7973
7974 exp->type = 2;
7975 exp->string = PrintChar(op1->c ^= 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 UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7986 {
7987 unsigned char value2 = op2->uc;
7988
7989 exp->type = 2;
7990 exp->string = PrintUChar(op1->uc ^= 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 IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8001 {
8002 int value2 = op2->i;
8003
8004 exp->type = 2;
8005 exp->string = PrintInt(op1->i <<= 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 UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8016 {
8017 unsigned int value2 = op2->ui;
8018
8019 exp->type = 2;
8020 exp->string = PrintUInt(op1->ui <<= 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 ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8031 {
8032 short value2 = op2->s;
8033
8034 exp->type = 2;
8035 exp->string = PrintShort(op1->s <<= 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 UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8046 {
8047 unsigned short value2 = op2->us;
8048
8049 exp->type = 2;
8050 exp->string = PrintUShort(op1->us <<= 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 CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8061 {
8062 char value2 = op2->c;
8063
8064 exp->type = 2;
8065 exp->string = PrintChar(op1->c <<= 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 UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8076 {
8077 unsigned char value2 = op2->uc;
8078
8079 exp->type = 2;
8080 exp->string = PrintUChar(op1->uc <<= 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 IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8091 {
8092 int value2 = op2->i;
8093
8094 exp->type = 2;
8095 exp->string = PrintInt(op1->i >>= 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 UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8106 {
8107 unsigned int value2 = op2->ui;
8108
8109 exp->type = 2;
8110 exp->string = PrintUInt(op1->ui >>= 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 ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8121 {
8122 short value2 = op2->s;
8123
8124 exp->type = 2;
8125 exp->string = PrintShort(op1->s >>= 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 UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8136 {
8137 unsigned short value2 = op2->us;
8138
8139 exp->type = 2;
8140 exp->string = PrintUShort(op1->us >>= 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 CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8151 {
8152 char value2 = op2->c;
8153
8154 exp->type = 2;
8155 exp->string = PrintChar(op1->c >>= 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 UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8166 {
8167 unsigned char value2 = op2->uc;
8168
8169 exp->type = 2;
8170 exp->string = PrintUChar(op1->uc >>= 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 IntNot(struct Expression * exp, struct Operand * op1)
8181 {
8182 exp->type = 2;
8183 exp->string = PrintInt((int)(!op1->i));
8184 if(!exp->expType)
8185 {
8186 exp->expType = op1->type;
8187 if(op1->type)
8188 op1->type->refCount++;
8189 }
8190 return 0x1;
8191 }
8192
8193 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8194 {
8195 exp->type = 2;
8196 exp->string = PrintUInt((unsigned int)(!op1->ui));
8197 if(!exp->expType)
8198 {
8199 exp->expType = op1->type;
8200 if(op1->type)
8201 op1->type->refCount++;
8202 }
8203 return 0x1;
8204 }
8205
8206 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8207 {
8208 exp->type = 2;
8209 exp->string = PrintShort((short)(!op1->s));
8210 if(!exp->expType)
8211 {
8212 exp->expType = op1->type;
8213 if(op1->type)
8214 op1->type->refCount++;
8215 }
8216 return 0x1;
8217 }
8218
8219 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8220 {
8221 exp->type = 2;
8222 exp->string = PrintUShort((unsigned short)(!op1->us));
8223 if(!exp->expType)
8224 {
8225 exp->expType = op1->type;
8226 if(op1->type)
8227 op1->type->refCount++;
8228 }
8229 return 0x1;
8230 }
8231
8232 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8233 {
8234 exp->type = 2;
8235 exp->string = PrintChar((char)(!op1->c));
8236 if(!exp->expType)
8237 {
8238 exp->expType = op1->type;
8239 if(op1->type)
8240 op1->type->refCount++;
8241 }
8242 return 0x1;
8243 }
8244
8245 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8246 {
8247 exp->type = 2;
8248 exp->string = PrintUChar((unsigned char)(!op1->uc));
8249 if(!exp->expType)
8250 {
8251 exp->expType = op1->type;
8252 if(op1->type)
8253 op1->type->refCount++;
8254 }
8255 return 0x1;
8256 }
8257
8258 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8259 {
8260 int value2 = op2->i;
8261
8262 exp->type = 2;
8263 exp->string = PrintInt(op1->i == value2);
8264 if(!exp->expType)
8265 {
8266 exp->expType = op1->type;
8267 if(op1->type)
8268 op1->type->refCount++;
8269 }
8270 return 0x1;
8271 }
8272
8273 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8274 {
8275 unsigned int value2 = op2->ui;
8276
8277 exp->type = 2;
8278 exp->string = PrintUInt(op1->ui == value2);
8279 if(!exp->expType)
8280 {
8281 exp->expType = op1->type;
8282 if(op1->type)
8283 op1->type->refCount++;
8284 }
8285 return 0x1;
8286 }
8287
8288 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8289 {
8290 short value2 = op2->s;
8291
8292 exp->type = 2;
8293 exp->string = PrintShort(op1->s == value2);
8294 if(!exp->expType)
8295 {
8296 exp->expType = op1->type;
8297 if(op1->type)
8298 op1->type->refCount++;
8299 }
8300 return 0x1;
8301 }
8302
8303 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8304 {
8305 unsigned short value2 = op2->us;
8306
8307 exp->type = 2;
8308 exp->string = PrintUShort(op1->us == value2);
8309 if(!exp->expType)
8310 {
8311 exp->expType = op1->type;
8312 if(op1->type)
8313 op1->type->refCount++;
8314 }
8315 return 0x1;
8316 }
8317
8318 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8319 {
8320 char value2 = op2->c;
8321
8322 exp->type = 2;
8323 exp->string = PrintChar(op1->c == value2);
8324 if(!exp->expType)
8325 {
8326 exp->expType = op1->type;
8327 if(op1->type)
8328 op1->type->refCount++;
8329 }
8330 return 0x1;
8331 }
8332
8333 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8334 {
8335 unsigned char value2 = op2->uc;
8336
8337 exp->type = 2;
8338 exp->string = PrintUChar(op1->uc == value2);
8339 if(!exp->expType)
8340 {
8341 exp->expType = op1->type;
8342 if(op1->type)
8343 op1->type->refCount++;
8344 }
8345 return 0x1;
8346 }
8347
8348 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8349 {
8350 float value2 = op2->f;
8351
8352 exp->type = 2;
8353 exp->string = PrintFloat(op1->f == value2);
8354 if(!exp->expType)
8355 {
8356 exp->expType = op1->type;
8357 if(op1->type)
8358 op1->type->refCount++;
8359 }
8360 return 0x1;
8361 }
8362
8363 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8364 {
8365 double value2 = op2->d;
8366
8367 exp->type = 2;
8368 exp->string = PrintDouble(op1->d == value2);
8369 if(!exp->expType)
8370 {
8371 exp->expType = op1->type;
8372 if(op1->type)
8373 op1->type->refCount++;
8374 }
8375 return 0x1;
8376 }
8377
8378 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8379 {
8380 int value2 = op2->i;
8381
8382 exp->type = 2;
8383 exp->string = PrintInt(op1->i != value2);
8384 if(!exp->expType)
8385 {
8386 exp->expType = op1->type;
8387 if(op1->type)
8388 op1->type->refCount++;
8389 }
8390 return 0x1;
8391 }
8392
8393 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8394 {
8395 unsigned int value2 = op2->ui;
8396
8397 exp->type = 2;
8398 exp->string = PrintUInt(op1->ui != value2);
8399 if(!exp->expType)
8400 {
8401 exp->expType = op1->type;
8402 if(op1->type)
8403 op1->type->refCount++;
8404 }
8405 return 0x1;
8406 }
8407
8408 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8409 {
8410 short value2 = op2->s;
8411
8412 exp->type = 2;
8413 exp->string = PrintShort(op1->s != value2);
8414 if(!exp->expType)
8415 {
8416 exp->expType = op1->type;
8417 if(op1->type)
8418 op1->type->refCount++;
8419 }
8420 return 0x1;
8421 }
8422
8423 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8424 {
8425 unsigned short value2 = op2->us;
8426
8427 exp->type = 2;
8428 exp->string = PrintUShort(op1->us != value2);
8429 if(!exp->expType)
8430 {
8431 exp->expType = op1->type;
8432 if(op1->type)
8433 op1->type->refCount++;
8434 }
8435 return 0x1;
8436 }
8437
8438 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8439 {
8440 char value2 = op2->c;
8441
8442 exp->type = 2;
8443 exp->string = PrintChar(op1->c != value2);
8444 if(!exp->expType)
8445 {
8446 exp->expType = op1->type;
8447 if(op1->type)
8448 op1->type->refCount++;
8449 }
8450 return 0x1;
8451 }
8452
8453 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8454 {
8455 unsigned char value2 = op2->uc;
8456
8457 exp->type = 2;
8458 exp->string = PrintUChar(op1->uc != value2);
8459 if(!exp->expType)
8460 {
8461 exp->expType = op1->type;
8462 if(op1->type)
8463 op1->type->refCount++;
8464 }
8465 return 0x1;
8466 }
8467
8468 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8469 {
8470 float value2 = op2->f;
8471
8472 exp->type = 2;
8473 exp->string = PrintFloat(op1->f != value2);
8474 if(!exp->expType)
8475 {
8476 exp->expType = op1->type;
8477 if(op1->type)
8478 op1->type->refCount++;
8479 }
8480 return 0x1;
8481 }
8482
8483 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8484 {
8485 double value2 = op2->d;
8486
8487 exp->type = 2;
8488 exp->string = PrintDouble(op1->d != value2);
8489 if(!exp->expType)
8490 {
8491 exp->expType = op1->type;
8492 if(op1->type)
8493 op1->type->refCount++;
8494 }
8495 return 0x1;
8496 }
8497
8498 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8499 {
8500 int value2 = op2->i;
8501
8502 exp->type = 2;
8503 exp->string = PrintInt(op1->i && value2);
8504 if(!exp->expType)
8505 {
8506 exp->expType = op1->type;
8507 if(op1->type)
8508 op1->type->refCount++;
8509 }
8510 return 0x1;
8511 }
8512
8513 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8514 {
8515 unsigned int value2 = op2->ui;
8516
8517 exp->type = 2;
8518 exp->string = PrintUInt(op1->ui && value2);
8519 if(!exp->expType)
8520 {
8521 exp->expType = op1->type;
8522 if(op1->type)
8523 op1->type->refCount++;
8524 }
8525 return 0x1;
8526 }
8527
8528 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8529 {
8530 short value2 = op2->s;
8531
8532 exp->type = 2;
8533 exp->string = PrintShort(op1->s && value2);
8534 if(!exp->expType)
8535 {
8536 exp->expType = op1->type;
8537 if(op1->type)
8538 op1->type->refCount++;
8539 }
8540 return 0x1;
8541 }
8542
8543 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8544 {
8545 unsigned short value2 = op2->us;
8546
8547 exp->type = 2;
8548 exp->string = PrintUShort(op1->us && value2);
8549 if(!exp->expType)
8550 {
8551 exp->expType = op1->type;
8552 if(op1->type)
8553 op1->type->refCount++;
8554 }
8555 return 0x1;
8556 }
8557
8558 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8559 {
8560 char value2 = op2->c;
8561
8562 exp->type = 2;
8563 exp->string = PrintChar(op1->c && value2);
8564 if(!exp->expType)
8565 {
8566 exp->expType = op1->type;
8567 if(op1->type)
8568 op1->type->refCount++;
8569 }
8570 return 0x1;
8571 }
8572
8573 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8574 {
8575 unsigned char value2 = op2->uc;
8576
8577 exp->type = 2;
8578 exp->string = PrintUChar(op1->uc && value2);
8579 if(!exp->expType)
8580 {
8581 exp->expType = op1->type;
8582 if(op1->type)
8583 op1->type->refCount++;
8584 }
8585 return 0x1;
8586 }
8587
8588 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8589 {
8590 float value2 = op2->f;
8591
8592 exp->type = 2;
8593 exp->string = PrintFloat(op1->f && value2);
8594 if(!exp->expType)
8595 {
8596 exp->expType = op1->type;
8597 if(op1->type)
8598 op1->type->refCount++;
8599 }
8600 return 0x1;
8601 }
8602
8603 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8604 {
8605 double value2 = op2->d;
8606
8607 exp->type = 2;
8608 exp->string = PrintDouble(op1->d && value2);
8609 if(!exp->expType)
8610 {
8611 exp->expType = op1->type;
8612 if(op1->type)
8613 op1->type->refCount++;
8614 }
8615 return 0x1;
8616 }
8617
8618 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8619 {
8620 int value2 = op2->i;
8621
8622 exp->type = 2;
8623 exp->string = PrintInt(op1->i || value2);
8624 if(!exp->expType)
8625 {
8626 exp->expType = op1->type;
8627 if(op1->type)
8628 op1->type->refCount++;
8629 }
8630 return 0x1;
8631 }
8632
8633 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8634 {
8635 unsigned int value2 = op2->ui;
8636
8637 exp->type = 2;
8638 exp->string = PrintUInt(op1->ui || value2);
8639 if(!exp->expType)
8640 {
8641 exp->expType = op1->type;
8642 if(op1->type)
8643 op1->type->refCount++;
8644 }
8645 return 0x1;
8646 }
8647
8648 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8649 {
8650 short value2 = op2->s;
8651
8652 exp->type = 2;
8653 exp->string = PrintShort(op1->s || value2);
8654 if(!exp->expType)
8655 {
8656 exp->expType = op1->type;
8657 if(op1->type)
8658 op1->type->refCount++;
8659 }
8660 return 0x1;
8661 }
8662
8663 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8664 {
8665 unsigned short value2 = op2->us;
8666
8667 exp->type = 2;
8668 exp->string = PrintUShort(op1->us || value2);
8669 if(!exp->expType)
8670 {
8671 exp->expType = op1->type;
8672 if(op1->type)
8673 op1->type->refCount++;
8674 }
8675 return 0x1;
8676 }
8677
8678 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8679 {
8680 char value2 = op2->c;
8681
8682 exp->type = 2;
8683 exp->string = PrintChar(op1->c || value2);
8684 if(!exp->expType)
8685 {
8686 exp->expType = op1->type;
8687 if(op1->type)
8688 op1->type->refCount++;
8689 }
8690 return 0x1;
8691 }
8692
8693 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8694 {
8695 unsigned char value2 = op2->uc;
8696
8697 exp->type = 2;
8698 exp->string = PrintUChar(op1->uc || value2);
8699 if(!exp->expType)
8700 {
8701 exp->expType = op1->type;
8702 if(op1->type)
8703 op1->type->refCount++;
8704 }
8705 return 0x1;
8706 }
8707
8708 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8709 {
8710 float value2 = op2->f;
8711
8712 exp->type = 2;
8713 exp->string = PrintFloat(op1->f || value2);
8714 if(!exp->expType)
8715 {
8716 exp->expType = op1->type;
8717 if(op1->type)
8718 op1->type->refCount++;
8719 }
8720 return 0x1;
8721 }
8722
8723 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8724 {
8725 double value2 = op2->d;
8726
8727 exp->type = 2;
8728 exp->string = PrintDouble(op1->d || value2);
8729 if(!exp->expType)
8730 {
8731 exp->expType = op1->type;
8732 if(op1->type)
8733 op1->type->refCount++;
8734 }
8735 return 0x1;
8736 }
8737
8738 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8739 {
8740 int value2 = op2->i;
8741
8742 exp->type = 2;
8743 exp->string = PrintInt(op1->i > value2);
8744 if(!exp->expType)
8745 {
8746 exp->expType = op1->type;
8747 if(op1->type)
8748 op1->type->refCount++;
8749 }
8750 return 0x1;
8751 }
8752
8753 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8754 {
8755 unsigned int value2 = op2->ui;
8756
8757 exp->type = 2;
8758 exp->string = PrintUInt(op1->ui > value2);
8759 if(!exp->expType)
8760 {
8761 exp->expType = op1->type;
8762 if(op1->type)
8763 op1->type->refCount++;
8764 }
8765 return 0x1;
8766 }
8767
8768 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8769 {
8770 short value2 = op2->s;
8771
8772 exp->type = 2;
8773 exp->string = PrintShort(op1->s > value2);
8774 if(!exp->expType)
8775 {
8776 exp->expType = op1->type;
8777 if(op1->type)
8778 op1->type->refCount++;
8779 }
8780 return 0x1;
8781 }
8782
8783 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8784 {
8785 unsigned short value2 = op2->us;
8786
8787 exp->type = 2;
8788 exp->string = PrintUShort(op1->us > value2);
8789 if(!exp->expType)
8790 {
8791 exp->expType = op1->type;
8792 if(op1->type)
8793 op1->type->refCount++;
8794 }
8795 return 0x1;
8796 }
8797
8798 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8799 {
8800 char value2 = op2->c;
8801
8802 exp->type = 2;
8803 exp->string = PrintChar(op1->c > value2);
8804 if(!exp->expType)
8805 {
8806 exp->expType = op1->type;
8807 if(op1->type)
8808 op1->type->refCount++;
8809 }
8810 return 0x1;
8811 }
8812
8813 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8814 {
8815 unsigned char value2 = op2->uc;
8816
8817 exp->type = 2;
8818 exp->string = PrintUChar(op1->uc > value2);
8819 if(!exp->expType)
8820 {
8821 exp->expType = op1->type;
8822 if(op1->type)
8823 op1->type->refCount++;
8824 }
8825 return 0x1;
8826 }
8827
8828 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8829 {
8830 float value2 = op2->f;
8831
8832 exp->type = 2;
8833 exp->string = PrintFloat(op1->f > value2);
8834 if(!exp->expType)
8835 {
8836 exp->expType = op1->type;
8837 if(op1->type)
8838 op1->type->refCount++;
8839 }
8840 return 0x1;
8841 }
8842
8843 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8844 {
8845 double value2 = op2->d;
8846
8847 exp->type = 2;
8848 exp->string = PrintDouble(op1->d > value2);
8849 if(!exp->expType)
8850 {
8851 exp->expType = op1->type;
8852 if(op1->type)
8853 op1->type->refCount++;
8854 }
8855 return 0x1;
8856 }
8857
8858 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8859 {
8860 int value2 = op2->i;
8861
8862 exp->type = 2;
8863 exp->string = PrintInt(op1->i < value2);
8864 if(!exp->expType)
8865 {
8866 exp->expType = op1->type;
8867 if(op1->type)
8868 op1->type->refCount++;
8869 }
8870 return 0x1;
8871 }
8872
8873 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8874 {
8875 unsigned int value2 = op2->ui;
8876
8877 exp->type = 2;
8878 exp->string = PrintUInt(op1->ui < value2);
8879 if(!exp->expType)
8880 {
8881 exp->expType = op1->type;
8882 if(op1->type)
8883 op1->type->refCount++;
8884 }
8885 return 0x1;
8886 }
8887
8888 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8889 {
8890 short value2 = op2->s;
8891
8892 exp->type = 2;
8893 exp->string = PrintShort(op1->s < value2);
8894 if(!exp->expType)
8895 {
8896 exp->expType = op1->type;
8897 if(op1->type)
8898 op1->type->refCount++;
8899 }
8900 return 0x1;
8901 }
8902
8903 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8904 {
8905 unsigned short value2 = op2->us;
8906
8907 exp->type = 2;
8908 exp->string = PrintUShort(op1->us < value2);
8909 if(!exp->expType)
8910 {
8911 exp->expType = op1->type;
8912 if(op1->type)
8913 op1->type->refCount++;
8914 }
8915 return 0x1;
8916 }
8917
8918 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8919 {
8920 char value2 = op2->c;
8921
8922 exp->type = 2;
8923 exp->string = PrintChar(op1->c < value2);
8924 if(!exp->expType)
8925 {
8926 exp->expType = op1->type;
8927 if(op1->type)
8928 op1->type->refCount++;
8929 }
8930 return 0x1;
8931 }
8932
8933 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8934 {
8935 unsigned char value2 = op2->uc;
8936
8937 exp->type = 2;
8938 exp->string = PrintUChar(op1->uc < value2);
8939 if(!exp->expType)
8940 {
8941 exp->expType = op1->type;
8942 if(op1->type)
8943 op1->type->refCount++;
8944 }
8945 return 0x1;
8946 }
8947
8948 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8949 {
8950 float value2 = op2->f;
8951
8952 exp->type = 2;
8953 exp->string = PrintFloat(op1->f < value2);
8954 if(!exp->expType)
8955 {
8956 exp->expType = op1->type;
8957 if(op1->type)
8958 op1->type->refCount++;
8959 }
8960 return 0x1;
8961 }
8962
8963 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8964 {
8965 double value2 = op2->d;
8966
8967 exp->type = 2;
8968 exp->string = PrintDouble(op1->d < value2);
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 IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8979 {
8980 int value2 = op2->i;
8981
8982 exp->type = 2;
8983 exp->string = PrintInt(op1->i >= value2);
8984 if(!exp->expType)
8985 {
8986 exp->expType = op1->type;
8987 if(op1->type)
8988 op1->type->refCount++;
8989 }
8990 return 0x1;
8991 }
8992
8993 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8994 {
8995 unsigned int value2 = op2->ui;
8996
8997 exp->type = 2;
8998 exp->string = PrintUInt(op1->ui >= value2);
8999 if(!exp->expType)
9000 {
9001 exp->expType = op1->type;
9002 if(op1->type)
9003 op1->type->refCount++;
9004 }
9005 return 0x1;
9006 }
9007
9008 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9009 {
9010 short value2 = op2->s;
9011
9012 exp->type = 2;
9013 exp->string = PrintShort(op1->s >= value2);
9014 if(!exp->expType)
9015 {
9016 exp->expType = op1->type;
9017 if(op1->type)
9018 op1->type->refCount++;
9019 }
9020 return 0x1;
9021 }
9022
9023 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9024 {
9025 unsigned short value2 = op2->us;
9026
9027 exp->type = 2;
9028 exp->string = PrintUShort(op1->us >= value2);
9029 if(!exp->expType)
9030 {
9031 exp->expType = op1->type;
9032 if(op1->type)
9033 op1->type->refCount++;
9034 }
9035 return 0x1;
9036 }
9037
9038 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9039 {
9040 char value2 = op2->c;
9041
9042 exp->type = 2;
9043 exp->string = PrintChar(op1->c >= value2);
9044 if(!exp->expType)
9045 {
9046 exp->expType = op1->type;
9047 if(op1->type)
9048 op1->type->refCount++;
9049 }
9050 return 0x1;
9051 }
9052
9053 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9054 {
9055 unsigned char value2 = op2->uc;
9056
9057 exp->type = 2;
9058 exp->string = PrintUChar(op1->uc >= value2);
9059 if(!exp->expType)
9060 {
9061 exp->expType = op1->type;
9062 if(op1->type)
9063 op1->type->refCount++;
9064 }
9065 return 0x1;
9066 }
9067
9068 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9069 {
9070 float value2 = op2->f;
9071
9072 exp->type = 2;
9073 exp->string = PrintFloat(op1->f >= value2);
9074 if(!exp->expType)
9075 {
9076 exp->expType = op1->type;
9077 if(op1->type)
9078 op1->type->refCount++;
9079 }
9080 return 0x1;
9081 }
9082
9083 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9084 {
9085 double value2 = op2->d;
9086
9087 exp->type = 2;
9088 exp->string = PrintDouble(op1->d >= value2);
9089 if(!exp->expType)
9090 {
9091 exp->expType = op1->type;
9092 if(op1->type)
9093 op1->type->refCount++;
9094 }
9095 return 0x1;
9096 }
9097
9098 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9099 {
9100 int value2 = op2->i;
9101
9102 exp->type = 2;
9103 exp->string = PrintInt(op1->i <= value2);
9104 if(!exp->expType)
9105 {
9106 exp->expType = op1->type;
9107 if(op1->type)
9108 op1->type->refCount++;
9109 }
9110 return 0x1;
9111 }
9112
9113 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9114 {
9115 unsigned int value2 = op2->ui;
9116
9117 exp->type = 2;
9118 exp->string = PrintUInt(op1->ui <= value2);
9119 if(!exp->expType)
9120 {
9121 exp->expType = op1->type;
9122 if(op1->type)
9123 op1->type->refCount++;
9124 }
9125 return 0x1;
9126 }
9127
9128 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9129 {
9130 short value2 = op2->s;
9131
9132 exp->type = 2;
9133 exp->string = PrintShort(op1->s <= value2);
9134 if(!exp->expType)
9135 {
9136 exp->expType = op1->type;
9137 if(op1->type)
9138 op1->type->refCount++;
9139 }
9140 return 0x1;
9141 }
9142
9143 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9144 {
9145 unsigned short value2 = op2->us;
9146
9147 exp->type = 2;
9148 exp->string = PrintUShort(op1->us <= value2);
9149 if(!exp->expType)
9150 {
9151 exp->expType = op1->type;
9152 if(op1->type)
9153 op1->type->refCount++;
9154 }
9155 return 0x1;
9156 }
9157
9158 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9159 {
9160 char value2 = op2->c;
9161
9162 exp->type = 2;
9163 exp->string = PrintChar(op1->c <= value2);
9164 if(!exp->expType)
9165 {
9166 exp->expType = op1->type;
9167 if(op1->type)
9168 op1->type->refCount++;
9169 }
9170 return 0x1;
9171 }
9172
9173 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9174 {
9175 unsigned char value2 = op2->uc;
9176
9177 exp->type = 2;
9178 exp->string = PrintUChar(op1->uc <= value2);
9179 if(!exp->expType)
9180 {
9181 exp->expType = op1->type;
9182 if(op1->type)
9183 op1->type->refCount++;
9184 }
9185 return 0x1;
9186 }
9187
9188 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9189 {
9190 float value2 = op2->f;
9191
9192 exp->type = 2;
9193 exp->string = PrintFloat(op1->f <= value2);
9194 if(!exp->expType)
9195 {
9196 exp->expType = op1->type;
9197 if(op1->type)
9198 op1->type->refCount++;
9199 }
9200 return 0x1;
9201 }
9202
9203 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9204 {
9205 double value2 = op2->d;
9206
9207 exp->type = 2;
9208 exp->string = PrintDouble(op1->d <= value2);
9209 if(!exp->expType)
9210 {
9211 exp->expType = op1->type;
9212 if(op1->type)
9213 op1->type->refCount++;
9214 }
9215 return 0x1;
9216 }
9217
9218 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9219 {
9220 exp->type = 2;
9221 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9222 if(!exp->expType)
9223 {
9224 exp->expType = op1->type;
9225 if(op1->type)
9226 op1->type->refCount++;
9227 }
9228 return 0x1;
9229 }
9230
9231 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9232 {
9233 exp->type = 2;
9234 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9235 if(!exp->expType)
9236 {
9237 exp->expType = op1->type;
9238 if(op1->type)
9239 op1->type->refCount++;
9240 }
9241 return 0x1;
9242 }
9243
9244 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9245 {
9246 exp->type = 2;
9247 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9248 if(!exp->expType)
9249 {
9250 exp->expType = op1->type;
9251 if(op1->type)
9252 op1->type->refCount++;
9253 }
9254 return 0x1;
9255 }
9256
9257 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9258 {
9259 exp->type = 2;
9260 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9261 if(!exp->expType)
9262 {
9263 exp->expType = op1->type;
9264 if(op1->type)
9265 op1->type->refCount++;
9266 }
9267 return 0x1;
9268 }
9269
9270 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9271 {
9272 exp->type = 2;
9273 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9274 if(!exp->expType)
9275 {
9276 exp->expType = op1->type;
9277 if(op1->type)
9278 op1->type->refCount++;
9279 }
9280 return 0x1;
9281 }
9282
9283 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9284 {
9285 exp->type = 2;
9286 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9287 if(!exp->expType)
9288 {
9289 exp->expType = op1->type;
9290 if(op1->type)
9291 op1->type->refCount++;
9292 }
9293 return 0x1;
9294 }
9295
9296 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9297 {
9298 exp->type = 2;
9299 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9300 if(!exp->expType)
9301 {
9302 exp->expType = op1->type;
9303 if(op1->type)
9304 op1->type->refCount++;
9305 }
9306 return 0x1;
9307 }
9308
9309 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9310 {
9311 exp->type = 2;
9312 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9313 if(!exp->expType)
9314 {
9315 exp->expType = op1->type;
9316 if(op1->type)
9317 op1->type->refCount++;
9318 }
9319 return 0x1;
9320 }
9321
9322 struct OpTable intOps = 
9323 {
9324 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
9325 };
9326
9327 struct OpTable uintOps = 
9328 {
9329 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
9330 };
9331
9332 struct OpTable shortOps = 
9333 {
9334 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
9335 };
9336
9337 struct OpTable ushortOps = 
9338 {
9339 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
9340 };
9341
9342 struct OpTable floatOps = 
9343 {
9344 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
9345 };
9346
9347 struct OpTable doubleOps = 
9348 {
9349 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
9350 };
9351
9352 struct OpTable charOps = 
9353 {
9354 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
9355 };
9356
9357 struct OpTable ucharOps = 
9358 {
9359 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
9360 };
9361
9362 void ReadString(char * output, char * string)
9363 {
9364 int len = strlen(string);
9365 int c, d = 0;
9366 unsigned int quoted = 0x0, escaped = 0x0;
9367
9368 for(c = 0; c < len; c++)
9369 {
9370 char ch = string[c];
9371
9372 if(escaped)
9373 {
9374 switch(ch)
9375 {
9376 case 'n':
9377 output[d] = '\n';
9378 break;
9379 case 't':
9380 output[d] = '\t';
9381 break;
9382 case 'a':
9383 output[d] = '\a';
9384 break;
9385 case 'b':
9386 output[d] = '\b';
9387 break;
9388 case 'f':
9389 output[d] = '\f';
9390 break;
9391 case 'r':
9392 output[d] = '\r';
9393 break;
9394 case 'v':
9395 output[d] = '\v';
9396 break;
9397 case '\\':
9398 output[d] = '\\';
9399 break;
9400 case '\"':
9401 output[d] = '\"';
9402 break;
9403 default:
9404 output[d++] = '\\';
9405 output[d] = ch;
9406 }
9407 d++;
9408 escaped = 0x0;
9409 }
9410 else
9411 {
9412 if(ch == '\"')
9413 quoted ^= 0x1;
9414 else if(quoted)
9415 {
9416 if(ch == '\\')
9417 escaped = 0x1;
9418 else
9419 output[d++] = ch;
9420 }
9421 }
9422 }
9423 output[d] = '\0';
9424 }
9425
9426 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
9427
9428 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
9429
9430 extern double strtod(char * , char * * );
9431
9432 struct Operand GetOperand(struct Expression * exp)
9433 {
9434 struct Operand op = 
9435 {
9436 0, 0, 0, 0, 
9437 {
9438 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
9439 }
9440 };
9441 struct Type * type = exp->expType;
9442
9443 if(type)
9444 {
9445 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9446 {
9447 if(!type->_class->registered->dataType)
9448 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9449 type = type->_class->registered->dataType;
9450 }
9451 op.kind = type->kind;
9452 op.type = exp->expType;
9453 if(exp->isConstant && exp->type == 2)
9454 {
9455 switch(op.kind)
9456 {
9457 case 1:
9458 {
9459 if(exp->constant[0] == '\'')
9460 op.c = exp->constant[1];
9461 else if(type->isSigned)
9462 {
9463 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9464 op.ops = charOps;
9465 }
9466 else
9467 {
9468 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9469 op.ops = ucharOps;
9470 }
9471 break;
9472 }
9473 case 2:
9474 if(type->isSigned)
9475 {
9476 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9477 op.ops = shortOps;
9478 }
9479 else
9480 {
9481 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9482 op.ops = ushortOps;
9483 }
9484 break;
9485 case 3:
9486 case 5:
9487 if(type->isSigned)
9488 {
9489 op.i = strtol(exp->constant, (((void *)0)), 0);
9490 op.ops = intOps;
9491 }
9492 else
9493 {
9494 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9495 op.ops = uintOps;
9496 }
9497 op.kind = 3;
9498 break;
9499 case 4:
9500 if(type->isSigned)
9501 {
9502 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9503 op.ops = intOps;
9504 }
9505 else
9506 {
9507 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9508 op.ops = uintOps;
9509 }
9510 op.kind = 3;
9511 break;
9512 case 22:
9513 if(type->isSigned)
9514 {
9515 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9516 op.ops = intOps;
9517 }
9518 else
9519 {
9520 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9521 op.ops = uintOps;
9522 }
9523 op.kind = 3;
9524 break;
9525 case 23:
9526 if(type->isSigned)
9527 {
9528 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
9529 op.ops = intOps;
9530 }
9531 else
9532 {
9533 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9534 op.ops = uintOps;
9535 }
9536 op.kind = 3;
9537 break;
9538 case 6:
9539 op.f = (float)strtod(exp->constant, (((void *)0)));
9540 op.ops = floatOps;
9541 break;
9542 case 7:
9543 op.d = (double)strtod(exp->constant, (((void *)0)));
9544 op.ops = doubleOps;
9545 break;
9546 case 12:
9547 case 13:
9548 case 8:
9549 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
9550 op.kind = 13;
9551 op.ops = uintOps;
9552 break;
9553 }
9554 }
9555 }
9556 return op;
9557 }
9558
9559 int __ecereVMethodID_class_OnGetString;
9560
9561 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9562
9563 static void UnusedFunction()
9564 {
9565 int a;
9566
9567 ((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);
9568 }
9569
9570 extern int __ecereVMethodID_class_OnGetString;
9571
9572 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9573 {
9574 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9575
9576 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9577 {
9578 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9579 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9580 else
9581 {
9582 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9583 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9584 struct Type * type;
9585 void * ptr = inst->data + dataMember->offset + offset;
9586 char * result = (((void *)0));
9587
9588 exp->loc = member->loc = inst->loc;
9589 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9590 if(!dataMember->dataType)
9591 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9592 type = dataMember->dataType;
9593 if(type->kind == 8)
9594 {
9595 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9596
9597 if(_class->type == 4)
9598 {
9599 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9600
9601 if(enumClass)
9602 {
9603 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9604 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9605
9606 for(item = e->values.first; item; item = item->next)
9607 {
9608 if((int)item->data == *(int *)ptr)
9609 {
9610 result = item->name;
9611 break;
9612 }
9613 }
9614 if(result)
9615 {
9616 exp->identifier = MkIdentifier(result);
9617 exp->type = 0;
9618 exp->destType = MkClassType(_class->fullName);
9619 ProcessExpressionType(exp);
9620 }
9621 }
9622 }
9623 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9624 {
9625 if(!_class->dataType)
9626 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9627 type = _class->dataType;
9628 }
9629 }
9630 if(!result)
9631 {
9632 switch(type->kind)
9633 {
9634 case 6:
9635 {
9636 FreeExpContents(exp);
9637 exp->constant = PrintFloat(*(float *)ptr);
9638 exp->type = 2;
9639 break;
9640 }
9641 case 7:
9642 {
9643 FreeExpContents(exp);
9644 exp->constant = PrintDouble(*(double *)ptr);
9645 exp->type = 2;
9646 break;
9647 }
9648 case 3:
9649 {
9650 FreeExpContents(exp);
9651 exp->constant = PrintInt(*(int *)ptr);
9652 exp->type = 2;
9653 break;
9654 }
9655 case 4:
9656 {
9657 FreeExpContents(exp);
9658 exp->constant = PrintInt64(*(long long *)ptr);
9659 exp->type = 2;
9660 break;
9661 }
9662 case 22:
9663 {
9664 FreeExpContents(exp);
9665 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9666 exp->type = 2;
9667 break;
9668 }
9669 case 23:
9670 {
9671 FreeExpContents(exp);
9672 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9673 exp->type = 2;
9674 break;
9675 }
9676 default:
9677 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9678 }
9679 }
9680 ListAdd(memberList, member);
9681 }
9682 if(parentDataMember->type == 1)
9683 break;
9684 }
9685 }
9686
9687 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9688
9689 void PopulateInstance(struct Instantiation * inst)
9690 {
9691 struct Symbol * classSym = inst->_class->symbol;
9692 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9693 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9694 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9695
9696 if(!inst->members)
9697 inst->members = MkListOne(MkMembersInitList(memberList));
9698 else
9699 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
9700 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9701 {
9702 if(!dataMember->isProperty)
9703 {
9704 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9705 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9706 else
9707 {
9708 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9709 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9710 struct Type * type;
9711 void * ptr = inst->data + dataMember->offset;
9712 char * result = (((void *)0));
9713
9714 exp->loc = member->loc = inst->loc;
9715 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9716 if(!dataMember->dataType)
9717 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9718 type = dataMember->dataType;
9719 if(type->kind == 8)
9720 {
9721 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9722
9723 if(_class->type == 4)
9724 {
9725 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9726
9727 if(enumClass)
9728 {
9729 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9730 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9731
9732 for(item = e->values.first; item; item = item->next)
9733 {
9734 if((int)item->data == *(int *)ptr)
9735 {
9736 result = item->name;
9737 break;
9738 }
9739 }
9740 }
9741 if(result)
9742 {
9743 exp->identifier = MkIdentifier(result);
9744 exp->type = 0;
9745 exp->destType = MkClassType(_class->fullName);
9746 ProcessExpressionType(exp);
9747 }
9748 }
9749 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9750 {
9751 if(!_class->dataType)
9752 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9753 type = _class->dataType;
9754 }
9755 }
9756 if(!result)
9757 {
9758 switch(type->kind)
9759 {
9760 case 6:
9761 {
9762 exp->constant = PrintFloat(*(float *)ptr);
9763 exp->type = 2;
9764 break;
9765 }
9766 case 7:
9767 {
9768 exp->constant = PrintDouble(*(double *)ptr);
9769 exp->type = 2;
9770 break;
9771 }
9772 case 3:
9773 {
9774 exp->constant = PrintInt(*(int *)ptr);
9775 exp->type = 2;
9776 break;
9777 }
9778 case 4:
9779 {
9780 exp->constant = PrintInt64(*(long long *)ptr);
9781 exp->type = 2;
9782 break;
9783 }
9784 case 22:
9785 {
9786 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9787 exp->type = 2;
9788 break;
9789 }
9790 default:
9791 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9792 }
9793 }
9794 ListAdd(memberList, member);
9795 }
9796 }
9797 }
9798 }
9799
9800 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);
9801
9802 extern void FreeInstance(struct Instantiation * inst);
9803
9804 void ComputeInstantiation(struct Expression * exp)
9805 {
9806 struct Instantiation * inst = exp->instance;
9807 struct MembersInit * members;
9808 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9809 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9810 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9811 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9812 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9813 int subMemberStackPos = 0;
9814 uint64 bits = 0;
9815
9816 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9817 {
9818 if(inst->data)
9819 return ;
9820 if(_class->type == 0 || _class->type == 5)
9821 {
9822 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9823 if(_class->type == 0)
9824 ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)inst->data))->_refCount++;
9825 }
9826 else
9827 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9828 }
9829 if(inst->members)
9830 {
9831 for(members = (*inst->members).first; members; members = members->next)
9832 {
9833 switch(members->type)
9834 {
9835 case 0:
9836 {
9837 if(members->dataMembers)
9838 {
9839 struct MemberInit * member;
9840
9841 for(member = (*members->dataMembers).first; member; member = member->next)
9842 {
9843 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9844 unsigned int found = 0x0;
9845 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9846 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9847 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9848 unsigned int dataMemberOffset;
9849
9850 if(!ident)
9851 {
9852 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9853 if(curMember)
9854 {
9855 if(curMember->isProperty)
9856 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9857 else
9858 {
9859 dataMember = curMember;
9860 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9861 if(_class->type == 0)
9862 dataMemberOffset += _class->base->structSize;
9863 }
9864 found = 0x1;
9865 }
9866 }
9867 else
9868 {
9869 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9870 if(prop)
9871 {
9872 found = 0x1;
9873 if(prop->memberAccess == 1)
9874 {
9875 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9876 curClass = prop->_class;
9877 }
9878 }
9879 else
9880 {
9881 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9882 int _subMemberStackPos = 0;
9883
9884 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9885 if(dataMember)
9886 {
9887 found = 0x1;
9888 if(dataMember->memberAccess == 1)
9889 {
9890 curMember = dataMember;
9891 curClass = dataMember->_class;
9892 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
9893 subMemberStackPos = _subMemberStackPos;
9894 }
9895 }
9896 }
9897 }
9898 if(found && member->initializer && member->initializer->type == 0)
9899 {
9900 struct Expression * value = member->initializer->exp;
9901 struct Type * type = (((void *)0));
9902 unsigned int deepMember = 0x0;
9903
9904 if(prop)
9905 {
9906 type = prop->dataType;
9907 }
9908 else if(dataMember)
9909 {
9910 if(!dataMember->dataType)
9911 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9912 type = dataMember->dataType;
9913 }
9914 if(ident && ident->next)
9915 {
9916 deepMember = 0x1;
9917 for(ident = ident->next; ident && type; ident = ident->next)
9918 {
9919 if(type->kind == 8)
9920 {
9921 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9922 if(prop)
9923 type = prop->dataType;
9924 else
9925 {
9926 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9927 if(dataMember)
9928 type = dataMember->dataType;
9929 }
9930 }
9931 else if(type->kind == 9 || type->kind == 10)
9932 {
9933 struct Type * memberType;
9934
9935 for(memberType = type->members.first; memberType; memberType = memberType->next)
9936 {
9937 if(!strcmp(memberType->name, ident->string))
9938 {
9939 type = memberType;
9940 break;
9941 }
9942 }
9943 }
9944 }
9945 }
9946 if(value)
9947 {
9948 FreeType(value->destType);
9949 value->destType = type;
9950 if(type)
9951 type->refCount++;
9952 ComputeExpression(value);
9953 }
9954 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9955 {
9956 if(type->kind == 8)
9957 {
9958 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9959
9960 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9961 {
9962 if(!_class->dataType)
9963 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9964 type = _class->dataType;
9965 }
9966 }
9967 if(dataMember)
9968 {
9969 void * ptr = inst->data + dataMemberOffset;
9970
9971 if(value->type == 2)
9972 {
9973 switch(type->kind)
9974 {
9975 case 3:
9976 {
9977 GetInt(value, (int *)ptr);
9978 break;
9979 }
9980 case 4:
9981 {
9982 GetInt64(value, (long long *)ptr);
9983 break;
9984 }
9985 case 22:
9986 {
9987 GetIntPtr(value, (intptr_t *)ptr);
9988 break;
9989 }
9990 case 23:
9991 {
9992 GetIntSize(value, (ssize_t *)ptr);
9993 break;
9994 }
9995 case 6:
9996 {
9997 GetFloat(value, (float *)ptr);
9998 break;
9999 }
10000 case 7:
10001 {
10002 GetDouble(value, (double *)ptr);
10003 break;
10004 }
10005 }
10006 }
10007 else if(value->type == 1)
10008 {
10009 if(type->kind == 8)
10010 {
10011 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10012
10013 if(_class->type == 1)
10014 {
10015 ComputeTypeSize(type);
10016 if(value->instance->data)
10017 memcpy(ptr, value->instance->data, type->size);
10018 }
10019 }
10020 }
10021 }
10022 else if(prop)
10023 {
10024 if(value->type == 1 && value->instance->data)
10025 {
10026 if(type->kind == 8)
10027 {
10028 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10029
10030 if(_class && (_class->type != 0 || __ecereNameSpace__ecere__com__eClass_IsDerived(((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)value->instance->data))->_class, _class)))
10031 {
10032 void (* Set)(void *, void *) = (void *)prop->Set;
10033
10034 Set(inst->data, value->instance->data);
10035 PopulateInstance(inst);
10036 }
10037 }
10038 }
10039 else if(value->type == 2)
10040 {
10041 switch(type->kind)
10042 {
10043 case 7:
10044 {
10045 void (* Set)(void *, double) = (void *)prop->Set;
10046
10047 Set(inst->data, strtod(value->constant, (((void *)0))));
10048 break;
10049 }
10050 case 6:
10051 {
10052 void (* Set)(void *, float) = (void *)prop->Set;
10053
10054 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
10055 break;
10056 }
10057 case 3:
10058 {
10059 void (* Set)(void *, int) = (void *)prop->Set;
10060
10061 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
10062 break;
10063 }
10064 case 4:
10065 {
10066 void (* Set)(void *, long long) = (void *)prop->Set;
10067
10068 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10069 break;
10070 }
10071 case 22:
10072 {
10073 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10074
10075 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10076 break;
10077 }
10078 case 23:
10079 {
10080 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10081
10082 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
10083 break;
10084 }
10085 }
10086 }
10087 else if(value->type == 3)
10088 {
10089 char temp[1024];
10090
10091 ReadString(temp, value->string);
10092 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
10093 }
10094 }
10095 }
10096 else if(!deepMember && type && _class->type == 3)
10097 {
10098 if(prop)
10099 {
10100 if(value->type == 2)
10101 {
10102 if(type->kind == 8)
10103 {
10104 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10105
10106 if(_class->type == 3)
10107 {
10108 if(!_class->dataType)
10109 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10110 type = _class->dataType;
10111 }
10112 }
10113 switch(type->kind)
10114 {
10115 case 6:
10116 {
10117 float fValue;
10118 float (* Set)(float) = (void *)prop->Set;
10119
10120 GetFloat(member->initializer->exp, &fValue);
10121 exp->constant = PrintFloat(Set(fValue));
10122 exp->type = 2;
10123 break;
10124 }
10125 case 7:
10126 {
10127 double dValue;
10128 double (* Set)(double) = (void *)prop->Set;
10129
10130 GetDouble(member->initializer->exp, &dValue);
10131 exp->constant = PrintDouble(Set(dValue));
10132 exp->type = 2;
10133 break;
10134 }
10135 }
10136 }
10137 }
10138 }
10139 else if(!deepMember && type && _class->type == 2)
10140 {
10141 if(prop)
10142 {
10143 if(value->type == 1 && value->instance->data)
10144 {
10145 unsigned int (* Set)(void *) = (void *)prop->Set;
10146
10147 bits = Set(value->instance->data);
10148 }
10149 else if(value->type == 2)
10150 {
10151 }
10152 }
10153 else if(dataMember)
10154 {
10155 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
10156 struct Type * type;
10157 int part = 0;
10158
10159 GetInt(value, &part);
10160 bits = (bits & ~bitMember->mask);
10161 if(!bitMember->dataType)
10162 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
10163 type = bitMember->dataType;
10164 if(type->kind == 8 && type->_class && type->_class->registered)
10165 {
10166 if(!type->_class->registered->dataType)
10167 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10168 type = type->_class->registered->dataType;
10169 }
10170 switch(type->kind)
10171 {
10172 case 1:
10173 if(type->isSigned)
10174 bits |= ((char)part << bitMember->pos);
10175 else
10176 bits |= ((unsigned char)part << bitMember->pos);
10177 break;
10178 case 2:
10179 if(type->isSigned)
10180 bits |= ((short)part << bitMember->pos);
10181 else
10182 bits |= ((unsigned short)part << bitMember->pos);
10183 break;
10184 case 3:
10185 case 5:
10186 if(type->isSigned)
10187 bits |= (part << bitMember->pos);
10188 else
10189 bits |= ((unsigned int)part << bitMember->pos);
10190 break;
10191 case 4:
10192 if(type->isSigned)
10193 bits |= ((long long)part << bitMember->pos);
10194 else
10195 bits |= ((uint64)part << bitMember->pos);
10196 break;
10197 case 22:
10198 if(type->isSigned)
10199 {
10200 bits |= ((intptr_t)part << bitMember->pos);
10201 }
10202 else
10203 {
10204 bits |= ((uintptr_t)part << bitMember->pos);
10205 }
10206 break;
10207 case 23:
10208 if(type->isSigned)
10209 {
10210 bits |= ((ssize_t)part << bitMember->pos);
10211 }
10212 else
10213 {
10214 bits |= ((size_t)part << bitMember->pos);
10215 }
10216 break;
10217 }
10218 }
10219 }
10220 }
10221 else
10222 {
10223 if(_class && _class->type == 3)
10224 {
10225 ComputeExpression(member->initializer->exp);
10226 exp->constant = member->initializer->exp->constant;
10227 exp->type = 2;
10228 member->initializer->exp->constant = (((void *)0));
10229 }
10230 }
10231 }
10232 }
10233 break;
10234 }
10235 }
10236 }
10237 }
10238 if(_class && _class->type == 2)
10239 {
10240 exp->constant = PrintHexUInt(bits);
10241 exp->type = 2;
10242 }
10243 if(exp->type != 1)
10244 {
10245 FreeInstance(inst);
10246 }
10247 }
10248
10249 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10250 {
10251 if(exp->op.op == SIZEOF)
10252 {
10253 FreeExpContents(exp);
10254 exp->type = 2;
10255 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10256 }
10257 else
10258 {
10259 if(!exp->op.exp1)
10260 {
10261 switch(exp->op.op)
10262 {
10263 case '+':
10264 {
10265 struct Expression * exp2 = exp->op.exp2;
10266
10267 exp->op.exp2 = (((void *)0));
10268 FreeExpContents(exp);
10269 FreeType(exp->expType);
10270 FreeType(exp->destType);
10271 *exp = *exp2;
10272 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10273 break;
10274 }
10275 case '-':
10276 if(op1->ops.Neg)
10277 {
10278 FreeExpContents(exp);
10279 op1->ops.Neg(exp, op1);
10280 }
10281 break;
10282 case '~':
10283 if(op1->ops.BitNot)
10284 {
10285 FreeExpContents(exp);
10286 op1->ops.BitNot(exp, op1);
10287 }
10288 break;
10289 case '!':
10290 if(op1->ops.Not)
10291 {
10292 FreeExpContents(exp);
10293 op1->ops.Not(exp, op1);
10294 }
10295 break;
10296 }
10297 }
10298 else
10299 {
10300 switch(exp->op.op)
10301 {
10302 case '+':
10303 if(op1->ops.Add)
10304 {
10305 FreeExpContents(exp);
10306 op1->ops.Add(exp, op1, op2);
10307 }
10308 break;
10309 case '-':
10310 if(op1->ops.Sub)
10311 {
10312 FreeExpContents(exp);
10313 op1->ops.Sub(exp, op1, op2);
10314 }
10315 break;
10316 case '*':
10317 if(op1->ops.Mul)
10318 {
10319 FreeExpContents(exp);
10320 op1->ops.Mul(exp, op1, op2);
10321 }
10322 break;
10323 case '/':
10324 if(op1->ops.Div)
10325 {
10326 FreeExpContents(exp);
10327 op1->ops.Div(exp, op1, op2);
10328 }
10329 break;
10330 case '%':
10331 if(op1->ops.Mod)
10332 {
10333 FreeExpContents(exp);
10334 op1->ops.Mod(exp, op1, op2);
10335 }
10336 break;
10337 case '&':
10338 if(exp->op.exp2)
10339 {
10340 if(op1->ops.BitAnd)
10341 {
10342 FreeExpContents(exp);
10343 op1->ops.BitAnd(exp, op1, op2);
10344 }
10345 }
10346 break;
10347 case '|':
10348 if(op1->ops.BitOr)
10349 {
10350 FreeExpContents(exp);
10351 op1->ops.BitOr(exp, op1, op2);
10352 }
10353 break;
10354 case '^':
10355 if(op1->ops.BitXor)
10356 {
10357 FreeExpContents(exp);
10358 op1->ops.BitXor(exp, op1, op2);
10359 }
10360 break;
10361 case LEFT_OP:
10362 if(op1->ops.LShift)
10363 {
10364 FreeExpContents(exp);
10365 op1->ops.LShift(exp, op1, op2);
10366 }
10367 break;
10368 case RIGHT_OP:
10369 if(op1->ops.RShift)
10370 {
10371 FreeExpContents(exp);
10372 op1->ops.RShift(exp, op1, op2);
10373 }
10374 break;
10375 case EQ_OP:
10376 if(op1->ops.Equ)
10377 {
10378 FreeExpContents(exp);
10379 op1->ops.Equ(exp, op1, op2);
10380 }
10381 break;
10382 case NE_OP:
10383 if(op1->ops.Nqu)
10384 {
10385 FreeExpContents(exp);
10386 op1->ops.Nqu(exp, op1, op2);
10387 }
10388 break;
10389 case AND_OP:
10390 if(op1->ops.And)
10391 {
10392 FreeExpContents(exp);
10393 op1->ops.And(exp, op1, op2);
10394 }
10395 break;
10396 case OR_OP:
10397 if(op1->ops.Or)
10398 {
10399 FreeExpContents(exp);
10400 op1->ops.Or(exp, op1, op2);
10401 }
10402 break;
10403 case '>':
10404 if(op1->ops.Grt)
10405 {
10406 FreeExpContents(exp);
10407 op1->ops.Grt(exp, op1, op2);
10408 }
10409 break;
10410 case '<':
10411 if(op1->ops.Sma)
10412 {
10413 FreeExpContents(exp);
10414 op1->ops.Sma(exp, op1, op2);
10415 }
10416 break;
10417 case GE_OP:
10418 if(op1->ops.GrtEqu)
10419 {
10420 FreeExpContents(exp);
10421 op1->ops.GrtEqu(exp, op1, op2);
10422 }
10423 break;
10424 case LE_OP:
10425 if(op1->ops.SmaEqu)
10426 {
10427 FreeExpContents(exp);
10428 op1->ops.SmaEqu(exp, op1, op2);
10429 }
10430 break;
10431 }
10432 }
10433 }
10434 }
10435
10436 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
10437
10438 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10439
10440 void ComputeExpression(struct Expression * exp)
10441 {
10442 char expString[10240];
10443
10444 expString[0] = '\0';
10445 switch(exp->type)
10446 {
10447 case 1:
10448 {
10449 ComputeInstantiation(exp);
10450 break;
10451 }
10452 case 4:
10453 {
10454 struct Expression * exp1, * exp2 = (((void *)0));
10455 struct Operand op1 = 
10456 {
10457 0, 0, 0, 0, 
10458 {
10459 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
10460 }
10461 };
10462 struct Operand op2 = 
10463 {
10464 0, 0, 0, 0, 
10465 {
10466 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
10467 }
10468 };
10469
10470 if(exp->op.exp2)
10471 ComputeExpression(exp->op.exp2);
10472 if(exp->op.exp1)
10473 {
10474 ComputeExpression(exp->op.exp1);
10475 exp1 = exp->op.exp1;
10476 exp2 = exp->op.exp2;
10477 op1 = GetOperand(exp1);
10478 if(op1.type)
10479 op1.type->refCount++;
10480 if(exp2)
10481 {
10482 op2 = GetOperand(exp2);
10483 if(op2.type)
10484 op2.type->refCount++;
10485 }
10486 }
10487 else
10488 {
10489 exp1 = exp->op.exp2;
10490 op1 = GetOperand(exp1);
10491 if(op1.type)
10492 op1.type->refCount++;
10493 }
10494 CallOperator(exp, exp1, exp2, &op1, &op2);
10495 if(op1.type)
10496 FreeType(op1.type);
10497 if(op2.type)
10498 FreeType(op2.type);
10499 break;
10500 }
10501 case 5:
10502 case 34:
10503 {
10504 struct Expression * e, * n;
10505
10506 for(e = (*exp->list).first; e; e = n)
10507 {
10508 n = e->next;
10509 if(!n)
10510 {
10511 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10512
10513 ComputeExpression(e);
10514 FreeType(exp->expType);
10515 FreeType(exp->destType);
10516 *exp = *e;
10517 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10518 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10519 }
10520 else
10521 {
10522 FreeExpression(e);
10523 }
10524 }
10525 break;
10526 }
10527 case 8:
10528 {
10529 struct Expression * memberExp = exp->member.exp;
10530 struct Identifier * memberID = exp->member.member;
10531 struct Type * type;
10532
10533 ComputeExpression(exp->member.exp);
10534 type = exp->member.exp->expType;
10535 if(type)
10536 {
10537 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)));
10538 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10539 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10540 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10541
10542 if(type->kind == 19 && exp->member.exp->type == 26)
10543 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10544 if(!_class)
10545 {
10546 char string[256];
10547 struct Symbol * classSym;
10548
10549 string[0] = '\0';
10550 PrintTypeNoConst(type, string, 0x0, 0x1);
10551 classSym = FindClass(string);
10552 _class = classSym ? classSym->registered : (((void *)0));
10553 }
10554 if(exp->member.member)
10555 {
10556 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10557 if(!prop)
10558 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10559 }
10560 if(!prop && !member && _class && exp->member.member)
10561 {
10562 struct Symbol * classSym = FindClass(exp->member.member->string);
10563
10564 convertTo = _class;
10565 _class = classSym ? classSym->registered : (((void *)0));
10566 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10567 }
10568 if(prop)
10569 {
10570 if(prop->compiled)
10571 {
10572 struct Type * type = prop->dataType;
10573
10574 if(_class->type == 3)
10575 {
10576 if(type->kind == 8)
10577 {
10578 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10579
10580 if(_class->type == 3)
10581 {
10582 if(!_class->dataType)
10583 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10584 type = _class->dataType;
10585 }
10586 }
10587 switch(type->kind)
10588 {
10589 case 6:
10590 {
10591 float value;
10592 float (* Get)(float) = (void *)prop->Get;
10593
10594 GetFloat(exp->member.exp, &value);
10595 exp->constant = PrintFloat(Get ? Get(value) : value);
10596 exp->type = 2;
10597 break;
10598 }
10599 case 7:
10600 {
10601 double value;
10602 double (* Get)(double);
10603
10604 GetDouble(exp->member.exp, &value);
10605 if(convertTo)
10606 Get = (void *)prop->Set;
10607 else
10608 Get = (void *)prop->Get;
10609 exp->constant = PrintDouble(Get ? Get(value) : value);
10610 exp->type = 2;
10611 break;
10612 }
10613 }
10614 }
10615 else
10616 {
10617 if(convertTo)
10618 {
10619 struct Expression * value = exp->member.exp;
10620 struct Type * type;
10621
10622 if(!prop->dataType)
10623 ProcessPropertyType(prop);
10624 type = prop->dataType;
10625 if(!type)
10626 {
10627 }
10628 else if(_class->type == 1)
10629 {
10630 switch(type->kind)
10631 {
10632 case 8:
10633 {
10634 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10635
10636 if(propertyClass->type == 1 && value->type == 1)
10637 {
10638 void (* Set)(void *, void *) = (void *)prop->Set;
10639
10640 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10641 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10642 exp->instance->_class = MkSpecifierName(_class->fullName);
10643 exp->instance->loc = exp->loc;
10644 exp->type = 1;
10645 Set(exp->instance->data, value->instance->data);
10646 PopulateInstance(exp->instance);
10647 }
10648 break;
10649 }
10650 case 3:
10651 {
10652 int intValue;
10653 void (* Set)(void *, int) = (void *)prop->Set;
10654
10655 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10656 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10657 exp->instance->_class = MkSpecifierName(_class->fullName);
10658 exp->instance->loc = exp->loc;
10659 exp->type = 1;
10660 GetInt(value, &intValue);
10661 Set(exp->instance->data, intValue);
10662 PopulateInstance(exp->instance);
10663 break;
10664 }
10665 case 4:
10666 {
10667 long long intValue;
10668 void (* Set)(void *, long long) = (void *)prop->Set;
10669
10670 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10671 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10672 exp->instance->_class = MkSpecifierName(_class->fullName);
10673 exp->instance->loc = exp->loc;
10674 exp->type = 1;
10675 GetInt64(value, &intValue);
10676 Set(exp->instance->data, intValue);
10677 PopulateInstance(exp->instance);
10678 break;
10679 }
10680 case 22:
10681 {
10682 intptr_t intValue;
10683 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10684
10685 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10686 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10687 exp->instance->_class = MkSpecifierName(_class->fullName);
10688 exp->instance->loc = exp->loc;
10689 exp->type = 1;
10690 GetIntPtr(value, &intValue);
10691 Set(exp->instance->data, intValue);
10692 PopulateInstance(exp->instance);
10693 break;
10694 }
10695 case 23:
10696 {
10697 ssize_t intValue;
10698 void (* Set)(void *, ssize_t) = (void *)prop->Set;
10699
10700 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10701 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10702 exp->instance->_class = MkSpecifierName(_class->fullName);
10703 exp->instance->loc = exp->loc;
10704 exp->type = 1;
10705 GetIntSize(value, &intValue);
10706 Set(exp->instance->data, intValue);
10707 PopulateInstance(exp->instance);
10708 break;
10709 }
10710 case 7:
10711 {
10712 double doubleValue;
10713 void (* Set)(void *, double) = (void *)prop->Set;
10714
10715 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10716 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10717 exp->instance->_class = MkSpecifierName(_class->fullName);
10718 exp->instance->loc = exp->loc;
10719 exp->type = 1;
10720 GetDouble(value, &doubleValue);
10721 Set(exp->instance->data, doubleValue);
10722 PopulateInstance(exp->instance);
10723 break;
10724 }
10725 }
10726 }
10727 else if(_class->type == 2)
10728 {
10729 switch(type->kind)
10730 {
10731 case 8:
10732 {
10733 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10734
10735 if(propertyClass->type == 1 && value->instance->data)
10736 {
10737 unsigned int (* Set)(void *) = (void *)prop->Set;
10738 unsigned int bits = Set(value->instance->data);
10739
10740 exp->constant = PrintHexUInt(bits);
10741 exp->type = 2;
10742 break;
10743 }
10744 else if(_class->type == 2)
10745 {
10746 unsigned int value;
10747 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10748 unsigned int bits;
10749
10750 GetUInt(exp->member.exp, &value);
10751 bits = Set(value);
10752 exp->constant = PrintHexUInt(bits);
10753 exp->type = 2;
10754 }
10755 }
10756 }
10757 }
10758 }
10759 else
10760 {
10761 if(_class->type == 2)
10762 {
10763 unsigned int value;
10764
10765 GetUInt(exp->member.exp, &value);
10766 switch(type->kind)
10767 {
10768 case 8:
10769 {
10770 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10771
10772 if(_class->type == 1)
10773 {
10774 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10775
10776 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10777 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10778 exp->instance->_class = MkSpecifierName(_class->fullName);
10779 exp->instance->loc = exp->loc;
10780 exp->type = 1;
10781 Get(value, exp->instance->data);
10782 PopulateInstance(exp->instance);
10783 }
10784 else if(_class->type == 2)
10785 {
10786 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10787 uint64 bits = Get(value);
10788
10789 exp->constant = PrintHexUInt64(bits);
10790 exp->type = 2;
10791 }
10792 break;
10793 }
10794 }
10795 }
10796 else if(_class->type == 1)
10797 {
10798 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10799
10800 switch(type->kind)
10801 {
10802 case 8:
10803 {
10804 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10805
10806 if(_class->type == 1 && value)
10807 {
10808 void (* Get)(void *, void *) = (void *)prop->Get;
10809
10810 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10811 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10812 exp->instance->_class = MkSpecifierName(_class->fullName);
10813 exp->instance->loc = exp->loc;
10814 exp->type = 1;
10815 Get(value, exp->instance->data);
10816 PopulateInstance(exp->instance);
10817 }
10818 break;
10819 }
10820 }
10821 }
10822 }
10823 }
10824 }
10825 else
10826 {
10827 exp->isConstant = 0x0;
10828 }
10829 }
10830 else if(member)
10831 {
10832 }
10833 }
10834 if(exp->type != 8)
10835 {
10836 FreeExpression(memberExp);
10837 FreeIdentifier(memberID);
10838 }
10839 break;
10840 }
10841 case 10:
10842 {
10843 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10844
10845 FreeExpContents(exp);
10846 exp->constant = PrintUInt(ComputeTypeSize(type));
10847 exp->type = 2;
10848 FreeType(type);
10849 break;
10850 }
10851 case 15:
10852 {
10853 struct Symbol * classSym = exp->_class->symbol;
10854
10855 if(classSym && classSym->registered)
10856 {
10857 if(classSym->registered->fixed)
10858 {
10859 FreeSpecifier(exp->_class);
10860 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10861 exp->type = 2;
10862 }
10863 else
10864 {
10865 char className[1024];
10866
10867 strcpy(className, "__ecereClass_");
10868 FullClassNameCat(className, classSym->string, 0x1);
10869 MangleClassName(className);
10870 DeclareClass(classSym, className);
10871 FreeExpContents(exp);
10872 exp->type = 9;
10873 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10874 exp->member.member = MkIdentifier("structSize");
10875 }
10876 }
10877 break;
10878 }
10879 case 11:
10880 {
10881 struct Type * type;
10882 struct Expression * e = exp;
10883
10884 if(exp->type == 11)
10885 {
10886 if(exp->cast.exp)
10887 ComputeExpression(exp->cast.exp);
10888 e = exp->cast.exp;
10889 }
10890 if(e && exp->expType)
10891 {
10892 type = exp->expType;
10893 if(type->kind == 8)
10894 {
10895 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10896
10897 if(_class && (_class->type == 3 || _class->type == 2))
10898 {
10899 if(!_class->dataType)
10900 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10901 type = _class->dataType;
10902 }
10903 }
10904 switch(type->kind)
10905 {
10906 case 1:
10907 if(type->isSigned)
10908 {
10909 char value;
10910
10911 GetChar(e, &value);
10912 FreeExpContents(exp);
10913 exp->constant = PrintChar(value);
10914 exp->type = 2;
10915 }
10916 else
10917 {
10918 unsigned char value;
10919
10920 GetUChar(e, &value);
10921 FreeExpContents(exp);
10922 exp->constant = PrintUChar(value);
10923 exp->type = 2;
10924 }
10925 break;
10926 case 2:
10927 if(type->isSigned)
10928 {
10929 short value;
10930
10931 GetShort(e, &value);
10932 FreeExpContents(exp);
10933 exp->constant = PrintShort(value);
10934 exp->type = 2;
10935 }
10936 else
10937 {
10938 unsigned short value;
10939
10940 GetUShort(e, &value);
10941 FreeExpContents(exp);
10942 exp->constant = PrintUShort(value);
10943 exp->type = 2;
10944 }
10945 break;
10946 case 3:
10947 if(type->isSigned)
10948 {
10949 int value;
10950
10951 GetInt(e, &value);
10952 FreeExpContents(exp);
10953 exp->constant = PrintInt(value);
10954 exp->type = 2;
10955 }
10956 else
10957 {
10958 unsigned int value;
10959
10960 GetUInt(e, &value);
10961 FreeExpContents(exp);
10962 exp->constant = PrintUInt(value);
10963 exp->type = 2;
10964 }
10965 break;
10966 case 4:
10967 if(type->isSigned)
10968 {
10969 long long value;
10970
10971 GetInt64(e, &value);
10972 FreeExpContents(exp);
10973 exp->constant = PrintInt64(value);
10974 exp->type = 2;
10975 }
10976 else
10977 {
10978 uint64 value;
10979
10980 GetUInt64(e, &value);
10981 FreeExpContents(exp);
10982 exp->constant = PrintUInt64(value);
10983 exp->type = 2;
10984 }
10985 break;
10986 case 22:
10987 if(type->isSigned)
10988 {
10989 intptr_t value;
10990
10991 GetIntPtr(e, &value);
10992 FreeExpContents(exp);
10993 exp->constant = PrintInt64((long long)value);
10994 exp->type = 2;
10995 }
10996 else
10997 {
10998 uintptr_t value;
10999
11000 GetUIntPtr(e, &value);
11001 FreeExpContents(exp);
11002 exp->constant = PrintUInt64((uint64)value);
11003 exp->type = 2;
11004 }
11005 break;
11006 case 23:
11007 if(type->isSigned)
11008 {
11009 ssize_t value;
11010
11011 GetIntSize(e, &value);
11012 FreeExpContents(exp);
11013 exp->constant = PrintInt64((long long)value);
11014 exp->type = 2;
11015 }
11016 else
11017 {
11018 size_t value;
11019
11020 GetUIntSize(e, &value);
11021 FreeExpContents(exp);
11022 exp->constant = PrintUInt64((uint64)value);
11023 exp->type = 2;
11024 }
11025 break;
11026 case 6:
11027 {
11028 float value;
11029
11030 GetFloat(e, &value);
11031 FreeExpContents(exp);
11032 exp->constant = PrintFloat(value);
11033 exp->type = 2;
11034 break;
11035 }
11036 case 7:
11037 {
11038 double value;
11039
11040 GetDouble(e, &value);
11041 FreeExpContents(exp);
11042 exp->constant = PrintDouble(value);
11043 exp->type = 2;
11044 break;
11045 }
11046 }
11047 }
11048 break;
11049 }
11050 case 12:
11051 {
11052 struct Operand op1 = 
11053 {
11054 0, 0, 0, 0, 
11055 {
11056 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
11057 }
11058 };
11059 struct Operand op2 = 
11060 {
11061 0, 0, 0, 0, 
11062 {
11063 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
11064 }
11065 };
11066 struct Operand op3 = 
11067 {
11068 0, 0, 0, 0, 
11069 {
11070 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
11071 }
11072 };
11073
11074 if(exp->cond.exp)
11075 ComputeExpression((*exp->cond.exp).last);
11076 if(exp->cond.elseExp)
11077 ComputeExpression(exp->cond.elseExp);
11078 if(exp->cond.cond)
11079 ComputeExpression(exp->cond.cond);
11080 op1 = GetOperand(exp->cond.cond);
11081 if(op1.type)
11082 op1.type->refCount++;
11083 op2 = GetOperand((*exp->cond.exp).last);
11084 if(op2.type)
11085 op2.type->refCount++;
11086 op3 = GetOperand(exp->cond.elseExp);
11087 if(op3.type)
11088 op3.type->refCount++;
11089 if(op1.ops.Cond)
11090 {
11091 FreeExpContents(exp);
11092 op1.ops.Cond(exp, &op1, &op2, &op3);
11093 }
11094 if(op1.type)
11095 FreeType(op1.type);
11096 if(op2.type)
11097 FreeType(op2.type);
11098 if(op3.type)
11099 FreeType(op3.type);
11100 break;
11101 }
11102 }
11103 }
11104
11105 void ApplyAnyObjectLogic(struct Expression * e);
11106
11107 extern void CopyTypeInto(struct Type * type, struct Type * src);
11108
11109 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
11110 {
11111 unsigned int result = 0x1;
11112
11113 if(destType)
11114 {
11115 struct __ecereNameSpace__ecere__sys__OldList converts = 
11116 {
11117 0, 0, 0, 0, 0
11118 };
11119 struct Conversion * convert;
11120
11121 if(destType->kind == 0)
11122 return 0x0;
11123 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
11124 result = 0x0;
11125 if(converts.count)
11126 {
11127 for(convert = converts.first; convert; convert = convert->next)
11128 {
11129 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
11130
11131 if(!empty)
11132 {
11133 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11134 int objectType = exp->expType ? exp->expType->classObjectType : 0;
11135
11136 *newExp = *exp;
11137 newExp->destType = (((void *)0));
11138 if(convert->isGet)
11139 {
11140 exp->type = 8;
11141 exp->addedThis = 0x1;
11142 exp->member.exp = newExp;
11143 FreeType(exp->member.exp->expType);
11144 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
11145 exp->member.exp->expType->classObjectType = objectType;
11146 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
11147 exp->member.memberType = 1;
11148 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11149 exp->needCast = 0x1;
11150 if(exp->expType)
11151 exp->expType->refCount++;
11152 ApplyAnyObjectLogic(exp->member.exp);
11153 }
11154 else
11155 {
11156 {
11157 exp->type = 8;
11158 exp->addedThis = 0x1;
11159 exp->member.exp = newExp;
11160 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
11161 {
11162 newExp->byReference = 0x1;
11163 }
11164 FreeType(exp->member.exp->expType);
11165 exp->member.exp->expType = (((void *)0));
11166 if(convert->convert->dataType)
11167 {
11168 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11169 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
11170 exp->member.exp->expType->refCount = 1;
11171 exp->member.exp->expType->classObjectType = objectType;
11172 ApplyAnyObjectLogic(exp->member.exp);
11173 }
11174 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
11175 exp->member.memberType = 4;
11176 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11177 exp->needCast = 0x1;
11178 if(convert->resultType)
11179 convert->resultType->refCount++;
11180 }
11181 }
11182 }
11183 else
11184 {
11185 FreeType(exp->expType);
11186 if(convert->isGet)
11187 {
11188 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
11189 exp->needCast = 0x1;
11190 if(exp->expType)
11191 exp->expType->refCount++;
11192 }
11193 else
11194 {
11195 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
11196 exp->needCast = 0x1;
11197 if(convert->resultType)
11198 convert->resultType->refCount++;
11199 }
11200 }
11201 }
11202 if(exp->isConstant && inCompiler)
11203 ComputeExpression(exp);
11204 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
11205 }
11206 if(!result && exp->expType && converts.count)
11207 {
11208 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
11209 }
11210 if(!result && exp->expType && exp->destType)
11211 {
11212 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))
11213 result = 0x1;
11214 }
11215 }
11216 return result;
11217 }
11218
11219 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
11220
11221 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
11222
11223 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
11224
11225 void CheckTemplateTypes(struct Expression * exp)
11226 {
11227 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
11228 {
11229 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11230 struct Statement * compound;
11231 struct Context * context;
11232
11233 *newExp = *exp;
11234 if(exp->destType)
11235 exp->destType->refCount++;
11236 if(exp->expType)
11237 exp->expType->refCount++;
11238 newExp->prev = (((void *)0));
11239 newExp->next = (((void *)0));
11240 switch(exp->expType->kind)
11241 {
11242 case 7:
11243 if(exp->destType->classObjectType)
11244 {
11245 if(exp->destType)
11246 exp->destType->refCount--;
11247 if(exp->expType)
11248 exp->expType->refCount--;
11249 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11250 }
11251 else
11252 {
11253 struct __ecereNameSpace__ecere__sys__OldList * specs;
11254 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11255 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11256
11257 context = PushContext();
11258 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11259 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11260 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11261 exp->type = 25;
11262 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11263 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11264 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11265 exp->compound->compound.context = context;
11266 PopContext(context);
11267 }
11268 break;
11269 default:
11270 exp->type = 11;
11271 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11272 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11273 break;
11274 }
11275 }
11276 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11277 {
11278 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11279 struct Statement * compound;
11280 struct Context * context;
11281
11282 *newExp = *exp;
11283 if(exp->destType)
11284 exp->destType->refCount++;
11285 if(exp->expType)
11286 exp->expType->refCount++;
11287 newExp->prev = (((void *)0));
11288 newExp->next = (((void *)0));
11289 switch(exp->expType->kind)
11290 {
11291 case 7:
11292 if(exp->destType->classObjectType)
11293 {
11294 if(exp->destType)
11295 exp->destType->refCount--;
11296 if(exp->expType)
11297 exp->expType->refCount--;
11298 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11299 }
11300 else
11301 {
11302 struct __ecereNameSpace__ecere__sys__OldList * specs;
11303 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11304 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11305
11306 context = PushContext();
11307 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11308 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11309 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11310 exp->type = 25;
11311 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11312 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11313 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11314 exp->compound->compound.context = context;
11315 PopContext(context);
11316 }
11317 break;
11318 case 8:
11319 {
11320 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11321 {
11322 exp->type = 5;
11323 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11324 ProcessExpressionType((*exp->list).first);
11325 break;
11326 }
11327 else
11328 {
11329 exp->type = 5;
11330 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11331 newExp->needCast = 0x1;
11332 ProcessExpressionType((*exp->list).first);
11333 break;
11334 }
11335 }
11336 default:
11337 {
11338 if(exp->expType->kind == 20)
11339 {
11340 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11341
11342 if(type)
11343 {
11344 FreeType(exp->destType);
11345 FreeType(exp->expType);
11346 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11347 break;
11348 }
11349 }
11350 if(newExp->type == 8 && newExp->member.memberType == 3)
11351 {
11352 exp->type = 4;
11353 exp->op.op = '*';
11354 exp->op.exp1 = (((void *)0));
11355 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11356 }
11357 else
11358 {
11359 char typeString[1024];
11360 struct Declarator * decl;
11361 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11362
11363 typeString[0] = '\0';
11364 PrintType(exp->expType, typeString, 0x0, 0x0);
11365 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11366 exp->type = 11;
11367 exp->cast.typeName = MkTypeName(specs, decl);
11368 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11369 exp->cast.exp->needCast = 0x1;
11370 }
11371 break;
11372 }
11373 }
11374 }
11375 }
11376
11377 extern int strncmp(const char * , const char * , size_t n);
11378
11379 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11380
11381 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11382 {
11383 int nsLen = strlen(nameSpace);
11384 struct Symbol * symbol;
11385
11386 for(symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(tree, nameSpace); symbol; symbol = (struct Symbol *)__ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(((struct __ecereNameSpace__ecere__sys__BTNode *)symbol)))
11387 {
11388 char * s = symbol->string;
11389
11390 if(!strncmp(s, nameSpace, nsLen))
11391 {
11392 int c;
11393 char * namePart;
11394
11395 for(c = strlen(s) - 1; c >= 0; c--)
11396 if(s[c] == ':')
11397 break;
11398 namePart = s + c + 1;
11399 if(!strcmp(namePart, name))
11400 {
11401 return symbol;
11402 }
11403 }
11404 else
11405 break;
11406 }
11407 return (((void *)0));
11408 }
11409
11410 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11411 {
11412 int c;
11413 char nameSpace[1024];
11414 char * namePart;
11415 unsigned int gotColon = 0x0;
11416
11417 nameSpace[0] = '\0';
11418 for(c = strlen(name) - 1; c >= 0; c--)
11419 if(name[c] == ':')
11420 {
11421 gotColon = 0x1;
11422 break;
11423 }
11424 namePart = name + c + 1;
11425 while(c >= 0 && name[c] == ':')
11426 c--;
11427 if(c >= 0)
11428 {
11429 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11430
11431 if(symbol)
11432 return symbol;
11433 memcpy(nameSpace, name, c + 1);
11434 nameSpace[c + 1] = (char)0;
11435 return ScanWithNameSpace(tree, nameSpace, namePart);
11436 }
11437 else if(gotColon)
11438 {
11439 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11440
11441 return symbol;
11442 }
11443 else
11444 {
11445 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11446
11447 if(symbol)
11448 return symbol;
11449 return ScanWithNameSpace(tree, "", namePart);
11450 }
11451 return (((void *)0));
11452 }
11453
11454 static void ProcessDeclaration(struct Declaration * decl);
11455
11456 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11457 {
11458 struct Context * ctx;
11459 struct Symbol * symbol = (((void *)0));
11460
11461 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11462 {
11463 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11464 {
11465 symbol = (((void *)0));
11466 if(thisNameSpace)
11467 {
11468 char curName[1024];
11469
11470 strcpy(curName, thisNameSpace);
11471 strcat(curName, "::");
11472 strcat(curName, name);
11473 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11474 }
11475 if(!symbol)
11476 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11477 }
11478 else
11479 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11480 if(symbol || ctx == endContext)
11481 break;
11482 }
11483 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11484 {
11485 if(symbol->pointerExternal->type == 0)
11486 {
11487 struct FunctionDefinition * function = symbol->pointerExternal->function;
11488 struct Context * tmpContext = curContext;
11489
11490 curContext = (((void *)0));
11491 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11492 curContext = tmpContext;
11493 symbol->pointerExternal->symbol = symbol;
11494 DeclareType(symbol->type, 0x1, 0x1);
11495 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11496 symbol->id = curExternal->symbol->idCode;
11497 }
11498 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11499 {
11500 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11501 symbol->id = curExternal->symbol->idCode;
11502 }
11503 }
11504 return symbol;
11505 }
11506
11507 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11508 {
11509 if(!type->isSigned && type->kind != 22 && type->kind != 23)
11510 ListAdd(specs, MkSpecifier(UNSIGNED));
11511 switch(type->kind)
11512 {
11513 case 8:
11514 {
11515 if(type->_class->registered)
11516 {
11517 if(!type->_class->registered->dataType)
11518 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11519 GetTypeSpecs(type->_class->registered->dataType, specs);
11520 }
11521 break;
11522 }
11523 case 7:
11524 ListAdd(specs, MkSpecifier(DOUBLE));
11525 break;
11526 case 6:
11527 ListAdd(specs, MkSpecifier(FLOAT));
11528 break;
11529 case 1:
11530 ListAdd(specs, MkSpecifier(CHAR));
11531 break;
11532 case 2:
11533 ListAdd(specs, MkSpecifier(SHORT));
11534 break;
11535 case 4:
11536 ListAdd(specs, MkSpecifier(INT64));
11537 break;
11538 case 22:
11539 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11540 break;
11541 case 23:
11542 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
11543 break;
11544 case 3:
11545 default:
11546 ListAdd(specs, MkSpecifier(INT));
11547 break;
11548 }
11549 }
11550
11551 static void PrintArraySize(struct Type * arrayType, char * string)
11552 {
11553 char size[256];
11554
11555 size[0] = '\0';
11556 strcat(size, "[");
11557 if(arrayType->enumClass)
11558 strcat(size, arrayType->enumClass->string);
11559 else if(arrayType->arraySizeExp)
11560 PrintExpression(arrayType->arraySizeExp, size);
11561 strcat(size, "]");
11562 strcat(string, size);
11563 }
11564
11565 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
11566 {
11567 if(type)
11568 {
11569 if(printConst && type->constant)
11570 strcat(string, "const ");
11571 switch(type->kind)
11572 {
11573 case 8:
11574 {
11575 struct Symbol * c = type->_class;
11576
11577 if(type->classObjectType == 2)
11578 strcat(string, "typed_object");
11579 else if(type->classObjectType == 3)
11580 strcat(string, "any_object");
11581 else
11582 {
11583 if(c && c->string)
11584 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
11585 }
11586 if(type->byReference)
11587 strcat(string, " &");
11588 break;
11589 }
11590 case 0:
11591 strcat(string, "void");
11592 break;
11593 case 3:
11594 strcat(string, type->isSigned ? "int" : "uint");
11595 break;
11596 case 4:
11597 strcat(string, type->isSigned ? "int64" : "uint64");
11598 break;
11599 case 22:
11600 strcat(string, type->isSigned ? "intptr" : "uintptr");
11601 break;
11602 case 23:
11603 strcat(string, type->isSigned ? "intsize" : "uintsize");
11604 break;
11605 case 1:
11606 strcat(string, type->isSigned ? "char" : "byte");
11607 break;
11608 case 2:
11609 strcat(string, type->isSigned ? "short" : "uint16");
11610 break;
11611 case 6:
11612 strcat(string, "float");
11613 break;
11614 case 7:
11615 strcat(string, "double");
11616 break;
11617 case 9:
11618 if(type->enumName)
11619 {
11620 strcat(string, "struct ");
11621 strcat(string, type->enumName);
11622 }
11623 else if(type->typeName)
11624 strcat(string, type->typeName);
11625 else
11626 {
11627 struct Type * member;
11628
11629 strcat(string, "struct { ");
11630 for(member = type->members.first; member; member = member->next)
11631 {
11632 PrintType(member, string, 0x1, fullName);
11633 strcat(string, "; ");
11634 }
11635 strcat(string, "}");
11636 }
11637 break;
11638 case 10:
11639 if(type->enumName)
11640 {
11641 strcat(string, "union ");
11642 strcat(string, type->enumName);
11643 }
11644 else if(type->typeName)
11645 strcat(string, type->typeName);
11646 else
11647 {
11648 strcat(string, "union ");
11649 strcat(string, "(unnamed)");
11650 }
11651 break;
11652 case 15:
11653 if(type->enumName)
11654 {
11655 strcat(string, "enum ");
11656 strcat(string, type->enumName);
11657 }
11658 else if(type->typeName)
11659 strcat(string, type->typeName);
11660 else
11661 strcat(string, "int");
11662 break;
11663 case 14:
11664 strcat(string, "...");
11665 break;
11666 case 19:
11667 strcat(string, "subclass(");
11668 strcat(string, type->_class ? type->_class->string : "int");
11669 strcat(string, ")");
11670 break;
11671 case 20:
11672 strcat(string, type->templateParameter->identifier->string);
11673 break;
11674 case 21:
11675 strcat(string, "thisclass");
11676 break;
11677 case 17:
11678 strcat(string, "__builtin_va_list");
11679 break;
11680 }
11681 }
11682 }
11683
11684 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11685
11686 static void PrintName(struct Type * type, char * string, unsigned int fullName)
11687 {
11688 if(type->name && type->name[0])
11689 {
11690 if(fullName)
11691 strcat(string, type->name);
11692 else
11693 {
11694 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11695
11696 if(name)
11697 name += 2;
11698 else
11699 name = type->name;
11700 strcat(string, name);
11701 }
11702 }
11703 }
11704
11705 static void PrintAttribs(struct Type * type, char * string)
11706 {
11707 if(type)
11708 {
11709 if(type->dllExport)
11710 strcat(string, "dllexport ");
11711 if(type->attrStdcall)
11712 strcat(string, "stdcall ");
11713 }
11714 }
11715
11716 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
11717 {
11718 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11719 {
11720 struct Type * attrType = (((void *)0));
11721
11722 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
11723 PrintAttribs(type, string);
11724 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
11725 strcat(string, " const");
11726 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
11727 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11728 strcat(string, " (");
11729 if(type->kind == 13)
11730 {
11731 if(type->type->kind == 11 || type->type->kind == 16)
11732 PrintAttribs(type->type, string);
11733 }
11734 if(type->kind == 13)
11735 {
11736 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
11737 strcat(string, "*");
11738 else
11739 strcat(string, " *");
11740 }
11741 if(printConst && type->constant && type->kind == 13)
11742 strcat(string, " const");
11743 }
11744 else
11745 PrintTypeSpecs(type, string, fullName, printConst);
11746 }
11747
11748 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
11749 {
11750 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
11751 strcat(string, ")");
11752 if(type->kind == 12)
11753 PrintArraySize(type, string);
11754 else if(type->kind == 11)
11755 {
11756 struct Type * param;
11757
11758 strcat(string, "(");
11759 for(param = type->params.first; param; param = param->next)
11760 {
11761 PrintType(param, string, 0x1, fullName);
11762 if(param->next)
11763 strcat(string, ", ");
11764 }
11765 strcat(string, ")");
11766 }
11767 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
11768 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
11769 }
11770
11771 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
11772 {
11773 PrePrintType(type, string, fullName, (((void *)0)), printConst);
11774 if(type->thisClass || (printName && type->name && type->name[0]))
11775 strcat(string, " ");
11776 if((type->thisClass || type->staticMethod))
11777 {
11778 struct Symbol * _class = type->thisClass;
11779
11780 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
11781 {
11782 if(type->classObjectType == 1)
11783 strcat(string, "class");
11784 else
11785 strcat(string, type->byReference ? "typed_object&" : "typed_object");
11786 }
11787 else if(_class && _class->string)
11788 {
11789 char * s = _class->string;
11790
11791 if(fullName)
11792 strcat(string, s);
11793 else
11794 {
11795 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
11796
11797 if(name)
11798 name += 2;
11799 else
11800 name = s;
11801 strcat(string, name);
11802 }
11803 }
11804 strcat(string, "::");
11805 }
11806 if(printName && type->name)
11807 PrintName(type, string, fullName);
11808 PostPrintType(type, string, fullName);
11809 if(type->bitFieldCount)
11810 {
11811 char count[100];
11812
11813 sprintf(count, ":%d", type->bitFieldCount);
11814 strcat(string, count);
11815 }
11816 }
11817
11818 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11819 {
11820 _PrintType(type, string, printName, fullName, 0x1);
11821 }
11822
11823 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11824 {
11825 _PrintType(type, string, printName, fullName, 0x0);
11826 }
11827
11828 static struct Type * FindMember(struct Type * type, char * string)
11829 {
11830 struct Type * memberType;
11831
11832 for(memberType = type->members.first; memberType; memberType = memberType->next)
11833 {
11834 if(!memberType->name)
11835 {
11836 struct Type * subType = FindMember(memberType, string);
11837
11838 if(subType)
11839 return subType;
11840 }
11841 else if(!strcmp(memberType->name, string))
11842 return memberType;
11843 }
11844 return (((void *)0));
11845 }
11846
11847 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11848 {
11849 struct Type * memberType;
11850
11851 for(memberType = type->members.first; memberType; memberType = memberType->next)
11852 {
11853 if(!memberType->name)
11854 {
11855 struct Type * subType = FindMember(memberType, string);
11856
11857 if(subType)
11858 {
11859 *offset += memberType->offset;
11860 return subType;
11861 }
11862 }
11863 else if(!strcmp(memberType->name, string))
11864 {
11865 *offset += memberType->offset;
11866 return memberType;
11867 }
11868 }
11869 return (((void *)0));
11870 }
11871
11872 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11873
11874 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11875
11876 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
11877
11878 struct Expression * ParseExpressionString(char * expression)
11879 {
11880 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11881 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
11882 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
11883
11884 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
11885 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
11886 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
11887 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
11888
11889 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
11890 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11891 echoOn = 0x0;
11892 parsedExpression = (((void *)0));
11893 resetScanner();
11894 expression_yyparse();
11895 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11896 return parsedExpression;
11897 }
11898
11899 extern char *  QMkString(char *  source);
11900
11901 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11902 {
11903 struct Identifier * id = exp->identifier;
11904 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11905 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11906 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11907 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11908
11909 if(_class && _class->type == 4)
11910 {
11911 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11912 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11913
11914 if(enumClass)
11915 {
11916 struct __ecereNameSpace__ecere__com__Class * baseClass;
11917
11918 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11919 {
11920 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11921
11922 for(value = e->values.first; value; value = value->next)
11923 {
11924 if(!strcmp(value->name, id->string))
11925 break;
11926 }
11927 if(value)
11928 {
11929 char constant[256];
11930
11931 FreeExpContents(exp);
11932 exp->type = 2;
11933 exp->isConstant = 0x1;
11934 if(!strcmp(baseClass->dataTypeString, "int"))
11935 sprintf(constant, "%d", (int)value->data);
11936 else
11937 sprintf(constant, "0x%X", (int)value->data);
11938 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11939 exp->expType = MkClassType(baseClass->fullName);
11940 break;
11941 }
11942 }
11943 }
11944 if(value)
11945 return 0x1;
11946 }
11947 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11948 {
11949 ProcessMethodType(method);
11950 exp->expType = __extension__ ({
11951 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11952
11953 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
11954 });
11955 return 0x1;
11956 }
11957 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11958 {
11959 if(!prop->dataType)
11960 ProcessPropertyType(prop);
11961 exp->expType = prop->dataType;
11962 if(prop->dataType)
11963 prop->dataType->refCount++;
11964 return 0x1;
11965 }
11966 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11967 {
11968 if(!member->dataType)
11969 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11970 exp->expType = member->dataType;
11971 if(member->dataType)
11972 member->dataType->refCount++;
11973 return 0x1;
11974 }
11975 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11976 {
11977 if(!classProp->dataType)
11978 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11979 if(classProp->constant)
11980 {
11981 FreeExpContents(exp);
11982 exp->isConstant = 0x1;
11983 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11984 {
11985 exp->type = 3;
11986 exp->constant = QMkString((char *)classProp->Get(_class));
11987 }
11988 else
11989 {
11990 char constant[256];
11991
11992 exp->type = 2;
11993 sprintf(constant, "%d", (int)classProp->Get(_class));
11994 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11995 }
11996 }
11997 else
11998 {
11999 }
12000 exp->expType = classProp->dataType;
12001 if(classProp->dataType)
12002 classProp->dataType->refCount++;
12003 return 0x1;
12004 }
12005 return 0x0;
12006 }
12007
12008 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
12009 {
12010 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
12011 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
12012 struct __ecereNameSpace__ecere__com__NameSpace * child;
12013
12014 if(!data)
12015 {
12016 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)))
12017 {
12018 data = ScanGlobalData(child, name);
12019 if(data)
12020 break;
12021 }
12022 }
12023 return data;
12024 }
12025
12026 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
12027
12028 extern char *  strncpy(char * , const char * , size_t n);
12029
12030 static struct GlobalData * FindGlobalData(char * name)
12031 {
12032 int start = 0, c;
12033 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
12034
12035 nameSpace = globalData;
12036 for(c = 0; name[c]; c++)
12037 {
12038 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
12039 {
12040 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
12041 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
12042
12043 strncpy(spaceName, name + start, c - start);
12044 spaceName[c - start] = '\0';
12045 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
12046 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
12047 if(!newSpace)
12048 return (((void *)0));
12049 nameSpace = newSpace;
12050 if(name[c] == ':')
12051 c++;
12052 start = c + 1;
12053 }
12054 }
12055 if(c - start)
12056 {
12057 return ScanGlobalData(nameSpace, name + start);
12058 }
12059 return (((void *)0));
12060 }
12061
12062 static int definedExpStackPos;
12063
12064 static void * definedExpStack[512];
12065
12066 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
12067 {
12068 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
12069
12070 FreeExpContents(checkedExp);
12071 FreeType(checkedExp->expType);
12072 FreeType(checkedExp->destType);
12073 *checkedExp = *newExp;
12074 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12075 checkedExp->prev = prev;
12076 checkedExp->next = next;
12077 }
12078
12079 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
12080
12081 extern int printf(char * , ...);
12082
12083 void __ecereMethod_Expression_Clear();
12084
12085 void ApplyAnyObjectLogic(struct Expression * e)
12086 {
12087 struct Type * destType = e->destType;
12088
12089 if(destType && (destType->classObjectType == 3))
12090 {
12091 if(e && e->expType)
12092 {
12093 struct Type * type = e->expType;
12094 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
12095
12096 if(type->kind == 8 && type->_class && type->_class->registered)
12097 {
12098 _class = type->_class->registered;
12099 }
12100 else if(type->kind == 19)
12101 {
12102 _class = FindClass("ecere::com::Class")->registered;
12103 }
12104 else
12105 {
12106 char string[1024] = "";
12107 struct Symbol * classSym;
12108
12109 PrintTypeNoConst(type, string, 0x0, 0x1);
12110 classSym = FindClass(string);
12111 if(classSym)
12112 _class = classSym->registered;
12113 }
12114 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "uintptr") && strcmp(_class->fullName, "intptr")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 22 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
12115 {
12116 if(!_class || strcmp(_class->fullName, "char *"))
12117 {
12118 struct Expression * checkedExp = e, * newExp;
12119
12120 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12121 {
12122 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12123 {
12124 if(checkedExp->type == 25)
12125 {
12126 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12127 }
12128 else
12129 checkedExp = (*checkedExp->list).last;
12130 }
12131 else if(checkedExp->type == 11)
12132 checkedExp = checkedExp->cast.exp;
12133 }
12134 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
12135 {
12136 newExp = checkedExp->op.exp2;
12137 checkedExp->op.exp2 = (((void *)0));
12138 FreeExpContents(checkedExp);
12139 if(e->expType && e->expType->passAsTemplate)
12140 {
12141 char size[100];
12142
12143 ComputeTypeSize(e->expType);
12144 sprintf(size, "%d", e->expType->size);
12145 newExp = MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp), '+', MkExpCall(MkExpIdentifier(MkIdentifier("__ENDIAN_PAD")), MkListOne(MkExpConstant(size))))));
12146 }
12147 ReplaceExpContents(checkedExp, newExp);
12148 e->byReference = 0x1;
12149 }
12150 else if(!e->byReference || (_class && _class->type == 5))
12151 {
12152 struct Expression * checkedExp, * newExp;
12153
12154 {
12155 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;
12156
12157 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
12158 {
12159 struct Context * context = PushContext();
12160 struct Declarator * decl;
12161 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12162 char typeString[1024];
12163 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12164
12165 typeString[0] = '\0';
12166 *newExp = *e;
12167 newExp->prev = (((void *)0));
12168 newExp->next = (((void *)0));
12169 newExp->expType = (((void *)0));
12170 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
12171 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12172 newExp->destType = ProcessType(specs, decl);
12173 curContext = context;
12174 if(curCompound)
12175 {
12176 char name[100];
12177 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
12178
12179 e->type = 25;
12180 sprintf(name, "__internalValue%03X", internalValueCounter++);
12181 if(!curCompound->compound.declarations)
12182 curCompound->compound.declarations = MkList();
12183 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
12184 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
12185 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
12186 e->compound = MkCompoundStmt((((void *)0)), stmts);
12187 }
12188 else
12189 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
12190 {
12191 struct Type * type = e->destType;
12192
12193 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12194 CopyTypeInto(e->destType, type);
12195 e->destType->refCount = 1;
12196 e->destType->classObjectType = 0;
12197 FreeType(type);
12198 }
12199 e->compound->compound.context = context;
12200 PopContext(context);
12201 curContext = context->parent;
12202 }
12203 }
12204 checkedExp = e;
12205 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
12206 {
12207 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
12208 {
12209 if(checkedExp->type == 25)
12210 {
12211 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
12212 }
12213 else
12214 checkedExp = (*checkedExp->list).last;
12215 }
12216 else if(checkedExp->type == 11)
12217 checkedExp = checkedExp->cast.exp;
12218 }
12219 {
12220 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12221
12222 *operand = *checkedExp;
12223 checkedExp->destType = (((void *)0));
12224 checkedExp->expType = (((void *)0));
12225 __ecereMethod_Expression_Clear(checkedExp);
12226 checkedExp->type = 4;
12227 checkedExp->op.op = '&';
12228 checkedExp->op.exp1 = (((void *)0));
12229 checkedExp->op.exp2 = operand;
12230 }
12231 }
12232 }
12233 }
12234 }
12235 }
12236 {
12237 }
12238 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))))
12239 {
12240 if(e->expType->classObjectType && destType && destType->classObjectType)
12241 {
12242 return ;
12243 }
12244 else
12245 {
12246 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12247
12248 *thisExp = *e;
12249 thisExp->prev = (((void *)0));
12250 thisExp->next = (((void *)0));
12251 __ecereMethod_Expression_Clear(e);
12252 e->type = 5;
12253 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
12254 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
12255 ((struct Expression *)(*e->list).first)->byReference = 0x1;
12256 {
12257 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12258 CopyTypeInto(e->expType, thisExp->expType);
12259 e->expType->byReference = 0x0;
12260 e->expType->refCount = 1;
12261 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))
12262 {
12263 e->expType->classObjectType = 0;
12264 }
12265 }
12266 }
12267 }
12268 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
12269 {
12270 if(destType->kind == 14)
12271 {
12272 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
12273 }
12274 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
12275 {
12276 unsigned int byReference = e->expType->byReference;
12277 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12278 struct Declarator * decl;
12279 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12280 char typeString[1024];
12281 struct Type * type;
12282 int backupClassObjectType;
12283 unsigned int backupByReference;
12284
12285 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
12286 type = e->expType;
12287 else
12288 type = destType;
12289 backupClassObjectType = type->classObjectType;
12290 backupByReference = type->byReference;
12291 type->classObjectType = 0;
12292 type->byReference = 0x0;
12293 typeString[0] = '\0';
12294 PrintType(type, typeString, 0x0, 0x1);
12295 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12296 type->classObjectType = backupClassObjectType;
12297 type->byReference = backupByReference;
12298 *thisExp = *e;
12299 thisExp->prev = (((void *)0));
12300 thisExp->next = (((void *)0));
12301 __ecereMethod_Expression_Clear(e);
12302 if((type->kind == 8 && type->_class && type->_class->registered && (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 != 22 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
12303 {
12304 e->type = 4;
12305 e->op.op = '*';
12306 e->op.exp1 = (((void *)0));
12307 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12308 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12309 CopyTypeInto(e->expType, type);
12310 e->expType->byReference = 0x0;
12311 e->expType->refCount = 1;
12312 }
12313 else
12314 {
12315 e->type = 11;
12316 e->cast.typeName = MkTypeName(specs, decl);
12317 e->cast.exp = thisExp;
12318 e->byReference = 0x1;
12319 e->expType = type;
12320 type->refCount++;
12321 }
12322 e->destType = destType;
12323 destType->refCount++;
12324 }
12325 }
12326 }
12327
12328 extern char *  strstr(const char * , const char * );
12329
12330 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12331
12332 struct __ecereNameSpace__ecere__com__DefinedExpression
12333 {
12334 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12335 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12336 char *  name;
12337 char *  value;
12338 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12339 } __attribute__ ((gcc_struct));
12340
12341 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12342
12343 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12344
12345 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12346
12347 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12348
12349 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12350
12351 extern struct Expression * CopyExpression(struct Expression * exp);
12352
12353 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12354
12355 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12356
12357 static void ProcessStatement(struct Statement * stmt);
12358
12359 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12360
12361 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12362
12363 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12364
12365 extern char *  sourceFile;
12366
12367 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12368
12369 void ProcessExpressionType(struct Expression * exp)
12370 {
12371 unsigned int unresolved = 0x0;
12372 struct Location oldyylloc = yylloc;
12373 unsigned int notByReference = 0x0;
12374
12375 if(!exp || exp->expType)
12376 return ;
12377 yylloc = exp->loc;
12378 switch(exp->type)
12379 {
12380 case 0:
12381 {
12382 struct Identifier * id = exp->identifier;
12383
12384 if(!id)
12385 return ;
12386 if(id->_class && id->_class->name)
12387 {
12388 id->classSym = id->_class->symbol;
12389 }
12390 if(strstr(id->string, "__ecereClass") == id->string)
12391 {
12392 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12393 break;
12394 }
12395 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12396 {
12397 ReplaceClassMembers(exp, thisClass);
12398 if(exp->type != 0)
12399 {
12400 ProcessExpressionType(exp);
12401 break;
12402 }
12403 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12404 break;
12405 }
12406 else
12407 {
12408 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12409
12410 if(!symbol)
12411 {
12412 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12413 break;
12414 else
12415 {
12416 if(thisClass)
12417 {
12418 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12419 if(exp->type != 0)
12420 {
12421 ProcessExpressionType(exp);
12422 break;
12423 }
12424 }
12425 else if(currentClass && !id->_class)
12426 {
12427 if(ResolveIdWithClass(exp, currentClass, 0x1))
12428 break;
12429 }
12430 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12431 }
12432 }
12433 if(symbol)
12434 {
12435 struct Type * type = symbol->type;
12436 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12437
12438 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12439 {
12440 struct Context * context = SetupTemplatesContext(_class);
12441
12442 type = ReplaceThisClassType(_class);
12443 FinishTemplatesContext(context);
12444 if(type)
12445 type->refCount = 0;
12446 }
12447 FreeSpecifier(id->_class);
12448 id->_class = (((void *)0));
12449 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12450 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12451 id->classSym = (((void *)0));
12452 exp->expType = type;
12453 if(type)
12454 type->refCount++;
12455 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12456 exp->isConstant = 0x1;
12457 if(symbol->isParam || !strcmp(id->string, "this"))
12458 {
12459 if(_class && _class->type == 1 && !type->declaredWithStruct)
12460 exp->byReference = 0x1;
12461 }
12462 if(symbol->isIterator)
12463 {
12464 if(symbol->isIterator == 3)
12465 {
12466 exp->type = 5;
12467 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12468 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12469 exp->expType = (((void *)0));
12470 ProcessExpressionType(exp);
12471 }
12472 else if(symbol->isIterator != 4)
12473 {
12474 exp->type = 8;
12475 exp->member.exp = MkExpIdentifier(exp->identifier);
12476 exp->member.exp->expType = exp->expType;
12477 exp->member.member = MkIdentifier("data");
12478 exp->expType = (((void *)0));
12479 ProcessExpressionType(exp);
12480 }
12481 }
12482 break;
12483 }
12484 else
12485 {
12486 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12487
12488 if(thisNameSpace && !(id->_class && !id->_class->name))
12489 {
12490 char name[1024];
12491
12492 strcpy(name, thisNameSpace);
12493 strcat(name, "::");
12494 strcat(name, id->string);
12495 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12496 }
12497 if(!definedExp)
12498 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12499 if(definedExp)
12500 {
12501 int c;
12502
12503 for(c = 0; c < definedExpStackPos; c++)
12504 if(definedExpStack[c] == definedExp)
12505 break;
12506 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12507 {
12508 struct Location backupYylloc = yylloc;
12509
12510 definedExpStack[definedExpStackPos++] = definedExp;
12511 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12512 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
12513 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
12514
12515 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
12516 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
12517 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
12518 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
12519
12520 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
12521 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12522 echoOn = 0x0;
12523 parsedExpression = (((void *)0));
12524 resetScanner();
12525 expression_yyparse();
12526 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12527 yylloc = backupYylloc;
12528 if(parsedExpression)
12529 {
12530 FreeIdentifier(id);
12531 exp->type = 5;
12532 exp->list = MkListOne(parsedExpression);
12533 parsedExpression->loc = yylloc;
12534 ProcessExpressionType(exp);
12535 definedExpStackPos--;
12536 return ;
12537 }
12538 definedExpStackPos--;
12539 }
12540 else
12541 {
12542 if(inCompiler)
12543 {
12544 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12545 }
12546 }
12547 }
12548 else
12549 {
12550 struct GlobalData * data = (((void *)0));
12551
12552 if(thisNameSpace && !(id->_class && !id->_class->name))
12553 {
12554 char name[1024];
12555
12556 strcpy(name, thisNameSpace);
12557 strcat(name, "::");
12558 strcat(name, id->string);
12559 data = FindGlobalData(name);
12560 }
12561 if(!data)
12562 data = FindGlobalData(id->string);
12563 if(data)
12564 {
12565 DeclareGlobalData(data);
12566 exp->expType = data->dataType;
12567 if(data->dataType)
12568 data->dataType->refCount++;
12569 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12570 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12571 FreeSpecifier(id->_class);
12572 id->_class = (((void *)0));
12573 break;
12574 }
12575 else
12576 {
12577 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12578
12579 if(thisNameSpace && !(id->_class && !id->_class->name))
12580 {
12581 char name[1024];
12582
12583 strcpy(name, thisNameSpace);
12584 strcat(name, "::");
12585 strcat(name, id->string);
12586 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12587 }
12588 if(!function)
12589 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12590 if(function)
12591 {
12592 char name[1024];
12593
12594 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12595 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12596 name[0] = (char)0;
12597 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12598 strcpy(name, "__ecereFunction_");
12599 FullClassNameCat(name, id->string, 0x0);
12600 if(DeclareFunction(function, name))
12601 {
12602 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12603 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12604 }
12605 exp->expType = function->dataType;
12606 if(function->dataType)
12607 function->dataType->refCount++;
12608 FreeSpecifier(id->_class);
12609 id->_class = (((void *)0));
12610 break;
12611 }
12612 }
12613 }
12614 }
12615 }
12616 unresolved = 0x1;
12617 break;
12618 }
12619 case 1:
12620 {
12621 struct __ecereNameSpace__ecere__com__Class * _class;
12622
12623 if(!exp->instance->_class)
12624 {
12625 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12626 {
12627 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12628 }
12629 }
12630 ProcessInstantiationType(exp->instance);
12631 exp->isConstant = exp->instance->isConstant;
12632 if(exp->instance->_class)
12633 {
12634 exp->expType = MkClassType(exp->instance->_class->name);
12635 }
12636 break;
12637 }
12638 case 2:
12639 {
12640 if(!exp->expType)
12641 {
12642 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12643
12644 exp->expType = type;
12645 if(exp->constant[0] == '\'')
12646 {
12647 if((int)((unsigned char *)exp->constant)[1] > 127)
12648 {
12649 int nb;
12650 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12651
12652 if(nb < 2)
12653 ch = exp->constant[1];
12654 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12655 exp->constant = PrintUInt(ch);
12656 type->kind = 8;
12657 type->_class = FindClass("unichar");
12658 type->isSigned = 0x0;
12659 }
12660 else
12661 {
12662 type->kind = 1;
12663 type->isSigned = 0x1;
12664 }
12665 }
12666 else if(strchr(exp->constant, '.'))
12667 {
12668 char ch = exp->constant[strlen(exp->constant) - 1];
12669
12670 if(ch == 'f')
12671 type->kind = 6;
12672 else
12673 type->kind = 7;
12674 type->isSigned = 0x1;
12675 }
12676 else
12677 {
12678 if(exp->constant[0] == '0' && exp->constant[1])
12679 type->isSigned = 0x0;
12680 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12681 type->isSigned = 0x0;
12682 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12683 type->isSigned = 0x0;
12684 else
12685 type->isSigned = 0x1;
12686 type->kind = 3;
12687 }
12688 exp->isConstant = 0x1;
12689 if(exp->destType && exp->destType->kind == 7)
12690 type->kind = 7;
12691 else if(exp->destType && exp->destType->kind == 6)
12692 type->kind = 6;
12693 else if(exp->destType && exp->destType->kind == 4)
12694 type->kind = 4;
12695 }
12696 break;
12697 }
12698 case 3:
12699 {
12700 exp->isConstant = 0x1;
12701 exp->expType = __extension__ ({
12702 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12703
12704 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
12705 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12706
12707 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1;
12708 }), __ecereInstance2;
12709 });
12710 break;
12711 }
12712 case 13:
12713 case 28:
12714 ProcessExpressionType(exp->_new.size);
12715 exp->expType = __extension__ ({
12716 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12717
12718 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
12719 });
12720 DeclareType(exp->expType->type, 0x0, 0x0);
12721 break;
12722 case 14:
12723 case 29:
12724 ProcessExpressionType(exp->_renew.size);
12725 ProcessExpressionType(exp->_renew.exp);
12726 exp->expType = __extension__ ({
12727 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12728
12729 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
12730 });
12731 DeclareType(exp->expType->type, 0x0, 0x0);
12732 break;
12733 case 4:
12734 {
12735 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12736 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12737 unsigned int useDestType = 0x0, useSideType = 0x0;
12738 struct Location oldyylloc = yylloc;
12739 unsigned int useSideUnit = 0x0;
12740 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
12741
12742 switch(exp->op.op)
12743 {
12744 case '=':
12745 case MUL_ASSIGN:
12746 case DIV_ASSIGN:
12747 case MOD_ASSIGN:
12748 case ADD_ASSIGN:
12749 case SUB_ASSIGN:
12750 case LEFT_ASSIGN:
12751 case RIGHT_ASSIGN:
12752 case AND_ASSIGN:
12753 case XOR_ASSIGN:
12754 case OR_ASSIGN:
12755 assign = 0x1;
12756 break;
12757 case '!':
12758 break;
12759 case AND_OP:
12760 case OR_OP:
12761 boolOps = 0x1;
12762 boolResult = 0x1;
12763 break;
12764 case EQ_OP:
12765 case '<':
12766 case '>':
12767 case LE_OP:
12768 case GE_OP:
12769 case NE_OP:
12770 boolResult = 0x1;
12771 useSideType = 0x1;
12772 break;
12773 case '+':
12774 case '-':
12775 useSideUnit = 0x1;
12776 case '|':
12777 case '&':
12778 case '^':
12779 case '/':
12780 case '%':
12781 case '*':
12782 if(exp->op.op != '*' || exp->op.exp1)
12783 {
12784 useSideType = 0x1;
12785 useDestType = 0x1;
12786 }
12787 break;
12788 }
12789 if(exp->op.op == '&')
12790 {
12791 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12792 {
12793 struct Identifier * id = exp->op.exp2->identifier;
12794 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12795
12796 if(symbol && symbol->isIterator == 2)
12797 {
12798 exp->type = 8;
12799 exp->member.exp = exp->op.exp2;
12800 exp->member.member = MkIdentifier("key");
12801 exp->expType = (((void *)0));
12802 exp->op.exp2->expType = symbol->type;
12803 symbol->type->refCount++;
12804 ProcessExpressionType(exp);
12805 FreeType(dummy);
12806 break;
12807 }
12808 }
12809 }
12810 if(exp->op.exp1)
12811 {
12812 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))
12813 {
12814 if(exp->op.exp1->destType)
12815 FreeType(exp->op.exp1->destType);
12816 exp->op.exp1->destType = exp->destType;
12817 if(exp->destType)
12818 exp->destType->refCount++;
12819 }
12820 else if(!assign)
12821 {
12822 if(exp->op.exp1->destType)
12823 FreeType(exp->op.exp1->destType);
12824 exp->op.exp1->destType = dummy;
12825 dummy->refCount++;
12826 }
12827 if(exp->op.exp1->destType && exp->op.op != '=')
12828 exp->op.exp1->destType->count++;
12829 ProcessExpressionType(exp->op.exp1);
12830 if(exp->op.exp1->destType && exp->op.op != '=')
12831 exp->op.exp1->destType->count--;
12832 if(exp->op.exp1->destType == dummy)
12833 {
12834 FreeType(dummy);
12835 exp->op.exp1->destType = (((void *)0));
12836 }
12837 type1 = exp->op.exp1->expType;
12838 }
12839 if(exp->op.exp2)
12840 {
12841 char expString[10240];
12842
12843 expString[0] = '\0';
12844 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12845 {
12846 if(exp->op.exp1)
12847 {
12848 exp->op.exp2->destType = exp->op.exp1->expType;
12849 if(exp->op.exp1->expType)
12850 exp->op.exp1->expType->refCount++;
12851 }
12852 else
12853 {
12854 exp->op.exp2->destType = exp->destType;
12855 if(exp->destType)
12856 exp->destType->refCount++;
12857 }
12858 if(type1)
12859 type1->refCount++;
12860 exp->expType = type1;
12861 }
12862 else if(assign)
12863 {
12864 if(inCompiler)
12865 PrintExpression(exp->op.exp2, expString);
12866 if(type1 && type1->kind == 13)
12867 {
12868 if(exp->op.op == MUL_ASSIGN || exp->op.op == DIV_ASSIGN || exp->op.op == MOD_ASSIGN || exp->op.op == LEFT_ASSIGN || exp->op.op == RIGHT_ASSIGN || exp->op.op == AND_ASSIGN || exp->op.op == OR_ASSIGN)
12869 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12870 else if(exp->op.op == '=')
12871 {
12872 if(exp->op.exp2->destType)
12873 FreeType(exp->op.exp2->destType);
12874 exp->op.exp2->destType = type1;
12875 if(type1)
12876 type1->refCount++;
12877 }
12878 }
12879 else
12880 {
12881 if(exp->op.op == MUL_ASSIGN || exp->op.op == DIV_ASSIGN || exp->op.op == MOD_ASSIGN || exp->op.op == LEFT_ASSIGN || exp->op.op == RIGHT_ASSIGN)
12882 ;
12883 else
12884 {
12885 if(exp->op.exp2->destType)
12886 FreeType(exp->op.exp2->destType);
12887 exp->op.exp2->destType = type1;
12888 if(type1)
12889 type1->refCount++;
12890 }
12891 }
12892 if(type1)
12893 type1->refCount++;
12894 exp->expType = type1;
12895 }
12896 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)))
12897 {
12898 if(exp->op.exp2->destType)
12899 FreeType(exp->op.exp2->destType);
12900 exp->op.exp2->destType = exp->destType;
12901 if(exp->destType)
12902 exp->destType->refCount++;
12903 }
12904 else
12905 {
12906 if(exp->op.exp2->destType)
12907 FreeType(exp->op.exp2->destType);
12908 exp->op.exp2->destType = dummy;
12909 dummy->refCount++;
12910 }
12911 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12912 {
12913 FreeType(exp->op.exp2->destType);
12914 exp->op.exp2->destType = type1;
12915 type1->refCount++;
12916 }
12917 if(exp->op.exp2->destType && exp->op.op != '=')
12918 exp->op.exp2->destType->count++;
12919 ProcessExpressionType(exp->op.exp2);
12920 if(exp->op.exp2->destType && exp->op.op != '=')
12921 exp->op.exp2->destType->count--;
12922 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12923 {
12924 if(exp->op.exp2->expType->kind == 23 || exp->op.exp2->expType->kind == 22 || exp->op.exp2->expType->kind == 4 || exp->op.exp2->expType->kind == 3 || exp->op.exp2->expType->kind == 2 || exp->op.exp2->expType->kind == 1)
12925 {
12926 if(exp->op.op != '=' && type1->type->kind == 0)
12927 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12928 }
12929 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)))
12930 {
12931 if(exp->op.op == ADD_ASSIGN)
12932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12933 }
12934 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))
12935 {
12936 if(exp->op.op == ADD_ASSIGN)
12937 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12938 }
12939 else if(inCompiler)
12940 {
12941 char type1String[1024];
12942 char type2String[1024];
12943
12944 type1String[0] = '\0';
12945 type2String[0] = '\0';
12946 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12947 PrintType(type1, type2String, 0x0, 0x1);
12948 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12949 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12950 }
12951 }
12952 if(exp->op.exp2->destType == dummy)
12953 {
12954 FreeType(dummy);
12955 exp->op.exp2->destType = (((void *)0));
12956 }
12957 if(exp->op.op == '-' && !exp->op.exp1 && exp->op.exp2->expType && !exp->op.exp2->expType->isSigned)
12958 {
12959 type2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12960 type2->refCount = 1;
12961 CopyTypeInto(type2, exp->op.exp2->expType);
12962 type2->isSigned = 0x1;
12963 }
12964 else if(exp->op.op == '~' && !exp->op.exp1 && exp->op.exp2->expType && (!exp->op.exp2->expType->isSigned || exp->op.exp2->expType->kind != 3))
12965 {
12966 type2 = __extension__ ({
12967 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12968
12969 __ecereInstance1->kind = 3, __ecereInstance1;
12970 });
12971 type2->refCount = 1;
12972 type2->isSigned = 0x1;
12973 }
12974 else
12975 type2 = exp->op.exp2->expType;
12976 }
12977 dummy->kind = 0;
12978 if(exp->op.op == SIZEOF)
12979 {
12980 exp->expType = __extension__ ({
12981 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12982
12983 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
12984 });
12985 exp->isConstant = 0x1;
12986 }
12987 else if(exp->op.op == '*' && !exp->op.exp1)
12988 {
12989 exp->expType = Dereference(type2);
12990 if(type2 && type2->kind == 8)
12991 notByReference = 0x1;
12992 }
12993 else if(exp->op.op == '&' && !exp->op.exp1)
12994 exp->expType = Reference(type2);
12995 else if(!assign)
12996 {
12997 if(boolOps)
12998 {
12999 if(exp->op.exp1)
13000 {
13001 if(exp->op.exp1->destType)
13002 FreeType(exp->op.exp1->destType);
13003 exp->op.exp1->destType = MkClassType("bool");
13004 exp->op.exp1->destType->truth = 0x1;
13005 if(!exp->op.exp1->expType)
13006 ProcessExpressionType(exp->op.exp1);
13007 else
13008 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13009 FreeType(exp->op.exp1->expType);
13010 exp->op.exp1->expType = MkClassType("bool");
13011 exp->op.exp1->expType->truth = 0x1;
13012 }
13013 if(exp->op.exp2)
13014 {
13015 if(exp->op.exp2->destType)
13016 FreeType(exp->op.exp2->destType);
13017 exp->op.exp2->destType = MkClassType("bool");
13018 exp->op.exp2->destType->truth = 0x1;
13019 if(!exp->op.exp2->expType)
13020 ProcessExpressionType(exp->op.exp2);
13021 else
13022 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13023 FreeType(exp->op.exp2->expType);
13024 exp->op.exp2->expType = MkClassType("bool");
13025 exp->op.exp2->expType->truth = 0x1;
13026 }
13027 }
13028 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")))))
13029 {
13030 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
13031 {
13032 if(exp->op.exp2->destType)
13033 FreeType(exp->op.exp2->destType);
13034 exp->op.exp2->destType = type1;
13035 type1->refCount++;
13036 if(exp->op.exp1->destType)
13037 FreeType(exp->op.exp1->destType);
13038 exp->op.exp1->destType = type2;
13039 type2->refCount++;
13040 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)
13041 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operating on %s and %s with an untyped result, assuming %s\n", (((void *)0))), type1->_class->string, type2->_class->string, type1->_class->string);
13042 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
13043 {
13044 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13045
13046 if(argExp)
13047 {
13048 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13049
13050 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
13051 ProcessExpressionType(exp->op.exp1);
13052 if(type2->kind != 13)
13053 {
13054 ProcessExpressionType(classExp);
13055 exp->op.exp2 = MkExpBrackets(MkListOne(MkExpOp(exp->op.exp2, '*', MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("5")), OR_OP, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpConstant("0"))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize"))))))));
13056 if(!exp->op.exp2->expType)
13057 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
13058 ProcessExpressionType(exp->op.exp2);
13059 }
13060 }
13061 }
13062 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 23 || type2->kind == 22 || type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
13063 {
13064 if(type1->kind != 8 && type1->type->kind == 0)
13065 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13066 exp->expType = type1;
13067 if(type1)
13068 type1->refCount++;
13069 }
13070 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 23 || type1->kind == 22 || type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
13071 {
13072 if(type2->kind != 8 && type2->type->kind == 0)
13073 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
13074 exp->expType = type2;
13075 if(type2)
13076 type2->refCount++;
13077 }
13078 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))
13079 {
13080 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
13081 }
13082 else
13083 {
13084 unsigned int success = 0x0;
13085
13086 if(type1->kind == 13 && type2->kind == 13)
13087 {
13088 if(exp->op.op == '+')
13089 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
13090 else if(exp->op.op == '-')
13091 {
13092 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
13093 {
13094 exp->expType = __extension__ ({
13095 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13096
13097 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
13098 });
13099 success = 0x1;
13100 if(type1->type->kind == 20)
13101 {
13102 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
13103
13104 if(argExp)
13105 {
13106 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
13107
13108 ProcessExpressionType(classExp);
13109 exp->type = 5;
13110 exp->list = MkListOne(MkExpOp(MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(exp->op.exp1))), exp->op.op, MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(exp->op.exp2)))))), '/', MkExpBrackets(MkListOne(MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("noHeadClass"))), OR_OP, MkExpOp(MkExpMember(CopyExpression(classExp), MkIdentifier("type")), EQ_OP, MkExpIdentifier(MkIdentifier("normalClass")))))), MkListOne(MkExpTypeSize(MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))))), MkExpMember(classExp, MkIdentifier("typeSize")))))));
13111 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
13112 FreeType(dummy);
13113 return ;
13114 }
13115 }
13116 }
13117 }
13118 }
13119 if(!success && exp->op.exp1->type == 2)
13120 {
13121 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13122 {
13123 if(exp->expType)
13124 FreeType(exp->expType);
13125 exp->expType = exp->op.exp1->destType;
13126 if(exp->op.exp1->destType)
13127 exp->op.exp1->destType->refCount++;
13128 success = 0x1;
13129 }
13130 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13131 {
13132 if(exp->expType)
13133 FreeType(exp->expType);
13134 exp->expType = exp->op.exp2->destType;
13135 if(exp->op.exp2->destType)
13136 exp->op.exp2->destType->refCount++;
13137 success = 0x1;
13138 }
13139 }
13140 else if(!success)
13141 {
13142 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13143 {
13144 if(exp->expType)
13145 FreeType(exp->expType);
13146 exp->expType = exp->op.exp2->destType;
13147 if(exp->op.exp2->destType)
13148 exp->op.exp2->destType->refCount++;
13149 success = 0x1;
13150 }
13151 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13152 {
13153 if(exp->expType)
13154 FreeType(exp->expType);
13155 exp->expType = exp->op.exp1->destType;
13156 if(exp->op.exp1->destType)
13157 exp->op.exp1->destType->refCount++;
13158 success = 0x1;
13159 }
13160 }
13161 if(!success)
13162 {
13163 char expString1[10240];
13164 char expString2[10240];
13165 char type1[1024];
13166 char type2[1024];
13167
13168 expString1[0] = '\0';
13169 expString2[0] = '\0';
13170 type1[0] = '\0';
13171 type2[0] = '\0';
13172 if(inCompiler)
13173 {
13174 PrintExpression(exp->op.exp1, expString1);
13175 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13176 PrintExpression(exp->op.exp2, expString2);
13177 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13178 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
13179 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
13180 }
13181 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
13182 }
13183 }
13184 }
13185 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13186 {
13187 if(exp->op.exp1->destType)
13188 FreeType(exp->op.exp1->destType);
13189 exp->op.exp1->destType = type2->_class->registered->dataType;
13190 if(type2->_class->registered->dataType)
13191 type2->_class->registered->dataType->refCount++;
13192 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13193 exp->expType = type2;
13194 if(type2)
13195 type2->refCount++;
13196 }
13197 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13198 {
13199 if(exp->op.exp2->destType)
13200 FreeType(exp->op.exp2->destType);
13201 exp->op.exp2->destType = type1->_class->registered->dataType;
13202 if(type1->_class->registered->dataType)
13203 type1->_class->registered->dataType->refCount++;
13204 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13205 exp->expType = type1;
13206 if(type1)
13207 type1->refCount++;
13208 }
13209 else if(type1)
13210 {
13211 unsigned int valid = 0x0;
13212
13213 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
13214 {
13215 if(exp->op.exp2->destType)
13216 FreeType(exp->op.exp2->destType);
13217 if(!type1->_class->registered->dataType)
13218 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
13219 exp->op.exp2->destType = type1->_class->registered->dataType;
13220 exp->op.exp2->destType->refCount++;
13221 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13222 type2 = exp->op.exp2->destType;
13223 exp->expType = type2;
13224 type2->refCount++;
13225 }
13226 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
13227 {
13228 if(exp->op.exp1->destType)
13229 FreeType(exp->op.exp1->destType);
13230 if(!type2->_class->registered->dataType)
13231 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
13232 exp->op.exp1->destType = type2->_class->registered->dataType;
13233 exp->op.exp1->destType->refCount++;
13234 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13235 type1 = exp->op.exp1->destType;
13236 exp->expType = type1;
13237 type1->refCount++;
13238 }
13239 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
13240 {
13241 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
13242 {
13243 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
13244 {
13245 if(exp->expType)
13246 FreeType(exp->expType);
13247 exp->expType = exp->op.exp1->expType;
13248 if(exp->op.exp2->expType)
13249 exp->op.exp1->expType->refCount++;
13250 valid = 0x1;
13251 }
13252 }
13253 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
13254 {
13255 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
13256 {
13257 if(exp->expType)
13258 FreeType(exp->expType);
13259 exp->expType = exp->op.exp2->expType;
13260 if(exp->op.exp2->expType)
13261 exp->op.exp2->expType->refCount++;
13262 valid = 0x1;
13263 }
13264 }
13265 }
13266 if(!valid)
13267 {
13268 if(exp->op.exp2->destType)
13269 FreeType(exp->op.exp2->destType);
13270 exp->op.exp2->destType = type1;
13271 type1->refCount++;
13272 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
13273 {
13274 if(exp->expType)
13275 FreeType(exp->expType);
13276 exp->expType = exp->op.exp2->destType;
13277 if(exp->op.exp2->destType)
13278 exp->op.exp2->destType->refCount++;
13279 }
13280 else if(type1 && type2)
13281 {
13282 char expString1[10240];
13283 char expString2[10240];
13284 char type1String[1024];
13285 char type2String[1024];
13286
13287 expString1[0] = '\0';
13288 expString2[0] = '\0';
13289 type1String[0] = '\0';
13290 type2String[0] = '\0';
13291 if(inCompiler)
13292 {
13293 PrintExpression(exp->op.exp1, expString1);
13294 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
13295 PrintExpression(exp->op.exp2, expString2);
13296 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
13297 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
13298 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
13299 }
13300 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
13301 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
13302 {
13303 exp->expType = exp->op.exp1->expType;
13304 if(exp->op.exp1->expType)
13305 exp->op.exp1->expType->refCount++;
13306 }
13307 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13308 {
13309 exp->expType = exp->op.exp2->expType;
13310 if(exp->op.exp2->expType)
13311 exp->op.exp2->expType->refCount++;
13312 }
13313 }
13314 }
13315 }
13316 else if(type2)
13317 {
13318 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
13319 {
13320 struct Type * oldType = exp->op.exp1->expType;
13321
13322 exp->op.exp1->expType = (((void *)0));
13323 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13324 FreeType(oldType);
13325 else
13326 exp->op.exp1->expType = oldType;
13327 }
13328 if(exp->op.exp1->destType)
13329 FreeType(exp->op.exp1->destType);
13330 exp->op.exp1->destType = type2;
13331 type2->refCount++;
13332 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
13333 {
13334 if(exp->expType)
13335 FreeType(exp->expType);
13336 exp->expType = exp->op.exp1->destType;
13337 if(exp->op.exp1->destType)
13338 exp->op.exp1->destType->refCount++;
13339 }
13340 }
13341 }
13342 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
13343 {
13344 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
13345 {
13346 if(exp->op.exp1->destType)
13347 FreeType(exp->op.exp1->destType);
13348 exp->op.exp1->destType = type2->_class->registered->dataType;
13349 if(type2->_class->registered->dataType)
13350 type2->_class->registered->dataType->refCount++;
13351 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
13352 }
13353 if(exp->op.op == '!')
13354 {
13355 exp->expType = MkClassType("bool");
13356 exp->expType->truth = 0x1;
13357 }
13358 else
13359 {
13360 exp->expType = type2;
13361 if(type2)
13362 type2->refCount++;
13363 }
13364 }
13365 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13366 {
13367 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13368 {
13369 if(exp->op.exp2->destType)
13370 FreeType(exp->op.exp2->destType);
13371 exp->op.exp2->destType = type1->_class->registered->dataType;
13372 if(type1->_class->registered->dataType)
13373 type1->_class->registered->dataType->refCount++;
13374 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13375 }
13376 exp->expType = type1;
13377 if(type1)
13378 type1->refCount++;
13379 }
13380 }
13381 yylloc = exp->loc;
13382 if(exp->op.exp1 && !exp->op.exp1->expType)
13383 {
13384 char expString[10000];
13385
13386 expString[0] = '\0';
13387 if(inCompiler)
13388 {
13389 PrintExpression(exp->op.exp1, expString);
13390 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13391 }
13392 if(expString[0])
13393 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13394 }
13395 if(exp->op.exp2 && !exp->op.exp2->expType)
13396 {
13397 char expString[10240];
13398
13399 expString[0] = '\0';
13400 if(inCompiler)
13401 {
13402 PrintExpression(exp->op.exp2, expString);
13403 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13404 }
13405 if(expString[0])
13406 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13407 }
13408 if(boolResult)
13409 {
13410 FreeType(exp->expType);
13411 exp->expType = MkClassType("bool");
13412 exp->expType->truth = 0x1;
13413 }
13414 if(exp->op.op != SIZEOF)
13415 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13416 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13417 {
13418 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13419 }
13420 yylloc = oldyylloc;
13421 FreeType(dummy);
13422 break;
13423 }
13424 case 5:
13425 case 34:
13426 {
13427 struct Expression * e;
13428
13429 exp->isConstant = 0x1;
13430 for(e = (*exp->list).first; e; e = e->next)
13431 {
13432 unsigned int inced = 0x0;
13433
13434 if(!e->next)
13435 {
13436 FreeType(e->destType);
13437 e->destType = exp->destType;
13438 if(e->destType)
13439 {
13440 exp->destType->refCount++;
13441 e->destType->count++;
13442 inced = 0x1;
13443 }
13444 }
13445 ProcessExpressionType(e);
13446 if(inced)
13447 exp->destType->count--;
13448 if(!exp->expType && !e->next)
13449 {
13450 exp->expType = e->expType;
13451 if(e->expType)
13452 e->expType->refCount++;
13453 }
13454 if(!e->isConstant)
13455 exp->isConstant = 0x0;
13456 }
13457 e = (*exp->list).first;
13458 if(!e->next && e->type == 8)
13459 {
13460 struct Expression * next = exp->next, * prev = exp->prev;
13461
13462 FreeType(exp->expType);
13463 FreeType(exp->destType);
13464 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13465 *exp = *e;
13466 exp->prev = prev;
13467 exp->next = next;
13468 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13469 ProcessExpressionType(exp);
13470 }
13471 break;
13472 }
13473 case 6:
13474 {
13475 struct Expression * e;
13476
13477 exp->isConstant = 0x1;
13478 ProcessExpressionType(exp->index.exp);
13479 if(!exp->index.exp->isConstant)
13480 exp->isConstant = 0x0;
13481 if(exp->index.exp->expType)
13482 {
13483 struct Type * source = exp->index.exp->expType;
13484
13485 if(source->kind == 8 && source->_class && source->_class->registered)
13486 {
13487 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13488 struct __ecereNameSpace__ecere__com__Class * c = _class->templateClass ? _class->templateClass : _class;
13489
13490 if(_class != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(c, containerClass) && _class->templateArgs)
13491 {
13492 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13493 if(exp->index.index && (*exp->index.index).last)
13494 {
13495 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13496 }
13497 }
13498 }
13499 }
13500 for(e = (*exp->index.index).first; e; e = e->next)
13501 {
13502 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13503 {
13504 if(e->destType)
13505 FreeType(e->destType);
13506 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13507 }
13508 ProcessExpressionType(e);
13509 if(!e->next)
13510 {
13511 }
13512 if(!e->isConstant)
13513 exp->isConstant = 0x0;
13514 }
13515 if(!exp->expType)
13516 exp->expType = Dereference(exp->index.exp->expType);
13517 if(exp->expType)
13518 DeclareType(exp->expType, 0x0, 0x0);
13519 break;
13520 }
13521 case 7:
13522 {
13523 struct Expression * e;
13524 struct Type * functionType;
13525 struct Type * methodType = (((void *)0));
13526 char name[1024];
13527
13528 name[0] = '\0';
13529 if(inCompiler)
13530 {
13531 PrintExpression(exp->call.exp, name);
13532 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13533 {
13534 PrintExpression(exp->call.exp, name);
13535 }
13536 }
13537 if(exp->call.exp->type == 0)
13538 {
13539 struct Expression * idExp = exp->call.exp;
13540 struct Identifier * id = idExp->identifier;
13541
13542 if(!strcmp(id->string, "__builtin_frame_address"))
13543 {
13544 exp->expType = ProcessTypeString("void *", 0x1);
13545 if(exp->call.arguments && (*exp->call.arguments).first)
13546 ProcessExpressionType((*exp->call.arguments).first);
13547 break;
13548 }
13549 else if(!strcmp(id->string, "__ENDIAN_PAD"))
13550 {
13551 exp->expType = ProcessTypeString("int", 0x1);
13552 if(exp->call.arguments && (*exp->call.arguments).first)
13553 ProcessExpressionType((*exp->call.arguments).first);
13554 break;
13555 }
13556 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13557 {
13558 struct Expression * a = (((void *)0));
13559 struct Expression * b = (((void *)0));
13560 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13561
13562 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13563 {
13564 a = (*exp->call.arguments).first;
13565 b = (*exp->call.arguments).last;
13566 tempExp1 = a;
13567 tempExp2 = b;
13568 }
13569 else if((*exp->call.arguments).count == 1)
13570 {
13571 a = (*exp->call.arguments).first;
13572 tempExp1 = a;
13573 }
13574 if(a)
13575 {
13576 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13577 idExp->identifier = (((void *)0));
13578 FreeExpContents(exp);
13579 ProcessExpressionType(a);
13580 if(b)
13581 ProcessExpressionType(b);
13582 exp->type = 5;
13583 exp->list = MkList();
13584 if(a->expType && (!b || b->expType))
13585 {
13586 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13587 {
13588 if(inCompiler)
13589 {
13590 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13591 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13592 struct Declaration * decl;
13593 char temp1[1024], temp2[1024];
13594
13595 GetTypeSpecs(a->expType, specs);
13596 if(a && !a->isConstant && a->type != 0)
13597 {
13598 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13599 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13600 tempExp1 = QMkExpId(temp1);
13601 tempExp1->expType = a->expType;
13602 if(a->expType)
13603 a->expType->refCount++;
13604 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13605 }
13606 if(b && !b->isConstant && b->type != 0)
13607 {
13608 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13609 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13610 tempExp2 = QMkExpId(temp2);
13611 tempExp2->expType = b->expType;
13612 if(b->expType)
13613 b->expType->refCount++;
13614 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13615 }
13616 decl = MkDeclaration(specs, decls);
13617 if(!curCompound->compound.declarations)
13618 curCompound->compound.declarations = MkList();
13619 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13620 }
13621 }
13622 }
13623 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13624 {
13625 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13626
13627 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13628 exp->expType = a->expType;
13629 if(a->expType)
13630 a->expType->refCount++;
13631 }
13632 else if(!strcmp(id->string, "Abs"))
13633 {
13634 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13635 exp->expType = a->expType;
13636 if(a->expType)
13637 a->expType->refCount++;
13638 }
13639 else if(!strcmp(id->string, "Sgn"))
13640 {
13641 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"))))));
13642 exp->expType = ProcessTypeString("int", 0x0);
13643 }
13644 FreeExpression(tempExp1);
13645 if(tempExp2)
13646 FreeExpression(tempExp2);
13647 FreeIdentifier(id);
13648 break;
13649 }
13650 }
13651 }
13652 {
13653 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
13654
13655 if(!exp->call.exp->destType)
13656 {
13657 exp->call.exp->destType = dummy;
13658 dummy->refCount++;
13659 }
13660 ProcessExpressionType(exp->call.exp);
13661 if(exp->call.exp->destType == dummy)
13662 {
13663 FreeType(dummy);
13664 exp->call.exp->destType = (((void *)0));
13665 }
13666 FreeType(dummy);
13667 }
13668 functionType = exp->call.exp->expType;
13669 if(functionType && functionType->kind == 16)
13670 {
13671 methodType = functionType;
13672 functionType = methodType->method->dataType;
13673 if(exp->call.exp->expType->usedClass)
13674 {
13675 char typeString[1024];
13676
13677 typeString[0] = '\0';
13678 {
13679 struct Symbol * back = functionType->thisClass;
13680
13681 functionType->thisClass = (((void *)0));
13682 PrintType(functionType, typeString, 0x1, 0x1);
13683 functionType->thisClass = back;
13684 }
13685 if(strstr(typeString, "thisclass"))
13686 {
13687 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13688 struct Declarator * decl;
13689
13690 {
13691 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13692
13693 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13694 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13695 thisClassParams = 0x0;
13696 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13697 {
13698 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13699
13700 thisClass = exp->call.exp->expType->usedClass;
13701 ProcessDeclarator(decl);
13702 thisClass = backupThisClass;
13703 }
13704 thisClassParams = 0x1;
13705 functionType = ProcessType(specs, decl);
13706 functionType->refCount = 0;
13707 FinishTemplatesContext(context);
13708 }
13709 FreeList(specs, FreeSpecifier);
13710 FreeDeclarator(decl);
13711 }
13712 }
13713 }
13714 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13715 {
13716 struct Type * type = functionType->type;
13717
13718 if(!functionType->refCount)
13719 {
13720 functionType->type = (((void *)0));
13721 FreeType(functionType);
13722 }
13723 functionType = type;
13724 }
13725 if(functionType && functionType->kind != 11)
13726 {
13727 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13728 }
13729 else if(functionType)
13730 {
13731 unsigned int emptyParams = 0x0, noParams = 0x0;
13732 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13733 struct Type * type = functionType->params.first;
13734 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13735 int extra = 0;
13736 struct Location oldyylloc = yylloc;
13737
13738 if(!type)
13739 emptyParams = 0x1;
13740 if(functionType->extraParam && e && functionType->thisClass)
13741 {
13742 e->destType = MkClassType(functionType->thisClass->string);
13743 e = e->next;
13744 }
13745 if(!functionType->staticMethod && !functionType->extraParam)
13746 {
13747 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13748 {
13749 type = MkClassType(memberExp->member.exp->expType->_class->string);
13750 if(e)
13751 {
13752 e->destType = type;
13753 e = e->next;
13754 type = functionType->params.first;
13755 }
13756 else
13757 type->refCount = 0;
13758 }
13759 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13760 {
13761 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13762 type->byReference = functionType->byReference;
13763 type->typedByReference = functionType->typedByReference;
13764 if(e)
13765 {
13766 if(e->next && type->kind == 8 && (functionType && functionType->thisClass) && functionType->classObjectType == 2)
13767 e = e->next;
13768 e->destType = type;
13769 e = e->next;
13770 type = functionType->params.first;
13771 }
13772 else
13773 type->refCount = 0;
13774 }
13775 }
13776 if(type && type->kind == 0)
13777 {
13778 noParams = 0x1;
13779 if(!type->refCount)
13780 FreeType(type);
13781 type = (((void *)0));
13782 }
13783 for(; e; e = e->next)
13784 {
13785 if(!type && !emptyParams)
13786 {
13787 yylloc = e->loc;
13788 if(methodType && methodType->methodClass)
13789 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13790 else
13791 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
13792 break;
13793 }
13794 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13795 {
13796 struct Type * templatedType = (((void *)0));
13797 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13798 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13799 int id = 0;
13800
13801 if(_class && _class->templateArgs)
13802 {
13803 struct __ecereNameSpace__ecere__com__Class * sClass;
13804
13805 for(sClass = _class; sClass; sClass = sClass->base)
13806 {
13807 if(sClass->templateClass)
13808 sClass = sClass->templateClass;
13809 id = 0;
13810 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13811 {
13812 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13813 {
13814 struct __ecereNameSpace__ecere__com__Class * nextClass;
13815
13816 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13817 {
13818 if(nextClass->templateClass)
13819 nextClass = nextClass->templateClass;
13820 id += nextClass->templateParams.count;
13821 }
13822 break;
13823 }
13824 id++;
13825 }
13826 if(curParam)
13827 break;
13828 }
13829 }
13830 if(curParam && _class->templateArgs[id].dataTypeString)
13831 {
13832 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13833
13834 {
13835 struct Context * context = SetupTemplatesContext(_class);
13836
13837 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13838 FinishTemplatesContext(context);
13839 }
13840 e->destType = templatedType;
13841 if(templatedType)
13842 {
13843 templatedType->passAsTemplate = 0x1;
13844 }
13845 }
13846 else
13847 {
13848 e->destType = type;
13849 if(type)
13850 type->refCount++;
13851 }
13852 }
13853 else
13854 {
13855 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
13856 {
13857 e->destType = type->prev;
13858 e->destType->refCount++;
13859 }
13860 else
13861 {
13862 e->destType = type;
13863 if(type)
13864 type->refCount++;
13865 }
13866 }
13867 if(type && type->kind != 14)
13868 {
13869 struct Type * next = type->next;
13870
13871 if(!type->refCount)
13872 FreeType(type);
13873 type = next;
13874 }
13875 }
13876 if(type && type->kind != 14)
13877 {
13878 if(methodType && methodType->methodClass)
13879 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for method %s::%s (%d given, expected %d)\n", (((void *)0))), methodType->methodClass->fullName, methodType->method->name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13880 else
13881 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, exp->call.arguments ? (*exp->call.arguments).count : 0, functionType->params.count + extra);
13882 }
13883 yylloc = oldyylloc;
13884 if(type && !type->refCount)
13885 FreeType(type);
13886 }
13887 else
13888 {
13889 functionType = __extension__ ({
13890 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13891
13892 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
13893 });
13894 if(exp->call.exp->type == 0)
13895 {
13896 char * string = exp->call.exp->identifier->string;
13897
13898 if(inCompiler)
13899 {
13900 struct Symbol * symbol;
13901 struct Location oldyylloc = yylloc;
13902
13903 yylloc = exp->call.exp->identifier->loc;
13904 if(strstr(string, "__builtin_") == string)
13905 {
13906 if(exp->destType)
13907 {
13908 functionType->returnType = exp->destType;
13909 exp->destType->refCount++;
13910 }
13911 }
13912 else
13913 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13914 symbol = __extension__ ({
13915 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
13916
13917 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
13918 });
13919 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13920 if(strstr(symbol->string, "::"))
13921 globalContext->hasNameSpace = 0x1;
13922 yylloc = oldyylloc;
13923 }
13924 }
13925 else if(exp->call.exp->type == 8)
13926 {
13927 }
13928 else
13929 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13930 if(!functionType->returnType)
13931 {
13932 functionType->returnType = __extension__ ({
13933 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13934
13935 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
13936 });
13937 }
13938 }
13939 if(functionType && functionType->kind == 11)
13940 {
13941 exp->expType = functionType->returnType;
13942 if(functionType->returnType)
13943 functionType->returnType->refCount++;
13944 if(!functionType->refCount)
13945 FreeType(functionType);
13946 }
13947 if(exp->call.arguments)
13948 {
13949 for(e = (*exp->call.arguments).first; e; e = e->next)
13950 {
13951 struct Type * destType = e->destType;
13952
13953 ProcessExpressionType(e);
13954 }
13955 }
13956 break;
13957 }
13958 case 8:
13959 {
13960 struct Type * type;
13961 struct Location oldyylloc = yylloc;
13962 unsigned int thisPtr;
13963 struct Expression * checkExp = exp->member.exp;
13964
13965 while(checkExp)
13966 {
13967 if(checkExp->type == 11)
13968 checkExp = checkExp->cast.exp;
13969 else if(checkExp->type == 5)
13970 checkExp = checkExp->list ? (*checkExp->list).first : (((void *)0));
13971 else
13972 break;
13973 }
13974 thisPtr = (checkExp && checkExp->type == 0 && !strcmp(checkExp->identifier->string, "this"));
13975 exp->thisPtr = thisPtr;
13976 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13977 {
13978 exp->member.member->classSym = exp->member.member->_class->symbol;
13979 }
13980 ProcessExpressionType(exp->member.exp);
13981 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)
13982 {
13983 exp->isConstant = 0x0;
13984 }
13985 else
13986 exp->isConstant = exp->member.exp->isConstant;
13987 type = exp->member.exp->expType;
13988 yylloc = exp->loc;
13989 if(type && (type->kind == 20))
13990 {
13991 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13992 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13993
13994 if(_class)
13995 {
13996 for(param = _class->templateParams.first; param; param = param->next)
13997 {
13998 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13999 break;
14000 }
14001 }
14002 if(param && param->defaultArg.member)
14003 {
14004 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
14005
14006 if(argExp)
14007 {
14008 struct Expression * expMember = exp->member.exp;
14009 struct Declarator * decl;
14010 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14011 char thisClassTypeString[1024];
14012
14013 FreeIdentifier(exp->member.member);
14014 ProcessExpressionType(argExp);
14015 {
14016 char * colon = strstr(param->defaultArg.memberString, "::");
14017
14018 if(colon)
14019 {
14020 char className[1024];
14021 struct __ecereNameSpace__ecere__com__Class * sClass;
14022
14023 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
14024 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
14025 }
14026 else
14027 strcpy(thisClassTypeString, _class->fullName);
14028 }
14029 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
14030 exp->expType = ProcessType(specs, decl);
14031 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
14032 {
14033 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14034 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14035 int c;
14036 int paramCount = 0;
14037 int lastParam = -1;
14038 char templateString[1024];
14039 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14040
14041 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14042 for(cClass = expClass; cClass; cClass = cClass->base)
14043 {
14044 int p = 0;
14045
14046 for(param = cClass->templateParams.first; param; param = param->next)
14047 {
14048 int id = p;
14049 struct __ecereNameSpace__ecere__com__Class * sClass;
14050 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14051
14052 for(sClass = cClass->base; sClass; sClass = sClass->base)
14053 id += sClass->templateParams.count;
14054 arg = expClass->templateArgs[id];
14055 for(sClass = _class; sClass; sClass = sClass->base)
14056 {
14057 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
14058 int p = 0;
14059 struct __ecereNameSpace__ecere__com__Class * nextClass;
14060
14061 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
14062 p += nextClass->templateParams.count;
14063 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
14064 {
14065 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
14066 {
14067 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14068 {
14069 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
14070 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
14071 break;
14072 }
14073 }
14074 }
14075 }
14076 {
14077 char argument[256];
14078
14079 argument[0] = '\0';
14080 switch(param->type)
14081 {
14082 case 2:
14083 {
14084 char expString[1024];
14085 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14086 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14087 struct Expression * exp;
14088 char * string = PrintHexUInt64(arg.expression.ui64);
14089
14090 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14091 ProcessExpressionType(exp);
14092 ComputeExpression(exp);
14093 expString[0] = '\0';
14094 PrintExpression(exp, expString);
14095 strcat(argument, expString);
14096 FreeExpression(exp);
14097 break;
14098 }
14099 case 1:
14100 {
14101 strcat(argument, arg.member->name);
14102 break;
14103 }
14104 case 0:
14105 {
14106 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14107 {
14108 if(!strcmp(arg.dataTypeString, "thisclass"))
14109 strcat(argument, thisClassTypeString);
14110 else
14111 strcat(argument, arg.dataTypeString);
14112 }
14113 break;
14114 }
14115 }
14116 if(argument[0])
14117 {
14118 if(paramCount)
14119 strcat(templateString, ", ");
14120 if(lastParam != p - 1)
14121 {
14122 strcat(templateString, param->name);
14123 strcat(templateString, " = ");
14124 }
14125 strcat(templateString, argument);
14126 paramCount++;
14127 lastParam = p;
14128 }
14129 p++;
14130 }
14131 }
14132 }
14133 {
14134 int len = strlen(templateString);
14135
14136 if(templateString[len - 1] == '>')
14137 templateString[len++] = ' ';
14138 templateString[len++] = '>';
14139 templateString[len++] = '\0';
14140 }
14141 {
14142 struct Context * context = SetupTemplatesContext(_class);
14143
14144 FreeType(exp->expType);
14145 exp->expType = ProcessTypeString(templateString, 0x0);
14146 FinishTemplatesContext(context);
14147 }
14148 }
14149 exp->type = 5;
14150 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")))))))));
14151 }
14152 }
14153 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
14154 {
14155 type = ProcessTemplateParameterType(type->templateParameter);
14156 }
14157 }
14158 if(type && (type->kind == 20))
14159 ;
14160 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15 || type->kind == 4 || type->kind == 2 || type->kind == 5 || type->kind == 1 || type->kind == 22 || type->kind == 23 || type->kind == 6 || type->kind == 7 || (type->kind == 13 && type->type->kind == 1)))
14161 {
14162 struct Identifier * id = exp->member.member;
14163 int typeKind = type->kind;
14164 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));
14165
14166 if(typeKind == 19 && exp->member.exp->type == 26)
14167 {
14168 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
14169 typeKind = 8;
14170 }
14171 if(id)
14172 {
14173 if(typeKind == 3 || typeKind == 15)
14174 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
14175 else if(!_class)
14176 {
14177 if(type->kind == 8 && type->_class && type->_class->registered)
14178 {
14179 _class = type->_class->registered;
14180 }
14181 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
14182 {
14183 _class = FindClass("char *")->registered;
14184 }
14185 else if(type->kind == 13)
14186 {
14187 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
14188 FreeType(exp->expType);
14189 exp->expType = ProcessTypeString("uintptr", 0x0);
14190 exp->byReference = 0x1;
14191 }
14192 else
14193 {
14194 char string[1024] = "";
14195 struct Symbol * classSym;
14196
14197 PrintTypeNoConst(type, string, 0x0, 0x1);
14198 classSym = FindClass(string);
14199 if(classSym)
14200 _class = classSym->registered;
14201 }
14202 }
14203 }
14204 if(_class && id)
14205 {
14206 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
14207 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
14208 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
14209 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
14210 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
14211
14212 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
14213 exp->member.memberType = 1;
14214 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
14215 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
14216 if(typeKind != 19)
14217 {
14218 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
14219 {
14220 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14221 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
14222 {
14223 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14224 if(prop)
14225 member = (((void *)0));
14226 }
14227 if(!member && !prop)
14228 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14229 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
14230 exp->member.thisPtr = 0x1;
14231 }
14232 else
14233 {
14234 if(!id->classSym)
14235 {
14236 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
14237 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14238 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
14239 }
14240 if(!prop && !member)
14241 {
14242 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
14243 if(!method)
14244 {
14245 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
14246 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
14247 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
14248 }
14249 }
14250 if(member && prop)
14251 {
14252 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
14253 prop = (((void *)0));
14254 else
14255 member = (((void *)0));
14256 }
14257 }
14258 }
14259 if(!prop && !member && !method)
14260 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
14261 if(!prop && !member && !method)
14262 {
14263 if(typeKind == 19)
14264 {
14265 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
14266 if(classProp)
14267 {
14268 exp->member.memberType = 5;
14269 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
14270 }
14271 else
14272 {
14273 char structName[1024];
14274 struct Identifier * id = exp->member.member;
14275 struct Expression * classExp = exp->member.exp;
14276
14277 type->refCount++;
14278 FreeType(classExp->expType);
14279 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
14280 strcpy(structName, "__ecereClassData_");
14281 FullClassNameCat(structName, type->_class->string, 0x0);
14282 exp->type = 9;
14283 exp->member.member = id;
14284 exp->member.exp = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(type->_class->string)), (((void *)0))), MkIdentifier("offsetClass"))))))));
14285 FreeType(type);
14286 ProcessExpressionType(exp);
14287 return ;
14288 }
14289 }
14290 else
14291 {
14292 struct Symbol * classSym = FindClass(id->string);
14293
14294 if(classSym)
14295 {
14296 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
14297
14298 if(convertClass)
14299 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
14300 }
14301 }
14302 }
14303 if(prop)
14304 {
14305 exp->member.memberType = 1;
14306 if(!prop->dataType)
14307 ProcessPropertyType(prop);
14308 exp->expType = prop->dataType;
14309 if(prop->dataType)
14310 prop->dataType->refCount++;
14311 }
14312 else if(member)
14313 {
14314 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14315 {
14316 FreeExpContents(exp);
14317 exp->type = 0;
14318 exp->identifier = MkIdentifier("class");
14319 ProcessExpressionType(exp);
14320 return ;
14321 }
14322 exp->member.memberType = 3;
14323 DeclareStruct(_class->fullName, 0x0);
14324 if(!member->dataType)
14325 {
14326 struct Context * context = SetupTemplatesContext(_class);
14327
14328 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
14329 FinishTemplatesContext(context);
14330 }
14331 exp->expType = member->dataType;
14332 if(member->dataType)
14333 member->dataType->refCount++;
14334 }
14335 else if(revConvert)
14336 {
14337 exp->member.memberType = 4;
14338 exp->expType = MkClassType(revConvert->_class->fullName);
14339 }
14340 else if(method)
14341 {
14342 {
14343 exp->member.memberType = 2;
14344 }
14345 if(!method->dataType)
14346 ProcessMethodType(method);
14347 exp->expType = __extension__ ({
14348 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14349
14350 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
14351 });
14352 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
14353 exp->expType->usedClass = _class;
14354 }
14355 else if(!classProp)
14356 {
14357 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
14358 {
14359 FreeExpContents(exp);
14360 exp->type = 0;
14361 exp->identifier = MkIdentifier("class");
14362 ProcessExpressionType(exp);
14363 return ;
14364 }
14365 yylloc = exp->member.member->loc;
14366 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
14367 if(inCompiler)
14368 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
14369 }
14370 if(_class && exp->expType)
14371 {
14372 struct __ecereNameSpace__ecere__com__Class * tClass;
14373
14374 tClass = _class;
14375 while(tClass && !tClass->templateClass)
14376 tClass = tClass->base;
14377 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
14378 {
14379 int id = 0;
14380 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14381 struct __ecereNameSpace__ecere__com__Class * sClass;
14382
14383 for(sClass = tClass; sClass; sClass = sClass->base)
14384 {
14385 id = 0;
14386 if(sClass->templateClass)
14387 sClass = sClass->templateClass;
14388 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14389 {
14390 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
14391 {
14392 for(sClass = sClass->base; sClass; sClass = sClass->base)
14393 id += sClass->templateParams.count;
14394 break;
14395 }
14396 id++;
14397 }
14398 if(curParam)
14399 break;
14400 }
14401 if(curParam && tClass->templateArgs[id].dataTypeString)
14402 {
14403 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14404 struct Context * context = SetupTemplatesContext(tClass);
14405
14406 FreeType(exp->expType);
14407 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
14408 if(exp->expType)
14409 {
14410 if(exp->expType->kind == 21)
14411 {
14412 FreeType(exp->expType);
14413 exp->expType = ReplaceThisClassType(_class);
14414 }
14415 if(tClass->templateClass)
14416 exp->expType->passAsTemplate = 0x1;
14417 if(!exp->destType)
14418 {
14419 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
14420 if(exp->destType->kind == 21)
14421 {
14422 FreeType(exp->destType);
14423 exp->destType = ReplaceThisClassType(_class);
14424 }
14425 }
14426 }
14427 FinishTemplatesContext(context);
14428 }
14429 }
14430 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
14431 {
14432 int id = 0;
14433 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
14434 struct __ecereNameSpace__ecere__com__Class * sClass;
14435
14436 for(sClass = tClass; sClass; sClass = sClass->base)
14437 {
14438 id = 0;
14439 if(sClass->templateClass)
14440 sClass = sClass->templateClass;
14441 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
14442 {
14443 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
14444 {
14445 for(sClass = sClass->base; sClass; sClass = sClass->base)
14446 id += sClass->templateParams.count;
14447 break;
14448 }
14449 id++;
14450 }
14451 if(curParam)
14452 break;
14453 }
14454 if(curParam)
14455 {
14456 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14457 struct Context * context = SetupTemplatesContext(tClass);
14458 struct Type * basicType;
14459
14460 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14461 if(basicType)
14462 {
14463 if(basicType->kind == 21)
14464 {
14465 FreeType(basicType);
14466 basicType = ReplaceThisClassType(_class);
14467 }
14468 FreeType(exp->expType);
14469 exp->expType = __extension__ ({
14470 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14471
14472 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
14473 });
14474 if(!exp->destType)
14475 {
14476 exp->destType = exp->expType;
14477 exp->destType->refCount++;
14478 }
14479 {
14480 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14481 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14482 struct Declarator * decl;
14483
14484 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14485 *newExp = *exp;
14486 if(exp->destType)
14487 exp->destType->refCount++;
14488 if(exp->expType)
14489 exp->expType->refCount++;
14490 exp->type = 11;
14491 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14492 exp->cast.exp = newExp;
14493 }
14494 }
14495 FinishTemplatesContext(context);
14496 }
14497 }
14498 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14499 {
14500 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14501
14502 if(expClass)
14503 {
14504 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14505 int c;
14506 int p = 0;
14507 int paramCount = 0;
14508 int lastParam = -1;
14509 char templateString[1024];
14510 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14511
14512 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14513 while(cClass != expClass)
14514 {
14515 struct __ecereNameSpace__ecere__com__Class * sClass;
14516
14517 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14518 ;
14519 cClass = sClass;
14520 for(param = cClass->templateParams.first; param; param = param->next)
14521 {
14522 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14523 int c;
14524 int cp = 0;
14525 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14526 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14527
14528 while(cClassCur != tClass && !paramCur)
14529 {
14530 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14531
14532 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14533 ;
14534 cClassCur = sClassCur;
14535 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14536 {
14537 if(!strcmp(paramCur->name, param->name))
14538 {
14539 break;
14540 }
14541 cp++;
14542 }
14543 }
14544 if(paramCur && paramCur->type == 0)
14545 arg = tClass->templateArgs[cp];
14546 else
14547 arg = expClass->templateArgs[p];
14548 {
14549 char argument[256];
14550
14551 argument[0] = '\0';
14552 switch(param->type)
14553 {
14554 case 2:
14555 {
14556 char expString[1024];
14557 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14558 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14559 struct Expression * exp;
14560 char * string = PrintHexUInt64(arg.expression.ui64);
14561
14562 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14563 ProcessExpressionType(exp);
14564 ComputeExpression(exp);
14565 expString[0] = '\0';
14566 PrintExpression(exp, expString);
14567 strcat(argument, expString);
14568 FreeExpression(exp);
14569 break;
14570 }
14571 case 1:
14572 {
14573 strcat(argument, arg.member->name);
14574 break;
14575 }
14576 case 0:
14577 {
14578 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14579 strcat(argument, arg.dataTypeString);
14580 break;
14581 }
14582 }
14583 if(argument[0])
14584 {
14585 if(paramCount)
14586 strcat(templateString, ", ");
14587 if(lastParam != p - 1)
14588 {
14589 strcat(templateString, param->name);
14590 strcat(templateString, " = ");
14591 }
14592 strcat(templateString, argument);
14593 paramCount++;
14594 lastParam = p;
14595 }
14596 }
14597 p++;
14598 }
14599 }
14600 {
14601 int len = strlen(templateString);
14602
14603 if(templateString[len - 1] == '>')
14604 templateString[len++] = ' ';
14605 templateString[len++] = '>';
14606 templateString[len++] = '\0';
14607 }
14608 FreeType(exp->expType);
14609 {
14610 struct Context * context = SetupTemplatesContext(tClass);
14611
14612 exp->expType = ProcessTypeString(templateString, 0x0);
14613 FinishTemplatesContext(context);
14614 }
14615 }
14616 }
14617 }
14618 }
14619 else
14620 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "undefined class %s\n", (((void *)0))), (id && (!id->_class || id->_class->name)) ? (id->classSym ? id->classSym->string : (type->_class ? type->_class->string : (((void *)0)))) : "(null)");
14621 }
14622 else if(type && (type->kind == 9 || type->kind == 10))
14623 {
14624 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14625
14626 if(memberType)
14627 {
14628 exp->expType = memberType;
14629 if(memberType)
14630 memberType->refCount++;
14631 }
14632 }
14633 else
14634 {
14635 char expString[10240];
14636
14637 expString[0] = '\0';
14638 if(inCompiler)
14639 {
14640 PrintExpression(exp, expString);
14641 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14642 }
14643 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14644 }
14645 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14646 {
14647 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14648 {
14649 struct Identifier * id = exp->member.member;
14650 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));
14651
14652 if(_class)
14653 {
14654 FreeType(exp->expType);
14655 exp->expType = ReplaceThisClassType(_class);
14656 }
14657 }
14658 }
14659 yylloc = oldyylloc;
14660 break;
14661 }
14662 case 9:
14663 {
14664 struct Type * destType = exp->destType;
14665
14666 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14667 {
14668 exp->member.member->classSym = exp->member.member->_class->symbol;
14669 }
14670 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14671 exp->type = 8;
14672 if(destType)
14673 destType->count++;
14674 ProcessExpressionType(exp);
14675 if(destType)
14676 destType->count--;
14677 break;
14678 }
14679 case 15:
14680 {
14681 struct Symbol * classSym = exp->_class->symbol;
14682
14683 if(classSym && classSym->registered)
14684 {
14685 if(classSym->registered->type == 5)
14686 {
14687 char name[1024];
14688
14689 name[0] = '\0';
14690 DeclareStruct(classSym->string, 0x0);
14691 FreeSpecifier(exp->_class);
14692 exp->type = 10;
14693 FullClassNameCat(name, classSym->string, 0x0);
14694 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14695 }
14696 else
14697 {
14698 if(classSym->registered->fixed)
14699 {
14700 FreeSpecifier(exp->_class);
14701 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14702 exp->type = 2;
14703 }
14704 else
14705 {
14706 char className[1024];
14707
14708 strcpy(className, "__ecereClass_");
14709 FullClassNameCat(className, classSym->string, 0x1);
14710 MangleClassName(className);
14711 DeclareClass(classSym, className);
14712 FreeExpContents(exp);
14713 exp->type = 9;
14714 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14715 exp->member.member = MkIdentifier("structSize");
14716 }
14717 }
14718 }
14719 exp->expType = __extension__ ({
14720 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14721
14722 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14723 });
14724 break;
14725 }
14726 case 10:
14727 {
14728 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14729
14730 exp->expType = __extension__ ({
14731 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14732
14733 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14734 });
14735 exp->isConstant = 0x1;
14736 DeclareType(type, 0x0, 0x0);
14737 FreeType(type);
14738 break;
14739 }
14740 case 11:
14741 {
14742 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14743
14744 type->count = 1;
14745 FreeType(exp->cast.exp->destType);
14746 exp->cast.exp->destType = type;
14747 type->refCount++;
14748 ProcessExpressionType(exp->cast.exp);
14749 type->count = 0;
14750 exp->expType = type;
14751 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14752 {
14753 void * prev = exp->prev, * next = exp->next;
14754 struct Type * expType = exp->cast.exp->destType;
14755 struct Expression * castExp = exp->cast.exp;
14756 struct Type * destType = exp->destType;
14757
14758 if(expType)
14759 expType->refCount++;
14760 FreeType(exp->expType);
14761 FreeTypeName(exp->cast.typeName);
14762 *exp = *castExp;
14763 FreeType(exp->expType);
14764 FreeType(exp->destType);
14765 exp->expType = expType;
14766 exp->destType = destType;
14767 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14768 exp->prev = prev;
14769 exp->next = next;
14770 }
14771 else
14772 {
14773 exp->isConstant = exp->cast.exp->isConstant;
14774 }
14775 break;
14776 }
14777 case 35:
14778 {
14779 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14780
14781 exp->expType = type;
14782 break;
14783 }
14784 case 36:
14785 {
14786 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14787
14788 ProcessExpressionType(exp->vaArg.exp);
14789 exp->expType = type;
14790 break;
14791 }
14792 case 12:
14793 {
14794 struct Expression * e;
14795
14796 exp->isConstant = 0x1;
14797 FreeType(exp->cond.cond->destType);
14798 exp->cond.cond->destType = MkClassType("bool");
14799 exp->cond.cond->destType->truth = 0x1;
14800 ProcessExpressionType(exp->cond.cond);
14801 if(!exp->cond.cond->isConstant)
14802 exp->isConstant = 0x0;
14803 for(e = (*exp->cond.exp).first; e; e = e->next)
14804 {
14805 if(!e->next)
14806 {
14807 FreeType(e->destType);
14808 e->destType = exp->destType;
14809 if(e->destType)
14810 e->destType->refCount++;
14811 }
14812 ProcessExpressionType(e);
14813 if(!e->next)
14814 {
14815 exp->expType = e->expType;
14816 if(e->expType)
14817 e->expType->refCount++;
14818 }
14819 if(!e->isConstant)
14820 exp->isConstant = 0x0;
14821 }
14822 FreeType(exp->cond.elseExp->destType);
14823 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14824 if(exp->cond.elseExp->destType)
14825 exp->cond.elseExp->destType->refCount++;
14826 ProcessExpressionType(exp->cond.elseExp);
14827 if(!exp->cond.elseExp->isConstant)
14828 exp->isConstant = 0x0;
14829 break;
14830 }
14831 case 25:
14832 {
14833 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14834 {
14835 struct Statement * last = (*exp->compound->compound.statements).last;
14836
14837 if(last->type == 3 && last->expressions && (*last->expressions).last)
14838 {
14839 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14840 if(exp->destType)
14841 exp->destType->refCount++;
14842 }
14843 ProcessStatement(exp->compound);
14844 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
14845 if(exp->expType)
14846 exp->expType->refCount++;
14847 }
14848 break;
14849 }
14850 case 26:
14851 {
14852 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14853
14854 if(spec && spec->type == 1)
14855 {
14856 exp->expType = MkClassType(spec->name);
14857 exp->expType->kind = 19;
14858 exp->byReference = 0x1;
14859 }
14860 else
14861 {
14862 exp->expType = MkClassType("ecere::com::Class");
14863 exp->byReference = 0x1;
14864 }
14865 break;
14866 }
14867 case 27:
14868 {
14869 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14870
14871 if(_class)
14872 {
14873 struct Identifier * id = exp->classData.id;
14874 char structName[1024];
14875 struct Expression * classExp;
14876
14877 strcpy(structName, "__ecereClassData_");
14878 FullClassNameCat(structName, _class->fullName, 0x0);
14879 exp->type = 9;
14880 exp->member.member = id;
14881 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14882 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14883 else
14884 classExp = MkExpIdentifier(MkIdentifier("class"));
14885 exp->member.exp = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp(MkExpCast(MkTypeName(MkListOne(MkSpecifier(CHAR)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpMember(classExp, MkIdentifier("data"))), '+', MkExpMember(MkExpClass(MkListOne(MkSpecifierName(_class->fullName)), (((void *)0))), MkIdentifier("offsetClass"))))))));
14886 ProcessExpressionType(exp);
14887 return ;
14888 }
14889 break;
14890 }
14891 case 37:
14892 {
14893 struct Type * type = (((void *)0));
14894 char * typeString = (((void *)0));
14895 char typeStringBuf[1024];
14896
14897 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))
14898 {
14899 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14900
14901 typeString = templateClass->templateArgs[2].dataTypeString;
14902 }
14903 else if(exp->list)
14904 {
14905 struct Expression * e;
14906
14907 for(e = (*exp->list).first; e; e = e->next)
14908 {
14909 ProcessExpressionType(e);
14910 if(e->expType)
14911 {
14912 if(!type)
14913 {
14914 type = e->expType;
14915 type->refCount++;
14916 }
14917 else
14918 {
14919 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14920 {
14921 FreeType(type);
14922 type = e->expType;
14923 e->expType = (((void *)0));
14924 e = (*exp->list).first;
14925 ProcessExpressionType(e);
14926 if(e->expType)
14927 {
14928 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14929 {
14930 FreeType(e->expType);
14931 e->expType = (((void *)0));
14932 FreeType(type);
14933 type = (((void *)0));
14934 break;
14935 }
14936 }
14937 }
14938 }
14939 if(e->expType)
14940 {
14941 FreeType(e->expType);
14942 e->expType = (((void *)0));
14943 }
14944 }
14945 }
14946 if(type)
14947 {
14948 typeStringBuf[0] = '\0';
14949 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
14950 typeString = typeStringBuf;
14951 FreeType(type);
14952 type = (((void *)0));
14953 }
14954 }
14955 if(typeString)
14956 {
14957 char templateString[1024];
14958 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14959 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14960 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14961 struct Expression * expExt;
14962 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14963
14964 sprintf(templateString, "Container<%s>", typeString);
14965 if(exp->list)
14966 {
14967 struct Expression * e;
14968
14969 type = ProcessTypeString(typeString, 0x0);
14970 while(e = (*exp->list).first)
14971 {
14972 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14973 e->destType = type;
14974 type->refCount++;
14975 ProcessExpressionType(e);
14976 ListAdd(initializers, MkInitializerAssignment(e));
14977 }
14978 FreeType(type);
14979 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14980 }
14981 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14982 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14983 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14984 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14985 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14986 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14987 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14988 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14989 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14990 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
14991 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14992
14993 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
14994 })));
14995 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14996 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14997 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14998 exp->expType = ProcessTypeString(templateString, 0x0);
14999 exp->type = 5;
15000 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
15001 ProcessExpressionType(expExt);
15002 }
15003 else
15004 {
15005 exp->expType = ProcessTypeString("Container", 0x0);
15006 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15007 }
15008 break;
15009 }
15010 }
15011 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
15012 {
15013 FreeType(exp->expType);
15014 exp->expType = ReplaceThisClassType(thisClass);
15015 }
15016 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
15017 {
15018 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
15019
15020 if(symbol)
15021 {
15022 if(exp->expType->kind != 15)
15023 {
15024 struct Type * member;
15025 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
15026
15027 FreeType(exp->expType);
15028 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15029 exp->expType->kind = symbol->type->kind;
15030 exp->expType->refCount++;
15031 exp->expType->enumName = enumName;
15032 exp->expType->members = symbol->type->members;
15033 for(member = symbol->type->members.first; member; member = member->next)
15034 member->refCount++;
15035 }
15036 else
15037 {
15038 struct __ecereNameSpace__ecere__sys__NamedLink * member;
15039
15040 for(member = symbol->type->members.first; member; member = member->next)
15041 {
15042 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
15043
15044 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
15045 }
15046 }
15047 }
15048 }
15049 yylloc = exp->loc;
15050 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
15051 ;
15052 else if(exp->destType && !exp->destType->keepCast)
15053 {
15054 if(!CheckExpressionType(exp, exp->destType, 0x0))
15055 {
15056 if(!exp->destType->count || unresolved)
15057 {
15058 if(!exp->expType)
15059 {
15060 yylloc = exp->loc;
15061 if(exp->destType->kind != 14)
15062 {
15063 char type2[1024];
15064
15065 type2[0] = '\0';
15066 if(inCompiler)
15067 {
15068 char expString[10240];
15069
15070 expString[0] = '\0';
15071 PrintType(exp->destType, type2, 0x0, 0x1);
15072 if(inCompiler)
15073 {
15074 PrintExpression(exp, expString);
15075 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15076 }
15077 if(unresolved)
15078 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
15079 else if(exp->type != 16)
15080 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
15081 }
15082 }
15083 else
15084 {
15085 char expString[10240];
15086
15087 expString[0] = '\0';
15088 if(inCompiler)
15089 {
15090 PrintExpression(exp, expString);
15091 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15092 }
15093 if(unresolved)
15094 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
15095 else if(exp->type != 16)
15096 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15097 }
15098 }
15099 else
15100 {
15101 char type1[1024];
15102 char type2[1024];
15103
15104 type1[0] = '\0';
15105 type2[0] = '\0';
15106 if(inCompiler)
15107 {
15108 PrintType(exp->expType, type1, 0x0, 0x1);
15109 PrintType(exp->destType, type2, 0x0, 0x1);
15110 }
15111 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)))
15112 ;
15113 else
15114 {
15115 char expString[10240];
15116
15117 expString[0] = '\0';
15118 if(inCompiler)
15119 {
15120 PrintExpression(exp, expString);
15121 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15122 }
15123 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
15124 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
15125 FreeType(exp->expType);
15126 exp->destType->refCount++;
15127 exp->expType = exp->destType;
15128 }
15129 }
15130 }
15131 }
15132 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
15133 {
15134 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
15135 char typeString[1024];
15136 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15137 struct Declarator * decl;
15138
15139 typeString[0] = '\0';
15140 *newExp = *exp;
15141 if(exp->expType)
15142 exp->expType->refCount++;
15143 if(exp->expType)
15144 exp->expType->refCount++;
15145 exp->type = 11;
15146 newExp->destType = exp->expType;
15147 PrintType(exp->expType, typeString, 0x0, 0x0);
15148 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15149 exp->cast.typeName = MkTypeName(specs, decl);
15150 exp->cast.exp = newExp;
15151 }
15152 }
15153 else if(unresolved)
15154 {
15155 if(exp->identifier->_class && exp->identifier->_class->name)
15156 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
15157 else if(exp->identifier->string && exp->identifier->string[0])
15158 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
15159 }
15160 else if(!exp->expType && exp->type != 16)
15161 {
15162 char expString[10240];
15163
15164 expString[0] = '\0';
15165 if(inCompiler)
15166 {
15167 PrintExpression(exp, expString);
15168 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15169 }
15170 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
15171 }
15172 if(inCompiler)
15173 ApplyAnyObjectLogic(exp);
15174 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5 && (!exp->destType || (exp->destType->kind != 3 && exp->destType->kind != 4 && exp->destType->kind != 22 && exp->destType->kind != 23 && exp->destType->kind != 5 && exp->destType->kind != 2 && exp->destType->kind != 1)))
15175 {
15176 exp->byReference = 0x1;
15177 }
15178 yylloc = oldyylloc;
15179 }
15180
15181 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)
15182 {
15183 if(*curMember)
15184 {
15185 *curMember = (*curMember)->next;
15186 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
15187 {
15188 *curMember = subMemberStack[--(*subMemberStackPos)];
15189 *curMember = (*curMember)->next;
15190 }
15191 while((*curMember) && (*curMember)->isProperty)
15192 *curMember = (*curMember)->next;
15193 if(subMemberStackPos)
15194 {
15195 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15196 {
15197 subMemberStack[(*subMemberStackPos)++] = *curMember;
15198 *curMember = (*curMember)->members.first;
15199 while(*curMember && (*curMember)->isProperty)
15200 *curMember = (*curMember)->next;
15201 }
15202 }
15203 }
15204 while(!*curMember)
15205 {
15206 if(!*curMember)
15207 {
15208 if(subMemberStackPos && *subMemberStackPos)
15209 {
15210 *curMember = subMemberStack[--(*subMemberStackPos)];
15211 *curMember = (*curMember)->next;
15212 }
15213 else
15214 {
15215 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
15216
15217 if(*curClass == _class)
15218 break;
15219 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
15220 ;
15221 *curMember = (*curClass)->membersAndProperties.first;
15222 }
15223 while((*curMember) && (*curMember)->isProperty)
15224 *curMember = (*curMember)->next;
15225 if(subMemberStackPos)
15226 {
15227 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
15228 {
15229 subMemberStack[(*subMemberStackPos)++] = *curMember;
15230 *curMember = (*curMember)->members.first;
15231 while(*curMember && (*curMember)->isProperty)
15232 *curMember = (*curMember)->next;
15233 }
15234 }
15235 }
15236 }
15237 }
15238
15239 static void ProcessInitializer(struct Initializer * init, struct Type * type)
15240 {
15241 switch(init->type)
15242 {
15243 case 0:
15244 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
15245 {
15246 if(init->exp && !init->exp->destType)
15247 {
15248 FreeType(init->exp->destType);
15249 init->exp->destType = type;
15250 if(type)
15251 type->refCount++;
15252 }
15253 if(init->exp)
15254 {
15255 ProcessExpressionType(init->exp);
15256 init->isConstant = init->exp->isConstant;
15257 }
15258 break;
15259 }
15260 else
15261 {
15262 struct Expression * exp = init->exp;
15263 struct Instantiation * inst = exp->instance;
15264 struct MembersInit * members;
15265
15266 init->type = 1;
15267 init->list = MkList();
15268 if(inst->members)
15269 {
15270 for(members = (*inst->members).first; members; members = members->next)
15271 {
15272 if(members->type == 0)
15273 {
15274 struct MemberInit * member;
15275
15276 for(member = (*members->dataMembers).first; member; member = member->next)
15277 {
15278 ListAdd(init->list, member->initializer);
15279 member->initializer = (((void *)0));
15280 }
15281 }
15282 }
15283 }
15284 FreeExpression(exp);
15285 }
15286 case 1:
15287 {
15288 struct Initializer * i;
15289 struct Type * initializerType = (((void *)0));
15290 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
15291 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
15292 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
15293 int subMemberStackPos = 0;
15294
15295 if(type && type->kind == 12)
15296 initializerType = Dereference(type);
15297 else if(type && (type->kind == 9 || type->kind == 10))
15298 initializerType = type->members.first;
15299 for(i = (*init->list).first; i; i = i->next)
15300 {
15301 if(type && type->kind == 8 && type->_class && type->_class->registered)
15302 {
15303 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
15304 if(curMember)
15305 {
15306 if(!curMember->dataType)
15307 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
15308 initializerType = curMember->dataType;
15309 }
15310 }
15311 ProcessInitializer(i, initializerType);
15312 if(initializerType && type && (type->kind == 9 || type->kind == 10))
15313 initializerType = initializerType->next;
15314 if(!i->isConstant)
15315 init->isConstant = 0x0;
15316 }
15317 if(type && type->kind == 12)
15318 FreeType(initializerType);
15319 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
15320 {
15321 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
15322 }
15323 break;
15324 }
15325 }
15326 }
15327
15328 extern struct Symbol * FindType(struct Context * ctx, char *  name);
15329
15330 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
15331
15332 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
15333 {
15334 switch(spec->type)
15335 {
15336 case 0:
15337 {
15338 if(spec->specifier == THISCLASS)
15339 {
15340 if(thisClass)
15341 {
15342 spec->type = 1;
15343 spec->name = ReplaceThisClass(thisClass);
15344 spec->symbol = FindClass(spec->name);
15345 ProcessSpecifier(spec, declareStruct);
15346 }
15347 }
15348 break;
15349 }
15350 case 1:
15351 {
15352 struct Symbol * symbol = FindType(curContext, spec->name);
15353
15354 if(symbol)
15355 DeclareType(symbol->type, 0x1, 0x1);
15356 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
15357 DeclareStruct(spec->name, 0x0);
15358 break;
15359 }
15360 case 2:
15361 {
15362 struct Enumerator * e;
15363
15364 if(spec->list)
15365 {
15366 for(e = (*spec->list).first; e; e = e->next)
15367 {
15368 if(e->exp)
15369 ProcessExpressionType(e->exp);
15370 }
15371 }
15372 break;
15373 }
15374 case 3:
15375 case 4:
15376 {
15377 if(spec->definitions)
15378 {
15379 struct ClassDef * def;
15380 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
15381
15382 ProcessClass(spec->definitions, symbol);
15383 }
15384 break;
15385 }
15386 }
15387 }
15388
15389 static void ProcessDeclarator(struct Declarator * decl)
15390 {
15391 switch(decl->type)
15392 {
15393 case 1:
15394 if(decl->identifier->classSym)
15395 {
15396 FreeSpecifier(decl->identifier->_class);
15397 decl->identifier->_class = (((void *)0));
15398 }
15399 break;
15400 case 3:
15401 if(decl->array.exp)
15402 ProcessExpressionType(decl->array.exp);
15403 case 0:
15404 case 2:
15405 case 4:
15406 case 5:
15407 case 6:
15408 case 7:
15409 if(decl->declarator)
15410 ProcessDeclarator(decl->declarator);
15411 if(decl->type == 4)
15412 {
15413 struct Identifier * id = GetDeclId(decl);
15414
15415 if(id && id->_class)
15416 {
15417 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
15418
15419 if(!decl->function.parameters)
15420 decl->function.parameters = MkList();
15421 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
15422 id->_class = (((void *)0));
15423 }
15424 if(decl->function.parameters)
15425 {
15426 struct TypeName * param;
15427
15428 for(param = (*decl->function.parameters).first; param; param = param->next)
15429 {
15430 if(param->qualifiers && (*param->qualifiers).first)
15431 {
15432 struct Specifier * spec = (*param->qualifiers).first;
15433
15434 if(spec && spec->specifier == TYPED_OBJECT)
15435 {
15436 struct Declarator * d = param->declarator;
15437 struct TypeName * newParam = (newParam = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), newParam->qualifiers = MkListOne(MkSpecifier(VOID)), newParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d), newParam);
15438
15439 FreeList(param->qualifiers, FreeSpecifier);
15440 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
15441 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
15442 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
15443 param = newParam;
15444 }
15445 else if(spec && spec->specifier == ANY_OBJECT)
15446 {
15447 struct Declarator * d = param->declarator;
15448
15449 FreeList(param->qualifiers, FreeSpecifier);
15450 param->qualifiers = MkListOne(MkSpecifier(VOID));
15451 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
15452 }
15453 else if(spec->specifier == THISCLASS)
15454 {
15455 if(thisClass)
15456 {
15457 spec->type = 1;
15458 spec->name = ReplaceThisClass(thisClass);
15459 spec->symbol = FindClass(spec->name);
15460 ProcessSpecifier(spec, 0x0);
15461 }
15462 }
15463 }
15464 if(param->declarator)
15465 ProcessDeclarator(param->declarator);
15466 }
15467 }
15468 }
15469 break;
15470 }
15471 }
15472
15473 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15474
15475 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15476
15477 static void ProcessDeclaration(struct Declaration * decl)
15478 {
15479 yylloc = decl->loc;
15480 switch(decl->type)
15481 {
15482 case 1:
15483 {
15484 unsigned int declareStruct = 0x0;
15485
15486 if(decl->declarators)
15487 {
15488 struct InitDeclarator * d;
15489
15490 for(d = (*decl->declarators).first; d; d = d->next)
15491 {
15492 struct Type * type, * subType;
15493
15494 ProcessDeclarator(d->declarator);
15495 type = ProcessType(decl->specifiers, d->declarator);
15496 if(d->initializer)
15497 {
15498 ProcessInitializer(d->initializer, type);
15499 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15500 {
15501 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15502 {
15503 struct Instantiation * inst = d->initializer->exp->instance;
15504
15505 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15506 d->initializer->exp->instance = (((void *)0));
15507 if(decl->specifiers)
15508 FreeList(decl->specifiers, FreeSpecifier);
15509 FreeList(decl->declarators, FreeInitDeclarator);
15510 d = (((void *)0));
15511 decl->type = 2;
15512 decl->inst = inst;
15513 }
15514 }
15515 }
15516 for(subType = type; subType; )
15517 {
15518 if(subType->kind == 8)
15519 {
15520 declareStruct = 0x1;
15521 break;
15522 }
15523 else if(subType->kind == 13)
15524 break;
15525 else if(subType->kind == 12)
15526 subType = subType->arrayType;
15527 else
15528 break;
15529 }
15530 FreeType(type);
15531 if(!d)
15532 break;
15533 }
15534 }
15535 if(decl->specifiers)
15536 {
15537 struct Specifier * s;
15538
15539 for(s = (*decl->specifiers).first; s; s = s->next)
15540 {
15541 ProcessSpecifier(s, declareStruct);
15542 }
15543 }
15544 break;
15545 }
15546 case 2:
15547 {
15548 ProcessInstantiationType(decl->inst);
15549 break;
15550 }
15551 case 0:
15552 {
15553 struct Specifier * spec;
15554 struct Declarator * d;
15555 unsigned int declareStruct = 0x0;
15556
15557 if(decl->declarators)
15558 {
15559 for(d = (*decl->declarators).first; d; d = d->next)
15560 {
15561 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15562 struct Type * subType;
15563
15564 ProcessDeclarator(d);
15565 for(subType = type; subType; )
15566 {
15567 if(subType->kind == 8)
15568 {
15569 declareStruct = 0x1;
15570 break;
15571 }
15572 else if(subType->kind == 13)
15573 break;
15574 else if(subType->kind == 12)
15575 subType = subType->arrayType;
15576 else
15577 break;
15578 }
15579 FreeType(type);
15580 }
15581 }
15582 if(decl->specifiers)
15583 {
15584 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15585 ProcessSpecifier(spec, declareStruct);
15586 }
15587 break;
15588 }
15589 }
15590 }
15591
15592 static struct FunctionDefinition * curFunction;
15593
15594 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15595 {
15596 char propName[1024], propNameM[1024];
15597 char getName[1024], setName[1024];
15598 struct __ecereNameSpace__ecere__sys__OldList * args;
15599
15600 DeclareProperty(prop, setName, getName);
15601 strcpy(propName, "__ecereProp_");
15602 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15603 strcat(propName, "_");
15604 FullClassNameCat(propName, prop->name, 0x1);
15605 MangleClassName(propName);
15606 strcpy(propNameM, "__ecerePropM_");
15607 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15608 strcat(propNameM, "_");
15609 FullClassNameCat(propNameM, prop->name, 0x1);
15610 MangleClassName(propNameM);
15611 if(prop->isWatchable)
15612 {
15613 args = MkList();
15614 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15615 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15616 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15617 args = MkList();
15618 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15619 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15620 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15621 }
15622 {
15623 args = MkList();
15624 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15625 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15626 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15627 args = MkList();
15628 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15629 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15630 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15631 }
15632 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15633 curFunction->propSet->fireWatchersDone = 0x1;
15634 }
15635
15636 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15637
15638 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15639
15640 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15641
15642 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15643
15644 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15645
15646 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15647
15648 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15649
15650 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15651
15652 static void ProcessStatement(struct Statement * stmt)
15653 {
15654 yylloc = stmt->loc;
15655 switch(stmt->type)
15656 {
15657 case 0:
15658 ProcessStatement(stmt->labeled.stmt);
15659 break;
15660 case 1:
15661 if(stmt->caseStmt.exp)
15662 {
15663 FreeType(stmt->caseStmt.exp->destType);
15664 stmt->caseStmt.exp->destType = curSwitchType;
15665 if(curSwitchType)
15666 curSwitchType->refCount++;
15667 ProcessExpressionType(stmt->caseStmt.exp);
15668 ComputeExpression(stmt->caseStmt.exp);
15669 }
15670 if(stmt->caseStmt.stmt)
15671 ProcessStatement(stmt->caseStmt.stmt);
15672 break;
15673 case 2:
15674 {
15675 if(stmt->compound.context)
15676 {
15677 struct Declaration * decl;
15678 struct Statement * s;
15679 struct Statement * prevCompound = curCompound;
15680 struct Context * prevContext = curContext;
15681
15682 if(!stmt->compound.isSwitch)
15683 {
15684 curCompound = stmt;
15685 curContext = stmt->compound.context;
15686 }
15687 if(stmt->compound.declarations)
15688 {
15689 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15690 ProcessDeclaration(decl);
15691 }
15692 if(stmt->compound.statements)
15693 {
15694 for(s = (*stmt->compound.statements).first; s; s = s->next)
15695 ProcessStatement(s);
15696 }
15697 curContext = prevContext;
15698 curCompound = prevCompound;
15699 }
15700 break;
15701 }
15702 case 3:
15703 {
15704 struct Expression * exp;
15705
15706 if(stmt->expressions)
15707 {
15708 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15709 ProcessExpressionType(exp);
15710 }
15711 break;
15712 }
15713 case 4:
15714 {
15715 struct Expression * exp;
15716
15717 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15718 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15719 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15720 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15721 {
15722 ProcessExpressionType(exp);
15723 }
15724 if(stmt->ifStmt.stmt)
15725 ProcessStatement(stmt->ifStmt.stmt);
15726 if(stmt->ifStmt.elseStmt)
15727 ProcessStatement(stmt->ifStmt.elseStmt);
15728 break;
15729 }
15730 case 5:
15731 {
15732 struct Type * oldSwitchType = curSwitchType;
15733
15734 if(stmt->switchStmt.exp)
15735 {
15736 struct Expression * exp;
15737
15738 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15739 {
15740 if(!exp->next)
15741 {
15742 ProcessExpressionType(exp);
15743 }
15744 if(!exp->next)
15745 curSwitchType = exp->expType;
15746 }
15747 }
15748 ProcessStatement(stmt->switchStmt.stmt);
15749 curSwitchType = oldSwitchType;
15750 break;
15751 }
15752 case 6:
15753 {
15754 if(stmt->whileStmt.exp)
15755 {
15756 struct Expression * exp;
15757
15758 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15759 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15760 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15761 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15762 {
15763 ProcessExpressionType(exp);
15764 }
15765 }
15766 if(stmt->whileStmt.stmt)
15767 ProcessStatement(stmt->whileStmt.stmt);
15768 break;
15769 }
15770 case 7:
15771 {
15772 if(stmt->doWhile.exp)
15773 {
15774 struct Expression * exp;
15775
15776 if((*stmt->doWhile.exp).last)
15777 {
15778 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15779 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15780 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15781 }
15782 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15783 {
15784 ProcessExpressionType(exp);
15785 }
15786 }
15787 if(stmt->doWhile.stmt)
15788 ProcessStatement(stmt->doWhile.stmt);
15789 break;
15790 }
15791 case 8:
15792 {
15793 struct Expression * exp;
15794
15795 if(stmt->forStmt.init)
15796 ProcessStatement(stmt->forStmt.init);
15797 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15798 {
15799 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15800 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15801 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15802 }
15803 if(stmt->forStmt.check)
15804 ProcessStatement(stmt->forStmt.check);
15805 if(stmt->forStmt.increment)
15806 {
15807 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15808 ProcessExpressionType(exp);
15809 }
15810 if(stmt->forStmt.stmt)
15811 ProcessStatement(stmt->forStmt.stmt);
15812 break;
15813 }
15814 case 18:
15815 {
15816 struct Identifier * id = stmt->forEachStmt.id;
15817 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15818 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15819 struct Statement * block = stmt->forEachStmt.stmt;
15820 char iteratorType[1024];
15821 struct Type * source;
15822 struct Expression * e;
15823 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));
15824 struct Expression * arrayExp;
15825 char * typeString = (((void *)0));
15826 int builtinCount = 0;
15827
15828 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15829 {
15830 if(!e->next)
15831 {
15832 FreeType(e->destType);
15833 e->destType = ProcessTypeString("Container", 0x0);
15834 }
15835 if(!isBuiltin || e->next)
15836 ProcessExpressionType(e);
15837 }
15838 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15839 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15840 {
15841 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15842 struct Symbol * symbol;
15843 struct Expression * expIt = (((void *)0));
15844 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15845 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15846 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15847 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15848
15849 stmt->type = 2;
15850 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15851 stmt->compound.context->parent = curContext;
15852 curContext = stmt->compound.context;
15853 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15854 {
15855 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15856 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15857
15858 isCustomAVLTree = 0x1;
15859 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15860 isAVLTree = 0x1;
15861 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15862 isMap = 0x1;
15863 }
15864 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15865 isArray = 0x1;
15866 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15867 {
15868 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15869
15870 isLinkList = 0x1;
15871 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15872 }
15873 if(isArray)
15874 {
15875 struct Declarator * decl;
15876 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15877
15878 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15879 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15880 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15881 }
15882 else if(isBuiltin)
15883 {
15884 struct Type * type = (((void *)0));
15885 char typeStringBuf[1024];
15886
15887 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15888 if(((struct Expression *)(*exp).last)->type == 11)
15889 {
15890 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15891
15892 if(typeName)
15893 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15894 }
15895 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)
15896 {
15897 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15898
15899 typeString = templateClass->templateArgs[2].dataTypeString;
15900 }
15901 else if(arrayExp->list)
15902 {
15903 struct Expression * e;
15904
15905 for(e = (*arrayExp->list).first; e; e = e->next)
15906 {
15907 ProcessExpressionType(e);
15908 if(e->expType)
15909 {
15910 if(!type)
15911 {
15912 type = e->expType;
15913 type->refCount++;
15914 }
15915 else
15916 {
15917 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15918 {
15919 FreeType(type);
15920 type = e->expType;
15921 e->expType = (((void *)0));
15922 e = (*arrayExp->list).first;
15923 ProcessExpressionType(e);
15924 if(e->expType)
15925 {
15926 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15927 {
15928 FreeType(e->expType);
15929 e->expType = (((void *)0));
15930 FreeType(type);
15931 type = (((void *)0));
15932 break;
15933 }
15934 }
15935 }
15936 }
15937 if(e->expType)
15938 {
15939 FreeType(e->expType);
15940 e->expType = (((void *)0));
15941 }
15942 }
15943 }
15944 if(type)
15945 {
15946 typeStringBuf[0] = '\0';
15947 PrintType(type, typeStringBuf, 0x0, 0x1);
15948 typeString = typeStringBuf;
15949 FreeType(type);
15950 }
15951 }
15952 if(typeString)
15953 {
15954 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15955 struct Declarator * decl;
15956 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15957
15958 if(arrayExp->list)
15959 {
15960 struct Expression * e;
15961
15962 builtinCount = (*arrayExp->list).count;
15963 type = ProcessTypeString(typeString, 0x0);
15964 while(e = (*arrayExp->list).first)
15965 {
15966 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15967 e->destType = type;
15968 type->refCount++;
15969 ProcessExpressionType(e);
15970 ListAdd(initializers, MkInitializerAssignment(e));
15971 }
15972 FreeType(type);
15973 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15974 }
15975 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15976 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15977 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
15978 FreeList(exp, FreeExpression);
15979 }
15980 else
15981 {
15982 arrayExp->expType = ProcessTypeString("Container", 0x0);
15983 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15984 }
15985 }
15986 else if(isLinkList && !isList)
15987 {
15988 struct Declarator * decl;
15989 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15990
15991 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15992 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15993 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15994 }
15995 else if(_class->templateArgs)
15996 {
15997 if(isMap)
15998 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15999 else
16000 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
16001 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
16002 }
16003 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
16004 if(block && block->type == 2 && block->compound.context)
16005 {
16006 block->compound.context->parent = stmt->compound.context;
16007 }
16008 if(filter)
16009 {
16010 block = MkIfStmt(filter, block, (((void *)0)));
16011 }
16012 if(isArray)
16013 {
16014 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array"))))), MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<', MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("array")), '+', MkExpMember(MkExpIdentifier(MkIdentifier("__internalArray")), MkIdentifier("count")))))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, (((void *)0)))), block));
16015 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16016 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16017 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16018 }
16019 else if(isBuiltin)
16020 {
16021 char count[128];
16022
16023 sprintf(count, "%d", builtinCount);
16024 stmt->compound.statements = MkListOne(MkForStmt(MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '=', MkExpIdentifier(MkIdentifier("__internalArray"))))), MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), '<', MkExpOp(MkExpIdentifier(MkIdentifier("__internalArray")), '+', MkExpConstant(count))))), MkListOne(MkExpOp(MkExpIdentifier(CopyIdentifier(id)), INC_OP, (((void *)0)))), block));
16025 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16026 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16027 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16028 }
16029 else if(isLinkList && !isList)
16030 {
16031 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
16032 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
16033
16034 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
16035 {
16036 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));
16037 }
16038 else
16039 {
16040 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16041 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
16042
16043 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));
16044 }
16045 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
16046 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
16047 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
16048 }
16049 else
16050 {
16051 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
16052 }
16053 ProcessExpressionType(expIt);
16054 if((*stmt->compound.declarations).first)
16055 ProcessDeclaration((*stmt->compound.declarations).first);
16056 if(symbol)
16057 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
16058 ProcessStatement(stmt);
16059 curContext = stmt->compound.context->parent;
16060 break;
16061 }
16062 else
16063 {
16064 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
16065 }
16066 break;
16067 }
16068 case 9:
16069 break;
16070 case 10:
16071 break;
16072 case 11:
16073 break;
16074 case 12:
16075 {
16076 struct Expression * exp;
16077
16078 if(stmt->expressions)
16079 {
16080 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
16081 {
16082 if(!exp->next)
16083 {
16084 if(curFunction && !curFunction->type)
16085 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
16086 FreeType(exp->destType);
16087 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
16088 if(exp->destType)
16089 exp->destType->refCount++;
16090 }
16091 ProcessExpressionType(exp);
16092 }
16093 }
16094 break;
16095 }
16096 case 14:
16097 {
16098 ProcessDeclaration(stmt->decl);
16099 break;
16100 }
16101 case 13:
16102 {
16103 struct AsmField * field;
16104
16105 if(stmt->asmStmt.inputFields)
16106 {
16107 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
16108 if(field->expression)
16109 ProcessExpressionType(field->expression);
16110 }
16111 if(stmt->asmStmt.outputFields)
16112 {
16113 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
16114 if(field->expression)
16115 ProcessExpressionType(field->expression);
16116 }
16117 if(stmt->asmStmt.clobberedFields)
16118 {
16119 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
16120 {
16121 if(field->expression)
16122 ProcessExpressionType(field->expression);
16123 }
16124 }
16125 break;
16126 }
16127 case 17:
16128 {
16129 struct PropertyWatch * propWatch;
16130 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16131 struct Expression * object = stmt->_watch.object;
16132 struct Expression * watcher = stmt->_watch.watcher;
16133
16134 if(watcher)
16135 ProcessExpressionType(watcher);
16136 if(object)
16137 ProcessExpressionType(object);
16138 if(inCompiler)
16139 {
16140 if(watcher || thisClass)
16141 {
16142 struct External * external = curExternal;
16143 struct Context * context = curContext;
16144
16145 stmt->type = 3;
16146 stmt->expressions = MkList();
16147 curExternal = external->prev;
16148 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16149 {
16150 struct ClassFunction * func;
16151 char watcherName[1024];
16152 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
16153 struct External * createdExternal;
16154 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
16155
16156 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
16157 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
16158 if(propWatch->deleteWatch)
16159 strcat(watcherName, "_delete");
16160 else
16161 {
16162 struct Identifier * propID;
16163
16164 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16165 {
16166 strcat(watcherName, "_");
16167 strcat(watcherName, propID->string);
16168 }
16169 }
16170 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
16171 {
16172 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
16173 ProcessClassFunctionBody(func, propWatch->compound);
16174 propWatch->compound = (((void *)0));
16175 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
16176 createdExternal->symbol->idCode = external->symbol->idCode;
16177 curExternal = createdExternal;
16178 ProcessFunction(createdExternal->function);
16179 {
16180 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
16181
16182 externalDecl->declaration = decl;
16183 if(decl->symbol && !decl->symbol->pointerExternal)
16184 decl->symbol->pointerExternal = externalDecl;
16185 }
16186 if(propWatch->deleteWatch)
16187 {
16188 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16189
16190 ListAdd(args, CopyExpression(object));
16191 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16192 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16193 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
16194 }
16195 else
16196 {
16197 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
16198 struct Identifier * propID;
16199
16200 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
16201 {
16202 char propName[1024];
16203 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16204
16205 if(prop)
16206 {
16207 char getName[1024], setName[1024];
16208 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16209
16210 DeclareProperty(prop, setName, getName);
16211 strcpy(propName, "__ecereProp_");
16212 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16213 strcat(propName, "_");
16214 FullClassNameCat(propName, prop->name, 0x1);
16215 ListAdd(args, CopyExpression(object));
16216 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16217 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16218 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
16219 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
16220 }
16221 else
16222 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16223 }
16224 }
16225 }
16226 else
16227 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
16228 }
16229 curExternal = external;
16230 curContext = context;
16231 if(watcher)
16232 FreeExpression(watcher);
16233 if(object)
16234 FreeExpression(object);
16235 FreeList(watches, FreePropertyWatch);
16236 }
16237 else
16238 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
16239 }
16240 else
16241 {
16242 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
16243 {
16244 ProcessStatement(propWatch->compound);
16245 }
16246 }
16247 break;
16248 }
16249 case 15:
16250 {
16251 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16252 struct Expression * object = stmt->_watch.object;
16253 struct __ecereNameSpace__ecere__com__Class * _class;
16254
16255 if(object)
16256 ProcessExpressionType(object);
16257 if(inCompiler)
16258 {
16259 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
16260 if(_class)
16261 {
16262 struct Identifier * propID;
16263
16264 stmt->type = 3;
16265 stmt->expressions = MkList();
16266 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
16267 {
16268 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
16269 }
16270 else if(!watches)
16271 {
16272 }
16273 if(watches)
16274 {
16275 for(propID = (*watches).first; propID; propID = propID->next)
16276 {
16277 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16278
16279 if(prop)
16280 {
16281 CreateFireWatcher(prop, object, stmt);
16282 }
16283 else
16284 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
16285 }
16286 }
16287 else
16288 {
16289 struct __ecereNameSpace__ecere__com__Property * prop;
16290 struct __ecereNameSpace__ecere__com__Class * base;
16291
16292 for(base = _class; base; base = base->base)
16293 {
16294 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
16295 {
16296 if(prop->isProperty && prop->isWatchable)
16297 {
16298 CreateFireWatcher(prop, object, stmt);
16299 }
16300 }
16301 }
16302 }
16303 if(object)
16304 FreeExpression(object);
16305 FreeList(watches, FreeIdentifier);
16306 }
16307 else
16308 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16309 }
16310 break;
16311 }
16312 case 16:
16313 {
16314 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
16315 struct Expression * object = stmt->_watch.object;
16316 struct Expression * watcher = stmt->_watch.watcher;
16317 struct __ecereNameSpace__ecere__com__Class * _class;
16318
16319 if(object)
16320 ProcessExpressionType(object);
16321 if(watcher)
16322 ProcessExpressionType(watcher);
16323 if(inCompiler)
16324 {
16325 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
16326 if(watcher || thisClass)
16327 {
16328 if(_class)
16329 {
16330 struct Identifier * propID;
16331
16332 stmt->type = 3;
16333 stmt->expressions = MkList();
16334 if(!watches)
16335 {
16336 struct __ecereNameSpace__ecere__sys__OldList * args;
16337
16338 args = MkList();
16339 ListAdd(args, CopyExpression(object));
16340 ListAdd(args, MkExpConstant("0"));
16341 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16342 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16343 }
16344 else
16345 {
16346 for(propID = (*watches).first; propID; propID = propID->next)
16347 {
16348 char propName[1024];
16349 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
16350
16351 if(prop)
16352 {
16353 char getName[1024], setName[1024];
16354 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
16355
16356 DeclareProperty(prop, setName, getName);
16357 strcpy(propName, "__ecereProp_");
16358 FullClassNameCat(propName, prop->_class->fullName, 0x0);
16359 strcat(propName, "_");
16360 FullClassNameCat(propName, prop->name, 0x1);
16361 MangleClassName(propName);
16362 ListAdd(args, CopyExpression(object));
16363 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
16364 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
16365 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
16366 }
16367 else
16368 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
16369 }
16370 }
16371 if(object)
16372 FreeExpression(object);
16373 if(watcher)
16374 FreeExpression(watcher);
16375 FreeList(watches, FreeIdentifier);
16376 }
16377 else
16378 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
16379 }
16380 else
16381 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
16382 }
16383 break;
16384 }
16385 }
16386 }
16387
16388 extern struct Expression * QBrackets(struct Expression * exp);
16389
16390 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
16391
16392 extern struct Declarator * QMkPtrDecl(char *  id);
16393
16394 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
16395
16396 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
16397
16398 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
16399
16400 static void ProcessFunction(struct FunctionDefinition * function)
16401 {
16402 struct Identifier * id = GetDeclId(function->declarator);
16403 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
16404 struct Type * type = symbol ? symbol->type : (((void *)0));
16405 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
16406 struct Context * oldTopContext = topContext;
16407
16408 yylloc = function->loc;
16409 if(type && type->thisClass)
16410 {
16411 struct Symbol * classSym = type->thisClass;
16412 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
16413 char className[1024];
16414 char structName[1024];
16415 struct Declarator * funcDecl;
16416 struct Symbol * thisSymbol;
16417 unsigned int typedObject = 0x0;
16418
16419 if(_class && !_class->base)
16420 {
16421 _class = currentClass;
16422 if(_class && !_class->symbol)
16423 _class->symbol = FindClass(_class->fullName);
16424 classSym = _class ? _class->symbol : (((void *)0));
16425 typedObject = 0x1;
16426 }
16427 thisClass = _class;
16428 if(inCompiler && _class)
16429 {
16430 if(type->kind == 11)
16431 {
16432 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
16433 {
16434 struct Type * param = symbol->type->params.first;
16435
16436 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
16437 FreeType(param);
16438 }
16439 if(type->classObjectType != 1)
16440 {
16441 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
16442 symbol->type->staticMethod = 0x1;
16443 symbol->type->thisClass = (((void *)0));
16444 symbol->type->extraParam = 0x0;
16445 }
16446 }
16447 strcpy(className, "__ecereClass_");
16448 FullClassNameCat(className, _class->fullName, 0x1);
16449 MangleClassName(className);
16450 structName[0] = (char)0;
16451 FullClassNameCat(structName, _class->fullName, 0x0);
16452 funcDecl = GetFuncDecl(function->declarator);
16453 if(funcDecl)
16454 {
16455 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16456 {
16457 struct TypeName * param = (*funcDecl->function.parameters).first;
16458
16459 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16460 {
16461 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16462 FreeTypeName(param);
16463 }
16464 }
16465 if(!function->propertyNoThis)
16466 {
16467 struct TypeName * thisParam;
16468
16469 if(type->classObjectType != 1)
16470 {
16471 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16472 if(!funcDecl->function.parameters)
16473 funcDecl->function.parameters = MkList();
16474 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16475 }
16476 if(typedObject)
16477 {
16478 if(type->classObjectType != 1)
16479 {
16480 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16481 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16482 }
16483 thisParam = __extension__ ({
16484 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
16485
16486 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
16487 });
16488 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16489 }
16490 }
16491 }
16492 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16493 {
16494 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16495
16496 funcDecl = GetFuncDecl(initDecl->declarator);
16497 if(funcDecl)
16498 {
16499 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16500 {
16501 struct TypeName * param = (*funcDecl->function.parameters).first;
16502
16503 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16504 {
16505 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16506 FreeTypeName(param);
16507 }
16508 }
16509 if(type->classObjectType != 1)
16510 {
16511 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16512 {
16513 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16514
16515 if(!funcDecl->function.parameters)
16516 funcDecl->function.parameters = MkList();
16517 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16518 }
16519 }
16520 }
16521 }
16522 }
16523 if(function->body)
16524 {
16525 if(type->classObjectType != 1)
16526 {
16527 thisSymbol = __extension__ ({
16528 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16529
16530 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
16531 });
16532 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16533 if(typedObject && thisSymbol->type)
16534 {
16535 thisSymbol->type->classObjectType = 2;
16536 thisSymbol->type->byReference = type->byReference;
16537 thisSymbol->type->typedByReference = type->byReference;
16538 }
16539 }
16540 }
16541 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16542 {
16543 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16544
16545 {
16546 struct __ecereNameSpace__ecere__com__Class * base;
16547
16548 for(base = _class; base && base->type != 1000; base = base->next)
16549 {
16550 for(member = base->membersAndProperties.first; member; member = member->next)
16551 if(!member->isProperty)
16552 break;
16553 if(member)
16554 break;
16555 }
16556 }
16557 for(member = _class->membersAndProperties.first; member; member = member->next)
16558 if(!member->isProperty)
16559 break;
16560 if(member)
16561 {
16562 char pointerName[1024];
16563 struct Declaration * decl;
16564 struct Initializer * initializer;
16565 struct Expression * exp, * bytePtr;
16566
16567 strcpy(pointerName, "__ecerePointer_");
16568 FullClassNameCat(pointerName, _class->fullName, 0x0);
16569 {
16570 char className[1024];
16571
16572 strcpy(className, "__ecereClass_");
16573 FullClassNameCat(className, classSym->string, 0x1);
16574 MangleClassName(className);
16575 DeclareClass(classSym, className);
16576 }
16577 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16578 if(_class->fixed)
16579 {
16580 char string[256];
16581
16582 sprintf(string, "%d", _class->offset);
16583 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16584 }
16585 else
16586 {
16587 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16588 }
16589 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16590 exp->expType = __extension__ ({
16591 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16592
16593 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
16594 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16595
16596 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
16597 }), __ecereInstance2;
16598 });
16599 if(function->body)
16600 {
16601 yylloc = function->body->loc;
16602 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16603 {
16604 struct Context * prevContext = curContext;
16605
16606 curContext = function->body->compound.context;
16607 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16608 curContext = prevContext;
16609 }
16610 decl->symbol = (((void *)0));
16611 if(!function->body->compound.declarations)
16612 function->body->compound.declarations = MkList();
16613 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16614 }
16615 }
16616 }
16617 }
16618 else
16619 thisClass = (((void *)0));
16620 if(id)
16621 {
16622 FreeSpecifier(id->_class);
16623 id->_class = (((void *)0));
16624 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16625 {
16626 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16627
16628 id = GetDeclId(initDecl->declarator);
16629 FreeSpecifier(id->_class);
16630 id->_class = (((void *)0));
16631 }
16632 }
16633 if(function->body)
16634 topContext = function->body->compound.context;
16635 {
16636 struct FunctionDefinition * oldFunction = curFunction;
16637
16638 curFunction = function;
16639 if(function->body)
16640 ProcessStatement(function->body);
16641 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16642 {
16643 struct Statement * prevCompound = curCompound;
16644 struct Context * prevContext = curContext;
16645 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16646
16647 if(!function->body->compound.statements)
16648 function->body->compound.statements = MkList();
16649 ListAdd(function->body->compound.statements, fireWatchers);
16650 curCompound = function->body;
16651 curContext = function->body->compound.context;
16652 ProcessStatement(fireWatchers);
16653 curContext = prevContext;
16654 curCompound = prevCompound;
16655 }
16656 curFunction = oldFunction;
16657 }
16658 if(function->declarator)
16659 {
16660 ProcessDeclarator(function->declarator);
16661 }
16662 topContext = oldTopContext;
16663 thisClass = oldThisClass;
16664 }
16665
16666 extern void FreeSymbol(struct Symbol * symbol);
16667
16668 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16669
16670 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16671 {
16672 struct ClassDef * def;
16673 struct External * external = curExternal;
16674 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16675
16676 for(def = definitions->first; def; def = def->next)
16677 {
16678 if(def->type == 0)
16679 {
16680 if(def->function->declarator)
16681 curExternal = def->function->declarator->symbol->pointerExternal;
16682 else
16683 curExternal = external;
16684 ProcessFunction((struct FunctionDefinition *)def->function);
16685 }
16686 else if(def->type == 2)
16687 {
16688 if(def->decl->type == 2)
16689 {
16690 thisClass = regClass;
16691 ProcessInstantiationType(def->decl->inst);
16692 thisClass = (((void *)0));
16693 }
16694 else
16695 {
16696 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16697
16698 if(regClass)
16699 thisClass = regClass;
16700 ProcessDeclaration(def->decl);
16701 thisClass = backThisClass;
16702 }
16703 }
16704 else if(def->type == 1 && def->defProperties)
16705 {
16706 struct MemberInit * defProperty;
16707 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);
16708
16709 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16710 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16711 {
16712 thisClass = regClass;
16713 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16714 thisClass = (((void *)0));
16715 }
16716 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16717 FreeSymbol(thisSymbol);
16718 }
16719 else if(def->type == 3 && def->propertyDef)
16720 {
16721 struct PropertyDef * prop = def->propertyDef;
16722
16723 thisClass = regClass;
16724 if(prop->setStmt)
16725 {
16726 if(regClass)
16727 {
16728 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16729
16730 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16731 }
16732 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16733 ProcessStatement(prop->setStmt);
16734 }
16735 if(prop->getStmt)
16736 {
16737 if(regClass)
16738 {
16739 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16740
16741 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16742 }
16743 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16744 ProcessStatement(prop->getStmt);
16745 }
16746 if(prop->issetStmt)
16747 {
16748 if(regClass)
16749 {
16750 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16751
16752 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16753 }
16754 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16755 ProcessStatement(prop->issetStmt);
16756 }
16757 thisClass = (((void *)0));
16758 }
16759 else if(def->type == 4 && def->propertyWatch)
16760 {
16761 struct PropertyWatch * propertyWatch = def->propertyWatch;
16762
16763 thisClass = regClass;
16764 if(propertyWatch->compound)
16765 {
16766 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);
16767
16768 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16769 curExternal = (((void *)0));
16770 ProcessStatement(propertyWatch->compound);
16771 }
16772 thisClass = (((void *)0));
16773 }
16774 }
16775 }
16776
16777 void DeclareFunctionUtil(char * s)
16778 {
16779 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16780
16781 if(function)
16782 {
16783 char name[1024];
16784
16785 name[0] = (char)0;
16786 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16787 strcpy(name, "__ecereFunction_");
16788 FullClassNameCat(name, s, 0x0);
16789 DeclareFunction(function, name);
16790 }
16791 }
16792
16793 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16794
16795 void ComputeDataTypes()
16796 {
16797 struct External * external;
16798 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16799 struct External * after = (((void *)0));
16800
16801 currentClass = (((void *)0));
16802 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16803 for(external = (*ast).first; external; external = external->next)
16804 {
16805 if(external->type == 1)
16806 {
16807 struct Declaration * decl = external->declaration;
16808
16809 if(decl)
16810 {
16811 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
16812
16813 if(decls)
16814 {
16815 struct InitDeclarator * initDecl = (*decls).first;
16816
16817 if(initDecl)
16818 {
16819 struct Declarator * declarator = initDecl->declarator;
16820
16821 if(declarator && declarator->type == 1)
16822 {
16823 struct Identifier * id = declarator->identifier;
16824
16825 if(id && id->string)
16826 {
16827 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
16828 {
16829 external->symbol->id = -1001, external->symbol->idCode = -1001;
16830 after = external;
16831 }
16832 }
16833 }
16834 }
16835 }
16836 }
16837 }
16838 }
16839 temp->symbol = __extension__ ({
16840 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
16841
16842 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
16843 });
16844 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
16845 curExternal = temp;
16846 DeclareFunctionUtil("eSystem_New");
16847 DeclareFunctionUtil("eSystem_New0");
16848 DeclareFunctionUtil("eSystem_Renew");
16849 DeclareFunctionUtil("eSystem_Renew0");
16850 DeclareFunctionUtil("eClass_GetProperty");
16851 DeclareStruct("ecere::com::Class", 0x0);
16852 DeclareStruct("ecere::com::Instance", 0x0);
16853 DeclareStruct("ecere::com::Property", 0x0);
16854 DeclareStruct("ecere::com::DataMember", 0x0);
16855 DeclareStruct("ecere::com::Method", 0x0);
16856 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16857 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16858 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16859 for(external = (*ast).first; external; external = external->next)
16860 {
16861 afterExternal = curExternal = external;
16862 if(external->type == 0)
16863 {
16864 currentClass = external->function->_class;
16865 ProcessFunction(external->function);
16866 }
16867 else if(external->type == 1)
16868 {
16869 currentClass = (((void *)0));
16870 ProcessDeclaration(external->declaration);
16871 }
16872 else if(external->type == 2)
16873 {
16874 struct ClassDefinition * _class = external->_class;
16875
16876 currentClass = external->symbol->registered;
16877 if(_class->definitions)
16878 {
16879 ProcessClass(_class->definitions, _class->symbol);
16880 }
16881 if(inCompiler)
16882 {
16883 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16884 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16885 }
16886 }
16887 else if(external->type == 4)
16888 {
16889 thisNameSpace = external->id->string;
16890 }
16891 }
16892 currentClass = (((void *)0));
16893 thisNameSpace = (((void *)0));
16894 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16895 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16896 }
16897
16898 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);
16899
16900 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16901
16902 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16903 {
16904 struct __ecereNameSpace__ecere__com__Class * class;
16905
16906 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16907 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16908 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16909 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16910 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16911 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16912 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16913 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16914 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16915 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16916 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16917 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16918 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16919 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16920 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16921 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16922 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16923 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16924 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16925 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16926 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16927 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16928 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16929 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16930 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
16931 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
16932 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16933 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16934 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16935 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16936 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16937 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16938 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16939 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16940 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16941 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("AddMembers", "int AddMembers(ecere::sys::OldList * declarations, ecere::com::Class _class, bool isMember, uint * retSize, ecere::com::Class topClass, bool * addedPadding)", AddMembers, module, 2);
16942 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16943 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16944 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16945 __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);
16946 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16947 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16948 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16949 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16950 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16951 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16952 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16953 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16954 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16955 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16956 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16957 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16958 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16959 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
16960 __ecereClass_Conversion = class;
16961 __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);
16962 __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);
16963 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16964 __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);
16965 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16966 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16967 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16968 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16969 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16970 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16971 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16972 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16973 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16974 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16975 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
16976 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16977 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16978 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16979 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16980 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16981 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16982 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16983 }
16984
16985 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16986 {
16987
16988 }
16989