compiler: Updated bootstrap, precompiled parsers and i18n templates
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 #if defined(__GNUC__)
2 typedef long long int64;
3 typedef unsigned long long uint64;
4 #ifndef _WIN32
5 #define __declspec(x)
6 #endif
7 #elif defined(__TINYC__)
8 #include <stdarg.h>
9 #define __builtin_va_list va_list
10 #define __builtin_va_start va_start
11 #define __builtin_va_end va_end
12 #ifdef _WIN32
13 #define strcasecmp stricmp
14 #define strncasecmp strnicmp
15 #define __declspec(x) __attribute__((x))
16 #else
17 #define __declspec(x)
18 #endif
19 typedef long long int64;
20 typedef unsigned long long uint64;
21 #else
22 typedef __int64 int64;
23 typedef unsigned __int64 uint64;
24 #endif
25 #ifdef __BIG_ENDIAN__
26 #define __ENDIAN_PAD(x) (8 - (x))
27 #else
28 #define __ENDIAN_PAD(x) 0
29 #endif
30 #ifdef __MINGW32__
31 #ifdef _WIN64
32 typedef unsigned long long int uintptr_t;
33 typedef long long int intptr_t;
34 #else
35 typedef unsigned int uintptr_t;
36 typedef int intptr_t;
37 #endif
38 #else
39 #include <stdint.h>
40 #endif
41 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
42
43 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
44
45 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
46
47 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
48
49 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
50
51 struct __ecereNameSpace__ecere__sys__BTNode;
52
53 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
54
55 struct __ecereNameSpace__ecere__sys__BinaryTree
56 {
57 struct __ecereNameSpace__ecere__sys__BTNode * root;
58 int count;
59 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
60 void (*  FreeKey)(void *  key);
61 } __attribute__ ((gcc_struct));
62
63 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
64
65 struct __ecereNameSpace__ecere__sys__OldList
66 {
67 void *  first;
68 void *  last;
69 int count;
70 unsigned int offset;
71 unsigned int circ;
72 } __attribute__ ((gcc_struct));
73
74 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
75
76 struct __ecereNameSpace__ecere__com__Method
77 {
78 char *  name;
79 struct __ecereNameSpace__ecere__com__Method * parent;
80 struct __ecereNameSpace__ecere__com__Method * left;
81 struct __ecereNameSpace__ecere__com__Method * right;
82 int depth;
83 int (*  function)();
84 int vid;
85 int type;
86 struct __ecereNameSpace__ecere__com__Class * _class;
87 void *  symbol;
88 char *  dataTypeString;
89 struct Type * dataType;
90 int memberAccess;
91 } __attribute__ ((gcc_struct));
92
93 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
94
95 struct __ecereNameSpace__ecere__com__Property
96 {
97 struct __ecereNameSpace__ecere__com__Property * prev;
98 struct __ecereNameSpace__ecere__com__Property * next;
99 char *  name;
100 unsigned int isProperty;
101 int memberAccess;
102 int id;
103 struct __ecereNameSpace__ecere__com__Class * _class;
104 char *  dataTypeString;
105 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
106 struct Type * dataType;
107 void (*  Set)();
108 int (*  Get)();
109 unsigned int (*  IsSet)();
110 void *  data;
111 void *  symbol;
112 int vid;
113 unsigned int conversion;
114 unsigned int watcherOffset;
115 char *  category;
116 unsigned int compiled;
117 unsigned int selfWatchable;
118 unsigned int isWatchable;
119 } __attribute__ ((gcc_struct));
120
121 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
122
123 struct CodePosition
124 {
125 int line;
126 int charPos;
127 int pos;
128 unsigned int included;
129 } __attribute__ ((gcc_struct));
130
131 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
132
133 struct Location
134 {
135 struct CodePosition start;
136 struct CodePosition end;
137 } __attribute__ ((gcc_struct));
138
139 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
140
141 struct Attrib;
142
143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
144
145 struct ExtDecl
146 {
147 struct Location loc;
148 int type;
149 union
150 {
151 char * s;
152 struct Attrib * attr;
153 } __attribute__ ((gcc_struct));
154 } __attribute__ ((gcc_struct));
155
156 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
157
158 struct ClassDefinition
159 {
160 struct ClassDefinition * prev;
161 struct ClassDefinition * next;
162 struct Location loc;
163 struct Specifier * _class;
164 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
165 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
166 struct Symbol * symbol;
167 struct Location blockStart;
168 struct Location nameLoc;
169 int endid;
170 int declMode;
171 unsigned int deleteWatchable;
172 } __attribute__ ((gcc_struct));
173
174 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
175
176 struct Context
177 {
178 struct Context * parent;
179 struct __ecereNameSpace__ecere__sys__BinaryTree types;
180 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
181 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
182 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
183 int nextID;
184 int simpleID;
185 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
186 struct ClassDefinition * classDef;
187 unsigned int templateTypesOnly;
188 unsigned int hasNameSpace;
189 } __attribute__ ((gcc_struct));
190
191 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
192
193 struct Instantiation
194 {
195 struct Instantiation * prev;
196 struct Instantiation * next;
197 struct Location loc;
198 struct Specifier * _class;
199 struct Expression * exp;
200 struct __ecereNameSpace__ecere__sys__OldList *  members;
201 struct Symbol * symbol;
202 unsigned int fullSet;
203 unsigned int isConstant;
204 unsigned char *  data;
205 struct Location nameLoc;
206 struct Location insideLoc;
207 unsigned int built;
208 } __attribute__ ((gcc_struct));
209
210 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
211
212 struct Declaration
213 {
214 struct Declaration * prev;
215 struct Declaration * next;
216 struct Location loc;
217 int type;
218 union
219 {
220 struct
221 {
222 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
223 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
224 } __attribute__ ((gcc_struct));
225 struct Instantiation * inst;
226 struct
227 {
228 struct Identifier * id;
229 struct Expression * exp;
230 } __attribute__ ((gcc_struct));
231 } __attribute__ ((gcc_struct));
232 struct Specifier * extStorage;
233 struct Symbol * symbol;
234 int declMode;
235 } __attribute__ ((gcc_struct));
236
237 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
238
239 struct Statement
240 {
241 struct Statement * prev;
242 struct Statement * next;
243 struct Location loc;
244 int type;
245 union
246 {
247 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
248 struct
249 {
250 struct Identifier * id;
251 struct Statement * stmt;
252 } __attribute__ ((gcc_struct)) labeled;
253 struct
254 {
255 struct Expression * exp;
256 struct Statement * stmt;
257 } __attribute__ ((gcc_struct)) caseStmt;
258 struct
259 {
260 struct __ecereNameSpace__ecere__sys__OldList * declarations;
261 struct __ecereNameSpace__ecere__sys__OldList * statements;
262 struct Context * context;
263 unsigned int isSwitch;
264 } __attribute__ ((gcc_struct)) compound;
265 struct
266 {
267 struct __ecereNameSpace__ecere__sys__OldList * exp;
268 struct Statement * stmt;
269 struct Statement * elseStmt;
270 } __attribute__ ((gcc_struct)) ifStmt;
271 struct
272 {
273 struct __ecereNameSpace__ecere__sys__OldList * exp;
274 struct Statement * stmt;
275 } __attribute__ ((gcc_struct)) switchStmt;
276 struct
277 {
278 struct __ecereNameSpace__ecere__sys__OldList * exp;
279 struct Statement * stmt;
280 } __attribute__ ((gcc_struct)) whileStmt;
281 struct
282 {
283 struct __ecereNameSpace__ecere__sys__OldList * exp;
284 struct Statement * stmt;
285 } __attribute__ ((gcc_struct)) doWhile;
286 struct
287 {
288 struct Statement * init;
289 struct Statement * check;
290 struct __ecereNameSpace__ecere__sys__OldList * increment;
291 struct Statement * stmt;
292 } __attribute__ ((gcc_struct)) forStmt;
293 struct
294 {
295 struct Identifier * id;
296 } __attribute__ ((gcc_struct)) gotoStmt;
297 struct
298 {
299 struct Specifier * spec;
300 char * statements;
301 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
302 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
303 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
304 } __attribute__ ((gcc_struct)) asmStmt;
305 struct
306 {
307 struct Expression * watcher;
308 struct Expression * object;
309 struct __ecereNameSpace__ecere__sys__OldList * watches;
310 } __attribute__ ((gcc_struct)) _watch;
311 struct
312 {
313 struct Identifier * id;
314 struct __ecereNameSpace__ecere__sys__OldList * exp;
315 struct __ecereNameSpace__ecere__sys__OldList * filter;
316 struct Statement * stmt;
317 } __attribute__ ((gcc_struct)) forEachStmt;
318 struct Declaration * decl;
319 } __attribute__ ((gcc_struct));
320 } __attribute__ ((gcc_struct));
321
322 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
323
324 struct TypeName
325 {
326 struct TypeName * prev;
327 struct TypeName * next;
328 struct Location loc;
329 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
330 struct Declarator * declarator;
331 int classObjectType;
332 struct Expression * bitCount;
333 } __attribute__ ((gcc_struct));
334
335 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
336
337 struct Initializer
338 {
339 struct Initializer * prev;
340 struct Initializer * next;
341 struct Location loc;
342 int type;
343 union
344 {
345 struct Expression * exp;
346 struct __ecereNameSpace__ecere__sys__OldList *  list;
347 } __attribute__ ((gcc_struct));
348 unsigned int isConstant;
349 } __attribute__ ((gcc_struct));
350
351 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
352
353 struct __ecereNameSpace__ecere__com__DataValue
354 {
355 union
356 {
357 char c;
358 unsigned char uc;
359 short s;
360 unsigned short us;
361 int i;
362 unsigned int ui;
363 void *  p;
364 float f;
365 double d;
366 long long i64;
367 uint64 ui64;
368 } __attribute__ ((gcc_struct));
369 } __attribute__ ((gcc_struct));
370
371 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
372
373 struct Expression
374 {
375 struct Expression * prev;
376 struct Expression * next;
377 struct Location loc;
378 int type;
379 union
380 {
381 struct
382 {
383 char *  constant;
384 struct Identifier * identifier;
385 } __attribute__ ((gcc_struct));
386 struct Statement * compound;
387 struct Instantiation * instance;
388 char *  string;
389 struct __ecereNameSpace__ecere__sys__OldList *  list;
390 struct
391 {
392 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
393 struct Declarator * decl;
394 } __attribute__ ((gcc_struct)) _classExp;
395 struct
396 {
397 struct Identifier * id;
398 } __attribute__ ((gcc_struct)) classData;
399 struct
400 {
401 struct Expression * exp;
402 struct __ecereNameSpace__ecere__sys__OldList * arguments;
403 struct Location argLoc;
404 } __attribute__ ((gcc_struct)) call;
405 struct
406 {
407 struct Expression * exp;
408 struct __ecereNameSpace__ecere__sys__OldList * index;
409 } __attribute__ ((gcc_struct)) index;
410 struct
411 {
412 struct Expression * exp;
413 struct Identifier * member;
414 int memberType;
415 unsigned int thisPtr;
416 } __attribute__ ((gcc_struct)) member;
417 struct
418 {
419 int op;
420 struct Expression * exp1;
421 struct Expression * exp2;
422 } __attribute__ ((gcc_struct)) op;
423 struct TypeName * typeName;
424 struct Specifier * _class;
425 struct
426 {
427 struct TypeName * typeName;
428 struct Expression * exp;
429 } __attribute__ ((gcc_struct)) cast;
430 struct
431 {
432 struct Expression * cond;
433 struct __ecereNameSpace__ecere__sys__OldList * exp;
434 struct Expression * elseExp;
435 } __attribute__ ((gcc_struct)) cond;
436 struct
437 {
438 struct TypeName * typeName;
439 struct Expression * size;
440 } __attribute__ ((gcc_struct)) _new;
441 struct
442 {
443 struct TypeName * typeName;
444 struct Expression * size;
445 struct Expression * exp;
446 } __attribute__ ((gcc_struct)) _renew;
447 struct
448 {
449 char * table;
450 struct Identifier * id;
451 } __attribute__ ((gcc_struct)) db;
452 struct
453 {
454 struct Expression * ds;
455 struct Expression * name;
456 } __attribute__ ((gcc_struct)) dbopen;
457 struct
458 {
459 struct TypeName * typeName;
460 struct Initializer * initializer;
461 } __attribute__ ((gcc_struct)) initializer;
462 struct
463 {
464 struct Expression * exp;
465 struct TypeName * typeName;
466 } __attribute__ ((gcc_struct)) vaArg;
467 } __attribute__ ((gcc_struct));
468 unsigned int debugValue;
469 struct __ecereNameSpace__ecere__com__DataValue val;
470 unsigned int address;
471 unsigned int hasAddress;
472 struct Type * expType;
473 struct Type * destType;
474 unsigned int usage;
475 int tempCount;
476 unsigned int byReference;
477 unsigned int isConstant;
478 unsigned int addedThis;
479 unsigned int needCast;
480 unsigned int thisPtr;
481 } __attribute__ ((gcc_struct));
482
483 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
484
485 struct TemplateDatatype
486 {
487 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
488 struct Declarator * decl;
489 } __attribute__ ((gcc_struct));
490
491 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
492
493 struct TemplateArgument;
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
496
497 struct TemplateParameter
498 {
499 struct TemplateParameter * prev;
500 struct TemplateParameter * next;
501 struct Location loc;
502 int type;
503 struct Identifier * identifier;
504 union
505 {
506 struct TemplateDatatype * dataType;
507 int memberType;
508 } __attribute__ ((gcc_struct));
509 struct TemplateArgument * defaultArgument;
510 char *  dataTypeString;
511 struct Type * baseType;
512 } __attribute__ ((gcc_struct));
513
514 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
515
516 struct Specifier
517 {
518 struct Specifier * prev;
519 struct Specifier * next;
520 struct Location loc;
521 int type;
522 union
523 {
524 int specifier;
525 struct
526 {
527 struct ExtDecl * extDecl;
528 char *  name;
529 struct Symbol * symbol;
530 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
531 } __attribute__ ((gcc_struct));
532 struct
533 {
534 struct Identifier * id;
535 struct __ecereNameSpace__ecere__sys__OldList *  list;
536 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
537 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
538 unsigned int addNameSpace;
539 struct Context * ctx;
540 struct ExtDecl * extDeclStruct;
541 } __attribute__ ((gcc_struct));
542 struct Expression * expression;
543 struct Specifier * _class;
544 struct TemplateParameter * templateParameter;
545 } __attribute__ ((gcc_struct));
546 } __attribute__ ((gcc_struct));
547
548 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
549
550 struct Identifier
551 {
552 struct Identifier * prev;
553 struct Identifier * next;
554 struct Location loc;
555 struct Symbol * classSym;
556 struct Specifier * _class;
557 char *  string;
558 struct Identifier * badID;
559 } __attribute__ ((gcc_struct));
560
561 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
562
563 struct Pointer;
564
565 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
566
567 struct Declarator
568 {
569 struct Declarator * prev;
570 struct Declarator * next;
571 struct Location loc;
572 int type;
573 struct Symbol * symbol;
574 struct Declarator * declarator;
575 union
576 {
577 struct Identifier * identifier;
578 struct
579 {
580 struct Expression * exp;
581 struct Expression * posExp;
582 struct Attrib * attrib;
583 } __attribute__ ((gcc_struct)) structDecl;
584 struct
585 {
586 struct Expression * exp;
587 struct Specifier * enumClass;
588 } __attribute__ ((gcc_struct)) array;
589 struct
590 {
591 struct __ecereNameSpace__ecere__sys__OldList * parameters;
592 } __attribute__ ((gcc_struct)) function;
593 struct
594 {
595 struct Pointer * pointer;
596 } __attribute__ ((gcc_struct)) pointer;
597 struct
598 {
599 struct ExtDecl * extended;
600 } __attribute__ ((gcc_struct)) extended;
601 } __attribute__ ((gcc_struct));
602 } __attribute__ ((gcc_struct));
603
604 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
605
606 struct FunctionDefinition
607 {
608 struct FunctionDefinition * prev;
609 struct FunctionDefinition * next;
610 struct Location loc;
611 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
612 struct Declarator * declarator;
613 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
614 struct Statement * body;
615 struct __ecereNameSpace__ecere__com__Class * _class;
616 struct __ecereNameSpace__ecere__sys__OldList attached;
617 int declMode;
618 struct Type * type;
619 struct Symbol * propSet;
620 int tempCount;
621 unsigned int propertyNoThis;
622 } __attribute__ ((gcc_struct));
623
624 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
625
626 struct DBTableDef;
627
628 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
629
630 struct External
631 {
632 struct External * prev;
633 struct External * next;
634 struct Location loc;
635 int type;
636 struct Symbol * symbol;
637 union
638 {
639 struct FunctionDefinition * function;
640 struct ClassDefinition * _class;
641 struct Declaration * declaration;
642 char *  importString;
643 struct Identifier * id;
644 struct DBTableDef * table;
645 } __attribute__ ((gcc_struct));
646 int importType;
647 } __attribute__ ((gcc_struct));
648
649 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
650
651 struct ModuleImport
652 {
653 struct ModuleImport * prev;
654 struct ModuleImport * next;
655 char *  name;
656 struct __ecereNameSpace__ecere__sys__OldList classes;
657 struct __ecereNameSpace__ecere__sys__OldList functions;
658 int importType;
659 int importAccess;
660 } __attribute__ ((gcc_struct));
661
662 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
663
664 struct ClassImport
665 {
666 struct ClassImport * prev;
667 struct ClassImport * next;
668 char *  name;
669 struct __ecereNameSpace__ecere__sys__OldList methods;
670 struct __ecereNameSpace__ecere__sys__OldList properties;
671 unsigned int itself;
672 unsigned int isRemote;
673 } __attribute__ ((gcc_struct));
674
675 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
676
677 struct Symbol
678 {
679 char *  string;
680 struct Symbol * parent;
681 struct Symbol * left;
682 struct Symbol * right;
683 int depth;
684 struct Type * type;
685 union
686 {
687 struct __ecereNameSpace__ecere__com__Method * method;
688 struct __ecereNameSpace__ecere__com__Property * _property;
689 struct __ecereNameSpace__ecere__com__Class * registered;
690 } __attribute__ ((gcc_struct));
691 int id;
692 int idCode;
693 union
694 {
695 struct
696 {
697 struct External * pointerExternal;
698 struct External * structExternal;
699 } __attribute__ ((gcc_struct));
700 struct
701 {
702 struct External * externalGet;
703 struct External * externalSet;
704 struct External * externalPtr;
705 struct External * externalIsSet;
706 } __attribute__ ((gcc_struct));
707 struct
708 {
709 struct External * methodExternal;
710 struct External * methodCodeExternal;
711 } __attribute__ ((gcc_struct));
712 } __attribute__ ((gcc_struct));
713 unsigned int imported;
714 unsigned int declaredStructSym;
715 struct __ecereNameSpace__ecere__com__Class * _class;
716 unsigned int declaredStruct;
717 unsigned int needConstructor;
718 unsigned int needDestructor;
719 char *  constructorName;
720 char *  structName;
721 char *  className;
722 char *  destructorName;
723 struct ModuleImport * module;
724 struct ClassImport * _import;
725 struct Location nameLoc;
726 unsigned int isParam;
727 unsigned int isRemote;
728 unsigned int isStruct;
729 unsigned int fireWatchersDone;
730 int declaring;
731 unsigned int classData;
732 unsigned int isStatic;
733 char *  shortName;
734 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
735 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
736 struct Context * ctx;
737 int isIterator;
738 struct Expression * propCategory;
739 } __attribute__ ((gcc_struct));
740
741 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
742
743 struct Type
744 {
745 struct Type * prev;
746 struct Type * next;
747 int refCount;
748 union
749 {
750 struct Symbol * _class;
751 struct
752 {
753 struct __ecereNameSpace__ecere__sys__OldList members;
754 char *  enumName;
755 } __attribute__ ((gcc_struct));
756 struct
757 {
758 struct Type * returnType;
759 struct __ecereNameSpace__ecere__sys__OldList params;
760 struct Symbol * thisClass;
761 unsigned int staticMethod;
762 struct TemplateParameter * thisClassTemplate;
763 } __attribute__ ((gcc_struct));
764 struct
765 {
766 struct __ecereNameSpace__ecere__com__Method * method;
767 struct __ecereNameSpace__ecere__com__Class * methodClass;
768 struct __ecereNameSpace__ecere__com__Class * usedClass;
769 } __attribute__ ((gcc_struct));
770 struct
771 {
772 struct Type * arrayType;
773 int arraySize;
774 struct Expression * arraySizeExp;
775 unsigned int freeExp;
776 struct Symbol * enumClass;
777 } __attribute__ ((gcc_struct));
778 struct Type * type;
779 struct TemplateParameter * templateParameter;
780 } __attribute__ ((gcc_struct));
781 unsigned int isSigned;
782 int kind;
783 unsigned int constant;
784 unsigned int size;
785 char *  name;
786 char *  typeName;
787 unsigned int count;
788 unsigned int truth;
789 int classObjectType;
790 unsigned int byReference;
791 unsigned int extraParam;
792 int alignment;
793 unsigned int directClassAccess;
794 unsigned int computing;
795 unsigned int dllExport;
796 unsigned int offset;
797 unsigned int keepCast;
798 unsigned int passAsTemplate;
799 int bitFieldCount;
800 } __attribute__ ((gcc_struct));
801
802 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
803
804 struct __ecereNameSpace__ecere__com__Class
805 {
806 struct __ecereNameSpace__ecere__com__Class * prev;
807 struct __ecereNameSpace__ecere__com__Class * next;
808 char *  name;
809 int offset;
810 int structSize;
811 int (* *  _vTbl)();
812 int vTblSize;
813 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
814 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
815 int offsetClass;
816 int sizeClass;
817 struct __ecereNameSpace__ecere__com__Class * base;
818 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
819 struct __ecereNameSpace__ecere__sys__BinaryTree members;
820 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
821 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
822 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
823 struct __ecereNameSpace__ecere__sys__OldList derivatives;
824 int memberID;
825 int startMemberID;
826 int type;
827 struct __ecereNameSpace__ecere__com__Instance * module;
828 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
829 char *  dataTypeString;
830 struct Type * dataType;
831 int typeSize;
832 int defaultAlignment;
833 void (*  Initialize)();
834 int memberOffset;
835 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
836 char *  designerClass;
837 unsigned int noExpansion;
838 char *  defaultProperty;
839 unsigned int comRedefinition;
840 int count;
841 unsigned int isRemote;
842 unsigned int internalDecl;
843 void *  data;
844 unsigned int computeSize;
845 int structAlignment;
846 int destructionWatchOffset;
847 unsigned int fixed;
848 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
849 int inheritanceAccess;
850 char *  fullName;
851 void *  symbol;
852 struct __ecereNameSpace__ecere__sys__OldList conversions;
853 struct __ecereNameSpace__ecere__sys__OldList templateParams;
854 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
855 struct __ecereNameSpace__ecere__com__Class * templateClass;
856 struct __ecereNameSpace__ecere__sys__OldList templatized;
857 int numParams;
858 } __attribute__ ((gcc_struct));
859
860 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
861
862 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
863
864 struct __ecereNameSpace__ecere__com__Instance
865 {
866 int (* *  _vTbl)();
867 struct __ecereNameSpace__ecere__com__Class * _class;
868 int _refCount;
869 } __attribute__ ((gcc_struct));
870
871 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
872
873 struct __ecereNameSpace__ecere__com__DataMember
874 {
875 struct __ecereNameSpace__ecere__com__DataMember * prev;
876 struct __ecereNameSpace__ecere__com__DataMember * next;
877 char *  name;
878 unsigned int isProperty;
879 int memberAccess;
880 int id;
881 struct __ecereNameSpace__ecere__com__Class * _class;
882 char *  dataTypeString;
883 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
884 struct Type * dataType;
885 int type;
886 int offset;
887 int memberID;
888 struct __ecereNameSpace__ecere__sys__OldList members;
889 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
890 int memberOffset;
891 int structAlignment;
892 } __attribute__ ((gcc_struct));
893
894 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
895
896 struct __ecereNameSpace__ecere__com__SerialBuffer
897 {
898 unsigned char *  _buffer;
899 unsigned int count;
900 unsigned int _size;
901 unsigned int pos;
902 } __attribute__ ((gcc_struct));
903
904 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
905
906 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
907 {
908 union
909 {
910 struct
911 {
912 char *  dataTypeString;
913 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
914 } __attribute__ ((gcc_struct));
915 struct __ecereNameSpace__ecere__com__DataValue expression;
916 struct
917 {
918 char *  memberString;
919 union
920 {
921 struct __ecereNameSpace__ecere__com__DataMember * member;
922 struct __ecereNameSpace__ecere__com__Property * prop;
923 struct __ecereNameSpace__ecere__com__Method * method;
924 } __attribute__ ((gcc_struct));
925 } __attribute__ ((gcc_struct));
926 } __attribute__ ((gcc_struct));
927 } __attribute__ ((gcc_struct));
928
929 typedef unsigned int size_t;
930
931 void exit(int status);
932
933 void * calloc(size_t nmemb, size_t size);
934
935 void free(void * ptr);
936
937 void * malloc(size_t size);
938
939 void * realloc(void * ptr, size_t size);
940
941 long int strtol(const char * nptr, char ** endptr, int base);
942
943 long long int strtoll(const char * nptr, char ** endptr, int base);
944
945 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
946
947 enum yytokentype
948 {
949 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
950 };
951
952 typedef union YYSTYPE
953 {
954 int specifierType;
955 int i;
956 int declMode;
957 struct Identifier * id;
958 struct Expression * exp;
959 struct Specifier * specifier;
960 struct __ecereNameSpace__ecere__sys__OldList * list;
961 struct Enumerator * enumerator;
962 struct Declarator * declarator;
963 struct Pointer * pointer;
964 struct Initializer * initializer;
965 struct InitDeclarator * initDeclarator;
966 struct TypeName * typeName;
967 struct Declaration * declaration;
968 struct Statement * stmt;
969 struct FunctionDefinition * function;
970 struct External * external;
971 struct Context * context;
972 struct AsmField * asmField;
973 struct Attrib * attrib;
974 struct ExtDecl * extDecl;
975 struct Attribute * attribute;
976 struct Instantiation * instance;
977 struct MembersInit * membersInit;
978 struct MemberInit * memberInit;
979 struct ClassFunction * classFunction;
980 struct ClassDefinition * _class;
981 struct ClassDef * classDef;
982 struct PropertyDef * prop;
983 char * string;
984 struct Symbol * symbol;
985 struct PropertyWatch * propertyWatch;
986 struct TemplateParameter * templateParameter;
987 struct TemplateArgument * templateArgument;
988 struct TemplateDatatype * templateDatatype;
989 struct DBTableEntry * dbtableEntry;
990 struct DBIndexItem * dbindexItem;
991 struct DBTableDef * dbtableDef;
992 } __attribute__ ((gcc_struct)) YYSTYPE;
993
994 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
995
996 struct Enumerator
997 {
998 struct Enumerator * prev;
999 struct Enumerator * next;
1000 struct Location loc;
1001 struct Identifier * id;
1002 struct Expression * exp;
1003 } __attribute__ ((gcc_struct));
1004
1005 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1006
1007 struct InitDeclarator
1008 {
1009 struct InitDeclarator * prev;
1010 struct InitDeclarator * next;
1011 struct Location loc;
1012 struct Declarator * declarator;
1013 struct Initializer * initializer;
1014 } __attribute__ ((gcc_struct));
1015
1016 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1017
1018 struct AsmField
1019 {
1020 struct AsmField * prev;
1021 struct AsmField * next;
1022 struct Location loc;
1023 char *  command;
1024 struct Expression * expression;
1025 } __attribute__ ((gcc_struct));
1026
1027 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1028
1029 struct Attribute;
1030
1031 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1032
1033 struct ClassFunction
1034 {
1035 struct ClassFunction * prev;
1036 struct ClassFunction * next;
1037 struct Location loc;
1038 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1039 struct Declarator * declarator;
1040 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1041 struct Statement * body;
1042 struct __ecereNameSpace__ecere__com__Class * _class;
1043 struct __ecereNameSpace__ecere__sys__OldList attached;
1044 int declMode;
1045 struct Type * type;
1046 struct Symbol * propSet;
1047 unsigned int isVirtual;
1048 unsigned int isConstructor;
1049 unsigned int isDestructor;
1050 unsigned int dontMangle;
1051 int id;
1052 int idCode;
1053 } __attribute__ ((gcc_struct));
1054
1055 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1056
1057 struct MembersInit
1058 {
1059 struct MembersInit * prev;
1060 struct MembersInit * next;
1061 struct Location loc;
1062 int type;
1063 union
1064 {
1065 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1066 struct ClassFunction * function;
1067 } __attribute__ ((gcc_struct));
1068 } __attribute__ ((gcc_struct));
1069
1070 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1071
1072 struct MemberInit
1073 {
1074 struct MemberInit * prev;
1075 struct MemberInit * next;
1076 struct Location loc;
1077 struct Location realLoc;
1078 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1079 struct Initializer * initializer;
1080 unsigned int used;
1081 unsigned int variable;
1082 unsigned int takeOutExp;
1083 } __attribute__ ((gcc_struct));
1084
1085 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1086
1087 struct PropertyDef
1088 {
1089 struct PropertyDef * prev;
1090 struct PropertyDef * next;
1091 struct Location loc;
1092 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1093 struct Declarator * declarator;
1094 struct Identifier * id;
1095 struct Statement * getStmt;
1096 struct Statement * setStmt;
1097 struct Statement * issetStmt;
1098 struct Symbol * symbol;
1099 unsigned int conversion;
1100 unsigned int isWatchable;
1101 struct Expression * category;
1102 } __attribute__ ((gcc_struct));
1103
1104 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1105
1106 struct PropertyWatch
1107 {
1108 struct PropertyWatch * prev;
1109 struct PropertyWatch * next;
1110 struct Location loc;
1111 struct Statement * compound;
1112 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1113 unsigned int deleteWatch;
1114 } __attribute__ ((gcc_struct));
1115
1116 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1117
1118 struct ClassDef
1119 {
1120 struct ClassDef * prev;
1121 struct ClassDef * next;
1122 struct Location loc;
1123 int type;
1124 union
1125 {
1126 struct Declaration * decl;
1127 struct ClassFunction * function;
1128 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1129 struct PropertyDef * propertyDef;
1130 struct PropertyWatch * propertyWatch;
1131 char *  designer;
1132 struct Identifier * defaultProperty;
1133 struct
1134 {
1135 struct Identifier * id;
1136 struct Initializer * initializer;
1137 } __attribute__ ((gcc_struct));
1138 } __attribute__ ((gcc_struct));
1139 int memberAccess;
1140 void *  object;
1141 } __attribute__ ((gcc_struct));
1142
1143 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1144
1145 struct DBTableEntry;
1146
1147 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1148
1149 struct DBIndexItem;
1150
1151 extern YYSTYPE yylval;
1152
1153 extern struct Location yylloc;
1154
1155 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1156
1157 extern int returnCode;
1158
1159 extern struct Expression * parsedExpression;
1160
1161 extern unsigned int yydebug;
1162
1163 void SetYydebug(unsigned int b)
1164 {
1165 yydebug = b;
1166 }
1167
1168 extern unsigned int echoOn;
1169
1170 void resetScanner();
1171
1172 int propWatcherID;
1173
1174 int expression_yyparse();
1175
1176 static struct Statement * curCompound;
1177
1178 struct External * curExternal, * afterExternal;
1179
1180 static struct Type * curSwitchType;
1181
1182 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1183
1184 struct __ecereNameSpace__ecere__com__Class * thisClass;
1185
1186 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1187 {
1188 thisClass = c;
1189 }
1190
1191 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1192 {
1193 return thisClass;
1194 }
1195
1196 static char * thisNameSpace;
1197
1198 struct __ecereNameSpace__ecere__com__Class * containerClass;
1199
1200 unsigned int thisClassParams = 0x1;
1201
1202 unsigned int internalValueCounter;
1203
1204 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1205
1206 struct __ecereNameSpace__ecere__sys__TempFile
1207 {
1208 char __ecere_padding[24];
1209 } __attribute__ ((gcc_struct));
1210
1211 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1212
1213 extern int strlen(const char * );
1214
1215 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1216
1217 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1218
1219 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1220
1221 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1222
1223 void PrintExpression(struct Expression * exp, char * string)
1224 {
1225 {
1226 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1227 int count;
1228
1229 if(exp)
1230 OutputExpression(exp, f);
1231 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1232 count = strlen(string);
1233 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1234 string[count] = '\0';
1235 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1236 }
1237 }
1238
1239 extern int isspace(int c);
1240
1241 long long _strtoi64(char * string, char ** endString, int base)
1242 {
1243 long long value = 0;
1244 int sign = 1;
1245 int c;
1246 char ch;
1247
1248 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1249 ;
1250 if(ch == '+')
1251 c++;
1252 else if(ch == '-')
1253 {
1254 sign = -1;
1255 c++;
1256 }
1257 ;
1258 if(!base)
1259 {
1260 if(ch == (char)0 && string[c + 1] == 'x')
1261 {
1262 base = 16;
1263 c += 2;
1264 }
1265 else if(ch == '0')
1266 {
1267 base = 8;
1268 c++;
1269 }
1270 else
1271 base = 10;
1272 }
1273 for(; (ch = string[c]); c++)
1274 {
1275 if(ch == '0')
1276 ch = (char)0;
1277 else if(ch >= '1' && ch <= '9')
1278 ch -= '1';
1279 else if(ch >= 'a' && ch <= 'z')
1280 ch -= 'a';
1281 else if(ch >= 'A' && ch <= 'Z')
1282 ch -= 'A';
1283 else
1284 {
1285 if(endString)
1286 *endString = string + c;
1287 break;
1288 }
1289 if(ch < base)
1290 {
1291 value *= base;
1292 value += ch;
1293 }
1294 else
1295 {
1296 if(endString)
1297 *endString = string + c;
1298 break;
1299 }
1300 }
1301 return sign * value;
1302 }
1303
1304 uint64 _strtoui64(char * string, char ** endString, int base)
1305 {
1306 uint64 value = 0;
1307 int sign = 1;
1308 int c;
1309 char ch;
1310
1311 for(c = 0; (ch = string[c]) && isspace(ch); c++)
1312 ;
1313 if(ch == '+')
1314 c++;
1315 else if(ch == '-')
1316 {
1317 sign = -1;
1318 c++;
1319 }
1320 ;
1321 if(!base)
1322 {
1323 if(ch == (char)0 && string[c + 1] == 'x')
1324 {
1325 base = 16;
1326 c += 2;
1327 }
1328 else if(ch == '0')
1329 {
1330 base = 8;
1331 c++;
1332 }
1333 else
1334 base = 10;
1335 }
1336 for(; (ch = string[c]); c++)
1337 {
1338 if(ch == '0')
1339 ch = (char)0;
1340 else if(ch >= '1' && ch <= '9')
1341 ch -= '1';
1342 else if(ch >= 'a' && ch <= 'z')
1343 ch -= 'a';
1344 else if(ch >= 'A' && ch <= 'Z')
1345 ch -= 'A';
1346 else
1347 {
1348 if(endString)
1349 *endString = string + c;
1350 break;
1351 }
1352 if(ch < base)
1353 {
1354 value *= base;
1355 value += ch;
1356 }
1357 else
1358 {
1359 if(endString)
1360 *endString = string + c;
1361 break;
1362 }
1363 }
1364 return sign * value;
1365 }
1366
1367 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1368
1369 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1370
1371 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1372 {
1373 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1374 {
1375 if(!param->baseType)
1376 {
1377 if(param->dataTypeString)
1378 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1379 else
1380 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1381 }
1382 return param->baseType;
1383 }
1384 return (((void *)0));
1385 }
1386
1387 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1388 {
1389 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1390 return 0x1;
1391 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1392 {
1393 return 0x0;
1394 }
1395 if(type1->kind == type2->kind)
1396 {
1397 switch(type1->kind)
1398 {
1399 case 1:
1400 case 2:
1401 case 3:
1402 case 4:
1403 case 22:
1404 if(type1->passAsTemplate && !type2->passAsTemplate)
1405 return 0x1;
1406 return type1->isSigned != type2->isSigned;
1407 case 8:
1408 return type1->_class != type2->_class;
1409 case 13:
1410 return NeedCast(type1->type, type2->type);
1411 default:
1412 return 0x1;
1413 }
1414 }
1415 return 0x1;
1416 }
1417
1418 extern int strcmp(const char * , const char * );
1419
1420 extern struct Context * curContext;
1421
1422 extern struct Context * topContext;
1423
1424 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1425
1426 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);
1427
1428 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1429
1430 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);
1431
1432 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);
1433
1434 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1435
1436 struct __ecereNameSpace__ecere__com__ClassProperty
1437 {
1438 char *  name;
1439 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1440 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1441 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1442 int depth;
1443 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1444 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1445 char *  dataTypeString;
1446 struct Type * dataType;
1447 unsigned int constant;
1448 } __attribute__ ((gcc_struct));
1449
1450 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1451
1452 extern struct Expression * QMkExpId(char *  id);
1453
1454 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1455
1456 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1457 {
1458 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1459 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1460 char *  name;
1461 int type;
1462 union
1463 {
1464 char *  dataTypeString;
1465 int memberType;
1466 } __attribute__ ((gcc_struct));
1467 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1468 void *  param;
1469 char __ecere_padding[4];
1470 } __attribute__ ((gcc_struct));
1471
1472 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1473
1474 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1475
1476 extern void FreeIdentifier(struct Identifier * id);
1477
1478 void ProcessExpressionType(struct Expression * exp);
1479
1480 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1481
1482 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1483
1484 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1485
1486 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1487
1488 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1489
1490 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1491
1492 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1493
1494 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1495
1496 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1497 {
1498 if(exp->type == 0 && exp->identifier)
1499 {
1500 struct Identifier * id = exp->identifier;
1501 struct Context * ctx;
1502 struct Symbol * symbol = (((void *)0));
1503
1504 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1505 {
1506 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1507 {
1508 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1509 if(symbol)
1510 break;
1511 }
1512 }
1513 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1514 {
1515 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1516 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1517 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1518 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1519
1520 if(!prop)
1521 {
1522 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1523 }
1524 if(!prop && !method)
1525 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1526 if(!prop && !method && !member)
1527 {
1528 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1529 }
1530 if(prop || method || member || classProp)
1531 {
1532 exp->type = 8;
1533 exp->member.member = id;
1534 exp->member.memberType = 0;
1535 exp->member.exp = QMkExpId("this");
1536 exp->addedThis = 0x1;
1537 }
1538 else if(_class && _class->templateParams.first)
1539 {
1540 struct __ecereNameSpace__ecere__com__Class * sClass;
1541
1542 for(sClass = _class; sClass; sClass = sClass->base)
1543 {
1544 if(sClass->templateParams.first)
1545 {
1546 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1547
1548 for(param = sClass->templateParams.first; param; param = param->next)
1549 {
1550 if(param->type == 2 && !strcmp(param->name, id->string))
1551 {
1552 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1553
1554 if(argExp)
1555 {
1556 struct Declarator * decl;
1557 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1558
1559 FreeIdentifier(exp->member.member);
1560 ProcessExpressionType(argExp);
1561 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1562 exp->expType = ProcessType(specs, decl);
1563 exp->type = 5;
1564 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1565 }
1566 }
1567 }
1568 }
1569 }
1570 }
1571 }
1572 }
1573 }
1574
1575 extern int sprintf(char * , char * , ...);
1576
1577 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1578
1579 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1580
1581 char * PrintInt(long long result)
1582 {
1583 char temp[100];
1584
1585 if(result > (((long long)0x7fffffffffffffffLL)))
1586 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1587 else
1588 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1589 return __ecereNameSpace__ecere__sys__CopyString(temp);
1590 }
1591
1592 char * PrintUInt(uint64 result)
1593 {
1594 char temp[100];
1595
1596 if(result > (0xffffffff))
1597 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1598 else if(result > (((int)0x7fffffff)))
1599 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1600 else
1601 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1602 return __ecereNameSpace__ecere__sys__CopyString(temp);
1603 }
1604
1605 char * PrintInt64(long long result)
1606 {
1607 char temp[100];
1608
1609 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1610 return __ecereNameSpace__ecere__sys__CopyString(temp);
1611 }
1612
1613 char * PrintUInt64(uint64 result)
1614 {
1615 char temp[100];
1616
1617 if(result > (((long long)0x7fffffffffffffffLL)))
1618 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1619 else
1620 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1621 return __ecereNameSpace__ecere__sys__CopyString(temp);
1622 }
1623
1624 char * PrintHexUInt(uint64 result)
1625 {
1626 char temp[100];
1627
1628 if(result > (0xffffffff))
1629 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1630 else
1631 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1632 return __ecereNameSpace__ecere__sys__CopyString(temp);
1633 }
1634
1635 char * PrintHexUInt64(uint64 result)
1636 {
1637 char temp[100];
1638
1639 if(result > (0xffffffff))
1640 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1641 else
1642 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1643 return __ecereNameSpace__ecere__sys__CopyString(temp);
1644 }
1645
1646 char * PrintShort(short result)
1647 {
1648 char temp[100];
1649
1650 sprintf(temp, "%d", (unsigned short)result);
1651 return __ecereNameSpace__ecere__sys__CopyString(temp);
1652 }
1653
1654 char * PrintUShort(unsigned short result)
1655 {
1656 char temp[100];
1657
1658 if(result > (unsigned short)32767)
1659 sprintf(temp, "0x%X", (int)result);
1660 else
1661 sprintf(temp, "%d", result);
1662 return __ecereNameSpace__ecere__sys__CopyString(temp);
1663 }
1664
1665 extern int isprint(int c);
1666
1667 char * PrintChar(char result)
1668 {
1669 char temp[100];
1670
1671 if(result > (char)0 && isprint(result))
1672 sprintf(temp, "'%c'", result);
1673 else if(result < (char)0)
1674 sprintf(temp, "%d", result);
1675 else
1676 sprintf(temp, "0x%X", (unsigned char)result);
1677 return __ecereNameSpace__ecere__sys__CopyString(temp);
1678 }
1679
1680 char * PrintUChar(unsigned char result)
1681 {
1682 char temp[100];
1683
1684 sprintf(temp, "0x%X", result);
1685 return __ecereNameSpace__ecere__sys__CopyString(temp);
1686 }
1687
1688 char * PrintFloat(float result)
1689 {
1690 char temp[350];
1691
1692 sprintf(temp, "%.16ff", result);
1693 return __ecereNameSpace__ecere__sys__CopyString(temp);
1694 }
1695
1696 char * PrintDouble(double result)
1697 {
1698 char temp[350];
1699
1700 sprintf(temp, "%.16f", result);
1701 return __ecereNameSpace__ecere__sys__CopyString(temp);
1702 }
1703
1704 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1705
1706 struct OpTable
1707 {
1708 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1709 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1710 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1711 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1712 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1713 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1714 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1715 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1716 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1717 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1718 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1719 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1720 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1721 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1722 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1723 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1724 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1725 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1726 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1727 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1728 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1729 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1730 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1731 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1732 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1733 unsigned int (*  Not)(struct Expression *, struct Operand *);
1734 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1735 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1736 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1737 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1738 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1739 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1740 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1741 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1742 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1743 } __attribute__ ((gcc_struct));
1744
1745 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1746
1747 struct Operand
1748 {
1749 int kind;
1750 struct Type * type;
1751 unsigned int ptrSize;
1752 union
1753 {
1754 char c;
1755 unsigned char uc;
1756 short s;
1757 unsigned short us;
1758 int i;
1759 unsigned int ui;
1760 float f;
1761 double d;
1762 unsigned char *  p;
1763 long long i64;
1764 uint64 ui64;
1765 intptr_t iptr;
1766 uintptr_t uiptr;
1767 } __attribute__ ((gcc_struct));
1768 struct OpTable ops;
1769 } __attribute__ ((gcc_struct));
1770
1771 struct Operand GetOperand(struct Expression * exp);
1772
1773 unsigned int GetInt(struct Expression * exp, int * value2)
1774 {
1775 struct Operand op2 = GetOperand(exp);
1776
1777 if(op2.kind == 3 && op2.type->isSigned)
1778 *value2 = op2.i;
1779 else if(op2.kind == 3)
1780 *value2 = (int)op2.ui;
1781 if(op2.kind == 4 && op2.type->isSigned)
1782 *value2 = (int)op2.i64;
1783 else if(op2.kind == 4)
1784 *value2 = (int)op2.ui64;
1785 else if(op2.kind == 22 && op2.type->isSigned)
1786 *value2 = (int)op2.iptr;
1787 else if(op2.kind == 22)
1788 *value2 = (int)op2.uiptr;
1789 else if(op2.kind == 2 && op2.type->isSigned)
1790 *value2 = (int)op2.s;
1791 else if(op2.kind == 2)
1792 *value2 = (int)op2.us;
1793 else if(op2.kind == 1 && op2.type->isSigned)
1794 *value2 = (int)op2.c;
1795 else if(op2.kind == 1)
1796 *value2 = (int)op2.uc;
1797 else if(op2.kind == 6)
1798 *value2 = (int)op2.f;
1799 else if(op2.kind == 7)
1800 *value2 = (int)op2.d;
1801 else if(op2.kind == 13)
1802 *value2 = (int)op2.ui;
1803 else
1804 return 0x0;
1805 return 0x1;
1806 }
1807
1808 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1809 {
1810 struct Operand op2 = GetOperand(exp);
1811
1812 if(op2.kind == 3 && op2.type->isSigned)
1813 *value2 = (unsigned int)op2.i;
1814 else if(op2.kind == 3)
1815 *value2 = op2.ui;
1816 if(op2.kind == 4 && op2.type->isSigned)
1817 *value2 = (unsigned int)op2.i64;
1818 else if(op2.kind == 4)
1819 *value2 = (unsigned int)op2.ui64;
1820 else if(op2.kind == 22 && op2.type->isSigned)
1821 *value2 = (unsigned int)op2.iptr;
1822 else if(op2.kind == 22)
1823 *value2 = (unsigned int)op2.uiptr;
1824 else if(op2.kind == 2 && op2.type->isSigned)
1825 *value2 = (unsigned int)op2.s;
1826 else if(op2.kind == 2)
1827 *value2 = (unsigned int)op2.us;
1828 else if(op2.kind == 1 && op2.type->isSigned)
1829 *value2 = (unsigned int)op2.c;
1830 else if(op2.kind == 1)
1831 *value2 = (unsigned int)op2.uc;
1832 else if(op2.kind == 6)
1833 *value2 = (unsigned int)op2.f;
1834 else if(op2.kind == 7)
1835 *value2 = (unsigned int)op2.d;
1836 else if(op2.kind == 13)
1837 *value2 = op2.ui;
1838 else
1839 return 0x0;
1840 return 0x1;
1841 }
1842
1843 unsigned int GetInt64(struct Expression * exp, long long * value2)
1844 {
1845 struct Operand op2 = GetOperand(exp);
1846
1847 if(op2.kind == 3 && op2.type->isSigned)
1848 *value2 = (long long)op2.i;
1849 else if(op2.kind == 3)
1850 *value2 = (long long)op2.ui;
1851 if(op2.kind == 4 && op2.type->isSigned)
1852 *value2 = op2.i64;
1853 else if(op2.kind == 4)
1854 *value2 = (long long)op2.ui64;
1855 else if(op2.kind == 22 && op2.type->isSigned)
1856 *value2 = (long long)op2.iptr;
1857 else if(op2.kind == 22)
1858 *value2 = (long long)op2.uiptr;
1859 else if(op2.kind == 2 && op2.type->isSigned)
1860 *value2 = (long long)op2.s;
1861 else if(op2.kind == 2)
1862 *value2 = (long long)op2.us;
1863 else if(op2.kind == 1 && op2.type->isSigned)
1864 *value2 = (long long)op2.c;
1865 else if(op2.kind == 1)
1866 *value2 = (long long)op2.uc;
1867 else if(op2.kind == 6)
1868 *value2 = (long long)op2.f;
1869 else if(op2.kind == 7)
1870 *value2 = (long long)op2.d;
1871 else if(op2.kind == 13)
1872 *value2 = (long long)op2.ui;
1873 else
1874 return 0x0;
1875 return 0x1;
1876 }
1877
1878 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1879 {
1880 struct Operand op2 = GetOperand(exp);
1881
1882 if(op2.kind == 3 && op2.type->isSigned)
1883 *value2 = (uint64)op2.i;
1884 else if(op2.kind == 3)
1885 *value2 = (uint64)op2.ui;
1886 if(op2.kind == 4 && op2.type->isSigned)
1887 *value2 = (uint64)op2.i64;
1888 else if(op2.kind == 4)
1889 *value2 = op2.ui64;
1890 else if(op2.kind == 22 && op2.type->isSigned)
1891 *value2 = (uint64)op2.iptr;
1892 else if(op2.kind == 22)
1893 *value2 = (uint64)op2.uiptr;
1894 else if(op2.kind == 2 && op2.type->isSigned)
1895 *value2 = (uint64)op2.s;
1896 else if(op2.kind == 2)
1897 *value2 = (uint64)op2.us;
1898 else if(op2.kind == 1 && op2.type->isSigned)
1899 *value2 = (uint64)op2.c;
1900 else if(op2.kind == 1)
1901 *value2 = (uint64)op2.uc;
1902 else if(op2.kind == 6)
1903 *value2 = (uint64)op2.f;
1904 else if(op2.kind == 7)
1905 *value2 = (uint64)op2.d;
1906 else if(op2.kind == 13)
1907 *value2 = (uint64)op2.ui;
1908 else
1909 return 0x0;
1910 return 0x1;
1911 }
1912
1913 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1914 {
1915 struct Operand op2 = GetOperand(exp);
1916
1917 if(op2.kind == 3 && op2.type->isSigned)
1918 *value2 = (intptr_t)op2.i;
1919 else if(op2.kind == 3)
1920 *value2 = (intptr_t)op2.ui;
1921 if(op2.kind == 4 && op2.type->isSigned)
1922 *value2 = (intptr_t)op2.i64;
1923 else if(op2.kind == 4)
1924 *value2 = (intptr_t)op2.ui64;
1925 else if(op2.kind == 22 && op2.type->isSigned)
1926 *value2 = op2.iptr;
1927 else if(op2.kind == 22)
1928 *value2 = (intptr_t)op2.uiptr;
1929 else if(op2.kind == 2 && op2.type->isSigned)
1930 *value2 = (intptr_t)op2.s;
1931 else if(op2.kind == 2)
1932 *value2 = (intptr_t)op2.us;
1933 else if(op2.kind == 1 && op2.type->isSigned)
1934 *value2 = (intptr_t)op2.c;
1935 else if(op2.kind == 1)
1936 *value2 = (intptr_t)op2.uc;
1937 else if(op2.kind == 6)
1938 *value2 = (intptr_t)op2.f;
1939 else if(op2.kind == 7)
1940 *value2 = (intptr_t)op2.d;
1941 else if(op2.kind == 13)
1942 *value2 = (intptr_t)op2.ui;
1943 else
1944 return 0x0;
1945 return 0x1;
1946 }
1947
1948 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1949 {
1950 struct Operand op2 = GetOperand(exp);
1951
1952 if(op2.kind == 3 && op2.type->isSigned)
1953 *value2 = (uintptr_t)op2.i;
1954 else if(op2.kind == 3)
1955 *value2 = (uintptr_t)op2.ui;
1956 if(op2.kind == 4 && op2.type->isSigned)
1957 *value2 = (uintptr_t)op2.i64;
1958 else if(op2.kind == 4)
1959 *value2 = (uintptr_t)op2.ui64;
1960 else if(op2.kind == 22 && op2.type->isSigned)
1961 *value2 = (uintptr_t)op2.iptr;
1962 else if(op2.kind == 22)
1963 *value2 = op2.uiptr;
1964 else if(op2.kind == 2 && op2.type->isSigned)
1965 *value2 = (uintptr_t)op2.s;
1966 else if(op2.kind == 2)
1967 *value2 = (uintptr_t)op2.us;
1968 else if(op2.kind == 1 && op2.type->isSigned)
1969 *value2 = (uintptr_t)op2.c;
1970 else if(op2.kind == 1)
1971 *value2 = (uintptr_t)op2.uc;
1972 else if(op2.kind == 6)
1973 *value2 = (uintptr_t)op2.f;
1974 else if(op2.kind == 7)
1975 *value2 = (uintptr_t)op2.d;
1976 else if(op2.kind == 13)
1977 *value2 = (uintptr_t)op2.ui;
1978 else
1979 return 0x0;
1980 return 0x1;
1981 }
1982
1983 unsigned int GetShort(struct Expression * exp, short * value2)
1984 {
1985 struct Operand op2 = GetOperand(exp);
1986
1987 if(op2.kind == 3 && op2.type->isSigned)
1988 *value2 = (short)op2.i;
1989 else if(op2.kind == 3)
1990 *value2 = (short)op2.ui;
1991 if(op2.kind == 4 && op2.type->isSigned)
1992 *value2 = (short)op2.i64;
1993 else if(op2.kind == 4)
1994 *value2 = (short)op2.ui64;
1995 else if(op2.kind == 22 && op2.type->isSigned)
1996 *value2 = (short)op2.iptr;
1997 else if(op2.kind == 22)
1998 *value2 = (short)op2.uiptr;
1999 else if(op2.kind == 2 && op2.type->isSigned)
2000 *value2 = op2.s;
2001 else if(op2.kind == 2)
2002 *value2 = (short)op2.us;
2003 else if(op2.kind == 1 && op2.type->isSigned)
2004 *value2 = (short)op2.c;
2005 else if(op2.kind == 1)
2006 *value2 = (short)op2.uc;
2007 else if(op2.kind == 6)
2008 *value2 = (short)op2.f;
2009 else if(op2.kind == 7)
2010 *value2 = (short)op2.d;
2011 else if(op2.kind == 13)
2012 *value2 = (short)op2.ui;
2013 else
2014 return 0x0;
2015 return 0x1;
2016 }
2017
2018 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2019 {
2020 struct Operand op2 = GetOperand(exp);
2021
2022 if(op2.kind == 3 && op2.type->isSigned)
2023 *value2 = (unsigned short)op2.i;
2024 else if(op2.kind == 3)
2025 *value2 = (unsigned short)op2.ui;
2026 if(op2.kind == 4 && op2.type->isSigned)
2027 *value2 = (unsigned short)op2.i64;
2028 else if(op2.kind == 4)
2029 *value2 = (unsigned short)op2.ui64;
2030 else if(op2.kind == 22 && op2.type->isSigned)
2031 *value2 = (unsigned short)op2.iptr;
2032 else if(op2.kind == 22)
2033 *value2 = (unsigned short)op2.uiptr;
2034 else if(op2.kind == 2 && op2.type->isSigned)
2035 *value2 = (unsigned short)op2.s;
2036 else if(op2.kind == 2)
2037 *value2 = op2.us;
2038 else if(op2.kind == 1 && op2.type->isSigned)
2039 *value2 = (unsigned short)op2.c;
2040 else if(op2.kind == 1)
2041 *value2 = (unsigned short)op2.uc;
2042 else if(op2.kind == 6)
2043 *value2 = (unsigned short)op2.f;
2044 else if(op2.kind == 7)
2045 *value2 = (unsigned short)op2.d;
2046 else if(op2.kind == 13)
2047 *value2 = (unsigned short)op2.ui;
2048 else
2049 return 0x0;
2050 return 0x1;
2051 }
2052
2053 unsigned int GetChar(struct Expression * exp, char * value2)
2054 {
2055 struct Operand op2 = GetOperand(exp);
2056
2057 if(op2.kind == 3 && op2.type->isSigned)
2058 *value2 = (char)op2.i;
2059 else if(op2.kind == 3)
2060 *value2 = (char)op2.ui;
2061 if(op2.kind == 4 && op2.type->isSigned)
2062 *value2 = (char)op2.i64;
2063 else if(op2.kind == 4)
2064 *value2 = (char)op2.ui64;
2065 else if(op2.kind == 22 && op2.type->isSigned)
2066 *value2 = (char)op2.iptr;
2067 else if(op2.kind == 22)
2068 *value2 = (char)op2.uiptr;
2069 else if(op2.kind == 2 && op2.type->isSigned)
2070 *value2 = (char)op2.s;
2071 else if(op2.kind == 2)
2072 *value2 = (char)op2.us;
2073 else if(op2.kind == 1 && op2.type->isSigned)
2074 *value2 = op2.c;
2075 else if(op2.kind == 1)
2076 *value2 = (char)op2.uc;
2077 else if(op2.kind == 6)
2078 *value2 = (char)op2.f;
2079 else if(op2.kind == 7)
2080 *value2 = (char)op2.d;
2081 else if(op2.kind == 13)
2082 *value2 = (char)op2.ui;
2083 else
2084 return 0x0;
2085 return 0x1;
2086 }
2087
2088 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2089 {
2090 struct Operand op2 = GetOperand(exp);
2091
2092 if(op2.kind == 3 && op2.type->isSigned)
2093 *value2 = (unsigned char)op2.i;
2094 else if(op2.kind == 3)
2095 *value2 = (unsigned char)op2.ui;
2096 if(op2.kind == 4 && op2.type->isSigned)
2097 *value2 = (unsigned char)op2.i64;
2098 else if(op2.kind == 4)
2099 *value2 = (unsigned char)op2.ui64;
2100 else if(op2.kind == 22 && op2.type->isSigned)
2101 *value2 = (unsigned char)op2.iptr;
2102 else if(op2.kind == 22)
2103 *value2 = (unsigned char)op2.uiptr;
2104 else if(op2.kind == 2 && op2.type->isSigned)
2105 *value2 = (unsigned char)op2.s;
2106 else if(op2.kind == 2)
2107 *value2 = (unsigned char)op2.us;
2108 else if(op2.kind == 1 && op2.type->isSigned)
2109 *value2 = (unsigned char)op2.c;
2110 else if(op2.kind == 1)
2111 *value2 = op2.uc;
2112 else if(op2.kind == 6)
2113 *value2 = (unsigned char)op2.f;
2114 else if(op2.kind == 7)
2115 *value2 = (unsigned char)op2.d;
2116 else if(op2.kind == 13)
2117 *value2 = (unsigned char)op2.ui;
2118 else
2119 return 0x0;
2120 return 0x1;
2121 }
2122
2123 unsigned int GetFloat(struct Expression * exp, float * value2)
2124 {
2125 struct Operand op2 = GetOperand(exp);
2126
2127 if(op2.kind == 3 && op2.type->isSigned)
2128 *value2 = (float)(float)op2.i;
2129 else if(op2.kind == 3)
2130 *value2 = (float)(float)op2.ui;
2131 if(op2.kind == 4 && op2.type->isSigned)
2132 *value2 = (float)(float)op2.i64;
2133 else if(op2.kind == 4)
2134 *value2 = (float)(float)op2.ui64;
2135 else if(op2.kind == 22 && op2.type->isSigned)
2136 *value2 = (float)op2.iptr;
2137 else if(op2.kind == 22)
2138 *value2 = (float)op2.uiptr;
2139 else if(op2.kind == 2 && op2.type->isSigned)
2140 *value2 = (float)(float)op2.s;
2141 else if(op2.kind == 2)
2142 *value2 = (float)(float)op2.us;
2143 else if(op2.kind == 1 && op2.type->isSigned)
2144 *value2 = (float)(float)op2.c;
2145 else if(op2.kind == 1)
2146 *value2 = (float)(float)op2.uc;
2147 else if(op2.kind == 6)
2148 *value2 = (float)op2.f;
2149 else if(op2.kind == 7)
2150 *value2 = (float)op2.d;
2151 else if(op2.kind == 13)
2152 *value2 = (float)(float)op2.ui;
2153 else
2154 return 0x0;
2155 return 0x1;
2156 }
2157
2158 unsigned int GetDouble(struct Expression * exp, double * value2)
2159 {
2160 struct Operand op2 = GetOperand(exp);
2161
2162 if(op2.kind == 3 && op2.type->isSigned)
2163 *value2 = (double)(double)op2.i;
2164 else if(op2.kind == 3)
2165 *value2 = (double)(double)op2.ui;
2166 if(op2.kind == 4 && op2.type->isSigned)
2167 *value2 = (double)(double)op2.i64;
2168 else if(op2.kind == 4)
2169 *value2 = (double)(double)op2.ui64;
2170 else if(op2.kind == 22 && op2.type->isSigned)
2171 *value2 = (double)op2.iptr;
2172 else if(op2.kind == 22)
2173 *value2 = (double)op2.uiptr;
2174 else if(op2.kind == 2 && op2.type->isSigned)
2175 *value2 = (double)(double)op2.s;
2176 else if(op2.kind == 2)
2177 *value2 = (double)(double)op2.us;
2178 else if(op2.kind == 1 && op2.type->isSigned)
2179 *value2 = (double)(double)op2.c;
2180 else if(op2.kind == 1)
2181 *value2 = (double)(double)op2.uc;
2182 else if(op2.kind == 6)
2183 *value2 = (double)op2.f;
2184 else if(op2.kind == 7)
2185 *value2 = (double)op2.d;
2186 else if(op2.kind == 13)
2187 *value2 = (double)(double)op2.ui;
2188 else
2189 return 0x0;
2190 return 0x1;
2191 }
2192
2193 void ComputeExpression(struct Expression * exp);
2194
2195 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2196
2197 int ComputeTypeSize(struct Type * type);
2198
2199 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2200
2201 struct __ecereNameSpace__ecere__com__BitMember
2202 {
2203 struct __ecereNameSpace__ecere__com__BitMember * prev;
2204 struct __ecereNameSpace__ecere__com__BitMember * next;
2205 char *  name;
2206 unsigned int isProperty;
2207 int memberAccess;
2208 int id;
2209 struct __ecereNameSpace__ecere__com__Class * _class;
2210 char *  dataTypeString;
2211 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2212 struct Type * dataType;
2213 int type;
2214 int size;
2215 int pos;
2216 uint64 mask;
2217 } __attribute__ ((gcc_struct));
2218
2219 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2220
2221 struct __ecereNameSpace__ecere__sys__OldLink
2222 {
2223 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2224 struct __ecereNameSpace__ecere__sys__OldLink * next;
2225 void *  data;
2226 } __attribute__ ((gcc_struct));
2227
2228 void FinishTemplatesContext(struct Context * context);
2229
2230 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2231 {
2232 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2233 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2234
2235 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || _class->structSize == _class->offset) && _class->computeSize))
2236 {
2237 int c;
2238 int unionMemberOffset = 0;
2239 int bitFields = 0;
2240
2241 if(!member && _class->destructionWatchOffset)
2242 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2243 {
2244 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2245
2246 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2247 {
2248 if(!dataMember->isProperty)
2249 {
2250 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2251 {
2252 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2253 }
2254 }
2255 }
2256 }
2257 {
2258 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2259
2260 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2261 {
2262 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2263 {
2264 if(!isMember && _class->type == 2 && dataMember->dataType)
2265 {
2266 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2267 uint64 mask = 0;
2268 int d;
2269
2270 ComputeTypeSize(dataMember->dataType);
2271 if(bitMember->pos == -1)
2272 bitMember->pos = _class->memberOffset;
2273 if(!bitMember->size)
2274 bitMember->size = dataMember->dataType->size * 8;
2275 _class->memberOffset = bitMember->pos + bitMember->size;
2276 for(d = 0; d < bitMember->size; d++)
2277 {
2278 if(d)
2279 mask <<= 1;
2280 mask |= 1;
2281 }
2282 bitMember->mask = mask << bitMember->pos;
2283 }
2284 else if(dataMember->type == 0 && dataMember->dataType)
2285 {
2286 int size;
2287 int alignment = 0;
2288
2289 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2290 ComputeTypeSize(dataMember->dataType);
2291 if(dataMember->dataType->bitFieldCount)
2292 {
2293 bitFields += dataMember->dataType->bitFieldCount;
2294 size = 0;
2295 }
2296 else
2297 {
2298 if(bitFields)
2299 {
2300 int size = (bitFields + 7) / 8;
2301
2302 if(isMember)
2303 {
2304 int __simpleStruct0;
2305
2306 if(alignment)
2307 {
2308 int __simpleStruct0;
2309
2310 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2311 if(member->memberOffset % alignment)
2312 member->memberOffset += alignment - (member->memberOffset % alignment);
2313 }
2314 dataMember->offset = member->memberOffset;
2315 if(member->type == 1)
2316 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2317 else
2318 {
2319 member->memberOffset += size;
2320 }
2321 }
2322 else
2323 {
2324 if(alignment)
2325 {
2326 int __simpleStruct0;
2327
2328 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2329 if(_class->memberOffset % alignment)
2330 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2331 }
2332 dataMember->offset = _class->memberOffset;
2333 _class->memberOffset += size;
2334 }
2335 bitFields = 0;
2336 }
2337 size = dataMember->dataType->size;
2338 alignment = dataMember->dataType->alignment;
2339 }
2340 if(isMember)
2341 {
2342 int __simpleStruct0;
2343
2344 if(alignment)
2345 {
2346 int __simpleStruct0;
2347
2348 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2349 if(member->memberOffset % alignment)
2350 member->memberOffset += alignment - (member->memberOffset % alignment);
2351 }
2352 dataMember->offset = member->memberOffset;
2353 if(member->type == 1)
2354 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2355 else
2356 {
2357 member->memberOffset += size;
2358 }
2359 }
2360 else
2361 {
2362 if(alignment)
2363 {
2364 int __simpleStruct0;
2365
2366 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2367 if(_class->memberOffset % alignment)
2368 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2369 }
2370 dataMember->offset = _class->memberOffset;
2371 _class->memberOffset += size;
2372 }
2373 }
2374 else
2375 {
2376 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2377 if(isMember)
2378 {
2379 int __simpleStruct2;
2380 int __simpleStruct0, __simpleStruct1;
2381
2382 member->structAlignment = (__simpleStruct0 = member->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2383 dataMember->offset = member->memberOffset;
2384 if(member->type == 1)
2385 unionMemberOffset = (__simpleStruct2 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct2) ? unionMemberOffset : __simpleStruct2);
2386 else
2387 member->memberOffset += dataMember->memberOffset;
2388 }
2389 else
2390 {
2391 int __simpleStruct0, __simpleStruct1;
2392
2393 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2394 dataMember->offset = _class->memberOffset;
2395 _class->memberOffset += dataMember->memberOffset;
2396 }
2397 }
2398 }
2399 }
2400 if(bitFields)
2401 {
2402 int alignment = 0;
2403 int size = (bitFields + 7) / 8;
2404
2405 if(isMember)
2406 {
2407 int __simpleStruct0;
2408
2409 if(alignment)
2410 {
2411 int __simpleStruct0;
2412
2413 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2414 if(member->memberOffset % alignment)
2415 member->memberOffset += alignment - (member->memberOffset % alignment);
2416 }
2417 if(member->type == 1)
2418 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2419 else
2420 {
2421 member->memberOffset += size;
2422 }
2423 }
2424 else
2425 {
2426 if(alignment)
2427 {
2428 int __simpleStruct0;
2429
2430 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2431 if(_class->memberOffset % alignment)
2432 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2433 }
2434 _class->memberOffset += size;
2435 }
2436 bitFields = 0;
2437 }
2438 }
2439 if(member && member->type == 1)
2440 {
2441 member->memberOffset = unionMemberOffset;
2442 }
2443 if(!isMember)
2444 {
2445 if(_class->type != 2)
2446 {
2447 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset;
2448 if(!member)
2449 {
2450 struct __ecereNameSpace__ecere__com__Property * prop;
2451
2452 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2453 {
2454 if(prop->isProperty && prop->isWatchable)
2455 {
2456 prop->watcherOffset = _class->structSize;
2457 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2458 }
2459 }
2460 }
2461 {
2462 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2463
2464 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2465 {
2466 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2467
2468 if(deriv->computeSize)
2469 {
2470 deriv->offset = _class->structSize;
2471 deriv->memberOffset = 0;
2472 deriv->structSize = deriv->offset;
2473 ComputeClassMembers(deriv, 0x0);
2474 }
2475 }
2476 }
2477 }
2478 }
2479 }
2480 if(context)
2481 FinishTemplatesContext(context);
2482 }
2483
2484 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2485
2486 struct __ecereNameSpace__ecere__com__NameSpace
2487 {
2488 char *  name;
2489 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2490 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2491 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2492 int depth;
2493 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2494 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2495 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2496 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2497 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2498 } __attribute__ ((gcc_struct));
2499
2500 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2501
2502 struct __ecereNameSpace__ecere__com__Module
2503 {
2504 struct __ecereNameSpace__ecere__com__Instance * application;
2505 struct __ecereNameSpace__ecere__sys__OldList classes;
2506 struct __ecereNameSpace__ecere__sys__OldList defines;
2507 struct __ecereNameSpace__ecere__sys__OldList functions;
2508 struct __ecereNameSpace__ecere__sys__OldList modules;
2509 struct __ecereNameSpace__ecere__com__Instance * prev;
2510 struct __ecereNameSpace__ecere__com__Instance * next;
2511 char *  name;
2512 void *  library;
2513 void *  Unload;
2514 int importType;
2515 int origImportType;
2516 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2517 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2518 } __attribute__ ((gcc_struct));
2519
2520 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2521 {
2522 struct __ecereNameSpace__ecere__com__Class * _class;
2523 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2524
2525 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->modules.first; subModule; subModule = subModule->next)
2526 ComputeModuleClasses(subModule->data);
2527 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->classes.first; _class; _class = _class->next)
2528 ComputeClassMembers(_class, 0x0);
2529 }
2530
2531 extern int targetBits;
2532
2533 extern unsigned int inCompiler;
2534
2535 extern void Compiler_Error(char *  format, ...);
2536
2537 extern char *  __ecereNameSpace__ecere__GetTranslatedString(struct __ecereNameSpace__ecere__com__Instance * module, char *  string, char *  stringAndContext);
2538
2539 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
2540
2541 int ComputeTypeSize(struct Type * type)
2542 {
2543 unsigned int size = type ? type->size : 0;
2544
2545 if(!size && type && !type->computing)
2546 {
2547 type->computing = 0x1;
2548 switch(type->kind)
2549 {
2550 case 1:
2551 type->alignment = size = sizeof(char);
2552 break;
2553 case 3:
2554 type->alignment = size = sizeof(int);
2555 break;
2556 case 4:
2557 type->alignment = size = sizeof(long long);
2558 break;
2559 case 22:
2560 type->alignment = size = targetBits / 8;
2561 break;
2562 case 5:
2563 type->alignment = size = sizeof(long);
2564 break;
2565 case 2:
2566 type->alignment = size = sizeof(short);
2567 break;
2568 case 6:
2569 type->alignment = size = sizeof(float);
2570 break;
2571 case 7:
2572 type->alignment = size = sizeof(double);
2573 break;
2574 case 8:
2575 {
2576 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2577
2578 if(_class && _class->type == 1)
2579 {
2580 ComputeClassMembers(_class, 0x0);
2581 type->alignment = _class->structAlignment;
2582 size = _class->structSize;
2583 if(type->alignment && size % type->alignment)
2584 size += type->alignment - (size % type->alignment);
2585 }
2586 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2587 {
2588 if(!_class->dataType)
2589 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2590 size = type->alignment = ComputeTypeSize(_class->dataType);
2591 }
2592 else
2593 size = type->alignment = targetBits / 8;
2594 break;
2595 }
2596 case 13:
2597 case 19:
2598 size = type->alignment = targetBits / 8;
2599 break;
2600 case 12:
2601 if(type->arraySizeExp)
2602 {
2603 ProcessExpressionType(type->arraySizeExp);
2604 ComputeExpression(type->arraySizeExp);
2605 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)))
2606 {
2607 struct Location oldLoc = yylloc;
2608 char expression[10240];
2609
2610 expression[0] = '\0';
2611 type->arraySizeExp->expType = (((void *)0));
2612 yylloc = type->arraySizeExp->loc;
2613 if(inCompiler)
2614 PrintExpression(type->arraySizeExp, expression);
2615 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Array size not constant int (%s)\n", (((void *)0))), expression);
2616 yylloc = oldLoc;
2617 }
2618 GetInt(type->arraySizeExp, &type->arraySize);
2619 }
2620 else if(type->enumClass)
2621 {
2622 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2623 {
2624 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2625 }
2626 else
2627 type->arraySize = 0;
2628 }
2629 else
2630 {
2631 type->arraySize = 0;
2632 }
2633 size = ComputeTypeSize(type->type) * type->arraySize;
2634 type->alignment = type->type->alignment;
2635 break;
2636 case 9:
2637 {
2638 struct Type * member;
2639
2640 for(member = type->members.first; member; member = member->next)
2641 {
2642 int __simpleStruct0, __simpleStruct1;
2643 unsigned int addSize = ComputeTypeSize(member);
2644
2645 member->offset = size;
2646 if(member->alignment && size % member->alignment)
2647 member->offset += member->alignment - (size % member->alignment);
2648 size = member->offset;
2649 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2650 size += addSize;
2651 }
2652 if(type->alignment && size % type->alignment)
2653 size += type->alignment - (size % type->alignment);
2654 break;
2655 }
2656 case 10:
2657 {
2658 struct Type * member;
2659
2660 for(member = type->members.first; member; member = member->next)
2661 {
2662 int __simpleStruct0, __simpleStruct1;
2663 unsigned int addSize = ComputeTypeSize(member);
2664
2665 member->offset = size;
2666 if(member->alignment && size % member->alignment)
2667 member->offset += member->alignment - (size % member->alignment);
2668 size = member->offset;
2669 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2670 size = ((size > addSize) ? size : addSize);
2671 }
2672 if(type->alignment && size % type->alignment)
2673 size += type->alignment - (size % type->alignment);
2674 break;
2675 }
2676 case 20:
2677 {
2678 struct TemplateParameter * param = type->templateParameter;
2679 struct Type * baseType = ProcessTemplateParameterType(param);
2680
2681 if(baseType)
2682 size = ComputeTypeSize(baseType);
2683 else
2684 size = sizeof(uint64);
2685 break;
2686 }
2687 case 15:
2688 {
2689 size = sizeof(enum
2690 {
2691 test
2692 });
2693 break;
2694 }
2695 case 21:
2696 {
2697 size = targetBits / 8;
2698 break;
2699 }
2700 }
2701 type->size = size;
2702 type->computing = 0x0;
2703 }
2704 return size;
2705 }
2706
2707 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2708
2709 extern struct Identifier * MkIdentifier(char *  string);
2710
2711 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2712
2713 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2714
2715 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2716
2717 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2718
2719 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2720
2721 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2722
2723 extern void FreeType(struct Type * type);
2724
2725 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2726
2727 extern struct Specifier * MkSpecifier(int specifier);
2728
2729 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2730
2731 extern struct Expression * MkExpConstant(char *  string);
2732
2733 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)
2734 {
2735 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2736 unsigned int totalSize = 0;
2737 unsigned int maxSize = 0;
2738 int alignment, size;
2739 struct __ecereNameSpace__ecere__com__DataMember * member;
2740 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2741
2742 if(!isMember && _class->base)
2743 {
2744 maxSize = _class->structSize;
2745 {
2746 if(_class->type == 1 || _class->type == 5)
2747 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass);
2748 else
2749 maxSize -= _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2750 }
2751 }
2752 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2753 {
2754 if(!member->isProperty)
2755 {
2756 switch(member->type)
2757 {
2758 case 0:
2759 {
2760 if(member->dataTypeString)
2761 {
2762 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2763 struct Declarator * decl;
2764
2765 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2766 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2767 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2768 if(!member->dataType)
2769 member->dataType = ProcessType(specs, decl);
2770 ReplaceThisClassSpecifiers(specs, topClass);
2771 {
2772 struct Type * type = ProcessType(specs, decl);
2773
2774 DeclareType(member->dataType, 0x0, 0x0);
2775 FreeType(type);
2776 }
2777 ComputeTypeSize(member->dataType);
2778 size = member->dataType->size;
2779 alignment = member->dataType->alignment;
2780 if(alignment)
2781 {
2782 if(totalSize % alignment)
2783 totalSize += alignment - (totalSize % alignment);
2784 }
2785 totalSize += size;
2786 }
2787 break;
2788 }
2789 case 1:
2790 case 2:
2791 {
2792 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2793
2794 size = 0;
2795 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass);
2796 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
2797 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
2798 alignment = member->structAlignment;
2799 if(alignment)
2800 {
2801 if(totalSize % alignment)
2802 totalSize += alignment - (totalSize % alignment);
2803 }
2804 totalSize += size;
2805 break;
2806 }
2807 }
2808 }
2809 }
2810 if(retSize)
2811 {
2812 unsigned int __simpleStruct0;
2813
2814 if(topMember && topMember->type == 1)
2815 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
2816 else
2817 *retSize += totalSize;
2818 }
2819 else if(totalSize < maxSize && _class->type != 1000)
2820 {
2821 char sizeString[50];
2822
2823 sprintf(sizeString, "%d", maxSize - totalSize);
2824 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
2825 }
2826 if(context)
2827 FinishTemplatesContext(context);
2828 return topMember ? topMember->memberID : _class->memberID;
2829 }
2830
2831 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2832 {
2833 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2834 unsigned int totalSize = 0;
2835 struct __ecereNameSpace__ecere__com__DataMember * member;
2836 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2837
2838 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
2839 DeclareMembers(_class->base, 0x0);
2840 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2841 {
2842 if(!member->isProperty)
2843 {
2844 switch(member->type)
2845 {
2846 case 0:
2847 {
2848 if(!member->dataType && member->dataTypeString)
2849 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
2850 if(member->dataType)
2851 DeclareType(member->dataType, 0x0, 0x0);
2852 break;
2853 }
2854 case 1:
2855 case 2:
2856 {
2857 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
2858 break;
2859 }
2860 }
2861 }
2862 }
2863 if(context)
2864 FinishTemplatesContext(context);
2865 return topMember ? topMember->memberID : _class->memberID;
2866 }
2867
2868 extern struct Symbol * FindClass(char *  name);
2869
2870 extern char *  strchr(char * , int);
2871
2872 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
2873
2874 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (* )(void * ));
2875
2876 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
2877
2878 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
2879
2880 extern char *  strcpy(char * , const char * );
2881
2882 extern void MangleClassName(char *  className);
2883
2884 extern void DeclareClass(struct Symbol * classSym, char *  className);
2885
2886 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
2887
2888 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
2889
2890 void DeclareStruct(char * name, unsigned int skipNoHead)
2891 {
2892 struct External * external = (((void *)0));
2893 struct Symbol * classSym = FindClass(name);
2894
2895 if(!inCompiler || !classSym)
2896 return (((void *)0));
2897 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
2898 return (((void *)0));
2899 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
2900 {
2901 struct Declaration * decl;
2902 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
2903 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
2904 char structName[1024];
2905
2906 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
2907 classSym->declaring++;
2908 if(strchr(classSym->string, '<'))
2909 {
2910 if(classSym->registered->templateClass)
2911 {
2912 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
2913 classSym->declaring--;
2914 }
2915 return (((void *)0));
2916 }
2917 DeclareMembers(classSym->registered, 0x0);
2918 structName[0] = (char)0;
2919 FullClassNameCat(structName, name, 0x0);
2920 if(!skipNoHead)
2921 {
2922 classSym->declaredStructSym = 0x1;
2923 declarations = MkList();
2924 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered);
2925 if(!(*declarations).count)
2926 {
2927 FreeList(declarations, (((void *)0)));
2928 declarations = (((void *)0));
2929 }
2930 }
2931 if(skipNoHead || declarations)
2932 {
2933 if(external && external->declaration)
2934 {
2935 ((struct Specifier *)(*external->declaration->specifiers).first)->definitions = declarations;
2936 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2937 {
2938 if(classSym->structExternal)
2939 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2940 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2941 classSym->id = curExternal->symbol->idCode;
2942 classSym->idCode = curExternal->symbol->idCode;
2943 }
2944 }
2945 else
2946 {
2947 if(!external)
2948 external = MkExternalDeclaration((((void *)0)));
2949 specifiers = MkList();
2950 declarators = MkList();
2951 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
2952 external->declaration = decl = MkDeclaration(specifiers, declarators);
2953 if(decl->symbol && !decl->symbol->pointerExternal)
2954 decl->symbol->pointerExternal = external;
2955 if(classSym->registered && classSym->registered->type == 1)
2956 {
2957 char className[1024];
2958
2959 strcpy(className, "__ecereClass_");
2960 FullClassNameCat(className, classSym->string, 0x1);
2961 MangleClassName(className);
2962 DeclareClass(classSym, className);
2963 external->symbol = classSym;
2964 classSym->pointerExternal = external;
2965 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2966 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
2967 }
2968 else
2969 {
2970 char className[1024];
2971
2972 strcpy(className, "__ecereClass_");
2973 FullClassNameCat(className, classSym->string, 0x1);
2974 MangleClassName(className);
2975 classSym->structExternal = external;
2976 DeclareClass(classSym, className);
2977 external->symbol = classSym;
2978 }
2979 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
2980 }
2981 }
2982 classSym->declaring--;
2983 }
2984 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
2985 {
2986 classSym->declaring++;
2987 {
2988 if(classSym->registered)
2989 DeclareMembers(classSym->registered, 0x0);
2990 }
2991 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
2992 {
2993 if(classSym->structExternal)
2994 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
2995 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
2996 classSym->id = curExternal->symbol->idCode;
2997 classSym->idCode = curExternal->symbol->idCode;
2998 }
2999 classSym->declaring--;
3000 }
3001 }
3002
3003 extern char *  strcat(char * , const char * );
3004
3005 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3006
3007 extern struct ModuleImport * mainModule;
3008
3009 extern struct Specifier * MkSpecifierName(char *  name);
3010
3011 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3012
3013 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3014
3015 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3016
3017 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3018
3019 extern void FreeDeclarator(struct Declarator * decl);
3020
3021 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3022
3023 struct PropertyImport
3024 {
3025 struct PropertyImport * prev;
3026 struct PropertyImport * next;
3027 char *  name;
3028 unsigned int isVirtual;
3029 unsigned int hasSet;
3030 unsigned int hasGet;
3031 } __attribute__ ((gcc_struct));
3032
3033 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3034
3035 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3036 {
3037 void * __ecereTemp1;
3038 struct Symbol * symbol = prop->symbol;
3039 char propName[1024];
3040
3041 strcpy(setName, "__ecereProp_");
3042 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3043 strcat(setName, "_Set_");
3044 FullClassNameCat(setName, prop->name, 0x1);
3045 strcpy(getName, "__ecereProp_");
3046 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3047 strcat(getName, "_Get_");
3048 FullClassNameCat(getName, prop->name, 0x1);
3049 strcpy(propName, "__ecereProp_");
3050 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3051 strcat(propName, "_");
3052 FullClassNameCat(propName, prop->name, 0x1);
3053 MangleClassName(getName);
3054 MangleClassName(setName);
3055 MangleClassName(propName);
3056 if(prop->_class->type == 1)
3057 DeclareStruct(prop->_class->fullName, 0x0);
3058 if(!symbol || curExternal->symbol->idCode < symbol->id)
3059 {
3060 unsigned int imported = 0x0;
3061 unsigned int dllImport = 0x0;
3062
3063 if(!symbol || symbol->_import)
3064 {
3065 if(!symbol)
3066 {
3067 struct Symbol * classSym;
3068
3069 if(!prop->_class->symbol)
3070 prop->_class->symbol = FindClass(prop->_class->fullName);
3071 classSym = prop->_class->symbol;
3072 if(classSym && !classSym->_import)
3073 {
3074 struct ModuleImport * module;
3075
3076 if(prop->_class->module)
3077 module = FindModule(prop->_class->module);
3078 else
3079 module = mainModule;
3080 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = prop->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
3081 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3082 }
3083 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3084 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport), ((struct PropertyImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), ((struct PropertyImport *)__ecereTemp1)->isVirtual = 0x0, ((struct PropertyImport *)__ecereTemp1)->hasSet = prop->Set ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1)->hasGet = prop->Get ? 0x1 : 0x0, ((struct PropertyImport *)__ecereTemp1));
3085 if(classSym)
3086 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3087 }
3088 imported = 0x1;
3089 if(prop->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 12)))->importType != 1)
3090 dllImport = 0x1;
3091 }
3092 if(!symbol->type)
3093 {
3094 struct Context * context = SetupTemplatesContext(prop->_class);
3095
3096 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3097 FinishTemplatesContext(context);
3098 }
3099 if(prop->Get)
3100 {
3101 if(!symbol->externalGet || symbol->externalGet->type == 0)
3102 {
3103 struct Declaration * decl;
3104 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3105 struct Declarator * d;
3106 struct __ecereNameSpace__ecere__sys__OldList * params;
3107 struct Specifier * spec;
3108 struct External * external;
3109 struct Declarator * typeDecl;
3110 unsigned int simple = 0x0;
3111
3112 specifiers = MkList();
3113 declarators = MkList();
3114 params = MkList();
3115 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3116 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3117 if(dllImport)
3118 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3119 {
3120 struct Context * context = SetupTemplatesContext(prop->_class);
3121
3122 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3123 FinishTemplatesContext(context);
3124 }
3125 for(spec = (*specifiers).first; spec; spec = spec->next)
3126 {
3127 if(spec->type == 1)
3128 {
3129 if((!typeDecl || typeDecl->type == 1))
3130 {
3131 struct Symbol * classSym = spec->symbol;
3132
3133 symbol->_class = classSym->registered;
3134 if(classSym->registered && classSym->registered->type == 1)
3135 {
3136 DeclareStruct(spec->name, 0x0);
3137 simple = 0x1;
3138 }
3139 }
3140 }
3141 }
3142 if(!simple)
3143 d = PlugDeclarator(typeDecl, d);
3144 else
3145 {
3146 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3147 specifiers = MkList();
3148 }
3149 d = MkDeclaratorFunction(d, params);
3150 if(dllImport)
3151 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3152 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3153 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3154 if(simple)
3155 ListAdd(specifiers, MkSpecifier(VOID));
3156 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3157 decl = MkDeclaration(specifiers, declarators);
3158 external = MkExternalDeclaration(decl);
3159 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3160 external->symbol = symbol;
3161 symbol->externalGet = external;
3162 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3163 if(typeDecl)
3164 FreeDeclarator(typeDecl);
3165 }
3166 else
3167 {
3168 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3169 }
3170 }
3171 if(prop->Set)
3172 {
3173 if(!symbol->externalSet || symbol->externalSet->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
3183 declarators = MkList();
3184 params = MkList();
3185 if(!prop->conversion || prop->_class->type == 1)
3186 {
3187 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3188 }
3189 specifiers = MkList();
3190 {
3191 struct Context * context = SetupTemplatesContext(prop->_class);
3192
3193 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3194 FinishTemplatesContext(context);
3195 }
3196 ListAdd(params, MkTypeName(specifiers, d));
3197 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3198 if(dllImport)
3199 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3200 d = MkDeclaratorFunction(d, params);
3201 for(spec = (*specifiers).first; spec; spec = spec->next)
3202 {
3203 if(spec->type == 1)
3204 {
3205 if((!typeDecl || typeDecl->type == 1))
3206 {
3207 struct Symbol * classSym = spec->symbol;
3208
3209 symbol->_class = classSym->registered;
3210 if(classSym->registered && classSym->registered->type == 1)
3211 DeclareStruct(spec->name, 0x0);
3212 }
3213 }
3214 }
3215 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3216 specifiers = MkList();
3217 if(dllImport)
3218 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3219 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3220 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3221 if(!prop->conversion || prop->_class->type == 1)
3222 ListAdd(specifiers, MkSpecifier(VOID));
3223 else
3224 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3225 decl = MkDeclaration(specifiers, declarators);
3226 external = MkExternalDeclaration(decl);
3227 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3228 external->symbol = symbol;
3229 symbol->externalSet = external;
3230 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3231 }
3232 else
3233 {
3234 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3235 }
3236 }
3237 if(!symbol->externalPtr)
3238 {
3239 struct Declaration * decl;
3240 struct External * external;
3241 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3242
3243 if(imported)
3244 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3245 else
3246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3247 ListAdd(specifiers, MkSpecifierName("Property"));
3248 {
3249 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3250
3251 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3252 if(!imported)
3253 {
3254 strcpy(propName, "__ecerePropM_");
3255 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3256 strcat(propName, "_");
3257 FullClassNameCat(propName, prop->name, 0x1);
3258 MangleClassName(propName);
3259 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3260 }
3261 decl = MkDeclaration(specifiers, list);
3262 }
3263 external = MkExternalDeclaration(decl);
3264 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3265 external->symbol = symbol;
3266 symbol->externalPtr = external;
3267 }
3268 else
3269 {
3270 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3271 }
3272 symbol->id = curExternal->symbol->idCode;
3273 }
3274 }
3275
3276 struct Type * Dereference(struct Type * source)
3277 {
3278 void * __ecereTemp1;
3279 struct Type * type = (((void *)0));
3280
3281 if(source)
3282 {
3283 if(source->kind == 13 || source->kind == 12)
3284 {
3285 type = source->type;
3286 source->type->refCount++;
3287 }
3288 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3289 {
3290 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3291 }
3292 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3293 {
3294 type = source;
3295 source->refCount++;
3296 }
3297 else
3298 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot dereference type\n", (((void *)0))));
3299 }
3300 return type;
3301 }
3302
3303 static struct Type * Reference(struct Type * source)
3304 {
3305 void * __ecereTemp1;
3306 struct Type * type = (((void *)0));
3307
3308 if(source)
3309 {
3310 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = source, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
3311 source->refCount++;
3312 }
3313 return type;
3314 }
3315
3316 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);
3317
3318 extern void *  memcpy(void * , const void * , unsigned int size);
3319
3320 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3321
3322 extern void FreeExpression(struct Expression * exp);
3323
3324 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3325
3326 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);
3327
3328 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3329
3330 extern struct Type * MkClassType(char *  name);
3331
3332 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);
3333
3334 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)
3335 {
3336 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3337 unsigned int found = 0x0;
3338 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3339 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3340 unsigned int freeType = 0x0;
3341
3342 yylloc = member->loc;
3343 if(!ident)
3344 {
3345 if(curMember)
3346 {
3347 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3348 if(*curMember)
3349 {
3350 found = 0x1;
3351 dataMember = *curMember;
3352 }
3353 }
3354 }
3355 else
3356 {
3357 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3358 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3359 int _subMemberStackPos = 0;
3360
3361 if(!thisMember)
3362 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3363 if(thisMember)
3364 {
3365 dataMember = thisMember;
3366 if(curMember && thisMember->memberAccess == 1)
3367 {
3368 *curMember = thisMember;
3369 *curClass = thisMember->_class;
3370 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
3371 *subMemberStackPos = _subMemberStackPos;
3372 }
3373 found = 0x1;
3374 }
3375 else
3376 {
3377 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3378 if(method && method->type == 1)
3379 found = 0x1;
3380 else
3381 method = (((void *)0));
3382 }
3383 }
3384 if(found)
3385 {
3386 struct Type * type = (((void *)0));
3387
3388 if(dataMember)
3389 {
3390 if(!dataMember->dataType && dataMember->dataTypeString)
3391 {
3392 struct Context * context = SetupTemplatesContext(_class);
3393
3394 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3395 FinishTemplatesContext(context);
3396 }
3397 type = dataMember->dataType;
3398 }
3399 else if(method)
3400 {
3401 if(!method->dataType)
3402 ProcessMethodType(method);
3403 type = method->dataType;
3404 }
3405 if(ident && ident->next)
3406 {
3407 for(ident = ident->next; ident && type; ident = ident->next)
3408 {
3409 if(type->kind == 8)
3410 {
3411 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3412 if(!dataMember)
3413 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3414 if(dataMember)
3415 type = dataMember->dataType;
3416 }
3417 else if(type->kind == 9 || type->kind == 10)
3418 {
3419 struct Type * memberType;
3420
3421 for(memberType = type->members.first; memberType; memberType = memberType->next)
3422 {
3423 if(!strcmp(memberType->name, ident->string))
3424 {
3425 type = memberType;
3426 break;
3427 }
3428 }
3429 }
3430 }
3431 }
3432 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3433 {
3434 int id = 0;
3435 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3436 struct __ecereNameSpace__ecere__com__Class * sClass;
3437
3438 for(sClass = _class; sClass; sClass = sClass->base)
3439 {
3440 id = 0;
3441 if(sClass->templateClass)
3442 sClass = sClass->templateClass;
3443 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3444 {
3445 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3446 {
3447 for(sClass = sClass->base; sClass; sClass = sClass->base)
3448 {
3449 if(sClass->templateClass)
3450 sClass = sClass->templateClass;
3451 id += sClass->templateParams.count;
3452 }
3453 break;
3454 }
3455 id++;
3456 }
3457 if(curParam)
3458 break;
3459 }
3460 if(curParam)
3461 {
3462 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3463
3464 if(arg.dataTypeString)
3465 {
3466 type = ProcessTypeString(arg.dataTypeString, 0x0);
3467 freeType = 0x1;
3468 if(type && _class->templateClass)
3469 type->passAsTemplate = 0x1;
3470 if(type)
3471 {
3472 }
3473 }
3474 }
3475 }
3476 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3477 {
3478 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3479 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3480 int c;
3481 int paramCount = 0;
3482 int lastParam = -1;
3483 char templateString[1024];
3484 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3485
3486 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3487 for(cClass = expClass; cClass; cClass = cClass->base)
3488 {
3489 int p = 0;
3490
3491 if(cClass->templateClass)
3492 cClass = cClass->templateClass;
3493 for(param = cClass->templateParams.first; param; param = param->next)
3494 {
3495 int id = p;
3496 struct __ecereNameSpace__ecere__com__Class * sClass;
3497 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3498
3499 for(sClass = cClass->base; sClass; sClass = sClass->base)
3500 {
3501 if(sClass->templateClass)
3502 sClass = sClass->templateClass;
3503 id += sClass->templateParams.count;
3504 }
3505 arg = expClass->templateArgs[id];
3506 for(sClass = _class; sClass; sClass = sClass->base)
3507 {
3508 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3509 int p = 0;
3510 struct __ecereNameSpace__ecere__com__Class * nextClass;
3511
3512 if(sClass->templateClass)
3513 sClass = sClass->templateClass;
3514 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3515 {
3516 if(nextClass->templateClass)
3517 nextClass = nextClass->templateClass;
3518 p += nextClass->templateParams.count;
3519 }
3520 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3521 {
3522 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3523 {
3524 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3525 {
3526 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3527 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3528 break;
3529 }
3530 }
3531 }
3532 }
3533 {
3534 char argument[256];
3535
3536 argument[0] = '\0';
3537 switch(param->type)
3538 {
3539 case 2:
3540 {
3541 char expString[1024];
3542 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3543 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3544 struct Expression * exp;
3545 char * string = PrintHexUInt64(arg.expression.ui64);
3546
3547 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3548 ProcessExpressionType(exp);
3549 ComputeExpression(exp);
3550 expString[0] = '\0';
3551 PrintExpression(exp, expString);
3552 strcat(argument, expString);
3553 FreeExpression(exp);
3554 break;
3555 }
3556 case 1:
3557 {
3558 strcat(argument, arg.member->name);
3559 break;
3560 }
3561 case 0:
3562 {
3563 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3564 strcat(argument, arg.dataTypeString);
3565 break;
3566 }
3567 }
3568 if(argument[0])
3569 {
3570 if(paramCount)
3571 strcat(templateString, ", ");
3572 if(lastParam != p - 1)
3573 {
3574 strcat(templateString, param->name);
3575 strcat(templateString, " = ");
3576 }
3577 strcat(templateString, argument);
3578 paramCount++;
3579 lastParam = p;
3580 }
3581 p++;
3582 }
3583 }
3584 }
3585 {
3586 int len = strlen(templateString);
3587
3588 if(templateString[len - 1] == '<')
3589 len--;
3590 else
3591 {
3592 if(templateString[len - 1] == '>')
3593 templateString[len++] = ' ';
3594 templateString[len++] = '>';
3595 }
3596 templateString[len++] = '\0';
3597 }
3598 {
3599 struct Context * context = SetupTemplatesContext(_class);
3600
3601 if(freeType)
3602 FreeType(type);
3603 type = ProcessTypeString(templateString, 0x0);
3604 freeType = 0x1;
3605 FinishTemplatesContext(context);
3606 }
3607 }
3608 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3609 {
3610 ProcessExpressionType(member->initializer->exp);
3611 if(!member->initializer->exp->expType)
3612 {
3613 if(inCompiler)
3614 {
3615 char expString[10240];
3616
3617 expString[0] = '\0';
3618 PrintExpression(member->initializer->exp, expString);
3619 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3620 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3621 }
3622 }
3623 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3624 {
3625 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible instance method %s\n", (((void *)0))), ident->string);
3626 }
3627 }
3628 else if(member->initializer)
3629 {
3630 ProcessInitializer(member->initializer, type);
3631 }
3632 if(freeType)
3633 FreeType(type);
3634 }
3635 else
3636 {
3637 if(_class && _class->type == 3)
3638 {
3639 if(member->initializer)
3640 {
3641 struct Type * type = MkClassType(_class->fullName);
3642
3643 ProcessInitializer(member->initializer, type);
3644 FreeType(type);
3645 }
3646 }
3647 else
3648 {
3649 if(member->initializer)
3650 {
3651 ProcessInitializer(member->initializer, (((void *)0)));
3652 }
3653 if(ident)
3654 {
3655 if(method)
3656 {
3657 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3658 }
3659 else if(_class)
3660 {
3661 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3662 if(inCompiler)
3663 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3664 }
3665 }
3666 else if(_class)
3667 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3668 }
3669 }
3670 }
3671
3672 extern struct Identifier * GetDeclId(struct Declarator * decl);
3673
3674 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);
3675
3676 extern void FreeSpecifier(struct Specifier * spec);
3677
3678 static void ProcessFunction(struct FunctionDefinition * function);
3679
3680 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (* )(void * ));
3681
3682 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3683
3684 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3685
3686 extern void FreeClassFunction(struct ClassFunction * func);
3687
3688 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3689
3690 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3691
3692 void ProcessInstantiationType(struct Instantiation * inst)
3693 {
3694 yylloc = inst->loc;
3695 if(inst->_class)
3696 {
3697 struct MembersInit * members;
3698 struct Symbol * classSym;
3699 struct __ecereNameSpace__ecere__com__Class * _class;
3700
3701 classSym = inst->_class->symbol;
3702 _class = classSym ? classSym->registered : (((void *)0));
3703 if(!_class || _class->type != 5)
3704 DeclareStruct(inst->_class->name, 0x0);
3705 afterExternal = afterExternal ? afterExternal : curExternal;
3706 if(inst->exp)
3707 ProcessExpressionType(inst->exp);
3708 inst->isConstant = 0x1;
3709 if(inst->members)
3710 {
3711 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3712 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3713 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3714 int subMemberStackPos = 0;
3715
3716 for(members = (*inst->members).first; members; members = members->next)
3717 {
3718 switch(members->type)
3719 {
3720 case 1:
3721 {
3722 char name[1024];
3723 static unsigned int instMethodID = 0;
3724 struct External * external = curExternal;
3725 struct Context * context = curContext;
3726 struct Declarator * declarator = members->function->declarator;
3727 struct Identifier * nameID = GetDeclId(declarator);
3728 char * unmangled = nameID ? nameID->string : (((void *)0));
3729 struct Expression * exp;
3730 struct External * createdExternal = (((void *)0));
3731
3732 if(inCompiler)
3733 {
3734 char number[16];
3735
3736 strcpy(name, "__ecereInstMeth_");
3737 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3738 strcat(name, "_");
3739 strcat(name, nameID->string);
3740 strcat(name, "_");
3741 sprintf(number, "_%08d", instMethodID++);
3742 strcat(name, number);
3743 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3744 }
3745 if(declarator)
3746 {
3747 struct Symbol * symbol = declarator->symbol;
3748 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3749
3750 if(method && method->type == 1)
3751 {
3752 symbol->method = method;
3753 ProcessMethodType(method);
3754 if(!symbol->type->thisClass)
3755 {
3756 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3757 {
3758 if(!currentClass->symbol)
3759 currentClass->symbol = FindClass(currentClass->fullName);
3760 symbol->type->thisClass = currentClass->symbol;
3761 }
3762 else
3763 {
3764 if(!_class->symbol)
3765 _class->symbol = FindClass(_class->fullName);
3766 symbol->type->thisClass = _class->symbol;
3767 }
3768 }
3769 DeclareType(symbol->type, 0x1, 0x1);
3770 }
3771 else if(classSym)
3772 {
3773 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
3774 }
3775 }
3776 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
3777 if(nameID)
3778 {
3779 FreeSpecifier(nameID->_class);
3780 nameID->_class = (((void *)0));
3781 }
3782 if(inCompiler)
3783 {
3784 struct Type * type = declarator->symbol->type;
3785 struct External * oldExternal = curExternal;
3786
3787 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
3788 {
3789 struct External * externalDecl;
3790
3791 externalDecl = MkExternalDeclaration((((void *)0)));
3792 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
3793 if(createdExternal->function)
3794 {
3795 ProcessFunction(createdExternal->function);
3796 {
3797 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
3798
3799 externalDecl->declaration = decl;
3800 if(decl->symbol && !decl->symbol->pointerExternal)
3801 decl->symbol->pointerExternal = externalDecl;
3802 declarator->symbol->pointerExternal = externalDecl;
3803 }
3804 }
3805 }
3806 }
3807 else if(declarator)
3808 {
3809 curExternal = declarator->symbol->pointerExternal;
3810 ProcessFunction((struct FunctionDefinition *)members->function);
3811 }
3812 curExternal = external;
3813 curContext = context;
3814 if(inCompiler)
3815 {
3816 FreeClassFunction(members->function);
3817 exp = QMkExpId(name);
3818 members->type = 0;
3819 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
3820 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
3821 }
3822 break;
3823 }
3824 case 0:
3825 {
3826 if(members->dataMembers && classSym)
3827 {
3828 struct MemberInit * member;
3829 struct Location oldyyloc = yylloc;
3830
3831 for(member = (*members->dataMembers).first; member; member = member->next)
3832 {
3833 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
3834 if(member->initializer && !member->initializer->isConstant)
3835 inst->isConstant = 0x0;
3836 }
3837 yylloc = oldyyloc;
3838 }
3839 break;
3840 }
3841 }
3842 }
3843 }
3844 }
3845 }
3846
3847 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
3848 {
3849 if(inCompiler)
3850 {
3851 if(type->kind == 11)
3852 {
3853 struct Type * param;
3854
3855 if(declareParams)
3856 {
3857 for(param = type->params.first; param; param = param->next)
3858 DeclareType(param, declarePointers, 0x1);
3859 }
3860 DeclareType(type->returnType, declarePointers, 0x1);
3861 }
3862 else if(type->kind == 13 && declarePointers)
3863 DeclareType(type->type, declarePointers, 0x0);
3864 else if(type->kind == 8)
3865 {
3866 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
3867 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
3868 }
3869 else if(type->kind == 9 || type->kind == 10)
3870 {
3871 struct Type * member;
3872
3873 for(member = type->members.first; member; member = member->next)
3874 DeclareType(member, 0x0, 0x0);
3875 }
3876 else if(type->kind == 12)
3877 DeclareType(type->arrayType, declarePointers, 0x0);
3878 }
3879 }
3880
3881 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
3882
3883 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
3884 {
3885 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
3886 int id = 0;
3887 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3888 struct __ecereNameSpace__ecere__com__Class * sClass;
3889
3890 for(sClass = _class; sClass; sClass = sClass->base)
3891 {
3892 id = 0;
3893 if(sClass->templateClass)
3894 sClass = sClass->templateClass;
3895 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3896 {
3897 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
3898 {
3899 for(sClass = sClass->base; sClass; sClass = sClass->base)
3900 {
3901 if(sClass->templateClass)
3902 sClass = sClass->templateClass;
3903 id += sClass->templateParams.count;
3904 }
3905 break;
3906 }
3907 id++;
3908 }
3909 if(curParam)
3910 break;
3911 }
3912 if(curParam)
3913 {
3914 arg = &_class->templateArgs[id];
3915 if(arg && param->type == 0)
3916 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
3917 }
3918 return arg;
3919 }
3920
3921 extern struct Context * PushContext(void);
3922
3923 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
3924
3925 struct TemplatedType
3926 {
3927 uintptr_t key;
3928 struct __ecereNameSpace__ecere__sys__BTNode * parent;
3929 struct __ecereNameSpace__ecere__sys__BTNode * left;
3930 struct __ecereNameSpace__ecere__sys__BTNode * right;
3931 int depth;
3932 struct TemplateParameter * param;
3933 } __attribute__ ((gcc_struct));
3934
3935 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
3936
3937 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
3938 {
3939 void * __ecereTemp1;
3940 struct Context * context = PushContext();
3941
3942 context->templateTypesOnly = 0x1;
3943 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
3944 {
3945 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
3946
3947 for(; param; param = param->next)
3948 {
3949 if(param->type == 0 && param->identifier)
3950 {
3951 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
3952
3953 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3954 }
3955 }
3956 }
3957 else if(_class)
3958 {
3959 struct __ecereNameSpace__ecere__com__Class * sClass;
3960
3961 for(sClass = _class; sClass; sClass = sClass->base)
3962 {
3963 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
3964
3965 for(p = sClass->templateParams.first; p; p = p->next)
3966 {
3967 if(p->type == 0)
3968 {
3969 struct TemplateParameter * param = p->param;
3970 struct TemplatedType * type;
3971
3972 if(!param)
3973 {
3974 p->param = param = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter), ((struct TemplateParameter *)__ecereTemp1)->identifier = MkIdentifier(p->name), ((struct TemplateParameter *)__ecereTemp1)->type = p->type, ((struct TemplateParameter *)__ecereTemp1)->dataTypeString = p->dataTypeString, ((struct TemplateParameter *)__ecereTemp1));
3975 }
3976 type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), ((struct TemplatedType *)__ecereTemp1)->key = (uintptr_t)p->name, ((struct TemplatedType *)__ecereTemp1)->param = param, ((struct TemplatedType *)__ecereTemp1));
3977 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
3978 }
3979 }
3980 }
3981 }
3982 return context;
3983 }
3984
3985 extern void PopContext(struct Context * ctx);
3986
3987 extern void FreeContext(struct Context * context);
3988
3989 void FinishTemplatesContext(struct Context * context)
3990 {
3991 PopContext(context);
3992 FreeContext(context);
3993 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
3994 }
3995
3996 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
3997 {
3998 if(!method->dataType)
3999 {
4000 struct Context * context = SetupTemplatesContext(method->_class);
4001
4002 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4003 FinishTemplatesContext(context);
4004 if(method->type != 1 && method->dataType)
4005 {
4006 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4007 {
4008 if(!method->_class->symbol)
4009 method->_class->symbol = FindClass(method->_class->fullName);
4010 method->dataType->thisClass = method->_class->symbol;
4011 }
4012 }
4013 }
4014 }
4015
4016 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4017 {
4018 if(!prop->dataType)
4019 {
4020 struct Context * context = SetupTemplatesContext(prop->_class);
4021
4022 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4023 FinishTemplatesContext(context);
4024 }
4025 }
4026
4027 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4028
4029 extern void FreeTypeName(struct TypeName * typeName);
4030
4031 static void ProcessDeclarator(struct Declarator * decl);
4032
4033 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4034
4035 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4036
4037 struct MethodImport
4038 {
4039 struct MethodImport * prev;
4040 struct MethodImport * next;
4041 char *  name;
4042 unsigned int isVirtual;
4043 } __attribute__ ((gcc_struct));
4044
4045 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4046
4047 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4048 {
4049 void * __ecereTemp1;
4050 struct Symbol * symbol = method->symbol;
4051
4052 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4053 {
4054 unsigned int imported = 0x0;
4055 unsigned int dllImport = 0x0;
4056
4057 if(!method->dataType)
4058 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4059 if(!symbol || symbol->_import || method->type == 1)
4060 {
4061 if(!symbol || method->type == 1)
4062 {
4063 struct Symbol * classSym;
4064
4065 if(!method->_class->symbol)
4066 method->_class->symbol = FindClass(method->_class->fullName);
4067 classSym = method->_class->symbol;
4068 if(!classSym->_import)
4069 {
4070 struct ModuleImport * module;
4071
4072 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->name)
4073 module = FindModule(method->_class->module);
4074 else
4075 module = mainModule;
4076 classSym->_import = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport), ((struct ClassImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), ((struct ClassImport *)__ecereTemp1)->isRemote = method->_class->isRemote, ((struct ClassImport *)__ecereTemp1));
4077 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4078 }
4079 if(!symbol)
4080 {
4081 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4082 }
4083 if(!symbol->_import)
4084 {
4085 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport), ((struct MethodImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(method->name), ((struct MethodImport *)__ecereTemp1)->isVirtual = method->type == 1, ((struct MethodImport *)__ecereTemp1));
4086 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4087 }
4088 if(!symbol)
4089 {
4090 symbol->type = method->dataType;
4091 if(symbol->type)
4092 symbol->type->refCount++;
4093 }
4094 }
4095 if(!method->dataType->dllExport)
4096 {
4097 imported = 0x1;
4098 if(method->_class->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 12)))->importType != 1)
4099 dllImport = 0x1;
4100 }
4101 }
4102 if(method->type != 1 && method->dataType)
4103 DeclareType(method->dataType, 0x1, 0x1);
4104 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4105 {
4106 struct Declaration * decl;
4107 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4108 struct Declarator * d;
4109 struct Declarator * funcDecl;
4110 struct External * external;
4111
4112 specifiers = MkList();
4113 declarators = MkList();
4114 if(dllImport)
4115 ListAdd(specifiers, MkSpecifier(EXTERN));
4116 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4117 ListAdd(specifiers, MkSpecifier(STATIC));
4118 if(method->type == 1)
4119 {
4120 ListAdd(specifiers, MkSpecifier(INT));
4121 d = MkDeclaratorIdentifier(MkIdentifier(name));
4122 }
4123 else
4124 {
4125 d = MkDeclaratorIdentifier(MkIdentifier(name));
4126 if(dllImport)
4127 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4128 {
4129 struct Context * context = SetupTemplatesContext(method->_class);
4130
4131 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4132 FinishTemplatesContext(context);
4133 }
4134 funcDecl = GetFuncDecl(d);
4135 if(dllImport)
4136 {
4137 struct Specifier * spec, * next;
4138
4139 for(spec = (*specifiers).first; spec; spec = next)
4140 {
4141 next = spec->next;
4142 if(spec->type == 5)
4143 {
4144 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4145 FreeSpecifier(spec);
4146 }
4147 }
4148 }
4149 if(method->dataType && !method->dataType->staticMethod)
4150 {
4151 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4152 {
4153 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4154 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")));
4155 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4156 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4157
4158 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4159 {
4160 struct TypeName * param = (*funcDecl->function.parameters).first;
4161
4162 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4163 FreeTypeName(param);
4164 }
4165 if(!funcDecl->function.parameters)
4166 funcDecl->function.parameters = MkList();
4167 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4168 }
4169 }
4170 }
4171 ProcessDeclarator(d);
4172 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4173 decl = MkDeclaration(specifiers, declarators);
4174 ReplaceThisClassSpecifiers(specifiers, method->_class);
4175 if(symbol->pointerExternal)
4176 {
4177 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4178
4179 {
4180 *functionSymbol = *symbol;
4181 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4182 if(functionSymbol->type)
4183 functionSymbol->type->refCount++;
4184 }
4185 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4186 symbol->pointerExternal->symbol = functionSymbol;
4187 }
4188 external = MkExternalDeclaration(decl);
4189 if(curExternal)
4190 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4191 external->symbol = symbol;
4192 symbol->pointerExternal = external;
4193 }
4194 else if(ast)
4195 {
4196 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4197 }
4198 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4199 }
4200 }
4201
4202 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4203 {
4204 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4205 {
4206 unsigned int first = 0x1;
4207 int p = 0;
4208 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4209 int lastParam = -1;
4210 char className[1024];
4211
4212 strcpy(className, _class->fullName);
4213 for(param = _class->templateParams.first; param; param = param->next)
4214 {
4215 {
4216 if(first)
4217 strcat(className, "<");
4218 if(!first)
4219 strcat(className, ", ");
4220 if(lastParam + 1 != p)
4221 {
4222 strcat(className, param->name);
4223 strcat(className, " = ");
4224 }
4225 strcat(className, param->name);
4226 first = 0x0;
4227 lastParam = p;
4228 }
4229 p++;
4230 }
4231 if(!first)
4232 {
4233 int len = strlen(className);
4234
4235 if(className[len - 1] == '>')
4236 className[len++] = ' ';
4237 className[len++] = '>';
4238 className[len++] = '\0';
4239 }
4240 return __ecereNameSpace__ecere__sys__CopyString(className);
4241 }
4242 else
4243 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4244 }
4245
4246 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4247 {
4248 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4249 {
4250 unsigned int first = 0x1;
4251 int p = 0;
4252 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4253 int lastParam = -1;
4254 char className[1024];
4255
4256 strcpy(className, _class->fullName);
4257 for(param = _class->templateParams.first; param; param = param->next)
4258 {
4259 {
4260 if(first)
4261 strcat(className, "<");
4262 if(!first)
4263 strcat(className, ", ");
4264 if(lastParam + 1 != p)
4265 {
4266 strcat(className, param->name);
4267 strcat(className, " = ");
4268 }
4269 strcat(className, param->name);
4270 first = 0x0;
4271 lastParam = p;
4272 }
4273 p++;
4274 }
4275 if(!first)
4276 {
4277 int len = strlen(className);
4278
4279 if(className[len - 1] == '>')
4280 className[len++] = ' ';
4281 className[len++] = '>';
4282 className[len++] = '\0';
4283 }
4284 return MkClassType(className);
4285 }
4286 else
4287 {
4288 return MkClassType(_class->fullName);
4289 }
4290 }
4291
4292 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4293 {
4294 if(specs != (((void *)0)) && _class)
4295 {
4296 struct Specifier * spec;
4297
4298 for(spec = specs->first; spec; spec = spec->next)
4299 {
4300 if(spec->type == 0 && spec->specifier == THISCLASS)
4301 {
4302 spec->type = 1;
4303 spec->name = ReplaceThisClass(_class);
4304 spec->symbol = FindClass(spec->name);
4305 }
4306 }
4307 }
4308 }
4309
4310 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4311
4312 struct __ecereNameSpace__ecere__com__GlobalFunction
4313 {
4314 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4315 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4316 char *  name;
4317 int (*  function)();
4318 struct __ecereNameSpace__ecere__com__Instance * module;
4319 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4320 char *  dataTypeString;
4321 struct Type * dataType;
4322 void *  symbol;
4323 } __attribute__ ((gcc_struct));
4324
4325 extern struct Context * globalContext;
4326
4327 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4328
4329 struct FunctionImport
4330 {
4331 struct FunctionImport * prev;
4332 struct FunctionImport * next;
4333 char *  name;
4334 } __attribute__ ((gcc_struct));
4335
4336 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4337 {
4338 void * __ecereTemp1;
4339 struct Symbol * symbol = function->symbol;
4340
4341 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4342 {
4343 unsigned int imported = 0x0;
4344 unsigned int dllImport = 0x0;
4345
4346 if(!function->dataType)
4347 {
4348 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4349 if(!function->dataType->thisClass)
4350 function->dataType->staticMethod = 0x1;
4351 }
4352 if(inCompiler)
4353 {
4354 if(!symbol)
4355 {
4356 struct ModuleImport * module = FindModule(function->module);
4357
4358 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4359 if(module->name)
4360 {
4361 if(!function->dataType->dllExport)
4362 {
4363 symbol->_import = (struct ClassImport *)(__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport), ((struct FunctionImport *)__ecereTemp1)->name = __ecereNameSpace__ecere__sys__CopyString(function->name), ((struct FunctionImport *)__ecereTemp1));
4364 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4365 }
4366 }
4367 {
4368 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4369 if(!symbol->type->thisClass)
4370 symbol->type->staticMethod = 0x1;
4371 }
4372 }
4373 imported = symbol->_import ? 0x1 : 0x0;
4374 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1)
4375 dllImport = 0x1;
4376 }
4377 DeclareType(function->dataType, 0x1, 0x1);
4378 if(inCompiler)
4379 {
4380 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4381 {
4382 struct Declaration * decl;
4383 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4384 struct Declarator * d;
4385 struct Declarator * funcDecl;
4386 struct External * external;
4387
4388 specifiers = MkList();
4389 declarators = MkList();
4390 ListAdd(specifiers, MkSpecifier(EXTERN));
4391 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4392 if(dllImport)
4393 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4394 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4395 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType == 1)
4396 {
4397 struct Specifier * spec;
4398
4399 for(spec = (*specifiers).first; spec; spec = spec->next)
4400 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4401 {
4402 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4403 FreeSpecifier(spec);
4404 break;
4405 }
4406 }
4407 funcDecl = GetFuncDecl(d);
4408 if(funcDecl && !funcDecl->function.parameters)
4409 {
4410 funcDecl->function.parameters = MkList();
4411 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4412 }
4413 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4414 {
4415 struct Context * oldCtx = curContext;
4416
4417 curContext = globalContext;
4418 decl = MkDeclaration(specifiers, declarators);
4419 curContext = oldCtx;
4420 }
4421 if(symbol->pointerExternal)
4422 {
4423 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4424
4425 {
4426 *functionSymbol = *symbol;
4427 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4428 if(functionSymbol->type)
4429 functionSymbol->type->refCount++;
4430 }
4431 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4432 symbol->pointerExternal->symbol = functionSymbol;
4433 }
4434 external = MkExternalDeclaration(decl);
4435 if(curExternal)
4436 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4437 external->symbol = symbol;
4438 symbol->pointerExternal = external;
4439 }
4440 else
4441 {
4442 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4443 }
4444 if(curExternal)
4445 symbol->id = curExternal->symbol->idCode;
4446 }
4447 }
4448 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1) ? 0x1 : 0x0;
4449 }
4450
4451 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4452
4453 struct GlobalData
4454 {
4455 uintptr_t key;
4456 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4457 struct __ecereNameSpace__ecere__sys__BTNode * left;
4458 struct __ecereNameSpace__ecere__sys__BTNode * right;
4459 int depth;
4460 struct __ecereNameSpace__ecere__com__Instance * module;
4461 char *  dataTypeString;
4462 struct Type * dataType;
4463 void *  symbol;
4464 char *  fullName;
4465 } __attribute__ ((gcc_struct));
4466
4467 void DeclareGlobalData(struct GlobalData * data)
4468 {
4469 struct Symbol * symbol = data->symbol;
4470
4471 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4472 {
4473 if(inCompiler)
4474 {
4475 if(!symbol)
4476 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4477 }
4478 if(!data->dataType)
4479 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4480 DeclareType(data->dataType, 0x1, 0x1);
4481 if(inCompiler)
4482 {
4483 if(!symbol->pointerExternal)
4484 {
4485 struct Declaration * decl;
4486 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4487 struct Declarator * d;
4488 struct External * external;
4489
4490 specifiers = MkList();
4491 declarators = MkList();
4492 ListAdd(specifiers, MkSpecifier(EXTERN));
4493 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4494 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4495 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4496 decl = MkDeclaration(specifiers, declarators);
4497 external = MkExternalDeclaration(decl);
4498 if(curExternal)
4499 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4500 external->symbol = symbol;
4501 symbol->pointerExternal = external;
4502 }
4503 else
4504 {
4505 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4506 }
4507 if(curExternal)
4508 symbol->id = curExternal->symbol->idCode;
4509 }
4510 }
4511 }
4512
4513 struct Conversion
4514 {
4515 struct Conversion * prev, * next;
4516 struct __ecereNameSpace__ecere__com__Property * convert;
4517 unsigned int isGet;
4518 struct Type * resultType;
4519 } __attribute__ ((gcc_struct));
4520
4521 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4522
4523 extern void Compiler_Warning(char *  format, ...);
4524
4525 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4526
4527 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)
4528 {
4529 if(source && dest)
4530 {
4531 if(source->kind == 20 && dest->kind != 20)
4532 {
4533 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4534
4535 if(type)
4536 source = type;
4537 }
4538 if(dest->kind == 20 && source->kind != 20)
4539 {
4540 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4541
4542 if(type)
4543 dest = type;
4544 }
4545 if((dest->classObjectType == 2 && source->classObjectType != 3) || (dest->classObjectType == 3 && source->classObjectType != 2))
4546 {
4547 return 0x1;
4548 }
4549 if(source->classObjectType == 3 && dest->classObjectType != 2)
4550 {
4551 return 0x1;
4552 }
4553 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4554 {
4555 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4556 return 0x1;
4557 }
4558 if(dest->kind == 14 && source->kind != 0)
4559 return 0x1;
4560 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))
4561 return 0x1;
4562 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))
4563 return 0x1;
4564 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4565 {
4566 if(source->_class->registered && source->_class->registered->type == 3)
4567 {
4568 if(conversions != (((void *)0)))
4569 {
4570 if(source->_class->registered == dest->_class->registered)
4571 return 0x1;
4572 }
4573 else
4574 {
4575 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4576
4577 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4578 ;
4579 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4580 ;
4581 if(sourceBase == destBase)
4582 return 0x1;
4583 }
4584 }
4585 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))
4586 return 0x1;
4587 else
4588 {
4589 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && source->_class && source->_class->registered && source->_class->registered->type != 4)
4590 {
4591 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4592 {
4593 return 0x1;
4594 }
4595 }
4596 }
4597 }
4598 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4599 return 0x1;
4600 if(doConversion)
4601 {
4602 if(source->kind == 8)
4603 {
4604 struct __ecereNameSpace__ecere__com__Class * _class;
4605
4606 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4607 {
4608 struct __ecereNameSpace__ecere__com__Property * convert;
4609
4610 for(convert = _class->conversions.first; convert; convert = convert->next)
4611 {
4612 if(convert->memberAccess == 1 || _class->module == privateModule)
4613 {
4614 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4615
4616 if(!convert->dataType)
4617 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4618 if(MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x0, 0x1, 0x0, 0x1))
4619 {
4620 if(!conversions && !convert->Get)
4621 return 0x1;
4622 else if(conversions != (((void *)0)))
4623 {
4624 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))
4625 return 0x1;
4626 else
4627 {
4628 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4629
4630 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4631 return 0x1;
4632 }
4633 }
4634 }
4635 }
4636 }
4637 }
4638 }
4639 if(dest->kind == 8)
4640 {
4641 struct __ecereNameSpace__ecere__com__Class * _class;
4642
4643 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4644 {
4645 struct __ecereNameSpace__ecere__com__Property * convert;
4646
4647 for(convert = _class->conversions.first; convert; convert = convert->next)
4648 {
4649 if(convert->memberAccess == 1 || _class->module == privateModule)
4650 {
4651 if(!convert->dataType)
4652 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4653 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4654 {
4655 if(!conversions && !convert->Set)
4656 return 0x1;
4657 else if(conversions != (((void *)0)))
4658 {
4659 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))
4660 return 0x1;
4661 else
4662 {
4663 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4664
4665 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4666 return 0x1;
4667 }
4668 }
4669 }
4670 }
4671 }
4672 }
4673 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4674 {
4675 if(!dest->_class->registered->dataType)
4676 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4677 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4678 {
4679 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4680 {
4681 return 0x1;
4682 }
4683 }
4684 }
4685 }
4686 if(source->kind == 8)
4687 {
4688 struct __ecereNameSpace__ecere__com__Class * _class;
4689
4690 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4691 {
4692 struct __ecereNameSpace__ecere__com__Property * convert;
4693
4694 for(convert = _class->conversions.first; convert; convert = convert->next)
4695 {
4696 if(convert->memberAccess == 1 || _class->module == privateModule)
4697 {
4698 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4699
4700 if(!convert->dataType)
4701 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4702 if(convert->dataType != source && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x1))
4703 {
4704 if(!conversions && !convert->Get)
4705 return 0x1;
4706 else if(conversions != (((void *)0)))
4707 {
4708 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))
4709 return 0x1;
4710 else
4711 {
4712 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4713
4714 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4715 return 0x1;
4716 }
4717 }
4718 }
4719 }
4720 }
4721 }
4722 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4723 {
4724 if(!source->_class->registered->dataType)
4725 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4726 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4727 {
4728 return 0x1;
4729 }
4730 }
4731 }
4732 }
4733 if(source->kind == 8 || source->kind == 19)
4734 ;
4735 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
4736 return 0x1;
4737 else if(dest->kind == 7 && source->kind == 6)
4738 return 0x1;
4739 else if(dest->kind == 2 && source->kind == 1)
4740 return 0x1;
4741 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1))
4742 return 0x1;
4743 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4744 return 0x1;
4745 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 3))
4746 return 0x1;
4747 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22))
4748 return 0x1;
4749 else if(dest->kind == 15 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 5 || source->kind == 4 || source->kind == 22))
4750 return 0x1;
4751 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)))
4752 {
4753 struct Type * paramSource, * paramDest;
4754
4755 if(dest->kind == 16)
4756 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
4757 if(source->kind == 16)
4758 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
4759 if(dest->kind == 13 && dest->type->kind == 11)
4760 dest = dest->type;
4761 if(source->kind == 13 && source->type->kind == 11)
4762 source = source->type;
4763 if(dest->kind == 16)
4764 dest = dest->method->dataType;
4765 if(source->kind == 16)
4766 source = source->method->dataType;
4767 paramSource = source->params.first;
4768 if(paramSource && paramSource->kind == 0)
4769 paramSource = (((void *)0));
4770 paramDest = dest->params.first;
4771 if(paramDest && paramDest->kind == 0)
4772 paramDest = (((void *)0));
4773 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
4774 {
4775 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))))
4776 {
4777 if(paramDest && paramDest->kind == 8)
4778 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
4779 else
4780 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class should not take an object\n", (((void *)0))));
4781 return 0x0;
4782 }
4783 paramDest = paramDest->next;
4784 }
4785 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
4786 {
4787 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
4788 {
4789 if(dest->thisClass)
4790 {
4791 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
4792 {
4793 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4794 return 0x0;
4795 }
4796 }
4797 else
4798 {
4799 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
4800 {
4801 if(owningClassDest)
4802 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
4803 else
4804 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "overriding class expected to be derived from method class\n", (((void *)0))));
4805 return 0x0;
4806 }
4807 }
4808 paramSource = paramSource->next;
4809 }
4810 else
4811 {
4812 if(dest->thisClass)
4813 {
4814 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
4815 {
4816 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
4817 return 0x0;
4818 }
4819 }
4820 else
4821 {
4822 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
4823 {
4824 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
4825 return 0x0;
4826 }
4827 }
4828 }
4829 }
4830 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4831 {
4832 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible return type for function\n", (((void *)0))));
4833 return 0x0;
4834 }
4835 for(; paramDest; paramDest = paramDest->next)
4836 {
4837 if(!paramSource)
4838 {
4839 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "not enough parameters\n", (((void *)0))));
4840 return 0x0;
4841 }
4842 {
4843 struct Type * paramDestType = paramDest;
4844 struct Type * paramSourceType = paramSource;
4845 struct Type * type = paramDestType;
4846
4847 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
4848 {
4849 int id = 0;
4850 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4851 struct __ecereNameSpace__ecere__com__Class * sClass;
4852
4853 for(sClass = owningClassSource; sClass; sClass = sClass->base)
4854 {
4855 id = 0;
4856 if(sClass->templateClass)
4857 sClass = sClass->templateClass;
4858 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4859 {
4860 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
4861 {
4862 for(sClass = sClass->base; sClass; sClass = sClass->base)
4863 {
4864 if(sClass->templateClass)
4865 sClass = sClass->templateClass;
4866 id += sClass->templateParams.count;
4867 }
4868 break;
4869 }
4870 id++;
4871 }
4872 if(curParam)
4873 break;
4874 }
4875 if(curParam)
4876 {
4877 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
4878
4879 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
4880 }
4881 }
4882 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)))
4883 {
4884 char type[1024];
4885
4886 type[0] = (char)0;
4887 PrintType(paramDest, type, 0x0, 0x1);
4888 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
4889 if(paramDestType != paramDest)
4890 FreeType(paramDestType);
4891 return 0x0;
4892 }
4893 if(paramDestType != paramDest)
4894 FreeType(paramDestType);
4895 }
4896 paramSource = paramSource->next;
4897 }
4898 if(paramSource)
4899 {
4900 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "too many parameters\n", (((void *)0))));
4901 return 0x0;
4902 }
4903 return 0x1;
4904 }
4905 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
4906 {
4907 return 0x1;
4908 }
4909 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
4910 {
4911 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
4912 return 0x1;
4913 }
4914 }
4915 return 0x0;
4916 }
4917
4918 static void FreeConvert(struct Conversion * convert)
4919 {
4920 if(convert->resultType)
4921 FreeType(convert->resultType);
4922 }
4923
4924 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
4925
4926 struct __ecereNameSpace__ecere__com__BTNamedLink
4927 {
4928 char *  name;
4929 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
4930 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
4931 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
4932 int depth;
4933 void *  data;
4934 } __attribute__ ((gcc_struct));
4935
4936 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
4937
4938 struct __ecereNameSpace__ecere__com__EnumClassData
4939 {
4940 struct __ecereNameSpace__ecere__sys__OldList values;
4941 int largest;
4942 } __attribute__ ((gcc_struct));
4943
4944 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
4945
4946 struct __ecereNameSpace__ecere__sys__NamedLink
4947 {
4948 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
4949 struct __ecereNameSpace__ecere__sys__NamedLink * next;
4950 char *  name;
4951 void *  data;
4952 } __attribute__ ((gcc_struct));
4953
4954 extern void FreeExpContents(struct Expression * exp);
4955
4956 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
4957
4958 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
4959
4960 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
4961
4962 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
4963
4964 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
4965
4966 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
4967 {
4968 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
4969
4970 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)))
4971 {
4972 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
4973
4974 if(_class->type == 4)
4975 {
4976 struct __ecereNameSpace__ecere__sys__OldList converts = 
4977 {
4978 0, 0, 0, 0, 0
4979 };
4980 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
4981
4982 type->kind = 8;
4983 if(!_class->symbol)
4984 _class->symbol = FindClass(_class->fullName);
4985 type->_class = _class->symbol;
4986 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
4987 {
4988 struct __ecereNameSpace__ecere__sys__NamedLink * value;
4989 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
4990
4991 if(enumClass)
4992 {
4993 struct __ecereNameSpace__ecere__com__Class * baseClass;
4994
4995 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
4996 {
4997 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
4998
4999 for(value = e->values.first; value; value = value->next)
5000 {
5001 if(!strcmp(value->name, string))
5002 break;
5003 }
5004 if(value)
5005 {
5006 FreeExpContents(sourceExp);
5007 FreeType(sourceExp->expType);
5008 sourceExp->isConstant = 0x1;
5009 sourceExp->expType = MkClassType(baseClass->fullName);
5010 {
5011 char constant[256];
5012
5013 sourceExp->type = 2;
5014 if(!strcmp(baseClass->dataTypeString, "int"))
5015 sprintf(constant, "%d", value->data);
5016 else
5017 sprintf(constant, "0x%X", value->data);
5018 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5019 }
5020 while(converts.first)
5021 {
5022 struct Conversion * convert = converts.first;
5023
5024 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5025 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5026 }
5027 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5028 return 0x1;
5029 }
5030 }
5031 }
5032 }
5033 if(converts.first)
5034 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5035 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5036 }
5037 }
5038 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)))
5039 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5040 return 0x1;
5041 return 0x0;
5042 }
5043
5044 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5045
5046 struct __ecereNameSpace__ecere__com__SubModule
5047 {
5048 struct __ecereNameSpace__ecere__com__SubModule * prev;
5049 struct __ecereNameSpace__ecere__com__SubModule * next;
5050 struct __ecereNameSpace__ecere__com__Instance * module;
5051 int importMode;
5052 } __attribute__ ((gcc_struct));
5053
5054 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5055 {
5056 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5057
5058 if(searchFor == searchIn)
5059 return 0x1;
5060 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->modules.first; subModule; subModule = subModule->next)
5061 {
5062 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + 12)))->application)
5063 {
5064 if(ModuleVisibility(subModule->module, searchFor))
5065 return 0x1;
5066 }
5067 }
5068 return 0x0;
5069 }
5070
5071 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5072
5073 struct __ecereNameSpace__ecere__com__Application
5074 {
5075 int argc;
5076 char * *  argv;
5077 int exitCode;
5078 unsigned int isGUIApp;
5079 struct __ecereNameSpace__ecere__sys__OldList allModules;
5080 char *  parsedCommand;
5081 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5082 } __attribute__ ((gcc_struct));
5083
5084 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5085 {
5086 struct __ecereNameSpace__ecere__com__Instance * module;
5087
5088 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->systemNameSpace, sourceExp, dest, string, conversions))
5089 return 0x1;
5090 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->privateNameSpace, sourceExp, dest, string, conversions))
5091 return 0x1;
5092 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
5093 return 0x1;
5094 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + 12)))->application + 300)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->next)
5095 {
5096 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->publicNameSpace, sourceExp, dest, string, conversions))
5097 return 0x1;
5098 }
5099 return 0x0;
5100 }
5101
5102 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5103
5104 void ReadString(char *  output, char *  string);
5105
5106 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5107
5108 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5109
5110 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5111
5112 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5113 {
5114 void * __ecereTemp1;
5115 struct Type * source = sourceExp->expType;
5116 struct Type * realDest = dest;
5117
5118 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5119 return 0x1;
5120 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5121 {
5122 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5123 {
5124 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5125
5126 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5127 ;
5128 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5129 ;
5130 if(sourceBase == destBase)
5131 return 0x1;
5132 }
5133 }
5134 if(source)
5135 {
5136 struct __ecereNameSpace__ecere__sys__OldList * specs;
5137 unsigned int flag = 0x0;
5138 long long value = (((int)0x7fffffff));
5139
5140 source->refCount++;
5141 dest->refCount++;
5142 if(sourceExp->type == 2)
5143 {
5144 if(source->isSigned)
5145 value = strtoll(sourceExp->constant, (((void *)0)), 0);
5146 else
5147 value = strtoull(sourceExp->constant, (((void *)0)), 0);
5148 }
5149 else if(sourceExp->type == 4 && sourceExp->op.op == '-' && !sourceExp->op.exp1 && sourceExp->op.exp2 && sourceExp->op.exp2->type == 2)
5150 {
5151 if(source->isSigned)
5152 value = -strtoll(sourceExp->op.exp2->constant, (((void *)0)), 0);
5153 else
5154 value = -strtoull(sourceExp->op.exp2->constant, (((void *)0)), 0);
5155 }
5156 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5157 {
5158 FreeType(source);
5159 source = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->isSigned = 0x0, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
5160 }
5161 if(dest->kind == 8)
5162 {
5163 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5164
5165 if(_class && _class->type == 3)
5166 {
5167 if(source->kind != 8)
5168 {
5169 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5170 struct Type * tempDest, * tempSource;
5171
5172 for(; _class->base->type != 1000; _class = _class->base)
5173 ;
5174 tempSource = dest;
5175 tempDest = tempType;
5176 tempType->kind = 8;
5177 if(!_class->symbol)
5178 _class->symbol = FindClass(_class->fullName);
5179 tempType->_class = _class->symbol;
5180 tempType->truth = dest->truth;
5181 if(tempType->_class)
5182 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5183 FreeType(sourceExp->expType);
5184 sourceExp->expType = dest;
5185 dest->refCount++;
5186 flag = 0x1;
5187 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5188 }
5189 }
5190 if(_class && _class->type == 2 && source->kind != 8)
5191 {
5192 if(!dest->_class->registered->dataType)
5193 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5194 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5195 {
5196 FreeType(source);
5197 FreeType(sourceExp->expType);
5198 source = sourceExp->expType = MkClassType(dest->_class->string);
5199 source->refCount++;
5200 }
5201 }
5202 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5203 {
5204 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5205 struct Declarator * decl;
5206 char string[1024];
5207
5208 ReadString(string, sourceExp->string);
5209 decl = SpecDeclFromString(string, specs, (((void *)0)));
5210 FreeExpContents(sourceExp);
5211 FreeType(sourceExp->expType);
5212 sourceExp->type = 26;
5213 sourceExp->_classExp.specifiers = specs;
5214 sourceExp->_classExp.decl = decl;
5215 sourceExp->expType = dest;
5216 dest->refCount++;
5217 FreeType(source);
5218 FreeType(dest);
5219 return 0x1;
5220 }
5221 }
5222 else if(source->kind == 8)
5223 {
5224 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5225
5226 if(_class && (_class->type == 3 || !strcmp(_class->fullName, "bool") || _class->type == 2))
5227 {
5228 if(dest->kind != 8)
5229 {
5230 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5231 struct Type * tempDest, * tempSource;
5232
5233 if(!source->_class->registered->dataType)
5234 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5235 for(; _class->base->type != 1000; _class = _class->base)
5236 ;
5237 tempDest = source;
5238 tempSource = tempType;
5239 tempType->kind = 8;
5240 tempType->_class = FindClass(_class->fullName);
5241 tempType->truth = source->truth;
5242 tempType->classObjectType = source->classObjectType;
5243 if(tempType->_class)
5244 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5245 if(conversions->last)
5246 {
5247 ((struct Conversion *)conversions->last)->resultType = dest;
5248 dest->refCount++;
5249 }
5250 FreeType(sourceExp->expType);
5251 sourceExp->expType = MkClassType(_class->fullName);
5252 sourceExp->expType->truth = source->truth;
5253 sourceExp->expType->classObjectType = source->classObjectType;
5254 if(!sourceExp->destType)
5255 {
5256 FreeType(sourceExp->destType);
5257 sourceExp->destType = sourceExp->expType;
5258 if(sourceExp->expType)
5259 sourceExp->expType->refCount++;
5260 }
5261 if(!_class->dataType)
5262 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5263 FreeType(dest);
5264 dest = MkClassType(source->_class->string);
5265 dest->truth = source->truth;
5266 dest->classObjectType = source->classObjectType;
5267 FreeType(source);
5268 source = _class->dataType;
5269 source->refCount++;
5270 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5271 }
5272 }
5273 }
5274 if(!flag)
5275 {
5276 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5277 {
5278 FreeType(source);
5279 FreeType(dest);
5280 return 0x1;
5281 }
5282 }
5283 if(dest->kind == 8)
5284 {
5285 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5286
5287 if(_class && !dest->truth && (_class->type == 3 || !strcmp(_class->fullName, "bool") || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5288 {
5289 if(_class->type == 0 || _class->type == 5)
5290 {
5291 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5292
5293 *newExp = *sourceExp;
5294 if(sourceExp->destType)
5295 sourceExp->destType->refCount++;
5296 if(sourceExp->expType)
5297 sourceExp->expType->refCount++;
5298 sourceExp->type = 11;
5299 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5300 sourceExp->cast.exp = newExp;
5301 FreeType(sourceExp->expType);
5302 sourceExp->expType = (((void *)0));
5303 ProcessExpressionType(sourceExp);
5304 if(!inCompiler)
5305 {
5306 FreeType(sourceExp->expType);
5307 sourceExp->expType = dest;
5308 }
5309 FreeType(source);
5310 if(inCompiler)
5311 FreeType(dest);
5312 return 0x1;
5313 }
5314 if(!_class->dataType)
5315 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5316 FreeType(dest);
5317 dest = _class->dataType;
5318 dest->refCount++;
5319 }
5320 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5321 {
5322 specs = MkListOne(MkSpecifier(DOUBLE));
5323 }
5324 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 7))
5325 {
5326 specs = MkListOne(MkSpecifier(FLOAT));
5327 }
5328 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5329 {
5330 specs = MkList();
5331 if(!dest->isSigned)
5332 ListAdd(specs, MkSpecifier(UNSIGNED));
5333 ListAdd(specs, MkSpecifier(INT64));
5334 }
5335 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 6 || source->kind == 7))
5336 {
5337 specs = MkList();
5338 if(!dest->isSigned)
5339 ListAdd(specs, MkSpecifier(UNSIGNED));
5340 ListAdd(specs, MkSpecifier(INT));
5341 }
5342 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5343 {
5344 specs = MkList();
5345 if(!dest->isSigned)
5346 ListAdd(specs, MkSpecifier(UNSIGNED));
5347 ListAdd(specs, MkSpecifier(SHORT));
5348 }
5349 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5350 {
5351 specs = MkList();
5352 if(!dest->isSigned)
5353 ListAdd(specs, MkSpecifier(UNSIGNED));
5354 ListAdd(specs, MkSpecifier(CHAR));
5355 }
5356 else
5357 {
5358 FreeType(source);
5359 FreeType(dest);
5360 return 0x0;
5361 }
5362 }
5363 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))
5364 {
5365 specs = MkListOne(MkSpecifier(DOUBLE));
5366 }
5367 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5368 {
5369 specs = MkListOne(MkSpecifier(FLOAT));
5370 }
5371 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)))
5372 {
5373 specs = MkList();
5374 if(!dest->isSigned)
5375 ListAdd(specs, MkSpecifier(UNSIGNED));
5376 ListAdd(specs, MkSpecifier(CHAR));
5377 }
5378 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)))))
5379 {
5380 specs = MkList();
5381 if(!dest->isSigned)
5382 ListAdd(specs, MkSpecifier(UNSIGNED));
5383 ListAdd(specs, MkSpecifier(SHORT));
5384 }
5385 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3))
5386 {
5387 specs = MkList();
5388 if(!dest->isSigned)
5389 ListAdd(specs, MkSpecifier(UNSIGNED));
5390 ListAdd(specs, MkSpecifier(INT));
5391 }
5392 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5393 {
5394 specs = MkList();
5395 if(!dest->isSigned)
5396 ListAdd(specs, MkSpecifier(UNSIGNED));
5397 ListAdd(specs, MkSpecifier(INT64));
5398 }
5399 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1))
5400 {
5401 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5402 }
5403 else
5404 {
5405 FreeType(source);
5406 FreeType(dest);
5407 return 0x0;
5408 }
5409 if(!flag)
5410 {
5411 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5412
5413 *newExp = *sourceExp;
5414 newExp->prev = (((void *)0));
5415 newExp->next = (((void *)0));
5416 if(sourceExp->destType)
5417 sourceExp->destType->refCount++;
5418 if(sourceExp->expType)
5419 sourceExp->expType->refCount++;
5420 sourceExp->type = 11;
5421 if(realDest->kind == 8)
5422 {
5423 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5424 FreeList(specs, FreeSpecifier);
5425 }
5426 else
5427 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5428 if(newExp->type == 4)
5429 {
5430 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5431 }
5432 else
5433 sourceExp->cast.exp = newExp;
5434 FreeType(sourceExp->expType);
5435 sourceExp->expType = (((void *)0));
5436 ProcessExpressionType(sourceExp);
5437 }
5438 else
5439 FreeList(specs, FreeSpecifier);
5440 FreeType(dest);
5441 FreeType(source);
5442 return 0x1;
5443 }
5444 else
5445 {
5446 while((sourceExp->type == 5 || sourceExp->type == 34) && sourceExp->list)
5447 sourceExp = (*sourceExp->list).last;
5448 if(sourceExp->type == 0)
5449 {
5450 struct Identifier * id = sourceExp->identifier;
5451
5452 if(dest->kind == 8)
5453 {
5454 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5455 {
5456 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5457 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5458
5459 if(enumClass)
5460 {
5461 for(; _class && _class->type == 4; _class = _class->base)
5462 {
5463 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5464 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5465
5466 for(value = e->values.first; value; value = value->next)
5467 {
5468 if(!strcmp(value->name, id->string))
5469 break;
5470 }
5471 if(value)
5472 {
5473 FreeExpContents(sourceExp);
5474 FreeType(sourceExp->expType);
5475 sourceExp->isConstant = 0x1;
5476 sourceExp->expType = MkClassType(_class->fullName);
5477 {
5478 char constant[256];
5479
5480 sourceExp->type = 2;
5481 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5482 sprintf(constant, "%d", value->data);
5483 else
5484 sprintf(constant, "0x%X", value->data);
5485 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5486 }
5487 return 0x1;
5488 }
5489 }
5490 }
5491 }
5492 }
5493 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5494 return 0x1;
5495 }
5496 }
5497 return 0x0;
5498 }
5499
5500 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5501 {
5502 int value2 = op2->i;
5503
5504 exp->type = 2;
5505 exp->string = PrintInt(op1->i + value2);
5506 if(!exp->expType)
5507 {
5508 exp->expType = op1->type;
5509 if(op1->type)
5510 op1->type->refCount++;
5511 }
5512 return 0x1;
5513 }
5514
5515 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5516 {
5517 unsigned int value2 = op2->ui;
5518
5519 exp->type = 2;
5520 exp->string = PrintUInt(op1->ui + value2);
5521 if(!exp->expType)
5522 {
5523 exp->expType = op1->type;
5524 if(op1->type)
5525 op1->type->refCount++;
5526 }
5527 return 0x1;
5528 }
5529
5530 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5531 {
5532 short value2 = op2->s;
5533
5534 exp->type = 2;
5535 exp->string = PrintShort(op1->s + value2);
5536 if(!exp->expType)
5537 {
5538 exp->expType = op1->type;
5539 if(op1->type)
5540 op1->type->refCount++;
5541 }
5542 return 0x1;
5543 }
5544
5545 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5546 {
5547 unsigned short value2 = op2->us;
5548
5549 exp->type = 2;
5550 exp->string = PrintUShort(op1->us + value2);
5551 if(!exp->expType)
5552 {
5553 exp->expType = op1->type;
5554 if(op1->type)
5555 op1->type->refCount++;
5556 }
5557 return 0x1;
5558 }
5559
5560 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5561 {
5562 char value2 = op2->c;
5563
5564 exp->type = 2;
5565 exp->string = PrintChar(op1->c + value2);
5566 if(!exp->expType)
5567 {
5568 exp->expType = op1->type;
5569 if(op1->type)
5570 op1->type->refCount++;
5571 }
5572 return 0x1;
5573 }
5574
5575 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5576 {
5577 unsigned char value2 = op2->uc;
5578
5579 exp->type = 2;
5580 exp->string = PrintUChar(op1->uc + value2);
5581 if(!exp->expType)
5582 {
5583 exp->expType = op1->type;
5584 if(op1->type)
5585 op1->type->refCount++;
5586 }
5587 return 0x1;
5588 }
5589
5590 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5591 {
5592 float value2 = op2->f;
5593
5594 exp->type = 2;
5595 exp->string = PrintFloat(op1->f + value2);
5596 if(!exp->expType)
5597 {
5598 exp->expType = op1->type;
5599 if(op1->type)
5600 op1->type->refCount++;
5601 }
5602 return 0x1;
5603 }
5604
5605 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5606 {
5607 double value2 = op2->d;
5608
5609 exp->type = 2;
5610 exp->string = PrintDouble(op1->d + value2);
5611 if(!exp->expType)
5612 {
5613 exp->expType = op1->type;
5614 if(op1->type)
5615 op1->type->refCount++;
5616 }
5617 return 0x1;
5618 }
5619
5620 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5621 {
5622 int value2 = op2->i;
5623
5624 exp->type = 2;
5625 exp->string = PrintInt(op1->i - value2);
5626 if(!exp->expType)
5627 {
5628 exp->expType = op1->type;
5629 if(op1->type)
5630 op1->type->refCount++;
5631 }
5632 return 0x1;
5633 }
5634
5635 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5636 {
5637 unsigned int value2 = op2->ui;
5638
5639 exp->type = 2;
5640 exp->string = PrintUInt(op1->ui - value2);
5641 if(!exp->expType)
5642 {
5643 exp->expType = op1->type;
5644 if(op1->type)
5645 op1->type->refCount++;
5646 }
5647 return 0x1;
5648 }
5649
5650 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5651 {
5652 short value2 = op2->s;
5653
5654 exp->type = 2;
5655 exp->string = PrintShort(op1->s - value2);
5656 if(!exp->expType)
5657 {
5658 exp->expType = op1->type;
5659 if(op1->type)
5660 op1->type->refCount++;
5661 }
5662 return 0x1;
5663 }
5664
5665 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5666 {
5667 unsigned short value2 = op2->us;
5668
5669 exp->type = 2;
5670 exp->string = PrintUShort(op1->us - value2);
5671 if(!exp->expType)
5672 {
5673 exp->expType = op1->type;
5674 if(op1->type)
5675 op1->type->refCount++;
5676 }
5677 return 0x1;
5678 }
5679
5680 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5681 {
5682 char value2 = op2->c;
5683
5684 exp->type = 2;
5685 exp->string = PrintChar(op1->c - value2);
5686 if(!exp->expType)
5687 {
5688 exp->expType = op1->type;
5689 if(op1->type)
5690 op1->type->refCount++;
5691 }
5692 return 0x1;
5693 }
5694
5695 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5696 {
5697 unsigned char value2 = op2->uc;
5698
5699 exp->type = 2;
5700 exp->string = PrintUChar(op1->uc - value2);
5701 if(!exp->expType)
5702 {
5703 exp->expType = op1->type;
5704 if(op1->type)
5705 op1->type->refCount++;
5706 }
5707 return 0x1;
5708 }
5709
5710 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5711 {
5712 float value2 = op2->f;
5713
5714 exp->type = 2;
5715 exp->string = PrintFloat(op1->f - value2);
5716 if(!exp->expType)
5717 {
5718 exp->expType = op1->type;
5719 if(op1->type)
5720 op1->type->refCount++;
5721 }
5722 return 0x1;
5723 }
5724
5725 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5726 {
5727 double value2 = op2->d;
5728
5729 exp->type = 2;
5730 exp->string = PrintDouble(op1->d - value2);
5731 if(!exp->expType)
5732 {
5733 exp->expType = op1->type;
5734 if(op1->type)
5735 op1->type->refCount++;
5736 }
5737 return 0x1;
5738 }
5739
5740 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5741 {
5742 int value2 = op2->i;
5743
5744 exp->type = 2;
5745 exp->string = PrintInt(op1->i * value2);
5746 if(!exp->expType)
5747 {
5748 exp->expType = op1->type;
5749 if(op1->type)
5750 op1->type->refCount++;
5751 }
5752 return 0x1;
5753 }
5754
5755 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5756 {
5757 unsigned int value2 = op2->ui;
5758
5759 exp->type = 2;
5760 exp->string = PrintUInt(op1->ui * value2);
5761 if(!exp->expType)
5762 {
5763 exp->expType = op1->type;
5764 if(op1->type)
5765 op1->type->refCount++;
5766 }
5767 return 0x1;
5768 }
5769
5770 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5771 {
5772 short value2 = op2->s;
5773
5774 exp->type = 2;
5775 exp->string = PrintShort(op1->s * value2);
5776 if(!exp->expType)
5777 {
5778 exp->expType = op1->type;
5779 if(op1->type)
5780 op1->type->refCount++;
5781 }
5782 return 0x1;
5783 }
5784
5785 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5786 {
5787 unsigned short value2 = op2->us;
5788
5789 exp->type = 2;
5790 exp->string = PrintUShort(op1->us * value2);
5791 if(!exp->expType)
5792 {
5793 exp->expType = op1->type;
5794 if(op1->type)
5795 op1->type->refCount++;
5796 }
5797 return 0x1;
5798 }
5799
5800 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5801 {
5802 char value2 = op2->c;
5803
5804 exp->type = 2;
5805 exp->string = PrintChar(op1->c * value2);
5806 if(!exp->expType)
5807 {
5808 exp->expType = op1->type;
5809 if(op1->type)
5810 op1->type->refCount++;
5811 }
5812 return 0x1;
5813 }
5814
5815 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5816 {
5817 unsigned char value2 = op2->uc;
5818
5819 exp->type = 2;
5820 exp->string = PrintUChar(op1->uc * value2);
5821 if(!exp->expType)
5822 {
5823 exp->expType = op1->type;
5824 if(op1->type)
5825 op1->type->refCount++;
5826 }
5827 return 0x1;
5828 }
5829
5830 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5831 {
5832 float value2 = op2->f;
5833
5834 exp->type = 2;
5835 exp->string = PrintFloat(op1->f * value2);
5836 if(!exp->expType)
5837 {
5838 exp->expType = op1->type;
5839 if(op1->type)
5840 op1->type->refCount++;
5841 }
5842 return 0x1;
5843 }
5844
5845 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5846 {
5847 double value2 = op2->d;
5848
5849 exp->type = 2;
5850 exp->string = PrintDouble(op1->d * value2);
5851 if(!exp->expType)
5852 {
5853 exp->expType = op1->type;
5854 if(op1->type)
5855 op1->type->refCount++;
5856 }
5857 return 0x1;
5858 }
5859
5860 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5861 {
5862 int value2 = op2->i;
5863
5864 exp->type = 2;
5865 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
5866 if(!exp->expType)
5867 {
5868 exp->expType = op1->type;
5869 if(op1->type)
5870 op1->type->refCount++;
5871 }
5872 return 0x1;
5873 }
5874
5875 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5876 {
5877 unsigned int value2 = op2->ui;
5878
5879 exp->type = 2;
5880 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
5881 if(!exp->expType)
5882 {
5883 exp->expType = op1->type;
5884 if(op1->type)
5885 op1->type->refCount++;
5886 }
5887 return 0x1;
5888 }
5889
5890 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5891 {
5892 short value2 = op2->s;
5893
5894 exp->type = 2;
5895 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
5896 if(!exp->expType)
5897 {
5898 exp->expType = op1->type;
5899 if(op1->type)
5900 op1->type->refCount++;
5901 }
5902 return 0x1;
5903 }
5904
5905 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5906 {
5907 unsigned short value2 = op2->us;
5908
5909 exp->type = 2;
5910 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
5911 if(!exp->expType)
5912 {
5913 exp->expType = op1->type;
5914 if(op1->type)
5915 op1->type->refCount++;
5916 }
5917 return 0x1;
5918 }
5919
5920 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5921 {
5922 char value2 = op2->c;
5923
5924 exp->type = 2;
5925 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
5926 if(!exp->expType)
5927 {
5928 exp->expType = op1->type;
5929 if(op1->type)
5930 op1->type->refCount++;
5931 }
5932 return 0x1;
5933 }
5934
5935 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5936 {
5937 unsigned char value2 = op2->uc;
5938
5939 exp->type = 2;
5940 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
5941 if(!exp->expType)
5942 {
5943 exp->expType = op1->type;
5944 if(op1->type)
5945 op1->type->refCount++;
5946 }
5947 return 0x1;
5948 }
5949
5950 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5951 {
5952 float value2 = op2->f;
5953
5954 exp->type = 2;
5955 exp->string = PrintFloat(value2 ? (op1->f / value2) : (float)0);
5956 if(!exp->expType)
5957 {
5958 exp->expType = op1->type;
5959 if(op1->type)
5960 op1->type->refCount++;
5961 }
5962 return 0x1;
5963 }
5964
5965 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5966 {
5967 double value2 = op2->d;
5968
5969 exp->type = 2;
5970 exp->string = PrintDouble(value2 ? (op1->d / value2) : (double)0);
5971 if(!exp->expType)
5972 {
5973 exp->expType = op1->type;
5974 if(op1->type)
5975 op1->type->refCount++;
5976 }
5977 return 0x1;
5978 }
5979
5980 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5981 {
5982 int value2 = op2->i;
5983
5984 exp->type = 2;
5985 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
5986 if(!exp->expType)
5987 {
5988 exp->expType = op1->type;
5989 if(op1->type)
5990 op1->type->refCount++;
5991 }
5992 return 0x1;
5993 }
5994
5995 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5996 {
5997 unsigned int value2 = op2->ui;
5998
5999 exp->type = 2;
6000 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6001 if(!exp->expType)
6002 {
6003 exp->expType = op1->type;
6004 if(op1->type)
6005 op1->type->refCount++;
6006 }
6007 return 0x1;
6008 }
6009
6010 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6011 {
6012 short value2 = op2->s;
6013
6014 exp->type = 2;
6015 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6016 if(!exp->expType)
6017 {
6018 exp->expType = op1->type;
6019 if(op1->type)
6020 op1->type->refCount++;
6021 }
6022 return 0x1;
6023 }
6024
6025 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6026 {
6027 unsigned short value2 = op2->us;
6028
6029 exp->type = 2;
6030 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6031 if(!exp->expType)
6032 {
6033 exp->expType = op1->type;
6034 if(op1->type)
6035 op1->type->refCount++;
6036 }
6037 return 0x1;
6038 }
6039
6040 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6041 {
6042 char value2 = op2->c;
6043
6044 exp->type = 2;
6045 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6046 if(!exp->expType)
6047 {
6048 exp->expType = op1->type;
6049 if(op1->type)
6050 op1->type->refCount++;
6051 }
6052 return 0x1;
6053 }
6054
6055 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6056 {
6057 unsigned char value2 = op2->uc;
6058
6059 exp->type = 2;
6060 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6061 if(!exp->expType)
6062 {
6063 exp->expType = op1->type;
6064 if(op1->type)
6065 op1->type->refCount++;
6066 }
6067 return 0x1;
6068 }
6069
6070 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6071 {
6072 exp->type = 2;
6073 exp->string = PrintInt(-op1->i);
6074 if(!exp->expType)
6075 {
6076 exp->expType = op1->type;
6077 if(op1->type)
6078 op1->type->refCount++;
6079 }
6080 return 0x1;
6081 }
6082
6083 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6084 {
6085 exp->type = 2;
6086 exp->string = PrintUInt(-op1->ui);
6087 if(!exp->expType)
6088 {
6089 exp->expType = op1->type;
6090 if(op1->type)
6091 op1->type->refCount++;
6092 }
6093 return 0x1;
6094 }
6095
6096 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6097 {
6098 exp->type = 2;
6099 exp->string = PrintShort(-op1->s);
6100 if(!exp->expType)
6101 {
6102 exp->expType = op1->type;
6103 if(op1->type)
6104 op1->type->refCount++;
6105 }
6106 return 0x1;
6107 }
6108
6109 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6110 {
6111 exp->type = 2;
6112 exp->string = PrintUShort(-op1->us);
6113 if(!exp->expType)
6114 {
6115 exp->expType = op1->type;
6116 if(op1->type)
6117 op1->type->refCount++;
6118 }
6119 return 0x1;
6120 }
6121
6122 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6123 {
6124 exp->type = 2;
6125 exp->string = PrintChar(-op1->c);
6126 if(!exp->expType)
6127 {
6128 exp->expType = op1->type;
6129 if(op1->type)
6130 op1->type->refCount++;
6131 }
6132 return 0x1;
6133 }
6134
6135 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6136 {
6137 exp->type = 2;
6138 exp->string = PrintUChar(-op1->uc);
6139 if(!exp->expType)
6140 {
6141 exp->expType = op1->type;
6142 if(op1->type)
6143 op1->type->refCount++;
6144 }
6145 return 0x1;
6146 }
6147
6148 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6149 {
6150 exp->type = 2;
6151 exp->string = PrintFloat(-op1->f);
6152 if(!exp->expType)
6153 {
6154 exp->expType = op1->type;
6155 if(op1->type)
6156 op1->type->refCount++;
6157 }
6158 return 0x1;
6159 }
6160
6161 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6162 {
6163 exp->type = 2;
6164 exp->string = PrintDouble(-op1->d);
6165 if(!exp->expType)
6166 {
6167 exp->expType = op1->type;
6168 if(op1->type)
6169 op1->type->refCount++;
6170 }
6171 return 0x1;
6172 }
6173
6174 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6175 {
6176 exp->type = 2;
6177 exp->string = PrintInt(++op1->i);
6178 if(!exp->expType)
6179 {
6180 exp->expType = op1->type;
6181 if(op1->type)
6182 op1->type->refCount++;
6183 }
6184 return 0x1;
6185 }
6186
6187 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6188 {
6189 exp->type = 2;
6190 exp->string = PrintUInt(++op1->ui);
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 ShortInc(struct Expression * exp, struct Operand * op1)
6201 {
6202 exp->type = 2;
6203 exp->string = PrintShort(++op1->s);
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 UShortInc(struct Expression * exp, struct Operand * op1)
6214 {
6215 exp->type = 2;
6216 exp->string = PrintUShort(++op1->us);
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 CharInc(struct Expression * exp, struct Operand * op1)
6227 {
6228 exp->type = 2;
6229 exp->string = PrintChar(++op1->c);
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 UCharInc(struct Expression * exp, struct Operand * op1)
6240 {
6241 exp->type = 2;
6242 exp->string = PrintUChar(++op1->uc);
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 FloatInc(struct Expression * exp, struct Operand * op1)
6253 {
6254 exp->type = 2;
6255 exp->string = PrintFloat(++op1->f);
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 DoubleInc(struct Expression * exp, struct Operand * op1)
6266 {
6267 exp->type = 2;
6268 exp->string = PrintDouble(++op1->d);
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 IntDec(struct Expression * exp, struct Operand * op1)
6279 {
6280 exp->type = 2;
6281 exp->string = PrintInt(--op1->i);
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 UIntDec(struct Expression * exp, struct Operand * op1)
6292 {
6293 exp->type = 2;
6294 exp->string = PrintUInt(--op1->ui);
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 ShortDec(struct Expression * exp, struct Operand * op1)
6305 {
6306 exp->type = 2;
6307 exp->string = PrintShort(--op1->s);
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 UShortDec(struct Expression * exp, struct Operand * op1)
6318 {
6319 exp->type = 2;
6320 exp->string = PrintUShort(--op1->us);
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 CharDec(struct Expression * exp, struct Operand * op1)
6331 {
6332 exp->type = 2;
6333 exp->string = PrintChar(--op1->c);
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 UCharDec(struct Expression * exp, struct Operand * op1)
6344 {
6345 exp->type = 2;
6346 exp->string = PrintUChar(--op1->uc);
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 FloatDec(struct Expression * exp, struct Operand * op1)
6357 {
6358 exp->type = 2;
6359 exp->string = PrintFloat(--op1->f);
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 DoubleDec(struct Expression * exp, struct Operand * op1)
6370 {
6371 exp->type = 2;
6372 exp->string = PrintDouble(--op1->d);
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 IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6383 {
6384 int value2 = op2->i;
6385
6386 exp->type = 2;
6387 exp->string = PrintInt(op1->i = value2);
6388 if(!exp->expType)
6389 {
6390 exp->expType = op1->type;
6391 if(op1->type)
6392 op1->type->refCount++;
6393 }
6394 return 0x1;
6395 }
6396
6397 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6398 {
6399 unsigned int value2 = op2->ui;
6400
6401 exp->type = 2;
6402 exp->string = PrintUInt(op1->ui = value2);
6403 if(!exp->expType)
6404 {
6405 exp->expType = op1->type;
6406 if(op1->type)
6407 op1->type->refCount++;
6408 }
6409 return 0x1;
6410 }
6411
6412 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6413 {
6414 short value2 = op2->s;
6415
6416 exp->type = 2;
6417 exp->string = PrintShort(op1->s = value2);
6418 if(!exp->expType)
6419 {
6420 exp->expType = op1->type;
6421 if(op1->type)
6422 op1->type->refCount++;
6423 }
6424 return 0x1;
6425 }
6426
6427 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6428 {
6429 unsigned short value2 = op2->us;
6430
6431 exp->type = 2;
6432 exp->string = PrintUShort(op1->us = value2);
6433 if(!exp->expType)
6434 {
6435 exp->expType = op1->type;
6436 if(op1->type)
6437 op1->type->refCount++;
6438 }
6439 return 0x1;
6440 }
6441
6442 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6443 {
6444 char value2 = op2->c;
6445
6446 exp->type = 2;
6447 exp->string = PrintChar(op1->c = value2);
6448 if(!exp->expType)
6449 {
6450 exp->expType = op1->type;
6451 if(op1->type)
6452 op1->type->refCount++;
6453 }
6454 return 0x1;
6455 }
6456
6457 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6458 {
6459 unsigned char value2 = op2->uc;
6460
6461 exp->type = 2;
6462 exp->string = PrintUChar(op1->uc = value2);
6463 if(!exp->expType)
6464 {
6465 exp->expType = op1->type;
6466 if(op1->type)
6467 op1->type->refCount++;
6468 }
6469 return 0x1;
6470 }
6471
6472 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6473 {
6474 float value2 = op2->f;
6475
6476 exp->type = 2;
6477 exp->string = PrintFloat(op1->f = value2);
6478 if(!exp->expType)
6479 {
6480 exp->expType = op1->type;
6481 if(op1->type)
6482 op1->type->refCount++;
6483 }
6484 return 0x1;
6485 }
6486
6487 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6488 {
6489 double value2 = op2->d;
6490
6491 exp->type = 2;
6492 exp->string = PrintDouble(op1->d = value2);
6493 if(!exp->expType)
6494 {
6495 exp->expType = op1->type;
6496 if(op1->type)
6497 op1->type->refCount++;
6498 }
6499 return 0x1;
6500 }
6501
6502 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6503 {
6504 int value2 = op2->i;
6505
6506 exp->type = 2;
6507 exp->string = PrintInt(op1->i += value2);
6508 if(!exp->expType)
6509 {
6510 exp->expType = op1->type;
6511 if(op1->type)
6512 op1->type->refCount++;
6513 }
6514 return 0x1;
6515 }
6516
6517 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6518 {
6519 unsigned int value2 = op2->ui;
6520
6521 exp->type = 2;
6522 exp->string = PrintUInt(op1->ui += value2);
6523 if(!exp->expType)
6524 {
6525 exp->expType = op1->type;
6526 if(op1->type)
6527 op1->type->refCount++;
6528 }
6529 return 0x1;
6530 }
6531
6532 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6533 {
6534 short value2 = op2->s;
6535
6536 exp->type = 2;
6537 exp->string = PrintShort(op1->s += value2);
6538 if(!exp->expType)
6539 {
6540 exp->expType = op1->type;
6541 if(op1->type)
6542 op1->type->refCount++;
6543 }
6544 return 0x1;
6545 }
6546
6547 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6548 {
6549 unsigned short value2 = op2->us;
6550
6551 exp->type = 2;
6552 exp->string = PrintUShort(op1->us += value2);
6553 if(!exp->expType)
6554 {
6555 exp->expType = op1->type;
6556 if(op1->type)
6557 op1->type->refCount++;
6558 }
6559 return 0x1;
6560 }
6561
6562 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6563 {
6564 char value2 = op2->c;
6565
6566 exp->type = 2;
6567 exp->string = PrintChar(op1->c += value2);
6568 if(!exp->expType)
6569 {
6570 exp->expType = op1->type;
6571 if(op1->type)
6572 op1->type->refCount++;
6573 }
6574 return 0x1;
6575 }
6576
6577 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6578 {
6579 unsigned char value2 = op2->uc;
6580
6581 exp->type = 2;
6582 exp->string = PrintUChar(op1->uc += value2);
6583 if(!exp->expType)
6584 {
6585 exp->expType = op1->type;
6586 if(op1->type)
6587 op1->type->refCount++;
6588 }
6589 return 0x1;
6590 }
6591
6592 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6593 {
6594 float value2 = op2->f;
6595
6596 exp->type = 2;
6597 exp->string = PrintFloat(op1->f += value2);
6598 if(!exp->expType)
6599 {
6600 exp->expType = op1->type;
6601 if(op1->type)
6602 op1->type->refCount++;
6603 }
6604 return 0x1;
6605 }
6606
6607 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6608 {
6609 double value2 = op2->d;
6610
6611 exp->type = 2;
6612 exp->string = PrintDouble(op1->d += value2);
6613 if(!exp->expType)
6614 {
6615 exp->expType = op1->type;
6616 if(op1->type)
6617 op1->type->refCount++;
6618 }
6619 return 0x1;
6620 }
6621
6622 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6623 {
6624 int value2 = op2->i;
6625
6626 exp->type = 2;
6627 exp->string = PrintInt(op1->i -= value2);
6628 if(!exp->expType)
6629 {
6630 exp->expType = op1->type;
6631 if(op1->type)
6632 op1->type->refCount++;
6633 }
6634 return 0x1;
6635 }
6636
6637 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6638 {
6639 unsigned int value2 = op2->ui;
6640
6641 exp->type = 2;
6642 exp->string = PrintUInt(op1->ui -= value2);
6643 if(!exp->expType)
6644 {
6645 exp->expType = op1->type;
6646 if(op1->type)
6647 op1->type->refCount++;
6648 }
6649 return 0x1;
6650 }
6651
6652 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6653 {
6654 short value2 = op2->s;
6655
6656 exp->type = 2;
6657 exp->string = PrintShort(op1->s -= value2);
6658 if(!exp->expType)
6659 {
6660 exp->expType = op1->type;
6661 if(op1->type)
6662 op1->type->refCount++;
6663 }
6664 return 0x1;
6665 }
6666
6667 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6668 {
6669 unsigned short value2 = op2->us;
6670
6671 exp->type = 2;
6672 exp->string = PrintUShort(op1->us -= value2);
6673 if(!exp->expType)
6674 {
6675 exp->expType = op1->type;
6676 if(op1->type)
6677 op1->type->refCount++;
6678 }
6679 return 0x1;
6680 }
6681
6682 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6683 {
6684 char value2 = op2->c;
6685
6686 exp->type = 2;
6687 exp->string = PrintChar(op1->c -= value2);
6688 if(!exp->expType)
6689 {
6690 exp->expType = op1->type;
6691 if(op1->type)
6692 op1->type->refCount++;
6693 }
6694 return 0x1;
6695 }
6696
6697 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6698 {
6699 unsigned char value2 = op2->uc;
6700
6701 exp->type = 2;
6702 exp->string = PrintUChar(op1->uc -= value2);
6703 if(!exp->expType)
6704 {
6705 exp->expType = op1->type;
6706 if(op1->type)
6707 op1->type->refCount++;
6708 }
6709 return 0x1;
6710 }
6711
6712 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6713 {
6714 float value2 = op2->f;
6715
6716 exp->type = 2;
6717 exp->string = PrintFloat(op1->f -= value2);
6718 if(!exp->expType)
6719 {
6720 exp->expType = op1->type;
6721 if(op1->type)
6722 op1->type->refCount++;
6723 }
6724 return 0x1;
6725 }
6726
6727 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6728 {
6729 double value2 = op2->d;
6730
6731 exp->type = 2;
6732 exp->string = PrintDouble(op1->d -= value2);
6733 if(!exp->expType)
6734 {
6735 exp->expType = op1->type;
6736 if(op1->type)
6737 op1->type->refCount++;
6738 }
6739 return 0x1;
6740 }
6741
6742 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6743 {
6744 int value2 = op2->i;
6745
6746 exp->type = 2;
6747 exp->string = PrintInt(op1->i *= value2);
6748 if(!exp->expType)
6749 {
6750 exp->expType = op1->type;
6751 if(op1->type)
6752 op1->type->refCount++;
6753 }
6754 return 0x1;
6755 }
6756
6757 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6758 {
6759 unsigned int value2 = op2->ui;
6760
6761 exp->type = 2;
6762 exp->string = PrintUInt(op1->ui *= value2);
6763 if(!exp->expType)
6764 {
6765 exp->expType = op1->type;
6766 if(op1->type)
6767 op1->type->refCount++;
6768 }
6769 return 0x1;
6770 }
6771
6772 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6773 {
6774 short value2 = op2->s;
6775
6776 exp->type = 2;
6777 exp->string = PrintShort(op1->s *= value2);
6778 if(!exp->expType)
6779 {
6780 exp->expType = op1->type;
6781 if(op1->type)
6782 op1->type->refCount++;
6783 }
6784 return 0x1;
6785 }
6786
6787 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6788 {
6789 unsigned short value2 = op2->us;
6790
6791 exp->type = 2;
6792 exp->string = PrintUShort(op1->us *= value2);
6793 if(!exp->expType)
6794 {
6795 exp->expType = op1->type;
6796 if(op1->type)
6797 op1->type->refCount++;
6798 }
6799 return 0x1;
6800 }
6801
6802 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6803 {
6804 char value2 = op2->c;
6805
6806 exp->type = 2;
6807 exp->string = PrintChar(op1->c *= value2);
6808 if(!exp->expType)
6809 {
6810 exp->expType = op1->type;
6811 if(op1->type)
6812 op1->type->refCount++;
6813 }
6814 return 0x1;
6815 }
6816
6817 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6818 {
6819 unsigned char value2 = op2->uc;
6820
6821 exp->type = 2;
6822 exp->string = PrintUChar(op1->uc *= value2);
6823 if(!exp->expType)
6824 {
6825 exp->expType = op1->type;
6826 if(op1->type)
6827 op1->type->refCount++;
6828 }
6829 return 0x1;
6830 }
6831
6832 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6833 {
6834 float value2 = op2->f;
6835
6836 exp->type = 2;
6837 exp->string = PrintFloat(op1->f *= value2);
6838 if(!exp->expType)
6839 {
6840 exp->expType = op1->type;
6841 if(op1->type)
6842 op1->type->refCount++;
6843 }
6844 return 0x1;
6845 }
6846
6847 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6848 {
6849 double value2 = op2->d;
6850
6851 exp->type = 2;
6852 exp->string = PrintDouble(op1->d *= value2);
6853 if(!exp->expType)
6854 {
6855 exp->expType = op1->type;
6856 if(op1->type)
6857 op1->type->refCount++;
6858 }
6859 return 0x1;
6860 }
6861
6862 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6863 {
6864 int value2 = op2->i;
6865
6866 exp->type = 2;
6867 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
6868 if(!exp->expType)
6869 {
6870 exp->expType = op1->type;
6871 if(op1->type)
6872 op1->type->refCount++;
6873 }
6874 return 0x1;
6875 }
6876
6877 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6878 {
6879 unsigned int value2 = op2->ui;
6880
6881 exp->type = 2;
6882 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
6883 if(!exp->expType)
6884 {
6885 exp->expType = op1->type;
6886 if(op1->type)
6887 op1->type->refCount++;
6888 }
6889 return 0x1;
6890 }
6891
6892 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6893 {
6894 short value2 = op2->s;
6895
6896 exp->type = 2;
6897 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
6898 if(!exp->expType)
6899 {
6900 exp->expType = op1->type;
6901 if(op1->type)
6902 op1->type->refCount++;
6903 }
6904 return 0x1;
6905 }
6906
6907 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6908 {
6909 unsigned short value2 = op2->us;
6910
6911 exp->type = 2;
6912 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
6913 if(!exp->expType)
6914 {
6915 exp->expType = op1->type;
6916 if(op1->type)
6917 op1->type->refCount++;
6918 }
6919 return 0x1;
6920 }
6921
6922 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6923 {
6924 char value2 = op2->c;
6925
6926 exp->type = 2;
6927 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
6928 if(!exp->expType)
6929 {
6930 exp->expType = op1->type;
6931 if(op1->type)
6932 op1->type->refCount++;
6933 }
6934 return 0x1;
6935 }
6936
6937 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6938 {
6939 unsigned char value2 = op2->uc;
6940
6941 exp->type = 2;
6942 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
6943 if(!exp->expType)
6944 {
6945 exp->expType = op1->type;
6946 if(op1->type)
6947 op1->type->refCount++;
6948 }
6949 return 0x1;
6950 }
6951
6952 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6953 {
6954 float value2 = op2->f;
6955
6956 exp->type = 2;
6957 exp->string = PrintFloat(value2 ? (op1->f /= value2) : (float)0);
6958 if(!exp->expType)
6959 {
6960 exp->expType = op1->type;
6961 if(op1->type)
6962 op1->type->refCount++;
6963 }
6964 return 0x1;
6965 }
6966
6967 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6968 {
6969 double value2 = op2->d;
6970
6971 exp->type = 2;
6972 exp->string = PrintDouble(value2 ? (op1->d /= value2) : (double)0);
6973 if(!exp->expType)
6974 {
6975 exp->expType = op1->type;
6976 if(op1->type)
6977 op1->type->refCount++;
6978 }
6979 return 0x1;
6980 }
6981
6982 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6983 {
6984 int value2 = op2->i;
6985
6986 exp->type = 2;
6987 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
6988 if(!exp->expType)
6989 {
6990 exp->expType = op1->type;
6991 if(op1->type)
6992 op1->type->refCount++;
6993 }
6994 return 0x1;
6995 }
6996
6997 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6998 {
6999 unsigned int value2 = op2->ui;
7000
7001 exp->type = 2;
7002 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7003 if(!exp->expType)
7004 {
7005 exp->expType = op1->type;
7006 if(op1->type)
7007 op1->type->refCount++;
7008 }
7009 return 0x1;
7010 }
7011
7012 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7013 {
7014 short value2 = op2->s;
7015
7016 exp->type = 2;
7017 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7018 if(!exp->expType)
7019 {
7020 exp->expType = op1->type;
7021 if(op1->type)
7022 op1->type->refCount++;
7023 }
7024 return 0x1;
7025 }
7026
7027 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7028 {
7029 unsigned short value2 = op2->us;
7030
7031 exp->type = 2;
7032 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7033 if(!exp->expType)
7034 {
7035 exp->expType = op1->type;
7036 if(op1->type)
7037 op1->type->refCount++;
7038 }
7039 return 0x1;
7040 }
7041
7042 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7043 {
7044 char value2 = op2->c;
7045
7046 exp->type = 2;
7047 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7048 if(!exp->expType)
7049 {
7050 exp->expType = op1->type;
7051 if(op1->type)
7052 op1->type->refCount++;
7053 }
7054 return 0x1;
7055 }
7056
7057 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7058 {
7059 unsigned char value2 = op2->uc;
7060
7061 exp->type = 2;
7062 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7063 if(!exp->expType)
7064 {
7065 exp->expType = op1->type;
7066 if(op1->type)
7067 op1->type->refCount++;
7068 }
7069 return 0x1;
7070 }
7071
7072 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7073 {
7074 int value2 = op2->i;
7075
7076 exp->type = 2;
7077 exp->string = PrintInt(op1->i & value2);
7078 if(!exp->expType)
7079 {
7080 exp->expType = op1->type;
7081 if(op1->type)
7082 op1->type->refCount++;
7083 }
7084 return 0x1;
7085 }
7086
7087 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7088 {
7089 unsigned int value2 = op2->ui;
7090
7091 exp->type = 2;
7092 exp->string = PrintUInt(op1->ui & value2);
7093 if(!exp->expType)
7094 {
7095 exp->expType = op1->type;
7096 if(op1->type)
7097 op1->type->refCount++;
7098 }
7099 return 0x1;
7100 }
7101
7102 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7103 {
7104 short value2 = op2->s;
7105
7106 exp->type = 2;
7107 exp->string = PrintShort(op1->s & value2);
7108 if(!exp->expType)
7109 {
7110 exp->expType = op1->type;
7111 if(op1->type)
7112 op1->type->refCount++;
7113 }
7114 return 0x1;
7115 }
7116
7117 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7118 {
7119 unsigned short value2 = op2->us;
7120
7121 exp->type = 2;
7122 exp->string = PrintUShort(op1->us & value2);
7123 if(!exp->expType)
7124 {
7125 exp->expType = op1->type;
7126 if(op1->type)
7127 op1->type->refCount++;
7128 }
7129 return 0x1;
7130 }
7131
7132 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7133 {
7134 char value2 = op2->c;
7135
7136 exp->type = 2;
7137 exp->string = PrintChar(op1->c & value2);
7138 if(!exp->expType)
7139 {
7140 exp->expType = op1->type;
7141 if(op1->type)
7142 op1->type->refCount++;
7143 }
7144 return 0x1;
7145 }
7146
7147 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7148 {
7149 unsigned char value2 = op2->uc;
7150
7151 exp->type = 2;
7152 exp->string = PrintUChar(op1->uc & value2);
7153 if(!exp->expType)
7154 {
7155 exp->expType = op1->type;
7156 if(op1->type)
7157 op1->type->refCount++;
7158 }
7159 return 0x1;
7160 }
7161
7162 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7163 {
7164 int value2 = op2->i;
7165
7166 exp->type = 2;
7167 exp->string = PrintInt(op1->i | value2);
7168 if(!exp->expType)
7169 {
7170 exp->expType = op1->type;
7171 if(op1->type)
7172 op1->type->refCount++;
7173 }
7174 return 0x1;
7175 }
7176
7177 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7178 {
7179 unsigned int value2 = op2->ui;
7180
7181 exp->type = 2;
7182 exp->string = PrintUInt(op1->ui | value2);
7183 if(!exp->expType)
7184 {
7185 exp->expType = op1->type;
7186 if(op1->type)
7187 op1->type->refCount++;
7188 }
7189 return 0x1;
7190 }
7191
7192 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7193 {
7194 short value2 = op2->s;
7195
7196 exp->type = 2;
7197 exp->string = PrintShort(op1->s | value2);
7198 if(!exp->expType)
7199 {
7200 exp->expType = op1->type;
7201 if(op1->type)
7202 op1->type->refCount++;
7203 }
7204 return 0x1;
7205 }
7206
7207 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7208 {
7209 unsigned short value2 = op2->us;
7210
7211 exp->type = 2;
7212 exp->string = PrintUShort(op1->us | value2);
7213 if(!exp->expType)
7214 {
7215 exp->expType = op1->type;
7216 if(op1->type)
7217 op1->type->refCount++;
7218 }
7219 return 0x1;
7220 }
7221
7222 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7223 {
7224 char value2 = op2->c;
7225
7226 exp->type = 2;
7227 exp->string = PrintChar(op1->c | value2);
7228 if(!exp->expType)
7229 {
7230 exp->expType = op1->type;
7231 if(op1->type)
7232 op1->type->refCount++;
7233 }
7234 return 0x1;
7235 }
7236
7237 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7238 {
7239 unsigned char value2 = op2->uc;
7240
7241 exp->type = 2;
7242 exp->string = PrintUChar(op1->uc | value2);
7243 if(!exp->expType)
7244 {
7245 exp->expType = op1->type;
7246 if(op1->type)
7247 op1->type->refCount++;
7248 }
7249 return 0x1;
7250 }
7251
7252 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7253 {
7254 int value2 = op2->i;
7255
7256 exp->type = 2;
7257 exp->string = PrintInt(op1->i ^ value2);
7258 if(!exp->expType)
7259 {
7260 exp->expType = op1->type;
7261 if(op1->type)
7262 op1->type->refCount++;
7263 }
7264 return 0x1;
7265 }
7266
7267 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7268 {
7269 unsigned int value2 = op2->ui;
7270
7271 exp->type = 2;
7272 exp->string = PrintUInt(op1->ui ^ value2);
7273 if(!exp->expType)
7274 {
7275 exp->expType = op1->type;
7276 if(op1->type)
7277 op1->type->refCount++;
7278 }
7279 return 0x1;
7280 }
7281
7282 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7283 {
7284 short value2 = op2->s;
7285
7286 exp->type = 2;
7287 exp->string = PrintShort(op1->s ^ value2);
7288 if(!exp->expType)
7289 {
7290 exp->expType = op1->type;
7291 if(op1->type)
7292 op1->type->refCount++;
7293 }
7294 return 0x1;
7295 }
7296
7297 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7298 {
7299 unsigned short value2 = op2->us;
7300
7301 exp->type = 2;
7302 exp->string = PrintUShort(op1->us ^ value2);
7303 if(!exp->expType)
7304 {
7305 exp->expType = op1->type;
7306 if(op1->type)
7307 op1->type->refCount++;
7308 }
7309 return 0x1;
7310 }
7311
7312 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7313 {
7314 char value2 = op2->c;
7315
7316 exp->type = 2;
7317 exp->string = PrintChar(op1->c ^ value2);
7318 if(!exp->expType)
7319 {
7320 exp->expType = op1->type;
7321 if(op1->type)
7322 op1->type->refCount++;
7323 }
7324 return 0x1;
7325 }
7326
7327 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7328 {
7329 unsigned char value2 = op2->uc;
7330
7331 exp->type = 2;
7332 exp->string = PrintUChar(op1->uc ^ value2);
7333 if(!exp->expType)
7334 {
7335 exp->expType = op1->type;
7336 if(op1->type)
7337 op1->type->refCount++;
7338 }
7339 return 0x1;
7340 }
7341
7342 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7343 {
7344 int value2 = op2->i;
7345
7346 exp->type = 2;
7347 exp->string = PrintInt(op1->i << value2);
7348 if(!exp->expType)
7349 {
7350 exp->expType = op1->type;
7351 if(op1->type)
7352 op1->type->refCount++;
7353 }
7354 return 0x1;
7355 }
7356
7357 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7358 {
7359 unsigned int value2 = op2->ui;
7360
7361 exp->type = 2;
7362 exp->string = PrintUInt(op1->ui << value2);
7363 if(!exp->expType)
7364 {
7365 exp->expType = op1->type;
7366 if(op1->type)
7367 op1->type->refCount++;
7368 }
7369 return 0x1;
7370 }
7371
7372 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7373 {
7374 short value2 = op2->s;
7375
7376 exp->type = 2;
7377 exp->string = PrintShort(op1->s << value2);
7378 if(!exp->expType)
7379 {
7380 exp->expType = op1->type;
7381 if(op1->type)
7382 op1->type->refCount++;
7383 }
7384 return 0x1;
7385 }
7386
7387 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7388 {
7389 unsigned short value2 = op2->us;
7390
7391 exp->type = 2;
7392 exp->string = PrintUShort(op1->us << value2);
7393 if(!exp->expType)
7394 {
7395 exp->expType = op1->type;
7396 if(op1->type)
7397 op1->type->refCount++;
7398 }
7399 return 0x1;
7400 }
7401
7402 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7403 {
7404 char value2 = op2->c;
7405
7406 exp->type = 2;
7407 exp->string = PrintChar(op1->c << value2);
7408 if(!exp->expType)
7409 {
7410 exp->expType = op1->type;
7411 if(op1->type)
7412 op1->type->refCount++;
7413 }
7414 return 0x1;
7415 }
7416
7417 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7418 {
7419 unsigned char value2 = op2->uc;
7420
7421 exp->type = 2;
7422 exp->string = PrintUChar(op1->uc << value2);
7423 if(!exp->expType)
7424 {
7425 exp->expType = op1->type;
7426 if(op1->type)
7427 op1->type->refCount++;
7428 }
7429 return 0x1;
7430 }
7431
7432 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7433 {
7434 int value2 = op2->i;
7435
7436 exp->type = 2;
7437 exp->string = PrintInt(op1->i >> value2);
7438 if(!exp->expType)
7439 {
7440 exp->expType = op1->type;
7441 if(op1->type)
7442 op1->type->refCount++;
7443 }
7444 return 0x1;
7445 }
7446
7447 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7448 {
7449 unsigned int value2 = op2->ui;
7450
7451 exp->type = 2;
7452 exp->string = PrintUInt(op1->ui >> value2);
7453 if(!exp->expType)
7454 {
7455 exp->expType = op1->type;
7456 if(op1->type)
7457 op1->type->refCount++;
7458 }
7459 return 0x1;
7460 }
7461
7462 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7463 {
7464 short value2 = op2->s;
7465
7466 exp->type = 2;
7467 exp->string = PrintShort(op1->s >> value2);
7468 if(!exp->expType)
7469 {
7470 exp->expType = op1->type;
7471 if(op1->type)
7472 op1->type->refCount++;
7473 }
7474 return 0x1;
7475 }
7476
7477 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7478 {
7479 unsigned short value2 = op2->us;
7480
7481 exp->type = 2;
7482 exp->string = PrintUShort(op1->us >> value2);
7483 if(!exp->expType)
7484 {
7485 exp->expType = op1->type;
7486 if(op1->type)
7487 op1->type->refCount++;
7488 }
7489 return 0x1;
7490 }
7491
7492 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7493 {
7494 char value2 = op2->c;
7495
7496 exp->type = 2;
7497 exp->string = PrintChar(op1->c >> value2);
7498 if(!exp->expType)
7499 {
7500 exp->expType = op1->type;
7501 if(op1->type)
7502 op1->type->refCount++;
7503 }
7504 return 0x1;
7505 }
7506
7507 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7508 {
7509 unsigned char value2 = op2->uc;
7510
7511 exp->type = 2;
7512 exp->string = PrintUChar(op1->uc >> value2);
7513 if(!exp->expType)
7514 {
7515 exp->expType = op1->type;
7516 if(op1->type)
7517 op1->type->refCount++;
7518 }
7519 return 0x1;
7520 }
7521
7522 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
7523 {
7524 exp->type = 2;
7525 exp->string = PrintInt(~op1->i);
7526 if(!exp->expType)
7527 {
7528 exp->expType = op1->type;
7529 if(op1->type)
7530 op1->type->refCount++;
7531 }
7532 return 0x1;
7533 }
7534
7535 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
7536 {
7537 exp->type = 2;
7538 exp->string = PrintUInt(~op1->ui);
7539 if(!exp->expType)
7540 {
7541 exp->expType = op1->type;
7542 if(op1->type)
7543 op1->type->refCount++;
7544 }
7545 return 0x1;
7546 }
7547
7548 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
7549 {
7550 exp->type = 2;
7551 exp->string = PrintShort(~op1->s);
7552 if(!exp->expType)
7553 {
7554 exp->expType = op1->type;
7555 if(op1->type)
7556 op1->type->refCount++;
7557 }
7558 return 0x1;
7559 }
7560
7561 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
7562 {
7563 exp->type = 2;
7564 exp->string = PrintUShort(~op1->us);
7565 if(!exp->expType)
7566 {
7567 exp->expType = op1->type;
7568 if(op1->type)
7569 op1->type->refCount++;
7570 }
7571 return 0x1;
7572 }
7573
7574 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
7575 {
7576 exp->type = 2;
7577 exp->string = PrintChar(~op1->c);
7578 if(!exp->expType)
7579 {
7580 exp->expType = op1->type;
7581 if(op1->type)
7582 op1->type->refCount++;
7583 }
7584 return 0x1;
7585 }
7586
7587 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
7588 {
7589 exp->type = 2;
7590 exp->string = PrintUChar(~op1->uc);
7591 if(!exp->expType)
7592 {
7593 exp->expType = op1->type;
7594 if(op1->type)
7595 op1->type->refCount++;
7596 }
7597 return 0x1;
7598 }
7599
7600 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7601 {
7602 int value2 = op2->i;
7603
7604 exp->type = 2;
7605 exp->string = PrintInt(op1->i &= value2);
7606 if(!exp->expType)
7607 {
7608 exp->expType = op1->type;
7609 if(op1->type)
7610 op1->type->refCount++;
7611 }
7612 return 0x1;
7613 }
7614
7615 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7616 {
7617 unsigned int value2 = op2->ui;
7618
7619 exp->type = 2;
7620 exp->string = PrintUInt(op1->ui &= value2);
7621 if(!exp->expType)
7622 {
7623 exp->expType = op1->type;
7624 if(op1->type)
7625 op1->type->refCount++;
7626 }
7627 return 0x1;
7628 }
7629
7630 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7631 {
7632 short value2 = op2->s;
7633
7634 exp->type = 2;
7635 exp->string = PrintShort(op1->s &= value2);
7636 if(!exp->expType)
7637 {
7638 exp->expType = op1->type;
7639 if(op1->type)
7640 op1->type->refCount++;
7641 }
7642 return 0x1;
7643 }
7644
7645 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7646 {
7647 unsigned short value2 = op2->us;
7648
7649 exp->type = 2;
7650 exp->string = PrintUShort(op1->us &= value2);
7651 if(!exp->expType)
7652 {
7653 exp->expType = op1->type;
7654 if(op1->type)
7655 op1->type->refCount++;
7656 }
7657 return 0x1;
7658 }
7659
7660 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7661 {
7662 char value2 = op2->c;
7663
7664 exp->type = 2;
7665 exp->string = PrintChar(op1->c &= value2);
7666 if(!exp->expType)
7667 {
7668 exp->expType = op1->type;
7669 if(op1->type)
7670 op1->type->refCount++;
7671 }
7672 return 0x1;
7673 }
7674
7675 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7676 {
7677 unsigned char value2 = op2->uc;
7678
7679 exp->type = 2;
7680 exp->string = PrintUChar(op1->uc &= value2);
7681 if(!exp->expType)
7682 {
7683 exp->expType = op1->type;
7684 if(op1->type)
7685 op1->type->refCount++;
7686 }
7687 return 0x1;
7688 }
7689
7690 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7691 {
7692 int value2 = op2->i;
7693
7694 exp->type = 2;
7695 exp->string = PrintInt(op1->i |= value2);
7696 if(!exp->expType)
7697 {
7698 exp->expType = op1->type;
7699 if(op1->type)
7700 op1->type->refCount++;
7701 }
7702 return 0x1;
7703 }
7704
7705 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7706 {
7707 unsigned int value2 = op2->ui;
7708
7709 exp->type = 2;
7710 exp->string = PrintUInt(op1->ui |= value2);
7711 if(!exp->expType)
7712 {
7713 exp->expType = op1->type;
7714 if(op1->type)
7715 op1->type->refCount++;
7716 }
7717 return 0x1;
7718 }
7719
7720 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7721 {
7722 short value2 = op2->s;
7723
7724 exp->type = 2;
7725 exp->string = PrintShort(op1->s |= value2);
7726 if(!exp->expType)
7727 {
7728 exp->expType = op1->type;
7729 if(op1->type)
7730 op1->type->refCount++;
7731 }
7732 return 0x1;
7733 }
7734
7735 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7736 {
7737 unsigned short value2 = op2->us;
7738
7739 exp->type = 2;
7740 exp->string = PrintUShort(op1->us |= value2);
7741 if(!exp->expType)
7742 {
7743 exp->expType = op1->type;
7744 if(op1->type)
7745 op1->type->refCount++;
7746 }
7747 return 0x1;
7748 }
7749
7750 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7751 {
7752 char value2 = op2->c;
7753
7754 exp->type = 2;
7755 exp->string = PrintChar(op1->c |= value2);
7756 if(!exp->expType)
7757 {
7758 exp->expType = op1->type;
7759 if(op1->type)
7760 op1->type->refCount++;
7761 }
7762 return 0x1;
7763 }
7764
7765 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7766 {
7767 unsigned char value2 = op2->uc;
7768
7769 exp->type = 2;
7770 exp->string = PrintUChar(op1->uc |= value2);
7771 if(!exp->expType)
7772 {
7773 exp->expType = op1->type;
7774 if(op1->type)
7775 op1->type->refCount++;
7776 }
7777 return 0x1;
7778 }
7779
7780 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7781 {
7782 int value2 = op2->i;
7783
7784 exp->type = 2;
7785 exp->string = PrintInt(op1->i ^= value2);
7786 if(!exp->expType)
7787 {
7788 exp->expType = op1->type;
7789 if(op1->type)
7790 op1->type->refCount++;
7791 }
7792 return 0x1;
7793 }
7794
7795 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7796 {
7797 unsigned int value2 = op2->ui;
7798
7799 exp->type = 2;
7800 exp->string = PrintUInt(op1->ui ^= value2);
7801 if(!exp->expType)
7802 {
7803 exp->expType = op1->type;
7804 if(op1->type)
7805 op1->type->refCount++;
7806 }
7807 return 0x1;
7808 }
7809
7810 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7811 {
7812 short value2 = op2->s;
7813
7814 exp->type = 2;
7815 exp->string = PrintShort(op1->s ^= value2);
7816 if(!exp->expType)
7817 {
7818 exp->expType = op1->type;
7819 if(op1->type)
7820 op1->type->refCount++;
7821 }
7822 return 0x1;
7823 }
7824
7825 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7826 {
7827 unsigned short value2 = op2->us;
7828
7829 exp->type = 2;
7830 exp->string = PrintUShort(op1->us ^= value2);
7831 if(!exp->expType)
7832 {
7833 exp->expType = op1->type;
7834 if(op1->type)
7835 op1->type->refCount++;
7836 }
7837 return 0x1;
7838 }
7839
7840 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7841 {
7842 char value2 = op2->c;
7843
7844 exp->type = 2;
7845 exp->string = PrintChar(op1->c ^= value2);
7846 if(!exp->expType)
7847 {
7848 exp->expType = op1->type;
7849 if(op1->type)
7850 op1->type->refCount++;
7851 }
7852 return 0x1;
7853 }
7854
7855 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7856 {
7857 unsigned char value2 = op2->uc;
7858
7859 exp->type = 2;
7860 exp->string = PrintUChar(op1->uc ^= value2);
7861 if(!exp->expType)
7862 {
7863 exp->expType = op1->type;
7864 if(op1->type)
7865 op1->type->refCount++;
7866 }
7867 return 0x1;
7868 }
7869
7870 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7871 {
7872 int value2 = op2->i;
7873
7874 exp->type = 2;
7875 exp->string = PrintInt(op1->i <<= value2);
7876 if(!exp->expType)
7877 {
7878 exp->expType = op1->type;
7879 if(op1->type)
7880 op1->type->refCount++;
7881 }
7882 return 0x1;
7883 }
7884
7885 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7886 {
7887 unsigned int value2 = op2->ui;
7888
7889 exp->type = 2;
7890 exp->string = PrintUInt(op1->ui <<= value2);
7891 if(!exp->expType)
7892 {
7893 exp->expType = op1->type;
7894 if(op1->type)
7895 op1->type->refCount++;
7896 }
7897 return 0x1;
7898 }
7899
7900 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7901 {
7902 short value2 = op2->s;
7903
7904 exp->type = 2;
7905 exp->string = PrintShort(op1->s <<= value2);
7906 if(!exp->expType)
7907 {
7908 exp->expType = op1->type;
7909 if(op1->type)
7910 op1->type->refCount++;
7911 }
7912 return 0x1;
7913 }
7914
7915 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7916 {
7917 unsigned short value2 = op2->us;
7918
7919 exp->type = 2;
7920 exp->string = PrintUShort(op1->us <<= value2);
7921 if(!exp->expType)
7922 {
7923 exp->expType = op1->type;
7924 if(op1->type)
7925 op1->type->refCount++;
7926 }
7927 return 0x1;
7928 }
7929
7930 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7931 {
7932 char value2 = op2->c;
7933
7934 exp->type = 2;
7935 exp->string = PrintChar(op1->c <<= value2);
7936 if(!exp->expType)
7937 {
7938 exp->expType = op1->type;
7939 if(op1->type)
7940 op1->type->refCount++;
7941 }
7942 return 0x1;
7943 }
7944
7945 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7946 {
7947 unsigned char value2 = op2->uc;
7948
7949 exp->type = 2;
7950 exp->string = PrintUChar(op1->uc <<= value2);
7951 if(!exp->expType)
7952 {
7953 exp->expType = op1->type;
7954 if(op1->type)
7955 op1->type->refCount++;
7956 }
7957 return 0x1;
7958 }
7959
7960 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7961 {
7962 int value2 = op2->i;
7963
7964 exp->type = 2;
7965 exp->string = PrintInt(op1->i >>= value2);
7966 if(!exp->expType)
7967 {
7968 exp->expType = op1->type;
7969 if(op1->type)
7970 op1->type->refCount++;
7971 }
7972 return 0x1;
7973 }
7974
7975 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7976 {
7977 unsigned int value2 = op2->ui;
7978
7979 exp->type = 2;
7980 exp->string = PrintUInt(op1->ui >>= value2);
7981 if(!exp->expType)
7982 {
7983 exp->expType = op1->type;
7984 if(op1->type)
7985 op1->type->refCount++;
7986 }
7987 return 0x1;
7988 }
7989
7990 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7991 {
7992 short value2 = op2->s;
7993
7994 exp->type = 2;
7995 exp->string = PrintShort(op1->s >>= value2);
7996 if(!exp->expType)
7997 {
7998 exp->expType = op1->type;
7999 if(op1->type)
8000 op1->type->refCount++;
8001 }
8002 return 0x1;
8003 }
8004
8005 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8006 {
8007 unsigned short value2 = op2->us;
8008
8009 exp->type = 2;
8010 exp->string = PrintUShort(op1->us >>= value2);
8011 if(!exp->expType)
8012 {
8013 exp->expType = op1->type;
8014 if(op1->type)
8015 op1->type->refCount++;
8016 }
8017 return 0x1;
8018 }
8019
8020 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8021 {
8022 char value2 = op2->c;
8023
8024 exp->type = 2;
8025 exp->string = PrintChar(op1->c >>= value2);
8026 if(!exp->expType)
8027 {
8028 exp->expType = op1->type;
8029 if(op1->type)
8030 op1->type->refCount++;
8031 }
8032 return 0x1;
8033 }
8034
8035 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8036 {
8037 unsigned char value2 = op2->uc;
8038
8039 exp->type = 2;
8040 exp->string = PrintUChar(op1->uc >>= value2);
8041 if(!exp->expType)
8042 {
8043 exp->expType = op1->type;
8044 if(op1->type)
8045 op1->type->refCount++;
8046 }
8047 return 0x1;
8048 }
8049
8050 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
8051 {
8052 exp->type = 2;
8053 exp->string = PrintInt(!op1->i);
8054 if(!exp->expType)
8055 {
8056 exp->expType = op1->type;
8057 if(op1->type)
8058 op1->type->refCount++;
8059 }
8060 return 0x1;
8061 }
8062
8063 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
8064 {
8065 exp->type = 2;
8066 exp->string = PrintUInt(!op1->ui);
8067 if(!exp->expType)
8068 {
8069 exp->expType = op1->type;
8070 if(op1->type)
8071 op1->type->refCount++;
8072 }
8073 return 0x1;
8074 }
8075
8076 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
8077 {
8078 exp->type = 2;
8079 exp->string = PrintShort(!op1->s);
8080 if(!exp->expType)
8081 {
8082 exp->expType = op1->type;
8083 if(op1->type)
8084 op1->type->refCount++;
8085 }
8086 return 0x1;
8087 }
8088
8089 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
8090 {
8091 exp->type = 2;
8092 exp->string = PrintUShort(!op1->us);
8093 if(!exp->expType)
8094 {
8095 exp->expType = op1->type;
8096 if(op1->type)
8097 op1->type->refCount++;
8098 }
8099 return 0x1;
8100 }
8101
8102 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
8103 {
8104 exp->type = 2;
8105 exp->string = PrintChar(!op1->c);
8106 if(!exp->expType)
8107 {
8108 exp->expType = op1->type;
8109 if(op1->type)
8110 op1->type->refCount++;
8111 }
8112 return 0x1;
8113 }
8114
8115 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
8116 {
8117 exp->type = 2;
8118 exp->string = PrintUChar(!op1->uc);
8119 if(!exp->expType)
8120 {
8121 exp->expType = op1->type;
8122 if(op1->type)
8123 op1->type->refCount++;
8124 }
8125 return 0x1;
8126 }
8127
8128 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8129 {
8130 int value2 = op2->i;
8131
8132 exp->type = 2;
8133 exp->string = PrintInt(op1->i == value2);
8134 if(!exp->expType)
8135 {
8136 exp->expType = op1->type;
8137 if(op1->type)
8138 op1->type->refCount++;
8139 }
8140 return 0x1;
8141 }
8142
8143 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8144 {
8145 unsigned int value2 = op2->ui;
8146
8147 exp->type = 2;
8148 exp->string = PrintUInt(op1->ui == value2);
8149 if(!exp->expType)
8150 {
8151 exp->expType = op1->type;
8152 if(op1->type)
8153 op1->type->refCount++;
8154 }
8155 return 0x1;
8156 }
8157
8158 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8159 {
8160 short value2 = op2->s;
8161
8162 exp->type = 2;
8163 exp->string = PrintShort(op1->s == value2);
8164 if(!exp->expType)
8165 {
8166 exp->expType = op1->type;
8167 if(op1->type)
8168 op1->type->refCount++;
8169 }
8170 return 0x1;
8171 }
8172
8173 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8174 {
8175 unsigned short value2 = op2->us;
8176
8177 exp->type = 2;
8178 exp->string = PrintUShort(op1->us == value2);
8179 if(!exp->expType)
8180 {
8181 exp->expType = op1->type;
8182 if(op1->type)
8183 op1->type->refCount++;
8184 }
8185 return 0x1;
8186 }
8187
8188 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8189 {
8190 char value2 = op2->c;
8191
8192 exp->type = 2;
8193 exp->string = PrintChar(op1->c == value2);
8194 if(!exp->expType)
8195 {
8196 exp->expType = op1->type;
8197 if(op1->type)
8198 op1->type->refCount++;
8199 }
8200 return 0x1;
8201 }
8202
8203 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8204 {
8205 unsigned char value2 = op2->uc;
8206
8207 exp->type = 2;
8208 exp->string = PrintUChar(op1->uc == value2);
8209 if(!exp->expType)
8210 {
8211 exp->expType = op1->type;
8212 if(op1->type)
8213 op1->type->refCount++;
8214 }
8215 return 0x1;
8216 }
8217
8218 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8219 {
8220 float value2 = op2->f;
8221
8222 exp->type = 2;
8223 exp->string = PrintFloat(op1->f == value2);
8224 if(!exp->expType)
8225 {
8226 exp->expType = op1->type;
8227 if(op1->type)
8228 op1->type->refCount++;
8229 }
8230 return 0x1;
8231 }
8232
8233 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8234 {
8235 double value2 = op2->d;
8236
8237 exp->type = 2;
8238 exp->string = PrintDouble(op1->d == value2);
8239 if(!exp->expType)
8240 {
8241 exp->expType = op1->type;
8242 if(op1->type)
8243 op1->type->refCount++;
8244 }
8245 return 0x1;
8246 }
8247
8248 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8249 {
8250 int value2 = op2->i;
8251
8252 exp->type = 2;
8253 exp->string = PrintInt(op1->i != value2);
8254 if(!exp->expType)
8255 {
8256 exp->expType = op1->type;
8257 if(op1->type)
8258 op1->type->refCount++;
8259 }
8260 return 0x1;
8261 }
8262
8263 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8264 {
8265 unsigned int value2 = op2->ui;
8266
8267 exp->type = 2;
8268 exp->string = PrintUInt(op1->ui != value2);
8269 if(!exp->expType)
8270 {
8271 exp->expType = op1->type;
8272 if(op1->type)
8273 op1->type->refCount++;
8274 }
8275 return 0x1;
8276 }
8277
8278 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8279 {
8280 short value2 = op2->s;
8281
8282 exp->type = 2;
8283 exp->string = PrintShort(op1->s != value2);
8284 if(!exp->expType)
8285 {
8286 exp->expType = op1->type;
8287 if(op1->type)
8288 op1->type->refCount++;
8289 }
8290 return 0x1;
8291 }
8292
8293 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8294 {
8295 unsigned short value2 = op2->us;
8296
8297 exp->type = 2;
8298 exp->string = PrintUShort(op1->us != value2);
8299 if(!exp->expType)
8300 {
8301 exp->expType = op1->type;
8302 if(op1->type)
8303 op1->type->refCount++;
8304 }
8305 return 0x1;
8306 }
8307
8308 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8309 {
8310 char value2 = op2->c;
8311
8312 exp->type = 2;
8313 exp->string = PrintChar(op1->c != value2);
8314 if(!exp->expType)
8315 {
8316 exp->expType = op1->type;
8317 if(op1->type)
8318 op1->type->refCount++;
8319 }
8320 return 0x1;
8321 }
8322
8323 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8324 {
8325 unsigned char value2 = op2->uc;
8326
8327 exp->type = 2;
8328 exp->string = PrintUChar(op1->uc != value2);
8329 if(!exp->expType)
8330 {
8331 exp->expType = op1->type;
8332 if(op1->type)
8333 op1->type->refCount++;
8334 }
8335 return 0x1;
8336 }
8337
8338 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8339 {
8340 float value2 = op2->f;
8341
8342 exp->type = 2;
8343 exp->string = PrintFloat(op1->f != value2);
8344 if(!exp->expType)
8345 {
8346 exp->expType = op1->type;
8347 if(op1->type)
8348 op1->type->refCount++;
8349 }
8350 return 0x1;
8351 }
8352
8353 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8354 {
8355 double value2 = op2->d;
8356
8357 exp->type = 2;
8358 exp->string = PrintDouble(op1->d != value2);
8359 if(!exp->expType)
8360 {
8361 exp->expType = op1->type;
8362 if(op1->type)
8363 op1->type->refCount++;
8364 }
8365 return 0x1;
8366 }
8367
8368 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8369 {
8370 int value2 = op2->i;
8371
8372 exp->type = 2;
8373 exp->string = PrintInt(op1->i && value2);
8374 if(!exp->expType)
8375 {
8376 exp->expType = op1->type;
8377 if(op1->type)
8378 op1->type->refCount++;
8379 }
8380 return 0x1;
8381 }
8382
8383 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8384 {
8385 unsigned int value2 = op2->ui;
8386
8387 exp->type = 2;
8388 exp->string = PrintUInt(op1->ui && value2);
8389 if(!exp->expType)
8390 {
8391 exp->expType = op1->type;
8392 if(op1->type)
8393 op1->type->refCount++;
8394 }
8395 return 0x1;
8396 }
8397
8398 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8399 {
8400 short value2 = op2->s;
8401
8402 exp->type = 2;
8403 exp->string = PrintShort(op1->s && value2);
8404 if(!exp->expType)
8405 {
8406 exp->expType = op1->type;
8407 if(op1->type)
8408 op1->type->refCount++;
8409 }
8410 return 0x1;
8411 }
8412
8413 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8414 {
8415 unsigned short value2 = op2->us;
8416
8417 exp->type = 2;
8418 exp->string = PrintUShort(op1->us && value2);
8419 if(!exp->expType)
8420 {
8421 exp->expType = op1->type;
8422 if(op1->type)
8423 op1->type->refCount++;
8424 }
8425 return 0x1;
8426 }
8427
8428 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8429 {
8430 char value2 = op2->c;
8431
8432 exp->type = 2;
8433 exp->string = PrintChar(op1->c && value2);
8434 if(!exp->expType)
8435 {
8436 exp->expType = op1->type;
8437 if(op1->type)
8438 op1->type->refCount++;
8439 }
8440 return 0x1;
8441 }
8442
8443 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8444 {
8445 unsigned char value2 = op2->uc;
8446
8447 exp->type = 2;
8448 exp->string = PrintUChar(op1->uc && value2);
8449 if(!exp->expType)
8450 {
8451 exp->expType = op1->type;
8452 if(op1->type)
8453 op1->type->refCount++;
8454 }
8455 return 0x1;
8456 }
8457
8458 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8459 {
8460 float value2 = op2->f;
8461
8462 exp->type = 2;
8463 exp->string = PrintFloat(op1->f && value2);
8464 if(!exp->expType)
8465 {
8466 exp->expType = op1->type;
8467 if(op1->type)
8468 op1->type->refCount++;
8469 }
8470 return 0x1;
8471 }
8472
8473 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8474 {
8475 double value2 = op2->d;
8476
8477 exp->type = 2;
8478 exp->string = PrintDouble(op1->d && value2);
8479 if(!exp->expType)
8480 {
8481 exp->expType = op1->type;
8482 if(op1->type)
8483 op1->type->refCount++;
8484 }
8485 return 0x1;
8486 }
8487
8488 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8489 {
8490 int value2 = op2->i;
8491
8492 exp->type = 2;
8493 exp->string = PrintInt(op1->i || value2);
8494 if(!exp->expType)
8495 {
8496 exp->expType = op1->type;
8497 if(op1->type)
8498 op1->type->refCount++;
8499 }
8500 return 0x1;
8501 }
8502
8503 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8504 {
8505 unsigned int value2 = op2->ui;
8506
8507 exp->type = 2;
8508 exp->string = PrintUInt(op1->ui || value2);
8509 if(!exp->expType)
8510 {
8511 exp->expType = op1->type;
8512 if(op1->type)
8513 op1->type->refCount++;
8514 }
8515 return 0x1;
8516 }
8517
8518 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8519 {
8520 short value2 = op2->s;
8521
8522 exp->type = 2;
8523 exp->string = PrintShort(op1->s || value2);
8524 if(!exp->expType)
8525 {
8526 exp->expType = op1->type;
8527 if(op1->type)
8528 op1->type->refCount++;
8529 }
8530 return 0x1;
8531 }
8532
8533 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8534 {
8535 unsigned short value2 = op2->us;
8536
8537 exp->type = 2;
8538 exp->string = PrintUShort(op1->us || value2);
8539 if(!exp->expType)
8540 {
8541 exp->expType = op1->type;
8542 if(op1->type)
8543 op1->type->refCount++;
8544 }
8545 return 0x1;
8546 }
8547
8548 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8549 {
8550 char value2 = op2->c;
8551
8552 exp->type = 2;
8553 exp->string = PrintChar(op1->c || value2);
8554 if(!exp->expType)
8555 {
8556 exp->expType = op1->type;
8557 if(op1->type)
8558 op1->type->refCount++;
8559 }
8560 return 0x1;
8561 }
8562
8563 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8564 {
8565 unsigned char value2 = op2->uc;
8566
8567 exp->type = 2;
8568 exp->string = PrintUChar(op1->uc || value2);
8569 if(!exp->expType)
8570 {
8571 exp->expType = op1->type;
8572 if(op1->type)
8573 op1->type->refCount++;
8574 }
8575 return 0x1;
8576 }
8577
8578 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8579 {
8580 float value2 = op2->f;
8581
8582 exp->type = 2;
8583 exp->string = PrintFloat(op1->f || value2);
8584 if(!exp->expType)
8585 {
8586 exp->expType = op1->type;
8587 if(op1->type)
8588 op1->type->refCount++;
8589 }
8590 return 0x1;
8591 }
8592
8593 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8594 {
8595 double value2 = op2->d;
8596
8597 exp->type = 2;
8598 exp->string = PrintDouble(op1->d || value2);
8599 if(!exp->expType)
8600 {
8601 exp->expType = op1->type;
8602 if(op1->type)
8603 op1->type->refCount++;
8604 }
8605 return 0x1;
8606 }
8607
8608 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8609 {
8610 int value2 = op2->i;
8611
8612 exp->type = 2;
8613 exp->string = PrintInt(op1->i > value2);
8614 if(!exp->expType)
8615 {
8616 exp->expType = op1->type;
8617 if(op1->type)
8618 op1->type->refCount++;
8619 }
8620 return 0x1;
8621 }
8622
8623 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8624 {
8625 unsigned int value2 = op2->ui;
8626
8627 exp->type = 2;
8628 exp->string = PrintUInt(op1->ui > value2);
8629 if(!exp->expType)
8630 {
8631 exp->expType = op1->type;
8632 if(op1->type)
8633 op1->type->refCount++;
8634 }
8635 return 0x1;
8636 }
8637
8638 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8639 {
8640 short value2 = op2->s;
8641
8642 exp->type = 2;
8643 exp->string = PrintShort(op1->s > value2);
8644 if(!exp->expType)
8645 {
8646 exp->expType = op1->type;
8647 if(op1->type)
8648 op1->type->refCount++;
8649 }
8650 return 0x1;
8651 }
8652
8653 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8654 {
8655 unsigned short value2 = op2->us;
8656
8657 exp->type = 2;
8658 exp->string = PrintUShort(op1->us > value2);
8659 if(!exp->expType)
8660 {
8661 exp->expType = op1->type;
8662 if(op1->type)
8663 op1->type->refCount++;
8664 }
8665 return 0x1;
8666 }
8667
8668 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8669 {
8670 char value2 = op2->c;
8671
8672 exp->type = 2;
8673 exp->string = PrintChar(op1->c > value2);
8674 if(!exp->expType)
8675 {
8676 exp->expType = op1->type;
8677 if(op1->type)
8678 op1->type->refCount++;
8679 }
8680 return 0x1;
8681 }
8682
8683 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8684 {
8685 unsigned char value2 = op2->uc;
8686
8687 exp->type = 2;
8688 exp->string = PrintUChar(op1->uc > value2);
8689 if(!exp->expType)
8690 {
8691 exp->expType = op1->type;
8692 if(op1->type)
8693 op1->type->refCount++;
8694 }
8695 return 0x1;
8696 }
8697
8698 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8699 {
8700 float value2 = op2->f;
8701
8702 exp->type = 2;
8703 exp->string = PrintFloat(op1->f > value2);
8704 if(!exp->expType)
8705 {
8706 exp->expType = op1->type;
8707 if(op1->type)
8708 op1->type->refCount++;
8709 }
8710 return 0x1;
8711 }
8712
8713 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8714 {
8715 double value2 = op2->d;
8716
8717 exp->type = 2;
8718 exp->string = PrintDouble(op1->d > value2);
8719 if(!exp->expType)
8720 {
8721 exp->expType = op1->type;
8722 if(op1->type)
8723 op1->type->refCount++;
8724 }
8725 return 0x1;
8726 }
8727
8728 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8729 {
8730 int value2 = op2->i;
8731
8732 exp->type = 2;
8733 exp->string = PrintInt(op1->i < value2);
8734 if(!exp->expType)
8735 {
8736 exp->expType = op1->type;
8737 if(op1->type)
8738 op1->type->refCount++;
8739 }
8740 return 0x1;
8741 }
8742
8743 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8744 {
8745 unsigned int value2 = op2->ui;
8746
8747 exp->type = 2;
8748 exp->string = PrintUInt(op1->ui < value2);
8749 if(!exp->expType)
8750 {
8751 exp->expType = op1->type;
8752 if(op1->type)
8753 op1->type->refCount++;
8754 }
8755 return 0x1;
8756 }
8757
8758 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8759 {
8760 short value2 = op2->s;
8761
8762 exp->type = 2;
8763 exp->string = PrintShort(op1->s < value2);
8764 if(!exp->expType)
8765 {
8766 exp->expType = op1->type;
8767 if(op1->type)
8768 op1->type->refCount++;
8769 }
8770 return 0x1;
8771 }
8772
8773 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8774 {
8775 unsigned short value2 = op2->us;
8776
8777 exp->type = 2;
8778 exp->string = PrintUShort(op1->us < value2);
8779 if(!exp->expType)
8780 {
8781 exp->expType = op1->type;
8782 if(op1->type)
8783 op1->type->refCount++;
8784 }
8785 return 0x1;
8786 }
8787
8788 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8789 {
8790 char value2 = op2->c;
8791
8792 exp->type = 2;
8793 exp->string = PrintChar(op1->c < value2);
8794 if(!exp->expType)
8795 {
8796 exp->expType = op1->type;
8797 if(op1->type)
8798 op1->type->refCount++;
8799 }
8800 return 0x1;
8801 }
8802
8803 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8804 {
8805 unsigned char value2 = op2->uc;
8806
8807 exp->type = 2;
8808 exp->string = PrintUChar(op1->uc < value2);
8809 if(!exp->expType)
8810 {
8811 exp->expType = op1->type;
8812 if(op1->type)
8813 op1->type->refCount++;
8814 }
8815 return 0x1;
8816 }
8817
8818 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8819 {
8820 float value2 = op2->f;
8821
8822 exp->type = 2;
8823 exp->string = PrintFloat(op1->f < value2);
8824 if(!exp->expType)
8825 {
8826 exp->expType = op1->type;
8827 if(op1->type)
8828 op1->type->refCount++;
8829 }
8830 return 0x1;
8831 }
8832
8833 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8834 {
8835 double value2 = op2->d;
8836
8837 exp->type = 2;
8838 exp->string = PrintDouble(op1->d < value2);
8839 if(!exp->expType)
8840 {
8841 exp->expType = op1->type;
8842 if(op1->type)
8843 op1->type->refCount++;
8844 }
8845 return 0x1;
8846 }
8847
8848 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8849 {
8850 int value2 = op2->i;
8851
8852 exp->type = 2;
8853 exp->string = PrintInt(op1->i >= value2);
8854 if(!exp->expType)
8855 {
8856 exp->expType = op1->type;
8857 if(op1->type)
8858 op1->type->refCount++;
8859 }
8860 return 0x1;
8861 }
8862
8863 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8864 {
8865 unsigned int value2 = op2->ui;
8866
8867 exp->type = 2;
8868 exp->string = PrintUInt(op1->ui >= value2);
8869 if(!exp->expType)
8870 {
8871 exp->expType = op1->type;
8872 if(op1->type)
8873 op1->type->refCount++;
8874 }
8875 return 0x1;
8876 }
8877
8878 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8879 {
8880 short value2 = op2->s;
8881
8882 exp->type = 2;
8883 exp->string = PrintShort(op1->s >= value2);
8884 if(!exp->expType)
8885 {
8886 exp->expType = op1->type;
8887 if(op1->type)
8888 op1->type->refCount++;
8889 }
8890 return 0x1;
8891 }
8892
8893 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8894 {
8895 unsigned short value2 = op2->us;
8896
8897 exp->type = 2;
8898 exp->string = PrintUShort(op1->us >= value2);
8899 if(!exp->expType)
8900 {
8901 exp->expType = op1->type;
8902 if(op1->type)
8903 op1->type->refCount++;
8904 }
8905 return 0x1;
8906 }
8907
8908 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8909 {
8910 char value2 = op2->c;
8911
8912 exp->type = 2;
8913 exp->string = PrintChar(op1->c >= value2);
8914 if(!exp->expType)
8915 {
8916 exp->expType = op1->type;
8917 if(op1->type)
8918 op1->type->refCount++;
8919 }
8920 return 0x1;
8921 }
8922
8923 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8924 {
8925 unsigned char value2 = op2->uc;
8926
8927 exp->type = 2;
8928 exp->string = PrintUChar(op1->uc >= value2);
8929 if(!exp->expType)
8930 {
8931 exp->expType = op1->type;
8932 if(op1->type)
8933 op1->type->refCount++;
8934 }
8935 return 0x1;
8936 }
8937
8938 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8939 {
8940 float value2 = op2->f;
8941
8942 exp->type = 2;
8943 exp->string = PrintFloat(op1->f >= value2);
8944 if(!exp->expType)
8945 {
8946 exp->expType = op1->type;
8947 if(op1->type)
8948 op1->type->refCount++;
8949 }
8950 return 0x1;
8951 }
8952
8953 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8954 {
8955 double value2 = op2->d;
8956
8957 exp->type = 2;
8958 exp->string = PrintDouble(op1->d >= value2);
8959 if(!exp->expType)
8960 {
8961 exp->expType = op1->type;
8962 if(op1->type)
8963 op1->type->refCount++;
8964 }
8965 return 0x1;
8966 }
8967
8968 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8969 {
8970 int value2 = op2->i;
8971
8972 exp->type = 2;
8973 exp->string = PrintInt(op1->i <= value2);
8974 if(!exp->expType)
8975 {
8976 exp->expType = op1->type;
8977 if(op1->type)
8978 op1->type->refCount++;
8979 }
8980 return 0x1;
8981 }
8982
8983 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8984 {
8985 unsigned int value2 = op2->ui;
8986
8987 exp->type = 2;
8988 exp->string = PrintUInt(op1->ui <= value2);
8989 if(!exp->expType)
8990 {
8991 exp->expType = op1->type;
8992 if(op1->type)
8993 op1->type->refCount++;
8994 }
8995 return 0x1;
8996 }
8997
8998 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8999 {
9000 short value2 = op2->s;
9001
9002 exp->type = 2;
9003 exp->string = PrintShort(op1->s <= value2);
9004 if(!exp->expType)
9005 {
9006 exp->expType = op1->type;
9007 if(op1->type)
9008 op1->type->refCount++;
9009 }
9010 return 0x1;
9011 }
9012
9013 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9014 {
9015 unsigned short value2 = op2->us;
9016
9017 exp->type = 2;
9018 exp->string = PrintUShort(op1->us <= value2);
9019 if(!exp->expType)
9020 {
9021 exp->expType = op1->type;
9022 if(op1->type)
9023 op1->type->refCount++;
9024 }
9025 return 0x1;
9026 }
9027
9028 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9029 {
9030 char value2 = op2->c;
9031
9032 exp->type = 2;
9033 exp->string = PrintChar(op1->c <= value2);
9034 if(!exp->expType)
9035 {
9036 exp->expType = op1->type;
9037 if(op1->type)
9038 op1->type->refCount++;
9039 }
9040 return 0x1;
9041 }
9042
9043 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9044 {
9045 unsigned char value2 = op2->uc;
9046
9047 exp->type = 2;
9048 exp->string = PrintUChar(op1->uc <= value2);
9049 if(!exp->expType)
9050 {
9051 exp->expType = op1->type;
9052 if(op1->type)
9053 op1->type->refCount++;
9054 }
9055 return 0x1;
9056 }
9057
9058 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9059 {
9060 float value2 = op2->f;
9061
9062 exp->type = 2;
9063 exp->string = PrintFloat(op1->f <= value2);
9064 if(!exp->expType)
9065 {
9066 exp->expType = op1->type;
9067 if(op1->type)
9068 op1->type->refCount++;
9069 }
9070 return 0x1;
9071 }
9072
9073 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9074 {
9075 double value2 = op2->d;
9076
9077 exp->type = 2;
9078 exp->string = PrintDouble(op1->d <= value2);
9079 if(!exp->expType)
9080 {
9081 exp->expType = op1->type;
9082 if(op1->type)
9083 op1->type->refCount++;
9084 }
9085 return 0x1;
9086 }
9087
9088 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9089 {
9090 exp->type = 2;
9091 exp->string = PrintInt(op1->i ? op2->i : op3->i);
9092 if(!exp->expType)
9093 {
9094 exp->expType = op1->type;
9095 if(op1->type)
9096 op1->type->refCount++;
9097 }
9098 return 0x1;
9099 }
9100
9101 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9102 {
9103 exp->type = 2;
9104 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
9105 if(!exp->expType)
9106 {
9107 exp->expType = op1->type;
9108 if(op1->type)
9109 op1->type->refCount++;
9110 }
9111 return 0x1;
9112 }
9113
9114 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9115 {
9116 exp->type = 2;
9117 exp->string = PrintShort(op1->s ? op2->s : op3->s);
9118 if(!exp->expType)
9119 {
9120 exp->expType = op1->type;
9121 if(op1->type)
9122 op1->type->refCount++;
9123 }
9124 return 0x1;
9125 }
9126
9127 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9128 {
9129 exp->type = 2;
9130 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
9131 if(!exp->expType)
9132 {
9133 exp->expType = op1->type;
9134 if(op1->type)
9135 op1->type->refCount++;
9136 }
9137 return 0x1;
9138 }
9139
9140 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9141 {
9142 exp->type = 2;
9143 exp->string = PrintChar(op1->c ? op2->c : op3->c);
9144 if(!exp->expType)
9145 {
9146 exp->expType = op1->type;
9147 if(op1->type)
9148 op1->type->refCount++;
9149 }
9150 return 0x1;
9151 }
9152
9153 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9154 {
9155 exp->type = 2;
9156 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
9157 if(!exp->expType)
9158 {
9159 exp->expType = op1->type;
9160 if(op1->type)
9161 op1->type->refCount++;
9162 }
9163 return 0x1;
9164 }
9165
9166 static unsigned int FloatCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9167 {
9168 exp->type = 2;
9169 exp->string = PrintFloat(op1->f ? op2->f : op3->f);
9170 if(!exp->expType)
9171 {
9172 exp->expType = op1->type;
9173 if(op1->type)
9174 op1->type->refCount++;
9175 }
9176 return 0x1;
9177 }
9178
9179 static unsigned int DoubleCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
9180 {
9181 exp->type = 2;
9182 exp->string = PrintDouble(op1->d ? op2->d : op3->d);
9183 if(!exp->expType)
9184 {
9185 exp->expType = op1->type;
9186 if(op1->type)
9187 op1->type->refCount++;
9188 }
9189 return 0x1;
9190 }
9191
9192 struct OpTable intOps = 
9193 {
9194 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
9195 };
9196
9197 struct OpTable uintOps = 
9198 {
9199 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
9200 };
9201
9202 struct OpTable shortOps = 
9203 {
9204 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
9205 };
9206
9207 struct OpTable ushortOps = 
9208 {
9209 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
9210 };
9211
9212 struct OpTable floatOps = 
9213 {
9214 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
9215 };
9216
9217 struct OpTable doubleOps = 
9218 {
9219 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
9220 };
9221
9222 struct OpTable charOps = 
9223 {
9224 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
9225 };
9226
9227 struct OpTable ucharOps = 
9228 {
9229 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
9230 };
9231
9232 void ReadString(char * output, char * string)
9233 {
9234 int len = strlen(string);
9235 int c, d = 0;
9236 unsigned int quoted = 0x0, escaped = 0x0;
9237
9238 for(c = 0; c < len; c++)
9239 {
9240 char ch = string[c];
9241
9242 if(escaped)
9243 {
9244 switch(ch)
9245 {
9246 case 'n':
9247 output[d] = '\n';
9248 break;
9249 case 't':
9250 output[d] = '\t';
9251 break;
9252 case 'a':
9253 output[d] = '\a';
9254 break;
9255 case 'b':
9256 output[d] = '\b';
9257 break;
9258 case 'f':
9259 output[d] = '\f';
9260 break;
9261 case 'r':
9262 output[d] = '\r';
9263 break;
9264 case 'v':
9265 output[d] = '\v';
9266 break;
9267 case '\\':
9268 output[d] = '\\';
9269 break;
9270 case '\"':
9271 output[d] = '\"';
9272 break;
9273 default:
9274 output[d++] = '\\';
9275 output[d] = ch;
9276 }
9277 d++;
9278 escaped = 0x0;
9279 }
9280 else
9281 {
9282 if(ch == '\"')
9283 quoted ^= 0x1;
9284 else if(quoted)
9285 {
9286 if(ch == '\\')
9287 escaped = 0x1;
9288 else
9289 output[d++] = ch;
9290 }
9291 }
9292 }
9293 output[d] = '\0';
9294 }
9295
9296 extern double strtod(char * , char * * );
9297
9298 struct Operand GetOperand(struct Expression * exp)
9299 {
9300 struct Operand op = 
9301 {
9302 0, 0, 0, 0, 
9303 {
9304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
9305 }
9306 };
9307 struct Type * type = exp->expType;
9308
9309 if(type)
9310 {
9311 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
9312 {
9313 if(!type->_class->registered->dataType)
9314 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9315 type = type->_class->registered->dataType;
9316 }
9317 op.kind = type->kind;
9318 op.type = exp->expType;
9319 if(exp->isConstant && exp->type == 2)
9320 {
9321 switch(op.kind)
9322 {
9323 case 1:
9324 {
9325 if(exp->constant[0] == '\'')
9326 op.c = exp->constant[1];
9327 else if(type->isSigned)
9328 {
9329 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
9330 op.ops = charOps;
9331 }
9332 else
9333 {
9334 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
9335 op.ops = ucharOps;
9336 }
9337 break;
9338 }
9339 case 2:
9340 if(type->isSigned)
9341 {
9342 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
9343 op.ops = shortOps;
9344 }
9345 else
9346 {
9347 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
9348 op.ops = ushortOps;
9349 }
9350 break;
9351 case 3:
9352 case 5:
9353 if(type->isSigned)
9354 {
9355 op.i = strtol(exp->constant, (((void *)0)), 0);
9356 op.ops = intOps;
9357 }
9358 else
9359 {
9360 op.ui = strtoul(exp->constant, (((void *)0)), 0);
9361 op.ops = uintOps;
9362 }
9363 op.kind = 3;
9364 break;
9365 case 4:
9366 if(type->isSigned)
9367 {
9368 op.i64 = _strtoi64(exp->constant, (((void *)0)), 0);
9369 op.ops = intOps;
9370 }
9371 else
9372 {
9373 op.ui64 = _strtoui64(exp->constant, (((void *)0)), 0);
9374 op.ops = uintOps;
9375 }
9376 op.kind = 3;
9377 break;
9378 case 22:
9379 if(type->isSigned)
9380 {
9381 op.iptr = (intptr_t)_strtoi64(exp->constant, (((void *)0)), 0);
9382 op.ops = intOps;
9383 }
9384 else
9385 {
9386 op.uiptr = (uintptr_t)_strtoui64(exp->constant, (((void *)0)), 0);
9387 op.ops = uintOps;
9388 }
9389 op.kind = 3;
9390 break;
9391 case 6:
9392 op.f = (float)strtod(exp->constant, (((void *)0)));
9393 op.ops = floatOps;
9394 break;
9395 case 7:
9396 op.d = (double)strtod(exp->constant, (((void *)0)));
9397 op.ops = doubleOps;
9398 break;
9399 case 12:
9400 case 13:
9401 case 8:
9402 op.p = (unsigned char *)strtoul(exp->constant, (((void *)0)), 0);
9403 op.kind = 13;
9404 op.ops = uintOps;
9405 break;
9406 }
9407 }
9408 }
9409 return op;
9410 }
9411
9412 int __ecereVMethodID_class_OnGetString;
9413
9414 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
9415
9416 static void UnusedFunction()
9417 {
9418 int a;
9419
9420 ((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);
9421 }
9422
9423 extern int __ecereVMethodID_class_OnGetString;
9424
9425 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
9426 {
9427 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9428
9429 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
9430 {
9431 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9432 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
9433 else
9434 {
9435 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9436 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9437 struct Type * type;
9438 void * ptr = inst->data + dataMember->offset + offset;
9439 char * result = (((void *)0));
9440
9441 exp->loc = member->loc = inst->loc;
9442 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9443 if(!dataMember->dataType)
9444 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9445 type = dataMember->dataType;
9446 if(type->kind == 8)
9447 {
9448 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9449
9450 if(_class->type == 4)
9451 {
9452 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9453
9454 if(enumClass)
9455 {
9456 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9457 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9458
9459 for(item = e->values.first; item; item = item->next)
9460 {
9461 if((int)item->data == *(int *)ptr)
9462 {
9463 result = item->name;
9464 break;
9465 }
9466 }
9467 if(result)
9468 {
9469 exp->identifier = MkIdentifier(result);
9470 exp->type = 0;
9471 exp->destType = MkClassType(_class->fullName);
9472 ProcessExpressionType(exp);
9473 }
9474 }
9475 }
9476 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9477 {
9478 if(!_class->dataType)
9479 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9480 type = _class->dataType;
9481 }
9482 }
9483 if(!result)
9484 {
9485 switch(type->kind)
9486 {
9487 case 6:
9488 {
9489 FreeExpContents(exp);
9490 exp->constant = PrintFloat(*(float *)ptr);
9491 exp->type = 2;
9492 break;
9493 }
9494 case 7:
9495 {
9496 FreeExpContents(exp);
9497 exp->constant = PrintDouble(*(double *)ptr);
9498 exp->type = 2;
9499 break;
9500 }
9501 case 3:
9502 {
9503 FreeExpContents(exp);
9504 exp->constant = PrintInt(*(int *)ptr);
9505 exp->type = 2;
9506 break;
9507 }
9508 case 4:
9509 {
9510 FreeExpContents(exp);
9511 exp->constant = PrintInt64(*(long long *)ptr);
9512 exp->type = 2;
9513 break;
9514 }
9515 case 22:
9516 {
9517 FreeExpContents(exp);
9518 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9519 exp->type = 2;
9520 break;
9521 }
9522 default:
9523 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9524 }
9525 }
9526 ListAdd(memberList, member);
9527 }
9528 if(parentDataMember->type == 1)
9529 break;
9530 }
9531 }
9532
9533 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
9534
9535 void PopulateInstance(struct Instantiation * inst)
9536 {
9537 struct Symbol * classSym = inst->_class->symbol;
9538 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
9539 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
9540 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
9541
9542 inst->members = MkListOne(MkMembersInitList(memberList));
9543 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
9544 {
9545 if(!dataMember->isProperty)
9546 {
9547 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
9548 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
9549 else
9550 {
9551 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
9552 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
9553 struct Type * type;
9554 void * ptr = inst->data + dataMember->offset;
9555 char * result = (((void *)0));
9556
9557 exp->loc = member->loc = inst->loc;
9558 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
9559 if(!dataMember->dataType)
9560 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9561 type = dataMember->dataType;
9562 if(type->kind == 8)
9563 {
9564 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9565
9566 if(_class->type == 4)
9567 {
9568 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
9569
9570 if(enumClass)
9571 {
9572 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
9573 struct __ecereNameSpace__ecere__sys__NamedLink * item;
9574
9575 for(item = e->values.first; item; item = item->next)
9576 {
9577 if((int)item->data == *(int *)ptr)
9578 {
9579 result = item->name;
9580 break;
9581 }
9582 }
9583 }
9584 if(result)
9585 {
9586 exp->identifier = MkIdentifier(result);
9587 exp->type = 0;
9588 exp->destType = MkClassType(_class->fullName);
9589 ProcessExpressionType(exp);
9590 }
9591 }
9592 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
9593 {
9594 if(!_class->dataType)
9595 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9596 type = _class->dataType;
9597 }
9598 }
9599 if(!result)
9600 {
9601 switch(type->kind)
9602 {
9603 case 6:
9604 {
9605 exp->constant = PrintFloat(*(float *)ptr);
9606 exp->type = 2;
9607 break;
9608 }
9609 case 7:
9610 {
9611 exp->constant = PrintDouble(*(double *)ptr);
9612 exp->type = 2;
9613 break;
9614 }
9615 case 3:
9616 {
9617 exp->constant = PrintInt(*(int *)ptr);
9618 exp->type = 2;
9619 break;
9620 }
9621 case 4:
9622 {
9623 exp->constant = PrintInt64(*(long long *)ptr);
9624 exp->type = 2;
9625 break;
9626 }
9627 case 22:
9628 {
9629 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
9630 exp->type = 2;
9631 break;
9632 }
9633 default:
9634 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unhandled type populating instance\n", (((void *)0))));
9635 }
9636 }
9637 ListAdd(memberList, member);
9638 }
9639 }
9640 }
9641 }
9642
9643 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);
9644
9645 extern void FreeInstance(struct Instantiation * inst);
9646
9647 void ComputeInstantiation(struct Expression * exp)
9648 {
9649 struct Instantiation * inst = exp->instance;
9650 struct MembersInit * members;
9651 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
9652 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
9653 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
9654 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
9655 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
9656 int subMemberStackPos = 0;
9657 uint64 bits = 0;
9658
9659 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9660 {
9661 if(inst->data)
9662 return ;
9663 if(_class->type == 0 || _class->type == 5)
9664 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
9665 else
9666 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
9667 }
9668 if(inst->members)
9669 {
9670 for(members = (*inst->members).first; members; members = members->next)
9671 {
9672 switch(members->type)
9673 {
9674 case 0:
9675 {
9676 if(members->dataMembers)
9677 {
9678 struct MemberInit * member;
9679
9680 for(member = (*members->dataMembers).first; member; member = member->next)
9681 {
9682 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
9683 unsigned int found = 0x0;
9684 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
9685 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
9686 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
9687 unsigned int dataMemberOffset;
9688
9689 if(!ident)
9690 {
9691 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
9692 if(curMember)
9693 {
9694 if(curMember->isProperty)
9695 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
9696 else
9697 {
9698 dataMember = curMember;
9699 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9700 }
9701 found = 0x1;
9702 }
9703 }
9704 else
9705 {
9706 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
9707 if(prop)
9708 {
9709 found = 0x1;
9710 if(prop->memberAccess == 1)
9711 {
9712 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
9713 curClass = prop->_class;
9714 }
9715 }
9716 else
9717 {
9718 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
9719 int _subMemberStackPos = 0;
9720
9721 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
9722 if(dataMember)
9723 {
9724 found = 0x1;
9725 if(dataMember->memberAccess == 1)
9726 {
9727 curMember = dataMember;
9728 curClass = dataMember->_class;
9729 memcpy(subMemberStack, _subMemberStack, sizeof(int) * _subMemberStackPos);
9730 subMemberStackPos = _subMemberStackPos;
9731 }
9732 }
9733 }
9734 }
9735 if(found && member->initializer && member->initializer->type == 0)
9736 {
9737 struct Expression * value = member->initializer->exp;
9738 struct Type * type = (((void *)0));
9739
9740 if(prop)
9741 {
9742 type = prop->dataType;
9743 }
9744 else if(dataMember)
9745 {
9746 if(!dataMember->dataType)
9747 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
9748 type = dataMember->dataType;
9749 }
9750 if(ident && ident->next)
9751 {
9752 for(ident = ident->next; ident && type; ident = ident->next)
9753 {
9754 if(type->kind == 8)
9755 {
9756 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
9757 if(prop)
9758 type = prop->dataType;
9759 else
9760 {
9761 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
9762 if(dataMember)
9763 type = dataMember->dataType;
9764 }
9765 }
9766 else if(type->kind == 9 || type->kind == 10)
9767 {
9768 struct Type * memberType;
9769
9770 for(memberType = type->members.first; memberType; memberType = memberType->next)
9771 {
9772 if(!strcmp(memberType->name, ident->string))
9773 {
9774 type = memberType;
9775 break;
9776 }
9777 }
9778 }
9779 }
9780 }
9781 if(value)
9782 {
9783 FreeType(value->destType);
9784 value->destType = type;
9785 if(type)
9786 type->refCount++;
9787 ComputeExpression(value);
9788 }
9789 if(value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
9790 {
9791 if(type->kind == 8)
9792 {
9793 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9794
9795 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
9796 {
9797 if(!_class->dataType)
9798 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9799 type = _class->dataType;
9800 }
9801 }
9802 if(dataMember)
9803 {
9804 void * ptr = inst->data + dataMemberOffset;
9805
9806 if(value->type == 2)
9807 {
9808 switch(type->kind)
9809 {
9810 case 3:
9811 {
9812 GetInt(value, (int *)ptr);
9813 break;
9814 }
9815 case 4:
9816 {
9817 GetInt64(value, (long long *)ptr);
9818 break;
9819 }
9820 case 22:
9821 {
9822 GetIntPtr(value, (intptr_t *)ptr);
9823 break;
9824 }
9825 case 6:
9826 {
9827 GetFloat(value, (float *)ptr);
9828 break;
9829 }
9830 case 7:
9831 {
9832 GetDouble(value, (double *)ptr);
9833 break;
9834 }
9835 }
9836 }
9837 else if(value->type == 1)
9838 {
9839 if(type->kind == 8)
9840 {
9841 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9842
9843 if(_class->type == 1)
9844 {
9845 ComputeTypeSize(type);
9846 if(value->instance->data)
9847 memcpy(ptr, value->instance->data, type->size);
9848 }
9849 }
9850 }
9851 }
9852 else if(prop)
9853 {
9854 if(value->type == 1 && value->instance->data)
9855 {
9856 void (* Set)(void *, void *) = (void *)prop->Set;
9857
9858 Set(inst->data, value->instance->data);
9859 PopulateInstance(inst);
9860 }
9861 else if(value->type == 2)
9862 {
9863 switch(type->kind)
9864 {
9865 case 7:
9866 {
9867 void (* Set)(void *, double) = (void *)prop->Set;
9868
9869 Set(inst->data, strtod(value->constant, (((void *)0))));
9870 break;
9871 }
9872 case 6:
9873 {
9874 void (* Set)(void *, float) = (void *)prop->Set;
9875
9876 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
9877 break;
9878 }
9879 case 3:
9880 {
9881 void (* Set)(void *, int) = (void *)prop->Set;
9882
9883 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
9884 break;
9885 }
9886 case 4:
9887 {
9888 void (* Set)(void *, long long) = (void *)prop->Set;
9889
9890 Set(inst->data, _strtoi64(value->constant, (((void *)0)), 0));
9891 break;
9892 }
9893 case 22:
9894 {
9895 void (* Set)(void *, intptr_t) = (void *)prop->Set;
9896
9897 Set(inst->data, (intptr_t)_strtoi64(value->constant, (((void *)0)), 0));
9898 break;
9899 }
9900 }
9901 }
9902 else if(value->type == 3)
9903 {
9904 char temp[1024];
9905
9906 ReadString(temp, value->string);
9907 prop->Set(inst->data, temp);
9908 }
9909 }
9910 }
9911 else if(_class->type == 3)
9912 {
9913 if(prop)
9914 {
9915 if(value->type == 2)
9916 {
9917 if(type->kind == 8)
9918 {
9919 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
9920
9921 if(_class->type == 3)
9922 {
9923 if(!_class->dataType)
9924 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
9925 type = _class->dataType;
9926 }
9927 }
9928 switch(type->kind)
9929 {
9930 case 6:
9931 {
9932 float fValue;
9933 float (* Set)(float) = (void *)prop->Set;
9934
9935 GetFloat(member->initializer->exp, &fValue);
9936 exp->constant = PrintFloat(Set(fValue));
9937 exp->type = 2;
9938 break;
9939 }
9940 case 7:
9941 {
9942 double dValue;
9943 double (* Set)(double) = (void *)prop->Set;
9944
9945 GetDouble(member->initializer->exp, &dValue);
9946 exp->constant = PrintDouble(Set(dValue));
9947 exp->type = 2;
9948 break;
9949 }
9950 }
9951 }
9952 }
9953 }
9954 else if(_class->type == 2)
9955 {
9956 if(prop)
9957 {
9958 if(value->type == 1 && value->instance->data)
9959 {
9960 unsigned int (* Set)(void *) = (void *)prop->Set;
9961
9962 bits = Set(value->instance->data);
9963 }
9964 else if(value->type == 2)
9965 {
9966 }
9967 }
9968 else if(dataMember)
9969 {
9970 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
9971 struct Type * type;
9972 int part = 0;
9973
9974 GetInt(value, &part);
9975 bits = (bits & ~bitMember->mask);
9976 if(!bitMember->dataType)
9977 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
9978 type = bitMember->dataType;
9979 if(type->kind == 8 && type->_class && type->_class->registered)
9980 {
9981 if(!type->_class->registered->dataType)
9982 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
9983 type = type->_class->registered->dataType;
9984 }
9985 switch(type->kind)
9986 {
9987 case 1:
9988 if(type->isSigned)
9989 bits |= ((char)part << bitMember->pos);
9990 else
9991 bits |= ((unsigned char)part << bitMember->pos);
9992 break;
9993 case 2:
9994 if(type->isSigned)
9995 bits |= ((short)part << bitMember->pos);
9996 else
9997 bits |= ((unsigned short)part << bitMember->pos);
9998 break;
9999 case 3:
10000 case 5:
10001 if(type->isSigned)
10002 bits |= (part << bitMember->pos);
10003 else
10004 bits |= ((unsigned int)part << bitMember->pos);
10005 break;
10006 case 4:
10007 if(type->isSigned)
10008 bits |= ((long long)part << bitMember->pos);
10009 else
10010 bits |= ((uint64)part << bitMember->pos);
10011 break;
10012 case 22:
10013 if(type->isSigned)
10014 bits |= ((intptr_t)part << bitMember->pos);
10015 else
10016 bits |= ((uintptr_t)part << bitMember->pos);
10017 break;
10018 }
10019 }
10020 }
10021 }
10022 else
10023 {
10024 if(_class && _class->type == 3)
10025 {
10026 ComputeExpression(member->initializer->exp);
10027 exp->constant = member->initializer->exp->constant;
10028 exp->type = 2;
10029 member->initializer->exp->constant = (((void *)0));
10030 }
10031 }
10032 }
10033 }
10034 break;
10035 }
10036 }
10037 }
10038 }
10039 if(_class && _class->type == 2)
10040 {
10041 exp->constant = PrintHexUInt(bits);
10042 exp->type = 2;
10043 }
10044 if(exp->type != 1)
10045 {
10046 FreeInstance(inst);
10047 }
10048 }
10049
10050 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
10051 {
10052 if(exp->op.op == SIZEOF)
10053 {
10054 FreeExpContents(exp);
10055 exp->type = 2;
10056 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
10057 }
10058 else
10059 {
10060 if(!exp->op.exp1)
10061 {
10062 switch(exp->op.op)
10063 {
10064 case '+':
10065 {
10066 struct Expression * exp2 = exp->op.exp2;
10067
10068 exp->op.exp2 = (((void *)0));
10069 FreeExpContents(exp);
10070 FreeType(exp->expType);
10071 FreeType(exp->destType);
10072 *exp = *exp2;
10073 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
10074 break;
10075 }
10076 case '-':
10077 if(op1->ops.Neg)
10078 {
10079 FreeExpContents(exp);
10080 op1->ops.Neg(exp, op1);
10081 }
10082 break;
10083 case '~':
10084 if(op1->ops.BitNot)
10085 {
10086 FreeExpContents(exp);
10087 op1->ops.BitNot(exp, op1);
10088 }
10089 break;
10090 case '!':
10091 if(op1->ops.Not)
10092 {
10093 FreeExpContents(exp);
10094 op1->ops.Not(exp, op1);
10095 }
10096 break;
10097 }
10098 }
10099 else
10100 {
10101 switch(exp->op.op)
10102 {
10103 case '+':
10104 if(op1->ops.Add)
10105 {
10106 FreeExpContents(exp);
10107 op1->ops.Add(exp, op1, op2);
10108 }
10109 break;
10110 case '-':
10111 if(op1->ops.Sub)
10112 {
10113 FreeExpContents(exp);
10114 op1->ops.Sub(exp, op1, op2);
10115 }
10116 break;
10117 case '*':
10118 if(op1->ops.Mul)
10119 {
10120 FreeExpContents(exp);
10121 op1->ops.Mul(exp, op1, op2);
10122 }
10123 break;
10124 case '/':
10125 if(op1->ops.Div)
10126 {
10127 FreeExpContents(exp);
10128 op1->ops.Div(exp, op1, op2);
10129 }
10130 break;
10131 case '%':
10132 if(op1->ops.Mod)
10133 {
10134 FreeExpContents(exp);
10135 op1->ops.Mod(exp, op1, op2);
10136 }
10137 break;
10138 case '&':
10139 if(exp->op.exp2)
10140 {
10141 if(op1->ops.BitAnd)
10142 {
10143 FreeExpContents(exp);
10144 op1->ops.BitAnd(exp, op1, op2);
10145 }
10146 }
10147 break;
10148 case '|':
10149 if(op1->ops.BitOr)
10150 {
10151 FreeExpContents(exp);
10152 op1->ops.BitOr(exp, op1, op2);
10153 }
10154 break;
10155 case '^':
10156 if(op1->ops.BitXor)
10157 {
10158 FreeExpContents(exp);
10159 op1->ops.BitXor(exp, op1, op2);
10160 }
10161 break;
10162 case LEFT_OP:
10163 if(op1->ops.LShift)
10164 {
10165 FreeExpContents(exp);
10166 op1->ops.LShift(exp, op1, op2);
10167 }
10168 break;
10169 case RIGHT_OP:
10170 if(op1->ops.RShift)
10171 {
10172 FreeExpContents(exp);
10173 op1->ops.RShift(exp, op1, op2);
10174 }
10175 break;
10176 case EQ_OP:
10177 if(op1->ops.Equ)
10178 {
10179 FreeExpContents(exp);
10180 op1->ops.Equ(exp, op1, op2);
10181 }
10182 break;
10183 case NE_OP:
10184 if(op1->ops.Nqu)
10185 {
10186 FreeExpContents(exp);
10187 op1->ops.Nqu(exp, op1, op2);
10188 }
10189 break;
10190 case AND_OP:
10191 if(op1->ops.And)
10192 {
10193 FreeExpContents(exp);
10194 op1->ops.And(exp, op1, op2);
10195 }
10196 break;
10197 case OR_OP:
10198 if(op1->ops.Or)
10199 {
10200 FreeExpContents(exp);
10201 op1->ops.Or(exp, op1, op2);
10202 }
10203 break;
10204 case '>':
10205 if(op1->ops.Grt)
10206 {
10207 FreeExpContents(exp);
10208 op1->ops.Grt(exp, op1, op2);
10209 }
10210 break;
10211 case '<':
10212 if(op1->ops.Sma)
10213 {
10214 FreeExpContents(exp);
10215 op1->ops.Sma(exp, op1, op2);
10216 }
10217 break;
10218 case GE_OP:
10219 if(op1->ops.GrtEqu)
10220 {
10221 FreeExpContents(exp);
10222 op1->ops.GrtEqu(exp, op1, op2);
10223 }
10224 break;
10225 case LE_OP:
10226 if(op1->ops.SmaEqu)
10227 {
10228 FreeExpContents(exp);
10229 op1->ops.SmaEqu(exp, op1, op2);
10230 }
10231 break;
10232 }
10233 }
10234 }
10235 }
10236
10237 extern struct Expression * MkExpIdentifier(struct Identifier * id);
10238
10239 void ComputeExpression(struct Expression * exp)
10240 {
10241 char expString[10240];
10242
10243 expString[0] = '\0';
10244 switch(exp->type)
10245 {
10246 case 1:
10247 {
10248 ComputeInstantiation(exp);
10249 break;
10250 }
10251 case 4:
10252 {
10253 struct Expression * exp1, * exp2 = (((void *)0));
10254 struct Operand op1 = 
10255 {
10256 0, 0, 0, 0, 
10257 {
10258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10259 }
10260 };
10261 struct Operand op2 = 
10262 {
10263 0, 0, 0, 0, 
10264 {
10265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10266 }
10267 };
10268
10269 if(exp->op.exp2)
10270 ComputeExpression(exp->op.exp2);
10271 if(exp->op.exp1)
10272 {
10273 ComputeExpression(exp->op.exp1);
10274 exp1 = exp->op.exp1;
10275 exp2 = exp->op.exp2;
10276 op1 = GetOperand(exp1);
10277 if(op1.type)
10278 op1.type->refCount++;
10279 if(exp2)
10280 {
10281 op2 = GetOperand(exp2);
10282 if(op2.type)
10283 op2.type->refCount++;
10284 }
10285 }
10286 else
10287 {
10288 exp1 = exp->op.exp2;
10289 op1 = GetOperand(exp1);
10290 if(op1.type)
10291 op1.type->refCount++;
10292 }
10293 CallOperator(exp, exp1, exp2, &op1, &op2);
10294 if(op1.type)
10295 FreeType(op1.type);
10296 if(op2.type)
10297 FreeType(op2.type);
10298 break;
10299 }
10300 case 5:
10301 case 34:
10302 {
10303 struct Expression * e, * n;
10304
10305 for(e = (*exp->list).first; e; e = n)
10306 {
10307 n = e->next;
10308 if(!n)
10309 {
10310 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
10311
10312 ComputeExpression(e);
10313 FreeType(exp->expType);
10314 FreeType(exp->destType);
10315 *exp = *e;
10316 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
10317 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
10318 }
10319 else
10320 {
10321 FreeExpression(e);
10322 }
10323 }
10324 break;
10325 }
10326 case 8:
10327 {
10328 struct Expression * memberExp = exp->member.exp;
10329 struct Identifier * memberID = exp->member.member;
10330 struct Type * type;
10331
10332 ComputeExpression(exp->member.exp);
10333 type = exp->member.exp->expType;
10334 if(type)
10335 {
10336 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)));
10337 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
10338 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
10339 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
10340
10341 if(type->kind == 19 && exp->member.exp->type == 26)
10342 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
10343 if(!_class)
10344 {
10345 char string[256];
10346 struct Symbol * classSym;
10347
10348 string[0] = '\0';
10349 PrintType(type, string, 0x0, 0x1);
10350 classSym = FindClass(string);
10351 _class = classSym ? classSym->registered : (((void *)0));
10352 }
10353 if(exp->member.member)
10354 {
10355 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
10356 if(!prop)
10357 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
10358 }
10359 if(!prop && !member && _class && exp->member.member)
10360 {
10361 struct Symbol * classSym = FindClass(exp->member.member->string);
10362
10363 convertTo = _class;
10364 _class = classSym ? classSym->registered : (((void *)0));
10365 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
10366 }
10367 if(prop)
10368 {
10369 if(prop->compiled)
10370 {
10371 struct Type * type = prop->dataType;
10372
10373 if(_class->type == 3)
10374 {
10375 if(type->kind == 8)
10376 {
10377 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10378
10379 if(_class->type == 3)
10380 {
10381 if(!_class->dataType)
10382 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10383 type = _class->dataType;
10384 }
10385 }
10386 switch(type->kind)
10387 {
10388 case 6:
10389 {
10390 float value;
10391 float (* Get)(float) = (void *)prop->Get;
10392
10393 GetFloat(exp->member.exp, &value);
10394 exp->constant = PrintFloat(Get ? Get(value) : value);
10395 exp->type = 2;
10396 break;
10397 }
10398 case 7:
10399 {
10400 double value;
10401 double (* Get)(double);
10402
10403 GetDouble(exp->member.exp, &value);
10404 if(convertTo)
10405 Get = (void *)prop->Set;
10406 else
10407 Get = (void *)prop->Get;
10408 exp->constant = PrintDouble(Get ? Get(value) : value);
10409 exp->type = 2;
10410 break;
10411 }
10412 }
10413 }
10414 else
10415 {
10416 if(convertTo)
10417 {
10418 struct Expression * value = exp->member.exp;
10419 struct Type * type;
10420
10421 if(!prop->dataType)
10422 ProcessPropertyType(prop);
10423 type = prop->dataType;
10424 if(!type)
10425 {
10426 }
10427 else if(_class->type == 1)
10428 {
10429 switch(type->kind)
10430 {
10431 case 8:
10432 {
10433 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10434
10435 if(propertyClass->type == 1 && value->type == 1)
10436 {
10437 void (* Set)(void *, void *) = (void *)prop->Set;
10438
10439 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10440 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10441 exp->instance->_class = MkSpecifierName(_class->fullName);
10442 exp->instance->loc = exp->loc;
10443 exp->type = 1;
10444 Set(exp->instance->data, value->instance->data);
10445 PopulateInstance(exp->instance);
10446 }
10447 break;
10448 }
10449 case 3:
10450 {
10451 int intValue;
10452 void (* Set)(void *, int) = (void *)prop->Set;
10453
10454 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10455 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10456 exp->instance->_class = MkSpecifierName(_class->fullName);
10457 exp->instance->loc = exp->loc;
10458 exp->type = 1;
10459 GetInt(value, &intValue);
10460 Set(exp->instance->data, intValue);
10461 PopulateInstance(exp->instance);
10462 break;
10463 }
10464 case 4:
10465 {
10466 long long intValue;
10467 void (* Set)(void *, long long) = (void *)prop->Set;
10468
10469 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10470 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10471 exp->instance->_class = MkSpecifierName(_class->fullName);
10472 exp->instance->loc = exp->loc;
10473 exp->type = 1;
10474 GetInt64(value, &intValue);
10475 Set(exp->instance->data, intValue);
10476 PopulateInstance(exp->instance);
10477 break;
10478 }
10479 case 22:
10480 {
10481 intptr_t intValue;
10482 void (* Set)(void *, intptr_t) = (void *)prop->Set;
10483
10484 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10485 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10486 exp->instance->_class = MkSpecifierName(_class->fullName);
10487 exp->instance->loc = exp->loc;
10488 exp->type = 1;
10489 GetIntPtr(value, &intValue);
10490 Set(exp->instance->data, intValue);
10491 PopulateInstance(exp->instance);
10492 break;
10493 }
10494 case 7:
10495 {
10496 double doubleValue;
10497 void (* Set)(void *, double) = (void *)prop->Set;
10498
10499 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10500 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10501 exp->instance->_class = MkSpecifierName(_class->fullName);
10502 exp->instance->loc = exp->loc;
10503 exp->type = 1;
10504 GetDouble(value, &doubleValue);
10505 Set(exp->instance->data, doubleValue);
10506 PopulateInstance(exp->instance);
10507 break;
10508 }
10509 }
10510 }
10511 else if(_class->type == 2)
10512 {
10513 switch(type->kind)
10514 {
10515 case 8:
10516 {
10517 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
10518
10519 if(propertyClass->type == 1 && value->instance->data)
10520 {
10521 unsigned int (* Set)(void *) = (void *)prop->Set;
10522 unsigned int bits = Set(value->instance->data);
10523
10524 exp->constant = PrintHexUInt(bits);
10525 exp->type = 2;
10526 break;
10527 }
10528 else if(_class->type == 2)
10529 {
10530 unsigned int value;
10531 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
10532 unsigned int bits;
10533
10534 GetUInt(exp->member.exp, &value);
10535 bits = Set(value);
10536 exp->constant = PrintHexUInt(bits);
10537 exp->type = 2;
10538 }
10539 }
10540 }
10541 }
10542 }
10543 else
10544 {
10545 if(_class->type == 2)
10546 {
10547 unsigned int value;
10548
10549 GetUInt(exp->member.exp, &value);
10550 switch(type->kind)
10551 {
10552 case 8:
10553 {
10554 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10555
10556 if(_class->type == 1)
10557 {
10558 void (* Get)(unsigned int, void *) = (void *)prop->Get;
10559
10560 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10561 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10562 exp->instance->_class = MkSpecifierName(_class->fullName);
10563 exp->instance->loc = exp->loc;
10564 exp->type = 1;
10565 Get(value, exp->instance->data);
10566 PopulateInstance(exp->instance);
10567 }
10568 else if(_class->type == 2)
10569 {
10570 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
10571 uint64 bits = Get(value);
10572
10573 exp->constant = PrintHexUInt64(bits);
10574 exp->type = 2;
10575 }
10576 break;
10577 }
10578 }
10579 }
10580 else if(_class->type == 1)
10581 {
10582 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
10583
10584 switch(type->kind)
10585 {
10586 case 8:
10587 {
10588 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10589
10590 if(_class->type == 1 && value)
10591 {
10592 void (* Get)(void *, void *) = (void *)prop->Get;
10593
10594 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
10595 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
10596 exp->instance->_class = MkSpecifierName(_class->fullName);
10597 exp->instance->loc = exp->loc;
10598 exp->type = 1;
10599 Get(value, exp->instance->data);
10600 PopulateInstance(exp->instance);
10601 }
10602 break;
10603 }
10604 }
10605 }
10606 }
10607 }
10608 }
10609 else
10610 {
10611 exp->isConstant = 0x0;
10612 }
10613 }
10614 else if(member)
10615 {
10616 }
10617 }
10618 if(exp->type != 8)
10619 {
10620 FreeExpression(memberExp);
10621 FreeIdentifier(memberID);
10622 }
10623 break;
10624 }
10625 case 10:
10626 {
10627 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
10628
10629 FreeExpContents(exp);
10630 exp->constant = PrintUInt(ComputeTypeSize(type));
10631 exp->type = 2;
10632 FreeType(type);
10633 break;
10634 }
10635 case 15:
10636 {
10637 struct Symbol * classSym = exp->_class->symbol;
10638
10639 if(classSym && classSym->registered)
10640 {
10641 if(classSym->registered->fixed)
10642 {
10643 FreeSpecifier(exp->_class);
10644 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
10645 exp->type = 2;
10646 }
10647 else
10648 {
10649 char className[1024];
10650
10651 strcpy(className, "__ecereClass_");
10652 FullClassNameCat(className, classSym->string, 0x1);
10653 MangleClassName(className);
10654 FreeExpContents(exp);
10655 exp->type = 9;
10656 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
10657 exp->member.member = MkIdentifier("structSize");
10658 }
10659 }
10660 break;
10661 }
10662 case 11:
10663 {
10664 struct Type * type;
10665 struct Expression * e = exp;
10666
10667 if(exp->type == 11)
10668 {
10669 if(exp->cast.exp)
10670 ComputeExpression(exp->cast.exp);
10671 e = exp->cast.exp;
10672 }
10673 if(e && exp->expType)
10674 {
10675 type = exp->expType;
10676 if(type->kind == 8)
10677 {
10678 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10679
10680 if(_class && (_class->type == 3 || _class->type == 2))
10681 {
10682 if(!_class->dataType)
10683 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10684 type = _class->dataType;
10685 }
10686 }
10687 switch(type->kind)
10688 {
10689 case 1:
10690 if(type->isSigned)
10691 {
10692 char value;
10693
10694 GetChar(e, &value);
10695 FreeExpContents(exp);
10696 exp->constant = PrintChar(value);
10697 exp->type = 2;
10698 }
10699 else
10700 {
10701 unsigned char value;
10702
10703 GetUChar(e, &value);
10704 FreeExpContents(exp);
10705 exp->constant = PrintUChar(value);
10706 exp->type = 2;
10707 }
10708 break;
10709 case 2:
10710 if(type->isSigned)
10711 {
10712 short value;
10713
10714 GetShort(e, &value);
10715 FreeExpContents(exp);
10716 exp->constant = PrintShort(value);
10717 exp->type = 2;
10718 }
10719 else
10720 {
10721 unsigned short value;
10722
10723 GetUShort(e, &value);
10724 FreeExpContents(exp);
10725 exp->constant = PrintUShort(value);
10726 exp->type = 2;
10727 }
10728 break;
10729 case 3:
10730 if(type->isSigned)
10731 {
10732 int value;
10733
10734 GetInt(e, &value);
10735 FreeExpContents(exp);
10736 exp->constant = PrintInt(value);
10737 exp->type = 2;
10738 }
10739 else
10740 {
10741 unsigned int value;
10742
10743 GetUInt(e, &value);
10744 FreeExpContents(exp);
10745 exp->constant = PrintUInt(value);
10746 exp->type = 2;
10747 }
10748 break;
10749 case 4:
10750 if(type->isSigned)
10751 {
10752 long long value;
10753
10754 GetInt64(e, &value);
10755 FreeExpContents(exp);
10756 exp->constant = PrintInt64(value);
10757 exp->type = 2;
10758 }
10759 else
10760 {
10761 uint64 value;
10762
10763 GetUInt64(e, &value);
10764 FreeExpContents(exp);
10765 exp->constant = PrintUInt64(value);
10766 exp->type = 2;
10767 }
10768 break;
10769 case 22:
10770 if(type->isSigned)
10771 {
10772 intptr_t value;
10773
10774 GetIntPtr(e, &value);
10775 FreeExpContents(exp);
10776 exp->constant = PrintInt64((long long)value);
10777 exp->type = 2;
10778 }
10779 else
10780 {
10781 uintptr_t value;
10782
10783 GetUIntPtr(e, &value);
10784 FreeExpContents(exp);
10785 exp->constant = PrintUInt64((uint64)value);
10786 exp->type = 2;
10787 }
10788 break;
10789 case 6:
10790 {
10791 float value;
10792
10793 GetFloat(e, &value);
10794 FreeExpContents(exp);
10795 exp->constant = PrintFloat(value);
10796 exp->type = 2;
10797 break;
10798 }
10799 case 7:
10800 {
10801 double value;
10802
10803 GetDouble(e, &value);
10804 FreeExpContents(exp);
10805 exp->constant = PrintDouble(value);
10806 exp->type = 2;
10807 break;
10808 }
10809 }
10810 }
10811 break;
10812 }
10813 case 12:
10814 {
10815 struct Operand op1 = 
10816 {
10817 0, 0, 0, 0, 
10818 {
10819 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10820 }
10821 };
10822 struct Operand op2 = 
10823 {
10824 0, 0, 0, 0, 
10825 {
10826 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10827 }
10828 };
10829 struct Operand op3 = 
10830 {
10831 0, 0, 0, 0, 
10832 {
10833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10834 }
10835 };
10836
10837 if(exp->cond.exp)
10838 ComputeExpression((*exp->cond.exp).last);
10839 if(exp->cond.elseExp)
10840 ComputeExpression(exp->cond.elseExp);
10841 if(exp->cond.cond)
10842 ComputeExpression(exp->cond.cond);
10843 op1 = GetOperand(exp->cond.cond);
10844 if(op1.type)
10845 op1.type->refCount++;
10846 op2 = GetOperand((*exp->cond.exp).last);
10847 if(op2.type)
10848 op2.type->refCount++;
10849 op3 = GetOperand(exp->cond.elseExp);
10850 if(op3.type)
10851 op3.type->refCount++;
10852 if(op1.ops.Cond)
10853 {
10854 FreeExpContents(exp);
10855 op1.ops.Cond(exp, &op1, &op2, &op3);
10856 }
10857 if(op1.type)
10858 FreeType(op1.type);
10859 if(op2.type)
10860 FreeType(op2.type);
10861 if(op3.type)
10862 FreeType(op3.type);
10863 break;
10864 }
10865 }
10866 }
10867
10868 void ApplyAnyObjectLogic(struct Expression * e);
10869
10870 extern void CopyTypeInto(struct Type * type, struct Type * src);
10871
10872 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
10873 {
10874 unsigned int result = 0x1;
10875
10876 if(destType)
10877 {
10878 struct __ecereNameSpace__ecere__sys__OldList converts = 
10879 {
10880 0, 0, 0, 0, 0
10881 };
10882 struct Conversion * convert;
10883
10884 if(destType->kind == 0)
10885 return 0x0;
10886 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
10887 result = 0x0;
10888 if(converts.count)
10889 {
10890 for(convert = converts.first; convert; convert = convert->next)
10891 {
10892 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
10893
10894 if(!empty)
10895 {
10896 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10897 int objectType = exp->expType ? exp->expType->classObjectType : 0;
10898
10899 *newExp = *exp;
10900 newExp->destType = (((void *)0));
10901 if(convert->isGet)
10902 {
10903 exp->type = 8;
10904 exp->addedThis = 0x1;
10905 exp->member.exp = newExp;
10906 FreeType(exp->member.exp->expType);
10907 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
10908 exp->member.exp->expType->classObjectType = objectType;
10909 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
10910 exp->member.memberType = 1;
10911 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10912 exp->needCast = 0x1;
10913 if(exp->expType)
10914 exp->expType->refCount++;
10915 ApplyAnyObjectLogic(exp->member.exp);
10916 }
10917 else
10918 {
10919 {
10920 exp->type = 8;
10921 exp->addedThis = 0x1;
10922 exp->member.exp = newExp;
10923 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
10924 {
10925 newExp->byReference = 0x1;
10926 }
10927 FreeType(exp->member.exp->expType);
10928 exp->member.exp->expType = (((void *)0));
10929 if(convert->convert->dataType)
10930 {
10931 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
10932 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
10933 exp->member.exp->expType->refCount = 1;
10934 exp->member.exp->expType->classObjectType = objectType;
10935 ApplyAnyObjectLogic(exp->member.exp);
10936 }
10937 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
10938 exp->member.memberType = 4;
10939 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10940 exp->needCast = 0x1;
10941 if(convert->resultType)
10942 convert->resultType->refCount++;
10943 }
10944 }
10945 }
10946 else
10947 {
10948 FreeType(exp->expType);
10949 if(convert->isGet)
10950 {
10951 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
10952 exp->needCast = 0x1;
10953 if(exp->expType)
10954 exp->expType->refCount++;
10955 }
10956 else
10957 {
10958 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
10959 exp->needCast = 0x1;
10960 if(convert->resultType)
10961 convert->resultType->refCount++;
10962 }
10963 }
10964 }
10965 if(exp->isConstant && inCompiler)
10966 ComputeExpression(exp);
10967 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
10968 }
10969 if(!result && exp->expType && converts.count)
10970 {
10971 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
10972 }
10973 if(!result && exp->expType && exp->destType)
10974 {
10975 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))
10976 result = 0x1;
10977 }
10978 }
10979 return result;
10980 }
10981
10982 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
10983
10984 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
10985
10986 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
10987
10988 void CheckTemplateTypes(struct Expression * exp)
10989 {
10990 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
10991 {
10992 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10993 struct Statement * compound;
10994 struct Context * context;
10995
10996 *newExp = *exp;
10997 if(exp->destType)
10998 exp->destType->refCount++;
10999 if(exp->expType)
11000 exp->expType->refCount++;
11001 newExp->prev = (((void *)0));
11002 newExp->next = (((void *)0));
11003 switch(exp->expType->kind)
11004 {
11005 case 7:
11006 if(exp->destType->classObjectType)
11007 {
11008 if(exp->destType)
11009 exp->destType->refCount--;
11010 if(exp->expType)
11011 exp->expType->refCount--;
11012 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11013 }
11014 else
11015 {
11016 struct __ecereNameSpace__ecere__sys__OldList * specs;
11017 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11018 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11019
11020 context = PushContext();
11021 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11022 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11023 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11024 exp->type = 25;
11025 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11026 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
11027 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
11028 exp->compound->compound.context = context;
11029 PopContext(context);
11030 }
11031 break;
11032 default:
11033 exp->type = 11;
11034 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
11035 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11036 break;
11037 }
11038 }
11039 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
11040 {
11041 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11042 struct Statement * compound;
11043 struct Context * context;
11044
11045 *newExp = *exp;
11046 if(exp->destType)
11047 exp->destType->refCount++;
11048 if(exp->expType)
11049 exp->expType->refCount++;
11050 newExp->prev = (((void *)0));
11051 newExp->next = (((void *)0));
11052 switch(exp->expType->kind)
11053 {
11054 case 7:
11055 if(exp->destType->classObjectType)
11056 {
11057 if(exp->destType)
11058 exp->destType->refCount--;
11059 if(exp->expType)
11060 exp->expType->refCount--;
11061 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11062 }
11063 else
11064 {
11065 struct __ecereNameSpace__ecere__sys__OldList * specs;
11066 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
11067 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
11068
11069 context = PushContext();
11070 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
11071 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
11072 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
11073 exp->type = 25;
11074 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
11075 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
11076 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
11077 exp->compound->compound.context = context;
11078 PopContext(context);
11079 }
11080 break;
11081 case 8:
11082 {
11083 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
11084 {
11085 exp->type = 5;
11086 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
11087 ProcessExpressionType((*exp->list).first);
11088 break;
11089 }
11090 else
11091 {
11092 exp->type = 5;
11093 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
11094 newExp->needCast = 0x1;
11095 ProcessExpressionType((*exp->list).first);
11096 break;
11097 }
11098 }
11099 default:
11100 {
11101 if(exp->expType->kind == 20)
11102 {
11103 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
11104
11105 if(type)
11106 {
11107 FreeType(exp->destType);
11108 FreeType(exp->expType);
11109 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11110 break;
11111 }
11112 }
11113 if(newExp->type == 8 && newExp->member.memberType == 3)
11114 {
11115 exp->type = 4;
11116 exp->op.op = '*';
11117 exp->op.exp1 = (((void *)0));
11118 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
11119 }
11120 else
11121 {
11122 char typeString[1024];
11123 struct Declarator * decl;
11124 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11125
11126 typeString[0] = '\0';
11127 PrintType(exp->expType, typeString, 0x0, 0x0);
11128 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11129 exp->type = 11;
11130 exp->cast.typeName = MkTypeName(specs, decl);
11131 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
11132 exp->cast.exp->needCast = 0x1;
11133 }
11134 break;
11135 }
11136 }
11137 }
11138 }
11139
11140 extern int strncmp(const char * , const char * , int n);
11141
11142 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
11143
11144 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
11145 {
11146 int nsLen = strlen(nameSpace);
11147 struct Symbol * symbol;
11148
11149 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)))
11150 {
11151 char * s = symbol->string;
11152
11153 if(!strncmp(s, nameSpace, nsLen))
11154 {
11155 int c;
11156 char * namePart;
11157
11158 for(c = strlen(s) - 1; c >= 0; c--)
11159 if(s[c] == ':')
11160 break;
11161 namePart = s + c + 1;
11162 if(!strcmp(namePart, name))
11163 {
11164 return symbol;
11165 }
11166 }
11167 else
11168 break;
11169 }
11170 return (((void *)0));
11171 }
11172
11173 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
11174 {
11175 int c;
11176 char nameSpace[1024];
11177 char * namePart;
11178 unsigned int gotColon = 0x0;
11179
11180 nameSpace[0] = '\0';
11181 for(c = strlen(name) - 1; c >= 0; c--)
11182 if(name[c] == ':')
11183 {
11184 gotColon = 0x1;
11185 break;
11186 }
11187 namePart = name + c + 1;
11188 while(c >= 0 && name[c] == ':')
11189 c--;
11190 if(c >= 0)
11191 {
11192 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
11193
11194 if(symbol)
11195 return symbol;
11196 memcpy(nameSpace, name, c + 1);
11197 nameSpace[c + 1] = (char)0;
11198 return ScanWithNameSpace(tree, nameSpace, namePart);
11199 }
11200 else if(gotColon)
11201 {
11202 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11203
11204 return symbol;
11205 }
11206 else
11207 {
11208 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
11209
11210 if(symbol)
11211 return symbol;
11212 return ScanWithNameSpace(tree, "", namePart);
11213 }
11214 return (((void *)0));
11215 }
11216
11217 static void ProcessDeclaration(struct Declaration * decl);
11218
11219 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
11220 {
11221 struct Context * ctx;
11222 struct Symbol * symbol = (((void *)0));
11223
11224 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
11225 {
11226 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
11227 {
11228 symbol = (((void *)0));
11229 if(thisNameSpace)
11230 {
11231 char curName[1024];
11232
11233 strcpy(curName, thisNameSpace);
11234 strcat(curName, "::");
11235 strcat(curName, name);
11236 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
11237 }
11238 if(!symbol)
11239 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
11240 }
11241 else
11242 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
11243 if(symbol || ctx == endContext)
11244 break;
11245 }
11246 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
11247 {
11248 if(symbol->pointerExternal->type == 0)
11249 {
11250 struct FunctionDefinition * function = symbol->pointerExternal->function;
11251 struct Context * tmpContext = curContext;
11252
11253 curContext = (((void *)0));
11254 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
11255 curContext = tmpContext;
11256 symbol->pointerExternal->symbol = symbol;
11257 DeclareType(symbol->type, 0x1, 0x1);
11258 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
11259 symbol->id = curExternal->symbol->idCode;
11260 }
11261 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
11262 {
11263 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
11264 symbol->id = curExternal->symbol->idCode;
11265 }
11266 }
11267 return symbol;
11268 }
11269
11270 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
11271 {
11272 if(!type->isSigned && type->kind != 22)
11273 ListAdd(specs, MkSpecifier(UNSIGNED));
11274 switch(type->kind)
11275 {
11276 case 8:
11277 {
11278 if(type->_class->registered)
11279 {
11280 if(!type->_class->registered->dataType)
11281 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11282 GetTypeSpecs(type->_class->registered->dataType, specs);
11283 }
11284 break;
11285 }
11286 case 7:
11287 ListAdd(specs, MkSpecifier(DOUBLE));
11288 break;
11289 case 6:
11290 ListAdd(specs, MkSpecifier(FLOAT));
11291 break;
11292 case 1:
11293 ListAdd(specs, MkSpecifier(CHAR));
11294 break;
11295 case 2:
11296 ListAdd(specs, MkSpecifier(SHORT));
11297 break;
11298 case 4:
11299 ListAdd(specs, MkSpecifier(INT64));
11300 break;
11301 case 22:
11302 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
11303 break;
11304 case 3:
11305 default:
11306 ListAdd(specs, MkSpecifier(INT));
11307 break;
11308 }
11309 }
11310
11311 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
11312
11313 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int printFunction, unsigned int fullName)
11314 {
11315 if(type)
11316 {
11317 switch(type->kind)
11318 {
11319 case 8:
11320 if(type->_class && type->_class->string)
11321 {
11322 if(type->classObjectType == 2)
11323 strcat(string, "typed_object");
11324 else if(fullName)
11325 strcat(string, type->_class->string);
11326 else
11327 {
11328 if(type->_class->registered)
11329 strcat(string, type->_class->registered->name);
11330 else
11331 strcat(string, type->_class->string);
11332 }
11333 }
11334 break;
11335 case 13:
11336 {
11337 {
11338 _PrintType(type->type, string, 0x0, printFunction, fullName);
11339 strcat(string, " *");
11340 }
11341 break;
11342 }
11343 case 0:
11344 strcat(string, "void");
11345 break;
11346 case 3:
11347 strcat(string, type->isSigned ? "int" : "uint");
11348 break;
11349 case 4:
11350 strcat(string, type->isSigned ? "int64" : "uint64");
11351 break;
11352 case 22:
11353 strcat(string, type->isSigned ? "intptr" : "uintptr");
11354 break;
11355 case 1:
11356 strcat(string, type->isSigned ? "char" : "byte");
11357 break;
11358 case 2:
11359 strcat(string, type->isSigned ? "short" : "uint16");
11360 break;
11361 case 6:
11362 strcat(string, "float");
11363 break;
11364 case 7:
11365 strcat(string, "double");
11366 break;
11367 case 9:
11368 if(type->enumName)
11369 {
11370 strcat(string, "struct ");
11371 strcat(string, type->enumName);
11372 }
11373 else if(type->typeName)
11374 {
11375 strcat(string, type->typeName);
11376 }
11377 else
11378 {
11379 struct Type * member;
11380
11381 strcat(string, "struct {");
11382 for(member = type->members.first; member; member = member->next)
11383 {
11384 PrintType(member, string, 0x1, fullName);
11385 strcat(string, "; ");
11386 }
11387 strcat(string, "}");
11388 }
11389 break;
11390 case 10:
11391 if(type->enumName)
11392 {
11393 strcat(string, "union ");
11394 strcat(string, type->enumName);
11395 }
11396 else if(type->typeName)
11397 {
11398 strcat(string, type->typeName);
11399 }
11400 else
11401 {
11402 strcat(string, "union ");
11403 strcat(string, "(unnamed)");
11404 }
11405 break;
11406 case 15:
11407 if(type->enumName)
11408 {
11409 strcat(string, "enum ");
11410 strcat(string, type->enumName);
11411 }
11412 else if(type->typeName)
11413 {
11414 strcat(string, type->typeName);
11415 }
11416 else
11417 strcat(string, "enum");
11418 break;
11419 case 11:
11420 {
11421 if(printFunction)
11422 {
11423 if(type->dllExport)
11424 strcat(string, "dllexport ");
11425 PrintType(type->returnType, string, 0x0, fullName);
11426 strcat(string, " ");
11427 }
11428 if(printName)
11429 {
11430 if(type->name)
11431 {
11432 if(fullName)
11433 strcat(string, type->name);
11434 else
11435 {
11436 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
11437
11438 if(name)
11439 name += 2;
11440 else
11441 name = type->name;
11442 strcat(string, name);
11443 }
11444 }
11445 }
11446 if(printFunction)
11447 {
11448 struct Type * param;
11449
11450 strcat(string, "(");
11451 for(param = type->params.first; param; param = param->next)
11452 {
11453 PrintType(param, string, 0x1, fullName);
11454 if(param->next)
11455 strcat(string, ", ");
11456 }
11457 strcat(string, ")");
11458 }
11459 break;
11460 }
11461 case 12:
11462 {
11463 {
11464 char baseType[1024], size[256];
11465 struct Type * arrayType = type;
11466
11467 baseType[0] = '\0';
11468 size[0] = '\0';
11469 while(arrayType->kind == 12)
11470 {
11471 strcat(size, "[");
11472 if(arrayType->enumClass)
11473 strcat(size, arrayType->enumClass->string);
11474 else if(arrayType->arraySizeExp)
11475 PrintExpression(arrayType->arraySizeExp, size);
11476 strcat(size, "]");
11477 arrayType = arrayType->arrayType;
11478 }
11479 _PrintType(arrayType, baseType, printName, printFunction, fullName);
11480 strcat(string, baseType);
11481 strcat(string, size);
11482 }
11483 printName = 0x0;
11484 break;
11485 }
11486 case 14:
11487 strcat(string, "...");
11488 break;
11489 case 16:
11490 _PrintType(type->method->dataType, string, 0x0, printFunction, fullName);
11491 break;
11492 case 19:
11493 strcat(string, "subclass(");
11494 strcat(string, type->_class ? type->_class->string : "int");
11495 strcat(string, ")");
11496 break;
11497 case 20:
11498 strcat(string, type->templateParameter->identifier->string);
11499 break;
11500 case 21:
11501 strcat(string, "thisclass");
11502 break;
11503 case 17:
11504 strcat(string, "__builtin_va_list");
11505 break;
11506 }
11507 if(type->name && printName && type->kind != 11 && (type->kind != 13 || type->type->kind != 11))
11508 {
11509 strcat(string, " ");
11510 strcat(string, type->name);
11511 }
11512 }
11513 }
11514
11515 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
11516 {
11517 struct Type * funcType;
11518
11519 for(funcType = type; funcType && (funcType->kind == 13 || funcType->kind == 12); funcType = funcType->type)
11520 ;
11521 if(funcType && funcType->kind == 11 && type != funcType)
11522 {
11523 char typeString[1024];
11524 struct Type * param;
11525
11526 PrintType(funcType->returnType, string, 0x0, fullName);
11527 strcat(string, "(");
11528 _PrintType(type, string, printName, 0x0, fullName);
11529 strcat(string, ")");
11530 strcat(string, "(");
11531 for(param = funcType->params.first; param; param = param->next)
11532 {
11533 PrintType(param, string, 0x1, fullName);
11534 if(param->next)
11535 strcat(string, ", ");
11536 }
11537 strcat(string, ")");
11538 }
11539 else
11540 _PrintType(type, string, printName, 0x1, fullName);
11541 if(type->bitFieldCount)
11542 {
11543 char count[100];
11544
11545 sprintf(count, ":%d", type->bitFieldCount);
11546 strcat(string, count);
11547 }
11548 }
11549
11550 static struct Type * FindMember(struct Type * type, char * string)
11551 {
11552 struct Type * memberType;
11553
11554 for(memberType = type->members.first; memberType; memberType = memberType->next)
11555 {
11556 if(!memberType->name)
11557 {
11558 struct Type * subType = FindMember(memberType, string);
11559
11560 if(subType)
11561 return subType;
11562 }
11563 else if(!strcmp(memberType->name, string))
11564 return memberType;
11565 }
11566 return (((void *)0));
11567 }
11568
11569 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
11570 {
11571 struct Type * memberType;
11572
11573 for(memberType = type->members.first; memberType; memberType = memberType->next)
11574 {
11575 if(!memberType->name)
11576 {
11577 struct Type * subType = FindMember(memberType, string);
11578
11579 if(subType)
11580 {
11581 *offset += memberType->offset;
11582 return subType;
11583 }
11584 }
11585 else if(!strcmp(memberType->name, string))
11586 {
11587 *offset += memberType->offset;
11588 return memberType;
11589 }
11590 }
11591 return (((void *)0));
11592 }
11593
11594 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
11595
11596 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
11597
11598 struct Expression * ParseExpressionString(char * expression)
11599 {
11600 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
11601 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
11602 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
11603 echoOn = 0x0;
11604 parsedExpression = (((void *)0));
11605 resetScanner();
11606 expression_yyparse();
11607 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
11608 return parsedExpression;
11609 }
11610
11611 extern char *  QMkString(char *  source);
11612
11613 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
11614 {
11615 void * __ecereTemp1;
11616 struct Identifier * id = exp->identifier;
11617 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11618 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11619 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11620 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
11621
11622 if(_class && _class->type == 4)
11623 {
11624 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
11625 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11626
11627 if(enumClass)
11628 {
11629 struct __ecereNameSpace__ecere__com__Class * baseClass;
11630
11631 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
11632 {
11633 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
11634
11635 for(value = e->values.first; value; value = value->next)
11636 {
11637 if(!strcmp(value->name, id->string))
11638 break;
11639 }
11640 if(value)
11641 {
11642 char constant[256];
11643
11644 FreeExpContents(exp);
11645 exp->type = 2;
11646 exp->isConstant = 0x1;
11647 if(!strcmp(baseClass->dataTypeString, "int"))
11648 sprintf(constant, "%d", value->data);
11649 else
11650 sprintf(constant, "0x%X", value->data);
11651 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11652 exp->expType = MkClassType(baseClass->fullName);
11653 break;
11654 }
11655 }
11656 }
11657 if(value)
11658 return 0x1;
11659 }
11660 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
11661 {
11662 ProcessMethodType(method);
11663 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1)->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), ((struct Type *)__ecereTemp1));
11664 return 0x1;
11665 }
11666 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
11667 {
11668 if(!prop->dataType)
11669 ProcessPropertyType(prop);
11670 exp->expType = prop->dataType;
11671 if(prop->dataType)
11672 prop->dataType->refCount++;
11673 return 0x1;
11674 }
11675 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
11676 {
11677 if(!member->dataType)
11678 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
11679 exp->expType = member->dataType;
11680 if(member->dataType)
11681 member->dataType->refCount++;
11682 return 0x1;
11683 }
11684 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
11685 {
11686 if(!classProp->dataType)
11687 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
11688 if(classProp->constant)
11689 {
11690 FreeExpContents(exp);
11691 exp->isConstant = 0x1;
11692 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
11693 {
11694 exp->type = 3;
11695 exp->constant = QMkString((char *)classProp->Get(_class));
11696 }
11697 else
11698 {
11699 char constant[256];
11700
11701 exp->type = 2;
11702 sprintf(constant, "%d", classProp->Get(_class));
11703 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
11704 }
11705 }
11706 else
11707 {
11708 }
11709 exp->expType = classProp->dataType;
11710 if(classProp->dataType)
11711 classProp->dataType->refCount++;
11712 return 0x1;
11713 }
11714 return 0x0;
11715 }
11716
11717 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
11718 {
11719 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
11720 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
11721 struct __ecereNameSpace__ecere__com__NameSpace * child;
11722
11723 if(!data)
11724 {
11725 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)))
11726 {
11727 data = ScanGlobalData(child, name);
11728 if(data)
11729 break;
11730 }
11731 }
11732 return data;
11733 }
11734
11735 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
11736
11737 extern char *  strncpy(char * , const char * , int n);
11738
11739 static struct GlobalData * FindGlobalData(char * name)
11740 {
11741 int start = 0, c;
11742 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
11743
11744 nameSpace = globalData;
11745 for(c = 0; name[c]; c++)
11746 {
11747 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
11748 {
11749 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
11750 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
11751
11752 strncpy(spaceName, name + start, c - start);
11753 spaceName[c - start] = '\0';
11754 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
11755 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
11756 if(!newSpace)
11757 return (((void *)0));
11758 nameSpace = newSpace;
11759 if(name[c] == ':')
11760 c++;
11761 start = c + 1;
11762 }
11763 }
11764 if(c - start)
11765 {
11766 return ScanGlobalData(nameSpace, name + start);
11767 }
11768 return (((void *)0));
11769 }
11770
11771 static int definedExpStackPos;
11772
11773 static void * definedExpStack[512];
11774
11775 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
11776 {
11777 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
11778
11779 FreeExpContents(checkedExp);
11780 FreeType(checkedExp->expType);
11781 FreeType(checkedExp->destType);
11782 *checkedExp = *newExp;
11783 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
11784 checkedExp->prev = prev;
11785 checkedExp->next = next;
11786 }
11787
11788 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
11789
11790 extern int printf(char * , ...);
11791
11792 void __ecereMethod_Expression_Clear();
11793
11794 void ApplyAnyObjectLogic(struct Expression * e)
11795 {
11796 struct Type * destType = e->destType;
11797
11798 if(destType && (destType->classObjectType == 3))
11799 {
11800 if(e && e->expType)
11801 {
11802 struct Type * type = e->expType;
11803 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
11804
11805 if(type->kind == 8 && type->_class && type->_class->registered)
11806 {
11807 _class = type->_class->registered;
11808 }
11809 else if(type->kind == 19)
11810 {
11811 _class = FindClass("ecere::com::Class")->registered;
11812 }
11813 else
11814 {
11815 char string[1024] = "";
11816 struct Symbol * classSym;
11817
11818 PrintType(type, string, 0x0, 0x1);
11819 classSym = FindClass(string);
11820 if(classSym)
11821 _class = classSym->registered;
11822 }
11823 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "ecere::com::Class")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
11824 {
11825 if(!_class || strcmp(_class->fullName, "char *"))
11826 {
11827 struct Expression * checkedExp = e, * newExp;
11828
11829 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11830 {
11831 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11832 {
11833 if(checkedExp->type == 25)
11834 {
11835 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11836 }
11837 else
11838 checkedExp = (*checkedExp->list).last;
11839 }
11840 else if(checkedExp->type == 11)
11841 checkedExp = checkedExp->cast.exp;
11842 }
11843 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
11844 {
11845 newExp = checkedExp->op.exp2;
11846 checkedExp->op.exp2 = (((void *)0));
11847 FreeExpContents(checkedExp);
11848 if(e->expType && e->expType->passAsTemplate)
11849 {
11850 char size[100];
11851
11852 ComputeTypeSize(e->expType);
11853 sprintf(size, "%d", e->expType->size);
11854 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))))));
11855 }
11856 ReplaceExpContents(checkedExp, newExp);
11857 e->byReference = 0x1;
11858 }
11859 else if(!e->byReference || (_class && _class->type == 5))
11860 {
11861 struct Expression * checkedExp, * newExp;
11862
11863 {
11864 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;
11865
11866 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
11867 {
11868 struct Context * context = PushContext();
11869 struct Declarator * decl;
11870 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11871 char typeString[1024];
11872 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11873
11874 typeString[0] = '\0';
11875 *newExp = *e;
11876 newExp->prev = (((void *)0));
11877 newExp->next = (((void *)0));
11878 newExp->expType = (((void *)0));
11879 PrintType(e->expType, typeString, 0x0, 0x1);
11880 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
11881 newExp->destType = ProcessType(specs, decl);
11882 curContext = context;
11883 e->type = 25;
11884 if(curCompound)
11885 {
11886 char name[100];
11887 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
11888
11889 sprintf(name, "__internalValue%03X", internalValueCounter++);
11890 if(!curCompound->compound.declarations)
11891 curCompound->compound.declarations = MkList();
11892 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
11893 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
11894 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
11895 e->compound = MkCompoundStmt((((void *)0)), stmts);
11896 }
11897 else
11898 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
11899 {
11900 struct Type * type = e->destType;
11901
11902 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11903 CopyTypeInto(e->destType, type);
11904 e->destType->refCount = 1;
11905 e->destType->classObjectType = 0;
11906 FreeType(type);
11907 }
11908 e->compound->compound.context = context;
11909 PopContext(context);
11910 curContext = context->parent;
11911 }
11912 }
11913 checkedExp = e;
11914 while(((checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25) && checkedExp->list) || checkedExp->type == 11)
11915 {
11916 if(checkedExp->type == 5 || checkedExp->type == 34 || checkedExp->type == 25)
11917 {
11918 if(checkedExp->type == 25)
11919 {
11920 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
11921 }
11922 else
11923 checkedExp = (*checkedExp->list).last;
11924 }
11925 else if(checkedExp->type == 11)
11926 checkedExp = checkedExp->cast.exp;
11927 }
11928 {
11929 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11930
11931 *operand = *checkedExp;
11932 checkedExp->destType = (((void *)0));
11933 checkedExp->expType = (((void *)0));
11934 __ecereMethod_Expression_Clear(checkedExp);
11935 checkedExp->type = 4;
11936 checkedExp->op.op = '&';
11937 checkedExp->op.exp1 = (((void *)0));
11938 checkedExp->op.exp2 = operand;
11939 }
11940 }
11941 }
11942 }
11943 }
11944 }
11945 {
11946 }
11947 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))))
11948 {
11949 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && !strcmp(e->expType->_class->registered->name, "class"))
11950 {
11951 return ;
11952 }
11953 else
11954 {
11955 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11956
11957 *thisExp = *e;
11958 thisExp->prev = (((void *)0));
11959 thisExp->next = (((void *)0));
11960 __ecereMethod_Expression_Clear(e);
11961 e->type = 5;
11962 e->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpBrackets(MkListOne(thisExp))));
11963 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
11964 ((struct Expression *)(*e->list).first)->byReference = 0x1;
11965 {
11966 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
11967 CopyTypeInto(e->expType, thisExp->expType);
11968 e->expType->byReference = 0x0;
11969 e->expType->refCount = 1;
11970 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))
11971 {
11972 e->expType->classObjectType = 0;
11973 }
11974 }
11975 }
11976 }
11977 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
11978 {
11979 if(destType->kind == 14)
11980 {
11981 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Unspecified type\n", (((void *)0))));
11982 }
11983 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
11984 {
11985 unsigned int byReference = e->expType->byReference;
11986 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11987 struct Declarator * decl;
11988 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
11989 char typeString[1024];
11990 struct Type * type;
11991 int backupClassObjectType;
11992
11993 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
11994 type = e->expType;
11995 else
11996 type = destType;
11997 backupClassObjectType = type->classObjectType;
11998 type->classObjectType = 0;
11999 typeString[0] = '\0';
12000 PrintType(type, typeString, 0x0, 0x1);
12001 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12002 type->classObjectType = backupClassObjectType;
12003 *thisExp = *e;
12004 thisExp->prev = (((void *)0));
12005 thisExp->next = (((void *)0));
12006 __ecereMethod_Expression_Clear(e);
12007 if((type->kind == 8 && type->_class && type->_class->registered && strcmp(type->_class->registered->fullName, "ecere::com::Instance") && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
12008 {
12009 e->type = 4;
12010 e->op.op = '*';
12011 e->op.exp1 = (((void *)0));
12012 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
12013 }
12014 else
12015 {
12016 e->type = 11;
12017 e->cast.typeName = MkTypeName(specs, decl);
12018 e->cast.exp = thisExp;
12019 e->byReference = 0x1;
12020 }
12021 e->expType = type;
12022 e->destType = destType;
12023 type->refCount++;
12024 destType->refCount++;
12025 }
12026 }
12027 }
12028
12029 extern char *  strstr(char * , const char * );
12030
12031 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
12032
12033 struct __ecereNameSpace__ecere__com__DefinedExpression
12034 {
12035 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
12036 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
12037 char *  name;
12038 char *  value;
12039 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
12040 } __attribute__ ((gcc_struct));
12041
12042 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12043
12044 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
12045
12046 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
12047
12048 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
12049
12050 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
12051
12052 extern struct Expression * CopyExpression(struct Expression * exp);
12053
12054 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
12055
12056 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
12057
12058 static void ProcessStatement(struct Statement * stmt);
12059
12060 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
12061
12062 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
12063
12064 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
12065
12066 extern char *  sourceFile;
12067
12068 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
12069
12070 void ProcessExpressionType(struct Expression * exp)
12071 {
12072 void * __ecereTemp2;
12073 void * __ecereTemp1;
12074 unsigned int unresolved = 0x0;
12075 struct Location oldyylloc = yylloc;
12076 unsigned int notByReference = 0x0;
12077
12078 if(!exp || exp->expType)
12079 return ;
12080 yylloc = exp->loc;
12081 switch(exp->type)
12082 {
12083 case 0:
12084 {
12085 struct Identifier * id = exp->identifier;
12086
12087 if(!id)
12088 return ;
12089 if(id->_class && id->_class->name)
12090 {
12091 id->classSym = id->_class->symbol;
12092 }
12093 if(strstr(id->string, "__ecereClass") == id->string)
12094 {
12095 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
12096 break;
12097 }
12098 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
12099 {
12100 ReplaceClassMembers(exp, thisClass);
12101 if(exp->type != 0)
12102 {
12103 ProcessExpressionType(exp);
12104 break;
12105 }
12106 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
12107 break;
12108 }
12109 else
12110 {
12111 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12112
12113 if(!symbol)
12114 {
12115 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
12116 break;
12117 else
12118 {
12119 if(thisClass)
12120 {
12121 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
12122 if(exp->type != 0)
12123 {
12124 ProcessExpressionType(exp);
12125 break;
12126 }
12127 }
12128 else if(currentClass && !id->_class)
12129 {
12130 if(ResolveIdWithClass(exp, currentClass, 0x1))
12131 break;
12132 }
12133 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12134 }
12135 }
12136 if(symbol)
12137 {
12138 struct Type * type = symbol->type;
12139 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
12140
12141 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
12142 {
12143 struct Context * context = SetupTemplatesContext(_class);
12144
12145 type = ReplaceThisClassType(_class);
12146 FinishTemplatesContext(context);
12147 if(type)
12148 type->refCount = 0;
12149 }
12150 FreeSpecifier(id->_class);
12151 id->_class = (((void *)0));
12152 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12153 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
12154 id->classSym = (((void *)0));
12155 exp->expType = type;
12156 if(type)
12157 type->refCount++;
12158 if(type && (type->kind == 15 || (_class && _class->type == 4)))
12159 exp->isConstant = 0x1;
12160 if(symbol->isParam || !strcmp(id->string, "this"))
12161 {
12162 if(_class && _class->type == 1)
12163 exp->byReference = 0x1;
12164 }
12165 if(symbol->isIterator)
12166 {
12167 if(symbol->isIterator == 3)
12168 {
12169 exp->type = 5;
12170 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
12171 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
12172 exp->expType = (((void *)0));
12173 ProcessExpressionType(exp);
12174 }
12175 else if(symbol->isIterator != 4)
12176 {
12177 exp->type = 8;
12178 exp->member.exp = MkExpIdentifier(exp->identifier);
12179 exp->member.exp->expType = exp->expType;
12180 exp->member.member = MkIdentifier("data");
12181 exp->expType = (((void *)0));
12182 ProcessExpressionType(exp);
12183 }
12184 }
12185 break;
12186 }
12187 else
12188 {
12189 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
12190
12191 if(thisNameSpace && !(id->_class && !id->_class->name))
12192 {
12193 char name[1024];
12194
12195 strcpy(name, thisNameSpace);
12196 strcat(name, "::");
12197 strcat(name, id->string);
12198 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
12199 }
12200 if(!definedExp)
12201 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
12202 if(definedExp)
12203 {
12204 int c;
12205
12206 for(c = 0; c < definedExpStackPos; c++)
12207 if(definedExpStack[c] == definedExp)
12208 break;
12209 if(c == definedExpStackPos && c < sizeof definedExpStack / sizeof(void *))
12210 {
12211 struct Location backupYylloc = yylloc;
12212
12213 definedExpStack[definedExpStackPos++] = definedExp;
12214 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
12215 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
12216 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))fileInput->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
12217 echoOn = 0x0;
12218 parsedExpression = (((void *)0));
12219 resetScanner();
12220 expression_yyparse();
12221 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
12222 yylloc = backupYylloc;
12223 if(parsedExpression)
12224 {
12225 FreeIdentifier(id);
12226 exp->type = 5;
12227 exp->list = MkListOne(parsedExpression);
12228 parsedExpression->loc = yylloc;
12229 ProcessExpressionType(exp);
12230 definedExpStackPos--;
12231 return ;
12232 }
12233 definedExpStackPos--;
12234 }
12235 else
12236 {
12237 if(inCompiler)
12238 {
12239 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Recursion in defined expression %s\n", (((void *)0))), id->string);
12240 }
12241 }
12242 }
12243 else
12244 {
12245 struct GlobalData * data = (((void *)0));
12246
12247 if(thisNameSpace && !(id->_class && !id->_class->name))
12248 {
12249 char name[1024];
12250
12251 strcpy(name, thisNameSpace);
12252 strcat(name, "::");
12253 strcat(name, id->string);
12254 data = FindGlobalData(name);
12255 }
12256 if(!data)
12257 data = FindGlobalData(id->string);
12258 if(data)
12259 {
12260 DeclareGlobalData(data);
12261 exp->expType = data->dataType;
12262 if(data->dataType)
12263 data->dataType->refCount++;
12264 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12265 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
12266 FreeSpecifier(id->_class);
12267 id->_class = (((void *)0));
12268 break;
12269 }
12270 else
12271 {
12272 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
12273
12274 if(thisNameSpace && !(id->_class && !id->_class->name))
12275 {
12276 char name[1024];
12277
12278 strcpy(name, thisNameSpace);
12279 strcat(name, "::");
12280 strcat(name, id->string);
12281 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
12282 }
12283 if(!function)
12284 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
12285 if(function)
12286 {
12287 char name[1024];
12288
12289 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12290 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
12291 name[0] = (char)0;
12292 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
12293 strcpy(name, "__ecereFunction_");
12294 FullClassNameCat(name, id->string, 0x0);
12295 if(DeclareFunction(function, name))
12296 {
12297 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
12298 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
12299 }
12300 exp->expType = function->dataType;
12301 if(function->dataType)
12302 function->dataType->refCount++;
12303 FreeSpecifier(id->_class);
12304 id->_class = (((void *)0));
12305 break;
12306 }
12307 }
12308 }
12309 }
12310 }
12311 unresolved = 0x1;
12312 break;
12313 }
12314 case 1:
12315 {
12316 struct __ecereNameSpace__ecere__com__Class * _class;
12317
12318 if(!exp->instance->_class)
12319 {
12320 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
12321 {
12322 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
12323 }
12324 }
12325 ProcessInstantiationType(exp->instance);
12326 exp->isConstant = exp->instance->isConstant;
12327 if(exp->instance->_class)
12328 {
12329 exp->expType = MkClassType(exp->instance->_class->name);
12330 }
12331 break;
12332 }
12333 case 2:
12334 {
12335 if(!exp->expType)
12336 {
12337 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
12338
12339 exp->expType = type;
12340 if(exp->constant[0] == '\'')
12341 {
12342 if((int)((unsigned char *)exp->constant)[1] > 127)
12343 {
12344 int nb;
12345 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(exp->constant + 1, &nb);
12346
12347 if(nb < 2)
12348 ch = exp->constant[1];
12349 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->constant), exp->constant = 0);
12350 exp->constant = PrintUInt(ch);
12351 type->kind = 8;
12352 type->_class = FindClass("unichar");
12353 type->isSigned = 0x0;
12354 }
12355 else
12356 {
12357 type->kind = 1;
12358 type->isSigned = 0x1;
12359 }
12360 }
12361 else if(strchr(exp->constant, '.'))
12362 {
12363 char ch = exp->constant[strlen(exp->constant) - 1];
12364
12365 if(ch == 'f')
12366 type->kind = 6;
12367 else
12368 type->kind = 7;
12369 type->isSigned = 0x1;
12370 }
12371 else
12372 {
12373 if(exp->constant[0] == '0' && exp->constant[1])
12374 type->isSigned = 0x0;
12375 else if(strchr(exp->constant, 'L') || strchr(exp->constant, 'l'))
12376 type->isSigned = 0x0;
12377 else if(strtoll(exp->constant, (((void *)0)), 0) > (((int)0x7fffffff)))
12378 type->isSigned = 0x0;
12379 else
12380 type->isSigned = 0x1;
12381 type->kind = 3;
12382 }
12383 exp->isConstant = 0x1;
12384 }
12385 break;
12386 }
12387 case 3:
12388 {
12389 exp->isConstant = 0x1;
12390 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 1, ((struct Type *)__ecereTemp1)->constant = 0x1, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
12391 break;
12392 }
12393 case 13:
12394 case 28:
12395 ProcessExpressionType(exp->_new.size);
12396 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), ((struct Type *)__ecereTemp1));
12397 DeclareType(exp->expType->type, 0x0, 0x0);
12398 break;
12399 case 14:
12400 case 29:
12401 ProcessExpressionType(exp->_renew.size);
12402 ProcessExpressionType(exp->_renew.exp);
12403 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), ((struct Type *)__ecereTemp1));
12404 DeclareType(exp->expType->type, 0x0, 0x0);
12405 break;
12406 case 4:
12407 {
12408 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
12409 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
12410 unsigned int useDestType = 0x0, useSideType = 0x0;
12411 struct Location oldyylloc = yylloc;
12412 unsigned int useSideUnit = 0x0;
12413 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
12414
12415 switch(exp->op.op)
12416 {
12417 case '=':
12418 case MUL_ASSIGN:
12419 case DIV_ASSIGN:
12420 case MOD_ASSIGN:
12421 case ADD_ASSIGN:
12422 case SUB_ASSIGN:
12423 case LEFT_ASSIGN:
12424 case RIGHT_ASSIGN:
12425 case AND_ASSIGN:
12426 case XOR_ASSIGN:
12427 case OR_ASSIGN:
12428 assign = 0x1;
12429 break;
12430 case '!':
12431 break;
12432 case AND_OP:
12433 case OR_OP:
12434 boolOps = 0x1;
12435 boolResult = 0x1;
12436 break;
12437 case EQ_OP:
12438 case '<':
12439 case '>':
12440 case LE_OP:
12441 case GE_OP:
12442 case NE_OP:
12443 boolResult = 0x1;
12444 useSideType = 0x1;
12445 break;
12446 case '+':
12447 case '-':
12448 useSideUnit = 0x1;
12449 case '|':
12450 case '&':
12451 case '^':
12452 case '/':
12453 case '%':
12454 case '*':
12455 if(exp->op.op != '*' || exp->op.exp1)
12456 {
12457 useSideType = 0x1;
12458 useDestType = 0x1;
12459 }
12460 break;
12461 }
12462 if(exp->op.op == '&')
12463 {
12464 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
12465 {
12466 struct Identifier * id = exp->op.exp2->identifier;
12467 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
12468
12469 if(symbol && symbol->isIterator == 2)
12470 {
12471 exp->type = 8;
12472 exp->member.exp = exp->op.exp2;
12473 exp->member.member = MkIdentifier("key");
12474 exp->expType = (((void *)0));
12475 exp->op.exp2->expType = symbol->type;
12476 symbol->type->refCount++;
12477 ProcessExpressionType(exp);
12478 FreeType(dummy);
12479 break;
12480 }
12481 }
12482 }
12483 if(exp->op.exp1)
12484 {
12485 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))
12486 {
12487 if(exp->op.exp1->destType)
12488 FreeType(exp->op.exp1->destType);
12489 exp->op.exp1->destType = exp->destType;
12490 if(exp->destType)
12491 exp->destType->refCount++;
12492 }
12493 else if(!assign)
12494 {
12495 if(exp->op.exp1->destType)
12496 FreeType(exp->op.exp1->destType);
12497 exp->op.exp1->destType = dummy;
12498 dummy->refCount++;
12499 }
12500 if(exp->op.exp1->destType && exp->op.op != '=')
12501 exp->op.exp1->destType->count++;
12502 ProcessExpressionType(exp->op.exp1);
12503 if(exp->op.exp1->destType && exp->op.op != '=')
12504 exp->op.exp1->destType->count--;
12505 if(exp->op.exp1->destType == dummy)
12506 {
12507 FreeType(dummy);
12508 exp->op.exp1->destType = (((void *)0));
12509 }
12510 type1 = exp->op.exp1->expType;
12511 }
12512 if(exp->op.exp2)
12513 {
12514 char expString[10240];
12515
12516 expString[0] = '\0';
12517 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
12518 {
12519 if(exp->op.exp1)
12520 {
12521 exp->op.exp2->destType = exp->op.exp1->expType;
12522 if(exp->op.exp1->expType)
12523 exp->op.exp1->expType->refCount++;
12524 }
12525 else
12526 {
12527 exp->op.exp2->destType = exp->destType;
12528 if(exp->destType)
12529 exp->destType->refCount++;
12530 }
12531 if(type1)
12532 type1->refCount++;
12533 exp->expType = type1;
12534 }
12535 else if(assign)
12536 {
12537 if(inCompiler)
12538 PrintExpression(exp->op.exp2, expString);
12539 if(type1 && type1->kind == 13)
12540 {
12541 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)
12542 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
12543 else if(exp->op.op == '=')
12544 {
12545 if(exp->op.exp2->destType)
12546 FreeType(exp->op.exp2->destType);
12547 exp->op.exp2->destType = type1;
12548 if(type1)
12549 type1->refCount++;
12550 }
12551 }
12552 else
12553 {
12554 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)
12555 ;
12556 else
12557 {
12558 if(exp->op.exp2->destType)
12559 FreeType(exp->op.exp2->destType);
12560 exp->op.exp2->destType = type1;
12561 if(type1)
12562 type1->refCount++;
12563 }
12564 }
12565 if(type1)
12566 type1->refCount++;
12567 exp->expType = type1;
12568 }
12569 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)))
12570 {
12571 if(exp->op.exp2->destType)
12572 FreeType(exp->op.exp2->destType);
12573 exp->op.exp2->destType = exp->destType;
12574 if(exp->destType)
12575 exp->destType->refCount++;
12576 }
12577 else
12578 {
12579 if(exp->op.exp2->destType)
12580 FreeType(exp->op.exp2->destType);
12581 exp->op.exp2->destType = dummy;
12582 dummy->refCount++;
12583 }
12584 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
12585 {
12586 FreeType(exp->op.exp2->destType);
12587 exp->op.exp2->destType = type1;
12588 type1->refCount++;
12589 }
12590 if(exp->op.exp2->destType && exp->op.op != '=')
12591 exp->op.exp2->destType->count++;
12592 ProcessExpressionType(exp->op.exp2);
12593 if(exp->op.exp2->destType && exp->op.op != '=')
12594 exp->op.exp2->destType->count--;
12595 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
12596 {
12597 if(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)
12598 {
12599 if(exp->op.op != '=' && type1->type->kind == 0)
12600 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12601 }
12602 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)))
12603 {
12604 if(exp->op.op == ADD_ASSIGN)
12605 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12606 }
12607 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))
12608 {
12609 if(exp->op.op == ADD_ASSIGN)
12610 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12611 }
12612 else if(inCompiler)
12613 {
12614 char type1String[1024];
12615 char type2String[1024];
12616
12617 type1String[0] = '\0';
12618 type2String[0] = '\0';
12619 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
12620 PrintType(type1, type2String, 0x0, 0x1);
12621 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
12622 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
12623 }
12624 }
12625 if(exp->op.exp2->destType == dummy)
12626 {
12627 FreeType(dummy);
12628 exp->op.exp2->destType = (((void *)0));
12629 }
12630 type2 = exp->op.exp2->expType;
12631 }
12632 dummy->kind = 0;
12633 if(exp->op.op == SIZEOF)
12634 {
12635 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
12636 exp->isConstant = 0x1;
12637 }
12638 else if(exp->op.op == '*' && !exp->op.exp1)
12639 {
12640 exp->expType = Dereference(type2);
12641 if(type2 && type2->kind == 8)
12642 notByReference = 0x1;
12643 }
12644 else if(exp->op.op == '&' && !exp->op.exp1)
12645 exp->expType = Reference(type2);
12646 else if(!assign)
12647 {
12648 if(boolOps)
12649 {
12650 if(exp->op.exp1)
12651 {
12652 if(exp->op.exp1->destType)
12653 FreeType(exp->op.exp1->destType);
12654 exp->op.exp1->destType = MkClassType("bool");
12655 exp->op.exp1->destType->truth = 0x1;
12656 if(!exp->op.exp1->expType)
12657 ProcessExpressionType(exp->op.exp1);
12658 else
12659 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12660 FreeType(exp->op.exp1->expType);
12661 exp->op.exp1->expType = MkClassType("bool");
12662 exp->op.exp1->expType->truth = 0x1;
12663 }
12664 if(exp->op.exp2)
12665 {
12666 if(exp->op.exp2->destType)
12667 FreeType(exp->op.exp2->destType);
12668 exp->op.exp2->destType = MkClassType("bool");
12669 exp->op.exp2->destType->truth = 0x1;
12670 if(!exp->op.exp2->expType)
12671 ProcessExpressionType(exp->op.exp2);
12672 else
12673 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12674 FreeType(exp->op.exp2->expType);
12675 exp->op.exp2->expType = MkClassType("bool");
12676 exp->op.exp2->expType->truth = 0x1;
12677 }
12678 }
12679 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")))))
12680 {
12681 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
12682 {
12683 if(exp->op.exp2->destType)
12684 FreeType(exp->op.exp2->destType);
12685 exp->op.exp2->destType = type1;
12686 type1->refCount++;
12687 if(exp->op.exp1->destType)
12688 FreeType(exp->op.exp1->destType);
12689 exp->op.exp1->destType = type2;
12690 type2->refCount++;
12691 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)
12692 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);
12693 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
12694 {
12695 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12696
12697 if(argExp)
12698 {
12699 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12700
12701 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
12702 ProcessExpressionType(exp->op.exp1);
12703 if(type2->kind != 13)
12704 {
12705 ProcessExpressionType(classExp);
12706 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"))))))));
12707 if(!exp->op.exp2->expType)
12708 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
12709 ProcessExpressionType(exp->op.exp2);
12710 }
12711 }
12712 }
12713 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 22 || type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
12714 {
12715 if(type1->kind != 8 && type1->type->kind == 0)
12716 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12717 exp->expType = type1;
12718 if(type1)
12719 type1->refCount++;
12720 }
12721 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 22 || type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
12722 {
12723 if(type2->kind != 8 && type2->type->kind == 0)
12724 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "void *: unknown size\n", (((void *)0))));
12725 exp->expType = type2;
12726 if(type2)
12727 type2->refCount++;
12728 }
12729 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))
12730 {
12731 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "different levels of indirection\n", (((void *)0))));
12732 }
12733 else
12734 {
12735 unsigned int success = 0x0;
12736
12737 if(type1->kind == 13 && type2->kind == 13)
12738 {
12739 if(exp->op.op == '+')
12740 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "cannot add two pointers\n", (((void *)0))));
12741 else if(exp->op.op == '-')
12742 {
12743 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
12744 {
12745 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1));
12746 success = 0x1;
12747 if(type1->type->kind == 20)
12748 {
12749 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
12750
12751 if(argExp)
12752 {
12753 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
12754
12755 ProcessExpressionType(classExp);
12756 exp->type = 5;
12757 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")))))));
12758 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
12759 FreeType(dummy);
12760 return ;
12761 }
12762 }
12763 }
12764 }
12765 }
12766 if(!success && exp->op.exp1->type == 2)
12767 {
12768 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12769 {
12770 if(exp->expType)
12771 FreeType(exp->expType);
12772 exp->expType = exp->op.exp1->destType;
12773 if(exp->op.exp1->destType)
12774 exp->op.exp1->destType->refCount++;
12775 success = 0x1;
12776 }
12777 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12778 {
12779 if(exp->expType)
12780 FreeType(exp->expType);
12781 exp->expType = exp->op.exp2->destType;
12782 if(exp->op.exp2->destType)
12783 exp->op.exp2->destType->refCount++;
12784 success = 0x1;
12785 }
12786 }
12787 else if(!success)
12788 {
12789 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12790 {
12791 if(exp->expType)
12792 FreeType(exp->expType);
12793 exp->expType = exp->op.exp2->destType;
12794 if(exp->op.exp2->destType)
12795 exp->op.exp2->destType->refCount++;
12796 success = 0x1;
12797 }
12798 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12799 {
12800 if(exp->expType)
12801 FreeType(exp->expType);
12802 exp->expType = exp->op.exp1->destType;
12803 if(exp->op.exp1->destType)
12804 exp->op.exp1->destType->refCount++;
12805 success = 0x1;
12806 }
12807 }
12808 if(!success)
12809 {
12810 char expString1[10240];
12811 char expString2[10240];
12812 char type1[1024];
12813 char type2[1024];
12814
12815 expString1[0] = '\0';
12816 expString2[0] = '\0';
12817 type1[0] = '\0';
12818 type2[0] = '\0';
12819 if(inCompiler)
12820 {
12821 PrintExpression(exp->op.exp1, expString1);
12822 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12823 PrintExpression(exp->op.exp2, expString2);
12824 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12825 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
12826 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
12827 }
12828 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
12829 }
12830 }
12831 }
12832 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12833 {
12834 if(exp->op.exp1->destType)
12835 FreeType(exp->op.exp1->destType);
12836 exp->op.exp1->destType = type2->_class->registered->dataType;
12837 if(type2->_class->registered->dataType)
12838 type2->_class->registered->dataType->refCount++;
12839 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12840 exp->expType = type2;
12841 if(type2)
12842 type2->refCount++;
12843 }
12844 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
12845 {
12846 if(exp->op.exp2->destType)
12847 FreeType(exp->op.exp2->destType);
12848 exp->op.exp2->destType = type1->_class->registered->dataType;
12849 if(type1->_class->registered->dataType)
12850 type1->_class->registered->dataType->refCount++;
12851 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12852 exp->expType = type1;
12853 if(type1)
12854 type1->refCount++;
12855 }
12856 else if(type1)
12857 {
12858 unsigned int valid = 0x0;
12859
12860 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
12861 {
12862 if(exp->op.exp2->destType)
12863 FreeType(exp->op.exp2->destType);
12864 if(!type1->_class->registered->dataType)
12865 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
12866 exp->op.exp2->destType = type1->_class->registered->dataType;
12867 exp->op.exp2->destType->refCount++;
12868 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
12869 type2 = exp->op.exp2->destType;
12870 exp->expType = type2;
12871 type2->refCount++;
12872 }
12873 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
12874 {
12875 if(exp->op.exp1->destType)
12876 FreeType(exp->op.exp1->destType);
12877 if(!type2->_class->registered->dataType)
12878 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
12879 exp->op.exp1->destType = type2->_class->registered->dataType;
12880 exp->op.exp1->destType->refCount++;
12881 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12882 type1 = exp->op.exp1->destType;
12883 exp->expType = type1;
12884 type1->refCount++;
12885 }
12886 if(!boolResult || exp->op.op == '>' || exp->op.op == '<')
12887 {
12888 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4 && exp->op.exp2->expType)
12889 {
12890 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
12891 {
12892 if(exp->expType)
12893 FreeType(exp->expType);
12894 exp->expType = exp->op.exp1->expType;
12895 if(exp->op.exp2->expType)
12896 exp->op.exp1->expType->refCount++;
12897 valid = 0x1;
12898 }
12899 }
12900 else if(type2 && (type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4 && exp->op.exp1->expType))
12901 {
12902 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
12903 {
12904 if(exp->expType)
12905 FreeType(exp->expType);
12906 exp->expType = exp->op.exp2->expType;
12907 if(exp->op.exp2->expType)
12908 exp->op.exp2->expType->refCount++;
12909 valid = 0x1;
12910 }
12911 }
12912 }
12913 if(!valid)
12914 {
12915 if(exp->op.exp2->destType)
12916 FreeType(exp->op.exp2->destType);
12917 exp->op.exp2->destType = type1;
12918 type1->refCount++;
12919 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
12920 {
12921 if(exp->expType)
12922 FreeType(exp->expType);
12923 exp->expType = exp->op.exp2->destType;
12924 if(exp->op.exp2->destType)
12925 exp->op.exp2->destType->refCount++;
12926 }
12927 else if(type1 && type2)
12928 {
12929 char expString1[10240];
12930 char expString2[10240];
12931 char type1String[1024];
12932 char type2String[1024];
12933
12934 expString1[0] = '\0';
12935 expString2[0] = '\0';
12936 type1String[0] = '\0';
12937 type2String[0] = '\0';
12938 if(inCompiler)
12939 {
12940 PrintExpression(exp->op.exp1, expString1);
12941 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
12942 PrintExpression(exp->op.exp2, expString2);
12943 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
12944 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
12945 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
12946 }
12947 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
12948 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
12949 {
12950 exp->expType = exp->op.exp1->expType;
12951 if(exp->op.exp1->expType)
12952 exp->op.exp1->expType->refCount++;
12953 }
12954 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12955 {
12956 exp->expType = exp->op.exp2->expType;
12957 if(exp->op.exp2->expType)
12958 exp->op.exp2->expType->refCount++;
12959 }
12960 }
12961 }
12962 }
12963 else if(type2)
12964 {
12965 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
12966 {
12967 struct Type * oldType = exp->op.exp1->expType;
12968
12969 exp->op.exp1->expType = (((void *)0));
12970 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12971 FreeType(oldType);
12972 else
12973 exp->op.exp1->expType = oldType;
12974 }
12975 if(exp->op.exp1->destType)
12976 FreeType(exp->op.exp1->destType);
12977 exp->op.exp1->destType = type2;
12978 type2->refCount++;
12979 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
12980 {
12981 if(exp->expType)
12982 FreeType(exp->expType);
12983 exp->expType = exp->op.exp1->destType;
12984 if(exp->op.exp1->destType)
12985 exp->op.exp1->destType->refCount++;
12986 }
12987 }
12988 }
12989 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
12990 {
12991 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
12992 {
12993 if(exp->op.exp1->destType)
12994 FreeType(exp->op.exp1->destType);
12995 exp->op.exp1->destType = type2->_class->registered->dataType;
12996 if(type2->_class->registered->dataType)
12997 type2->_class->registered->dataType->refCount++;
12998 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
12999 }
13000 if(exp->op.op == '!')
13001 {
13002 exp->expType = MkClassType("bool");
13003 exp->expType->truth = 0x1;
13004 }
13005 else
13006 {
13007 exp->expType = type2;
13008 if(type2)
13009 type2->refCount++;
13010 }
13011 }
13012 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
13013 {
13014 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
13015 {
13016 if(exp->op.exp2->destType)
13017 FreeType(exp->op.exp2->destType);
13018 exp->op.exp2->destType = type1->_class->registered->dataType;
13019 if(type1->_class->registered->dataType)
13020 type1->_class->registered->dataType->refCount++;
13021 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
13022 }
13023 exp->expType = type1;
13024 if(type1)
13025 type1->refCount++;
13026 }
13027 }
13028 yylloc = exp->loc;
13029 if(exp->op.exp1 && !exp->op.exp1->expType)
13030 {
13031 char expString[10000];
13032
13033 expString[0] = '\0';
13034 if(inCompiler)
13035 {
13036 PrintExpression(exp->op.exp1, expString);
13037 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13038 }
13039 if(expString[0])
13040 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13041 }
13042 if(exp->op.exp2 && !exp->op.exp2->expType)
13043 {
13044 char expString[10240];
13045
13046 expString[0] = '\0';
13047 if(inCompiler)
13048 {
13049 PrintExpression(exp->op.exp2, expString);
13050 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
13051 }
13052 if(expString[0])
13053 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
13054 }
13055 if(boolResult)
13056 {
13057 FreeType(exp->expType);
13058 exp->expType = MkClassType("bool");
13059 exp->expType->truth = 0x1;
13060 }
13061 if(exp->op.op != SIZEOF)
13062 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
13063 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
13064 {
13065 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
13066 }
13067 yylloc = oldyylloc;
13068 FreeType(dummy);
13069 break;
13070 }
13071 case 5:
13072 case 34:
13073 {
13074 struct Expression * e;
13075
13076 exp->isConstant = 0x1;
13077 for(e = (*exp->list).first; e; e = e->next)
13078 {
13079 unsigned int inced = 0x0;
13080
13081 if(!e->next)
13082 {
13083 FreeType(e->destType);
13084 e->destType = exp->destType;
13085 if(e->destType)
13086 {
13087 exp->destType->refCount++;
13088 e->destType->count++;
13089 inced = 0x1;
13090 }
13091 }
13092 ProcessExpressionType(e);
13093 if(inced)
13094 exp->destType->count--;
13095 if(!exp->expType && !e->next)
13096 {
13097 exp->expType = e->expType;
13098 if(e->expType)
13099 e->expType->refCount++;
13100 }
13101 if(!e->isConstant)
13102 exp->isConstant = 0x0;
13103 }
13104 e = (*exp->list).first;
13105 if(!e->next && e->type == 8)
13106 {
13107 struct Expression * next = exp->next, * prev = exp->prev;
13108
13109 FreeType(exp->expType);
13110 FreeType(exp->destType);
13111 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
13112 *exp = *e;
13113 exp->prev = prev;
13114 exp->next = next;
13115 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
13116 ProcessExpressionType(exp);
13117 }
13118 break;
13119 }
13120 case 6:
13121 {
13122 struct Expression * e;
13123
13124 exp->isConstant = 0x1;
13125 ProcessExpressionType(exp->index.exp);
13126 if(!exp->index.exp->isConstant)
13127 exp->isConstant = 0x0;
13128 if(exp->index.exp->expType)
13129 {
13130 struct Type * source = exp->index.exp->expType;
13131
13132 if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass) && source->_class->registered->templateArgs)
13133 {
13134 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
13135
13136 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
13137 if(exp->index.index && (*exp->index.index).last)
13138 {
13139 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
13140 }
13141 }
13142 }
13143 for(e = (*exp->index.index).first; e; e = e->next)
13144 {
13145 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
13146 {
13147 if(e->destType)
13148 FreeType(e->destType);
13149 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
13150 }
13151 ProcessExpressionType(e);
13152 if(!e->next)
13153 {
13154 }
13155 if(!e->isConstant)
13156 exp->isConstant = 0x0;
13157 }
13158 if(!exp->expType)
13159 exp->expType = Dereference(exp->index.exp->expType);
13160 if(exp->expType)
13161 DeclareType(exp->expType, 0x0, 0x0);
13162 break;
13163 }
13164 case 7:
13165 {
13166 struct Expression * e;
13167 struct Type * functionType;
13168 struct Type * methodType = (((void *)0));
13169 char name[1024];
13170
13171 name[0] = '\0';
13172 if(inCompiler)
13173 {
13174 PrintExpression(exp->call.exp, name);
13175 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
13176 {
13177 PrintExpression(exp->call.exp, name);
13178 }
13179 }
13180 if(exp->call.exp->type == 0)
13181 {
13182 struct Expression * idExp = exp->call.exp;
13183 struct Identifier * id = idExp->identifier;
13184
13185 if(!strcmp(id->string, "__ENDIAN_PAD"))
13186 {
13187 exp->expType = ProcessTypeString("int", 0x1);
13188 if(exp->call.arguments && (*exp->call.arguments).first)
13189 ProcessExpressionType((*exp->call.arguments).first);
13190 break;
13191 }
13192 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
13193 {
13194 struct Expression * a = (((void *)0));
13195 struct Expression * b = (((void *)0));
13196 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
13197
13198 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
13199 {
13200 a = (*exp->call.arguments).first;
13201 b = (*exp->call.arguments).last;
13202 tempExp1 = a;
13203 tempExp2 = b;
13204 }
13205 else if((*exp->call.arguments).count == 1)
13206 {
13207 a = (*exp->call.arguments).first;
13208 tempExp1 = a;
13209 }
13210 if(a)
13211 {
13212 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
13213 idExp->identifier = (((void *)0));
13214 FreeExpContents(exp);
13215 ProcessExpressionType(a);
13216 if(b)
13217 ProcessExpressionType(b);
13218 exp->type = 5;
13219 exp->list = MkList();
13220 if(a->expType && (!b || b->expType))
13221 {
13222 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
13223 {
13224 if(inCompiler)
13225 {
13226 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13227 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
13228 struct Declaration * decl;
13229 char temp1[1024], temp2[1024];
13230
13231 GetTypeSpecs(a->expType, specs);
13232 if(a && !a->isConstant && a->type != 0)
13233 {
13234 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
13235 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
13236 tempExp1 = QMkExpId(temp1);
13237 tempExp1->expType = a->expType;
13238 if(a->expType)
13239 a->expType->refCount++;
13240 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
13241 }
13242 if(b && !b->isConstant && b->type != 0)
13243 {
13244 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
13245 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
13246 tempExp2 = QMkExpId(temp2);
13247 tempExp2->expType = b->expType;
13248 if(b->expType)
13249 b->expType->refCount++;
13250 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
13251 }
13252 decl = MkDeclaration(specs, decls);
13253 if(!curCompound->compound.declarations)
13254 curCompound->compound.declarations = MkList();
13255 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
13256 }
13257 }
13258 }
13259 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
13260 {
13261 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
13262
13263 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
13264 exp->expType = a->expType;
13265 if(a->expType)
13266 a->expType->refCount++;
13267 }
13268 else if(!strcmp(id->string, "Abs"))
13269 {
13270 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
13271 exp->expType = a->expType;
13272 if(a->expType)
13273 a->expType->refCount++;
13274 }
13275 else if(!strcmp(id->string, "Sgn"))
13276 {
13277 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"))))));
13278 exp->expType = ProcessTypeString("int", 0x0);
13279 }
13280 FreeExpression(tempExp1);
13281 if(tempExp2)
13282 FreeExpression(tempExp2);
13283 FreeIdentifier(id);
13284 break;
13285 }
13286 }
13287 }
13288 {
13289 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = (unsigned int)1, dummy->refCount = 1, dummy);
13290
13291 if(!exp->call.exp->destType)
13292 {
13293 exp->call.exp->destType = dummy;
13294 dummy->refCount++;
13295 }
13296 ProcessExpressionType(exp->call.exp);
13297 if(exp->call.exp->destType == dummy)
13298 {
13299 FreeType(dummy);
13300 exp->call.exp->destType = (((void *)0));
13301 }
13302 FreeType(dummy);
13303 }
13304 functionType = exp->call.exp->expType;
13305 if(functionType && functionType->kind == 16)
13306 {
13307 methodType = functionType;
13308 functionType = methodType->method->dataType;
13309 if(exp->call.exp->expType->usedClass)
13310 {
13311 char typeString[1024];
13312
13313 typeString[0] = '\0';
13314 PrintType(functionType, typeString, 0x1, 0x1);
13315 if(strstr(typeString, "thisclass"))
13316 {
13317 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13318 struct Declarator * decl;
13319
13320 {
13321 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
13322
13323 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13324 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
13325 thisClassParams = 0x0;
13326 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
13327 {
13328 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
13329
13330 thisClass = exp->call.exp->expType->usedClass;
13331 ProcessDeclarator(decl);
13332 thisClass = backupThisClass;
13333 }
13334 thisClassParams = 0x1;
13335 functionType = ProcessType(specs, decl);
13336 functionType->refCount = 0;
13337 FinishTemplatesContext(context);
13338 }
13339 FreeList(specs, FreeSpecifier);
13340 FreeDeclarator(decl);
13341 }
13342 }
13343 }
13344 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
13345 {
13346 struct Type * type = functionType->type;
13347
13348 if(!functionType->refCount)
13349 {
13350 functionType->type = (((void *)0));
13351 FreeType(functionType);
13352 }
13353 functionType = type;
13354 }
13355 if(functionType && functionType->kind != 11)
13356 {
13357 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "called object %s is not a function\n", (((void *)0))), name);
13358 }
13359 else if(functionType)
13360 {
13361 unsigned int emptyParams = 0x0, noParams = 0x0;
13362 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
13363 struct Type * type = functionType->params.first;
13364 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
13365 int extra = 0;
13366 struct Location oldyylloc = yylloc;
13367
13368 if(!type)
13369 emptyParams = 0x1;
13370 if(functionType->extraParam && e)
13371 {
13372 e->destType = MkClassType(functionType->thisClass->string);
13373 e = e->next;
13374 }
13375 if(!functionType->staticMethod)
13376 {
13377 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
13378 {
13379 type = MkClassType(memberExp->member.exp->expType->_class->string);
13380 if(e)
13381 {
13382 e->destType = type;
13383 e = e->next;
13384 type = functionType->params.first;
13385 }
13386 else
13387 type->refCount = 0;
13388 }
13389 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
13390 {
13391 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
13392 if(e)
13393 {
13394 e->destType = type;
13395 e = e->next;
13396 type = functionType->params.first;
13397 }
13398 else
13399 type->refCount = 0;
13400 }
13401 }
13402 if(type && type->kind == 0)
13403 {
13404 noParams = 0x1;
13405 if(!type->refCount)
13406 FreeType(type);
13407 type = (((void *)0));
13408 }
13409 for(; e; e = e->next)
13410 {
13411 if(!type && !emptyParams)
13412 {
13413 yylloc = e->loc;
13414 if(methodType && methodType->methodClass)
13415 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);
13416 else
13417 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);
13418 break;
13419 }
13420 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
13421 {
13422 struct Type * templatedType = (((void *)0));
13423 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
13424 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13425 int id = 0;
13426
13427 if(_class && _class->templateArgs)
13428 {
13429 struct __ecereNameSpace__ecere__com__Class * sClass;
13430
13431 for(sClass = _class; sClass; sClass = sClass->base)
13432 {
13433 if(sClass->templateClass)
13434 sClass = sClass->templateClass;
13435 id = 0;
13436 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13437 {
13438 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
13439 {
13440 struct __ecereNameSpace__ecere__com__Class * nextClass;
13441
13442 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13443 {
13444 if(nextClass->templateClass)
13445 nextClass = nextClass->templateClass;
13446 id += nextClass->templateParams.count;
13447 }
13448 break;
13449 }
13450 id++;
13451 }
13452 if(curParam)
13453 break;
13454 }
13455 }
13456 if(curParam && _class->templateArgs[id].dataTypeString)
13457 {
13458 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
13459
13460 {
13461 struct Context * context = SetupTemplatesContext(_class);
13462
13463 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
13464 FinishTemplatesContext(context);
13465 }
13466 e->destType = templatedType;
13467 if(templatedType)
13468 {
13469 templatedType->passAsTemplate = 0x1;
13470 }
13471 }
13472 else
13473 {
13474 e->destType = type;
13475 if(type)
13476 type->refCount++;
13477 }
13478 }
13479 else
13480 {
13481 e->destType = type;
13482 if(type)
13483 type->refCount++;
13484 }
13485 if(type && type->kind != 14)
13486 {
13487 struct Type * next = type->next;
13488
13489 if(!type->refCount)
13490 FreeType(type);
13491 type = next;
13492 }
13493 }
13494 if(type && type->kind != 14)
13495 {
13496 if(methodType && methodType->methodClass)
13497 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);
13498 else
13499 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);
13500 }
13501 yylloc = oldyylloc;
13502 if(type && !type->refCount)
13503 FreeType(type);
13504 }
13505 else
13506 {
13507 functionType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 0, ((struct Type *)__ecereTemp1)->kind = 11, ((struct Type *)__ecereTemp1));
13508 if(exp->call.exp->type == 0)
13509 {
13510 char * string = exp->call.exp->identifier->string;
13511
13512 if(inCompiler)
13513 {
13514 struct Symbol * symbol;
13515 struct Location oldyylloc = yylloc;
13516
13517 yylloc = exp->call.exp->identifier->loc;
13518 if(strstr(string, "__builtin_") == string)
13519 ;
13520 else
13521 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "%s undefined; assuming extern returning int\n", (((void *)0))), string);
13522 symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString(string), ((struct Symbol *)__ecereTemp1)->type = ProcessTypeString("int()", 0x1), ((struct Symbol *)__ecereTemp1));
13523 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
13524 if(strstr(symbol->string, "::"))
13525 globalContext->hasNameSpace = 0x1;
13526 yylloc = oldyylloc;
13527 }
13528 }
13529 else if(exp->call.exp->type == 8)
13530 {
13531 }
13532 else
13533 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "callable object undefined; extern assuming returning int\n", (((void *)0))));
13534 if(!functionType->returnType)
13535 {
13536 functionType->returnType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
13537 }
13538 }
13539 if(functionType && functionType->kind == 11)
13540 {
13541 exp->expType = functionType->returnType;
13542 if(functionType->returnType)
13543 functionType->returnType->refCount++;
13544 if(!functionType->refCount)
13545 FreeType(functionType);
13546 }
13547 if(exp->call.arguments)
13548 {
13549 for(e = (*exp->call.arguments).first; e; e = e->next)
13550 {
13551 struct Type * destType = e->destType;
13552
13553 ProcessExpressionType(e);
13554 }
13555 }
13556 break;
13557 }
13558 case 8:
13559 {
13560 struct Type * type;
13561 struct Location oldyylloc = yylloc;
13562 unsigned int thisPtr = (exp->member.exp && exp->member.exp->type == 0 && !strcmp(exp->member.exp->identifier->string, "this"));
13563
13564 exp->thisPtr = thisPtr;
13565 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
13566 {
13567 exp->member.member->classSym = exp->member.member->_class->symbol;
13568 }
13569 ProcessExpressionType(exp->member.exp);
13570 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)
13571 {
13572 exp->isConstant = 0x0;
13573 }
13574 else
13575 exp->isConstant = exp->member.exp->isConstant;
13576 type = exp->member.exp->expType;
13577 yylloc = exp->loc;
13578 if(type && (type->kind == 20))
13579 {
13580 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
13581 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
13582
13583 if(_class)
13584 {
13585 for(param = _class->templateParams.first; param; param = param->next)
13586 {
13587 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
13588 break;
13589 }
13590 }
13591 if(param && param->defaultArg.member)
13592 {
13593 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
13594
13595 if(argExp)
13596 {
13597 struct Expression * expMember = exp->member.exp;
13598 struct Declarator * decl;
13599 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13600 char thisClassTypeString[1024];
13601
13602 FreeIdentifier(exp->member.member);
13603 ProcessExpressionType(argExp);
13604 {
13605 char * colon = strstr(param->defaultArg.memberString, "::");
13606
13607 if(colon)
13608 {
13609 char className[1024];
13610 struct __ecereNameSpace__ecere__com__Class * sClass;
13611
13612 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
13613 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
13614 }
13615 else
13616 strcpy(thisClassTypeString, _class->fullName);
13617 }
13618 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
13619 exp->expType = ProcessType(specs, decl);
13620 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
13621 {
13622 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
13623 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
13624 int c;
13625 int paramCount = 0;
13626 int lastParam = -1;
13627 char templateString[1024];
13628 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
13629
13630 sprintf(templateString, "%s<", expClass->templateClass->fullName);
13631 for(cClass = expClass; cClass; cClass = cClass->base)
13632 {
13633 int p = 0;
13634
13635 for(param = cClass->templateParams.first; param; param = param->next)
13636 {
13637 int id = p;
13638 struct __ecereNameSpace__ecere__com__Class * sClass;
13639 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
13640
13641 for(sClass = cClass->base; sClass; sClass = sClass->base)
13642 id += sClass->templateParams.count;
13643 arg = expClass->templateArgs[id];
13644 for(sClass = _class; sClass; sClass = sClass->base)
13645 {
13646 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
13647 int p = 0;
13648 struct __ecereNameSpace__ecere__com__Class * nextClass;
13649
13650 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
13651 p += nextClass->templateParams.count;
13652 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
13653 {
13654 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
13655 {
13656 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13657 {
13658 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
13659 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
13660 break;
13661 }
13662 }
13663 }
13664 }
13665 {
13666 char argument[256];
13667
13668 argument[0] = '\0';
13669 switch(param->type)
13670 {
13671 case 2:
13672 {
13673 char expString[1024];
13674 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13675 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
13676 struct Expression * exp;
13677 char * string = PrintHexUInt64(arg.expression.ui64);
13678
13679 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
13680 ProcessExpressionType(exp);
13681 ComputeExpression(exp);
13682 expString[0] = '\0';
13683 PrintExpression(exp, expString);
13684 strcat(argument, expString);
13685 FreeExpression(exp);
13686 break;
13687 }
13688 case 1:
13689 {
13690 strcat(argument, arg.member->name);
13691 break;
13692 }
13693 case 0:
13694 {
13695 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
13696 {
13697 if(!strcmp(arg.dataTypeString, "thisclass"))
13698 strcat(argument, thisClassTypeString);
13699 else
13700 strcat(argument, arg.dataTypeString);
13701 }
13702 break;
13703 }
13704 }
13705 if(argument[0])
13706 {
13707 if(paramCount)
13708 strcat(templateString, ", ");
13709 if(lastParam != p - 1)
13710 {
13711 strcat(templateString, param->name);
13712 strcat(templateString, " = ");
13713 }
13714 strcat(templateString, argument);
13715 paramCount++;
13716 lastParam = p;
13717 }
13718 p++;
13719 }
13720 }
13721 }
13722 {
13723 int len = strlen(templateString);
13724
13725 if(templateString[len - 1] == '>')
13726 templateString[len++] = ' ';
13727 templateString[len++] = '>';
13728 templateString[len++] = '\0';
13729 }
13730 {
13731 struct Context * context = SetupTemplatesContext(_class);
13732
13733 FreeType(exp->expType);
13734 exp->expType = ProcessTypeString(templateString, 0x0);
13735 FinishTemplatesContext(context);
13736 }
13737 }
13738 exp->type = 5;
13739 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")))))))));
13740 }
13741 }
13742 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
13743 {
13744 type = ProcessTemplateParameterType(type->templateParameter);
13745 }
13746 }
13747 if(type && (type->kind == 20))
13748 ;
13749 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
13750 {
13751 struct Identifier * id = exp->member.member;
13752 int typeKind = type->kind;
13753 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));
13754
13755 if(typeKind == 19 && exp->member.exp->type == 26)
13756 {
13757 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
13758 typeKind = 8;
13759 }
13760 if(id && (typeKind == 3 || typeKind == 15))
13761 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
13762 if(_class && id)
13763 {
13764 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13765 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13766 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13767 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
13768 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13769
13770 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
13771 exp->member.memberType = 1;
13772 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
13773 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
13774 if(typeKind != 19)
13775 {
13776 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
13777 {
13778 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13779 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
13780 {
13781 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13782 if(prop)
13783 member = (((void *)0));
13784 }
13785 if(!member && !prop)
13786 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13787 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
13788 exp->member.thisPtr = 0x1;
13789 }
13790 else
13791 {
13792 if(!id->classSym)
13793 {
13794 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
13795 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13796 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
13797 }
13798 if(!prop && !member)
13799 {
13800 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
13801 if(!method)
13802 {
13803 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
13804 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
13805 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
13806 }
13807 }
13808 if(member && prop)
13809 {
13810 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
13811 prop = (((void *)0));
13812 else
13813 member = (((void *)0));
13814 }
13815 }
13816 }
13817 if(!prop && !member)
13818 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
13819 if(!prop && !member && !method)
13820 {
13821 if(typeKind == 19)
13822 {
13823 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
13824 if(classProp)
13825 {
13826 exp->member.memberType = 5;
13827 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
13828 }
13829 else
13830 {
13831 char structName[1024];
13832 struct Identifier * id = exp->member.member;
13833 struct Expression * classExp = exp->member.exp;
13834
13835 type->refCount++;
13836 FreeType(classExp->expType);
13837 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
13838 strcpy(structName, "__ecereClassData_");
13839 FullClassNameCat(structName, type->_class->string, 0x0);
13840 exp->type = 9;
13841 exp->member.member = id;
13842 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"))))))));
13843 FreeType(type);
13844 ProcessExpressionType(exp);
13845 return ;
13846 }
13847 }
13848 else
13849 {
13850 struct Symbol * classSym = FindClass(id->string);
13851
13852 if(classSym)
13853 {
13854 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
13855
13856 if(convertClass)
13857 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
13858 }
13859 }
13860 }
13861 if(prop)
13862 {
13863 exp->member.memberType = 1;
13864 if(!prop->dataType)
13865 ProcessPropertyType(prop);
13866 exp->expType = prop->dataType;
13867 if(prop->dataType)
13868 prop->dataType->refCount++;
13869 }
13870 else if(member)
13871 {
13872 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13873 {
13874 FreeExpContents(exp);
13875 exp->type = 0;
13876 exp->identifier = MkIdentifier("class");
13877 ProcessExpressionType(exp);
13878 return ;
13879 }
13880 exp->member.memberType = 3;
13881 DeclareStruct(_class->fullName, 0x0);
13882 if(!member->dataType)
13883 {
13884 struct Context * context = SetupTemplatesContext(_class);
13885
13886 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13887 FinishTemplatesContext(context);
13888 }
13889 exp->expType = member->dataType;
13890 if(member->dataType)
13891 member->dataType->refCount++;
13892 }
13893 else if(revConvert)
13894 {
13895 exp->member.memberType = 4;
13896 exp->expType = MkClassType(revConvert->_class->fullName);
13897 }
13898 else if(method)
13899 {
13900 if(inCompiler)
13901 {
13902 exp->member.memberType = 2;
13903 }
13904 if(!method->dataType)
13905 ProcessMethodType(method);
13906 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 16, ((struct Type *)__ecereTemp1)->method = method, ((struct Type *)__ecereTemp1));
13907 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
13908 exp->expType->usedClass = _class;
13909 }
13910 else if(!classProp)
13911 {
13912 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
13913 {
13914 FreeExpContents(exp);
13915 exp->type = 0;
13916 exp->identifier = MkIdentifier("class");
13917 ProcessExpressionType(exp);
13918 return ;
13919 }
13920 yylloc = exp->member.member->loc;
13921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
13922 if(inCompiler)
13923 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
13924 }
13925 if(_class && exp->expType)
13926 {
13927 struct __ecereNameSpace__ecere__com__Class * tClass;
13928
13929 tClass = _class;
13930 while(tClass && !tClass->templateClass)
13931 tClass = tClass->base;
13932 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
13933 {
13934 int id = 0;
13935 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13936 struct __ecereNameSpace__ecere__com__Class * sClass;
13937
13938 for(sClass = tClass; sClass; sClass = sClass->base)
13939 {
13940 id = 0;
13941 if(sClass->templateClass)
13942 sClass = sClass->templateClass;
13943 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13944 {
13945 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
13946 {
13947 for(sClass = sClass->base; sClass; sClass = sClass->base)
13948 id += sClass->templateParams.count;
13949 break;
13950 }
13951 id++;
13952 }
13953 if(curParam)
13954 break;
13955 }
13956 if(curParam && tClass->templateArgs[id].dataTypeString)
13957 {
13958 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
13959 struct Context * context = SetupTemplatesContext(tClass);
13960
13961 FreeType(exp->expType);
13962 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
13963 if(exp->expType)
13964 {
13965 if(exp->expType->kind == 21)
13966 {
13967 FreeType(exp->expType);
13968 exp->expType = ReplaceThisClassType(_class);
13969 }
13970 if(tClass->templateClass)
13971 exp->expType->passAsTemplate = 0x1;
13972 if(!exp->destType)
13973 {
13974 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
13975 if(exp->destType->kind == 21)
13976 {
13977 FreeType(exp->destType);
13978 exp->destType = ReplaceThisClassType(_class);
13979 }
13980 }
13981 }
13982 FinishTemplatesContext(context);
13983 }
13984 }
13985 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
13986 {
13987 int id = 0;
13988 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
13989 struct __ecereNameSpace__ecere__com__Class * sClass;
13990
13991 for(sClass = tClass; sClass; sClass = sClass->base)
13992 {
13993 id = 0;
13994 if(sClass->templateClass)
13995 sClass = sClass->templateClass;
13996 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
13997 {
13998 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
13999 {
14000 for(sClass = sClass->base; sClass; sClass = sClass->base)
14001 id += sClass->templateParams.count;
14002 break;
14003 }
14004 id++;
14005 }
14006 if(curParam)
14007 break;
14008 }
14009 if(curParam)
14010 {
14011 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
14012 struct Context * context = SetupTemplatesContext(tClass);
14013 struct Type * basicType;
14014
14015 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
14016 if(basicType)
14017 {
14018 if(basicType->kind == 21)
14019 {
14020 FreeType(basicType);
14021 basicType = ReplaceThisClassType(_class);
14022 }
14023 FreeType(exp->expType);
14024 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 13, ((struct Type *)__ecereTemp1)->type = basicType, ((struct Type *)__ecereTemp1));
14025 if(!exp->destType)
14026 {
14027 exp->destType = exp->expType;
14028 exp->destType->refCount++;
14029 }
14030 {
14031 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14032 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14033 struct Declarator * decl;
14034
14035 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
14036 *newExp = *exp;
14037 if(exp->destType)
14038 exp->destType->refCount++;
14039 if(exp->expType)
14040 exp->expType->refCount++;
14041 exp->type = 11;
14042 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
14043 exp->cast.exp = newExp;
14044 }
14045 }
14046 FinishTemplatesContext(context);
14047 }
14048 }
14049 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
14050 {
14051 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
14052
14053 if(expClass)
14054 {
14055 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
14056 int c;
14057 int p = 0;
14058 int paramCount = 0;
14059 int lastParam = -1;
14060 char templateString[1024];
14061 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
14062
14063 sprintf(templateString, "%s<", expClass->templateClass->fullName);
14064 while(cClass != expClass)
14065 {
14066 struct __ecereNameSpace__ecere__com__Class * sClass;
14067
14068 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
14069 ;
14070 cClass = sClass;
14071 for(param = cClass->templateParams.first; param; param = param->next)
14072 {
14073 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
14074 int c;
14075 int cp = 0;
14076 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
14077 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
14078
14079 while(cClassCur != tClass && !paramCur)
14080 {
14081 struct __ecereNameSpace__ecere__com__Class * sClassCur;
14082
14083 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
14084 ;
14085 cClassCur = sClassCur;
14086 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
14087 {
14088 if(!strcmp(paramCur->name, param->name))
14089 {
14090 break;
14091 }
14092 cp++;
14093 }
14094 }
14095 if(paramCur && paramCur->type == 0)
14096 arg = tClass->templateArgs[cp];
14097 else
14098 arg = expClass->templateArgs[p];
14099 {
14100 char argument[256];
14101
14102 argument[0] = '\0';
14103 switch(param->type)
14104 {
14105 case 2:
14106 {
14107 char expString[1024];
14108 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14109 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
14110 struct Expression * exp;
14111 char * string = PrintHexUInt64(arg.expression.ui64);
14112
14113 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
14114 ProcessExpressionType(exp);
14115 ComputeExpression(exp);
14116 expString[0] = '\0';
14117 PrintExpression(exp, expString);
14118 strcat(argument, expString);
14119 FreeExpression(exp);
14120 break;
14121 }
14122 case 1:
14123 {
14124 strcat(argument, arg.member->name);
14125 break;
14126 }
14127 case 0:
14128 {
14129 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
14130 strcat(argument, arg.dataTypeString);
14131 break;
14132 }
14133 }
14134 if(argument[0])
14135 {
14136 if(paramCount)
14137 strcat(templateString, ", ");
14138 if(lastParam != p - 1)
14139 {
14140 strcat(templateString, param->name);
14141 strcat(templateString, " = ");
14142 }
14143 strcat(templateString, argument);
14144 paramCount++;
14145 lastParam = p;
14146 }
14147 }
14148 p++;
14149 }
14150 }
14151 {
14152 int len = strlen(templateString);
14153
14154 if(templateString[len - 1] == '>')
14155 templateString[len++] = ' ';
14156 templateString[len++] = '>';
14157 templateString[len++] = '\0';
14158 }
14159 FreeType(exp->expType);
14160 {
14161 struct Context * context = SetupTemplatesContext(tClass);
14162
14163 exp->expType = ProcessTypeString(templateString, 0x0);
14164 FinishTemplatesContext(context);
14165 }
14166 }
14167 }
14168 }
14169 }
14170 else
14171 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)");
14172 }
14173 else if(type && (type->kind == 9 || type->kind == 10))
14174 {
14175 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
14176
14177 if(memberType)
14178 {
14179 exp->expType = memberType;
14180 if(memberType)
14181 memberType->refCount++;
14182 }
14183 }
14184 else
14185 {
14186 char expString[10240];
14187
14188 expString[0] = '\0';
14189 if(inCompiler)
14190 {
14191 PrintExpression(exp, expString);
14192 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14193 }
14194 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "member operator on non-structure type expression %s\n", (((void *)0))), expString);
14195 }
14196 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
14197 {
14198 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
14199 {
14200 struct Identifier * id = exp->member.member;
14201 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));
14202
14203 if(_class)
14204 {
14205 FreeType(exp->expType);
14206 exp->expType = ReplaceThisClassType(_class);
14207 }
14208 }
14209 }
14210 yylloc = oldyylloc;
14211 break;
14212 }
14213 case 9:
14214 {
14215 struct Type * destType = exp->destType;
14216
14217 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
14218 {
14219 exp->member.member->classSym = exp->member.member->_class->symbol;
14220 }
14221 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
14222 exp->type = 8;
14223 if(destType)
14224 destType->count++;
14225 ProcessExpressionType(exp);
14226 if(destType)
14227 destType->count--;
14228 break;
14229 }
14230 case 15:
14231 {
14232 struct Symbol * classSym = exp->_class->symbol;
14233
14234 if(classSym && classSym->registered)
14235 {
14236 if(classSym->registered->type == 5)
14237 {
14238 char name[1024];
14239
14240 name[0] = '\0';
14241 DeclareStruct(classSym->string, 0x0);
14242 FreeSpecifier(exp->_class);
14243 exp->type = 10;
14244 FullClassNameCat(name, classSym->string, 0x0);
14245 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
14246 }
14247 else
14248 {
14249 if(classSym->registered->fixed)
14250 {
14251 FreeSpecifier(exp->_class);
14252 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
14253 exp->type = 2;
14254 }
14255 else
14256 {
14257 char className[1024];
14258
14259 strcpy(className, "__ecereClass_");
14260 FullClassNameCat(className, classSym->string, 0x1);
14261 MangleClassName(className);
14262 DeclareClass(classSym, className);
14263 FreeExpContents(exp);
14264 exp->type = 9;
14265 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
14266 exp->member.member = MkIdentifier("structSize");
14267 }
14268 }
14269 }
14270 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14271 break;
14272 }
14273 case 10:
14274 {
14275 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
14276
14277 exp->expType = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 3, ((struct Type *)__ecereTemp1));
14278 exp->isConstant = 0x1;
14279 DeclareType(type, 0x0, 0x0);
14280 FreeType(type);
14281 break;
14282 }
14283 case 11:
14284 {
14285 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
14286
14287 type->count = (unsigned int)1;
14288 FreeType(exp->cast.exp->destType);
14289 exp->cast.exp->destType = type;
14290 type->refCount++;
14291 ProcessExpressionType(exp->cast.exp);
14292 type->count = (unsigned int)0;
14293 exp->expType = type;
14294 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
14295 {
14296 void * prev = exp->prev, * next = exp->next;
14297 struct Type * expType = exp->cast.exp->destType;
14298 struct Expression * castExp = exp->cast.exp;
14299 struct Type * destType = exp->destType;
14300
14301 if(expType)
14302 expType->refCount++;
14303 FreeType(exp->expType);
14304 FreeTypeName(exp->cast.typeName);
14305 *exp = *castExp;
14306 FreeType(exp->expType);
14307 FreeType(exp->destType);
14308 exp->expType = expType;
14309 exp->destType = destType;
14310 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
14311 exp->prev = prev;
14312 exp->next = next;
14313 }
14314 else
14315 {
14316 exp->isConstant = exp->cast.exp->isConstant;
14317 }
14318 break;
14319 }
14320 case 35:
14321 {
14322 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
14323
14324 type->refCount++;
14325 exp->expType = type;
14326 break;
14327 }
14328 case 36:
14329 {
14330 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
14331
14332 ProcessExpressionType(exp->vaArg.exp);
14333 type->refCount++;
14334 exp->expType = type;
14335 break;
14336 }
14337 case 12:
14338 {
14339 struct Expression * e;
14340
14341 exp->isConstant = 0x1;
14342 FreeType(exp->cond.cond->destType);
14343 exp->cond.cond->destType = MkClassType("bool");
14344 exp->cond.cond->destType->truth = 0x1;
14345 ProcessExpressionType(exp->cond.cond);
14346 if(!exp->cond.cond->isConstant)
14347 exp->isConstant = 0x0;
14348 for(e = (*exp->cond.exp).first; e; e = e->next)
14349 {
14350 if(!e->next)
14351 {
14352 FreeType(e->destType);
14353 e->destType = exp->destType;
14354 if(e->destType)
14355 e->destType->refCount++;
14356 }
14357 ProcessExpressionType(e);
14358 if(!e->next)
14359 {
14360 exp->expType = e->expType;
14361 if(e->expType)
14362 e->expType->refCount++;
14363 }
14364 if(!e->isConstant)
14365 exp->isConstant = 0x0;
14366 }
14367 FreeType(exp->cond.elseExp->destType);
14368 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
14369 if(exp->cond.elseExp->destType)
14370 exp->cond.elseExp->destType->refCount++;
14371 ProcessExpressionType(exp->cond.elseExp);
14372 if(!exp->cond.elseExp->isConstant)
14373 exp->isConstant = 0x0;
14374 break;
14375 }
14376 case 25:
14377 {
14378 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
14379 {
14380 struct Statement * last = (*exp->compound->compound.statements).last;
14381
14382 if(last->type == 3 && last->expressions && (*last->expressions).last)
14383 {
14384 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
14385 if(exp->destType)
14386 exp->destType->refCount++;
14387 }
14388 ProcessStatement(exp->compound);
14389 exp->expType = ((struct Expression *)(*last->expressions).last)->expType;
14390 if(((struct Expression *)(*last->expressions).last)->expType)
14391 exp->expType->refCount++;
14392 }
14393 break;
14394 }
14395 case 26:
14396 {
14397 struct Specifier * spec = (*exp->_classExp.specifiers).first;
14398
14399 if(spec && spec->type == 1)
14400 {
14401 exp->expType = MkClassType(spec->name);
14402 exp->expType->kind = 19;
14403 exp->byReference = 0x1;
14404 }
14405 else
14406 {
14407 exp->expType = MkClassType("ecere::com::Class");
14408 exp->byReference = 0x1;
14409 }
14410 break;
14411 }
14412 case 27:
14413 {
14414 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
14415
14416 if(_class)
14417 {
14418 struct Identifier * id = exp->classData.id;
14419 char structName[1024];
14420 struct Expression * classExp;
14421
14422 strcpy(structName, "__ecereClassData_");
14423 FullClassNameCat(structName, _class->fullName, 0x0);
14424 exp->type = 9;
14425 exp->member.member = id;
14426 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
14427 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
14428 else
14429 classExp = MkExpIdentifier(MkIdentifier("class"));
14430 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"))))))));
14431 ProcessExpressionType(exp);
14432 return ;
14433 }
14434 break;
14435 }
14436 case 37:
14437 {
14438 struct Type * type = (((void *)0));
14439 char * typeString = (((void *)0));
14440 char typeStringBuf[1024];
14441
14442 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))
14443 {
14444 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
14445
14446 typeString = templateClass->templateArgs[2].dataTypeString;
14447 }
14448 else if(exp->list)
14449 {
14450 struct Expression * e;
14451
14452 for(e = (*exp->list).first; e; e = e->next)
14453 {
14454 ProcessExpressionType(e);
14455 if(e->expType)
14456 {
14457 if(!type)
14458 {
14459 type = e->expType;
14460 type->refCount++;
14461 }
14462 else
14463 {
14464 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14465 {
14466 FreeType(type);
14467 type = e->expType;
14468 e->expType = (((void *)0));
14469 e = (*exp->list).first;
14470 ProcessExpressionType(e);
14471 if(e->expType)
14472 {
14473 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
14474 {
14475 FreeType(e->expType);
14476 e->expType = (((void *)0));
14477 FreeType(type);
14478 type = (((void *)0));
14479 break;
14480 }
14481 }
14482 }
14483 }
14484 if(e->expType)
14485 {
14486 FreeType(e->expType);
14487 e->expType = (((void *)0));
14488 }
14489 }
14490 }
14491 if(type)
14492 {
14493 typeStringBuf[0] = '\0';
14494 PrintType(type, typeStringBuf, 0x0, 0x1);
14495 typeString = typeStringBuf;
14496 FreeType(type);
14497 type = (((void *)0));
14498 }
14499 }
14500 if(typeString)
14501 {
14502 char templateString[1024];
14503 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
14504 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
14505 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14506 struct Expression * expExt;
14507 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14508
14509 sprintf(templateString, "Container<%s>", typeString);
14510 if(exp->list)
14511 {
14512 struct Expression * e;
14513
14514 type = ProcessTypeString(typeString, 0x0);
14515 while(e = (*exp->list).first)
14516 {
14517 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
14518 e->destType = type;
14519 type->refCount++;
14520 ProcessExpressionType(e);
14521 ListAdd(initializers, MkInitializerAssignment(e));
14522 }
14523 FreeType(type);
14524 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
14525 }
14526 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
14527 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
14528 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14529 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
14530 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14531 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
14532 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14533 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
14534 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14535 ListAdd(structInitializers, MkInitializerAssignment((__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression), ((struct Expression *)__ecereTemp1)->type = 2, ((struct Expression *)__ecereTemp1)->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), ((struct Expression *)__ecereTemp1))));
14536 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14537 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
14538 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
14539 exp->expType = ProcessTypeString(templateString, 0x0);
14540 exp->type = 5;
14541 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
14542 ProcessExpressionType(expExt);
14543 }
14544 else
14545 {
14546 exp->expType = ProcessTypeString("Container", 0x0);
14547 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
14548 }
14549 break;
14550 }
14551 }
14552 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
14553 {
14554 FreeType(exp->expType);
14555 exp->expType = ReplaceThisClassType(thisClass);
14556 }
14557 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
14558 {
14559 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
14560
14561 if(symbol)
14562 {
14563 if(exp->expType->kind != 15)
14564 {
14565 struct Type * member;
14566 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
14567
14568 FreeType(exp->expType);
14569 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14570 exp->expType->kind = symbol->type->kind;
14571 exp->expType->refCount++;
14572 exp->expType->enumName = enumName;
14573 exp->expType->members = symbol->type->members;
14574 for(member = symbol->type->members.first; member; member = member->next)
14575 member->refCount++;
14576 }
14577 else
14578 {
14579 struct __ecereNameSpace__ecere__sys__NamedLink * member;
14580
14581 for(member = symbol->type->members.first; member; member = member->next)
14582 {
14583 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(16), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
14584
14585 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
14586 }
14587 }
14588 }
14589 }
14590 yylloc = exp->loc;
14591 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
14592 ;
14593 else if(exp->destType && !exp->destType->keepCast)
14594 {
14595 if(!CheckExpressionType(exp, exp->destType, 0x0))
14596 {
14597 if(!exp->destType->count || unresolved)
14598 {
14599 if(!exp->expType)
14600 {
14601 yylloc = exp->loc;
14602 if(exp->destType->kind != 14)
14603 {
14604 char type2[1024];
14605
14606 type2[0] = '\0';
14607 if(inCompiler)
14608 {
14609 char expString[10240];
14610
14611 expString[0] = '\0';
14612 PrintType(exp->destType, type2, 0x0, 0x1);
14613 if(inCompiler)
14614 {
14615 PrintExpression(exp, expString);
14616 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14617 }
14618 if(unresolved)
14619 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
14620 else if(exp->type != 16)
14621 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
14622 }
14623 }
14624 else
14625 {
14626 char expString[10240];
14627
14628 expString[0] = '\0';
14629 if(inCompiler)
14630 {
14631 PrintExpression(exp, expString);
14632 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14633 }
14634 if(unresolved)
14635 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), expString);
14636 else if(exp->type != 16)
14637 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14638 }
14639 }
14640 else
14641 {
14642 char type1[1024];
14643 char type2[1024];
14644
14645 type1[0] = '\0';
14646 type2[0] = '\0';
14647 if(inCompiler)
14648 {
14649 PrintType(exp->expType, type1, 0x0, 0x1);
14650 PrintType(exp->destType, type2, 0x0, 0x1);
14651 }
14652 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)))
14653 ;
14654 else
14655 {
14656 char expString[10240];
14657
14658 expString[0] = '\0';
14659 if(inCompiler)
14660 {
14661 PrintExpression(exp, expString);
14662 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14663 }
14664 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
14665 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
14666 FreeType(exp->expType);
14667 exp->destType->refCount++;
14668 exp->expType = exp->destType;
14669 }
14670 }
14671 }
14672 }
14673 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
14674 {
14675 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
14676 char typeString[1024];
14677 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
14678 struct Declarator * decl;
14679
14680 typeString[0] = '\0';
14681 *newExp = *exp;
14682 if(exp->expType)
14683 exp->expType->refCount++;
14684 if(exp->expType)
14685 exp->expType->refCount++;
14686 exp->type = 11;
14687 newExp->destType = exp->expType;
14688 PrintType(exp->expType, typeString, 0x0, 0x0);
14689 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
14690 exp->cast.typeName = MkTypeName(specs, decl);
14691 exp->cast.exp = newExp;
14692 }
14693 }
14694 else if(unresolved)
14695 {
14696 if(exp->identifier->_class && exp->identifier->_class->name)
14697 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
14698 else if(exp->identifier->string && exp->identifier->string[0])
14699 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
14700 }
14701 else if(!exp->expType && exp->type != 16)
14702 {
14703 char expString[10240];
14704
14705 expString[0] = '\0';
14706 if(inCompiler)
14707 {
14708 PrintExpression(exp, expString);
14709 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14710 }
14711 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "couldn't determine type of %s\n", (((void *)0))), expString);
14712 }
14713 ApplyAnyObjectLogic(exp);
14714 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5)
14715 {
14716 exp->byReference = 0x1;
14717 }
14718 yylloc = oldyylloc;
14719 }
14720
14721 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)
14722 {
14723 if(*curMember)
14724 {
14725 *curMember = (*curMember)->next;
14726 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
14727 {
14728 *curMember = subMemberStack[--(*subMemberStackPos)];
14729 *curMember = (*curMember)->next;
14730 }
14731 while((*curMember) && (*curMember)->isProperty)
14732 *curMember = (*curMember)->next;
14733 if(subMemberStackPos)
14734 {
14735 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14736 {
14737 subMemberStack[(*subMemberStackPos)++] = *curMember;
14738 *curMember = (*curMember)->members.first;
14739 while(*curMember && (*curMember)->isProperty)
14740 *curMember = (*curMember)->next;
14741 }
14742 }
14743 }
14744 while(!*curMember)
14745 {
14746 if(!*curMember)
14747 {
14748 if(subMemberStackPos && *subMemberStackPos)
14749 {
14750 *curMember = subMemberStack[--(*subMemberStackPos)];
14751 *curMember = (*curMember)->next;
14752 }
14753 else
14754 {
14755 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
14756
14757 if(*curClass == _class)
14758 break;
14759 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
14760 ;
14761 *curMember = (*curClass)->membersAndProperties.first;
14762 }
14763 while((*curMember) && (*curMember)->isProperty)
14764 *curMember = (*curMember)->next;
14765 if(subMemberStackPos)
14766 {
14767 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
14768 {
14769 subMemberStack[(*subMemberStackPos)++] = *curMember;
14770 *curMember = (*curMember)->members.first;
14771 while(*curMember && (*curMember)->isProperty)
14772 *curMember = (*curMember)->next;
14773 }
14774 }
14775 }
14776 }
14777 }
14778
14779 static void ProcessInitializer(struct Initializer * init, struct Type * type)
14780 {
14781 switch(init->type)
14782 {
14783 case 0:
14784 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
14785 {
14786 if(init->exp && !init->exp->destType)
14787 {
14788 FreeType(init->exp->destType);
14789 init->exp->destType = type;
14790 if(type)
14791 type->refCount++;
14792 }
14793 if(init->exp)
14794 {
14795 ProcessExpressionType(init->exp);
14796 init->isConstant = init->exp->isConstant;
14797 }
14798 break;
14799 }
14800 else
14801 {
14802 struct Expression * exp = init->exp;
14803 struct Instantiation * inst = exp->instance;
14804 struct MembersInit * members;
14805
14806 init->type = 1;
14807 init->list = MkList();
14808 if(inst->members)
14809 {
14810 for(members = (*inst->members).first; members; members = members->next)
14811 {
14812 if(members->type == 0)
14813 {
14814 struct MemberInit * member;
14815
14816 for(member = (*members->dataMembers).first; member; member = member->next)
14817 {
14818 ListAdd(init->list, member->initializer);
14819 member->initializer = (((void *)0));
14820 }
14821 }
14822 }
14823 }
14824 FreeExpression(exp);
14825 }
14826 case 1:
14827 {
14828 struct Initializer * i;
14829 struct Type * initializerType = (((void *)0));
14830 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
14831 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
14832 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
14833 int subMemberStackPos = 0;
14834
14835 if(type && type->kind == 12)
14836 initializerType = Dereference(type);
14837 else if(type && (type->kind == 9 || type->kind == 10))
14838 initializerType = type->members.first;
14839 for(i = (*init->list).first; i; i = i->next)
14840 {
14841 if(type && type->kind == 8 && type->_class && type->_class->registered)
14842 {
14843 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
14844 if(curMember)
14845 {
14846 if(!curMember->dataType)
14847 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
14848 initializerType = curMember->dataType;
14849 }
14850 }
14851 ProcessInitializer(i, initializerType);
14852 if(initializerType && type && (type->kind == 9 || type->kind == 10))
14853 initializerType = initializerType->next;
14854 if(!i->isConstant)
14855 init->isConstant = 0x0;
14856 }
14857 if(type && type->kind == 12)
14858 FreeType(initializerType);
14859 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
14860 {
14861 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Assigning list initializer to non list\n", (((void *)0))));
14862 }
14863 break;
14864 }
14865 }
14866 }
14867
14868 extern struct Symbol * FindType(struct Context * ctx, char *  name);
14869
14870 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
14871
14872 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
14873 {
14874 switch(spec->type)
14875 {
14876 case 0:
14877 {
14878 if(spec->specifier == THISCLASS)
14879 {
14880 if(thisClass)
14881 {
14882 spec->type = 1;
14883 spec->name = ReplaceThisClass(thisClass);
14884 spec->symbol = FindClass(spec->name);
14885 ProcessSpecifier(spec, declareStruct);
14886 }
14887 }
14888 break;
14889 }
14890 case 1:
14891 {
14892 struct Symbol * symbol = FindType(curContext, spec->name);
14893
14894 if(symbol)
14895 DeclareType(symbol->type, 0x1, 0x1);
14896 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
14897 DeclareStruct(spec->name, 0x0);
14898 break;
14899 }
14900 case 2:
14901 {
14902 struct Enumerator * e;
14903
14904 if(spec->list)
14905 {
14906 for(e = (*spec->list).first; e; e = e->next)
14907 {
14908 if(e->exp)
14909 ProcessExpressionType(e->exp);
14910 }
14911 }
14912 break;
14913 }
14914 case 3:
14915 case 4:
14916 {
14917 if(spec->definitions)
14918 {
14919 struct ClassDef * def;
14920 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
14921
14922 ProcessClass(spec->definitions, symbol);
14923 }
14924 break;
14925 }
14926 }
14927 }
14928
14929 static void ProcessDeclarator(struct Declarator * decl)
14930 {
14931 switch(decl->type)
14932 {
14933 case 1:
14934 if(decl->identifier->classSym)
14935 {
14936 FreeSpecifier(decl->identifier->_class);
14937 decl->identifier->_class = (((void *)0));
14938 }
14939 break;
14940 case 3:
14941 if(decl->array.exp)
14942 ProcessExpressionType(decl->array.exp);
14943 case 0:
14944 case 2:
14945 case 4:
14946 case 5:
14947 case 6:
14948 case 7:
14949 if(decl->declarator)
14950 ProcessDeclarator(decl->declarator);
14951 if(decl->type == 4)
14952 {
14953 struct Identifier * id = GetDeclId(decl);
14954
14955 if(id && id->_class)
14956 {
14957 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
14958
14959 if(!decl->function.parameters)
14960 decl->function.parameters = MkList();
14961 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
14962 id->_class = (((void *)0));
14963 }
14964 if(decl->function.parameters)
14965 {
14966 struct TypeName * param;
14967
14968 for(param = (*decl->function.parameters).first; param; param = param->next)
14969 {
14970 if(param->qualifiers && (*param->qualifiers).first)
14971 {
14972 struct Specifier * spec = (*param->qualifiers).first;
14973
14974 if(spec && spec->specifier == TYPED_OBJECT)
14975 {
14976 struct Declarator * d = param->declarator;
14977 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);
14978
14979 FreeList(param->qualifiers, FreeSpecifier);
14980 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
14981 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
14982 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
14983 param = newParam;
14984 }
14985 else if(spec && spec->specifier == ANY_OBJECT)
14986 {
14987 struct Declarator * d = param->declarator;
14988
14989 FreeList(param->qualifiers, FreeSpecifier);
14990 param->qualifiers = MkListOne(MkSpecifier(VOID));
14991 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
14992 }
14993 else if(spec->specifier == THISCLASS)
14994 {
14995 if(thisClass)
14996 {
14997 spec->type = 1;
14998 spec->name = ReplaceThisClass(thisClass);
14999 spec->symbol = FindClass(spec->name);
15000 ProcessSpecifier(spec, 0x0);
15001 }
15002 }
15003 }
15004 if(param->declarator)
15005 ProcessDeclarator(param->declarator);
15006 }
15007 }
15008 }
15009 break;
15010 }
15011 }
15012
15013 extern struct Identifier * CopyIdentifier(struct Identifier * id);
15014
15015 extern void FreeInitDeclarator(struct InitDeclarator * decl);
15016
15017 static void ProcessDeclaration(struct Declaration * decl)
15018 {
15019 yylloc = decl->loc;
15020 switch(decl->type)
15021 {
15022 case 1:
15023 {
15024 unsigned int declareStruct = 0x0;
15025
15026 if(decl->declarators)
15027 {
15028 struct InitDeclarator * d;
15029
15030 for(d = (*decl->declarators).first; d; d = d->next)
15031 {
15032 struct Type * type, * subType;
15033
15034 ProcessDeclarator(d->declarator);
15035 type = ProcessType(decl->specifiers, d->declarator);
15036 if(d->initializer)
15037 {
15038 ProcessInitializer(d->initializer, type);
15039 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
15040 {
15041 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
15042 {
15043 struct Instantiation * inst = d->initializer->exp->instance;
15044
15045 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
15046 d->initializer->exp->instance = (((void *)0));
15047 if(decl->specifiers)
15048 FreeList(decl->specifiers, FreeSpecifier);
15049 FreeList(decl->declarators, FreeInitDeclarator);
15050 d = (((void *)0));
15051 decl->type = 2;
15052 decl->inst = inst;
15053 }
15054 }
15055 }
15056 for(subType = type; subType; )
15057 {
15058 if(subType->kind == 8)
15059 {
15060 declareStruct = 0x1;
15061 break;
15062 }
15063 else if(subType->kind == 13)
15064 break;
15065 else if(subType->kind == 12)
15066 subType = subType->arrayType;
15067 else
15068 break;
15069 }
15070 FreeType(type);
15071 if(!d)
15072 break;
15073 }
15074 }
15075 if(decl->specifiers)
15076 {
15077 struct Specifier * s;
15078
15079 for(s = (*decl->specifiers).first; s; s = s->next)
15080 {
15081 ProcessSpecifier(s, declareStruct);
15082 }
15083 }
15084 break;
15085 }
15086 case 2:
15087 {
15088 ProcessInstantiationType(decl->inst);
15089 break;
15090 }
15091 case 0:
15092 {
15093 struct Specifier * spec;
15094 struct Declarator * d;
15095 unsigned int declareStruct = 0x0;
15096
15097 if(decl->declarators)
15098 {
15099 for(d = (*decl->declarators).first; d; d = d->next)
15100 {
15101 struct Type * type = ProcessType(decl->specifiers, d->declarator);
15102 struct Type * subType;
15103
15104 ProcessDeclarator(d);
15105 for(subType = type; subType; )
15106 {
15107 if(subType->kind == 8)
15108 {
15109 declareStruct = 0x1;
15110 break;
15111 }
15112 else if(subType->kind == 13)
15113 break;
15114 else if(subType->kind == 12)
15115 subType = subType->arrayType;
15116 else
15117 break;
15118 }
15119 FreeType(type);
15120 }
15121 }
15122 if(decl->specifiers)
15123 {
15124 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
15125 ProcessSpecifier(spec, declareStruct);
15126 }
15127 break;
15128 }
15129 }
15130 }
15131
15132 static struct FunctionDefinition * curFunction;
15133
15134 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
15135 {
15136 char propName[1024], propNameM[1024];
15137 char getName[1024], setName[1024];
15138 struct __ecereNameSpace__ecere__sys__OldList * args;
15139
15140 DeclareProperty(prop, setName, getName);
15141 strcpy(propName, "__ecereProp_");
15142 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15143 strcat(propName, "_");
15144 FullClassNameCat(propName, prop->name, 0x1);
15145 MangleClassName(propName);
15146 strcpy(propNameM, "__ecerePropM_");
15147 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
15148 strcat(propNameM, "_");
15149 FullClassNameCat(propNameM, prop->name, 0x1);
15150 MangleClassName(propNameM);
15151 if(prop->isWatchable)
15152 {
15153 args = MkList();
15154 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15155 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15156 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15157 args = MkList();
15158 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15159 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15160 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
15161 }
15162 {
15163 args = MkList();
15164 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15165 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15166 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15167 args = MkList();
15168 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
15169 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
15170 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
15171 }
15172 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15173 curFunction->propSet->fireWatchersDone = 0x1;
15174 }
15175
15176 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
15177
15178 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
15179
15180 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
15181
15182 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
15183
15184 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
15185
15186 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
15187
15188 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
15189
15190 extern void FreePropertyWatch(struct PropertyWatch * watcher);
15191
15192 static void ProcessStatement(struct Statement * stmt)
15193 {
15194 yylloc = stmt->loc;
15195 switch(stmt->type)
15196 {
15197 case 0:
15198 ProcessStatement(stmt->labeled.stmt);
15199 break;
15200 case 1:
15201 if(stmt->caseStmt.exp)
15202 {
15203 FreeType(stmt->caseStmt.exp->destType);
15204 stmt->caseStmt.exp->destType = curSwitchType;
15205 if(curSwitchType)
15206 curSwitchType->refCount++;
15207 ProcessExpressionType(stmt->caseStmt.exp);
15208 ComputeExpression(stmt->caseStmt.exp);
15209 }
15210 if(stmt->caseStmt.stmt)
15211 ProcessStatement(stmt->caseStmt.stmt);
15212 break;
15213 case 2:
15214 {
15215 if(stmt->compound.context)
15216 {
15217 struct Declaration * decl;
15218 struct Statement * s;
15219 struct Statement * prevCompound = curCompound;
15220 struct Context * prevContext = curContext;
15221
15222 if(!stmt->compound.isSwitch)
15223 {
15224 curCompound = stmt;
15225 curContext = stmt->compound.context;
15226 }
15227 if(stmt->compound.declarations)
15228 {
15229 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
15230 ProcessDeclaration(decl);
15231 }
15232 if(stmt->compound.statements)
15233 {
15234 for(s = (*stmt->compound.statements).first; s; s = s->next)
15235 ProcessStatement(s);
15236 }
15237 curContext = prevContext;
15238 curCompound = prevCompound;
15239 }
15240 break;
15241 }
15242 case 3:
15243 {
15244 struct Expression * exp;
15245
15246 if(stmt->expressions)
15247 {
15248 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15249 ProcessExpressionType(exp);
15250 }
15251 break;
15252 }
15253 case 4:
15254 {
15255 struct Expression * exp;
15256
15257 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
15258 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
15259 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
15260 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
15261 {
15262 ProcessExpressionType(exp);
15263 }
15264 if(stmt->ifStmt.stmt)
15265 ProcessStatement(stmt->ifStmt.stmt);
15266 if(stmt->ifStmt.elseStmt)
15267 ProcessStatement(stmt->ifStmt.elseStmt);
15268 break;
15269 }
15270 case 5:
15271 {
15272 struct Type * oldSwitchType = curSwitchType;
15273
15274 if(stmt->switchStmt.exp)
15275 {
15276 struct Expression * exp;
15277
15278 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
15279 {
15280 if(!exp->next)
15281 {
15282 ProcessExpressionType(exp);
15283 }
15284 if(!exp->next)
15285 curSwitchType = exp->expType;
15286 }
15287 }
15288 ProcessStatement(stmt->switchStmt.stmt);
15289 curSwitchType = oldSwitchType;
15290 break;
15291 }
15292 case 6:
15293 {
15294 if(stmt->whileStmt.exp)
15295 {
15296 struct Expression * exp;
15297
15298 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
15299 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
15300 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
15301 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
15302 {
15303 ProcessExpressionType(exp);
15304 }
15305 }
15306 if(stmt->whileStmt.stmt)
15307 ProcessStatement(stmt->whileStmt.stmt);
15308 break;
15309 }
15310 case 7:
15311 {
15312 if(stmt->doWhile.exp)
15313 {
15314 struct Expression * exp;
15315
15316 if((*stmt->doWhile.exp).last)
15317 {
15318 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
15319 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
15320 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
15321 }
15322 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
15323 {
15324 ProcessExpressionType(exp);
15325 }
15326 }
15327 if(stmt->doWhile.stmt)
15328 ProcessStatement(stmt->doWhile.stmt);
15329 break;
15330 }
15331 case 8:
15332 {
15333 struct Expression * exp;
15334
15335 if(stmt->forStmt.init)
15336 ProcessStatement(stmt->forStmt.init);
15337 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
15338 {
15339 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
15340 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
15341 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
15342 }
15343 if(stmt->forStmt.check)
15344 ProcessStatement(stmt->forStmt.check);
15345 if(stmt->forStmt.increment)
15346 {
15347 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
15348 ProcessExpressionType(exp);
15349 }
15350 if(stmt->forStmt.stmt)
15351 ProcessStatement(stmt->forStmt.stmt);
15352 break;
15353 }
15354 case 18:
15355 {
15356 struct Identifier * id = stmt->forEachStmt.id;
15357 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
15358 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
15359 struct Statement * block = stmt->forEachStmt.stmt;
15360 char iteratorType[1024];
15361 struct Type * source;
15362 struct Expression * e;
15363 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));
15364 struct Expression * arrayExp;
15365 char * typeString = (((void *)0));
15366 int builtinCount = 0;
15367
15368 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
15369 {
15370 if(!e->next)
15371 {
15372 FreeType(e->destType);
15373 e->destType = ProcessTypeString("Container", 0x0);
15374 }
15375 if(!isBuiltin || e->next)
15376 ProcessExpressionType(e);
15377 }
15378 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
15379 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
15380 {
15381 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
15382 struct Symbol * symbol;
15383 struct Expression * expIt = (((void *)0));
15384 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
15385 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
15386 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
15387 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
15388
15389 stmt->type = 2;
15390 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
15391 stmt->compound.context->parent = curContext;
15392 curContext = stmt->compound.context;
15393 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
15394 {
15395 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
15396 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
15397
15398 isCustomAVLTree = 0x1;
15399 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
15400 isAVLTree = 0x1;
15401 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
15402 isMap = 0x1;
15403 }
15404 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
15405 isArray = 0x1;
15406 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
15407 {
15408 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
15409
15410 isLinkList = 0x1;
15411 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
15412 }
15413 if(isArray)
15414 {
15415 struct Declarator * decl;
15416 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15417
15418 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
15419 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15420 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
15421 }
15422 else if(isBuiltin)
15423 {
15424 struct Type * type = (((void *)0));
15425 char typeStringBuf[1024];
15426
15427 arrayExp = (((struct Expression *)(*exp).last)->type == 37) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
15428 if(((struct Expression *)(*exp).last)->type == 11)
15429 {
15430 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
15431
15432 if(typeName)
15433 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
15434 }
15435 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)
15436 {
15437 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
15438
15439 typeString = templateClass->templateArgs[2].dataTypeString;
15440 }
15441 else if(arrayExp->list)
15442 {
15443 struct Expression * e;
15444
15445 for(e = (*arrayExp->list).first; e; e = e->next)
15446 {
15447 ProcessExpressionType(e);
15448 if(e->expType)
15449 {
15450 if(!type)
15451 {
15452 type = e->expType;
15453 type->refCount++;
15454 }
15455 else
15456 {
15457 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15458 {
15459 FreeType(type);
15460 type = e->expType;
15461 e->expType = (((void *)0));
15462 e = (*arrayExp->list).first;
15463 ProcessExpressionType(e);
15464 if(e->expType)
15465 {
15466 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
15467 {
15468 FreeType(e->expType);
15469 e->expType = (((void *)0));
15470 FreeType(type);
15471 type = (((void *)0));
15472 break;
15473 }
15474 }
15475 }
15476 }
15477 if(e->expType)
15478 {
15479 FreeType(e->expType);
15480 e->expType = (((void *)0));
15481 }
15482 }
15483 }
15484 if(type)
15485 {
15486 typeStringBuf[0] = '\0';
15487 PrintType(type, typeStringBuf, 0x0, 0x1);
15488 typeString = typeStringBuf;
15489 FreeType(type);
15490 }
15491 }
15492 if(typeString)
15493 {
15494 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
15495 struct Declarator * decl;
15496 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15497
15498 if(arrayExp->list)
15499 {
15500 struct Expression * e;
15501
15502 builtinCount = (*arrayExp->list).count;
15503 type = ProcessTypeString(typeString, 0x0);
15504 while(e = (*arrayExp->list).first)
15505 {
15506 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
15507 e->destType = type;
15508 type->refCount++;
15509 ProcessExpressionType(e);
15510 ListAdd(initializers, MkInitializerAssignment(e));
15511 }
15512 FreeType(type);
15513 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
15514 }
15515 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
15516 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
15517 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers)))));
15518 FreeList(exp, FreeExpression);
15519 }
15520 else
15521 {
15522 arrayExp->expType = ProcessTypeString("Container", 0x0);
15523 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Couldn't determine type of array elements\n", (((void *)0))));
15524 }
15525 }
15526 else if(isLinkList && !isList)
15527 {
15528 struct Declarator * decl;
15529 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15530
15531 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
15532 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
15533 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
15534 }
15535 else if(_class->templateArgs)
15536 {
15537 if(isMap)
15538 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
15539 else
15540 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
15541 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
15542 }
15543 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
15544 if(block && block->type == 2 && block->compound.context)
15545 {
15546 block->compound.context->parent = stmt->compound.context;
15547 }
15548 if(filter)
15549 {
15550 block = MkIfStmt(filter, block, (((void *)0)));
15551 }
15552 if(isArray)
15553 {
15554 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));
15555 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15556 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15557 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15558 }
15559 else if(isBuiltin)
15560 {
15561 char count[128];
15562
15563 sprintf(count, "%d", builtinCount);
15564 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));
15565 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15566 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15567 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15568 }
15569 else if(isLinkList && !isList)
15570 {
15571 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
15572 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
15573
15574 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
15575 {
15576 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));
15577 }
15578 else
15579 {
15580 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15581 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
15582
15583 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));
15584 }
15585 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
15586 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
15587 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
15588 }
15589 else
15590 {
15591 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
15592 }
15593 ProcessExpressionType(expIt);
15594 if((*stmt->compound.declarations).first)
15595 ProcessDeclaration((*stmt->compound.declarations).first);
15596 if(symbol)
15597 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
15598 ProcessStatement(stmt);
15599 curContext = stmt->compound.context->parent;
15600 break;
15601 }
15602 else
15603 {
15604 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Expression is not a container\n", (((void *)0))));
15605 }
15606 break;
15607 }
15608 case 9:
15609 break;
15610 case 10:
15611 break;
15612 case 11:
15613 break;
15614 case 12:
15615 {
15616 struct Expression * exp;
15617
15618 if(stmt->expressions)
15619 {
15620 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
15621 {
15622 if(!exp->next)
15623 {
15624 if(curFunction && !curFunction->type)
15625 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
15626 FreeType(exp->destType);
15627 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
15628 if(exp->destType)
15629 exp->destType->refCount++;
15630 }
15631 ProcessExpressionType(exp);
15632 }
15633 }
15634 break;
15635 }
15636 case 14:
15637 {
15638 ProcessDeclaration(stmt->decl);
15639 break;
15640 }
15641 case 13:
15642 {
15643 struct AsmField * field;
15644
15645 if(stmt->asmStmt.inputFields)
15646 {
15647 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
15648 if(field->expression)
15649 ProcessExpressionType(field->expression);
15650 }
15651 if(stmt->asmStmt.outputFields)
15652 {
15653 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
15654 if(field->expression)
15655 ProcessExpressionType(field->expression);
15656 }
15657 if(stmt->asmStmt.clobberedFields)
15658 {
15659 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
15660 {
15661 if(field->expression)
15662 ProcessExpressionType(field->expression);
15663 }
15664 }
15665 break;
15666 }
15667 case 17:
15668 {
15669 struct PropertyWatch * propWatch;
15670 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15671 struct Expression * object = stmt->_watch.object;
15672 struct Expression * watcher = stmt->_watch.watcher;
15673
15674 if(watcher)
15675 ProcessExpressionType(watcher);
15676 if(object)
15677 ProcessExpressionType(object);
15678 if(inCompiler)
15679 {
15680 if(watcher || thisClass)
15681 {
15682 struct External * external = curExternal;
15683 struct Context * context = curContext;
15684
15685 stmt->type = 3;
15686 stmt->expressions = MkList();
15687 curExternal = external->prev;
15688 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15689 {
15690 struct ClassFunction * func;
15691 char watcherName[1024];
15692 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
15693 struct External * createdExternal;
15694 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
15695
15696 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
15697 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
15698 if(propWatch->deleteWatch)
15699 strcat(watcherName, "_delete");
15700 else
15701 {
15702 struct Identifier * propID;
15703
15704 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15705 {
15706 strcat(watcherName, "_");
15707 strcat(watcherName, propID->string);
15708 }
15709 }
15710 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
15711 {
15712 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
15713 ProcessClassFunctionBody(func, propWatch->compound);
15714 propWatch->compound = (((void *)0));
15715 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
15716 createdExternal->symbol->idCode = external->symbol->idCode;
15717 curExternal = createdExternal;
15718 ProcessFunction(createdExternal->function);
15719 {
15720 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
15721
15722 externalDecl->declaration = decl;
15723 if(decl->symbol && !decl->symbol->pointerExternal)
15724 decl->symbol->pointerExternal = externalDecl;
15725 }
15726 if(propWatch->deleteWatch)
15727 {
15728 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15729
15730 ListAdd(args, CopyExpression(object));
15731 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15732 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15733 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
15734 }
15735 else
15736 {
15737 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
15738 struct Identifier * propID;
15739
15740 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
15741 {
15742 char propName[1024];
15743 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15744
15745 if(prop)
15746 {
15747 char getName[1024], setName[1024];
15748 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15749
15750 DeclareProperty(prop, setName, getName);
15751 strcpy(propName, "__ecereProp_");
15752 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15753 strcat(propName, "_");
15754 FullClassNameCat(propName, prop->name, 0x1);
15755 ListAdd(args, CopyExpression(object));
15756 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15757 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15758 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
15759 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
15760 }
15761 else
15762 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15763 }
15764 }
15765 }
15766 else
15767 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid watched object\n", (((void *)0))));
15768 }
15769 curExternal = external;
15770 curContext = context;
15771 if(watcher)
15772 FreeExpression(watcher);
15773 if(object)
15774 FreeExpression(object);
15775 FreeList(watches, FreePropertyWatch);
15776 }
15777 else
15778 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a _class\n", (((void *)0))));
15779 }
15780 else
15781 {
15782 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
15783 {
15784 ProcessStatement(propWatch->compound);
15785 }
15786 }
15787 break;
15788 }
15789 case 15:
15790 {
15791 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15792 struct Expression * object = stmt->_watch.object;
15793 struct __ecereNameSpace__ecere__com__Class * _class;
15794
15795 if(object)
15796 ProcessExpressionType(object);
15797 if(inCompiler)
15798 {
15799 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
15800 if(_class)
15801 {
15802 struct Identifier * propID;
15803
15804 stmt->type = 3;
15805 stmt->expressions = MkList();
15806 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
15807 {
15808 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
15809 }
15810 else if(!watches)
15811 {
15812 }
15813 if(watches)
15814 {
15815 for(propID = (*watches).first; propID; propID = propID->next)
15816 {
15817 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15818
15819 if(prop)
15820 {
15821 CreateFireWatcher(prop, object, stmt);
15822 }
15823 else
15824 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
15825 }
15826 }
15827 else
15828 {
15829 struct __ecereNameSpace__ecere__com__Property * prop;
15830 struct __ecereNameSpace__ecere__com__Class * base;
15831
15832 for(base = _class; base; base = base->base)
15833 {
15834 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
15835 {
15836 if(prop->isProperty && prop->isWatchable)
15837 {
15838 CreateFireWatcher(prop, object, stmt);
15839 }
15840 }
15841 }
15842 }
15843 if(object)
15844 FreeExpression(object);
15845 FreeList(watches, FreeIdentifier);
15846 }
15847 else
15848 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15849 }
15850 break;
15851 }
15852 case 16:
15853 {
15854 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
15855 struct Expression * object = stmt->_watch.object;
15856 struct Expression * watcher = stmt->_watch.watcher;
15857 struct __ecereNameSpace__ecere__com__Class * _class;
15858
15859 if(object)
15860 ProcessExpressionType(object);
15861 if(watcher)
15862 ProcessExpressionType(watcher);
15863 if(inCompiler)
15864 {
15865 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
15866 if(watcher || thisClass)
15867 {
15868 if(_class)
15869 {
15870 struct Identifier * propID;
15871
15872 stmt->type = 3;
15873 stmt->expressions = MkList();
15874 if(!watches)
15875 {
15876 struct __ecereNameSpace__ecere__sys__OldList * args;
15877
15878 args = MkList();
15879 ListAdd(args, CopyExpression(object));
15880 ListAdd(args, MkExpConstant("0"));
15881 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15882 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15883 }
15884 else
15885 {
15886 for(propID = (*watches).first; propID; propID = propID->next)
15887 {
15888 char propName[1024];
15889 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
15890
15891 if(prop)
15892 {
15893 char getName[1024], setName[1024];
15894 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
15895
15896 DeclareProperty(prop, setName, getName);
15897 strcpy(propName, "__ecereProp_");
15898 FullClassNameCat(propName, prop->_class->fullName, 0x0);
15899 strcat(propName, "_");
15900 FullClassNameCat(propName, prop->name, 0x1);
15901 MangleClassName(propName);
15902 ListAdd(args, CopyExpression(object));
15903 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
15904 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
15905 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
15906 }
15907 else
15908 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Property %s not found in class %s\n", (((void *)0))), prop->name, _class->fullName);
15909 }
15910 }
15911 if(object)
15912 FreeExpression(object);
15913 if(watcher)
15914 FreeExpression(watcher);
15915 FreeList(watches, FreeIdentifier);
15916 }
15917 else
15918 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "Invalid object specified and not inside a class\n", (((void *)0))));
15919 }
15920 else
15921 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString(__thisModule, "No observer specified and not inside a class\n", (((void *)0))));
15922 }
15923 break;
15924 }
15925 }
15926 }
15927
15928 extern struct Expression * QBrackets(struct Expression * exp);
15929
15930 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
15931
15932 extern struct Declarator * QMkPtrDecl(char *  id);
15933
15934 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
15935
15936 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
15937
15938 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
15939
15940 static void ProcessFunction(struct FunctionDefinition * function)
15941 {
15942 void * __ecereTemp2;
15943 void * __ecereTemp1;
15944 struct Identifier * id = GetDeclId(function->declarator);
15945 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
15946 struct Type * type = symbol ? symbol->type : (((void *)0));
15947 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
15948 struct Context * oldTopContext = topContext;
15949
15950 yylloc = function->loc;
15951 if(type && type->thisClass)
15952 {
15953 struct Symbol * classSym = type->thisClass;
15954 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
15955 char className[1024];
15956 char structName[1024];
15957 struct Declarator * funcDecl;
15958 struct Symbol * thisSymbol;
15959 unsigned int typedObject = 0x0;
15960
15961 if(_class && !_class->base)
15962 {
15963 _class = currentClass;
15964 if(_class && !_class->symbol)
15965 _class->symbol = FindClass(_class->fullName);
15966 classSym = _class ? _class->symbol : (((void *)0));
15967 typedObject = 0x1;
15968 }
15969 thisClass = _class;
15970 if(inCompiler && _class)
15971 {
15972 if(type->kind == 11)
15973 {
15974 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
15975 {
15976 struct Type * param = symbol->type->params.first;
15977
15978 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
15979 FreeType(param);
15980 }
15981 if(type->classObjectType != 1)
15982 {
15983 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
15984 symbol->type->staticMethod = 0x1;
15985 symbol->type->thisClass = (((void *)0));
15986 symbol->type->extraParam = 0x0;
15987 }
15988 }
15989 strcpy(className, "__ecereClass_");
15990 FullClassNameCat(className, _class->fullName, 0x1);
15991 MangleClassName(className);
15992 structName[0] = (char)0;
15993 FullClassNameCat(structName, _class->fullName, 0x0);
15994 funcDecl = GetFuncDecl(function->declarator);
15995 if(funcDecl)
15996 {
15997 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
15998 {
15999 struct TypeName * param = (*funcDecl->function.parameters).first;
16000
16001 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16002 {
16003 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16004 FreeTypeName(param);
16005 }
16006 }
16007 if(!function->propertyNoThis)
16008 {
16009 struct TypeName * thisParam;
16010
16011 if(type->classObjectType != 1)
16012 {
16013 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16014 if(!funcDecl->function.parameters)
16015 funcDecl->function.parameters = MkList();
16016 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16017 }
16018 if(typedObject)
16019 {
16020 if(type->classObjectType != 1)
16021 {
16022 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
16023 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
16024 }
16025 thisParam = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), ((struct TypeName *)__ecereTemp1)->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), ((struct TypeName *)__ecereTemp1)->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), ((struct TypeName *)__ecereTemp1));
16026 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16027 }
16028 }
16029 }
16030 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16031 {
16032 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16033
16034 funcDecl = GetFuncDecl(initDecl->declarator);
16035 if(funcDecl)
16036 {
16037 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
16038 {
16039 struct TypeName * param = (*funcDecl->function.parameters).first;
16040
16041 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
16042 {
16043 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
16044 FreeTypeName(param);
16045 }
16046 }
16047 if(type->classObjectType != 1)
16048 {
16049 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
16050 {
16051 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
16052
16053 if(!funcDecl->function.parameters)
16054 funcDecl->function.parameters = MkList();
16055 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
16056 }
16057 }
16058 }
16059 }
16060 }
16061 if(function->body)
16062 {
16063 if(type->classObjectType != 1)
16064 {
16065 thisSymbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->string = __ecereNameSpace__ecere__sys__CopyString("this"), ((struct Symbol *)__ecereTemp1)->type = classSym ? MkClassType(classSym->string) : (((void *)0)), ((struct Symbol *)__ecereTemp1));
16066 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16067 if(typedObject && thisSymbol->type)
16068 {
16069 thisSymbol->type->classObjectType = 2;
16070 thisSymbol->type->byReference = type->byReference;
16071 }
16072 }
16073 }
16074 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
16075 {
16076 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
16077
16078 {
16079 struct __ecereNameSpace__ecere__com__Class * base;
16080
16081 for(base = _class; base && base->type != 1000; base = base->next)
16082 {
16083 for(member = base->membersAndProperties.first; member; member = member->next)
16084 if(!member->isProperty)
16085 break;
16086 if(member)
16087 break;
16088 }
16089 }
16090 for(member = _class->membersAndProperties.first; member; member = member->next)
16091 if(!member->isProperty)
16092 break;
16093 if(member)
16094 {
16095 char pointerName[1024];
16096 struct Declaration * decl;
16097 struct Initializer * initializer;
16098 struct Expression * exp, * bytePtr;
16099
16100 strcpy(pointerName, "__ecerePointer_");
16101 FullClassNameCat(pointerName, _class->fullName, 0x0);
16102 {
16103 char className[1024];
16104
16105 strcpy(className, "__ecereClass_");
16106 FullClassNameCat(className, classSym->string, 0x1);
16107 MangleClassName(className);
16108 DeclareClass(classSym, className);
16109 }
16110 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
16111 if(_class->fixed)
16112 {
16113 char string[256];
16114
16115 sprintf(string, "%d", _class->offset);
16116 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
16117 }
16118 else
16119 {
16120 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
16121 }
16122 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
16123 exp->expType = (__ecereTemp2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp2)->refCount = 1, ((struct Type *)__ecereTemp2)->kind = 13, ((struct Type *)__ecereTemp2)->type = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), ((struct Type *)__ecereTemp1)->refCount = 1, ((struct Type *)__ecereTemp1)->kind = 0, ((struct Type *)__ecereTemp1)), ((struct Type *)__ecereTemp2));
16124 if(function->body)
16125 {
16126 yylloc = function->body->loc;
16127 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
16128 {
16129 struct Context * prevContext = curContext;
16130
16131 curContext = function->body->compound.context;
16132 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
16133 curContext = prevContext;
16134 }
16135 decl->symbol = (((void *)0));
16136 if(!function->body->compound.declarations)
16137 function->body->compound.declarations = MkList();
16138 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
16139 }
16140 }
16141 }
16142 }
16143 else
16144 thisClass = (((void *)0));
16145 if(id)
16146 {
16147 FreeSpecifier(id->_class);
16148 id->_class = (((void *)0));
16149 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
16150 {
16151 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
16152
16153 id = GetDeclId(initDecl->declarator);
16154 FreeSpecifier(id->_class);
16155 id->_class = (((void *)0));
16156 }
16157 }
16158 if(function->body)
16159 topContext = function->body->compound.context;
16160 {
16161 struct FunctionDefinition * oldFunction = curFunction;
16162
16163 curFunction = function;
16164 if(function->body)
16165 ProcessStatement(function->body);
16166 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
16167 {
16168 struct Statement * prevCompound = curCompound;
16169 struct Context * prevContext = curContext;
16170 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
16171
16172 if(!function->body->compound.statements)
16173 function->body->compound.statements = MkList();
16174 ListAdd(function->body->compound.statements, fireWatchers);
16175 curCompound = function->body;
16176 curContext = function->body->compound.context;
16177 ProcessStatement(fireWatchers);
16178 curContext = prevContext;
16179 curCompound = prevCompound;
16180 }
16181 curFunction = oldFunction;
16182 }
16183 if(function->declarator)
16184 {
16185 ProcessDeclarator(function->declarator);
16186 }
16187 topContext = oldTopContext;
16188 thisClass = oldThisClass;
16189 }
16190
16191 extern void FreeSymbol(struct Symbol * symbol);
16192
16193 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
16194
16195 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
16196 {
16197 struct ClassDef * def;
16198 struct External * external = curExternal;
16199 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
16200
16201 for(def = definitions->first; def; def = def->next)
16202 {
16203 if(def->type == 0)
16204 {
16205 if(def->function->declarator)
16206 curExternal = def->function->declarator->symbol->pointerExternal;
16207 else
16208 curExternal = external;
16209 ProcessFunction((struct FunctionDefinition *)def->function);
16210 }
16211 else if(def->type == 2)
16212 {
16213 if(def->decl->type == 2)
16214 {
16215 thisClass = regClass;
16216 ProcessInstantiationType(def->decl->inst);
16217 thisClass = (((void *)0));
16218 }
16219 else
16220 {
16221 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
16222
16223 if(regClass)
16224 thisClass = regClass;
16225 ProcessDeclaration(def->decl);
16226 thisClass = backThisClass;
16227 }
16228 }
16229 else if(def->type == 1 && def->defProperties)
16230 {
16231 struct MemberInit * defProperty;
16232 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);
16233
16234 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16235 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
16236 {
16237 thisClass = regClass;
16238 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
16239 thisClass = (((void *)0));
16240 }
16241 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16242 FreeSymbol(thisSymbol);
16243 }
16244 else if(def->type == 3 && def->propertyDef)
16245 {
16246 struct PropertyDef * prop = def->propertyDef;
16247
16248 thisClass = regClass;
16249 if(prop->setStmt)
16250 {
16251 if(regClass)
16252 {
16253 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16254
16255 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16256 }
16257 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
16258 ProcessStatement(prop->setStmt);
16259 }
16260 if(prop->getStmt)
16261 {
16262 if(regClass)
16263 {
16264 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16265
16266 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16267 }
16268 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
16269 ProcessStatement(prop->getStmt);
16270 }
16271 if(prop->issetStmt)
16272 {
16273 if(regClass)
16274 {
16275 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
16276
16277 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16278 }
16279 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
16280 ProcessStatement(prop->issetStmt);
16281 }
16282 thisClass = (((void *)0));
16283 }
16284 else if(def->type == 4 && def->propertyWatch)
16285 {
16286 struct PropertyWatch * propertyWatch = def->propertyWatch;
16287
16288 thisClass = regClass;
16289 if(propertyWatch->compound)
16290 {
16291 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);
16292
16293 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
16294 curExternal = (((void *)0));
16295 ProcessStatement(propertyWatch->compound);
16296 }
16297 thisClass = (((void *)0));
16298 }
16299 }
16300 }
16301
16302 void DeclareFunctionUtil(char * s)
16303 {
16304 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
16305
16306 if(function)
16307 {
16308 char name[1024];
16309
16310 name[0] = (char)0;
16311 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + 12)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
16312 strcpy(name, "__ecereFunction_");
16313 FullClassNameCat(name, s, 0x0);
16314 DeclareFunction(function, name);
16315 }
16316 }
16317
16318 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
16319
16320 void ComputeDataTypes()
16321 {
16322 void * __ecereTemp1;
16323 struct External * external;
16324 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
16325
16326 currentClass = (((void *)0));
16327 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
16328 temp->symbol = (__ecereTemp1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), ((struct Symbol *)__ecereTemp1)->id = -1000, ((struct Symbol *)__ecereTemp1)->idCode = -1000, ((struct Symbol *)__ecereTemp1));
16329 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), (((void *)0)), temp);
16330 curExternal = temp;
16331 DeclareFunctionUtil("eSystem_New");
16332 DeclareFunctionUtil("eSystem_New0");
16333 DeclareFunctionUtil("eSystem_Renew");
16334 DeclareFunctionUtil("eSystem_Renew0");
16335 DeclareFunctionUtil("eClass_GetProperty");
16336 DeclareStruct("ecere::com::Class", 0x0);
16337 DeclareStruct("ecere::com::Instance", 0x0);
16338 DeclareStruct("ecere::com::Property", 0x0);
16339 DeclareStruct("ecere::com::DataMember", 0x0);
16340 DeclareStruct("ecere::com::Method", 0x0);
16341 DeclareStruct("ecere::com::SerialBuffer", 0x0);
16342 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
16343 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
16344 for(external = (*ast).first; external; external = external->next)
16345 {
16346 afterExternal = curExternal = external;
16347 if(external->type == 0)
16348 {
16349 currentClass = external->function->_class;
16350 ProcessFunction(external->function);
16351 }
16352 else if(external->type == 1)
16353 {
16354 currentClass = (((void *)0));
16355 ProcessDeclaration(external->declaration);
16356 }
16357 else if(external->type == 2)
16358 {
16359 struct ClassDefinition * _class = external->_class;
16360
16361 currentClass = external->symbol->registered;
16362 if(_class->definitions)
16363 {
16364 ProcessClass(_class->definitions, _class->symbol);
16365 }
16366 if(inCompiler)
16367 {
16368 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
16369 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
16370 }
16371 }
16372 else if(external->type == 4)
16373 {
16374 thisNameSpace = external->id->string;
16375 }
16376 }
16377 currentClass = (((void *)0));
16378 thisNameSpace = (((void *)0));
16379 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
16380 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
16381 }
16382
16383 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);
16384
16385 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (* )(void * ), void (* )(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
16386
16387 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16388 {
16389 struct __ecereNameSpace__ecere__com__Class * class;
16390
16391 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
16392 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
16393 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
16394 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
16395 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoi64", "int64 _strtoi64(char * string, char * * endString, int base)", _strtoi64, module, 2);
16396 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("_strtoui64", "uint64 _strtoui64(char * string, char * * endString, int base)", _strtoui64, module, 2);
16397 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
16398 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
16399 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
16400 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
16401 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
16402 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
16403 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
16404 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
16405 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
16406 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
16407 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
16408 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
16409 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
16410 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
16411 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
16412 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
16413 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
16414 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
16415 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
16416 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
16417 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
16418 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
16419 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
16420 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
16421 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
16422 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
16423 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
16424 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
16425 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
16426 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("AddMembers", "int AddMembers(ecere::sys::OldList * declarations, ecere::com::Class _class, bool isMember, uint * retSize, ecere::com::Class topClass)", AddMembers, module, 2);
16427 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
16428 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
16429 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
16430 __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);
16431 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
16432 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
16433 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
16434 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
16435 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
16436 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
16437 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
16438 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
16439 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
16440 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
16441 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
16442 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
16443 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
16444 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + 12)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + 12)))->application && class)
16445 __ecereClass_Conversion = class;
16446 __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);
16447 __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);
16448 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
16449 __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);
16450 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
16451 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
16452 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
16453 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
16454 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
16455 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
16456 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
16457 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
16458 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
16459 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
16460 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
16461 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
16462 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
16463 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
16464 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
16465 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
16466 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
16467 }
16468
16469 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
16470 {
16471
16472 }
16473