Fixed many warnings
[sdk] / compiler / bootstrap / libec / bootstrap / pass15.c
1 /* Code generated from eC source file: pass15.ec */
2 #if defined(__GNUC__)
3 typedef long long int64;
4 typedef unsigned long long uint64;
5 #ifndef _WIN32
6 #define __declspec(x)
7 #endif
8 #elif defined(__TINYC__)
9 #include <stdarg.h>
10 #define __builtin_va_list va_list
11 #define __builtin_va_start va_start
12 #define __builtin_va_end va_end
13 #ifdef _WIN32
14 #define strcasecmp stricmp
15 #define strncasecmp strnicmp
16 #define __declspec(x) __attribute__((x))
17 #else
18 #define __declspec(x)
19 #endif
20 typedef long long int64;
21 typedef unsigned long long uint64;
22 #else
23 typedef __int64 int64;
24 typedef unsigned __int64 uint64;
25 #endif
26 #ifdef __BIG_ENDIAN__
27 #define __ENDIAN_PAD(x) (8 - (x))
28 #else
29 #define __ENDIAN_PAD(x) 0
30 #endif
31 #include <stdint.h>
32 #include <sys/types.h>
33
34 #if /*defined(_W64) || */(defined(__WORDSIZE) && __WORDSIZE == 8) || defined(__x86_64__)
35 #define _64BIT 1
36 #else
37 #define _64BIT 0
38 #endif
39
40 #define arch_PointerSize                  sizeof(void *)
41 #define structSize_Instance               (_64BIT ? 24 : 12)
42 #define structSize_Module                 (_64BIT ? 560 : 300)
43 #define structSize_NamedLink              (_64BIT ? 32 : 16)
44
45 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
46
47 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
48
49 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
50
51 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
52
53 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
54
55 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BTNode;
56
57 struct __ecereNameSpace__ecere__sys__BTNode;
58
59 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__BinaryTree;
60
61 struct __ecereNameSpace__ecere__sys__BinaryTree
62 {
63 struct __ecereNameSpace__ecere__sys__BTNode * root;
64 int count;
65 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
66 void (*  FreeKey)(void *  key);
67 } __attribute__ ((gcc_struct));
68
69 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldList;
70
71 struct __ecereNameSpace__ecere__sys__OldList
72 {
73 void *  first;
74 void *  last;
75 int count;
76 unsigned int offset;
77 unsigned int circ;
78 } __attribute__ ((gcc_struct));
79
80 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Method;
81
82 struct __ecereNameSpace__ecere__com__Method
83 {
84 char *  name;
85 struct __ecereNameSpace__ecere__com__Method * parent;
86 struct __ecereNameSpace__ecere__com__Method * left;
87 struct __ecereNameSpace__ecere__com__Method * right;
88 int depth;
89 int (*  function)();
90 int vid;
91 int type;
92 struct __ecereNameSpace__ecere__com__Class * _class;
93 void *  symbol;
94 char *  dataTypeString;
95 struct Type * dataType;
96 int memberAccess;
97 } __attribute__ ((gcc_struct));
98
99 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Property;
100
101 struct __ecereNameSpace__ecere__com__Property
102 {
103 struct __ecereNameSpace__ecere__com__Property * prev;
104 struct __ecereNameSpace__ecere__com__Property * next;
105 char *  name;
106 unsigned int isProperty;
107 int memberAccess;
108 int id;
109 struct __ecereNameSpace__ecere__com__Class * _class;
110 char *  dataTypeString;
111 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
112 struct Type * dataType;
113 void (*  Set)(void * , int);
114 int (*  Get)(void * );
115 unsigned int (*  IsSet)(void * );
116 void *  data;
117 void *  symbol;
118 int vid;
119 unsigned int conversion;
120 unsigned int watcherOffset;
121 char *  category;
122 unsigned int compiled;
123 unsigned int selfWatchable;
124 unsigned int isWatchable;
125 } __attribute__ ((gcc_struct));
126
127 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_CodePosition;
128
129 struct CodePosition
130 {
131 int line;
132 int charPos;
133 int pos;
134 int included;
135 } __attribute__ ((gcc_struct));
136
137 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Location;
138
139 struct Location
140 {
141 struct CodePosition start;
142 struct CodePosition end;
143 } __attribute__ ((gcc_struct));
144
145 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attrib;
146
147 struct Attrib;
148
149 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ExtDecl;
150
151 struct ExtDecl
152 {
153 struct Location loc;
154 int type;
155 union
156 {
157 char * s;
158 struct Attrib * attr;
159 } __attribute__ ((gcc_struct));
160 } __attribute__ ((gcc_struct));
161
162 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDefinition;
163
164 struct ClassDefinition
165 {
166 struct ClassDefinition * prev;
167 struct ClassDefinition * next;
168 struct Location loc;
169 struct Specifier * _class;
170 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
171 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
172 struct Symbol * symbol;
173 struct Location blockStart;
174 struct Location nameLoc;
175 int endid;
176 int declMode;
177 unsigned int deleteWatchable;
178 } __attribute__ ((gcc_struct));
179
180 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Context;
181
182 struct Context
183 {
184 struct Context * parent;
185 struct __ecereNameSpace__ecere__sys__BinaryTree types;
186 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
187 struct __ecereNameSpace__ecere__sys__BinaryTree symbols;
188 struct __ecereNameSpace__ecere__sys__BinaryTree structSymbols;
189 int nextID;
190 int simpleID;
191 struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
192 struct ClassDefinition * classDef;
193 unsigned int templateTypesOnly;
194 unsigned int hasNameSpace;
195 } __attribute__ ((gcc_struct));
196
197 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Instantiation;
198
199 struct Instantiation
200 {
201 struct Instantiation * prev;
202 struct Instantiation * next;
203 struct Location loc;
204 struct Specifier * _class;
205 struct Expression * exp;
206 struct __ecereNameSpace__ecere__sys__OldList *  members;
207 struct Symbol * symbol;
208 unsigned int fullSet;
209 unsigned int isConstant;
210 unsigned char *  data;
211 struct Location nameLoc;
212 struct Location insideLoc;
213 unsigned int built;
214 } __attribute__ ((gcc_struct));
215
216 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declaration;
217
218 struct Declaration
219 {
220 struct Declaration * prev;
221 struct Declaration * next;
222 struct Location loc;
223 int type;
224 union
225 {
226 struct
227 {
228 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
229 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
230 } __attribute__ ((gcc_struct));
231 struct Instantiation * inst;
232 struct
233 {
234 struct Identifier * id;
235 struct Expression * exp;
236 } __attribute__ ((gcc_struct));
237 } __attribute__ ((gcc_struct));
238 struct Specifier * extStorage;
239 struct Symbol * symbol;
240 int declMode;
241 } __attribute__ ((gcc_struct));
242
243 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Statement;
244
245 struct Statement
246 {
247 struct Statement * prev;
248 struct Statement * next;
249 struct Location loc;
250 int type;
251 union
252 {
253 struct __ecereNameSpace__ecere__sys__OldList *  expressions;
254 struct
255 {
256 struct Identifier * id;
257 struct Statement * stmt;
258 } __attribute__ ((gcc_struct)) labeled;
259 struct
260 {
261 struct Expression * exp;
262 struct Statement * stmt;
263 } __attribute__ ((gcc_struct)) caseStmt;
264 struct
265 {
266 struct __ecereNameSpace__ecere__sys__OldList * declarations;
267 struct __ecereNameSpace__ecere__sys__OldList * statements;
268 struct Context * context;
269 unsigned int isSwitch;
270 } __attribute__ ((gcc_struct)) compound;
271 struct
272 {
273 struct __ecereNameSpace__ecere__sys__OldList * exp;
274 struct Statement * stmt;
275 struct Statement * elseStmt;
276 } __attribute__ ((gcc_struct)) ifStmt;
277 struct
278 {
279 struct __ecereNameSpace__ecere__sys__OldList * exp;
280 struct Statement * stmt;
281 } __attribute__ ((gcc_struct)) switchStmt;
282 struct
283 {
284 struct __ecereNameSpace__ecere__sys__OldList * exp;
285 struct Statement * stmt;
286 } __attribute__ ((gcc_struct)) whileStmt;
287 struct
288 {
289 struct __ecereNameSpace__ecere__sys__OldList * exp;
290 struct Statement * stmt;
291 } __attribute__ ((gcc_struct)) doWhile;
292 struct
293 {
294 struct Statement * init;
295 struct Statement * check;
296 struct __ecereNameSpace__ecere__sys__OldList * increment;
297 struct Statement * stmt;
298 } __attribute__ ((gcc_struct)) forStmt;
299 struct
300 {
301 struct Identifier * id;
302 } __attribute__ ((gcc_struct)) gotoStmt;
303 struct
304 {
305 struct Specifier * spec;
306 char * statements;
307 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
308 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
309 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
310 } __attribute__ ((gcc_struct)) asmStmt;
311 struct
312 {
313 struct Expression * watcher;
314 struct Expression * object;
315 struct __ecereNameSpace__ecere__sys__OldList * watches;
316 } __attribute__ ((gcc_struct)) _watch;
317 struct
318 {
319 struct Identifier * id;
320 struct __ecereNameSpace__ecere__sys__OldList * exp;
321 struct __ecereNameSpace__ecere__sys__OldList * filter;
322 struct Statement * stmt;
323 } __attribute__ ((gcc_struct)) forEachStmt;
324 struct Declaration * decl;
325 } __attribute__ ((gcc_struct));
326 } __attribute__ ((gcc_struct));
327
328 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TypeName;
329
330 struct TypeName
331 {
332 struct TypeName * prev;
333 struct TypeName * next;
334 struct Location loc;
335 struct __ecereNameSpace__ecere__sys__OldList *  qualifiers;
336 struct Declarator * declarator;
337 int classObjectType;
338 struct Expression * bitCount;
339 } __attribute__ ((gcc_struct));
340
341 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Initializer;
342
343 struct Initializer
344 {
345 struct Initializer * prev;
346 struct Initializer * next;
347 struct Location loc;
348 int type;
349 union
350 {
351 struct Expression * exp;
352 struct __ecereNameSpace__ecere__sys__OldList *  list;
353 } __attribute__ ((gcc_struct));
354 unsigned int isConstant;
355 struct Identifier * id;
356 } __attribute__ ((gcc_struct));
357
358 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
359
360 struct __ecereNameSpace__ecere__com__DataValue
361 {
362 union
363 {
364 char c;
365 unsigned char uc;
366 short s;
367 unsigned short us;
368 int i;
369 unsigned int ui;
370 void *  p;
371 float f;
372 double d;
373 long long i64;
374 uint64 ui64;
375 } __attribute__ ((gcc_struct));
376 } __attribute__ ((gcc_struct));
377
378 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
379
380 struct Expression
381 {
382 struct Expression * prev;
383 struct Expression * next;
384 struct Location loc;
385 int type;
386 union
387 {
388 struct
389 {
390 char *  constant;
391 struct Identifier * identifier;
392 } __attribute__ ((gcc_struct));
393 struct Statement * compound;
394 struct Instantiation * instance;
395 struct
396 {
397 char *  string;
398 unsigned int intlString;
399 } __attribute__ ((gcc_struct));
400 struct __ecereNameSpace__ecere__sys__OldList *  list;
401 struct
402 {
403 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
404 struct Declarator * decl;
405 } __attribute__ ((gcc_struct)) _classExp;
406 struct
407 {
408 struct Identifier * id;
409 } __attribute__ ((gcc_struct)) classData;
410 struct
411 {
412 struct Expression * exp;
413 struct __ecereNameSpace__ecere__sys__OldList * arguments;
414 struct Location argLoc;
415 } __attribute__ ((gcc_struct)) call;
416 struct
417 {
418 struct Expression * exp;
419 struct __ecereNameSpace__ecere__sys__OldList * index;
420 } __attribute__ ((gcc_struct)) index;
421 struct
422 {
423 struct Expression * exp;
424 struct Identifier * member;
425 int memberType;
426 unsigned int thisPtr;
427 } __attribute__ ((gcc_struct)) member;
428 struct
429 {
430 int op;
431 struct Expression * exp1;
432 struct Expression * exp2;
433 } __attribute__ ((gcc_struct)) op;
434 struct TypeName * typeName;
435 struct Specifier * _class;
436 struct
437 {
438 struct TypeName * typeName;
439 struct Expression * exp;
440 } __attribute__ ((gcc_struct)) cast;
441 struct
442 {
443 struct Expression * cond;
444 struct __ecereNameSpace__ecere__sys__OldList * exp;
445 struct Expression * elseExp;
446 } __attribute__ ((gcc_struct)) cond;
447 struct
448 {
449 struct TypeName * typeName;
450 struct Expression * size;
451 } __attribute__ ((gcc_struct)) _new;
452 struct
453 {
454 struct TypeName * typeName;
455 struct Expression * size;
456 struct Expression * exp;
457 } __attribute__ ((gcc_struct)) _renew;
458 struct
459 {
460 char * table;
461 struct Identifier * id;
462 } __attribute__ ((gcc_struct)) db;
463 struct
464 {
465 struct Expression * ds;
466 struct Expression * name;
467 } __attribute__ ((gcc_struct)) dbopen;
468 struct
469 {
470 struct TypeName * typeName;
471 struct Initializer * initializer;
472 } __attribute__ ((gcc_struct)) initializer;
473 struct
474 {
475 struct Expression * exp;
476 struct TypeName * typeName;
477 } __attribute__ ((gcc_struct)) vaArg;
478 } __attribute__ ((gcc_struct));
479 unsigned int debugValue;
480 struct __ecereNameSpace__ecere__com__DataValue val;
481 uint64 address;
482 unsigned int hasAddress;
483 struct Type * expType;
484 struct Type * destType;
485 unsigned int usage;
486 int tempCount;
487 unsigned int byReference;
488 unsigned int isConstant;
489 unsigned int addedThis;
490 unsigned int needCast;
491 unsigned int thisPtr;
492 unsigned int opDestType;
493 } __attribute__ ((gcc_struct));
494
495 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
496
497 struct TemplateDatatype
498 {
499 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
500 struct Declarator * decl;
501 } __attribute__ ((gcc_struct));
502
503 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
504
505 struct TemplateArgument;
506
507 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
508
509 struct TemplateParameter
510 {
511 struct TemplateParameter * prev;
512 struct TemplateParameter * next;
513 struct Location loc;
514 int type;
515 struct Identifier * identifier;
516 union
517 {
518 struct TemplateDatatype * dataType;
519 int memberType;
520 } __attribute__ ((gcc_struct));
521 struct TemplateArgument * defaultArgument;
522 char *  dataTypeString;
523 struct Type * baseType;
524 } __attribute__ ((gcc_struct));
525
526 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
527
528 struct Specifier
529 {
530 struct Specifier * prev;
531 struct Specifier * next;
532 struct Location loc;
533 int type;
534 union
535 {
536 int specifier;
537 struct
538 {
539 struct ExtDecl * extDecl;
540 char *  name;
541 struct Symbol * symbol;
542 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
543 } __attribute__ ((gcc_struct));
544 struct
545 {
546 struct Identifier * id;
547 struct __ecereNameSpace__ecere__sys__OldList *  list;
548 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
549 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
550 unsigned int addNameSpace;
551 struct Context * ctx;
552 struct ExtDecl * extDeclStruct;
553 } __attribute__ ((gcc_struct));
554 struct Expression * expression;
555 struct Specifier * _class;
556 struct TemplateParameter * templateParameter;
557 } __attribute__ ((gcc_struct));
558 } __attribute__ ((gcc_struct));
559
560 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
561
562 struct Identifier
563 {
564 struct Identifier * prev;
565 struct Identifier * next;
566 struct Location loc;
567 struct Symbol * classSym;
568 struct Specifier * _class;
569 char *  string;
570 struct Identifier * badID;
571 } __attribute__ ((gcc_struct));
572
573 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
574
575 struct Pointer;
576
577 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
578
579 struct Declarator
580 {
581 struct Declarator * prev;
582 struct Declarator * next;
583 struct Location loc;
584 int type;
585 struct Symbol * symbol;
586 struct Declarator * declarator;
587 union
588 {
589 struct Identifier * identifier;
590 struct
591 {
592 struct Expression * exp;
593 struct Expression * posExp;
594 struct Attrib * attrib;
595 } __attribute__ ((gcc_struct)) structDecl;
596 struct
597 {
598 struct Expression * exp;
599 struct Specifier * enumClass;
600 } __attribute__ ((gcc_struct)) array;
601 struct
602 {
603 struct __ecereNameSpace__ecere__sys__OldList * parameters;
604 } __attribute__ ((gcc_struct)) function;
605 struct
606 {
607 struct Pointer * pointer;
608 } __attribute__ ((gcc_struct)) pointer;
609 struct
610 {
611 struct ExtDecl * extended;
612 } __attribute__ ((gcc_struct)) extended;
613 } __attribute__ ((gcc_struct));
614 } __attribute__ ((gcc_struct));
615
616 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
617
618 struct FunctionDefinition
619 {
620 struct FunctionDefinition * prev;
621 struct FunctionDefinition * next;
622 struct Location loc;
623 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
624 struct Declarator * declarator;
625 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
626 struct Statement * body;
627 struct __ecereNameSpace__ecere__com__Class * _class;
628 struct __ecereNameSpace__ecere__sys__OldList attached;
629 int declMode;
630 struct Type * type;
631 struct Symbol * propSet;
632 int tempCount;
633 unsigned int propertyNoThis;
634 } __attribute__ ((gcc_struct));
635
636 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
637
638 struct DBTableDef;
639
640 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
641
642 struct External
643 {
644 struct External * prev;
645 struct External * next;
646 struct Location loc;
647 int type;
648 struct Symbol * symbol;
649 union
650 {
651 struct FunctionDefinition * function;
652 struct ClassDefinition * _class;
653 struct Declaration * declaration;
654 char *  importString;
655 struct Identifier * id;
656 struct DBTableDef * table;
657 } __attribute__ ((gcc_struct));
658 int importType;
659 } __attribute__ ((gcc_struct));
660
661 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
662
663 struct ModuleImport
664 {
665 struct ModuleImport * prev;
666 struct ModuleImport * next;
667 char *  name;
668 struct __ecereNameSpace__ecere__sys__OldList classes;
669 struct __ecereNameSpace__ecere__sys__OldList functions;
670 int importType;
671 int importAccess;
672 } __attribute__ ((gcc_struct));
673
674 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
675
676 struct ClassImport
677 {
678 struct ClassImport * prev;
679 struct ClassImport * next;
680 char *  name;
681 struct __ecereNameSpace__ecere__sys__OldList methods;
682 struct __ecereNameSpace__ecere__sys__OldList properties;
683 unsigned int itself;
684 int isRemote;
685 } __attribute__ ((gcc_struct));
686
687 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
688
689 struct Symbol
690 {
691 char *  string;
692 struct Symbol * parent;
693 struct Symbol * left;
694 struct Symbol * right;
695 int depth;
696 struct Type * type;
697 union
698 {
699 struct __ecereNameSpace__ecere__com__Method * method;
700 struct __ecereNameSpace__ecere__com__Property * _property;
701 struct __ecereNameSpace__ecere__com__Class * registered;
702 } __attribute__ ((gcc_struct));
703 int id;
704 int idCode;
705 union
706 {
707 struct
708 {
709 struct External * pointerExternal;
710 struct External * structExternal;
711 } __attribute__ ((gcc_struct));
712 struct
713 {
714 struct External * externalGet;
715 struct External * externalSet;
716 struct External * externalPtr;
717 struct External * externalIsSet;
718 } __attribute__ ((gcc_struct));
719 struct
720 {
721 struct External * methodExternal;
722 struct External * methodCodeExternal;
723 } __attribute__ ((gcc_struct));
724 } __attribute__ ((gcc_struct));
725 unsigned int imported;
726 unsigned int declaredStructSym;
727 struct __ecereNameSpace__ecere__com__Class * _class;
728 unsigned int declaredStruct;
729 unsigned int needConstructor;
730 unsigned int needDestructor;
731 char *  constructorName;
732 char *  structName;
733 char *  className;
734 char *  destructorName;
735 struct ModuleImport * module;
736 struct ClassImport * _import;
737 struct Location nameLoc;
738 unsigned int isParam;
739 unsigned int isRemote;
740 unsigned int isStruct;
741 unsigned int fireWatchersDone;
742 int declaring;
743 unsigned int classData;
744 unsigned int isStatic;
745 char *  shortName;
746 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
747 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
748 struct Context * ctx;
749 int isIterator;
750 struct Expression * propCategory;
751 } __attribute__ ((gcc_struct));
752
753 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
754
755 struct Type
756 {
757 struct Type * prev;
758 struct Type * next;
759 int refCount;
760 union
761 {
762 struct Symbol * _class;
763 struct
764 {
765 struct __ecereNameSpace__ecere__sys__OldList members;
766 char *  enumName;
767 } __attribute__ ((gcc_struct));
768 struct
769 {
770 struct Type * returnType;
771 struct __ecereNameSpace__ecere__sys__OldList params;
772 struct Symbol * thisClass;
773 unsigned int staticMethod;
774 struct TemplateParameter * thisClassTemplate;
775 } __attribute__ ((gcc_struct));
776 struct
777 {
778 struct __ecereNameSpace__ecere__com__Method * method;
779 struct __ecereNameSpace__ecere__com__Class * methodClass;
780 struct __ecereNameSpace__ecere__com__Class * usedClass;
781 } __attribute__ ((gcc_struct));
782 struct
783 {
784 struct Type * arrayType;
785 int arraySize;
786 struct Expression * arraySizeExp;
787 unsigned int freeExp;
788 struct Symbol * enumClass;
789 } __attribute__ ((gcc_struct));
790 struct Type * type;
791 struct TemplateParameter * templateParameter;
792 } __attribute__ ((gcc_struct));
793 int kind;
794 unsigned int size;
795 char *  name;
796 char *  typeName;
797 int classObjectType;
798 int alignment;
799 unsigned int offset;
800 int bitFieldCount;
801 int count;
802 unsigned int isSigned : 1;
803 unsigned int constant : 1;
804 unsigned int truth : 1;
805 unsigned int byReference : 1;
806 unsigned int extraParam : 1;
807 unsigned int directClassAccess : 1;
808 unsigned int computing : 1;
809 unsigned int keepCast : 1;
810 unsigned int passAsTemplate : 1;
811 unsigned int dllExport : 1;
812 unsigned int attrStdcall : 1;
813 unsigned int declaredWithStruct : 1;
814 unsigned int typedByReference : 1;
815 } __attribute__ ((gcc_struct));
816
817 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
818
819 struct __ecereNameSpace__ecere__com__Class
820 {
821 struct __ecereNameSpace__ecere__com__Class * prev;
822 struct __ecereNameSpace__ecere__com__Class * next;
823 char *  name;
824 int offset;
825 int structSize;
826 int (* *  _vTbl)();
827 int vTblSize;
828 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
829 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
830 int offsetClass;
831 int sizeClass;
832 struct __ecereNameSpace__ecere__com__Class * base;
833 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
834 struct __ecereNameSpace__ecere__sys__BinaryTree members;
835 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
836 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
837 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
838 struct __ecereNameSpace__ecere__sys__OldList derivatives;
839 int memberID;
840 int startMemberID;
841 int type;
842 struct __ecereNameSpace__ecere__com__Instance * module;
843 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
844 char *  dataTypeString;
845 struct Type * dataType;
846 int typeSize;
847 int defaultAlignment;
848 void (*  Initialize)();
849 int memberOffset;
850 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
851 char *  designerClass;
852 unsigned int noExpansion;
853 char *  defaultProperty;
854 unsigned int comRedefinition;
855 int count;
856 int isRemote;
857 unsigned int internalDecl;
858 void *  data;
859 unsigned int computeSize;
860 int structAlignment;
861 int destructionWatchOffset;
862 unsigned int fixed;
863 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
864 int inheritanceAccess;
865 char *  fullName;
866 void *  symbol;
867 struct __ecereNameSpace__ecere__sys__OldList conversions;
868 struct __ecereNameSpace__ecere__sys__OldList templateParams;
869 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
870 struct __ecereNameSpace__ecere__com__Class * templateClass;
871 struct __ecereNameSpace__ecere__sys__OldList templatized;
872 int numParams;
873 unsigned int isInstanceClass;
874 unsigned int byValueSystemClass;
875 } __attribute__ ((gcc_struct));
876
877 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
878
879 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name, long long value);
880
881 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
882
883 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, char *  name, void *  function);
884
885 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
886
887 extern void __ecereNameSpace__ecere__com__eInstance_StopWatching(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, struct __ecereNameSpace__ecere__com__Instance * object);
888
889 extern void __ecereNameSpace__ecere__com__eInstance_Watch(void *  instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
890
891 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
892
893 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
894
895 struct __ecereNameSpace__ecere__com__Instance
896 {
897 int (* *  _vTbl)();
898 struct __ecereNameSpace__ecere__com__Class * _class;
899 int _refCount;
900 } __attribute__ ((gcc_struct));
901
902 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
903
904 struct __ecereNameSpace__ecere__com__DataMember
905 {
906 struct __ecereNameSpace__ecere__com__DataMember * prev;
907 struct __ecereNameSpace__ecere__com__DataMember * next;
908 char *  name;
909 unsigned int isProperty;
910 int memberAccess;
911 int id;
912 struct __ecereNameSpace__ecere__com__Class * _class;
913 char *  dataTypeString;
914 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
915 struct Type * dataType;
916 int type;
917 int offset;
918 int memberID;
919 struct __ecereNameSpace__ecere__sys__OldList members;
920 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
921 int memberOffset;
922 int structAlignment;
923 } __attribute__ ((gcc_struct));
924
925 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
926
927 struct __ecereNameSpace__ecere__com__SerialBuffer
928 {
929 unsigned char *  _buffer;
930 unsigned int count;
931 unsigned int _size;
932 unsigned int pos;
933 } __attribute__ ((gcc_struct));
934
935 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
936
937 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
938 {
939 union
940 {
941 struct
942 {
943 char *  dataTypeString;
944 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
945 } __attribute__ ((gcc_struct));
946 struct __ecereNameSpace__ecere__com__DataValue expression;
947 struct
948 {
949 char *  memberString;
950 union
951 {
952 struct __ecereNameSpace__ecere__com__DataMember * member;
953 struct __ecereNameSpace__ecere__com__Property * prop;
954 struct __ecereNameSpace__ecere__com__Method * method;
955 } __attribute__ ((gcc_struct));
956 } __attribute__ ((gcc_struct));
957 } __attribute__ ((gcc_struct));
958 } __attribute__ ((gcc_struct));
959
960 void exit(int status);
961
962 void * calloc(size_t nmemb, size_t size);
963
964 void free(void * ptr);
965
966 void * malloc(size_t size);
967
968 void * realloc(void * ptr, size_t size);
969
970 long int strtol(const char * nptr, char ** endptr, int base);
971
972 long long int strtoll(const char * nptr, char ** endptr, int base);
973
974 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
975
976 enum yytokentype
977 {
978 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, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372
979 };
980
981 typedef union YYSTYPE
982 {
983 int specifierType;
984 int i;
985 int declMode;
986 struct Identifier * id;
987 struct Expression * exp;
988 struct Specifier * specifier;
989 struct __ecereNameSpace__ecere__sys__OldList * list;
990 struct Enumerator * enumerator;
991 struct Declarator * declarator;
992 struct Pointer * pointer;
993 struct Initializer * initializer;
994 struct InitDeclarator * initDeclarator;
995 struct TypeName * typeName;
996 struct Declaration * declaration;
997 struct Statement * stmt;
998 struct FunctionDefinition * function;
999 struct External * external;
1000 struct Context * context;
1001 struct AsmField * asmField;
1002 struct Attrib * attrib;
1003 struct ExtDecl * extDecl;
1004 struct Attribute * attribute;
1005 struct Instantiation * instance;
1006 struct MembersInit * membersInit;
1007 struct MemberInit * memberInit;
1008 struct ClassFunction * classFunction;
1009 struct ClassDefinition * _class;
1010 struct ClassDef * classDef;
1011 struct PropertyDef * prop;
1012 char * string;
1013 struct Symbol * symbol;
1014 struct PropertyWatch * propertyWatch;
1015 struct TemplateParameter * templateParameter;
1016 struct TemplateArgument * templateArgument;
1017 struct TemplateDatatype * templateDatatype;
1018 struct DBTableEntry * dbtableEntry;
1019 struct DBIndexItem * dbindexItem;
1020 struct DBTableDef * dbtableDef;
1021 } __attribute__ ((gcc_struct)) YYSTYPE;
1022
1023 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1024
1025 struct Enumerator
1026 {
1027 struct Enumerator * prev;
1028 struct Enumerator * next;
1029 struct Location loc;
1030 struct Identifier * id;
1031 struct Expression * exp;
1032 } __attribute__ ((gcc_struct));
1033
1034 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1035
1036 struct InitDeclarator
1037 {
1038 struct InitDeclarator * prev;
1039 struct InitDeclarator * next;
1040 struct Location loc;
1041 struct Declarator * declarator;
1042 struct Initializer * initializer;
1043 } __attribute__ ((gcc_struct));
1044
1045 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1046
1047 struct AsmField
1048 {
1049 struct AsmField * prev;
1050 struct AsmField * next;
1051 struct Location loc;
1052 char *  command;
1053 struct Expression * expression;
1054 struct Identifier * symbolic;
1055 } __attribute__ ((gcc_struct));
1056
1057 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1058
1059 struct Attribute;
1060
1061 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1062
1063 struct ClassFunction
1064 {
1065 struct ClassFunction * prev;
1066 struct ClassFunction * next;
1067 struct Location loc;
1068 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1069 struct Declarator * declarator;
1070 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1071 struct Statement * body;
1072 struct __ecereNameSpace__ecere__com__Class * _class;
1073 struct __ecereNameSpace__ecere__sys__OldList attached;
1074 int declMode;
1075 struct Type * type;
1076 struct Symbol * propSet;
1077 unsigned int isVirtual;
1078 unsigned int isConstructor;
1079 unsigned int isDestructor;
1080 unsigned int dontMangle;
1081 int id;
1082 int idCode;
1083 } __attribute__ ((gcc_struct));
1084
1085 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1086
1087 struct MembersInit
1088 {
1089 struct MembersInit * prev;
1090 struct MembersInit * next;
1091 struct Location loc;
1092 int type;
1093 union
1094 {
1095 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1096 struct ClassFunction * function;
1097 } __attribute__ ((gcc_struct));
1098 } __attribute__ ((gcc_struct));
1099
1100 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1101
1102 struct MemberInit
1103 {
1104 struct MemberInit * prev;
1105 struct MemberInit * next;
1106 struct Location loc;
1107 struct Location realLoc;
1108 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1109 struct Initializer * initializer;
1110 unsigned int used;
1111 unsigned int variable;
1112 unsigned int takeOutExp;
1113 } __attribute__ ((gcc_struct));
1114
1115 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1116
1117 struct PropertyDef
1118 {
1119 struct PropertyDef * prev;
1120 struct PropertyDef * next;
1121 struct Location loc;
1122 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1123 struct Declarator * declarator;
1124 struct Identifier * id;
1125 struct Statement * getStmt;
1126 struct Statement * setStmt;
1127 struct Statement * issetStmt;
1128 struct Symbol * symbol;
1129 struct Expression * category;
1130 struct
1131 {
1132 unsigned int conversion : 1;
1133 unsigned int isWatchable : 1;
1134 unsigned int isDBProp : 1;
1135 } __attribute__ ((gcc_struct));
1136 } __attribute__ ((gcc_struct));
1137
1138 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1139
1140 struct PropertyWatch
1141 {
1142 struct PropertyWatch * prev;
1143 struct PropertyWatch * next;
1144 struct Location loc;
1145 struct Statement * compound;
1146 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1147 unsigned int deleteWatch;
1148 } __attribute__ ((gcc_struct));
1149
1150 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1151
1152 struct ClassDef
1153 {
1154 struct ClassDef * prev;
1155 struct ClassDef * next;
1156 struct Location loc;
1157 int type;
1158 union
1159 {
1160 struct Declaration * decl;
1161 struct ClassFunction * function;
1162 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1163 struct PropertyDef * propertyDef;
1164 struct PropertyWatch * propertyWatch;
1165 char *  designer;
1166 struct Identifier * defaultProperty;
1167 struct
1168 {
1169 struct Identifier * id;
1170 struct Initializer * initializer;
1171 } __attribute__ ((gcc_struct));
1172 } __attribute__ ((gcc_struct));
1173 int memberAccess;
1174 void *  object;
1175 } __attribute__ ((gcc_struct));
1176
1177 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1178
1179 struct DBTableEntry;
1180
1181 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1182
1183 struct DBIndexItem;
1184
1185 extern YYSTYPE yylval;
1186
1187 extern struct Location yylloc;
1188
1189 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1190
1191 extern int returnCode;
1192
1193 extern struct Expression * parsedExpression;
1194
1195 extern unsigned int yydebug;
1196
1197 void SetYydebug(unsigned int b)
1198 {
1199 yydebug = b;
1200 }
1201
1202 extern unsigned int echoOn;
1203
1204 void resetScanner();
1205
1206 int propWatcherID;
1207
1208 int expression_yyparse();
1209
1210 static struct Statement * curCompound;
1211
1212 struct External * curExternal, * afterExternal;
1213
1214 static struct Type * curSwitchType;
1215
1216 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1217
1218 struct __ecereNameSpace__ecere__com__Class * thisClass;
1219
1220 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1221 {
1222 thisClass = c;
1223 }
1224
1225 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1226 {
1227 return thisClass;
1228 }
1229
1230 static char * thisNameSpace;
1231
1232 struct __ecereNameSpace__ecere__com__Class * containerClass;
1233
1234 unsigned int thisClassParams = 0x1;
1235
1236 unsigned int internalValueCounter;
1237
1238 extern unsigned int outputLineNumbers;
1239
1240 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1241
1242 extern size_t strlen(const char * );
1243
1244 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1245
1246 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1247
1248 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1249
1250 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1251
1252 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1253
1254 void PrintExpression(struct Expression * exp, char * string)
1255 {
1256 {
1257 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1258 int count;
1259 unsigned int backOutputLineNumbers = outputLineNumbers;
1260
1261 outputLineNumbers = 0x0;
1262 if(exp)
1263 OutputExpression(exp, f);
1264 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1265 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1266
1267 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1268 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1269 count = strlen(string);
1270 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1271 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1272
1273 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1274 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1275 string[count] = '\0';
1276 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1277 outputLineNumbers = backOutputLineNumbers;
1278 }
1279 }
1280
1281 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1282
1283 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1284
1285 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1286 {
1287 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1288 {
1289 if(!param->baseType)
1290 {
1291 if(param->dataTypeString)
1292 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1293 else
1294 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1295 }
1296 return param->baseType;
1297 }
1298 return (((void *)0));
1299 }
1300
1301 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1302 {
1303 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1304 return 0x1;
1305 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1306 {
1307 return 0x0;
1308 }
1309 if(type1->kind == type2->kind)
1310 {
1311 switch(type1->kind)
1312 {
1313 case 24:
1314 case 1:
1315 case 2:
1316 case 3:
1317 case 4:
1318 case 22:
1319 case 23:
1320 if(type1->passAsTemplate && !type2->passAsTemplate)
1321 return 0x1;
1322 return type1->isSigned != type2->isSigned;
1323 case 8:
1324 return type1->_class != type2->_class;
1325 case 13:
1326 return NeedCast(type1->type, type2->type);
1327 default:
1328 return 0x1;
1329 }
1330 }
1331 return 0x1;
1332 }
1333
1334 extern int strcmp(const char * , const char * );
1335
1336 extern struct Context * curContext;
1337
1338 extern struct Context * topContext;
1339
1340 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1341
1342 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);
1343
1344 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1345
1346 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);
1347
1348 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);
1349
1350 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1351
1352 struct __ecereNameSpace__ecere__com__ClassProperty
1353 {
1354 char *  name;
1355 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1356 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1357 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1358 int depth;
1359 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1360 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1361 char *  dataTypeString;
1362 struct Type * dataType;
1363 unsigned int constant;
1364 } __attribute__ ((gcc_struct));
1365
1366 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1367
1368 extern struct Expression * QMkExpId(char *  id);
1369
1370 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1371
1372 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1373 {
1374 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1375 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1376 char *  name;
1377 int type;
1378 union
1379 {
1380 char *  dataTypeString;
1381 int memberType;
1382 } __attribute__ ((gcc_struct));
1383 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1384 void *  param;
1385 } __attribute__ ((gcc_struct));
1386
1387 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1388
1389 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1390
1391 extern void FreeIdentifier(struct Identifier * id);
1392
1393 void ProcessExpressionType(struct Expression * exp);
1394
1395 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1396
1397 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1398
1399 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1400
1401 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1402
1403 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1404
1405 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1406
1407 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1408
1409 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1410
1411 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1412 {
1413 if(exp->type == 0 && exp->identifier)
1414 {
1415 struct Identifier * id = exp->identifier;
1416 struct Context * ctx;
1417 struct Symbol * symbol = (((void *)0));
1418
1419 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1420 {
1421 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1422 {
1423 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1424 if(symbol)
1425 break;
1426 }
1427 }
1428 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1429 {
1430 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1431 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1432 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1433 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1434
1435 if(!prop)
1436 {
1437 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1438 }
1439 if(!prop && !method)
1440 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1441 if(!prop && !method && !member)
1442 {
1443 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1444 }
1445 if(prop || method || member || classProp)
1446 {
1447 exp->type = 8;
1448 exp->member.member = id;
1449 exp->member.memberType = 0;
1450 exp->member.exp = QMkExpId("this");
1451 exp->addedThis = 0x1;
1452 }
1453 else if(_class && _class->templateParams.first)
1454 {
1455 struct __ecereNameSpace__ecere__com__Class * sClass;
1456
1457 for(sClass = _class; sClass; sClass = sClass->base)
1458 {
1459 if(sClass->templateParams.first)
1460 {
1461 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1462
1463 for(param = sClass->templateParams.first; param; param = param->next)
1464 {
1465 if(param->type == 2 && !strcmp(param->name, id->string))
1466 {
1467 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1468
1469 if(argExp)
1470 {
1471 struct Declarator * decl;
1472 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1473
1474 FreeIdentifier(exp->member.member);
1475 ProcessExpressionType(argExp);
1476 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1477 exp->expType = ProcessType(specs, decl);
1478 exp->type = 5;
1479 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1480 }
1481 }
1482 }
1483 }
1484 }
1485 }
1486 }
1487 }
1488 }
1489
1490 extern int sprintf(char * , char * , ...);
1491
1492 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1493
1494 extern char *  strcat(char * , const char * );
1495
1496 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1497
1498 char * PrintInt(long long result)
1499 {
1500 char temp[100];
1501
1502 if(result > (((int)0x7fffffff)))
1503 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1504 else
1505 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1506 if(result > (((int)0x7fffffff)) || result < (((int)0x80000000)))
1507 strcat(temp, "LL");
1508 return __ecereNameSpace__ecere__sys__CopyString(temp);
1509 }
1510
1511 char * PrintUInt(uint64 result)
1512 {
1513 char temp[100];
1514
1515 if(result > (0xffffffff))
1516 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1517 else if(result > (((int)0x7fffffff)))
1518 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1519 else
1520 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1521 return __ecereNameSpace__ecere__sys__CopyString(temp);
1522 }
1523
1524 char * PrintInt64(long long result)
1525 {
1526 char temp[100];
1527
1528 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1529 return __ecereNameSpace__ecere__sys__CopyString(temp);
1530 }
1531
1532 char * PrintUInt64(uint64 result)
1533 {
1534 char temp[100];
1535
1536 if(result > (((long long)0x7fffffffffffffffLL)))
1537 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1538 else
1539 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1540 return __ecereNameSpace__ecere__sys__CopyString(temp);
1541 }
1542
1543 char * PrintHexUInt(uint64 result)
1544 {
1545 char temp[100];
1546
1547 if(result > (0xffffffff))
1548 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1549 else
1550 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1551 if(result > (0xffffffff))
1552 strcat(temp, "LL");
1553 return __ecereNameSpace__ecere__sys__CopyString(temp);
1554 }
1555
1556 char * PrintHexUInt64(uint64 result)
1557 {
1558 char temp[100];
1559
1560 if(result > (0xffffffff))
1561 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1562 else
1563 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1564 return __ecereNameSpace__ecere__sys__CopyString(temp);
1565 }
1566
1567 char * PrintShort(short result)
1568 {
1569 char temp[100];
1570
1571 sprintf(temp, "%d", (unsigned short)result);
1572 return __ecereNameSpace__ecere__sys__CopyString(temp);
1573 }
1574
1575 char * PrintUShort(unsigned short result)
1576 {
1577 char temp[100];
1578
1579 if(result > (unsigned short)32767)
1580 sprintf(temp, "0x%X", (int)result);
1581 else
1582 sprintf(temp, "%d", (int)result);
1583 return __ecereNameSpace__ecere__sys__CopyString(temp);
1584 }
1585
1586 extern int isprint(int c);
1587
1588 char * PrintChar(char result)
1589 {
1590 char temp[100];
1591
1592 if(result > (char)0 && isprint(result))
1593 sprintf(temp, "'%c'", result);
1594 else if(result < (char)0)
1595 sprintf(temp, "%d", (int)result);
1596 else
1597 sprintf(temp, "0x%X", (unsigned char)result);
1598 return __ecereNameSpace__ecere__sys__CopyString(temp);
1599 }
1600
1601 char * PrintUChar(unsigned char result)
1602 {
1603 char temp[100];
1604
1605 sprintf(temp, "0x%X", result);
1606 return __ecereNameSpace__ecere__sys__CopyString(temp);
1607 }
1608
1609 extern char *  strcpy(char * , const char * );
1610
1611 extern unsigned int (* __ecereProp_float_Get_isInf)(float this);
1612
1613 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isInf;
1614
1615 extern int (* __ecereProp_float_Get_signBit)(float this);
1616
1617 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_signBit;
1618
1619 extern unsigned int (* __ecereProp_float_Get_isNan)(float this);
1620
1621 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isNan;
1622
1623 char * PrintFloat(float result)
1624 {
1625 char temp[350];
1626
1627 if(__ecereProp_float_Get_isInf(result))
1628 {
1629 if(__ecereProp_float_Get_signBit(result))
1630 strcpy(temp, "-inf");
1631 else
1632 strcpy(temp, "inf");
1633 }
1634 else if(__ecereProp_float_Get_isNan(result))
1635 {
1636 if(__ecereProp_float_Get_signBit(result))
1637 strcpy(temp, "-nan");
1638 else
1639 strcpy(temp, "nan");
1640 }
1641 else
1642 sprintf(temp, "%.16ff", result);
1643 return __ecereNameSpace__ecere__sys__CopyString(temp);
1644 }
1645
1646 extern unsigned int (* __ecereProp_double_Get_isInf)(double this);
1647
1648 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isInf;
1649
1650 extern int (* __ecereProp_double_Get_signBit)(double this);
1651
1652 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_signBit;
1653
1654 extern unsigned int (* __ecereProp_double_Get_isNan)(double this);
1655
1656 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isNan;
1657
1658 char * PrintDouble(double result)
1659 {
1660 char temp[350];
1661
1662 if(__ecereProp_double_Get_isInf(result))
1663 {
1664 if(__ecereProp_double_Get_signBit(result))
1665 strcpy(temp, "-inf");
1666 else
1667 strcpy(temp, "inf");
1668 }
1669 else if(__ecereProp_double_Get_isNan(result))
1670 {
1671 if(__ecereProp_double_Get_signBit(result))
1672 strcpy(temp, "-nan");
1673 else
1674 strcpy(temp, "nan");
1675 }
1676 else
1677 sprintf(temp, "%.16f", result);
1678 return __ecereNameSpace__ecere__sys__CopyString(temp);
1679 }
1680
1681 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1682
1683 struct OpTable
1684 {
1685 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1686 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1687 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1688 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1689 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1690 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1691 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1692 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1693 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1694 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1695 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1696 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1697 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1698 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1699 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1700 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1701 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1702 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1703 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1704 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1705 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1706 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1707 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1708 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1709 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1710 unsigned int (*  Not)(struct Expression *, struct Operand *);
1711 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1712 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1713 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1714 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1715 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1716 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1717 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1718 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1719 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1720 } __attribute__ ((gcc_struct));
1721
1722 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1723
1724 struct Operand
1725 {
1726 int kind;
1727 struct Type * type;
1728 unsigned int ptrSize;
1729 union
1730 {
1731 char c;
1732 unsigned char uc;
1733 short s;
1734 unsigned short us;
1735 int i;
1736 unsigned int ui;
1737 float f;
1738 double d;
1739 long long i64;
1740 uint64 ui64;
1741 } __attribute__ ((gcc_struct));
1742 struct OpTable ops;
1743 } __attribute__ ((gcc_struct));
1744
1745 unsigned int GetOpInt(struct Operand * op2, int * value2)
1746 {
1747 if(op2->kind == 3 && op2->type->isSigned)
1748 *value2 = op2->i;
1749 else if(op2->kind == 3)
1750 *value2 = (int)op2->ui;
1751 else if(op2->kind == 4 && op2->type->isSigned)
1752 *value2 = (int)op2->i64;
1753 else if(op2->kind == 4)
1754 *value2 = (int)op2->ui64;
1755 else if(op2->kind == 23 && op2->type->isSigned)
1756 *value2 = (int)op2->i64;
1757 else if(op2->kind == 23)
1758 *value2 = (int)op2->ui64;
1759 else if(op2->kind == 22 && op2->type->isSigned)
1760 *value2 = (int)op2->i64;
1761 else if(op2->kind == 22)
1762 *value2 = (int)op2->ui64;
1763 else if(op2->kind == 2 && op2->type->isSigned)
1764 *value2 = (int)op2->s;
1765 else if(op2->kind == 2)
1766 *value2 = (int)op2->us;
1767 else if(op2->kind == 1 && op2->type->isSigned)
1768 *value2 = (int)op2->c;
1769 else if(op2->kind == 24 || op2->kind == 1)
1770 *value2 = (int)op2->uc;
1771 else if(op2->kind == 6)
1772 *value2 = (int)op2->f;
1773 else if(op2->kind == 7)
1774 *value2 = (int)op2->d;
1775 else if(op2->kind == 13)
1776 *value2 = (int)op2->ui64;
1777 else
1778 return 0x0;
1779 return 0x1;
1780 }
1781
1782 struct Operand GetOperand(struct Expression * exp);
1783
1784 unsigned int GetInt(struct Expression * exp, int * value2)
1785 {
1786 struct Operand op2 = GetOperand(exp);
1787
1788 return GetOpInt(&op2, value2);
1789 }
1790
1791 unsigned int GetOpUInt(struct Operand * op2, unsigned int * value2)
1792 {
1793 if(op2->kind == 3 && op2->type->isSigned)
1794 *value2 = (unsigned int)op2->i;
1795 else if(op2->kind == 3)
1796 *value2 = op2->ui;
1797 else if(op2->kind == 4 && op2->type->isSigned)
1798 *value2 = (unsigned int)op2->i64;
1799 else if(op2->kind == 4)
1800 *value2 = (unsigned int)op2->ui64;
1801 else if(op2->kind == 23 && op2->type->isSigned)
1802 *value2 = (unsigned int)op2->i64;
1803 else if(op2->kind == 23)
1804 *value2 = (unsigned int)op2->ui64;
1805 else if(op2->kind == 22 && op2->type->isSigned)
1806 *value2 = (unsigned int)op2->i64;
1807 else if(op2->kind == 22)
1808 *value2 = (unsigned int)op2->ui64;
1809 else if(op2->kind == 2 && op2->type->isSigned)
1810 *value2 = (unsigned int)op2->s;
1811 else if(op2->kind == 2)
1812 *value2 = (unsigned int)op2->us;
1813 else if(op2->kind == 1 && op2->type->isSigned)
1814 *value2 = (unsigned int)op2->c;
1815 else if(op2->kind == 24 || op2->kind == 1)
1816 *value2 = (unsigned int)op2->uc;
1817 else if(op2->kind == 6)
1818 *value2 = (unsigned int)op2->f;
1819 else if(op2->kind == 7)
1820 *value2 = (unsigned int)op2->d;
1821 else if(op2->kind == 13)
1822 *value2 = (unsigned int)op2->ui64;
1823 else
1824 return 0x0;
1825 return 0x1;
1826 }
1827
1828 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1829 {
1830 struct Operand op2 = GetOperand(exp);
1831
1832 return GetOpUInt(&op2, value2);
1833 }
1834
1835 unsigned int GetOpInt64(struct Operand * op2, long long * value2)
1836 {
1837 if(op2->kind == 3 && op2->type->isSigned)
1838 *value2 = (long long)op2->i;
1839 else if(op2->kind == 3)
1840 *value2 = (long long)op2->ui;
1841 else if(op2->kind == 4 && op2->type->isSigned)
1842 *value2 = op2->i64;
1843 else if(op2->kind == 4)
1844 *value2 = (long long)op2->ui64;
1845 else if(op2->kind == 23 && op2->type->isSigned)
1846 *value2 = op2->i64;
1847 else if(op2->kind == 23)
1848 *value2 = (long long)op2->ui64;
1849 else if(op2->kind == 22 && op2->type->isSigned)
1850 *value2 = op2->i64;
1851 else if(op2->kind == 22)
1852 *value2 = (long long)op2->ui64;
1853 else if(op2->kind == 2 && op2->type->isSigned)
1854 *value2 = (long long)op2->s;
1855 else if(op2->kind == 2)
1856 *value2 = (long long)op2->us;
1857 else if(op2->kind == 1 && op2->type->isSigned)
1858 *value2 = (long long)op2->c;
1859 else if(op2->kind == 24 || op2->kind == 1)
1860 *value2 = (long long)op2->uc;
1861 else if(op2->kind == 6)
1862 *value2 = (long long)op2->f;
1863 else if(op2->kind == 7)
1864 *value2 = (long long)op2->d;
1865 else if(op2->kind == 13)
1866 *value2 = (long long)op2->ui64;
1867 else
1868 return 0x0;
1869 return 0x1;
1870 }
1871
1872 unsigned int GetInt64(struct Expression * exp, long long * value2)
1873 {
1874 struct Operand op2 = GetOperand(exp);
1875
1876 return GetOpInt64(&op2, value2);
1877 }
1878
1879 unsigned int GetOpUInt64(struct Operand * op2, uint64 * value2)
1880 {
1881 if(op2->kind == 3 && op2->type->isSigned)
1882 *value2 = (uint64)op2->i;
1883 else if(op2->kind == 3)
1884 *value2 = (uint64)op2->ui;
1885 else if(op2->kind == 4 && op2->type->isSigned)
1886 *value2 = (uint64)op2->i64;
1887 else if(op2->kind == 4)
1888 *value2 = op2->ui64;
1889 else if(op2->kind == 23 && op2->type->isSigned)
1890 *value2 = (uint64)op2->i64;
1891 else if(op2->kind == 23)
1892 *value2 = op2->ui64;
1893 else if(op2->kind == 22 && op2->type->isSigned)
1894 *value2 = (uint64)op2->i64;
1895 else if(op2->kind == 22)
1896 *value2 = op2->ui64;
1897 else if(op2->kind == 2 && op2->type->isSigned)
1898 *value2 = (uint64)op2->s;
1899 else if(op2->kind == 2)
1900 *value2 = (uint64)op2->us;
1901 else if(op2->kind == 1 && op2->type->isSigned)
1902 *value2 = (uint64)op2->c;
1903 else if(op2->kind == 24 || op2->kind == 1)
1904 *value2 = (uint64)op2->uc;
1905 else if(op2->kind == 6)
1906 *value2 = (uint64)op2->f;
1907 else if(op2->kind == 7)
1908 *value2 = (uint64)op2->d;
1909 else if(op2->kind == 13)
1910 *value2 = op2->ui64;
1911 else
1912 return 0x0;
1913 return 0x1;
1914 }
1915
1916 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1917 {
1918 struct Operand op2 = GetOperand(exp);
1919
1920 return GetOpUInt64(&op2, value2);
1921 }
1922
1923 unsigned int GetOpIntPtr(struct Operand * op2, intptr_t * value2)
1924 {
1925 if(op2->kind == 3 && op2->type->isSigned)
1926 *value2 = (intptr_t)op2->i;
1927 else if(op2->kind == 3)
1928 *value2 = (intptr_t)op2->ui;
1929 else if(op2->kind == 4 && op2->type->isSigned)
1930 *value2 = (intptr_t)op2->i64;
1931 else if(op2->kind == 4)
1932 *value2 = (intptr_t)op2->ui64;
1933 else if(op2->kind == 23 && op2->type->isSigned)
1934 *value2 = (intptr_t)op2->i64;
1935 else if(op2->kind == 23)
1936 *value2 = (intptr_t)op2->ui64;
1937 else if(op2->kind == 22 && op2->type->isSigned)
1938 *value2 = (intptr_t)op2->i64;
1939 else if(op2->kind == 22)
1940 *value2 = (intptr_t)op2->ui64;
1941 else if(op2->kind == 2 && op2->type->isSigned)
1942 *value2 = (intptr_t)op2->s;
1943 else if(op2->kind == 2)
1944 *value2 = (intptr_t)op2->us;
1945 else if(op2->kind == 1 && op2->type->isSigned)
1946 *value2 = (intptr_t)op2->c;
1947 else if(op2->kind == 24 || op2->kind == 1)
1948 *value2 = (intptr_t)op2->uc;
1949 else if(op2->kind == 6)
1950 *value2 = (intptr_t)op2->f;
1951 else if(op2->kind == 7)
1952 *value2 = (intptr_t)op2->d;
1953 else if(op2->kind == 13)
1954 *value2 = (intptr_t)op2->ui64;
1955 else
1956 return 0x0;
1957 return 0x1;
1958 }
1959
1960 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1961 {
1962 struct Operand op2 = GetOperand(exp);
1963
1964 return GetOpIntPtr(&op2, value2);
1965 }
1966
1967 unsigned int GetOpUIntPtr(struct Operand * op2, uintptr_t * value2)
1968 {
1969 if(op2->kind == 3 && op2->type->isSigned)
1970 *value2 = (uintptr_t)op2->i;
1971 else if(op2->kind == 3)
1972 *value2 = (uintptr_t)op2->ui;
1973 else if(op2->kind == 4 && op2->type->isSigned)
1974 *value2 = (uintptr_t)op2->i64;
1975 else if(op2->kind == 4)
1976 *value2 = (uintptr_t)op2->ui64;
1977 else if(op2->kind == 23 && op2->type->isSigned)
1978 *value2 = (uintptr_t)op2->i64;
1979 else if(op2->kind == 23)
1980 *value2 = (uintptr_t)op2->ui64;
1981 else if(op2->kind == 22 && op2->type->isSigned)
1982 *value2 = (uintptr_t)op2->i64;
1983 else if(op2->kind == 22)
1984 *value2 = (uintptr_t)op2->ui64;
1985 else if(op2->kind == 2 && op2->type->isSigned)
1986 *value2 = (uintptr_t)op2->s;
1987 else if(op2->kind == 2)
1988 *value2 = (uintptr_t)op2->us;
1989 else if(op2->kind == 1 && op2->type->isSigned)
1990 *value2 = (uintptr_t)op2->c;
1991 else if(op2->kind == 24 || op2->kind == 1)
1992 *value2 = (uintptr_t)op2->uc;
1993 else if(op2->kind == 6)
1994 *value2 = (uintptr_t)op2->f;
1995 else if(op2->kind == 7)
1996 *value2 = (uintptr_t)op2->d;
1997 else if(op2->kind == 13)
1998 *value2 = (uintptr_t)op2->ui64;
1999 else
2000 return 0x0;
2001 return 0x1;
2002 }
2003
2004 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
2005 {
2006 struct Operand op2 = GetOperand(exp);
2007
2008 return GetOpUIntPtr(&op2, value2);
2009 }
2010
2011 unsigned int GetOpIntSize(struct Operand * op2, ssize_t * value2)
2012 {
2013 if(op2->kind == 3 && op2->type->isSigned)
2014 *value2 = (ssize_t)op2->i;
2015 else if(op2->kind == 3)
2016 *value2 = (ssize_t)op2->ui;
2017 else if(op2->kind == 4 && op2->type->isSigned)
2018 *value2 = (ssize_t)op2->i64;
2019 else if(op2->kind == 4)
2020 *value2 = (ssize_t)op2->ui64;
2021 else if(op2->kind == 23 && op2->type->isSigned)
2022 *value2 = (ssize_t)op2->i64;
2023 else if(op2->kind == 23)
2024 *value2 = (ssize_t)op2->ui64;
2025 else if(op2->kind == 22 && op2->type->isSigned)
2026 *value2 = (ssize_t)op2->i64;
2027 else if(op2->kind == 22)
2028 *value2 = (ssize_t)op2->ui64;
2029 else if(op2->kind == 2 && op2->type->isSigned)
2030 *value2 = (ssize_t)op2->s;
2031 else if(op2->kind == 2)
2032 *value2 = (ssize_t)op2->us;
2033 else if(op2->kind == 1 && op2->type->isSigned)
2034 *value2 = (ssize_t)op2->c;
2035 else if(op2->kind == 24 || op2->kind == 1)
2036 *value2 = (ssize_t)op2->uc;
2037 else if(op2->kind == 6)
2038 *value2 = (ssize_t)op2->f;
2039 else if(op2->kind == 7)
2040 *value2 = (ssize_t)op2->d;
2041 else if(op2->kind == 13)
2042 *value2 = (ssize_t)op2->ui64;
2043 else
2044 return 0x0;
2045 return 0x1;
2046 }
2047
2048 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
2049 {
2050 struct Operand op2 = GetOperand(exp);
2051
2052 return GetOpIntSize(&op2, value2);
2053 }
2054
2055 unsigned int GetOpUIntSize(struct Operand * op2, size_t * value2)
2056 {
2057 if(op2->kind == 3 && op2->type->isSigned)
2058 *value2 = (size_t)op2->i;
2059 else if(op2->kind == 3)
2060 *value2 = (size_t)op2->ui;
2061 else if(op2->kind == 4 && op2->type->isSigned)
2062 *value2 = (size_t)op2->i64;
2063 else if(op2->kind == 4)
2064 *value2 = (size_t)op2->ui64;
2065 else if(op2->kind == 23 && op2->type->isSigned)
2066 *value2 = (size_t)op2->i64;
2067 else if(op2->kind == 23)
2068 *value2 = (size_t)op2->ui64;
2069 else if(op2->kind == 22 && op2->type->isSigned)
2070 *value2 = (size_t)op2->i64;
2071 else if(op2->kind == 22)
2072 *value2 = (size_t)op2->ui64;
2073 else if(op2->kind == 2 && op2->type->isSigned)
2074 *value2 = (size_t)op2->s;
2075 else if(op2->kind == 2)
2076 *value2 = (size_t)op2->us;
2077 else if(op2->kind == 1 && op2->type->isSigned)
2078 *value2 = (size_t)op2->c;
2079 else if(op2->kind == 24 || op2->kind == 1)
2080 *value2 = (size_t)op2->uc;
2081 else if(op2->kind == 6)
2082 *value2 = (size_t)op2->f;
2083 else if(op2->kind == 7)
2084 *value2 = (size_t)op2->d;
2085 else if(op2->kind == 13)
2086 *value2 = (size_t)op2->ui64;
2087 else
2088 return 0x0;
2089 return 0x1;
2090 }
2091
2092 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
2093 {
2094 struct Operand op2 = GetOperand(exp);
2095
2096 return GetOpUIntSize(&op2, value2);
2097 }
2098
2099 unsigned int GetOpShort(struct Operand * op2, short * value2)
2100 {
2101 if(op2->kind == 3 && op2->type->isSigned)
2102 *value2 = (short)op2->i;
2103 else if(op2->kind == 3)
2104 *value2 = (short)op2->ui;
2105 else if(op2->kind == 4 && op2->type->isSigned)
2106 *value2 = (short)op2->i64;
2107 else if(op2->kind == 4)
2108 *value2 = (short)op2->ui64;
2109 else if(op2->kind == 23 && op2->type->isSigned)
2110 *value2 = (short)op2->i64;
2111 else if(op2->kind == 23)
2112 *value2 = (short)op2->ui64;
2113 else if(op2->kind == 22 && op2->type->isSigned)
2114 *value2 = (short)op2->i64;
2115 else if(op2->kind == 22)
2116 *value2 = (short)op2->ui64;
2117 else if(op2->kind == 2 && op2->type->isSigned)
2118 *value2 = op2->s;
2119 else if(op2->kind == 2)
2120 *value2 = (short)op2->us;
2121 else if(op2->kind == 1 && op2->type->isSigned)
2122 *value2 = (short)op2->c;
2123 else if(op2->kind == 24 || op2->kind == 1)
2124 *value2 = (short)op2->uc;
2125 else if(op2->kind == 6)
2126 *value2 = (short)op2->f;
2127 else if(op2->kind == 7)
2128 *value2 = (short)op2->d;
2129 else if(op2->kind == 13)
2130 *value2 = (short)op2->ui64;
2131 else
2132 return 0x0;
2133 return 0x1;
2134 }
2135
2136 unsigned int GetShort(struct Expression * exp, short * value2)
2137 {
2138 struct Operand op2 = GetOperand(exp);
2139
2140 return GetOpShort(&op2, value2);
2141 }
2142
2143 unsigned int GetOpUShort(struct Operand * op2, unsigned short * value2)
2144 {
2145 if(op2->kind == 3 && op2->type->isSigned)
2146 *value2 = (unsigned short)op2->i;
2147 else if(op2->kind == 3)
2148 *value2 = (unsigned short)op2->ui;
2149 else if(op2->kind == 4 && op2->type->isSigned)
2150 *value2 = (unsigned short)op2->i64;
2151 else if(op2->kind == 4)
2152 *value2 = (unsigned short)op2->ui64;
2153 else if(op2->kind == 23 && op2->type->isSigned)
2154 *value2 = (unsigned short)op2->i64;
2155 else if(op2->kind == 23)
2156 *value2 = (unsigned short)op2->ui64;
2157 else if(op2->kind == 22 && op2->type->isSigned)
2158 *value2 = (unsigned short)op2->i64;
2159 else if(op2->kind == 22)
2160 *value2 = (unsigned short)op2->ui64;
2161 else if(op2->kind == 2 && op2->type->isSigned)
2162 *value2 = (unsigned short)op2->s;
2163 else if(op2->kind == 2)
2164 *value2 = op2->us;
2165 else if(op2->kind == 1 && op2->type->isSigned)
2166 *value2 = (unsigned short)op2->c;
2167 else if(op2->kind == 24 || op2->kind == 1)
2168 *value2 = (unsigned short)op2->uc;
2169 else if(op2->kind == 6)
2170 *value2 = (unsigned short)op2->f;
2171 else if(op2->kind == 7)
2172 *value2 = (unsigned short)op2->d;
2173 else if(op2->kind == 13)
2174 *value2 = (unsigned short)op2->ui64;
2175 else
2176 return 0x0;
2177 return 0x1;
2178 }
2179
2180 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2181 {
2182 struct Operand op2 = GetOperand(exp);
2183
2184 return GetOpUShort(&op2, value2);
2185 }
2186
2187 unsigned int GetOpChar(struct Operand * op2, char * value2)
2188 {
2189 if(op2->kind == 3 && op2->type->isSigned)
2190 *value2 = (char)op2->i;
2191 else if(op2->kind == 3)
2192 *value2 = (char)op2->ui;
2193 else if(op2->kind == 4 && op2->type->isSigned)
2194 *value2 = (char)op2->i64;
2195 else if(op2->kind == 4)
2196 *value2 = (char)op2->ui64;
2197 else if(op2->kind == 23 && op2->type->isSigned)
2198 *value2 = (char)op2->i64;
2199 else if(op2->kind == 23)
2200 *value2 = (char)op2->ui64;
2201 else if(op2->kind == 22 && op2->type->isSigned)
2202 *value2 = (char)op2->i64;
2203 else if(op2->kind == 22)
2204 *value2 = (char)op2->ui64;
2205 else if(op2->kind == 2 && op2->type->isSigned)
2206 *value2 = (char)op2->s;
2207 else if(op2->kind == 2)
2208 *value2 = (char)op2->us;
2209 else if(op2->kind == 1 && op2->type->isSigned)
2210 *value2 = op2->c;
2211 else if(op2->kind == 24 || op2->kind == 1)
2212 *value2 = (char)op2->uc;
2213 else if(op2->kind == 6)
2214 *value2 = (char)op2->f;
2215 else if(op2->kind == 7)
2216 *value2 = (char)op2->d;
2217 else if(op2->kind == 13)
2218 *value2 = (char)op2->ui64;
2219 else
2220 return 0x0;
2221 return 0x1;
2222 }
2223
2224 unsigned int GetChar(struct Expression * exp, char * value2)
2225 {
2226 struct Operand op2 = GetOperand(exp);
2227
2228 return GetOpChar(&op2, value2);
2229 }
2230
2231 unsigned int GetOpUChar(struct Operand * op2, unsigned char * value2)
2232 {
2233 if(op2->kind == 3 && op2->type->isSigned)
2234 *value2 = (unsigned char)op2->i;
2235 else if(op2->kind == 3)
2236 *value2 = (unsigned char)op2->ui;
2237 else if(op2->kind == 4 && op2->type->isSigned)
2238 *value2 = (unsigned char)op2->i64;
2239 else if(op2->kind == 4)
2240 *value2 = (unsigned char)op2->ui64;
2241 else if(op2->kind == 23 && op2->type->isSigned)
2242 *value2 = (unsigned char)op2->i64;
2243 else if(op2->kind == 23)
2244 *value2 = (unsigned char)op2->ui64;
2245 else if(op2->kind == 22 && op2->type->isSigned)
2246 *value2 = (unsigned char)op2->i64;
2247 else if(op2->kind == 22)
2248 *value2 = (unsigned char)op2->ui64;
2249 else if(op2->kind == 2 && op2->type->isSigned)
2250 *value2 = (unsigned char)op2->s;
2251 else if(op2->kind == 2)
2252 *value2 = (unsigned char)op2->us;
2253 else if(op2->kind == 1 && op2->type->isSigned)
2254 *value2 = (unsigned char)op2->c;
2255 else if(op2->kind == 24 || op2->kind == 1)
2256 *value2 = op2->uc;
2257 else if(op2->kind == 6)
2258 *value2 = (unsigned char)op2->f;
2259 else if(op2->kind == 7)
2260 *value2 = (unsigned char)op2->d;
2261 else if(op2->kind == 13)
2262 *value2 = (unsigned char)op2->ui64;
2263 else
2264 return 0x0;
2265 return 0x1;
2266 }
2267
2268 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2269 {
2270 struct Operand op2 = GetOperand(exp);
2271
2272 return GetOpUChar(&op2, value2);
2273 }
2274
2275 unsigned int GetOpFloat(struct Operand * op2, float * value2)
2276 {
2277 if(op2->kind == 3 && op2->type->isSigned)
2278 *value2 = (float)(float)op2->i;
2279 else if(op2->kind == 3)
2280 *value2 = (float)(float)op2->ui;
2281 else if(op2->kind == 4 && op2->type->isSigned)
2282 *value2 = (float)(float)op2->i64;
2283 else if(op2->kind == 4)
2284 *value2 = (float)(float)op2->ui64;
2285 else if(op2->kind == 23 && op2->type->isSigned)
2286 *value2 = (float)(float)op2->i64;
2287 else if(op2->kind == 23)
2288 *value2 = (float)(float)op2->ui64;
2289 else if(op2->kind == 22 && op2->type->isSigned)
2290 *value2 = (float)(float)op2->i64;
2291 else if(op2->kind == 22)
2292 *value2 = (float)(float)op2->ui64;
2293 else if(op2->kind == 2 && op2->type->isSigned)
2294 *value2 = (float)(float)op2->s;
2295 else if(op2->kind == 2)
2296 *value2 = (float)(float)op2->us;
2297 else if(op2->kind == 1 && op2->type->isSigned)
2298 *value2 = (float)(float)op2->c;
2299 else if(op2->kind == 24 || op2->kind == 1)
2300 *value2 = (float)(float)op2->uc;
2301 else if(op2->kind == 6)
2302 *value2 = (float)op2->f;
2303 else if(op2->kind == 7)
2304 *value2 = (float)op2->d;
2305 else if(op2->kind == 13)
2306 *value2 = (float)(float)op2->ui64;
2307 else
2308 return 0x0;
2309 return 0x1;
2310 }
2311
2312 unsigned int GetFloat(struct Expression * exp, float * value2)
2313 {
2314 struct Operand op2 = GetOperand(exp);
2315
2316 return GetOpFloat(&op2, value2);
2317 }
2318
2319 unsigned int GetOpDouble(struct Operand * op2, double * value2)
2320 {
2321 if(op2->kind == 3 && op2->type->isSigned)
2322 *value2 = (double)(double)op2->i;
2323 else if(op2->kind == 3)
2324 *value2 = (double)(double)op2->ui;
2325 else if(op2->kind == 4 && op2->type->isSigned)
2326 *value2 = (double)(double)op2->i64;
2327 else if(op2->kind == 4)
2328 *value2 = (double)(double)op2->ui64;
2329 else if(op2->kind == 23 && op2->type->isSigned)
2330 *value2 = (double)(double)op2->i64;
2331 else if(op2->kind == 23)
2332 *value2 = (double)(double)op2->ui64;
2333 else if(op2->kind == 22 && op2->type->isSigned)
2334 *value2 = (double)(double)op2->i64;
2335 else if(op2->kind == 22)
2336 *value2 = (double)(double)op2->ui64;
2337 else if(op2->kind == 2 && op2->type->isSigned)
2338 *value2 = (double)(double)op2->s;
2339 else if(op2->kind == 2)
2340 *value2 = (double)(double)op2->us;
2341 else if(op2->kind == 1 && op2->type->isSigned)
2342 *value2 = (double)(double)op2->c;
2343 else if(op2->kind == 24 || op2->kind == 1)
2344 *value2 = (double)(double)op2->uc;
2345 else if(op2->kind == 6)
2346 *value2 = (double)op2->f;
2347 else if(op2->kind == 7)
2348 *value2 = (double)op2->d;
2349 else if(op2->kind == 13)
2350 *value2 = (double)(double)op2->ui64;
2351 else
2352 return 0x0;
2353 return 0x1;
2354 }
2355
2356 unsigned int GetDouble(struct Expression * exp, double * value2)
2357 {
2358 struct Operand op2 = GetOperand(exp);
2359
2360 return GetOpDouble(&op2, value2);
2361 }
2362
2363 void ComputeExpression(struct Expression * exp);
2364
2365 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2366
2367 extern int targetBits;
2368
2369 int ComputeTypeSize(struct Type * type);
2370
2371 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2372
2373 struct __ecereNameSpace__ecere__com__BitMember
2374 {
2375 struct __ecereNameSpace__ecere__com__BitMember * prev;
2376 struct __ecereNameSpace__ecere__com__BitMember * next;
2377 char *  name;
2378 unsigned int isProperty;
2379 int memberAccess;
2380 int id;
2381 struct __ecereNameSpace__ecere__com__Class * _class;
2382 char *  dataTypeString;
2383 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2384 struct Type * dataType;
2385 int type;
2386 int size;
2387 int pos;
2388 uint64 mask;
2389 } __attribute__ ((gcc_struct));
2390
2391 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2392
2393 struct __ecereNameSpace__ecere__sys__OldLink
2394 {
2395 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2396 struct __ecereNameSpace__ecere__sys__OldLink * next;
2397 void *  data;
2398 } __attribute__ ((gcc_struct));
2399
2400 void FinishTemplatesContext(struct Context * context);
2401
2402 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2403 {
2404 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2405 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2406
2407 if(member || ((_class->type == 2 || _class->type == 0 || _class->type == 1 || _class->type == 5) && (_class->type == 2 || (!_class->structSize || _class->structSize == _class->offset)) && _class->computeSize))
2408 {
2409 int unionMemberOffset = 0;
2410 int bitFields = 0;
2411
2412 if(member)
2413 {
2414 member->memberOffset = 0;
2415 if(targetBits < sizeof(void *) * 8)
2416 member->structAlignment = 0;
2417 }
2418 else if(targetBits < sizeof(void *) * 8)
2419 _class->structAlignment = 0;
2420 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2421 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2422 if(!member && _class->destructionWatchOffset)
2423 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2424 {
2425 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2426
2427 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2428 {
2429 if(!dataMember->isProperty)
2430 {
2431 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2432 {
2433 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2434 }
2435 }
2436 }
2437 }
2438 {
2439 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2440
2441 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2442 {
2443 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2444 {
2445 if(!isMember && _class->type == 2 && dataMember->dataType)
2446 {
2447 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2448 uint64 mask = 0;
2449 int d;
2450
2451 ComputeTypeSize(dataMember->dataType);
2452 if(bitMember->pos == -1)
2453 bitMember->pos = _class->memberOffset;
2454 if(!bitMember->size)
2455 bitMember->size = dataMember->dataType->size * 8;
2456 _class->memberOffset = bitMember->pos + bitMember->size;
2457 for(d = 0; d < bitMember->size; d++)
2458 {
2459 if(d)
2460 mask <<= 1;
2461 mask |= 1;
2462 }
2463 bitMember->mask = mask << bitMember->pos;
2464 }
2465 else if(dataMember->type == 0 && dataMember->dataType)
2466 {
2467 int size;
2468 int alignment = 0;
2469
2470 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2471 ComputeTypeSize(dataMember->dataType);
2472 if(dataMember->dataType->bitFieldCount)
2473 {
2474 bitFields += dataMember->dataType->bitFieldCount;
2475 size = 0;
2476 }
2477 else
2478 {
2479 if(bitFields)
2480 {
2481 int size = (bitFields + 7) / 8;
2482
2483 if(isMember)
2484 {
2485 int __simpleStruct0;
2486
2487 if(alignment)
2488 {
2489 int __simpleStruct0;
2490
2491 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2492 if(member->memberOffset % alignment)
2493 member->memberOffset += alignment - (member->memberOffset % alignment);
2494 }
2495 dataMember->offset = member->memberOffset;
2496 if(member->type == 1)
2497 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2498 else
2499 {
2500 member->memberOffset += size;
2501 }
2502 }
2503 else
2504 {
2505 if(alignment)
2506 {
2507 int __simpleStruct0;
2508
2509 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2510 if(_class->memberOffset % alignment)
2511 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2512 }
2513 dataMember->offset = _class->memberOffset;
2514 _class->memberOffset += size;
2515 }
2516 bitFields = 0;
2517 }
2518 size = dataMember->dataType->size;
2519 alignment = dataMember->dataType->alignment;
2520 }
2521 if(isMember)
2522 {
2523 int __simpleStruct0;
2524
2525 if(alignment)
2526 {
2527 int __simpleStruct0;
2528
2529 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2530 if(member->memberOffset % alignment)
2531 member->memberOffset += alignment - (member->memberOffset % alignment);
2532 }
2533 dataMember->offset = member->memberOffset;
2534 if(member->type == 1)
2535 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2536 else
2537 {
2538 member->memberOffset += size;
2539 }
2540 }
2541 else
2542 {
2543 if(alignment)
2544 {
2545 int __simpleStruct0;
2546
2547 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2548 if(_class->memberOffset % alignment)
2549 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2550 }
2551 dataMember->offset = _class->memberOffset;
2552 _class->memberOffset += size;
2553 }
2554 }
2555 else
2556 {
2557 int alignment;
2558
2559 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2560 alignment = dataMember->structAlignment;
2561 if(isMember)
2562 {
2563 int __simpleStruct0;
2564
2565 if(alignment)
2566 {
2567 int __simpleStruct0;
2568
2569 if(member->memberOffset % alignment)
2570 member->memberOffset += alignment - (member->memberOffset % alignment);
2571 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2572 }
2573 dataMember->offset = member->memberOffset;
2574 if(member->type == 1)
2575 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2576 else
2577 member->memberOffset += dataMember->memberOffset;
2578 }
2579 else
2580 {
2581 if(alignment)
2582 {
2583 int __simpleStruct0;
2584
2585 if(_class->memberOffset % alignment)
2586 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2587 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2588 }
2589 dataMember->offset = _class->memberOffset;
2590 _class->memberOffset += dataMember->memberOffset;
2591 }
2592 }
2593 }
2594 }
2595 if(bitFields)
2596 {
2597 int alignment = 0;
2598 int size = (bitFields + 7) / 8;
2599
2600 if(isMember)
2601 {
2602 int __simpleStruct0;
2603
2604 if(alignment)
2605 {
2606 int __simpleStruct0;
2607
2608 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2609 if(member->memberOffset % alignment)
2610 member->memberOffset += alignment - (member->memberOffset % alignment);
2611 }
2612 if(member->type == 1)
2613 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2614 else
2615 {
2616 member->memberOffset += size;
2617 }
2618 }
2619 else
2620 {
2621 if(alignment)
2622 {
2623 int __simpleStruct0;
2624
2625 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2626 if(_class->memberOffset % alignment)
2627 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2628 }
2629 _class->memberOffset += size;
2630 }
2631 bitFields = 0;
2632 }
2633 }
2634 if(member && member->type == 1)
2635 {
2636 member->memberOffset = unionMemberOffset;
2637 }
2638 if(!isMember)
2639 {
2640 if(_class->type != 2)
2641 {
2642 int extra = 0;
2643
2644 if(_class->structAlignment)
2645 {
2646 if(_class->memberOffset % _class->structAlignment)
2647 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2648 }
2649 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2650 if(!member)
2651 {
2652 struct __ecereNameSpace__ecere__com__Property * prop;
2653
2654 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2655 {
2656 if(prop->isProperty && prop->isWatchable)
2657 {
2658 prop->watcherOffset = _class->structSize;
2659 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2660 }
2661 }
2662 }
2663 {
2664 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2665
2666 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2667 {
2668 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2669
2670 if(deriv->computeSize)
2671 {
2672 deriv->offset = _class->structSize;
2673 deriv->memberOffset = 0;
2674 deriv->structSize = deriv->offset;
2675 ComputeClassMembers(deriv, 0x0);
2676 }
2677 }
2678 }
2679 }
2680 }
2681 }
2682 if(context)
2683 FinishTemplatesContext(context);
2684 }
2685
2686 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2687
2688 struct __ecereNameSpace__ecere__com__NameSpace
2689 {
2690 char *  name;
2691 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2692 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2693 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2694 int depth;
2695 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2696 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2697 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2698 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2699 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2700 } __attribute__ ((gcc_struct));
2701
2702 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2703
2704 struct __ecereNameSpace__ecere__com__Module
2705 {
2706 struct __ecereNameSpace__ecere__com__Instance * application;
2707 struct __ecereNameSpace__ecere__sys__OldList classes;
2708 struct __ecereNameSpace__ecere__sys__OldList defines;
2709 struct __ecereNameSpace__ecere__sys__OldList functions;
2710 struct __ecereNameSpace__ecere__sys__OldList modules;
2711 struct __ecereNameSpace__ecere__com__Instance * prev;
2712 struct __ecereNameSpace__ecere__com__Instance * next;
2713 char *  name;
2714 void *  library;
2715 void *  Unload;
2716 int importType;
2717 int origImportType;
2718 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2719 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2720 } __attribute__ ((gcc_struct));
2721
2722 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2723 {
2724 struct __ecereNameSpace__ecere__com__Class * _class;
2725 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2726
2727 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2728 ComputeModuleClasses(subModule->data);
2729 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2730 ComputeClassMembers(_class, 0x0);
2731 }
2732
2733 extern unsigned int inCompiler;
2734
2735 extern void Compiler_Error(char *  format, ...);
2736
2737 extern char *  __ecereNameSpace__ecere__GetTranslatedString(char * name, char *  string, char *  stringAndContext);
2738
2739 int ComputeTypeSize(struct Type * type)
2740 {
2741 unsigned int size = type ? type->size : 0;
2742
2743 if(!size && type && !type->computing)
2744 {
2745 type->computing = 0x1;
2746 switch(type->kind)
2747 {
2748 case 24:
2749 type->alignment = size = sizeof(char);
2750 break;
2751 case 1:
2752 type->alignment = size = sizeof(char);
2753 break;
2754 case 3:
2755 type->alignment = size = sizeof(int);
2756 break;
2757 case 4:
2758 type->alignment = size = sizeof(long long);
2759 break;
2760 case 22:
2761 type->alignment = size = targetBits / 8;
2762 break;
2763 case 23:
2764 type->alignment = size = targetBits / 8;
2765 break;
2766 case 5:
2767 type->alignment = size = sizeof(long);
2768 break;
2769 case 2:
2770 type->alignment = size = sizeof(short);
2771 break;
2772 case 6:
2773 type->alignment = size = sizeof(float);
2774 break;
2775 case 7:
2776 type->alignment = size = sizeof(double);
2777 break;
2778 case 8:
2779 {
2780 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2781
2782 if(_class && _class->type == 1)
2783 {
2784 ComputeClassMembers(_class, 0x0);
2785 type->alignment = _class->structAlignment;
2786 size = _class->structSize;
2787 if(type->alignment && size % type->alignment)
2788 size += type->alignment - (size % type->alignment);
2789 }
2790 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2791 {
2792 if(!_class->dataType)
2793 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2794 size = type->alignment = ComputeTypeSize(_class->dataType);
2795 }
2796 else
2797 size = type->alignment = targetBits / 8;
2798 break;
2799 }
2800 case 13:
2801 case 19:
2802 size = type->alignment = targetBits / 8;
2803 break;
2804 case 12:
2805 if(type->arraySizeExp)
2806 {
2807 ProcessExpressionType(type->arraySizeExp);
2808 ComputeExpression(type->arraySizeExp);
2809 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 2 && type->arraySizeExp->expType->kind != 1 && type->arraySizeExp->expType->kind != 5 && type->arraySizeExp->expType->kind != 4 && type->arraySizeExp->expType->kind != 23 && type->arraySizeExp->expType->kind != 22 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2810 {
2811 struct Location oldLoc = yylloc;
2812 char expression[10240];
2813
2814 expression[0] = '\0';
2815 type->arraySizeExp->expType = (((void *)0));
2816 yylloc = type->arraySizeExp->loc;
2817 if(inCompiler)
2818 PrintExpression(type->arraySizeExp, expression);
2819 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Array size not constant int (%s)\n", (((void *)0))), expression);
2820 yylloc = oldLoc;
2821 }
2822 GetInt(type->arraySizeExp, &type->arraySize);
2823 }
2824 else if(type->enumClass)
2825 {
2826 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2827 {
2828 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2829 }
2830 else
2831 type->arraySize = 0;
2832 }
2833 else
2834 {
2835 type->arraySize = 0;
2836 }
2837 size = ComputeTypeSize(type->type) * type->arraySize;
2838 if(type->type)
2839 type->alignment = type->type->alignment;
2840 break;
2841 case 9:
2842 {
2843 struct Type * member;
2844
2845 for(member = type->members.first; member; member = member->next)
2846 {
2847 int __simpleStruct0, __simpleStruct1;
2848 unsigned int addSize = ComputeTypeSize(member);
2849
2850 member->offset = size;
2851 if(member->alignment && size % member->alignment)
2852 member->offset += member->alignment - (size % member->alignment);
2853 size = member->offset;
2854 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2855 size += addSize;
2856 }
2857 if(type->alignment && size % type->alignment)
2858 size += type->alignment - (size % type->alignment);
2859 break;
2860 }
2861 case 10:
2862 {
2863 struct Type * member;
2864
2865 for(member = type->members.first; member; member = member->next)
2866 {
2867 int __simpleStruct0, __simpleStruct1;
2868 unsigned int addSize = ComputeTypeSize(member);
2869
2870 member->offset = size;
2871 if(member->alignment && size % member->alignment)
2872 member->offset += member->alignment - (size % member->alignment);
2873 size = member->offset;
2874 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2875 size = ((size > addSize) ? size : addSize);
2876 }
2877 if(type->alignment && size % type->alignment)
2878 size += type->alignment - (size % type->alignment);
2879 break;
2880 }
2881 case 20:
2882 {
2883 struct TemplateParameter * param = type->templateParameter;
2884 struct Type * baseType = ProcessTemplateParameterType(param);
2885
2886 if(baseType)
2887 {
2888 size = ComputeTypeSize(baseType);
2889 type->alignment = baseType->alignment;
2890 }
2891 else
2892 type->alignment = size = sizeof(uint64);
2893 break;
2894 }
2895 case 15:
2896 {
2897 type->alignment = size = sizeof(enum
2898 {
2899 test
2900 });
2901 break;
2902 }
2903 case 21:
2904 {
2905 type->alignment = size = targetBits / 8;
2906 break;
2907 }
2908 }
2909 type->size = size;
2910 type->computing = 0x0;
2911 }
2912 return size;
2913 }
2914
2915 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2916
2917 extern struct Identifier * MkIdentifier(char *  string);
2918
2919 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2920
2921 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2922
2923 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2924
2925 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2926
2927 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2928
2929 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2930
2931 extern void FreeType(struct Type * type);
2932
2933 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2934
2935 extern struct Specifier * MkSpecifier(int specifier);
2936
2937 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2938
2939 extern struct Expression * MkExpConstant(char *  string);
2940
2941 int AddMembers(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember, unsigned int * retSize, struct __ecereNameSpace__ecere__com__Class * topClass, unsigned int * addedPadding)
2942 {
2943 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2944 unsigned int totalSize = 0;
2945 unsigned int maxSize = 0;
2946 int alignment;
2947 unsigned int size;
2948 struct __ecereNameSpace__ecere__com__DataMember * member;
2949 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2950
2951 if(addedPadding)
2952 *addedPadding = 0x0;
2953 if(!isMember && _class->base)
2954 {
2955 maxSize = _class->structSize;
2956 {
2957 if(_class->type == 1 || _class->type == 5)
2958 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2959 else
2960 {
2961 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2962
2963 if(maxSize > baseSize)
2964 maxSize -= baseSize;
2965 else
2966 maxSize = 0;
2967 }
2968 }
2969 }
2970 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2971 {
2972 if(!member->isProperty)
2973 {
2974 switch(member->type)
2975 {
2976 case 0:
2977 {
2978 if(member->dataTypeString)
2979 {
2980 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2981 struct Declarator * decl;
2982
2983 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2984 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2985 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2986 if(!member->dataType)
2987 member->dataType = ProcessType(specs, decl);
2988 ReplaceThisClassSpecifiers(specs, topClass);
2989 {
2990 struct Type * type = ProcessType(specs, decl);
2991
2992 DeclareType(member->dataType, 0x0, 0x0);
2993 FreeType(type);
2994 }
2995 ComputeTypeSize(member->dataType);
2996 size = member->dataType->size;
2997 alignment = member->dataType->alignment;
2998 if(alignment)
2999 {
3000 if(totalSize % alignment)
3001 totalSize += alignment - (totalSize % alignment);
3002 }
3003 totalSize += size;
3004 }
3005 break;
3006 }
3007 case 1:
3008 case 2:
3009 {
3010 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
3011
3012 size = 0;
3013 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
3014 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
3015 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
3016 alignment = member->structAlignment;
3017 if(alignment)
3018 {
3019 if(totalSize % alignment)
3020 totalSize += alignment - (totalSize % alignment);
3021 }
3022 totalSize += size;
3023 break;
3024 }
3025 }
3026 }
3027 }
3028 if(retSize)
3029 {
3030 unsigned int __simpleStruct0;
3031
3032 if(topMember && topMember->type == 1)
3033 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
3034 else
3035 *retSize += totalSize;
3036 }
3037 else if(totalSize < maxSize && _class->type != 1000)
3038 {
3039 int autoPadding = 0;
3040
3041 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
3042 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
3043 if(totalSize + autoPadding < maxSize)
3044 {
3045 char sizeString[50];
3046
3047 sprintf(sizeString, "%d", maxSize - totalSize);
3048 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
3049 if(addedPadding)
3050 *addedPadding = 0x1;
3051 }
3052 }
3053 if(context)
3054 FinishTemplatesContext(context);
3055 return topMember ? topMember->memberID : _class->memberID;
3056 }
3057
3058 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
3059 {
3060 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
3061 struct __ecereNameSpace__ecere__com__DataMember * member;
3062 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
3063
3064 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
3065 DeclareMembers(_class->base, 0x0);
3066 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
3067 {
3068 if(!member->isProperty)
3069 {
3070 switch(member->type)
3071 {
3072 case 0:
3073 {
3074 if(!member->dataType && member->dataTypeString)
3075 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
3076 if(member->dataType)
3077 DeclareType(member->dataType, 0x0, 0x0);
3078 break;
3079 }
3080 case 1:
3081 case 2:
3082 {
3083 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
3084 break;
3085 }
3086 }
3087 }
3088 }
3089 if(context)
3090 FinishTemplatesContext(context);
3091 return topMember ? topMember->memberID : _class->memberID;
3092 }
3093
3094 extern struct Symbol * FindClass(char *  name);
3095
3096 extern char *  strchr(const char * , int);
3097
3098 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
3099
3100 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
3101
3102 extern void FreeClassDef(struct ClassDef * def);
3103
3104 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
3105
3106 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
3107
3108 extern void MangleClassName(char *  className);
3109
3110 extern void DeclareClass(struct Symbol * classSym, char *  className);
3111
3112 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
3113
3114 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
3115
3116 void DeclareStruct(char * name, unsigned int skipNoHead)
3117 {
3118 struct External * external = (((void *)0));
3119 struct Symbol * classSym = FindClass(name);
3120
3121 if(!inCompiler || !classSym)
3122 return ;
3123 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
3124 return ;
3125 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
3126 {
3127 struct Declaration * decl;
3128 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3129 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
3130 char structName[1024];
3131 struct Specifier * spec = (((void *)0));
3132
3133 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
3134 classSym->declaring++;
3135 if(strchr(classSym->string, '<'))
3136 {
3137 if(classSym->registered->templateClass)
3138 {
3139 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
3140 classSym->declaring--;
3141 }
3142 return ;
3143 }
3144 DeclareMembers(classSym->registered, 0x0);
3145 structName[0] = (char)0;
3146 FullClassNameCat(structName, name, 0x0);
3147 if(external && external->declaration && external->declaration->specifiers)
3148 {
3149 for(spec = (*external->declaration->specifiers).first; spec; spec = spec->next)
3150 {
3151 if(spec->type == 3 || spec->type == 4)
3152 break;
3153 }
3154 }
3155 if(!skipNoHead && (!spec || !spec->definitions))
3156 {
3157 unsigned int addedPadding = 0x0;
3158
3159 classSym->declaredStructSym = 0x1;
3160 declarations = MkList();
3161 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
3162 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
3163 {
3164 FreeList(declarations, FreeClassDef);
3165 declarations = (((void *)0));
3166 }
3167 }
3168 if(skipNoHead || declarations)
3169 {
3170 if(spec)
3171 {
3172 if(declarations)
3173 spec->definitions = declarations;
3174 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3175 {
3176 if(classSym->structExternal)
3177 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3178 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3179 classSym->id = curExternal->symbol->idCode;
3180 classSym->idCode = curExternal->symbol->idCode;
3181 }
3182 }
3183 else
3184 {
3185 if(!external)
3186 external = MkExternalDeclaration((((void *)0)));
3187 specifiers = MkList();
3188 declarators = MkList();
3189 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3190 external->declaration = decl = MkDeclaration(specifiers, declarators);
3191 if(decl->symbol && !decl->symbol->pointerExternal)
3192 decl->symbol->pointerExternal = external;
3193 if(classSym->registered && classSym->registered->type == 1)
3194 {
3195 char className[1024];
3196
3197 strcpy(className, "__ecereClass_");
3198 FullClassNameCat(className, classSym->string, 0x1);
3199 MangleClassName(className);
3200 DeclareClass(classSym, className);
3201 external->symbol = classSym;
3202 classSym->pointerExternal = external;
3203 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3204 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3205 }
3206 else
3207 {
3208 char className[1024];
3209
3210 strcpy(className, "__ecereClass_");
3211 FullClassNameCat(className, classSym->string, 0x1);
3212 MangleClassName(className);
3213 classSym->structExternal = external;
3214 DeclareClass(classSym, className);
3215 external->symbol = classSym;
3216 }
3217 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3218 }
3219 }
3220 classSym->declaring--;
3221 }
3222 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3223 {
3224 classSym->declaring++;
3225 {
3226 if(classSym->registered)
3227 DeclareMembers(classSym->registered, 0x0);
3228 }
3229 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3230 {
3231 if(classSym->structExternal)
3232 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3233 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3234 classSym->id = curExternal->symbol->idCode;
3235 classSym->idCode = curExternal->symbol->idCode;
3236 }
3237 classSym->declaring--;
3238 }
3239 }
3240
3241 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3242
3243 extern struct ModuleImport * mainModule;
3244
3245 extern struct Specifier * MkSpecifierName(char *  name);
3246
3247 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3248
3249 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3250
3251 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3252
3253 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3254
3255 extern void FreeDeclarator(struct Declarator * decl);
3256
3257 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3258
3259 struct PropertyImport
3260 {
3261 struct PropertyImport * prev;
3262 struct PropertyImport * next;
3263 char *  name;
3264 unsigned int isVirtual;
3265 unsigned int hasSet;
3266 unsigned int hasGet;
3267 } __attribute__ ((gcc_struct));
3268
3269 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3270
3271 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3272 {
3273 struct Symbol * symbol = prop->symbol;
3274 char propName[1024];
3275
3276 strcpy(setName, "__ecereProp_");
3277 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3278 strcat(setName, "_Set_");
3279 FullClassNameCat(setName, prop->name, 0x1);
3280 strcpy(getName, "__ecereProp_");
3281 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3282 strcat(getName, "_Get_");
3283 FullClassNameCat(getName, prop->name, 0x1);
3284 strcpy(propName, "__ecereProp_");
3285 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3286 strcat(propName, "_");
3287 FullClassNameCat(propName, prop->name, 0x1);
3288 MangleClassName(getName);
3289 MangleClassName(setName);
3290 MangleClassName(propName);
3291 if(prop->_class->type == 1)
3292 DeclareStruct(prop->_class->fullName, 0x0);
3293 if(!symbol || curExternal->symbol->idCode < symbol->id)
3294 {
3295 unsigned int imported = 0x0;
3296 unsigned int dllImport = 0x0;
3297
3298 if(!symbol || symbol->_import)
3299 {
3300 if(!symbol)
3301 {
3302 struct Symbol * classSym;
3303
3304 if(!prop->_class->symbol)
3305 prop->_class->symbol = FindClass(prop->_class->fullName);
3306 classSym = prop->_class->symbol;
3307 if(classSym && !classSym->_import)
3308 {
3309 struct ModuleImport * module;
3310
3311 if(prop->_class->module)
3312 module = FindModule(prop->_class->module);
3313 else
3314 module = mainModule;
3315 classSym->_import = __extension__ ({
3316 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3317
3318 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3319 });
3320 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3321 }
3322 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3323 symbol->_import = (struct ClassImport *)__extension__ ({
3324 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3325
3326 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3327 });
3328 if(classSym)
3329 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3330 }
3331 imported = 0x1;
3332 if((prop->_class->module != privateModule || !strcmp(prop->_class->name, "float") || !strcmp(prop->_class->name, "double")) && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)prop->_class->module + 24)))->importType != 1)
3333 dllImport = 0x1;
3334 }
3335 if(!symbol->type)
3336 {
3337 struct Context * context = SetupTemplatesContext(prop->_class);
3338
3339 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3340 FinishTemplatesContext(context);
3341 }
3342 if(prop->Get)
3343 {
3344 if(!symbol->externalGet || symbol->externalGet->type == 0)
3345 {
3346 struct Declaration * decl;
3347 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3348 struct Declarator * d;
3349 struct __ecereNameSpace__ecere__sys__OldList * params;
3350 struct Specifier * spec;
3351 struct External * external;
3352 struct Declarator * typeDecl;
3353 unsigned int simple = 0x0;
3354
3355 specifiers = MkList();
3356 declarators = MkList();
3357 params = MkList();
3358 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3359 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3360 if(dllImport)
3361 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3362 {
3363 struct Context * context = SetupTemplatesContext(prop->_class);
3364
3365 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3366 FinishTemplatesContext(context);
3367 }
3368 for(spec = (*specifiers).first; spec; spec = spec->next)
3369 {
3370 if(spec->type == 1)
3371 {
3372 if((!typeDecl || typeDecl->type == 1))
3373 {
3374 struct Symbol * classSym = spec->symbol;
3375
3376 symbol->_class = classSym->registered;
3377 if(classSym->registered && classSym->registered->type == 1)
3378 {
3379 DeclareStruct(spec->name, 0x0);
3380 simple = 0x1;
3381 }
3382 }
3383 }
3384 }
3385 if(!simple)
3386 d = PlugDeclarator(typeDecl, d);
3387 else
3388 {
3389 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3390 specifiers = MkList();
3391 }
3392 d = MkDeclaratorFunction(d, params);
3393 if(dllImport)
3394 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3395 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3396 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3397 if(simple)
3398 ListAdd(specifiers, MkSpecifier(VOID));
3399 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3400 decl = MkDeclaration(specifiers, declarators);
3401 external = MkExternalDeclaration(decl);
3402 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3403 external->symbol = symbol;
3404 symbol->externalGet = external;
3405 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3406 if(typeDecl)
3407 FreeDeclarator(typeDecl);
3408 }
3409 else
3410 {
3411 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3412 }
3413 }
3414 if(prop->Set)
3415 {
3416 if(!symbol->externalSet || symbol->externalSet->type == 0)
3417 {
3418 struct Declaration * decl;
3419 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3420 struct Declarator * d;
3421 struct __ecereNameSpace__ecere__sys__OldList * params;
3422 struct Specifier * spec;
3423 struct External * external;
3424 struct Declarator * typeDecl;
3425
3426 declarators = MkList();
3427 params = MkList();
3428 if(!prop->conversion || prop->_class->type == 1)
3429 {
3430 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3431 }
3432 specifiers = MkList();
3433 {
3434 struct Context * context = SetupTemplatesContext(prop->_class);
3435
3436 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3437 FinishTemplatesContext(context);
3438 }
3439 ListAdd(params, MkTypeName(specifiers, d));
3440 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3441 if(dllImport)
3442 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3443 d = MkDeclaratorFunction(d, params);
3444 for(spec = (*specifiers).first; spec; spec = spec->next)
3445 {
3446 if(spec->type == 1)
3447 {
3448 if((!typeDecl || typeDecl->type == 1))
3449 {
3450 struct Symbol * classSym = spec->symbol;
3451
3452 symbol->_class = classSym->registered;
3453 if(classSym->registered && classSym->registered->type == 1)
3454 DeclareStruct(spec->name, 0x0);
3455 }
3456 }
3457 }
3458 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3459 specifiers = MkList();
3460 if(dllImport)
3461 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3462 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3463 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3464 if(!prop->conversion || prop->_class->type == 1)
3465 ListAdd(specifiers, MkSpecifier(VOID));
3466 else
3467 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3468 decl = MkDeclaration(specifiers, declarators);
3469 external = MkExternalDeclaration(decl);
3470 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3471 external->symbol = symbol;
3472 symbol->externalSet = external;
3473 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3474 }
3475 else
3476 {
3477 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3478 }
3479 }
3480 if(!symbol->externalPtr)
3481 {
3482 struct Declaration * decl;
3483 struct External * external;
3484 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3485
3486 if(imported)
3487 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3488 else
3489 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3490 ListAdd(specifiers, MkSpecifierName("Property"));
3491 {
3492 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3493
3494 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3495 if(!imported)
3496 {
3497 strcpy(propName, "__ecerePropM_");
3498 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3499 strcat(propName, "_");
3500 FullClassNameCat(propName, prop->name, 0x1);
3501 MangleClassName(propName);
3502 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3503 }
3504 decl = MkDeclaration(specifiers, list);
3505 }
3506 external = MkExternalDeclaration(decl);
3507 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3508 external->symbol = symbol;
3509 symbol->externalPtr = external;
3510 }
3511 else
3512 {
3513 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3514 }
3515 symbol->id = curExternal->symbol->idCode;
3516 }
3517 }
3518
3519 struct Type * Dereference(struct Type * source)
3520 {
3521 struct Type * type = (((void *)0));
3522
3523 if(source)
3524 {
3525 if(source->kind == 13 || source->kind == 12)
3526 {
3527 type = source->type;
3528 source->type->refCount++;
3529 }
3530 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3531 {
3532 type = __extension__ ({
3533 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3534
3535 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3536 });
3537 }
3538 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3539 {
3540 type = source;
3541 source->refCount++;
3542 }
3543 else
3544 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot dereference type\n", (((void *)0))));
3545 }
3546 return type;
3547 }
3548
3549 static struct Type * Reference(struct Type * source)
3550 {
3551 struct Type * type = (((void *)0));
3552
3553 if(source)
3554 {
3555 type = __extension__ ({
3556 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3557
3558 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3559 });
3560 source->refCount++;
3561 }
3562 return type;
3563 }
3564
3565 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);
3566
3567 extern void *  memcpy(void * , const void * , size_t size);
3568
3569 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3570
3571 extern void FreeExpression(struct Expression * exp);
3572
3573 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3574
3575 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);
3576
3577 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3578
3579 extern struct Type * MkClassType(char *  name);
3580
3581 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);
3582
3583 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)
3584 {
3585 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3586 unsigned int found = 0x0;
3587 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3588 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3589 unsigned int freeType = 0x0;
3590
3591 yylloc = member->loc;
3592 if(!ident)
3593 {
3594 if(curMember)
3595 {
3596 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3597 if(*curMember)
3598 {
3599 found = 0x1;
3600 dataMember = *curMember;
3601 }
3602 }
3603 }
3604 else
3605 {
3606 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3607 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3608 int _subMemberStackPos = 0;
3609
3610 if(!thisMember)
3611 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3612 if(thisMember)
3613 {
3614 dataMember = thisMember;
3615 if(curMember && thisMember->memberAccess == 1)
3616 {
3617 *curMember = thisMember;
3618 *curClass = thisMember->_class;
3619 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3620 *subMemberStackPos = _subMemberStackPos;
3621 }
3622 found = 0x1;
3623 }
3624 else
3625 {
3626 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3627 if(method && method->type == 1)
3628 found = 0x1;
3629 else
3630 method = (((void *)0));
3631 }
3632 }
3633 if(found)
3634 {
3635 struct Type * type = (((void *)0));
3636
3637 if(dataMember)
3638 {
3639 if(!dataMember->dataType && dataMember->dataTypeString)
3640 {
3641 struct Context * context = SetupTemplatesContext(_class);
3642
3643 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3644 FinishTemplatesContext(context);
3645 }
3646 type = dataMember->dataType;
3647 }
3648 else if(method)
3649 {
3650 if(!method->dataType)
3651 ProcessMethodType(method);
3652 type = method->dataType;
3653 }
3654 if(ident && ident->next)
3655 {
3656 for(ident = ident->next; ident && type; ident = ident->next)
3657 {
3658 if(type->kind == 8)
3659 {
3660 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3661 if(!dataMember)
3662 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3663 if(dataMember)
3664 type = dataMember->dataType;
3665 }
3666 else if(type->kind == 9 || type->kind == 10)
3667 {
3668 struct Type * memberType;
3669
3670 for(memberType = type->members.first; memberType; memberType = memberType->next)
3671 {
3672 if(!strcmp(memberType->name, ident->string))
3673 {
3674 type = memberType;
3675 break;
3676 }
3677 }
3678 }
3679 }
3680 }
3681 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3682 {
3683 int id = 0;
3684 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3685 struct __ecereNameSpace__ecere__com__Class * sClass;
3686
3687 for(sClass = _class; sClass; sClass = sClass->base)
3688 {
3689 id = 0;
3690 if(sClass->templateClass)
3691 sClass = sClass->templateClass;
3692 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3693 {
3694 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3695 {
3696 for(sClass = sClass->base; sClass; sClass = sClass->base)
3697 {
3698 if(sClass->templateClass)
3699 sClass = sClass->templateClass;
3700 id += sClass->templateParams.count;
3701 }
3702 break;
3703 }
3704 id++;
3705 }
3706 if(curParam)
3707 break;
3708 }
3709 if(curParam)
3710 {
3711 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3712
3713 if(arg.dataTypeString)
3714 {
3715 type = ProcessTypeString(arg.dataTypeString, 0x0);
3716 freeType = 0x1;
3717 if(type && _class->templateClass)
3718 type->passAsTemplate = 0x1;
3719 if(type)
3720 {
3721 }
3722 }
3723 }
3724 }
3725 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3726 {
3727 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3728 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3729 int c;
3730 int paramCount = 0;
3731 int lastParam = -1;
3732 char templateString[1024];
3733 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3734
3735 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3736 for(cClass = expClass; cClass; cClass = cClass->base)
3737 {
3738 int p = 0;
3739
3740 if(cClass->templateClass)
3741 cClass = cClass->templateClass;
3742 for(param = cClass->templateParams.first; param; param = param->next)
3743 {
3744 int id = p;
3745 struct __ecereNameSpace__ecere__com__Class * sClass;
3746 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3747
3748 for(sClass = cClass->base; sClass; sClass = sClass->base)
3749 {
3750 if(sClass->templateClass)
3751 sClass = sClass->templateClass;
3752 id += sClass->templateParams.count;
3753 }
3754 arg = expClass->templateArgs[id];
3755 for(sClass = _class; sClass; sClass = sClass->base)
3756 {
3757 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3758 int p = 0;
3759 struct __ecereNameSpace__ecere__com__Class * nextClass;
3760
3761 if(sClass->templateClass)
3762 sClass = sClass->templateClass;
3763 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3764 {
3765 if(nextClass->templateClass)
3766 nextClass = nextClass->templateClass;
3767 p += nextClass->templateParams.count;
3768 }
3769 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3770 {
3771 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3772 {
3773 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3774 {
3775 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3776 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3777 break;
3778 }
3779 }
3780 }
3781 }
3782 {
3783 char argument[256];
3784
3785 argument[0] = '\0';
3786 switch(param->type)
3787 {
3788 case 2:
3789 {
3790 char expString[1024];
3791 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3792 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3793 struct Expression * exp;
3794 char * string = PrintHexUInt64(arg.expression.ui64);
3795
3796 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3797 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
3798 ProcessExpressionType(exp);
3799 ComputeExpression(exp);
3800 expString[0] = '\0';
3801 PrintExpression(exp, expString);
3802 strcat(argument, expString);
3803 FreeExpression(exp);
3804 break;
3805 }
3806 case 1:
3807 {
3808 strcat(argument, arg.member->name);
3809 break;
3810 }
3811 case 0:
3812 {
3813 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3814 strcat(argument, arg.dataTypeString);
3815 break;
3816 }
3817 }
3818 if(argument[0])
3819 {
3820 if(paramCount)
3821 strcat(templateString, ", ");
3822 if(lastParam != p - 1)
3823 {
3824 strcat(templateString, param->name);
3825 strcat(templateString, " = ");
3826 }
3827 strcat(templateString, argument);
3828 paramCount++;
3829 lastParam = p;
3830 }
3831 p++;
3832 }
3833 }
3834 }
3835 {
3836 int len = strlen(templateString);
3837
3838 if(templateString[len - 1] == '<')
3839 len--;
3840 else
3841 {
3842 if(templateString[len - 1] == '>')
3843 templateString[len++] = ' ';
3844 templateString[len++] = '>';
3845 }
3846 templateString[len++] = '\0';
3847 }
3848 {
3849 struct Context * context = SetupTemplatesContext(_class);
3850
3851 if(freeType)
3852 FreeType(type);
3853 type = ProcessTypeString(templateString, 0x0);
3854 freeType = 0x1;
3855 FinishTemplatesContext(context);
3856 }
3857 }
3858 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3859 {
3860 ProcessExpressionType(member->initializer->exp);
3861 if(!member->initializer->exp->expType)
3862 {
3863 if(inCompiler)
3864 {
3865 char expString[10240];
3866
3867 expString[0] = '\0';
3868 PrintExpression(member->initializer->exp, expString);
3869 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3870 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3871 }
3872 }
3873 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3874 {
3875 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible instance method %s\n", (((void *)0))), ident->string);
3876 }
3877 }
3878 else if(member->initializer)
3879 {
3880 ProcessInitializer(member->initializer, type);
3881 }
3882 if(freeType)
3883 FreeType(type);
3884 }
3885 else
3886 {
3887 if(_class && _class->type == 3)
3888 {
3889 if(member->initializer)
3890 {
3891 struct Type * type = MkClassType(_class->fullName);
3892
3893 ProcessInitializer(member->initializer, type);
3894 FreeType(type);
3895 }
3896 }
3897 else
3898 {
3899 if(member->initializer)
3900 {
3901 ProcessInitializer(member->initializer, (((void *)0)));
3902 }
3903 if(ident)
3904 {
3905 if(method)
3906 {
3907 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3908 }
3909 else if(_class)
3910 {
3911 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3912 if(inCompiler)
3913 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3914 }
3915 }
3916 else if(_class)
3917 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3918 }
3919 }
3920 }
3921
3922 extern struct Identifier * GetDeclId(struct Declarator * decl);
3923
3924 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);
3925
3926 extern void FreeSpecifier(struct Specifier * spec);
3927
3928 static void ProcessFunction(struct FunctionDefinition * function);
3929
3930 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3931
3932 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3933
3934 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3935
3936 extern void FreeClassFunction(struct ClassFunction * func);
3937
3938 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3939
3940 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3941
3942 void ProcessInstantiationType(struct Instantiation * inst)
3943 {
3944 yylloc = inst->loc;
3945 if(inst->_class)
3946 {
3947 struct MembersInit * members;
3948 struct Symbol * classSym;
3949 struct __ecereNameSpace__ecere__com__Class * _class;
3950
3951 classSym = inst->_class->symbol;
3952 _class = classSym ? classSym->registered : (((void *)0));
3953 if(!_class || _class->type != 5)
3954 DeclareStruct(inst->_class->name, 0x0);
3955 afterExternal = afterExternal ? afterExternal : curExternal;
3956 if(inst->exp)
3957 ProcessExpressionType(inst->exp);
3958 inst->isConstant = 0x1;
3959 if(inst->members)
3960 {
3961 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3962 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3963 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3964 int subMemberStackPos = 0;
3965
3966 for(members = (*inst->members).first; members; members = members->next)
3967 {
3968 switch(members->type)
3969 {
3970 case 1:
3971 {
3972 char name[1024];
3973 static unsigned int instMethodID = 0;
3974 struct External * external = curExternal;
3975 struct Context * context = curContext;
3976 struct Declarator * declarator = members->function->declarator;
3977 struct Identifier * nameID = GetDeclId(declarator);
3978 char * unmangled = nameID ? nameID->string : (((void *)0));
3979 struct Expression * exp;
3980 struct External * createdExternal = (((void *)0));
3981
3982 if(inCompiler)
3983 {
3984 char number[16];
3985
3986 strcpy(name, "__ecereInstMeth_");
3987 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3988 strcat(name, "_");
3989 strcat(name, nameID->string);
3990 strcat(name, "_");
3991 sprintf(number, "_%08d", instMethodID++);
3992 strcat(name, number);
3993 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3994 }
3995 if(declarator)
3996 {
3997 struct Symbol * symbol = declarator->symbol;
3998 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3999
4000 if(method && method->type == 1)
4001 {
4002 symbol->method = method;
4003 ProcessMethodType(method);
4004 if(!symbol->type->thisClass)
4005 {
4006 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
4007 {
4008 if(!currentClass->symbol)
4009 currentClass->symbol = FindClass(currentClass->fullName);
4010 symbol->type->thisClass = currentClass->symbol;
4011 }
4012 else
4013 {
4014 if(!_class->symbol)
4015 _class->symbol = FindClass(_class->fullName);
4016 symbol->type->thisClass = _class->symbol;
4017 }
4018 }
4019 DeclareType(symbol->type, 0x1, 0x1);
4020 }
4021 else if(classSym)
4022 {
4023 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
4024 }
4025 }
4026 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
4027 if(nameID)
4028 {
4029 FreeSpecifier(nameID->_class);
4030 nameID->_class = (((void *)0));
4031 }
4032 if(inCompiler)
4033 {
4034 struct External * oldExternal = curExternal;
4035
4036 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
4037 {
4038 struct External * externalDecl;
4039
4040 externalDecl = MkExternalDeclaration((((void *)0)));
4041 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
4042 if(createdExternal->function)
4043 {
4044 ProcessFunction(createdExternal->function);
4045 {
4046 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
4047
4048 externalDecl->declaration = decl;
4049 if(decl->symbol && !decl->symbol->pointerExternal)
4050 decl->symbol->pointerExternal = externalDecl;
4051 declarator->symbol->pointerExternal = externalDecl;
4052 }
4053 }
4054 }
4055 }
4056 else if(declarator)
4057 {
4058 curExternal = declarator->symbol->pointerExternal;
4059 ProcessFunction((struct FunctionDefinition *)members->function);
4060 }
4061 curExternal = external;
4062 curContext = context;
4063 if(inCompiler)
4064 {
4065 FreeClassFunction(members->function);
4066 exp = QMkExpId(name);
4067 members->type = 0;
4068 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
4069 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
4070 }
4071 break;
4072 }
4073 case 0:
4074 {
4075 if(members->dataMembers && classSym)
4076 {
4077 struct MemberInit * member;
4078 struct Location oldyyloc = yylloc;
4079
4080 for(member = (*members->dataMembers).first; member; member = member->next)
4081 {
4082 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
4083 if(member->initializer && !member->initializer->isConstant)
4084 inst->isConstant = 0x0;
4085 }
4086 yylloc = oldyyloc;
4087 }
4088 break;
4089 }
4090 }
4091 }
4092 }
4093 }
4094 }
4095
4096 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
4097 {
4098 if(inCompiler)
4099 {
4100 if(type->kind == 11)
4101 {
4102 struct Type * param;
4103
4104 if(declareParams)
4105 {
4106 for(param = type->params.first; param; param = param->next)
4107 DeclareType(param, declarePointers, 0x1);
4108 }
4109 DeclareType(type->returnType, declarePointers, 0x1);
4110 }
4111 else if(type->kind == 13 && declarePointers)
4112 DeclareType(type->type, declarePointers, 0x0);
4113 else if(type->kind == 8)
4114 {
4115 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
4116 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
4117 }
4118 else if(type->kind == 9 || type->kind == 10)
4119 {
4120 struct Type * member;
4121
4122 for(member = type->members.first; member; member = member->next)
4123 DeclareType(member, 0x0, 0x0);
4124 }
4125 else if(type->kind == 12)
4126 DeclareType(type->arrayType, declarePointers, 0x0);
4127 }
4128 }
4129
4130 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
4131
4132 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
4133 {
4134 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
4135 int id = 0;
4136 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4137 struct __ecereNameSpace__ecere__com__Class * sClass;
4138
4139 for(sClass = _class; sClass; sClass = sClass->base)
4140 {
4141 id = 0;
4142 if(sClass->templateClass)
4143 sClass = sClass->templateClass;
4144 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4145 {
4146 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
4147 {
4148 for(sClass = sClass->base; sClass; sClass = sClass->base)
4149 {
4150 if(sClass->templateClass)
4151 sClass = sClass->templateClass;
4152 id += sClass->templateParams.count;
4153 }
4154 break;
4155 }
4156 id++;
4157 }
4158 if(curParam)
4159 break;
4160 }
4161 if(curParam)
4162 {
4163 arg = &_class->templateArgs[id];
4164 if(arg && param->type == 0)
4165 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
4166 }
4167 return arg;
4168 }
4169
4170 extern struct Context * PushContext(void);
4171
4172 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
4173
4174 struct TemplatedType
4175 {
4176 uintptr_t key;
4177 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4178 struct __ecereNameSpace__ecere__sys__BTNode * left;
4179 struct __ecereNameSpace__ecere__sys__BTNode * right;
4180 int depth;
4181 struct TemplateParameter * param;
4182 } __attribute__ ((gcc_struct));
4183
4184 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4185
4186 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4187 {
4188 struct Context * context = PushContext();
4189
4190 context->templateTypesOnly = 0x1;
4191 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4192 {
4193 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4194
4195 for(; param; param = param->next)
4196 {
4197 if(param->type == 0 && param->identifier)
4198 {
4199 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4200
4201 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4202 }
4203 }
4204 }
4205 else if(_class)
4206 {
4207 struct __ecereNameSpace__ecere__com__Class * sClass;
4208
4209 for(sClass = _class; sClass; sClass = sClass->base)
4210 {
4211 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4212
4213 for(p = sClass->templateParams.first; p; p = p->next)
4214 {
4215 if(p->type == 0)
4216 {
4217 struct TemplateParameter * param = p->param;
4218 struct TemplatedType * type;
4219
4220 if(!param)
4221 {
4222 p->param = param = __extension__ ({
4223 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4224
4225 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4226 });
4227 }
4228 type = __extension__ ({
4229 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4230
4231 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4232 });
4233 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4234 }
4235 }
4236 }
4237 }
4238 return context;
4239 }
4240
4241 extern void PopContext(struct Context * ctx);
4242
4243 extern void FreeContext(struct Context * context);
4244
4245 void FinishTemplatesContext(struct Context * context)
4246 {
4247 PopContext(context);
4248 FreeContext(context);
4249 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor((void *)context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4250 }
4251
4252 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4253 {
4254 if(!method->dataType)
4255 {
4256 struct Context * context = SetupTemplatesContext(method->_class);
4257
4258 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4259 FinishTemplatesContext(context);
4260 if(method->type != 1 && method->dataType)
4261 {
4262 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4263 {
4264 if(!method->_class->symbol)
4265 method->_class->symbol = FindClass(method->_class->fullName);
4266 method->dataType->thisClass = method->_class->symbol;
4267 }
4268 }
4269 }
4270 }
4271
4272 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4273 {
4274 if(!prop->dataType)
4275 {
4276 struct Context * context = SetupTemplatesContext(prop->_class);
4277
4278 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4279 FinishTemplatesContext(context);
4280 }
4281 }
4282
4283 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4284
4285 extern void FreeTypeName(struct TypeName * typeName);
4286
4287 static void ProcessDeclarator(struct Declarator * decl);
4288
4289 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4290
4291 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4292
4293 struct MethodImport
4294 {
4295 struct MethodImport * prev;
4296 struct MethodImport * next;
4297 char *  name;
4298 unsigned int isVirtual;
4299 } __attribute__ ((gcc_struct));
4300
4301 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4302
4303 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4304 {
4305 struct Symbol * symbol = method->symbol;
4306
4307 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4308 {
4309 unsigned int imported = 0x0;
4310 unsigned int dllImport = 0x0;
4311
4312 if(!method->dataType)
4313 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4314 if(!symbol || symbol->_import || method->type == 1)
4315 {
4316 if(!symbol || method->type == 1)
4317 {
4318 struct Symbol * classSym;
4319
4320 if(!method->_class->symbol)
4321 method->_class->symbol = FindClass(method->_class->fullName);
4322 classSym = method->_class->symbol;
4323 if(!classSym->_import)
4324 {
4325 struct ModuleImport * module;
4326
4327 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4328 module = FindModule(method->_class->module);
4329 else
4330 module = mainModule;
4331 classSym->_import = __extension__ ({
4332 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4333
4334 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4335 });
4336 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4337 }
4338 if(!symbol)
4339 {
4340 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4341 }
4342 if(!symbol->_import)
4343 {
4344 symbol->_import = (struct ClassImport *)__extension__ ({
4345 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4346
4347 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4348 });
4349 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4350 }
4351 if(!symbol)
4352 {
4353 symbol->type = method->dataType;
4354 if(symbol->type)
4355 symbol->type->refCount++;
4356 }
4357 }
4358 if(!method->dataType->dllExport)
4359 {
4360 imported = 0x1;
4361 if((method->_class->module != privateModule || !strcmp(method->_class->name, "float") || !strcmp(method->_class->name, "double")) && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + 24)))->importType != 1)
4362 dllImport = 0x1;
4363 }
4364 }
4365 if(method->type != 1 && method->dataType)
4366 DeclareType(method->dataType, 0x1, 0x1);
4367 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4368 {
4369 struct Declaration * decl;
4370 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4371 struct Declarator * d;
4372 struct Declarator * funcDecl;
4373 struct External * external;
4374
4375 specifiers = MkList();
4376 declarators = MkList();
4377 if(dllImport)
4378 ListAdd(specifiers, MkSpecifier(EXTERN));
4379 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4380 ListAdd(specifiers, MkSpecifier(STATIC));
4381 if(method->type == 1)
4382 {
4383 ListAdd(specifiers, MkSpecifier(INT));
4384 d = MkDeclaratorIdentifier(MkIdentifier(name));
4385 }
4386 else
4387 {
4388 d = MkDeclaratorIdentifier(MkIdentifier(name));
4389 if(dllImport)
4390 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4391 {
4392 struct Context * context = SetupTemplatesContext(method->_class);
4393
4394 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4395 FinishTemplatesContext(context);
4396 }
4397 funcDecl = GetFuncDecl(d);
4398 if(dllImport)
4399 {
4400 struct Specifier * spec, * next;
4401
4402 for(spec = (*specifiers).first; spec; spec = next)
4403 {
4404 next = spec->next;
4405 if(spec->type == 5)
4406 {
4407 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4408 FreeSpecifier(spec);
4409 }
4410 }
4411 }
4412 if(method->dataType && !method->dataType->staticMethod)
4413 {
4414 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4415 {
4416 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4417 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")));
4418 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4419 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4420
4421 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4422 {
4423 struct TypeName * param = (*funcDecl->function.parameters).first;
4424
4425 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4426 FreeTypeName(param);
4427 }
4428 if(!funcDecl->function.parameters)
4429 funcDecl->function.parameters = MkList();
4430 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4431 }
4432 }
4433 }
4434 ProcessDeclarator(d);
4435 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4436 decl = MkDeclaration(specifiers, declarators);
4437 ReplaceThisClassSpecifiers(specifiers, method->_class);
4438 if(symbol->pointerExternal)
4439 {
4440 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4441
4442 {
4443 *functionSymbol = *symbol;
4444 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4445 if(functionSymbol->type)
4446 functionSymbol->type->refCount++;
4447 }
4448 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4449 symbol->pointerExternal->symbol = functionSymbol;
4450 }
4451 external = MkExternalDeclaration(decl);
4452 if(curExternal)
4453 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4454 external->symbol = symbol;
4455 symbol->pointerExternal = external;
4456 }
4457 else if(ast)
4458 {
4459 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4460 }
4461 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4462 }
4463 }
4464
4465 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4466 {
4467 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4468 {
4469 unsigned int first = 0x1;
4470 int p = 0;
4471 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4472 int lastParam = -1;
4473 char className[1024];
4474
4475 strcpy(className, _class->fullName);
4476 for(param = _class->templateParams.first; param; param = param->next)
4477 {
4478 {
4479 if(first)
4480 strcat(className, "<");
4481 if(!first)
4482 strcat(className, ", ");
4483 if(lastParam + 1 != p)
4484 {
4485 strcat(className, param->name);
4486 strcat(className, " = ");
4487 }
4488 strcat(className, param->name);
4489 first = 0x0;
4490 lastParam = p;
4491 }
4492 p++;
4493 }
4494 if(!first)
4495 {
4496 int len = strlen(className);
4497
4498 if(className[len - 1] == '>')
4499 className[len++] = ' ';
4500 className[len++] = '>';
4501 className[len++] = '\0';
4502 }
4503 return __ecereNameSpace__ecere__sys__CopyString(className);
4504 }
4505 else
4506 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4507 }
4508
4509 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4510 {
4511 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4512 {
4513 unsigned int first = 0x1;
4514 int p = 0;
4515 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4516 int lastParam = -1;
4517 char className[1024];
4518
4519 strcpy(className, _class->fullName);
4520 for(param = _class->templateParams.first; param; param = param->next)
4521 {
4522 {
4523 if(first)
4524 strcat(className, "<");
4525 if(!first)
4526 strcat(className, ", ");
4527 if(lastParam + 1 != p)
4528 {
4529 strcat(className, param->name);
4530 strcat(className, " = ");
4531 }
4532 strcat(className, param->name);
4533 first = 0x0;
4534 lastParam = p;
4535 }
4536 p++;
4537 }
4538 if(!first)
4539 {
4540 int len = strlen(className);
4541
4542 if(className[len - 1] == '>')
4543 className[len++] = ' ';
4544 className[len++] = '>';
4545 className[len++] = '\0';
4546 }
4547 return MkClassType(className);
4548 }
4549 else
4550 {
4551 return MkClassType(_class->fullName);
4552 }
4553 }
4554
4555 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4556 {
4557 if(specs != (((void *)0)) && _class)
4558 {
4559 struct Specifier * spec;
4560
4561 for(spec = specs->first; spec; spec = spec->next)
4562 {
4563 if(spec->type == 0 && spec->specifier == THISCLASS)
4564 {
4565 spec->type = 1;
4566 spec->name = ReplaceThisClass(_class);
4567 spec->symbol = FindClass(spec->name);
4568 }
4569 }
4570 }
4571 }
4572
4573 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4574
4575 struct __ecereNameSpace__ecere__com__GlobalFunction
4576 {
4577 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4578 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4579 char *  name;
4580 int (*  function)();
4581 struct __ecereNameSpace__ecere__com__Instance * module;
4582 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4583 char *  dataTypeString;
4584 struct Type * dataType;
4585 void *  symbol;
4586 } __attribute__ ((gcc_struct));
4587
4588 extern struct Context * globalContext;
4589
4590 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4591
4592 struct FunctionImport
4593 {
4594 struct FunctionImport * prev;
4595 struct FunctionImport * next;
4596 char *  name;
4597 } __attribute__ ((gcc_struct));
4598
4599 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4600 {
4601 struct Symbol * symbol = function->symbol;
4602
4603 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4604 {
4605 unsigned int imported = 0x0;
4606 unsigned int dllImport = 0x0;
4607
4608 if(!function->dataType)
4609 {
4610 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4611 if(!function->dataType->thisClass)
4612 function->dataType->staticMethod = 0x1;
4613 }
4614 if(inCompiler)
4615 {
4616 if(!symbol)
4617 {
4618 struct ModuleImport * module = FindModule(function->module);
4619
4620 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4621 if(module->name)
4622 {
4623 if(!function->dataType->dllExport)
4624 {
4625 symbol->_import = (struct ClassImport *)__extension__ ({
4626 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4627
4628 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4629 });
4630 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4631 }
4632 }
4633 {
4634 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4635 if(!symbol->type->thisClass)
4636 symbol->type->staticMethod = 0x1;
4637 }
4638 }
4639 imported = symbol->_import ? 0x1 : 0x0;
4640 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4641 dllImport = 0x1;
4642 }
4643 DeclareType(function->dataType, 0x1, 0x1);
4644 if(inCompiler)
4645 {
4646 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4647 {
4648 struct Declaration * decl;
4649 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4650 struct Declarator * d;
4651 struct Declarator * funcDecl;
4652 struct External * external;
4653
4654 specifiers = MkList();
4655 declarators = MkList();
4656 ListAdd(specifiers, MkSpecifier(EXTERN));
4657 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4658 if(dllImport)
4659 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4660 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4661 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4662 {
4663 struct Specifier * spec;
4664
4665 for(spec = (*specifiers).first; spec; spec = spec->next)
4666 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4667 {
4668 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4669 FreeSpecifier(spec);
4670 break;
4671 }
4672 }
4673 funcDecl = GetFuncDecl(d);
4674 if(funcDecl && !funcDecl->function.parameters)
4675 {
4676 funcDecl->function.parameters = MkList();
4677 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4678 }
4679 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4680 {
4681 struct Context * oldCtx = curContext;
4682
4683 curContext = globalContext;
4684 decl = MkDeclaration(specifiers, declarators);
4685 curContext = oldCtx;
4686 }
4687 if(symbol->pointerExternal)
4688 {
4689 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4690
4691 {
4692 *functionSymbol = *symbol;
4693 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4694 if(functionSymbol->type)
4695 functionSymbol->type->refCount++;
4696 }
4697 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4698 symbol->pointerExternal->symbol = functionSymbol;
4699 }
4700 external = MkExternalDeclaration(decl);
4701 if(curExternal)
4702 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4703 external->symbol = symbol;
4704 symbol->pointerExternal = external;
4705 }
4706 else
4707 {
4708 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4709 }
4710 if(curExternal)
4711 symbol->id = curExternal->symbol->idCode;
4712 }
4713 }
4714 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4715 }
4716
4717 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4718
4719 struct GlobalData
4720 {
4721 uintptr_t key;
4722 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4723 struct __ecereNameSpace__ecere__sys__BTNode * left;
4724 struct __ecereNameSpace__ecere__sys__BTNode * right;
4725 int depth;
4726 struct __ecereNameSpace__ecere__com__Instance * module;
4727 char *  dataTypeString;
4728 struct Type * dataType;
4729 void *  symbol;
4730 char *  fullName;
4731 } __attribute__ ((gcc_struct));
4732
4733 void DeclareGlobalData(struct GlobalData * data)
4734 {
4735 struct Symbol * symbol = data->symbol;
4736
4737 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4738 {
4739 if(inCompiler)
4740 {
4741 if(!symbol)
4742 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4743 }
4744 if(!data->dataType)
4745 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4746 DeclareType(data->dataType, 0x1, 0x1);
4747 if(inCompiler)
4748 {
4749 if(!symbol->pointerExternal)
4750 {
4751 struct Declaration * decl;
4752 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4753 struct Declarator * d;
4754 struct External * external;
4755
4756 specifiers = MkList();
4757 declarators = MkList();
4758 ListAdd(specifiers, MkSpecifier(EXTERN));
4759 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4760 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4761 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4762 decl = MkDeclaration(specifiers, declarators);
4763 external = MkExternalDeclaration(decl);
4764 if(curExternal)
4765 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4766 external->symbol = symbol;
4767 symbol->pointerExternal = external;
4768 }
4769 else
4770 {
4771 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4772 }
4773 if(curExternal)
4774 symbol->id = curExternal->symbol->idCode;
4775 }
4776 }
4777 }
4778
4779 struct Conversion
4780 {
4781 struct Conversion * prev, * next;
4782 struct __ecereNameSpace__ecere__com__Property * convert;
4783 unsigned int isGet;
4784 struct Type * resultType;
4785 } __attribute__ ((gcc_struct));
4786
4787 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4788
4789 extern void Compiler_Warning(char *  format, ...);
4790
4791 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4792
4793 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)
4794 {
4795 if(source && dest)
4796 {
4797 if(source->kind == 20 && dest->kind != 20)
4798 {
4799 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4800
4801 if(type)
4802 source = type;
4803 }
4804 if(dest->kind == 20 && source->kind != 20)
4805 {
4806 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4807
4808 if(type)
4809 dest = type;
4810 }
4811 if(dest->classObjectType == 2)
4812 {
4813 if(source->classObjectType != 3)
4814 return 0x1;
4815 else
4816 {
4817 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4818 {
4819 return 0x1;
4820 }
4821 }
4822 }
4823 else
4824 {
4825 if(source->classObjectType == 3)
4826 return 0x1;
4827 if(dest->classObjectType == 3 && source->classObjectType != 2)
4828 return 0x1;
4829 }
4830 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4831 {
4832 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4833 return 0x1;
4834 }
4835 if(dest->kind == 14 && source->kind != 0)
4836 return 0x1;
4837 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))
4838 return 0x1;
4839 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))
4840 return 0x1;
4841 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4842 {
4843 if(source->_class->registered && source->_class->registered->type == 3)
4844 {
4845 if(conversions != (((void *)0)))
4846 {
4847 if(source->_class->registered == dest->_class->registered)
4848 return 0x1;
4849 }
4850 else
4851 {
4852 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4853
4854 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4855 ;
4856 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4857 ;
4858 if(sourceBase == destBase)
4859 return 0x1;
4860 }
4861 }
4862 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))
4863 return 0x1;
4864 else
4865 {
4866 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4 && ((source->_class && source->_class->registered && source->_class->registered->type != 4) || source->kind == 8))
4867 {
4868 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4869 {
4870 return 0x1;
4871 }
4872 }
4873 }
4874 }
4875 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4876 return 0x1;
4877 if(doConversion)
4878 {
4879 if(source->kind == 8)
4880 {
4881 struct __ecereNameSpace__ecere__com__Class * _class;
4882
4883 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4884 {
4885 struct __ecereNameSpace__ecere__com__Property * convert;
4886
4887 for(convert = _class->conversions.first; convert; convert = convert->next)
4888 {
4889 if(convert->memberAccess == 1 || _class->module == privateModule)
4890 {
4891 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4892
4893 if(!convert->dataType)
4894 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4895 if((!isConversionExploration || convert->dataType->kind == 8 || !strcmp(_class->name, "String")) && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), (convert->dataType->kind == 8 && !strcmp(convert->dataTypeString, "String")) ? 0x1 : 0x0, convert->dataType->kind == 8, 0x0, 0x1))
4896 {
4897 if(!conversions && !convert->Get)
4898 return 0x1;
4899 else if(conversions != (((void *)0)))
4900 {
4901 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))
4902 return 0x1;
4903 else
4904 {
4905 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4906
4907 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4908 return 0x1;
4909 }
4910 }
4911 }
4912 }
4913 }
4914 }
4915 }
4916 if(dest->kind == 8)
4917 {
4918 struct __ecereNameSpace__ecere__com__Class * _class;
4919
4920 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4921 {
4922 struct __ecereNameSpace__ecere__com__Property * convert;
4923
4924 for(convert = _class->conversions.first; convert; convert = convert->next)
4925 {
4926 if(convert->memberAccess == 1 || _class->module == privateModule)
4927 {
4928 if(!convert->dataType)
4929 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4930 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4931 {
4932 if(!conversions && !convert->Set)
4933 return 0x1;
4934 else if(conversions != (((void *)0)))
4935 {
4936 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))
4937 return 0x1;
4938 else
4939 {
4940 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4941
4942 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4943 return 0x1;
4944 }
4945 }
4946 }
4947 }
4948 }
4949 }
4950 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4951 {
4952 if(!dest->_class->registered->dataType)
4953 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4954 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4955 {
4956 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, dest->_class->registered->dataType->kind == 8, 0x0, 0x0))
4957 {
4958 return 0x1;
4959 }
4960 }
4961 }
4962 }
4963 if(source->kind == 8)
4964 {
4965 struct __ecereNameSpace__ecere__com__Class * _class;
4966
4967 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4968 {
4969 struct __ecereNameSpace__ecere__com__Property * convert;
4970
4971 for(convert = _class->conversions.first; convert; convert = convert->next)
4972 {
4973 if(convert->memberAccess == 1 || _class->module == privateModule)
4974 {
4975 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4976
4977 if(!convert->dataType)
4978 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4979 if(convert->dataType != source && (!isConversionExploration || convert->dataType->kind == 8 || !strcmp(_class->name, "String")) && MatchTypes(convert->dataType, dest, conversions, (((void *)0)), (((void *)0)), convert->dataType->kind == 8, convert->dataType->kind == 8, 0x0, 0x1))
4980 {
4981 if(!conversions && !convert->Get)
4982 return 0x1;
4983 else if(conversions != (((void *)0)))
4984 {
4985 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))
4986 return 0x1;
4987 else
4988 {
4989 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4990
4991 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4992 return 0x1;
4993 }
4994 }
4995 }
4996 }
4997 }
4998 }
4999 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
5000 {
5001 if(!source->_class->registered->dataType)
5002 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5003 if(!isConversionExploration || source->_class->registered->dataType->kind == 8 || !strcmp(source->_class->registered->name, "String"))
5004 {
5005 if(MatchTypes(source->_class->registered->dataType, dest, conversions, (((void *)0)), (((void *)0)), source->_class->registered->dataType->kind == 8, source->_class->registered->dataType->kind == 8, 0x0, 0x0))
5006 return 0x1;
5007 else if(MatchTypes(dest, source->_class->registered->dataType, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
5008 return 0x1;
5009 }
5010 }
5011 }
5012 }
5013 if(source->kind == 8 || source->kind == 19)
5014 ;
5015 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
5016 return 0x1;
5017 else if(dest->kind == 7 && source->kind == 6)
5018 return 0x1;
5019 else if(dest->kind == 2 && (source->kind == 1 || source->kind == 24))
5020 return 0x1;
5021 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 23))
5022 return 0x1;
5023 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 22 || source->kind == 23))
5024 return 0x1;
5025 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 23 || source->kind == 4))
5026 return 0x1;
5027 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 4 || source->kind == 22))
5028 return 0x1;
5029 else if(source->kind == 15 && (dest->kind == 3 || dest->kind == 2 || dest->kind == 1 || source->kind == 24 || dest->kind == 5 || dest->kind == 4 || dest->kind == 22 || dest->kind == 23))
5030 return 0x1;
5031 else if(dest->kind == 15 && !isConversionExploration && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 5 || source->kind == 4 || source->kind == 22 || source->kind == 23))
5032 return 0x1;
5033 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)))
5034 {
5035 struct Type * paramSource, * paramDest;
5036
5037 if(dest->kind == 16)
5038 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
5039 if(source->kind == 16)
5040 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
5041 if(dest->kind == 13 && dest->type->kind == 11)
5042 dest = dest->type;
5043 if(source->kind == 13 && source->type->kind == 11)
5044 source = source->type;
5045 if(dest->kind == 16)
5046 dest = dest->method->dataType;
5047 if(source->kind == 16)
5048 source = source->method->dataType;
5049 paramSource = source->params.first;
5050 if(paramSource && paramSource->kind == 0)
5051 paramSource = (((void *)0));
5052 paramDest = dest->params.first;
5053 if(paramDest && paramDest->kind == 0)
5054 paramDest = (((void *)0));
5055 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
5056 {
5057 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))))
5058 {
5059 if(paramDest && paramDest->kind == 8)
5060 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
5061 else
5062 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class should not take an object\n", (((void *)0))));
5063 return 0x0;
5064 }
5065 paramDest = paramDest->next;
5066 }
5067 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
5068 {
5069 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
5070 {
5071 if(dest->thisClass)
5072 {
5073 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
5074 {
5075 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5076 return 0x0;
5077 }
5078 }
5079 else
5080 {
5081 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
5082 {
5083 if(owningClassDest)
5084 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
5085 else
5086 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "overriding class expected to be derived from method class\n", (((void *)0))));
5087 return 0x0;
5088 }
5089 }
5090 paramSource = paramSource->next;
5091 }
5092 else
5093 {
5094 if(dest->thisClass)
5095 {
5096 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
5097 {
5098 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5099 return 0x0;
5100 }
5101 }
5102 else
5103 {
5104 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
5105 {
5106 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
5107 return 0x0;
5108 }
5109 }
5110 }
5111 }
5112 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5113 {
5114 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible return type for function\n", (((void *)0))));
5115 return 0x0;
5116 }
5117 for(; paramDest; paramDest = paramDest->next)
5118 {
5119 if(!paramSource)
5120 {
5121 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "not enough parameters\n", (((void *)0))));
5122 return 0x0;
5123 }
5124 {
5125 struct Type * paramDestType = paramDest;
5126 struct Type * paramSourceType = paramSource;
5127 struct Type * type = paramDestType;
5128
5129 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
5130 {
5131 int id = 0;
5132 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
5133 struct __ecereNameSpace__ecere__com__Class * sClass;
5134
5135 for(sClass = owningClassSource; sClass; sClass = sClass->base)
5136 {
5137 id = 0;
5138 if(sClass->templateClass)
5139 sClass = sClass->templateClass;
5140 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
5141 {
5142 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
5143 {
5144 for(sClass = sClass->base; sClass; sClass = sClass->base)
5145 {
5146 if(sClass->templateClass)
5147 sClass = sClass->templateClass;
5148 id += sClass->templateParams.count;
5149 }
5150 break;
5151 }
5152 id++;
5153 }
5154 if(curParam)
5155 break;
5156 }
5157 if(curParam)
5158 {
5159 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
5160
5161 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
5162 }
5163 }
5164 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)))
5165 {
5166 char type[1024];
5167
5168 type[0] = (char)0;
5169 PrintType(paramDest, type, 0x0, 0x1);
5170 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
5171 if(paramDestType != paramDest)
5172 FreeType(paramDestType);
5173 return 0x0;
5174 }
5175 if(paramDestType != paramDest)
5176 FreeType(paramDestType);
5177 }
5178 paramSource = paramSource->next;
5179 }
5180 if(paramSource)
5181 {
5182 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many parameters\n", (((void *)0))));
5183 return 0x0;
5184 }
5185 return 0x1;
5186 }
5187 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5188 {
5189 return 0x1;
5190 }
5191 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5192 {
5193 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5194 return 0x1;
5195 }
5196 }
5197 return 0x0;
5198 }
5199
5200 static void FreeConvert(struct Conversion * convert)
5201 {
5202 if(convert->resultType)
5203 FreeType(convert->resultType);
5204 }
5205
5206 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5207
5208 struct __ecereNameSpace__ecere__com__BTNamedLink
5209 {
5210 char *  name;
5211 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5212 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5213 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5214 int depth;
5215 void *  data;
5216 } __attribute__ ((gcc_struct));
5217
5218 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5219
5220 struct __ecereNameSpace__ecere__com__EnumClassData
5221 {
5222 struct __ecereNameSpace__ecere__sys__OldList values;
5223 int largest;
5224 } __attribute__ ((gcc_struct));
5225
5226 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5227
5228 struct __ecereNameSpace__ecere__sys__NamedLink
5229 {
5230 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5231 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5232 char *  name;
5233 void *  data;
5234 } __attribute__ ((gcc_struct));
5235
5236 extern void FreeExpContents(struct Expression * exp);
5237
5238 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5239
5240 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5241
5242 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5243
5244 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5245
5246 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5247
5248 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5249 {
5250 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5251
5252 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)))
5253 {
5254 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5255
5256 if(_class->type == 4)
5257 {
5258 struct __ecereNameSpace__ecere__sys__OldList converts =
5259 {
5260 0, 0, 0, 0, 0
5261 };
5262 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5263
5264 type->kind = 8;
5265 if(!_class->symbol)
5266 _class->symbol = FindClass(_class->fullName);
5267 type->_class = _class->symbol;
5268 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5269 {
5270 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5271 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5272
5273 if(enumClass)
5274 {
5275 struct __ecereNameSpace__ecere__com__Class * baseClass;
5276
5277 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5278 {
5279 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5280
5281 for(value = e->values.first; value; value = value->next)
5282 {
5283 if(!strcmp(value->name, string))
5284 break;
5285 }
5286 if(value)
5287 {
5288 FreeExpContents(sourceExp);
5289 FreeType(sourceExp->expType);
5290 sourceExp->isConstant = 0x1;
5291 sourceExp->expType = MkClassType(baseClass->fullName);
5292 {
5293 char constant[256];
5294
5295 sourceExp->type = 2;
5296 if(!strcmp(baseClass->dataTypeString, "int"))
5297 sprintf(constant, "%d", (int)value->data);
5298 else
5299 sprintf(constant, "0x%X", (int)value->data);
5300 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5301 }
5302 while(converts.first)
5303 {
5304 struct Conversion * convert = converts.first;
5305
5306 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5307 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5308 }
5309 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5310 return 0x1;
5311 }
5312 }
5313 }
5314 }
5315 if(converts.first)
5316 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5317 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5318 }
5319 }
5320 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)))
5321 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5322 return 0x1;
5323 return 0x0;
5324 }
5325
5326 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5327
5328 struct __ecereNameSpace__ecere__com__SubModule
5329 {
5330 struct __ecereNameSpace__ecere__com__SubModule * prev;
5331 struct __ecereNameSpace__ecere__com__SubModule * next;
5332 struct __ecereNameSpace__ecere__com__Instance * module;
5333 int importMode;
5334 } __attribute__ ((gcc_struct));
5335
5336 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5337 {
5338 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5339
5340 if(searchFor == searchIn)
5341 return 0x1;
5342 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5343 {
5344 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5345 {
5346 if(ModuleVisibility(subModule->module, searchFor))
5347 return 0x1;
5348 }
5349 }
5350 return 0x0;
5351 }
5352
5353 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5354
5355 struct __ecereNameSpace__ecere__com__Application
5356 {
5357 int argc;
5358 char * *  argv;
5359 int exitCode;
5360 unsigned int isGUIApp;
5361 struct __ecereNameSpace__ecere__sys__OldList allModules;
5362 char *  parsedCommand;
5363 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5364 } __attribute__ ((gcc_struct));
5365
5366 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5367 {
5368 struct __ecereNameSpace__ecere__com__Instance * module;
5369
5370 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->systemNameSpace, sourceExp, dest, string, conversions))
5371 return 0x1;
5372 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->privateNameSpace, sourceExp, dest, string, conversions))
5373 return 0x1;
5374 if(MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5375 return 0x1;
5376 for(module = ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)mainModule + structSize_Instance)))->application + structSize_Module)))->allModules.first; module; module = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->next)
5377 {
5378 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5379 return 0x1;
5380 }
5381 return 0x0;
5382 }
5383
5384 extern struct Expression * CopyExpression(struct Expression * exp);
5385
5386 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5387
5388 void ReadString(char *  output, char *  string);
5389
5390 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5391
5392 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5393
5394 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5395
5396 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5397 {
5398 struct Type * source;
5399 struct Type * realDest = dest;
5400 struct Type * backupSourceExpType = (((void *)0));
5401 struct Expression * computedExp = sourceExp;
5402
5403 dest->refCount++;
5404 if(sourceExp->isConstant && sourceExp->type != 2 && sourceExp->type != 0 && sourceExp->type != 11 && dest->kind == 8 && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5405 {
5406 computedExp = CopyExpression(sourceExp);
5407 ComputeExpression(computedExp);
5408 }
5409 source = sourceExp->expType;
5410 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5411 {
5412 if(computedExp != sourceExp)
5413 {
5414 FreeExpression(computedExp);
5415 computedExp = sourceExp;
5416 }
5417 FreeType(dest);
5418 return 0x1;
5419 }
5420 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5421 {
5422 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5423 {
5424 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5425
5426 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5427 ;
5428 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5429 ;
5430 if(sourceBase == destBase)
5431 {
5432 if(computedExp != sourceExp)
5433 {
5434 FreeExpression(computedExp);
5435 computedExp = sourceExp;
5436 }
5437 FreeType(dest);
5438 return 0x1;
5439 }
5440 }
5441 }
5442 if(source)
5443 {
5444 struct __ecereNameSpace__ecere__sys__OldList * specs;
5445 unsigned int flag = 0x0;
5446 long long value = (((int)0x7fffffff));
5447
5448 source->refCount++;
5449 if(computedExp->type == 2)
5450 {
5451 if(source->isSigned)
5452 value = strtoll(computedExp->constant, (((void *)0)), 0);
5453 else
5454 value = strtoull(computedExp->constant, (((void *)0)), 0);
5455 }
5456 else if(computedExp->type == 4 && sourceExp->op.op == '-' && !computedExp->op.exp1 && computedExp->op.exp2 && computedExp->op.exp2->type == 2)
5457 {
5458 if(source->isSigned)
5459 value = -strtoll(computedExp->op.exp2->constant, (((void *)0)), 0);
5460 else
5461 value = -strtoull(computedExp->op.exp2->constant, (((void *)0)), 0);
5462 }
5463 if(computedExp != sourceExp)
5464 {
5465 FreeExpression(computedExp);
5466 computedExp = sourceExp;
5467 }
5468 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5469 {
5470 FreeType(source);
5471 source = __extension__ ({
5472 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5473
5474 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5475 });
5476 }
5477 if(dest->kind == 8)
5478 {
5479 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5480
5481 if(_class && _class->type == 3)
5482 {
5483 if(source->kind != 8)
5484 {
5485 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5486 struct Type * tempDest, * tempSource;
5487
5488 for(; _class->base->type != 1000; _class = _class->base)
5489 ;
5490 tempSource = dest;
5491 tempDest = tempType;
5492 tempType->kind = 8;
5493 if(!_class->symbol)
5494 _class->symbol = FindClass(_class->fullName);
5495 tempType->_class = _class->symbol;
5496 tempType->truth = dest->truth;
5497 if(tempType->_class)
5498 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5499 backupSourceExpType = sourceExp->expType;
5500 sourceExp->expType = dest;
5501 dest->refCount++;
5502 flag = 0x1;
5503 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5504 }
5505 }
5506 if(_class && _class->type == 2 && source->kind != 8)
5507 {
5508 if(!dest->_class->registered->dataType)
5509 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5510 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5511 {
5512 FreeType(source);
5513 FreeType(sourceExp->expType);
5514 source = sourceExp->expType = MkClassType(dest->_class->string);
5515 source->refCount++;
5516 }
5517 }
5518 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5519 {
5520 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5521 struct Declarator * decl;
5522 char string[1024];
5523
5524 ReadString(string, sourceExp->string);
5525 decl = SpecDeclFromString(string, specs, (((void *)0)));
5526 FreeExpContents(sourceExp);
5527 FreeType(sourceExp->expType);
5528 sourceExp->type = 24;
5529 sourceExp->_classExp.specifiers = specs;
5530 sourceExp->_classExp.decl = decl;
5531 sourceExp->expType = dest;
5532 dest->refCount++;
5533 FreeType(source);
5534 FreeType(dest);
5535 if(backupSourceExpType)
5536 FreeType(backupSourceExpType);
5537 return 0x1;
5538 }
5539 }
5540 else if(source->kind == 8)
5541 {
5542 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5543
5544 if(_class && (_class->type == 3 || _class->type == 2))
5545 {
5546 if(dest->kind != 8)
5547 {
5548 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5549 struct Type * tempDest, * tempSource;
5550
5551 if(!source->_class->registered->dataType)
5552 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5553 for(; _class->base->type != 1000; _class = _class->base)
5554 ;
5555 tempDest = source;
5556 tempSource = tempType;
5557 tempType->kind = 8;
5558 tempType->_class = FindClass(_class->fullName);
5559 tempType->truth = source->truth;
5560 tempType->classObjectType = source->classObjectType;
5561 if(tempType->_class)
5562 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5563 if(conversions->last)
5564 {
5565 ((struct Conversion *)conversions->last)->resultType = dest;
5566 dest->refCount++;
5567 }
5568 FreeType(sourceExp->expType);
5569 sourceExp->expType = MkClassType(_class->fullName);
5570 sourceExp->expType->truth = source->truth;
5571 sourceExp->expType->classObjectType = source->classObjectType;
5572 if(!sourceExp->destType)
5573 {
5574 FreeType(sourceExp->destType);
5575 sourceExp->destType = sourceExp->expType;
5576 if(sourceExp->expType)
5577 sourceExp->expType->refCount++;
5578 }
5579 if(!_class->dataType)
5580 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5581 FreeType(dest);
5582 dest = MkClassType(source->_class->string);
5583 dest->truth = source->truth;
5584 dest->classObjectType = source->classObjectType;
5585 FreeType(source);
5586 source = _class->dataType;
5587 source->refCount++;
5588 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor((void *)tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5589 }
5590 }
5591 }
5592 if(!flag)
5593 {
5594 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5595 {
5596 FreeType(source);
5597 FreeType(dest);
5598 return 0x1;
5599 }
5600 }
5601 if(dest->kind == 8)
5602 {
5603 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5604 unsigned int fittingValue = 0x0;
5605
5606 if(_class && _class->type == 4)
5607 {
5608 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5609 struct __ecereNameSpace__ecere__com__EnumClassData * c = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5610
5611 if(c && value >= 0 && value <= c->largest)
5612 fittingValue = 0x1;
5613 }
5614 if(_class && !dest->truth && (_class->type == 3 || fittingValue || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5615 {
5616 if(_class->type == 0 || _class->type == 5)
5617 {
5618 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5619
5620 *newExp = *sourceExp;
5621 if(sourceExp->destType)
5622 sourceExp->destType->refCount++;
5623 if(sourceExp->expType)
5624 sourceExp->expType->refCount++;
5625 sourceExp->type = 11;
5626 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5627 sourceExp->cast.exp = newExp;
5628 FreeType(sourceExp->expType);
5629 sourceExp->expType = (((void *)0));
5630 ProcessExpressionType(sourceExp);
5631 if(!inCompiler)
5632 {
5633 FreeType(sourceExp->expType);
5634 sourceExp->expType = dest;
5635 }
5636 FreeType(source);
5637 if(inCompiler)
5638 FreeType(dest);
5639 if(backupSourceExpType)
5640 FreeType(backupSourceExpType);
5641 return 0x1;
5642 }
5643 if(!_class->dataType)
5644 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5645 FreeType(dest);
5646 dest = _class->dataType;
5647 dest->refCount++;
5648 }
5649 if(dest->kind == 7 && (source->kind == 7 || source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24))
5650 {
5651 specs = MkListOne(MkSpecifier(DOUBLE));
5652 }
5653 else if(dest->kind == 6 && (source->kind == 6 || dest->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 7))
5654 {
5655 specs = MkListOne(MkSpecifier(FLOAT));
5656 }
5657 else if(dest->kind == 4 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 6 || source->kind == 7))
5658 {
5659 specs = MkList();
5660 if(!dest->isSigned)
5661 ListAdd(specs, MkSpecifier(UNSIGNED));
5662 ListAdd(specs, MkSpecifier(INT64));
5663 }
5664 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 6 || source->kind == 7))
5665 {
5666 specs = MkList();
5667 if(!dest->isSigned)
5668 ListAdd(specs, MkSpecifier(UNSIGNED));
5669 ListAdd(specs, MkSpecifier(INT));
5670 }
5671 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5672 {
5673 specs = MkList();
5674 if(!dest->isSigned)
5675 ListAdd(specs, MkSpecifier(UNSIGNED));
5676 ListAdd(specs, MkSpecifier(SHORT));
5677 }
5678 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 24 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5679 {
5680 specs = MkList();
5681 if(!dest->isSigned)
5682 ListAdd(specs, MkSpecifier(UNSIGNED));
5683 ListAdd(specs, MkSpecifier(CHAR));
5684 }
5685 else
5686 {
5687 FreeType(source);
5688 FreeType(dest);
5689 if(backupSourceExpType)
5690 {
5691 if(sourceExp->expType)
5692 FreeType(sourceExp->expType);
5693 sourceExp->expType = backupSourceExpType;
5694 }
5695 return 0x0;
5696 }
5697 }
5698 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 == 24 || source->kind == 1))
5699 {
5700 specs = MkListOne(MkSpecifier(DOUBLE));
5701 }
5702 else if(dest->kind == 6 && (source->kind == 6 || source->kind == 15 || source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 24 || source->kind == 1))
5703 {
5704 specs = MkListOne(MkSpecifier(FLOAT));
5705 }
5706 else if(dest->kind == 24 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (value == 1 || value == 0))
5707 {
5708 specs = MkList();
5709 ListAdd(specs, MkSpecifier(BOOL));
5710 }
5711 else if(dest->kind == 1 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (dest->isSigned ? (value >= -128 && value <= 127) : (value >= 0 && value <= 255)))
5712 {
5713 specs = MkList();
5714 if(!dest->isSigned)
5715 ListAdd(specs, MkSpecifier(UNSIGNED));
5716 ListAdd(specs, MkSpecifier(CHAR));
5717 }
5718 else if(dest->kind == 2 && (source->kind == 15 || source->kind == 24 || source->kind == 1 || source->kind == 2 || (source->kind == 3 && (dest->isSigned ? (value >= -32768 && value <= 32767) : (value >= 0 && value <= 65535)))))
5719 {
5720 specs = MkList();
5721 if(!dest->isSigned)
5722 ListAdd(specs, MkSpecifier(UNSIGNED));
5723 ListAdd(specs, MkSpecifier(SHORT));
5724 }
5725 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3))
5726 {
5727 specs = MkList();
5728 if(!dest->isSigned)
5729 ListAdd(specs, MkSpecifier(UNSIGNED));
5730 ListAdd(specs, MkSpecifier(INT));
5731 }
5732 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5733 {
5734 specs = MkList();
5735 if(!dest->isSigned)
5736 ListAdd(specs, MkSpecifier(UNSIGNED));
5737 ListAdd(specs, MkSpecifier(INT64));
5738 }
5739 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 24 || source->kind == 1))
5740 {
5741 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5742 }
5743 else
5744 {
5745 FreeType(source);
5746 FreeType(dest);
5747 if(backupSourceExpType)
5748 {
5749 if(sourceExp->expType)
5750 FreeType(sourceExp->expType);
5751 sourceExp->expType = backupSourceExpType;
5752 }
5753 return 0x0;
5754 }
5755 if(!flag && !sourceExp->opDestType)
5756 {
5757 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5758
5759 *newExp = *sourceExp;
5760 newExp->prev = (((void *)0));
5761 newExp->next = (((void *)0));
5762 if(sourceExp->destType)
5763 sourceExp->destType->refCount++;
5764 if(sourceExp->expType)
5765 sourceExp->expType->refCount++;
5766 sourceExp->type = 11;
5767 if(realDest->kind == 8)
5768 {
5769 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5770 FreeList(specs, FreeSpecifier);
5771 }
5772 else
5773 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5774 if(newExp->type == 4)
5775 {
5776 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5777 }
5778 else
5779 sourceExp->cast.exp = newExp;
5780 FreeType(sourceExp->expType);
5781 sourceExp->expType = (((void *)0));
5782 ProcessExpressionType(sourceExp);
5783 }
5784 else
5785 FreeList(specs, FreeSpecifier);
5786 FreeType(dest);
5787 FreeType(source);
5788 if(backupSourceExpType)
5789 FreeType(backupSourceExpType);
5790 return 0x1;
5791 }
5792 else
5793 {
5794 if(computedExp != sourceExp)
5795 {
5796 FreeExpression(computedExp);
5797 computedExp = sourceExp;
5798 }
5799 while((sourceExp->type == 5 || sourceExp->type == 32) && sourceExp->list)
5800 sourceExp = (*sourceExp->list).last;
5801 if(sourceExp->type == 0)
5802 {
5803 struct Identifier * id = sourceExp->identifier;
5804
5805 if(dest->kind == 8)
5806 {
5807 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5808 {
5809 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5810 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5811
5812 if(enumClass)
5813 {
5814 for(; _class && _class->type == 4; _class = _class->base)
5815 {
5816 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5817 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5818
5819 for(value = e->values.first; value; value = value->next)
5820 {
5821 if(!strcmp(value->name, id->string))
5822 break;
5823 }
5824 if(value)
5825 {
5826 FreeExpContents(sourceExp);
5827 FreeType(sourceExp->expType);
5828 sourceExp->isConstant = 0x1;
5829 sourceExp->expType = MkClassType(_class->fullName);
5830 {
5831 char constant[256];
5832
5833 sourceExp->type = 2;
5834 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5835 sprintf(constant, "%d", (int)value->data);
5836 else
5837 sprintf(constant, "0x%X", (int)value->data);
5838 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5839 }
5840 FreeType(dest);
5841 return 0x1;
5842 }
5843 }
5844 }
5845 }
5846 }
5847 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5848 {
5849 FreeType(dest);
5850 return 0x1;
5851 }
5852 }
5853 FreeType(dest);
5854 }
5855 return 0x0;
5856 }
5857
5858 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5859 {
5860 int value2 = op2->i;
5861
5862 exp->type = 2;
5863 exp->string = PrintInt((op1->i + value2));
5864 if(!exp->expType)
5865 {
5866 exp->expType = op1->type;
5867 if(op1->type)
5868 op1->type->refCount++;
5869 }
5870 return 0x1;
5871 }
5872
5873 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5874 {
5875 unsigned int value2 = op2->ui;
5876
5877 exp->type = 2;
5878 exp->string = PrintUInt((op1->ui + value2));
5879 if(!exp->expType)
5880 {
5881 exp->expType = op1->type;
5882 if(op1->type)
5883 op1->type->refCount++;
5884 }
5885 return 0x1;
5886 }
5887
5888 static unsigned int Int64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5889 {
5890 long long value2 = op2->i64;
5891
5892 exp->type = 2;
5893 exp->string = PrintInt64((op1->i64 + value2));
5894 if(!exp->expType)
5895 {
5896 exp->expType = op1->type;
5897 if(op1->type)
5898 op1->type->refCount++;
5899 }
5900 return 0x1;
5901 }
5902
5903 static unsigned int UInt64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5904 {
5905 uint64 value2 = op2->ui64;
5906
5907 exp->type = 2;
5908 exp->string = PrintUInt64((op1->ui64 + value2));
5909 if(!exp->expType)
5910 {
5911 exp->expType = op1->type;
5912 if(op1->type)
5913 op1->type->refCount++;
5914 }
5915 return 0x1;
5916 }
5917
5918 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5919 {
5920 short value2 = op2->s;
5921
5922 exp->type = 2;
5923 exp->string = PrintShort((op1->s + value2));
5924 if(!exp->expType)
5925 {
5926 exp->expType = op1->type;
5927 if(op1->type)
5928 op1->type->refCount++;
5929 }
5930 return 0x1;
5931 }
5932
5933 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5934 {
5935 unsigned short value2 = op2->us;
5936
5937 exp->type = 2;
5938 exp->string = PrintUShort((op1->us + value2));
5939 if(!exp->expType)
5940 {
5941 exp->expType = op1->type;
5942 if(op1->type)
5943 op1->type->refCount++;
5944 }
5945 return 0x1;
5946 }
5947
5948 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5949 {
5950 char value2 = op2->c;
5951
5952 exp->type = 2;
5953 exp->string = PrintChar((op1->c + value2));
5954 if(!exp->expType)
5955 {
5956 exp->expType = op1->type;
5957 if(op1->type)
5958 op1->type->refCount++;
5959 }
5960 return 0x1;
5961 }
5962
5963 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5964 {
5965 unsigned char value2 = op2->uc;
5966
5967 exp->type = 2;
5968 exp->string = PrintUChar((op1->uc + value2));
5969 if(!exp->expType)
5970 {
5971 exp->expType = op1->type;
5972 if(op1->type)
5973 op1->type->refCount++;
5974 }
5975 return 0x1;
5976 }
5977
5978 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5979 {
5980 float value2 = op2->f;
5981
5982 exp->type = 2;
5983 exp->string = PrintFloat((float)(op1->f + value2));
5984 if(!exp->expType)
5985 {
5986 exp->expType = op1->type;
5987 if(op1->type)
5988 op1->type->refCount++;
5989 }
5990 return 0x1;
5991 }
5992
5993 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5994 {
5995 double value2 = op2->d;
5996
5997 exp->type = 2;
5998 exp->string = PrintDouble((double)(op1->d + value2));
5999 if(!exp->expType)
6000 {
6001 exp->expType = op1->type;
6002 if(op1->type)
6003 op1->type->refCount++;
6004 }
6005 return 0x1;
6006 }
6007
6008 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6009 {
6010 int value2 = op2->i;
6011
6012 exp->type = 2;
6013 exp->string = PrintInt((op1->i - value2));
6014 if(!exp->expType)
6015 {
6016 exp->expType = op1->type;
6017 if(op1->type)
6018 op1->type->refCount++;
6019 }
6020 return 0x1;
6021 }
6022
6023 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6024 {
6025 unsigned int value2 = op2->ui;
6026
6027 exp->type = 2;
6028 exp->string = PrintUInt((op1->ui - value2));
6029 if(!exp->expType)
6030 {
6031 exp->expType = op1->type;
6032 if(op1->type)
6033 op1->type->refCount++;
6034 }
6035 return 0x1;
6036 }
6037
6038 static unsigned int Int64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6039 {
6040 long long value2 = op2->i64;
6041
6042 exp->type = 2;
6043 exp->string = PrintInt64((op1->i64 - value2));
6044 if(!exp->expType)
6045 {
6046 exp->expType = op1->type;
6047 if(op1->type)
6048 op1->type->refCount++;
6049 }
6050 return 0x1;
6051 }
6052
6053 static unsigned int UInt64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6054 {
6055 uint64 value2 = op2->ui64;
6056
6057 exp->type = 2;
6058 exp->string = PrintUInt64((op1->ui64 - value2));
6059 if(!exp->expType)
6060 {
6061 exp->expType = op1->type;
6062 if(op1->type)
6063 op1->type->refCount++;
6064 }
6065 return 0x1;
6066 }
6067
6068 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6069 {
6070 short value2 = op2->s;
6071
6072 exp->type = 2;
6073 exp->string = PrintShort((op1->s - value2));
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 UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6084 {
6085 unsigned short value2 = op2->us;
6086
6087 exp->type = 2;
6088 exp->string = PrintUShort((op1->us - value2));
6089 if(!exp->expType)
6090 {
6091 exp->expType = op1->type;
6092 if(op1->type)
6093 op1->type->refCount++;
6094 }
6095 return 0x1;
6096 }
6097
6098 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6099 {
6100 char value2 = op2->c;
6101
6102 exp->type = 2;
6103 exp->string = PrintChar((op1->c - value2));
6104 if(!exp->expType)
6105 {
6106 exp->expType = op1->type;
6107 if(op1->type)
6108 op1->type->refCount++;
6109 }
6110 return 0x1;
6111 }
6112
6113 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6114 {
6115 unsigned char value2 = op2->uc;
6116
6117 exp->type = 2;
6118 exp->string = PrintUChar((op1->uc - value2));
6119 if(!exp->expType)
6120 {
6121 exp->expType = op1->type;
6122 if(op1->type)
6123 op1->type->refCount++;
6124 }
6125 return 0x1;
6126 }
6127
6128 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6129 {
6130 float value2 = op2->f;
6131
6132 exp->type = 2;
6133 exp->string = PrintFloat((float)(op1->f - value2));
6134 if(!exp->expType)
6135 {
6136 exp->expType = op1->type;
6137 if(op1->type)
6138 op1->type->refCount++;
6139 }
6140 return 0x1;
6141 }
6142
6143 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6144 {
6145 double value2 = op2->d;
6146
6147 exp->type = 2;
6148 exp->string = PrintDouble((double)(op1->d - value2));
6149 if(!exp->expType)
6150 {
6151 exp->expType = op1->type;
6152 if(op1->type)
6153 op1->type->refCount++;
6154 }
6155 return 0x1;
6156 }
6157
6158 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6159 {
6160 int value2 = op2->i;
6161
6162 exp->type = 2;
6163 exp->string = PrintInt((op1->i * value2));
6164 if(!exp->expType)
6165 {
6166 exp->expType = op1->type;
6167 if(op1->type)
6168 op1->type->refCount++;
6169 }
6170 return 0x1;
6171 }
6172
6173 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6174 {
6175 unsigned int value2 = op2->ui;
6176
6177 exp->type = 2;
6178 exp->string = PrintUInt((op1->ui * value2));
6179 if(!exp->expType)
6180 {
6181 exp->expType = op1->type;
6182 if(op1->type)
6183 op1->type->refCount++;
6184 }
6185 return 0x1;
6186 }
6187
6188 static unsigned int Int64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6189 {
6190 long long value2 = op2->i64;
6191
6192 exp->type = 2;
6193 exp->string = PrintInt64((op1->i64 * value2));
6194 if(!exp->expType)
6195 {
6196 exp->expType = op1->type;
6197 if(op1->type)
6198 op1->type->refCount++;
6199 }
6200 return 0x1;
6201 }
6202
6203 static unsigned int UInt64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6204 {
6205 uint64 value2 = op2->ui64;
6206
6207 exp->type = 2;
6208 exp->string = PrintUInt64((op1->ui64 * value2));
6209 if(!exp->expType)
6210 {
6211 exp->expType = op1->type;
6212 if(op1->type)
6213 op1->type->refCount++;
6214 }
6215 return 0x1;
6216 }
6217
6218 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6219 {
6220 short value2 = op2->s;
6221
6222 exp->type = 2;
6223 exp->string = PrintShort((op1->s * value2));
6224 if(!exp->expType)
6225 {
6226 exp->expType = op1->type;
6227 if(op1->type)
6228 op1->type->refCount++;
6229 }
6230 return 0x1;
6231 }
6232
6233 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6234 {
6235 unsigned short value2 = op2->us;
6236
6237 exp->type = 2;
6238 exp->string = PrintUShort((op1->us * value2));
6239 if(!exp->expType)
6240 {
6241 exp->expType = op1->type;
6242 if(op1->type)
6243 op1->type->refCount++;
6244 }
6245 return 0x1;
6246 }
6247
6248 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6249 {
6250 char value2 = op2->c;
6251
6252 exp->type = 2;
6253 exp->string = PrintChar((op1->c * value2));
6254 if(!exp->expType)
6255 {
6256 exp->expType = op1->type;
6257 if(op1->type)
6258 op1->type->refCount++;
6259 }
6260 return 0x1;
6261 }
6262
6263 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6264 {
6265 unsigned char value2 = op2->uc;
6266
6267 exp->type = 2;
6268 exp->string = PrintUChar((op1->uc * value2));
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 FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6279 {
6280 float value2 = op2->f;
6281
6282 exp->type = 2;
6283 exp->string = PrintFloat((float)(op1->f * value2));
6284 if(!exp->expType)
6285 {
6286 exp->expType = op1->type;
6287 if(op1->type)
6288 op1->type->refCount++;
6289 }
6290 return 0x1;
6291 }
6292
6293 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6294 {
6295 double value2 = op2->d;
6296
6297 exp->type = 2;
6298 exp->string = PrintDouble((double)(op1->d * value2));
6299 if(!exp->expType)
6300 {
6301 exp->expType = op1->type;
6302 if(op1->type)
6303 op1->type->refCount++;
6304 }
6305 return 0x1;
6306 }
6307
6308 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6309 {
6310 int value2 = op2->i;
6311
6312 exp->type = 2;
6313 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
6314 if(!exp->expType)
6315 {
6316 exp->expType = op1->type;
6317 if(op1->type)
6318 op1->type->refCount++;
6319 }
6320 return 0x1;
6321 }
6322
6323 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6324 {
6325 unsigned int value2 = op2->ui;
6326
6327 exp->type = 2;
6328 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6329 if(!exp->expType)
6330 {
6331 exp->expType = op1->type;
6332 if(op1->type)
6333 op1->type->refCount++;
6334 }
6335 return 0x1;
6336 }
6337
6338 static unsigned int Int64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6339 {
6340 long long value2 = op2->i64;
6341
6342 exp->type = 2;
6343 exp->string = PrintInt64(value2 ? (op1->i64 / value2) : 0);
6344 if(!exp->expType)
6345 {
6346 exp->expType = op1->type;
6347 if(op1->type)
6348 op1->type->refCount++;
6349 }
6350 return 0x1;
6351 }
6352
6353 static unsigned int UInt64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6354 {
6355 uint64 value2 = op2->ui64;
6356
6357 exp->type = 2;
6358 exp->string = PrintUInt64(value2 ? (op1->ui64 / value2) : 0);
6359 if(!exp->expType)
6360 {
6361 exp->expType = op1->type;
6362 if(op1->type)
6363 op1->type->refCount++;
6364 }
6365 return 0x1;
6366 }
6367
6368 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6369 {
6370 short value2 = op2->s;
6371
6372 exp->type = 2;
6373 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6374 if(!exp->expType)
6375 {
6376 exp->expType = op1->type;
6377 if(op1->type)
6378 op1->type->refCount++;
6379 }
6380 return 0x1;
6381 }
6382
6383 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6384 {
6385 unsigned short value2 = op2->us;
6386
6387 exp->type = 2;
6388 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6389 if(!exp->expType)
6390 {
6391 exp->expType = op1->type;
6392 if(op1->type)
6393 op1->type->refCount++;
6394 }
6395 return 0x1;
6396 }
6397
6398 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6399 {
6400 char value2 = op2->c;
6401
6402 exp->type = 2;
6403 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6404 if(!exp->expType)
6405 {
6406 exp->expType = op1->type;
6407 if(op1->type)
6408 op1->type->refCount++;
6409 }
6410 return 0x1;
6411 }
6412
6413 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6414 {
6415 unsigned char value2 = op2->uc;
6416
6417 exp->type = 2;
6418 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6419 if(!exp->expType)
6420 {
6421 exp->expType = op1->type;
6422 if(op1->type)
6423 op1->type->refCount++;
6424 }
6425 return 0x1;
6426 }
6427
6428 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6429 {
6430 float value2 = op2->f;
6431
6432 exp->type = 2;
6433 exp->string = PrintFloat(op1->f / value2);
6434 if(!exp->expType)
6435 {
6436 exp->expType = op1->type;
6437 if(op1->type)
6438 op1->type->refCount++;
6439 }
6440 return 0x1;
6441 }
6442
6443 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6444 {
6445 double value2 = op2->d;
6446
6447 exp->type = 2;
6448 exp->string = PrintDouble(op1->d / value2);
6449 if(!exp->expType)
6450 {
6451 exp->expType = op1->type;
6452 if(op1->type)
6453 op1->type->refCount++;
6454 }
6455 return 0x1;
6456 }
6457
6458 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6459 {
6460 int value2 = op2->i;
6461
6462 exp->type = 2;
6463 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6464 if(!exp->expType)
6465 {
6466 exp->expType = op1->type;
6467 if(op1->type)
6468 op1->type->refCount++;
6469 }
6470 return 0x1;
6471 }
6472
6473 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6474 {
6475 unsigned int value2 = op2->ui;
6476
6477 exp->type = 2;
6478 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6479 if(!exp->expType)
6480 {
6481 exp->expType = op1->type;
6482 if(op1->type)
6483 op1->type->refCount++;
6484 }
6485 return 0x1;
6486 }
6487
6488 static unsigned int Int64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6489 {
6490 long long value2 = op2->i64;
6491
6492 exp->type = 2;
6493 exp->string = PrintInt64(value2 ? (op1->i64 % value2) : 0);
6494 if(!exp->expType)
6495 {
6496 exp->expType = op1->type;
6497 if(op1->type)
6498 op1->type->refCount++;
6499 }
6500 return 0x1;
6501 }
6502
6503 static unsigned int UInt64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6504 {
6505 uint64 value2 = op2->ui64;
6506
6507 exp->type = 2;
6508 exp->string = PrintUInt64(value2 ? (op1->ui64 % value2) : 0);
6509 if(!exp->expType)
6510 {
6511 exp->expType = op1->type;
6512 if(op1->type)
6513 op1->type->refCount++;
6514 }
6515 return 0x1;
6516 }
6517
6518 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6519 {
6520 short value2 = op2->s;
6521
6522 exp->type = 2;
6523 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6524 if(!exp->expType)
6525 {
6526 exp->expType = op1->type;
6527 if(op1->type)
6528 op1->type->refCount++;
6529 }
6530 return 0x1;
6531 }
6532
6533 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6534 {
6535 unsigned short value2 = op2->us;
6536
6537 exp->type = 2;
6538 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6539 if(!exp->expType)
6540 {
6541 exp->expType = op1->type;
6542 if(op1->type)
6543 op1->type->refCount++;
6544 }
6545 return 0x1;
6546 }
6547
6548 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6549 {
6550 char value2 = op2->c;
6551
6552 exp->type = 2;
6553 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6554 if(!exp->expType)
6555 {
6556 exp->expType = op1->type;
6557 if(op1->type)
6558 op1->type->refCount++;
6559 }
6560 return 0x1;
6561 }
6562
6563 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6564 {
6565 unsigned char value2 = op2->uc;
6566
6567 exp->type = 2;
6568 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6569 if(!exp->expType)
6570 {
6571 exp->expType = op1->type;
6572 if(op1->type)
6573 op1->type->refCount++;
6574 }
6575 return 0x1;
6576 }
6577
6578 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6579 {
6580 exp->type = 2;
6581 exp->string = PrintInt((-op1->i));
6582 if(!exp->expType)
6583 {
6584 exp->expType = op1->type;
6585 if(op1->type)
6586 op1->type->refCount++;
6587 }
6588 return 0x1;
6589 }
6590
6591 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6592 {
6593 exp->type = 2;
6594 exp->string = PrintUInt((unsigned int)(-op1->ui));
6595 if(!exp->expType)
6596 {
6597 exp->expType = op1->type;
6598 if(op1->type)
6599 op1->type->refCount++;
6600 }
6601 return 0x1;
6602 }
6603
6604 static unsigned int Int64Neg(struct Expression * exp, struct Operand * op1)
6605 {
6606 exp->type = 2;
6607 exp->string = PrintInt64((-op1->i64));
6608 if(!exp->expType)
6609 {
6610 exp->expType = op1->type;
6611 if(op1->type)
6612 op1->type->refCount++;
6613 }
6614 return 0x1;
6615 }
6616
6617 static unsigned int UInt64Neg(struct Expression * exp, struct Operand * op1)
6618 {
6619 exp->type = 2;
6620 exp->string = PrintUInt64((uint64)(-op1->ui64));
6621 if(!exp->expType)
6622 {
6623 exp->expType = op1->type;
6624 if(op1->type)
6625 op1->type->refCount++;
6626 }
6627 return 0x1;
6628 }
6629
6630 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6631 {
6632 exp->type = 2;
6633 exp->string = PrintShort((-op1->s));
6634 if(!exp->expType)
6635 {
6636 exp->expType = op1->type;
6637 if(op1->type)
6638 op1->type->refCount++;
6639 }
6640 return 0x1;
6641 }
6642
6643 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6644 {
6645 exp->type = 2;
6646 exp->string = PrintUShort((unsigned short)(-op1->us));
6647 if(!exp->expType)
6648 {
6649 exp->expType = op1->type;
6650 if(op1->type)
6651 op1->type->refCount++;
6652 }
6653 return 0x1;
6654 }
6655
6656 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6657 {
6658 exp->type = 2;
6659 exp->string = PrintChar((-op1->c));
6660 if(!exp->expType)
6661 {
6662 exp->expType = op1->type;
6663 if(op1->type)
6664 op1->type->refCount++;
6665 }
6666 return 0x1;
6667 }
6668
6669 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6670 {
6671 exp->type = 2;
6672 exp->string = PrintUChar((unsigned char)(-op1->uc));
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 FloatNeg(struct Expression * exp, struct Operand * op1)
6683 {
6684 exp->type = 2;
6685 exp->string = PrintFloat((float)(-op1->f));
6686 if(!exp->expType)
6687 {
6688 exp->expType = op1->type;
6689 if(op1->type)
6690 op1->type->refCount++;
6691 }
6692 return 0x1;
6693 }
6694
6695 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6696 {
6697 exp->type = 2;
6698 exp->string = PrintDouble((double)(-op1->d));
6699 if(!exp->expType)
6700 {
6701 exp->expType = op1->type;
6702 if(op1->type)
6703 op1->type->refCount++;
6704 }
6705 return 0x1;
6706 }
6707
6708 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6709 {
6710 exp->type = 2;
6711 exp->string = PrintInt((++op1->i));
6712 if(!exp->expType)
6713 {
6714 exp->expType = op1->type;
6715 if(op1->type)
6716 op1->type->refCount++;
6717 }
6718 return 0x1;
6719 }
6720
6721 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6722 {
6723 exp->type = 2;
6724 exp->string = PrintUInt((++op1->ui));
6725 if(!exp->expType)
6726 {
6727 exp->expType = op1->type;
6728 if(op1->type)
6729 op1->type->refCount++;
6730 }
6731 return 0x1;
6732 }
6733
6734 static unsigned int Int64Inc(struct Expression * exp, struct Operand * op1)
6735 {
6736 exp->type = 2;
6737 exp->string = PrintInt64((++op1->i64));
6738 if(!exp->expType)
6739 {
6740 exp->expType = op1->type;
6741 if(op1->type)
6742 op1->type->refCount++;
6743 }
6744 return 0x1;
6745 }
6746
6747 static unsigned int UInt64Inc(struct Expression * exp, struct Operand * op1)
6748 {
6749 exp->type = 2;
6750 exp->string = PrintUInt64((++op1->ui64));
6751 if(!exp->expType)
6752 {
6753 exp->expType = op1->type;
6754 if(op1->type)
6755 op1->type->refCount++;
6756 }
6757 return 0x1;
6758 }
6759
6760 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6761 {
6762 exp->type = 2;
6763 exp->string = PrintShort((++op1->s));
6764 if(!exp->expType)
6765 {
6766 exp->expType = op1->type;
6767 if(op1->type)
6768 op1->type->refCount++;
6769 }
6770 return 0x1;
6771 }
6772
6773 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6774 {
6775 exp->type = 2;
6776 exp->string = PrintUShort((++op1->us));
6777 if(!exp->expType)
6778 {
6779 exp->expType = op1->type;
6780 if(op1->type)
6781 op1->type->refCount++;
6782 }
6783 return 0x1;
6784 }
6785
6786 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6787 {
6788 exp->type = 2;
6789 exp->string = PrintChar((++op1->c));
6790 if(!exp->expType)
6791 {
6792 exp->expType = op1->type;
6793 if(op1->type)
6794 op1->type->refCount++;
6795 }
6796 return 0x1;
6797 }
6798
6799 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6800 {
6801 exp->type = 2;
6802 exp->string = PrintUChar((++op1->uc));
6803 if(!exp->expType)
6804 {
6805 exp->expType = op1->type;
6806 if(op1->type)
6807 op1->type->refCount++;
6808 }
6809 return 0x1;
6810 }
6811
6812 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6813 {
6814 exp->type = 2;
6815 exp->string = PrintFloat((float)(++op1->f));
6816 if(!exp->expType)
6817 {
6818 exp->expType = op1->type;
6819 if(op1->type)
6820 op1->type->refCount++;
6821 }
6822 return 0x1;
6823 }
6824
6825 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6826 {
6827 exp->type = 2;
6828 exp->string = PrintDouble((double)(++op1->d));
6829 if(!exp->expType)
6830 {
6831 exp->expType = op1->type;
6832 if(op1->type)
6833 op1->type->refCount++;
6834 }
6835 return 0x1;
6836 }
6837
6838 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6839 {
6840 exp->type = 2;
6841 exp->string = PrintInt((--op1->i));
6842 if(!exp->expType)
6843 {
6844 exp->expType = op1->type;
6845 if(op1->type)
6846 op1->type->refCount++;
6847 }
6848 return 0x1;
6849 }
6850
6851 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6852 {
6853 exp->type = 2;
6854 exp->string = PrintUInt((--op1->ui));
6855 if(!exp->expType)
6856 {
6857 exp->expType = op1->type;
6858 if(op1->type)
6859 op1->type->refCount++;
6860 }
6861 return 0x1;
6862 }
6863
6864 static unsigned int Int64Dec(struct Expression * exp, struct Operand * op1)
6865 {
6866 exp->type = 2;
6867 exp->string = PrintInt64((--op1->i64));
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 UInt64Dec(struct Expression * exp, struct Operand * op1)
6878 {
6879 exp->type = 2;
6880 exp->string = PrintUInt64((--op1->ui64));
6881 if(!exp->expType)
6882 {
6883 exp->expType = op1->type;
6884 if(op1->type)
6885 op1->type->refCount++;
6886 }
6887 return 0x1;
6888 }
6889
6890 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6891 {
6892 exp->type = 2;
6893 exp->string = PrintShort((--op1->s));
6894 if(!exp->expType)
6895 {
6896 exp->expType = op1->type;
6897 if(op1->type)
6898 op1->type->refCount++;
6899 }
6900 return 0x1;
6901 }
6902
6903 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6904 {
6905 exp->type = 2;
6906 exp->string = PrintUShort((--op1->us));
6907 if(!exp->expType)
6908 {
6909 exp->expType = op1->type;
6910 if(op1->type)
6911 op1->type->refCount++;
6912 }
6913 return 0x1;
6914 }
6915
6916 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6917 {
6918 exp->type = 2;
6919 exp->string = PrintChar((--op1->c));
6920 if(!exp->expType)
6921 {
6922 exp->expType = op1->type;
6923 if(op1->type)
6924 op1->type->refCount++;
6925 }
6926 return 0x1;
6927 }
6928
6929 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6930 {
6931 exp->type = 2;
6932 exp->string = PrintUChar((--op1->uc));
6933 if(!exp->expType)
6934 {
6935 exp->expType = op1->type;
6936 if(op1->type)
6937 op1->type->refCount++;
6938 }
6939 return 0x1;
6940 }
6941
6942 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6943 {
6944 exp->type = 2;
6945 exp->string = PrintFloat((float)(--op1->f));
6946 if(!exp->expType)
6947 {
6948 exp->expType = op1->type;
6949 if(op1->type)
6950 op1->type->refCount++;
6951 }
6952 return 0x1;
6953 }
6954
6955 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6956 {
6957 exp->type = 2;
6958 exp->string = PrintDouble((double)(--op1->d));
6959 if(!exp->expType)
6960 {
6961 exp->expType = op1->type;
6962 if(op1->type)
6963 op1->type->refCount++;
6964 }
6965 return 0x1;
6966 }
6967
6968 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6969 {
6970 int value2 = op2->i;
6971
6972 exp->type = 2;
6973 exp->string = PrintInt((op1->i = value2));
6974 if(!exp->expType)
6975 {
6976 exp->expType = op1->type;
6977 if(op1->type)
6978 op1->type->refCount++;
6979 }
6980 return 0x1;
6981 }
6982
6983 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6984 {
6985 unsigned int value2 = op2->ui;
6986
6987 exp->type = 2;
6988 exp->string = PrintUInt((op1->ui = value2));
6989 if(!exp->expType)
6990 {
6991 exp->expType = op1->type;
6992 if(op1->type)
6993 op1->type->refCount++;
6994 }
6995 return 0x1;
6996 }
6997
6998 static unsigned int Int64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6999 {
7000 long long value2 = op2->i64;
7001
7002 exp->type = 2;
7003 exp->string = PrintInt64((op1->i64 = value2));
7004 if(!exp->expType)
7005 {
7006 exp->expType = op1->type;
7007 if(op1->type)
7008 op1->type->refCount++;
7009 }
7010 return 0x1;
7011 }
7012
7013 static unsigned int UInt64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7014 {
7015 uint64 value2 = op2->ui64;
7016
7017 exp->type = 2;
7018 exp->string = PrintUInt64((op1->ui64 = value2));
7019 if(!exp->expType)
7020 {
7021 exp->expType = op1->type;
7022 if(op1->type)
7023 op1->type->refCount++;
7024 }
7025 return 0x1;
7026 }
7027
7028 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7029 {
7030 short value2 = op2->s;
7031
7032 exp->type = 2;
7033 exp->string = PrintShort((op1->s = value2));
7034 if(!exp->expType)
7035 {
7036 exp->expType = op1->type;
7037 if(op1->type)
7038 op1->type->refCount++;
7039 }
7040 return 0x1;
7041 }
7042
7043 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7044 {
7045 unsigned short value2 = op2->us;
7046
7047 exp->type = 2;
7048 exp->string = PrintUShort((op1->us = value2));
7049 if(!exp->expType)
7050 {
7051 exp->expType = op1->type;
7052 if(op1->type)
7053 op1->type->refCount++;
7054 }
7055 return 0x1;
7056 }
7057
7058 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7059 {
7060 char value2 = op2->c;
7061
7062 exp->type = 2;
7063 exp->string = PrintChar((op1->c = value2));
7064 if(!exp->expType)
7065 {
7066 exp->expType = op1->type;
7067 if(op1->type)
7068 op1->type->refCount++;
7069 }
7070 return 0x1;
7071 }
7072
7073 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7074 {
7075 unsigned char value2 = op2->uc;
7076
7077 exp->type = 2;
7078 exp->string = PrintUChar((op1->uc = value2));
7079 if(!exp->expType)
7080 {
7081 exp->expType = op1->type;
7082 if(op1->type)
7083 op1->type->refCount++;
7084 }
7085 return 0x1;
7086 }
7087
7088 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7089 {
7090 float value2 = op2->f;
7091
7092 exp->type = 2;
7093 exp->string = PrintFloat((float)(op1->f = value2));
7094 if(!exp->expType)
7095 {
7096 exp->expType = op1->type;
7097 if(op1->type)
7098 op1->type->refCount++;
7099 }
7100 return 0x1;
7101 }
7102
7103 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7104 {
7105 double value2 = op2->d;
7106
7107 exp->type = 2;
7108 exp->string = PrintDouble((double)(op1->d = value2));
7109 if(!exp->expType)
7110 {
7111 exp->expType = op1->type;
7112 if(op1->type)
7113 op1->type->refCount++;
7114 }
7115 return 0x1;
7116 }
7117
7118 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7119 {
7120 int value2 = op2->i;
7121
7122 exp->type = 2;
7123 exp->string = PrintInt((op1->i += value2));
7124 if(!exp->expType)
7125 {
7126 exp->expType = op1->type;
7127 if(op1->type)
7128 op1->type->refCount++;
7129 }
7130 return 0x1;
7131 }
7132
7133 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7134 {
7135 unsigned int value2 = op2->ui;
7136
7137 exp->type = 2;
7138 exp->string = PrintUInt((op1->ui += value2));
7139 if(!exp->expType)
7140 {
7141 exp->expType = op1->type;
7142 if(op1->type)
7143 op1->type->refCount++;
7144 }
7145 return 0x1;
7146 }
7147
7148 static unsigned int Int64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7149 {
7150 long long value2 = op2->i64;
7151
7152 exp->type = 2;
7153 exp->string = PrintInt64((op1->i64 += value2));
7154 if(!exp->expType)
7155 {
7156 exp->expType = op1->type;
7157 if(op1->type)
7158 op1->type->refCount++;
7159 }
7160 return 0x1;
7161 }
7162
7163 static unsigned int UInt64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7164 {
7165 uint64 value2 = op2->ui64;
7166
7167 exp->type = 2;
7168 exp->string = PrintUInt64((op1->ui64 += value2));
7169 if(!exp->expType)
7170 {
7171 exp->expType = op1->type;
7172 if(op1->type)
7173 op1->type->refCount++;
7174 }
7175 return 0x1;
7176 }
7177
7178 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7179 {
7180 short value2 = op2->s;
7181
7182 exp->type = 2;
7183 exp->string = PrintShort((op1->s += value2));
7184 if(!exp->expType)
7185 {
7186 exp->expType = op1->type;
7187 if(op1->type)
7188 op1->type->refCount++;
7189 }
7190 return 0x1;
7191 }
7192
7193 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7194 {
7195 unsigned short value2 = op2->us;
7196
7197 exp->type = 2;
7198 exp->string = PrintUShort((op1->us += value2));
7199 if(!exp->expType)
7200 {
7201 exp->expType = op1->type;
7202 if(op1->type)
7203 op1->type->refCount++;
7204 }
7205 return 0x1;
7206 }
7207
7208 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7209 {
7210 char value2 = op2->c;
7211
7212 exp->type = 2;
7213 exp->string = PrintChar((op1->c += value2));
7214 if(!exp->expType)
7215 {
7216 exp->expType = op1->type;
7217 if(op1->type)
7218 op1->type->refCount++;
7219 }
7220 return 0x1;
7221 }
7222
7223 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7224 {
7225 unsigned char value2 = op2->uc;
7226
7227 exp->type = 2;
7228 exp->string = PrintUChar((op1->uc += value2));
7229 if(!exp->expType)
7230 {
7231 exp->expType = op1->type;
7232 if(op1->type)
7233 op1->type->refCount++;
7234 }
7235 return 0x1;
7236 }
7237
7238 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7239 {
7240 float value2 = op2->f;
7241
7242 exp->type = 2;
7243 exp->string = PrintFloat((float)(op1->f += value2));
7244 if(!exp->expType)
7245 {
7246 exp->expType = op1->type;
7247 if(op1->type)
7248 op1->type->refCount++;
7249 }
7250 return 0x1;
7251 }
7252
7253 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7254 {
7255 double value2 = op2->d;
7256
7257 exp->type = 2;
7258 exp->string = PrintDouble((double)(op1->d += value2));
7259 if(!exp->expType)
7260 {
7261 exp->expType = op1->type;
7262 if(op1->type)
7263 op1->type->refCount++;
7264 }
7265 return 0x1;
7266 }
7267
7268 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7269 {
7270 int value2 = op2->i;
7271
7272 exp->type = 2;
7273 exp->string = PrintInt((op1->i -= value2));
7274 if(!exp->expType)
7275 {
7276 exp->expType = op1->type;
7277 if(op1->type)
7278 op1->type->refCount++;
7279 }
7280 return 0x1;
7281 }
7282
7283 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7284 {
7285 unsigned int value2 = op2->ui;
7286
7287 exp->type = 2;
7288 exp->string = PrintUInt((op1->ui -= value2));
7289 if(!exp->expType)
7290 {
7291 exp->expType = op1->type;
7292 if(op1->type)
7293 op1->type->refCount++;
7294 }
7295 return 0x1;
7296 }
7297
7298 static unsigned int Int64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7299 {
7300 long long value2 = op2->i64;
7301
7302 exp->type = 2;
7303 exp->string = PrintInt64((op1->i64 -= value2));
7304 if(!exp->expType)
7305 {
7306 exp->expType = op1->type;
7307 if(op1->type)
7308 op1->type->refCount++;
7309 }
7310 return 0x1;
7311 }
7312
7313 static unsigned int UInt64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7314 {
7315 uint64 value2 = op2->ui64;
7316
7317 exp->type = 2;
7318 exp->string = PrintUInt64((op1->ui64 -= value2));
7319 if(!exp->expType)
7320 {
7321 exp->expType = op1->type;
7322 if(op1->type)
7323 op1->type->refCount++;
7324 }
7325 return 0x1;
7326 }
7327
7328 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7329 {
7330 short value2 = op2->s;
7331
7332 exp->type = 2;
7333 exp->string = PrintShort((op1->s -= value2));
7334 if(!exp->expType)
7335 {
7336 exp->expType = op1->type;
7337 if(op1->type)
7338 op1->type->refCount++;
7339 }
7340 return 0x1;
7341 }
7342
7343 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7344 {
7345 unsigned short value2 = op2->us;
7346
7347 exp->type = 2;
7348 exp->string = PrintUShort((op1->us -= value2));
7349 if(!exp->expType)
7350 {
7351 exp->expType = op1->type;
7352 if(op1->type)
7353 op1->type->refCount++;
7354 }
7355 return 0x1;
7356 }
7357
7358 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7359 {
7360 char value2 = op2->c;
7361
7362 exp->type = 2;
7363 exp->string = PrintChar((op1->c -= value2));
7364 if(!exp->expType)
7365 {
7366 exp->expType = op1->type;
7367 if(op1->type)
7368 op1->type->refCount++;
7369 }
7370 return 0x1;
7371 }
7372
7373 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7374 {
7375 unsigned char value2 = op2->uc;
7376
7377 exp->type = 2;
7378 exp->string = PrintUChar((op1->uc -= value2));
7379 if(!exp->expType)
7380 {
7381 exp->expType = op1->type;
7382 if(op1->type)
7383 op1->type->refCount++;
7384 }
7385 return 0x1;
7386 }
7387
7388 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7389 {
7390 float value2 = op2->f;
7391
7392 exp->type = 2;
7393 exp->string = PrintFloat((float)(op1->f -= value2));
7394 if(!exp->expType)
7395 {
7396 exp->expType = op1->type;
7397 if(op1->type)
7398 op1->type->refCount++;
7399 }
7400 return 0x1;
7401 }
7402
7403 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7404 {
7405 double value2 = op2->d;
7406
7407 exp->type = 2;
7408 exp->string = PrintDouble((double)(op1->d -= value2));
7409 if(!exp->expType)
7410 {
7411 exp->expType = op1->type;
7412 if(op1->type)
7413 op1->type->refCount++;
7414 }
7415 return 0x1;
7416 }
7417
7418 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7419 {
7420 int value2 = op2->i;
7421
7422 exp->type = 2;
7423 exp->string = PrintInt((op1->i *= value2));
7424 if(!exp->expType)
7425 {
7426 exp->expType = op1->type;
7427 if(op1->type)
7428 op1->type->refCount++;
7429 }
7430 return 0x1;
7431 }
7432
7433 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7434 {
7435 unsigned int value2 = op2->ui;
7436
7437 exp->type = 2;
7438 exp->string = PrintUInt((op1->ui *= value2));
7439 if(!exp->expType)
7440 {
7441 exp->expType = op1->type;
7442 if(op1->type)
7443 op1->type->refCount++;
7444 }
7445 return 0x1;
7446 }
7447
7448 static unsigned int Int64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7449 {
7450 long long value2 = op2->i64;
7451
7452 exp->type = 2;
7453 exp->string = PrintInt64((op1->i64 *= value2));
7454 if(!exp->expType)
7455 {
7456 exp->expType = op1->type;
7457 if(op1->type)
7458 op1->type->refCount++;
7459 }
7460 return 0x1;
7461 }
7462
7463 static unsigned int UInt64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7464 {
7465 uint64 value2 = op2->ui64;
7466
7467 exp->type = 2;
7468 exp->string = PrintUInt64((op1->ui64 *= value2));
7469 if(!exp->expType)
7470 {
7471 exp->expType = op1->type;
7472 if(op1->type)
7473 op1->type->refCount++;
7474 }
7475 return 0x1;
7476 }
7477
7478 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7479 {
7480 short value2 = op2->s;
7481
7482 exp->type = 2;
7483 exp->string = PrintShort((op1->s *= value2));
7484 if(!exp->expType)
7485 {
7486 exp->expType = op1->type;
7487 if(op1->type)
7488 op1->type->refCount++;
7489 }
7490 return 0x1;
7491 }
7492
7493 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7494 {
7495 unsigned short value2 = op2->us;
7496
7497 exp->type = 2;
7498 exp->string = PrintUShort((op1->us *= value2));
7499 if(!exp->expType)
7500 {
7501 exp->expType = op1->type;
7502 if(op1->type)
7503 op1->type->refCount++;
7504 }
7505 return 0x1;
7506 }
7507
7508 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7509 {
7510 char value2 = op2->c;
7511
7512 exp->type = 2;
7513 exp->string = PrintChar((op1->c *= value2));
7514 if(!exp->expType)
7515 {
7516 exp->expType = op1->type;
7517 if(op1->type)
7518 op1->type->refCount++;
7519 }
7520 return 0x1;
7521 }
7522
7523 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7524 {
7525 unsigned char value2 = op2->uc;
7526
7527 exp->type = 2;
7528 exp->string = PrintUChar((op1->uc *= value2));
7529 if(!exp->expType)
7530 {
7531 exp->expType = op1->type;
7532 if(op1->type)
7533 op1->type->refCount++;
7534 }
7535 return 0x1;
7536 }
7537
7538 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7539 {
7540 float value2 = op2->f;
7541
7542 exp->type = 2;
7543 exp->string = PrintFloat((float)(op1->f *= value2));
7544 if(!exp->expType)
7545 {
7546 exp->expType = op1->type;
7547 if(op1->type)
7548 op1->type->refCount++;
7549 }
7550 return 0x1;
7551 }
7552
7553 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7554 {
7555 double value2 = op2->d;
7556
7557 exp->type = 2;
7558 exp->string = PrintDouble((double)(op1->d *= value2));
7559 if(!exp->expType)
7560 {
7561 exp->expType = op1->type;
7562 if(op1->type)
7563 op1->type->refCount++;
7564 }
7565 return 0x1;
7566 }
7567
7568 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7569 {
7570 int value2 = op2->i;
7571
7572 exp->type = 2;
7573 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
7574 if(!exp->expType)
7575 {
7576 exp->expType = op1->type;
7577 if(op1->type)
7578 op1->type->refCount++;
7579 }
7580 return 0x1;
7581 }
7582
7583 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7584 {
7585 unsigned int value2 = op2->ui;
7586
7587 exp->type = 2;
7588 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7589 if(!exp->expType)
7590 {
7591 exp->expType = op1->type;
7592 if(op1->type)
7593 op1->type->refCount++;
7594 }
7595 return 0x1;
7596 }
7597
7598 static unsigned int Int64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7599 {
7600 long long value2 = op2->i64;
7601
7602 exp->type = 2;
7603 exp->string = PrintInt64(value2 ? (op1->i64 /= value2) : 0);
7604 if(!exp->expType)
7605 {
7606 exp->expType = op1->type;
7607 if(op1->type)
7608 op1->type->refCount++;
7609 }
7610 return 0x1;
7611 }
7612
7613 static unsigned int UInt64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7614 {
7615 uint64 value2 = op2->ui64;
7616
7617 exp->type = 2;
7618 exp->string = PrintUInt64(value2 ? (op1->ui64 /= value2) : 0);
7619 if(!exp->expType)
7620 {
7621 exp->expType = op1->type;
7622 if(op1->type)
7623 op1->type->refCount++;
7624 }
7625 return 0x1;
7626 }
7627
7628 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7629 {
7630 short value2 = op2->s;
7631
7632 exp->type = 2;
7633 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7634 if(!exp->expType)
7635 {
7636 exp->expType = op1->type;
7637 if(op1->type)
7638 op1->type->refCount++;
7639 }
7640 return 0x1;
7641 }
7642
7643 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7644 {
7645 unsigned short value2 = op2->us;
7646
7647 exp->type = 2;
7648 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7649 if(!exp->expType)
7650 {
7651 exp->expType = op1->type;
7652 if(op1->type)
7653 op1->type->refCount++;
7654 }
7655 return 0x1;
7656 }
7657
7658 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7659 {
7660 char value2 = op2->c;
7661
7662 exp->type = 2;
7663 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7664 if(!exp->expType)
7665 {
7666 exp->expType = op1->type;
7667 if(op1->type)
7668 op1->type->refCount++;
7669 }
7670 return 0x1;
7671 }
7672
7673 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7674 {
7675 unsigned char value2 = op2->uc;
7676
7677 exp->type = 2;
7678 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7679 if(!exp->expType)
7680 {
7681 exp->expType = op1->type;
7682 if(op1->type)
7683 op1->type->refCount++;
7684 }
7685 return 0x1;
7686 }
7687
7688 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7689 {
7690 float value2 = op2->f;
7691
7692 exp->type = 2;
7693 exp->string = PrintFloat(op1->f /= value2);
7694 if(!exp->expType)
7695 {
7696 exp->expType = op1->type;
7697 if(op1->type)
7698 op1->type->refCount++;
7699 }
7700 return 0x1;
7701 }
7702
7703 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7704 {
7705 double value2 = op2->d;
7706
7707 exp->type = 2;
7708 exp->string = PrintDouble(op1->d /= value2);
7709 if(!exp->expType)
7710 {
7711 exp->expType = op1->type;
7712 if(op1->type)
7713 op1->type->refCount++;
7714 }
7715 return 0x1;
7716 }
7717
7718 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7719 {
7720 int value2 = op2->i;
7721
7722 exp->type = 2;
7723 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7724 if(!exp->expType)
7725 {
7726 exp->expType = op1->type;
7727 if(op1->type)
7728 op1->type->refCount++;
7729 }
7730 return 0x1;
7731 }
7732
7733 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7734 {
7735 unsigned int value2 = op2->ui;
7736
7737 exp->type = 2;
7738 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7739 if(!exp->expType)
7740 {
7741 exp->expType = op1->type;
7742 if(op1->type)
7743 op1->type->refCount++;
7744 }
7745 return 0x1;
7746 }
7747
7748 static unsigned int Int64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7749 {
7750 long long value2 = op2->i64;
7751
7752 exp->type = 2;
7753 exp->string = PrintInt64(value2 ? (op1->i64 %= value2) : 0);
7754 if(!exp->expType)
7755 {
7756 exp->expType = op1->type;
7757 if(op1->type)
7758 op1->type->refCount++;
7759 }
7760 return 0x1;
7761 }
7762
7763 static unsigned int UInt64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7764 {
7765 uint64 value2 = op2->ui64;
7766
7767 exp->type = 2;
7768 exp->string = PrintUInt64(value2 ? (op1->ui64 %= value2) : 0);
7769 if(!exp->expType)
7770 {
7771 exp->expType = op1->type;
7772 if(op1->type)
7773 op1->type->refCount++;
7774 }
7775 return 0x1;
7776 }
7777
7778 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7779 {
7780 short value2 = op2->s;
7781
7782 exp->type = 2;
7783 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7784 if(!exp->expType)
7785 {
7786 exp->expType = op1->type;
7787 if(op1->type)
7788 op1->type->refCount++;
7789 }
7790 return 0x1;
7791 }
7792
7793 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7794 {
7795 unsigned short value2 = op2->us;
7796
7797 exp->type = 2;
7798 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7799 if(!exp->expType)
7800 {
7801 exp->expType = op1->type;
7802 if(op1->type)
7803 op1->type->refCount++;
7804 }
7805 return 0x1;
7806 }
7807
7808 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7809 {
7810 char value2 = op2->c;
7811
7812 exp->type = 2;
7813 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7814 if(!exp->expType)
7815 {
7816 exp->expType = op1->type;
7817 if(op1->type)
7818 op1->type->refCount++;
7819 }
7820 return 0x1;
7821 }
7822
7823 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7824 {
7825 unsigned char value2 = op2->uc;
7826
7827 exp->type = 2;
7828 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7829 if(!exp->expType)
7830 {
7831 exp->expType = op1->type;
7832 if(op1->type)
7833 op1->type->refCount++;
7834 }
7835 return 0x1;
7836 }
7837
7838 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7839 {
7840 int value2 = op2->i;
7841
7842 exp->type = 2;
7843 exp->string = PrintInt((op1->i & value2));
7844 if(!exp->expType)
7845 {
7846 exp->expType = op1->type;
7847 if(op1->type)
7848 op1->type->refCount++;
7849 }
7850 return 0x1;
7851 }
7852
7853 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7854 {
7855 unsigned int value2 = op2->ui;
7856
7857 exp->type = 2;
7858 exp->string = PrintUInt((op1->ui & value2));
7859 if(!exp->expType)
7860 {
7861 exp->expType = op1->type;
7862 if(op1->type)
7863 op1->type->refCount++;
7864 }
7865 return 0x1;
7866 }
7867
7868 static unsigned int Int64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7869 {
7870 long long value2 = op2->i64;
7871
7872 exp->type = 2;
7873 exp->string = PrintInt64((op1->i64 & value2));
7874 if(!exp->expType)
7875 {
7876 exp->expType = op1->type;
7877 if(op1->type)
7878 op1->type->refCount++;
7879 }
7880 return 0x1;
7881 }
7882
7883 static unsigned int UInt64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7884 {
7885 uint64 value2 = op2->ui64;
7886
7887 exp->type = 2;
7888 exp->string = PrintUInt64((op1->ui64 & value2));
7889 if(!exp->expType)
7890 {
7891 exp->expType = op1->type;
7892 if(op1->type)
7893 op1->type->refCount++;
7894 }
7895 return 0x1;
7896 }
7897
7898 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7899 {
7900 short value2 = op2->s;
7901
7902 exp->type = 2;
7903 exp->string = PrintShort((op1->s & value2));
7904 if(!exp->expType)
7905 {
7906 exp->expType = op1->type;
7907 if(op1->type)
7908 op1->type->refCount++;
7909 }
7910 return 0x1;
7911 }
7912
7913 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7914 {
7915 unsigned short value2 = op2->us;
7916
7917 exp->type = 2;
7918 exp->string = PrintUShort((op1->us & value2));
7919 if(!exp->expType)
7920 {
7921 exp->expType = op1->type;
7922 if(op1->type)
7923 op1->type->refCount++;
7924 }
7925 return 0x1;
7926 }
7927
7928 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7929 {
7930 char value2 = op2->c;
7931
7932 exp->type = 2;
7933 exp->string = PrintChar((op1->c & value2));
7934 if(!exp->expType)
7935 {
7936 exp->expType = op1->type;
7937 if(op1->type)
7938 op1->type->refCount++;
7939 }
7940 return 0x1;
7941 }
7942
7943 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7944 {
7945 unsigned char value2 = op2->uc;
7946
7947 exp->type = 2;
7948 exp->string = PrintUChar((op1->uc & value2));
7949 if(!exp->expType)
7950 {
7951 exp->expType = op1->type;
7952 if(op1->type)
7953 op1->type->refCount++;
7954 }
7955 return 0x1;
7956 }
7957
7958 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7959 {
7960 int value2 = op2->i;
7961
7962 exp->type = 2;
7963 exp->string = PrintInt((op1->i | value2));
7964 if(!exp->expType)
7965 {
7966 exp->expType = op1->type;
7967 if(op1->type)
7968 op1->type->refCount++;
7969 }
7970 return 0x1;
7971 }
7972
7973 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7974 {
7975 unsigned int value2 = op2->ui;
7976
7977 exp->type = 2;
7978 exp->string = PrintUInt((op1->ui | value2));
7979 if(!exp->expType)
7980 {
7981 exp->expType = op1->type;
7982 if(op1->type)
7983 op1->type->refCount++;
7984 }
7985 return 0x1;
7986 }
7987
7988 static unsigned int Int64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7989 {
7990 long long value2 = op2->i64;
7991
7992 exp->type = 2;
7993 exp->string = PrintInt64((op1->i64 | value2));
7994 if(!exp->expType)
7995 {
7996 exp->expType = op1->type;
7997 if(op1->type)
7998 op1->type->refCount++;
7999 }
8000 return 0x1;
8001 }
8002
8003 static unsigned int UInt64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8004 {
8005 uint64 value2 = op2->ui64;
8006
8007 exp->type = 2;
8008 exp->string = PrintUInt64((op1->ui64 | value2));
8009 if(!exp->expType)
8010 {
8011 exp->expType = op1->type;
8012 if(op1->type)
8013 op1->type->refCount++;
8014 }
8015 return 0x1;
8016 }
8017
8018 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8019 {
8020 short value2 = op2->s;
8021
8022 exp->type = 2;
8023 exp->string = PrintShort((op1->s | value2));
8024 if(!exp->expType)
8025 {
8026 exp->expType = op1->type;
8027 if(op1->type)
8028 op1->type->refCount++;
8029 }
8030 return 0x1;
8031 }
8032
8033 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8034 {
8035 unsigned short value2 = op2->us;
8036
8037 exp->type = 2;
8038 exp->string = PrintUShort((op1->us | value2));
8039 if(!exp->expType)
8040 {
8041 exp->expType = op1->type;
8042 if(op1->type)
8043 op1->type->refCount++;
8044 }
8045 return 0x1;
8046 }
8047
8048 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8049 {
8050 char value2 = op2->c;
8051
8052 exp->type = 2;
8053 exp->string = PrintChar((op1->c | value2));
8054 if(!exp->expType)
8055 {
8056 exp->expType = op1->type;
8057 if(op1->type)
8058 op1->type->refCount++;
8059 }
8060 return 0x1;
8061 }
8062
8063 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8064 {
8065 unsigned char value2 = op2->uc;
8066
8067 exp->type = 2;
8068 exp->string = PrintUChar((op1->uc | value2));
8069 if(!exp->expType)
8070 {
8071 exp->expType = op1->type;
8072 if(op1->type)
8073 op1->type->refCount++;
8074 }
8075 return 0x1;
8076 }
8077
8078 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8079 {
8080 int value2 = op2->i;
8081
8082 exp->type = 2;
8083 exp->string = PrintInt((op1->i ^ value2));
8084 if(!exp->expType)
8085 {
8086 exp->expType = op1->type;
8087 if(op1->type)
8088 op1->type->refCount++;
8089 }
8090 return 0x1;
8091 }
8092
8093 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8094 {
8095 unsigned int value2 = op2->ui;
8096
8097 exp->type = 2;
8098 exp->string = PrintUInt((op1->ui ^ value2));
8099 if(!exp->expType)
8100 {
8101 exp->expType = op1->type;
8102 if(op1->type)
8103 op1->type->refCount++;
8104 }
8105 return 0x1;
8106 }
8107
8108 static unsigned int Int64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8109 {
8110 long long value2 = op2->i64;
8111
8112 exp->type = 2;
8113 exp->string = PrintInt64((op1->i64 ^ value2));
8114 if(!exp->expType)
8115 {
8116 exp->expType = op1->type;
8117 if(op1->type)
8118 op1->type->refCount++;
8119 }
8120 return 0x1;
8121 }
8122
8123 static unsigned int UInt64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8124 {
8125 uint64 value2 = op2->ui64;
8126
8127 exp->type = 2;
8128 exp->string = PrintUInt64((op1->ui64 ^ value2));
8129 if(!exp->expType)
8130 {
8131 exp->expType = op1->type;
8132 if(op1->type)
8133 op1->type->refCount++;
8134 }
8135 return 0x1;
8136 }
8137
8138 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8139 {
8140 short value2 = op2->s;
8141
8142 exp->type = 2;
8143 exp->string = PrintShort((op1->s ^ value2));
8144 if(!exp->expType)
8145 {
8146 exp->expType = op1->type;
8147 if(op1->type)
8148 op1->type->refCount++;
8149 }
8150 return 0x1;
8151 }
8152
8153 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8154 {
8155 unsigned short value2 = op2->us;
8156
8157 exp->type = 2;
8158 exp->string = PrintUShort((op1->us ^ value2));
8159 if(!exp->expType)
8160 {
8161 exp->expType = op1->type;
8162 if(op1->type)
8163 op1->type->refCount++;
8164 }
8165 return 0x1;
8166 }
8167
8168 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8169 {
8170 char value2 = op2->c;
8171
8172 exp->type = 2;
8173 exp->string = PrintChar((op1->c ^ value2));
8174 if(!exp->expType)
8175 {
8176 exp->expType = op1->type;
8177 if(op1->type)
8178 op1->type->refCount++;
8179 }
8180 return 0x1;
8181 }
8182
8183 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8184 {
8185 unsigned char value2 = op2->uc;
8186
8187 exp->type = 2;
8188 exp->string = PrintUChar((op1->uc ^ value2));
8189 if(!exp->expType)
8190 {
8191 exp->expType = op1->type;
8192 if(op1->type)
8193 op1->type->refCount++;
8194 }
8195 return 0x1;
8196 }
8197
8198 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8199 {
8200 int value2 = op2->i;
8201
8202 exp->type = 2;
8203 exp->string = PrintInt((op1->i << value2));
8204 if(!exp->expType)
8205 {
8206 exp->expType = op1->type;
8207 if(op1->type)
8208 op1->type->refCount++;
8209 }
8210 return 0x1;
8211 }
8212
8213 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8214 {
8215 unsigned int value2 = op2->ui;
8216
8217 exp->type = 2;
8218 exp->string = PrintUInt((op1->ui << value2));
8219 if(!exp->expType)
8220 {
8221 exp->expType = op1->type;
8222 if(op1->type)
8223 op1->type->refCount++;
8224 }
8225 return 0x1;
8226 }
8227
8228 static unsigned int Int64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8229 {
8230 long long value2 = op2->i64;
8231
8232 exp->type = 2;
8233 exp->string = PrintInt64((op1->i64 << value2));
8234 if(!exp->expType)
8235 {
8236 exp->expType = op1->type;
8237 if(op1->type)
8238 op1->type->refCount++;
8239 }
8240 return 0x1;
8241 }
8242
8243 static unsigned int UInt64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8244 {
8245 uint64 value2 = op2->ui64;
8246
8247 exp->type = 2;
8248 exp->string = PrintUInt64((op1->ui64 << value2));
8249 if(!exp->expType)
8250 {
8251 exp->expType = op1->type;
8252 if(op1->type)
8253 op1->type->refCount++;
8254 }
8255 return 0x1;
8256 }
8257
8258 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8259 {
8260 short value2 = op2->s;
8261
8262 exp->type = 2;
8263 exp->string = PrintShort((op1->s << value2));
8264 if(!exp->expType)
8265 {
8266 exp->expType = op1->type;
8267 if(op1->type)
8268 op1->type->refCount++;
8269 }
8270 return 0x1;
8271 }
8272
8273 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8274 {
8275 unsigned short value2 = op2->us;
8276
8277 exp->type = 2;
8278 exp->string = PrintUShort((op1->us << value2));
8279 if(!exp->expType)
8280 {
8281 exp->expType = op1->type;
8282 if(op1->type)
8283 op1->type->refCount++;
8284 }
8285 return 0x1;
8286 }
8287
8288 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8289 {
8290 char value2 = op2->c;
8291
8292 exp->type = 2;
8293 exp->string = PrintChar((op1->c << value2));
8294 if(!exp->expType)
8295 {
8296 exp->expType = op1->type;
8297 if(op1->type)
8298 op1->type->refCount++;
8299 }
8300 return 0x1;
8301 }
8302
8303 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8304 {
8305 unsigned char value2 = op2->uc;
8306
8307 exp->type = 2;
8308 exp->string = PrintUChar((op1->uc << value2));
8309 if(!exp->expType)
8310 {
8311 exp->expType = op1->type;
8312 if(op1->type)
8313 op1->type->refCount++;
8314 }
8315 return 0x1;
8316 }
8317
8318 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8319 {
8320 int value2 = op2->i;
8321
8322 exp->type = 2;
8323 exp->string = PrintInt((op1->i >> value2));
8324 if(!exp->expType)
8325 {
8326 exp->expType = op1->type;
8327 if(op1->type)
8328 op1->type->refCount++;
8329 }
8330 return 0x1;
8331 }
8332
8333 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8334 {
8335 unsigned int value2 = op2->ui;
8336
8337 exp->type = 2;
8338 exp->string = PrintUInt((op1->ui >> value2));
8339 if(!exp->expType)
8340 {
8341 exp->expType = op1->type;
8342 if(op1->type)
8343 op1->type->refCount++;
8344 }
8345 return 0x1;
8346 }
8347
8348 static unsigned int Int64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8349 {
8350 long long value2 = op2->i64;
8351
8352 exp->type = 2;
8353 exp->string = PrintInt64((op1->i64 >> value2));
8354 if(!exp->expType)
8355 {
8356 exp->expType = op1->type;
8357 if(op1->type)
8358 op1->type->refCount++;
8359 }
8360 return 0x1;
8361 }
8362
8363 static unsigned int UInt64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8364 {
8365 uint64 value2 = op2->ui64;
8366
8367 exp->type = 2;
8368 exp->string = PrintUInt64((op1->ui64 >> value2));
8369 if(!exp->expType)
8370 {
8371 exp->expType = op1->type;
8372 if(op1->type)
8373 op1->type->refCount++;
8374 }
8375 return 0x1;
8376 }
8377
8378 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8379 {
8380 short value2 = op2->s;
8381
8382 exp->type = 2;
8383 exp->string = PrintShort((op1->s >> value2));
8384 if(!exp->expType)
8385 {
8386 exp->expType = op1->type;
8387 if(op1->type)
8388 op1->type->refCount++;
8389 }
8390 return 0x1;
8391 }
8392
8393 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8394 {
8395 unsigned short value2 = op2->us;
8396
8397 exp->type = 2;
8398 exp->string = PrintUShort((op1->us >> value2));
8399 if(!exp->expType)
8400 {
8401 exp->expType = op1->type;
8402 if(op1->type)
8403 op1->type->refCount++;
8404 }
8405 return 0x1;
8406 }
8407
8408 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8409 {
8410 char value2 = op2->c;
8411
8412 exp->type = 2;
8413 exp->string = PrintChar((op1->c >> value2));
8414 if(!exp->expType)
8415 {
8416 exp->expType = op1->type;
8417 if(op1->type)
8418 op1->type->refCount++;
8419 }
8420 return 0x1;
8421 }
8422
8423 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8424 {
8425 unsigned char value2 = op2->uc;
8426
8427 exp->type = 2;
8428 exp->string = PrintUChar((op1->uc >> value2));
8429 if(!exp->expType)
8430 {
8431 exp->expType = op1->type;
8432 if(op1->type)
8433 op1->type->refCount++;
8434 }
8435 return 0x1;
8436 }
8437
8438 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
8439 {
8440 exp->type = 2;
8441 exp->string = PrintInt((~op1->i));
8442 if(!exp->expType)
8443 {
8444 exp->expType = op1->type;
8445 if(op1->type)
8446 op1->type->refCount++;
8447 }
8448 return 0x1;
8449 }
8450
8451 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
8452 {
8453 exp->type = 2;
8454 exp->string = PrintUInt((unsigned int)(~op1->ui));
8455 if(!exp->expType)
8456 {
8457 exp->expType = op1->type;
8458 if(op1->type)
8459 op1->type->refCount++;
8460 }
8461 return 0x1;
8462 }
8463
8464 static unsigned int Int64BitNot(struct Expression * exp, struct Operand * op1)
8465 {
8466 exp->type = 2;
8467 exp->string = PrintInt64((long long)(~op1->i64));
8468 if(!exp->expType)
8469 {
8470 exp->expType = op1->type;
8471 if(op1->type)
8472 op1->type->refCount++;
8473 }
8474 return 0x1;
8475 }
8476
8477 static unsigned int UInt64BitNot(struct Expression * exp, struct Operand * op1)
8478 {
8479 exp->type = 2;
8480 exp->string = PrintUInt64((uint64)(~op1->ui64));
8481 if(!exp->expType)
8482 {
8483 exp->expType = op1->type;
8484 if(op1->type)
8485 op1->type->refCount++;
8486 }
8487 return 0x1;
8488 }
8489
8490 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
8491 {
8492 exp->type = 2;
8493 exp->string = PrintShort((short)(~op1->s));
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 UShortBitNot(struct Expression * exp, struct Operand * op1)
8504 {
8505 exp->type = 2;
8506 exp->string = PrintUShort((unsigned short)(~op1->us));
8507 if(!exp->expType)
8508 {
8509 exp->expType = op1->type;
8510 if(op1->type)
8511 op1->type->refCount++;
8512 }
8513 return 0x1;
8514 }
8515
8516 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
8517 {
8518 exp->type = 2;
8519 exp->string = PrintChar((char)(~op1->c));
8520 if(!exp->expType)
8521 {
8522 exp->expType = op1->type;
8523 if(op1->type)
8524 op1->type->refCount++;
8525 }
8526 return 0x1;
8527 }
8528
8529 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
8530 {
8531 exp->type = 2;
8532 exp->string = PrintUChar((unsigned char)(~op1->uc));
8533 if(!exp->expType)
8534 {
8535 exp->expType = op1->type;
8536 if(op1->type)
8537 op1->type->refCount++;
8538 }
8539 return 0x1;
8540 }
8541
8542 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8543 {
8544 int value2 = op2->i;
8545
8546 exp->type = 2;
8547 exp->string = PrintInt((op1->i &= value2));
8548 if(!exp->expType)
8549 {
8550 exp->expType = op1->type;
8551 if(op1->type)
8552 op1->type->refCount++;
8553 }
8554 return 0x1;
8555 }
8556
8557 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8558 {
8559 unsigned int value2 = op2->ui;
8560
8561 exp->type = 2;
8562 exp->string = PrintUInt((op1->ui &= value2));
8563 if(!exp->expType)
8564 {
8565 exp->expType = op1->type;
8566 if(op1->type)
8567 op1->type->refCount++;
8568 }
8569 return 0x1;
8570 }
8571
8572 static unsigned int Int64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8573 {
8574 long long value2 = op2->i64;
8575
8576 exp->type = 2;
8577 exp->string = PrintInt64((op1->i64 &= value2));
8578 if(!exp->expType)
8579 {
8580 exp->expType = op1->type;
8581 if(op1->type)
8582 op1->type->refCount++;
8583 }
8584 return 0x1;
8585 }
8586
8587 static unsigned int UInt64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8588 {
8589 uint64 value2 = op2->ui64;
8590
8591 exp->type = 2;
8592 exp->string = PrintUInt64((op1->ui64 &= value2));
8593 if(!exp->expType)
8594 {
8595 exp->expType = op1->type;
8596 if(op1->type)
8597 op1->type->refCount++;
8598 }
8599 return 0x1;
8600 }
8601
8602 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8603 {
8604 short value2 = op2->s;
8605
8606 exp->type = 2;
8607 exp->string = PrintShort((op1->s &= value2));
8608 if(!exp->expType)
8609 {
8610 exp->expType = op1->type;
8611 if(op1->type)
8612 op1->type->refCount++;
8613 }
8614 return 0x1;
8615 }
8616
8617 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8618 {
8619 unsigned short value2 = op2->us;
8620
8621 exp->type = 2;
8622 exp->string = PrintUShort((op1->us &= value2));
8623 if(!exp->expType)
8624 {
8625 exp->expType = op1->type;
8626 if(op1->type)
8627 op1->type->refCount++;
8628 }
8629 return 0x1;
8630 }
8631
8632 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8633 {
8634 char value2 = op2->c;
8635
8636 exp->type = 2;
8637 exp->string = PrintChar((op1->c &= value2));
8638 if(!exp->expType)
8639 {
8640 exp->expType = op1->type;
8641 if(op1->type)
8642 op1->type->refCount++;
8643 }
8644 return 0x1;
8645 }
8646
8647 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8648 {
8649 unsigned char value2 = op2->uc;
8650
8651 exp->type = 2;
8652 exp->string = PrintUChar((op1->uc &= value2));
8653 if(!exp->expType)
8654 {
8655 exp->expType = op1->type;
8656 if(op1->type)
8657 op1->type->refCount++;
8658 }
8659 return 0x1;
8660 }
8661
8662 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8663 {
8664 int value2 = op2->i;
8665
8666 exp->type = 2;
8667 exp->string = PrintInt((op1->i |= value2));
8668 if(!exp->expType)
8669 {
8670 exp->expType = op1->type;
8671 if(op1->type)
8672 op1->type->refCount++;
8673 }
8674 return 0x1;
8675 }
8676
8677 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8678 {
8679 unsigned int value2 = op2->ui;
8680
8681 exp->type = 2;
8682 exp->string = PrintUInt((op1->ui |= value2));
8683 if(!exp->expType)
8684 {
8685 exp->expType = op1->type;
8686 if(op1->type)
8687 op1->type->refCount++;
8688 }
8689 return 0x1;
8690 }
8691
8692 static unsigned int Int64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8693 {
8694 long long value2 = op2->i64;
8695
8696 exp->type = 2;
8697 exp->string = PrintInt64((op1->i64 |= value2));
8698 if(!exp->expType)
8699 {
8700 exp->expType = op1->type;
8701 if(op1->type)
8702 op1->type->refCount++;
8703 }
8704 return 0x1;
8705 }
8706
8707 static unsigned int UInt64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8708 {
8709 uint64 value2 = op2->ui64;
8710
8711 exp->type = 2;
8712 exp->string = PrintUInt64((op1->ui64 |= value2));
8713 if(!exp->expType)
8714 {
8715 exp->expType = op1->type;
8716 if(op1->type)
8717 op1->type->refCount++;
8718 }
8719 return 0x1;
8720 }
8721
8722 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8723 {
8724 short value2 = op2->s;
8725
8726 exp->type = 2;
8727 exp->string = PrintShort((op1->s |= value2));
8728 if(!exp->expType)
8729 {
8730 exp->expType = op1->type;
8731 if(op1->type)
8732 op1->type->refCount++;
8733 }
8734 return 0x1;
8735 }
8736
8737 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8738 {
8739 unsigned short value2 = op2->us;
8740
8741 exp->type = 2;
8742 exp->string = PrintUShort((op1->us |= value2));
8743 if(!exp->expType)
8744 {
8745 exp->expType = op1->type;
8746 if(op1->type)
8747 op1->type->refCount++;
8748 }
8749 return 0x1;
8750 }
8751
8752 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8753 {
8754 char value2 = op2->c;
8755
8756 exp->type = 2;
8757 exp->string = PrintChar((op1->c |= value2));
8758 if(!exp->expType)
8759 {
8760 exp->expType = op1->type;
8761 if(op1->type)
8762 op1->type->refCount++;
8763 }
8764 return 0x1;
8765 }
8766
8767 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8768 {
8769 unsigned char value2 = op2->uc;
8770
8771 exp->type = 2;
8772 exp->string = PrintUChar((op1->uc |= value2));
8773 if(!exp->expType)
8774 {
8775 exp->expType = op1->type;
8776 if(op1->type)
8777 op1->type->refCount++;
8778 }
8779 return 0x1;
8780 }
8781
8782 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8783 {
8784 int value2 = op2->i;
8785
8786 exp->type = 2;
8787 exp->string = PrintInt((op1->i ^= value2));
8788 if(!exp->expType)
8789 {
8790 exp->expType = op1->type;
8791 if(op1->type)
8792 op1->type->refCount++;
8793 }
8794 return 0x1;
8795 }
8796
8797 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8798 {
8799 unsigned int value2 = op2->ui;
8800
8801 exp->type = 2;
8802 exp->string = PrintUInt((op1->ui ^= value2));
8803 if(!exp->expType)
8804 {
8805 exp->expType = op1->type;
8806 if(op1->type)
8807 op1->type->refCount++;
8808 }
8809 return 0x1;
8810 }
8811
8812 static unsigned int Int64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8813 {
8814 long long value2 = op2->i64;
8815
8816 exp->type = 2;
8817 exp->string = PrintInt64((op1->i64 ^= value2));
8818 if(!exp->expType)
8819 {
8820 exp->expType = op1->type;
8821 if(op1->type)
8822 op1->type->refCount++;
8823 }
8824 return 0x1;
8825 }
8826
8827 static unsigned int UInt64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8828 {
8829 uint64 value2 = op2->ui64;
8830
8831 exp->type = 2;
8832 exp->string = PrintUInt64((op1->ui64 ^= value2));
8833 if(!exp->expType)
8834 {
8835 exp->expType = op1->type;
8836 if(op1->type)
8837 op1->type->refCount++;
8838 }
8839 return 0x1;
8840 }
8841
8842 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8843 {
8844 short value2 = op2->s;
8845
8846 exp->type = 2;
8847 exp->string = PrintShort((op1->s ^= value2));
8848 if(!exp->expType)
8849 {
8850 exp->expType = op1->type;
8851 if(op1->type)
8852 op1->type->refCount++;
8853 }
8854 return 0x1;
8855 }
8856
8857 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8858 {
8859 unsigned short value2 = op2->us;
8860
8861 exp->type = 2;
8862 exp->string = PrintUShort((op1->us ^= value2));
8863 if(!exp->expType)
8864 {
8865 exp->expType = op1->type;
8866 if(op1->type)
8867 op1->type->refCount++;
8868 }
8869 return 0x1;
8870 }
8871
8872 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8873 {
8874 char value2 = op2->c;
8875
8876 exp->type = 2;
8877 exp->string = PrintChar((op1->c ^= value2));
8878 if(!exp->expType)
8879 {
8880 exp->expType = op1->type;
8881 if(op1->type)
8882 op1->type->refCount++;
8883 }
8884 return 0x1;
8885 }
8886
8887 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8888 {
8889 unsigned char value2 = op2->uc;
8890
8891 exp->type = 2;
8892 exp->string = PrintUChar((op1->uc ^= value2));
8893 if(!exp->expType)
8894 {
8895 exp->expType = op1->type;
8896 if(op1->type)
8897 op1->type->refCount++;
8898 }
8899 return 0x1;
8900 }
8901
8902 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8903 {
8904 int value2 = op2->i;
8905
8906 exp->type = 2;
8907 exp->string = PrintInt((op1->i <<= value2));
8908 if(!exp->expType)
8909 {
8910 exp->expType = op1->type;
8911 if(op1->type)
8912 op1->type->refCount++;
8913 }
8914 return 0x1;
8915 }
8916
8917 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8918 {
8919 unsigned int value2 = op2->ui;
8920
8921 exp->type = 2;
8922 exp->string = PrintUInt((op1->ui <<= value2));
8923 if(!exp->expType)
8924 {
8925 exp->expType = op1->type;
8926 if(op1->type)
8927 op1->type->refCount++;
8928 }
8929 return 0x1;
8930 }
8931
8932 static unsigned int Int64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8933 {
8934 long long value2 = op2->i64;
8935
8936 exp->type = 2;
8937 exp->string = PrintInt64((op1->i64 <<= value2));
8938 if(!exp->expType)
8939 {
8940 exp->expType = op1->type;
8941 if(op1->type)
8942 op1->type->refCount++;
8943 }
8944 return 0x1;
8945 }
8946
8947 static unsigned int UInt64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8948 {
8949 uint64 value2 = op2->ui64;
8950
8951 exp->type = 2;
8952 exp->string = PrintUInt64((op1->ui64 <<= value2));
8953 if(!exp->expType)
8954 {
8955 exp->expType = op1->type;
8956 if(op1->type)
8957 op1->type->refCount++;
8958 }
8959 return 0x1;
8960 }
8961
8962 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8963 {
8964 short value2 = op2->s;
8965
8966 exp->type = 2;
8967 exp->string = PrintShort((op1->s <<= value2));
8968 if(!exp->expType)
8969 {
8970 exp->expType = op1->type;
8971 if(op1->type)
8972 op1->type->refCount++;
8973 }
8974 return 0x1;
8975 }
8976
8977 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8978 {
8979 unsigned short value2 = op2->us;
8980
8981 exp->type = 2;
8982 exp->string = PrintUShort((op1->us <<= value2));
8983 if(!exp->expType)
8984 {
8985 exp->expType = op1->type;
8986 if(op1->type)
8987 op1->type->refCount++;
8988 }
8989 return 0x1;
8990 }
8991
8992 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8993 {
8994 char value2 = op2->c;
8995
8996 exp->type = 2;
8997 exp->string = PrintChar((op1->c <<= value2));
8998 if(!exp->expType)
8999 {
9000 exp->expType = op1->type;
9001 if(op1->type)
9002 op1->type->refCount++;
9003 }
9004 return 0x1;
9005 }
9006
9007 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9008 {
9009 unsigned char value2 = op2->uc;
9010
9011 exp->type = 2;
9012 exp->string = PrintUChar((op1->uc <<= value2));
9013 if(!exp->expType)
9014 {
9015 exp->expType = op1->type;
9016 if(op1->type)
9017 op1->type->refCount++;
9018 }
9019 return 0x1;
9020 }
9021
9022 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9023 {
9024 int value2 = op2->i;
9025
9026 exp->type = 2;
9027 exp->string = PrintInt((op1->i >>= value2));
9028 if(!exp->expType)
9029 {
9030 exp->expType = op1->type;
9031 if(op1->type)
9032 op1->type->refCount++;
9033 }
9034 return 0x1;
9035 }
9036
9037 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9038 {
9039 unsigned int value2 = op2->ui;
9040
9041 exp->type = 2;
9042 exp->string = PrintUInt((op1->ui >>= value2));
9043 if(!exp->expType)
9044 {
9045 exp->expType = op1->type;
9046 if(op1->type)
9047 op1->type->refCount++;
9048 }
9049 return 0x1;
9050 }
9051
9052 static unsigned int Int64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9053 {
9054 long long value2 = op2->i64;
9055
9056 exp->type = 2;
9057 exp->string = PrintInt64((op1->i64 >>= value2));
9058 if(!exp->expType)
9059 {
9060 exp->expType = op1->type;
9061 if(op1->type)
9062 op1->type->refCount++;
9063 }
9064 return 0x1;
9065 }
9066
9067 static unsigned int UInt64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9068 {
9069 uint64 value2 = op2->ui64;
9070
9071 exp->type = 2;
9072 exp->string = PrintUInt64((op1->ui64 >>= value2));
9073 if(!exp->expType)
9074 {
9075 exp->expType = op1->type;
9076 if(op1->type)
9077 op1->type->refCount++;
9078 }
9079 return 0x1;
9080 }
9081
9082 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9083 {
9084 short value2 = op2->s;
9085
9086 exp->type = 2;
9087 exp->string = PrintShort((op1->s >>= value2));
9088 if(!exp->expType)
9089 {
9090 exp->expType = op1->type;
9091 if(op1->type)
9092 op1->type->refCount++;
9093 }
9094 return 0x1;
9095 }
9096
9097 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9098 {
9099 unsigned short value2 = op2->us;
9100
9101 exp->type = 2;
9102 exp->string = PrintUShort((op1->us >>= value2));
9103 if(!exp->expType)
9104 {
9105 exp->expType = op1->type;
9106 if(op1->type)
9107 op1->type->refCount++;
9108 }
9109 return 0x1;
9110 }
9111
9112 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9113 {
9114 char value2 = op2->c;
9115
9116 exp->type = 2;
9117 exp->string = PrintChar((op1->c >>= value2));
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 UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9128 {
9129 unsigned char value2 = op2->uc;
9130
9131 exp->type = 2;
9132 exp->string = PrintUChar((op1->uc >>= value2));
9133 if(!exp->expType)
9134 {
9135 exp->expType = op1->type;
9136 if(op1->type)
9137 op1->type->refCount++;
9138 }
9139 return 0x1;
9140 }
9141
9142 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
9143 {
9144 exp->type = 2;
9145 exp->string = PrintInt((int)(!op1->i));
9146 if(!exp->expType)
9147 {
9148 exp->expType = op1->type;
9149 if(op1->type)
9150 op1->type->refCount++;
9151 }
9152 return 0x1;
9153 }
9154
9155 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
9156 {
9157 exp->type = 2;
9158 exp->string = PrintUInt((unsigned int)(!op1->ui));
9159 if(!exp->expType)
9160 {
9161 exp->expType = op1->type;
9162 if(op1->type)
9163 op1->type->refCount++;
9164 }
9165 return 0x1;
9166 }
9167
9168 static unsigned int Int64Not(struct Expression * exp, struct Operand * op1)
9169 {
9170 exp->type = 2;
9171 exp->string = PrintInt64((long long)(!op1->i64));
9172 if(!exp->expType)
9173 {
9174 exp->expType = op1->type;
9175 if(op1->type)
9176 op1->type->refCount++;
9177 }
9178 return 0x1;
9179 }
9180
9181 static unsigned int UInt64Not(struct Expression * exp, struct Operand * op1)
9182 {
9183 exp->type = 2;
9184 exp->string = PrintUInt64((uint64)(!op1->ui64));
9185 if(!exp->expType)
9186 {
9187 exp->expType = op1->type;
9188 if(op1->type)
9189 op1->type->refCount++;
9190 }
9191 return 0x1;
9192 }
9193
9194 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
9195 {
9196 exp->type = 2;
9197 exp->string = PrintShort((short)(!op1->s));
9198 if(!exp->expType)
9199 {
9200 exp->expType = op1->type;
9201 if(op1->type)
9202 op1->type->refCount++;
9203 }
9204 return 0x1;
9205 }
9206
9207 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
9208 {
9209 exp->type = 2;
9210 exp->string = PrintUShort((unsigned short)(!op1->us));
9211 if(!exp->expType)
9212 {
9213 exp->expType = op1->type;
9214 if(op1->type)
9215 op1->type->refCount++;
9216 }
9217 return 0x1;
9218 }
9219
9220 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
9221 {
9222 exp->type = 2;
9223 exp->string = PrintChar((char)(!op1->c));
9224 if(!exp->expType)
9225 {
9226 exp->expType = op1->type;
9227 if(op1->type)
9228 op1->type->refCount++;
9229 }
9230 return 0x1;
9231 }
9232
9233 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
9234 {
9235 exp->type = 2;
9236 exp->string = PrintUChar((unsigned char)(!op1->uc));
9237 if(!exp->expType)
9238 {
9239 exp->expType = op1->type;
9240 if(op1->type)
9241 op1->type->refCount++;
9242 }
9243 return 0x1;
9244 }
9245
9246 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9247 {
9248 int value2 = op2->i;
9249
9250 exp->type = 2;
9251 exp->string = PrintInt((int)(op1->i == value2));
9252 if(!exp->expType)
9253 {
9254 exp->expType = op1->type;
9255 if(op1->type)
9256 op1->type->refCount++;
9257 }
9258 return 0x1;
9259 }
9260
9261 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9262 {
9263 unsigned int value2 = op2->ui;
9264
9265 exp->type = 2;
9266 exp->string = PrintUInt((unsigned int)(op1->ui == value2));
9267 if(!exp->expType)
9268 {
9269 exp->expType = op1->type;
9270 if(op1->type)
9271 op1->type->refCount++;
9272 }
9273 return 0x1;
9274 }
9275
9276 static unsigned int Int64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9277 {
9278 long long value2 = op2->i64;
9279
9280 exp->type = 2;
9281 exp->string = PrintInt64((long long)(op1->i64 == value2));
9282 if(!exp->expType)
9283 {
9284 exp->expType = op1->type;
9285 if(op1->type)
9286 op1->type->refCount++;
9287 }
9288 return 0x1;
9289 }
9290
9291 static unsigned int UInt64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9292 {
9293 uint64 value2 = op2->ui64;
9294
9295 exp->type = 2;
9296 exp->string = PrintUInt64((uint64)(op1->ui64 == value2));
9297 if(!exp->expType)
9298 {
9299 exp->expType = op1->type;
9300 if(op1->type)
9301 op1->type->refCount++;
9302 }
9303 return 0x1;
9304 }
9305
9306 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9307 {
9308 short value2 = op2->s;
9309
9310 exp->type = 2;
9311 exp->string = PrintShort((short)(op1->s == value2));
9312 if(!exp->expType)
9313 {
9314 exp->expType = op1->type;
9315 if(op1->type)
9316 op1->type->refCount++;
9317 }
9318 return 0x1;
9319 }
9320
9321 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9322 {
9323 unsigned short value2 = op2->us;
9324
9325 exp->type = 2;
9326 exp->string = PrintUShort((unsigned short)(op1->us == value2));
9327 if(!exp->expType)
9328 {
9329 exp->expType = op1->type;
9330 if(op1->type)
9331 op1->type->refCount++;
9332 }
9333 return 0x1;
9334 }
9335
9336 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9337 {
9338 char value2 = op2->c;
9339
9340 exp->type = 2;
9341 exp->string = PrintChar((char)(op1->c == value2));
9342 if(!exp->expType)
9343 {
9344 exp->expType = op1->type;
9345 if(op1->type)
9346 op1->type->refCount++;
9347 }
9348 return 0x1;
9349 }
9350
9351 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9352 {
9353 unsigned char value2 = op2->uc;
9354
9355 exp->type = 2;
9356 exp->string = PrintUChar((unsigned char)(op1->uc == value2));
9357 if(!exp->expType)
9358 {
9359 exp->expType = op1->type;
9360 if(op1->type)
9361 op1->type->refCount++;
9362 }
9363 return 0x1;
9364 }
9365
9366 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9367 {
9368 float value2 = op2->f;
9369
9370 exp->type = 2;
9371 exp->string = PrintFloat((float)(op1->f == value2));
9372 if(!exp->expType)
9373 {
9374 exp->expType = op1->type;
9375 if(op1->type)
9376 op1->type->refCount++;
9377 }
9378 return 0x1;
9379 }
9380
9381 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9382 {
9383 double value2 = op2->d;
9384
9385 exp->type = 2;
9386 exp->string = PrintDouble((double)(op1->d == value2));
9387 if(!exp->expType)
9388 {
9389 exp->expType = op1->type;
9390 if(op1->type)
9391 op1->type->refCount++;
9392 }
9393 return 0x1;
9394 }
9395
9396 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9397 {
9398 int value2 = op2->i;
9399
9400 exp->type = 2;
9401 exp->string = PrintInt((int)(op1->i != value2));
9402 if(!exp->expType)
9403 {
9404 exp->expType = op1->type;
9405 if(op1->type)
9406 op1->type->refCount++;
9407 }
9408 return 0x1;
9409 }
9410
9411 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9412 {
9413 unsigned int value2 = op2->ui;
9414
9415 exp->type = 2;
9416 exp->string = PrintUInt((unsigned int)(op1->ui != value2));
9417 if(!exp->expType)
9418 {
9419 exp->expType = op1->type;
9420 if(op1->type)
9421 op1->type->refCount++;
9422 }
9423 return 0x1;
9424 }
9425
9426 static unsigned int Int64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9427 {
9428 long long value2 = op2->i64;
9429
9430 exp->type = 2;
9431 exp->string = PrintInt64((long long)(op1->i64 != value2));
9432 if(!exp->expType)
9433 {
9434 exp->expType = op1->type;
9435 if(op1->type)
9436 op1->type->refCount++;
9437 }
9438 return 0x1;
9439 }
9440
9441 static unsigned int UInt64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9442 {
9443 uint64 value2 = op2->ui64;
9444
9445 exp->type = 2;
9446 exp->string = PrintUInt64((uint64)(op1->ui64 != value2));
9447 if(!exp->expType)
9448 {
9449 exp->expType = op1->type;
9450 if(op1->type)
9451 op1->type->refCount++;
9452 }
9453 return 0x1;
9454 }
9455
9456 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9457 {
9458 short value2 = op2->s;
9459
9460 exp->type = 2;
9461 exp->string = PrintShort((short)(op1->s != value2));
9462 if(!exp->expType)
9463 {
9464 exp->expType = op1->type;
9465 if(op1->type)
9466 op1->type->refCount++;
9467 }
9468 return 0x1;
9469 }
9470
9471 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9472 {
9473 unsigned short value2 = op2->us;
9474
9475 exp->type = 2;
9476 exp->string = PrintUShort((unsigned short)(op1->us != value2));
9477 if(!exp->expType)
9478 {
9479 exp->expType = op1->type;
9480 if(op1->type)
9481 op1->type->refCount++;
9482 }
9483 return 0x1;
9484 }
9485
9486 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9487 {
9488 char value2 = op2->c;
9489
9490 exp->type = 2;
9491 exp->string = PrintChar((char)(op1->c != value2));
9492 if(!exp->expType)
9493 {
9494 exp->expType = op1->type;
9495 if(op1->type)
9496 op1->type->refCount++;
9497 }
9498 return 0x1;
9499 }
9500
9501 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9502 {
9503 unsigned char value2 = op2->uc;
9504
9505 exp->type = 2;
9506 exp->string = PrintUChar((unsigned char)(op1->uc != value2));
9507 if(!exp->expType)
9508 {
9509 exp->expType = op1->type;
9510 if(op1->type)
9511 op1->type->refCount++;
9512 }
9513 return 0x1;
9514 }
9515
9516 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9517 {
9518 float value2 = op2->f;
9519
9520 exp->type = 2;
9521 exp->string = PrintFloat((float)(op1->f != value2));
9522 if(!exp->expType)
9523 {
9524 exp->expType = op1->type;
9525 if(op1->type)
9526 op1->type->refCount++;
9527 }
9528 return 0x1;
9529 }
9530
9531 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9532 {
9533 double value2 = op2->d;
9534
9535 exp->type = 2;
9536 exp->string = PrintDouble((double)(op1->d != value2));
9537 if(!exp->expType)
9538 {
9539 exp->expType = op1->type;
9540 if(op1->type)
9541 op1->type->refCount++;
9542 }
9543 return 0x1;
9544 }
9545
9546 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9547 {
9548 int value2 = op2->i;
9549
9550 exp->type = 2;
9551 exp->string = PrintInt((int)(op1->i && value2));
9552 if(!exp->expType)
9553 {
9554 exp->expType = op1->type;
9555 if(op1->type)
9556 op1->type->refCount++;
9557 }
9558 return 0x1;
9559 }
9560
9561 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9562 {
9563 unsigned int value2 = op2->ui;
9564
9565 exp->type = 2;
9566 exp->string = PrintUInt((unsigned int)(op1->ui && value2));
9567 if(!exp->expType)
9568 {
9569 exp->expType = op1->type;
9570 if(op1->type)
9571 op1->type->refCount++;
9572 }
9573 return 0x1;
9574 }
9575
9576 static unsigned int Int64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9577 {
9578 long long value2 = op2->i64;
9579
9580 exp->type = 2;
9581 exp->string = PrintInt64((long long)(op1->i64 && value2));
9582 if(!exp->expType)
9583 {
9584 exp->expType = op1->type;
9585 if(op1->type)
9586 op1->type->refCount++;
9587 }
9588 return 0x1;
9589 }
9590
9591 static unsigned int UInt64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9592 {
9593 uint64 value2 = op2->ui64;
9594
9595 exp->type = 2;
9596 exp->string = PrintUInt64((uint64)(op1->ui64 && value2));
9597 if(!exp->expType)
9598 {
9599 exp->expType = op1->type;
9600 if(op1->type)
9601 op1->type->refCount++;
9602 }
9603 return 0x1;
9604 }
9605
9606 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9607 {
9608 short value2 = op2->s;
9609
9610 exp->type = 2;
9611 exp->string = PrintShort((short)(op1->s && value2));
9612 if(!exp->expType)
9613 {
9614 exp->expType = op1->type;
9615 if(op1->type)
9616 op1->type->refCount++;
9617 }
9618 return 0x1;
9619 }
9620
9621 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9622 {
9623 unsigned short value2 = op2->us;
9624
9625 exp->type = 2;
9626 exp->string = PrintUShort((unsigned short)(op1->us && value2));
9627 if(!exp->expType)
9628 {
9629 exp->expType = op1->type;
9630 if(op1->type)
9631 op1->type->refCount++;
9632 }
9633 return 0x1;
9634 }
9635
9636 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9637 {
9638 char value2 = op2->c;
9639
9640 exp->type = 2;
9641 exp->string = PrintChar((char)(op1->c && value2));
9642 if(!exp->expType)
9643 {
9644 exp->expType = op1->type;
9645 if(op1->type)
9646 op1->type->refCount++;
9647 }
9648 return 0x1;
9649 }
9650
9651 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9652 {
9653 unsigned char value2 = op2->uc;
9654
9655 exp->type = 2;
9656 exp->string = PrintUChar((unsigned char)(op1->uc && value2));
9657 if(!exp->expType)
9658 {
9659 exp->expType = op1->type;
9660 if(op1->type)
9661 op1->type->refCount++;
9662 }
9663 return 0x1;
9664 }
9665
9666 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9667 {
9668 float value2 = op2->f;
9669
9670 exp->type = 2;
9671 exp->string = PrintFloat((float)(op1->f && value2));
9672 if(!exp->expType)
9673 {
9674 exp->expType = op1->type;
9675 if(op1->type)
9676 op1->type->refCount++;
9677 }
9678 return 0x1;
9679 }
9680
9681 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9682 {
9683 double value2 = op2->d;
9684
9685 exp->type = 2;
9686 exp->string = PrintDouble((double)(op1->d && value2));
9687 if(!exp->expType)
9688 {
9689 exp->expType = op1->type;
9690 if(op1->type)
9691 op1->type->refCount++;
9692 }
9693 return 0x1;
9694 }
9695
9696 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9697 {
9698 int value2 = op2->i;
9699
9700 exp->type = 2;
9701 exp->string = PrintInt((int)(op1->i || value2));
9702 if(!exp->expType)
9703 {
9704 exp->expType = op1->type;
9705 if(op1->type)
9706 op1->type->refCount++;
9707 }
9708 return 0x1;
9709 }
9710
9711 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9712 {
9713 unsigned int value2 = op2->ui;
9714
9715 exp->type = 2;
9716 exp->string = PrintUInt((unsigned int)(op1->ui || value2));
9717 if(!exp->expType)
9718 {
9719 exp->expType = op1->type;
9720 if(op1->type)
9721 op1->type->refCount++;
9722 }
9723 return 0x1;
9724 }
9725
9726 static unsigned int Int64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9727 {
9728 long long value2 = op2->i64;
9729
9730 exp->type = 2;
9731 exp->string = PrintInt64((long long)(op1->i64 || value2));
9732 if(!exp->expType)
9733 {
9734 exp->expType = op1->type;
9735 if(op1->type)
9736 op1->type->refCount++;
9737 }
9738 return 0x1;
9739 }
9740
9741 static unsigned int UInt64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9742 {
9743 uint64 value2 = op2->ui64;
9744
9745 exp->type = 2;
9746 exp->string = PrintUInt64((uint64)(op1->ui64 || value2));
9747 if(!exp->expType)
9748 {
9749 exp->expType = op1->type;
9750 if(op1->type)
9751 op1->type->refCount++;
9752 }
9753 return 0x1;
9754 }
9755
9756 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9757 {
9758 short value2 = op2->s;
9759
9760 exp->type = 2;
9761 exp->string = PrintShort((short)(op1->s || value2));
9762 if(!exp->expType)
9763 {
9764 exp->expType = op1->type;
9765 if(op1->type)
9766 op1->type->refCount++;
9767 }
9768 return 0x1;
9769 }
9770
9771 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9772 {
9773 unsigned short value2 = op2->us;
9774
9775 exp->type = 2;
9776 exp->string = PrintUShort((unsigned short)(op1->us || value2));
9777 if(!exp->expType)
9778 {
9779 exp->expType = op1->type;
9780 if(op1->type)
9781 op1->type->refCount++;
9782 }
9783 return 0x1;
9784 }
9785
9786 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9787 {
9788 char value2 = op2->c;
9789
9790 exp->type = 2;
9791 exp->string = PrintChar((char)(op1->c || value2));
9792 if(!exp->expType)
9793 {
9794 exp->expType = op1->type;
9795 if(op1->type)
9796 op1->type->refCount++;
9797 }
9798 return 0x1;
9799 }
9800
9801 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9802 {
9803 unsigned char value2 = op2->uc;
9804
9805 exp->type = 2;
9806 exp->string = PrintUChar((unsigned char)(op1->uc || value2));
9807 if(!exp->expType)
9808 {
9809 exp->expType = op1->type;
9810 if(op1->type)
9811 op1->type->refCount++;
9812 }
9813 return 0x1;
9814 }
9815
9816 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9817 {
9818 float value2 = op2->f;
9819
9820 exp->type = 2;
9821 exp->string = PrintFloat((float)(op1->f || value2));
9822 if(!exp->expType)
9823 {
9824 exp->expType = op1->type;
9825 if(op1->type)
9826 op1->type->refCount++;
9827 }
9828 return 0x1;
9829 }
9830
9831 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9832 {
9833 double value2 = op2->d;
9834
9835 exp->type = 2;
9836 exp->string = PrintDouble((double)(op1->d || value2));
9837 if(!exp->expType)
9838 {
9839 exp->expType = op1->type;
9840 if(op1->type)
9841 op1->type->refCount++;
9842 }
9843 return 0x1;
9844 }
9845
9846 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9847 {
9848 int value2 = op2->i;
9849
9850 exp->type = 2;
9851 exp->string = PrintInt((int)(op1->i > value2));
9852 if(!exp->expType)
9853 {
9854 exp->expType = op1->type;
9855 if(op1->type)
9856 op1->type->refCount++;
9857 }
9858 return 0x1;
9859 }
9860
9861 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9862 {
9863 unsigned int value2 = op2->ui;
9864
9865 exp->type = 2;
9866 exp->string = PrintUInt((unsigned int)(op1->ui > value2));
9867 if(!exp->expType)
9868 {
9869 exp->expType = op1->type;
9870 if(op1->type)
9871 op1->type->refCount++;
9872 }
9873 return 0x1;
9874 }
9875
9876 static unsigned int Int64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9877 {
9878 long long value2 = op2->i64;
9879
9880 exp->type = 2;
9881 exp->string = PrintInt64((long long)(op1->i64 > value2));
9882 if(!exp->expType)
9883 {
9884 exp->expType = op1->type;
9885 if(op1->type)
9886 op1->type->refCount++;
9887 }
9888 return 0x1;
9889 }
9890
9891 static unsigned int UInt64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9892 {
9893 uint64 value2 = op2->ui64;
9894
9895 exp->type = 2;
9896 exp->string = PrintUInt64((uint64)(op1->ui64 > value2));
9897 if(!exp->expType)
9898 {
9899 exp->expType = op1->type;
9900 if(op1->type)
9901 op1->type->refCount++;
9902 }
9903 return 0x1;
9904 }
9905
9906 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9907 {
9908 short value2 = op2->s;
9909
9910 exp->type = 2;
9911 exp->string = PrintShort((short)(op1->s > value2));
9912 if(!exp->expType)
9913 {
9914 exp->expType = op1->type;
9915 if(op1->type)
9916 op1->type->refCount++;
9917 }
9918 return 0x1;
9919 }
9920
9921 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9922 {
9923 unsigned short value2 = op2->us;
9924
9925 exp->type = 2;
9926 exp->string = PrintUShort((unsigned short)(op1->us > value2));
9927 if(!exp->expType)
9928 {
9929 exp->expType = op1->type;
9930 if(op1->type)
9931 op1->type->refCount++;
9932 }
9933 return 0x1;
9934 }
9935
9936 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9937 {
9938 char value2 = op2->c;
9939
9940 exp->type = 2;
9941 exp->string = PrintChar((char)(op1->c > value2));
9942 if(!exp->expType)
9943 {
9944 exp->expType = op1->type;
9945 if(op1->type)
9946 op1->type->refCount++;
9947 }
9948 return 0x1;
9949 }
9950
9951 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9952 {
9953 unsigned char value2 = op2->uc;
9954
9955 exp->type = 2;
9956 exp->string = PrintUChar((unsigned char)(op1->uc > value2));
9957 if(!exp->expType)
9958 {
9959 exp->expType = op1->type;
9960 if(op1->type)
9961 op1->type->refCount++;
9962 }
9963 return 0x1;
9964 }
9965
9966 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9967 {
9968 float value2 = op2->f;
9969
9970 exp->type = 2;
9971 exp->string = PrintFloat((float)(op1->f > value2));
9972 if(!exp->expType)
9973 {
9974 exp->expType = op1->type;
9975 if(op1->type)
9976 op1->type->refCount++;
9977 }
9978 return 0x1;
9979 }
9980
9981 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9982 {
9983 double value2 = op2->d;
9984
9985 exp->type = 2;
9986 exp->string = PrintDouble((double)(op1->d > value2));
9987 if(!exp->expType)
9988 {
9989 exp->expType = op1->type;
9990 if(op1->type)
9991 op1->type->refCount++;
9992 }
9993 return 0x1;
9994 }
9995
9996 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9997 {
9998 int value2 = op2->i;
9999
10000 exp->type = 2;
10001 exp->string = PrintInt((int)(op1->i < value2));
10002 if(!exp->expType)
10003 {
10004 exp->expType = op1->type;
10005 if(op1->type)
10006 op1->type->refCount++;
10007 }
10008 return 0x1;
10009 }
10010
10011 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10012 {
10013 unsigned int value2 = op2->ui;
10014
10015 exp->type = 2;
10016 exp->string = PrintUInt((unsigned int)(op1->ui < value2));
10017 if(!exp->expType)
10018 {
10019 exp->expType = op1->type;
10020 if(op1->type)
10021 op1->type->refCount++;
10022 }
10023 return 0x1;
10024 }
10025
10026 static unsigned int Int64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10027 {
10028 long long value2 = op2->i64;
10029
10030 exp->type = 2;
10031 exp->string = PrintInt64((long long)(op1->i64 < value2));
10032 if(!exp->expType)
10033 {
10034 exp->expType = op1->type;
10035 if(op1->type)
10036 op1->type->refCount++;
10037 }
10038 return 0x1;
10039 }
10040
10041 static unsigned int UInt64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10042 {
10043 uint64 value2 = op2->ui64;
10044
10045 exp->type = 2;
10046 exp->string = PrintUInt64((uint64)(op1->ui64 < value2));
10047 if(!exp->expType)
10048 {
10049 exp->expType = op1->type;
10050 if(op1->type)
10051 op1->type->refCount++;
10052 }
10053 return 0x1;
10054 }
10055
10056 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10057 {
10058 short value2 = op2->s;
10059
10060 exp->type = 2;
10061 exp->string = PrintShort((short)(op1->s < value2));
10062 if(!exp->expType)
10063 {
10064 exp->expType = op1->type;
10065 if(op1->type)
10066 op1->type->refCount++;
10067 }
10068 return 0x1;
10069 }
10070
10071 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10072 {
10073 unsigned short value2 = op2->us;
10074
10075 exp->type = 2;
10076 exp->string = PrintUShort((unsigned short)(op1->us < value2));
10077 if(!exp->expType)
10078 {
10079 exp->expType = op1->type;
10080 if(op1->type)
10081 op1->type->refCount++;
10082 }
10083 return 0x1;
10084 }
10085
10086 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10087 {
10088 char value2 = op2->c;
10089
10090 exp->type = 2;
10091 exp->string = PrintChar((char)(op1->c < value2));
10092 if(!exp->expType)
10093 {
10094 exp->expType = op1->type;
10095 if(op1->type)
10096 op1->type->refCount++;
10097 }
10098 return 0x1;
10099 }
10100
10101 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10102 {
10103 unsigned char value2 = op2->uc;
10104
10105 exp->type = 2;
10106 exp->string = PrintUChar((unsigned char)(op1->uc < value2));
10107 if(!exp->expType)
10108 {
10109 exp->expType = op1->type;
10110 if(op1->type)
10111 op1->type->refCount++;
10112 }
10113 return 0x1;
10114 }
10115
10116 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10117 {
10118 float value2 = op2->f;
10119
10120 exp->type = 2;
10121 exp->string = PrintFloat((float)(op1->f < value2));
10122 if(!exp->expType)
10123 {
10124 exp->expType = op1->type;
10125 if(op1->type)
10126 op1->type->refCount++;
10127 }
10128 return 0x1;
10129 }
10130
10131 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10132 {
10133 double value2 = op2->d;
10134
10135 exp->type = 2;
10136 exp->string = PrintDouble((double)(op1->d < value2));
10137 if(!exp->expType)
10138 {
10139 exp->expType = op1->type;
10140 if(op1->type)
10141 op1->type->refCount++;
10142 }
10143 return 0x1;
10144 }
10145
10146 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10147 {
10148 int value2 = op2->i;
10149
10150 exp->type = 2;
10151 exp->string = PrintInt((int)(op1->i >= value2));
10152 if(!exp->expType)
10153 {
10154 exp->expType = op1->type;
10155 if(op1->type)
10156 op1->type->refCount++;
10157 }
10158 return 0x1;
10159 }
10160
10161 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10162 {
10163 unsigned int value2 = op2->ui;
10164
10165 exp->type = 2;
10166 exp->string = PrintUInt((unsigned int)(op1->ui >= value2));
10167 if(!exp->expType)
10168 {
10169 exp->expType = op1->type;
10170 if(op1->type)
10171 op1->type->refCount++;
10172 }
10173 return 0x1;
10174 }
10175
10176 static unsigned int Int64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10177 {
10178 long long value2 = op2->i64;
10179
10180 exp->type = 2;
10181 exp->string = PrintInt64((long long)(op1->i64 >= value2));
10182 if(!exp->expType)
10183 {
10184 exp->expType = op1->type;
10185 if(op1->type)
10186 op1->type->refCount++;
10187 }
10188 return 0x1;
10189 }
10190
10191 static unsigned int UInt64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10192 {
10193 uint64 value2 = op2->ui64;
10194
10195 exp->type = 2;
10196 exp->string = PrintUInt64((uint64)(op1->ui64 >= value2));
10197 if(!exp->expType)
10198 {
10199 exp->expType = op1->type;
10200 if(op1->type)
10201 op1->type->refCount++;
10202 }
10203 return 0x1;
10204 }
10205
10206 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10207 {
10208 short value2 = op2->s;
10209
10210 exp->type = 2;
10211 exp->string = PrintShort((short)(op1->s >= value2));
10212 if(!exp->expType)
10213 {
10214 exp->expType = op1->type;
10215 if(op1->type)
10216 op1->type->refCount++;
10217 }
10218 return 0x1;
10219 }
10220
10221 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10222 {
10223 unsigned short value2 = op2->us;
10224
10225 exp->type = 2;
10226 exp->string = PrintUShort((unsigned short)(op1->us >= value2));
10227 if(!exp->expType)
10228 {
10229 exp->expType = op1->type;
10230 if(op1->type)
10231 op1->type->refCount++;
10232 }
10233 return 0x1;
10234 }
10235
10236 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10237 {
10238 char value2 = op2->c;
10239
10240 exp->type = 2;
10241 exp->string = PrintChar((char)(op1->c >= value2));
10242 if(!exp->expType)
10243 {
10244 exp->expType = op1->type;
10245 if(op1->type)
10246 op1->type->refCount++;
10247 }
10248 return 0x1;
10249 }
10250
10251 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10252 {
10253 unsigned char value2 = op2->uc;
10254
10255 exp->type = 2;
10256 exp->string = PrintUChar((unsigned char)(op1->uc >= value2));
10257 if(!exp->expType)
10258 {
10259 exp->expType = op1->type;
10260 if(op1->type)
10261 op1->type->refCount++;
10262 }
10263 return 0x1;
10264 }
10265
10266 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10267 {
10268 float value2 = op2->f;
10269
10270 exp->type = 2;
10271 exp->string = PrintFloat((float)(op1->f >= value2));
10272 if(!exp->expType)
10273 {
10274 exp->expType = op1->type;
10275 if(op1->type)
10276 op1->type->refCount++;
10277 }
10278 return 0x1;
10279 }
10280
10281 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10282 {
10283 double value2 = op2->d;
10284
10285 exp->type = 2;
10286 exp->string = PrintDouble((double)(op1->d >= value2));
10287 if(!exp->expType)
10288 {
10289 exp->expType = op1->type;
10290 if(op1->type)
10291 op1->type->refCount++;
10292 }
10293 return 0x1;
10294 }
10295
10296 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10297 {
10298 int value2 = op2->i;
10299
10300 exp->type = 2;
10301 exp->string = PrintInt((int)(op1->i <= value2));
10302 if(!exp->expType)
10303 {
10304 exp->expType = op1->type;
10305 if(op1->type)
10306 op1->type->refCount++;
10307 }
10308 return 0x1;
10309 }
10310
10311 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10312 {
10313 unsigned int value2 = op2->ui;
10314
10315 exp->type = 2;
10316 exp->string = PrintUInt((unsigned int)(op1->ui <= value2));
10317 if(!exp->expType)
10318 {
10319 exp->expType = op1->type;
10320 if(op1->type)
10321 op1->type->refCount++;
10322 }
10323 return 0x1;
10324 }
10325
10326 static unsigned int Int64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10327 {
10328 long long value2 = op2->i64;
10329
10330 exp->type = 2;
10331 exp->string = PrintInt64((long long)(op1->i64 <= value2));
10332 if(!exp->expType)
10333 {
10334 exp->expType = op1->type;
10335 if(op1->type)
10336 op1->type->refCount++;
10337 }
10338 return 0x1;
10339 }
10340
10341 static unsigned int UInt64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10342 {
10343 uint64 value2 = op2->ui64;
10344
10345 exp->type = 2;
10346 exp->string = PrintUInt64((uint64)(op1->ui64 <= value2));
10347 if(!exp->expType)
10348 {
10349 exp->expType = op1->type;
10350 if(op1->type)
10351 op1->type->refCount++;
10352 }
10353 return 0x1;
10354 }
10355
10356 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10357 {
10358 short value2 = op2->s;
10359
10360 exp->type = 2;
10361 exp->string = PrintShort((short)(op1->s <= value2));
10362 if(!exp->expType)
10363 {
10364 exp->expType = op1->type;
10365 if(op1->type)
10366 op1->type->refCount++;
10367 }
10368 return 0x1;
10369 }
10370
10371 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10372 {
10373 unsigned short value2 = op2->us;
10374
10375 exp->type = 2;
10376 exp->string = PrintUShort((unsigned short)(op1->us <= value2));
10377 if(!exp->expType)
10378 {
10379 exp->expType = op1->type;
10380 if(op1->type)
10381 op1->type->refCount++;
10382 }
10383 return 0x1;
10384 }
10385
10386 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10387 {
10388 char value2 = op2->c;
10389
10390 exp->type = 2;
10391 exp->string = PrintChar((char)(op1->c <= value2));
10392 if(!exp->expType)
10393 {
10394 exp->expType = op1->type;
10395 if(op1->type)
10396 op1->type->refCount++;
10397 }
10398 return 0x1;
10399 }
10400
10401 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10402 {
10403 unsigned char value2 = op2->uc;
10404
10405 exp->type = 2;
10406 exp->string = PrintUChar((unsigned char)(op1->uc <= value2));
10407 if(!exp->expType)
10408 {
10409 exp->expType = op1->type;
10410 if(op1->type)
10411 op1->type->refCount++;
10412 }
10413 return 0x1;
10414 }
10415
10416 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10417 {
10418 float value2 = op2->f;
10419
10420 exp->type = 2;
10421 exp->string = PrintFloat((float)(op1->f <= value2));
10422 if(!exp->expType)
10423 {
10424 exp->expType = op1->type;
10425 if(op1->type)
10426 op1->type->refCount++;
10427 }
10428 return 0x1;
10429 }
10430
10431 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10432 {
10433 double value2 = op2->d;
10434
10435 exp->type = 2;
10436 exp->string = PrintDouble((double)(op1->d <= value2));
10437 if(!exp->expType)
10438 {
10439 exp->expType = op1->type;
10440 if(op1->type)
10441 op1->type->refCount++;
10442 }
10443 return 0x1;
10444 }
10445
10446 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10447 {
10448 exp->type = 2;
10449 exp->string = PrintInt(op1->i ? op2->i : op3->i);
10450 if(!exp->expType)
10451 {
10452 exp->expType = op1->type;
10453 if(op1->type)
10454 op1->type->refCount++;
10455 }
10456 return 0x1;
10457 }
10458
10459 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10460 {
10461 exp->type = 2;
10462 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
10463 if(!exp->expType)
10464 {
10465 exp->expType = op1->type;
10466 if(op1->type)
10467 op1->type->refCount++;
10468 }
10469 return 0x1;
10470 }
10471
10472 static unsigned int Int64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10473 {
10474 exp->type = 2;
10475 exp->string = PrintInt64(op1->i64 ? op2->i64 : op3->i64);
10476 if(!exp->expType)
10477 {
10478 exp->expType = op1->type;
10479 if(op1->type)
10480 op1->type->refCount++;
10481 }
10482 return 0x1;
10483 }
10484
10485 static unsigned int UInt64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10486 {
10487 exp->type = 2;
10488 exp->string = PrintUInt64(op1->ui64 ? op2->ui64 : op3->ui64);
10489 if(!exp->expType)
10490 {
10491 exp->expType = op1->type;
10492 if(op1->type)
10493 op1->type->refCount++;
10494 }
10495 return 0x1;
10496 }
10497
10498 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10499 {
10500 exp->type = 2;
10501 exp->string = PrintShort(op1->s ? op2->s : op3->s);
10502 if(!exp->expType)
10503 {
10504 exp->expType = op1->type;
10505 if(op1->type)
10506 op1->type->refCount++;
10507 }
10508 return 0x1;
10509 }
10510
10511 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10512 {
10513 exp->type = 2;
10514 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
10515 if(!exp->expType)
10516 {
10517 exp->expType = op1->type;
10518 if(op1->type)
10519 op1->type->refCount++;
10520 }
10521 return 0x1;
10522 }
10523
10524 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10525 {
10526 exp->type = 2;
10527 exp->string = PrintChar(op1->c ? op2->c : op3->c);
10528 if(!exp->expType)
10529 {
10530 exp->expType = op1->type;
10531 if(op1->type)
10532 op1->type->refCount++;
10533 }
10534 return 0x1;
10535 }
10536
10537 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10538 {
10539 exp->type = 2;
10540 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
10541 if(!exp->expType)
10542 {
10543 exp->expType = op1->type;
10544 if(op1->type)
10545 op1->type->refCount++;
10546 }
10547 return 0x1;
10548 }
10549
10550 struct OpTable intOps =
10551 {
10552 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
10553 };
10554
10555 struct OpTable uintOps =
10556 {
10557 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
10558 };
10559
10560 struct OpTable int64Ops =
10561 {
10562 Int64Add, Int64Sub, Int64Mul, Int64Div, Int64Mod, Int64Neg, Int64Inc, Int64Dec, Int64Asign, Int64AddAsign, Int64SubAsign, Int64MulAsign, Int64DivAsign, Int64ModAsign, Int64BitAnd, Int64BitOr, Int64BitXor, Int64LShift, Int64RShift, Int64BitNot, Int64AndAsign, Int64OrAsign, Int64XorAsign, Int64LShiftAsign, Int64RShiftAsign, Int64Not, Int64Equ, Int64Nqu, Int64And, Int64Or, Int64Grt, Int64Sma, Int64GrtEqu, Int64SmaEqu, Int64Cond
10563 };
10564
10565 struct OpTable uint64Ops =
10566 {
10567 UInt64Add, UInt64Sub, UInt64Mul, UInt64Div, UInt64Mod, UInt64Neg, UInt64Inc, UInt64Dec, UInt64Asign, UInt64AddAsign, UInt64SubAsign, UInt64MulAsign, UInt64DivAsign, UInt64ModAsign, UInt64BitAnd, UInt64BitOr, UInt64BitXor, UInt64LShift, UInt64RShift, UInt64BitNot, UInt64AndAsign, UInt64OrAsign, UInt64XorAsign, UInt64LShiftAsign, UInt64RShiftAsign, UInt64Not, UInt64Equ, UInt64Nqu, UInt64And, UInt64Or, UInt64Grt, UInt64Sma, UInt64GrtEqu, UInt64SmaEqu, UInt64Cond
10568 };
10569
10570 struct OpTable shortOps =
10571 {
10572 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
10573 };
10574
10575 struct OpTable ushortOps =
10576 {
10577 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
10578 };
10579
10580 struct OpTable floatOps =
10581 {
10582 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
10583 };
10584
10585 struct OpTable doubleOps =
10586 {
10587 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
10588 };
10589
10590 struct OpTable charOps =
10591 {
10592 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
10593 };
10594
10595 struct OpTable ucharOps =
10596 {
10597 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
10598 };
10599
10600 void ReadString(char * output, char * string)
10601 {
10602 int len = strlen(string);
10603 int c, d = 0;
10604 unsigned int quoted = 0x0, escaped = 0x0;
10605
10606 for(c = 0; c < len; c++)
10607 {
10608 char ch = string[c];
10609
10610 if(escaped)
10611 {
10612 switch(ch)
10613 {
10614 case 'n':
10615 output[d] = '\n';
10616 break;
10617 case 't':
10618 output[d] = '\t';
10619 break;
10620 case 'a':
10621 output[d] = '\a';
10622 break;
10623 case 'b':
10624 output[d] = '\b';
10625 break;
10626 case 'f':
10627 output[d] = '\f';
10628 break;
10629 case 'r':
10630 output[d] = '\r';
10631 break;
10632 case 'v':
10633 output[d] = '\v';
10634 break;
10635 case '\\':
10636 output[d] = '\\';
10637 break;
10638 case '\"':
10639 output[d] = '\"';
10640 break;
10641 case '\'':
10642 output[d] = '\'';
10643 break;
10644 default:
10645 output[d] = ch;
10646 }
10647 d++;
10648 escaped = 0x0;
10649 }
10650 else
10651 {
10652 if(ch == '\"')
10653 quoted ^= 0x1;
10654 else if(quoted)
10655 {
10656 if(ch == '\\')
10657 escaped = 0x1;
10658 else
10659 output[d++] = ch;
10660 }
10661 }
10662 }
10663 output[d] = '\0';
10664 }
10665
10666 int UnescapeString(char * d, char * s, int len)
10667 {
10668 int j = 0, k = 0;
10669 char ch;
10670
10671 while(j < len && (ch = s[j]))
10672 {
10673 switch(ch)
10674 {
10675 case '\\':
10676 switch((ch = s[++j]))
10677 {
10678 case 'n':
10679 d[k] = '\n';
10680 break;
10681 case 't':
10682 d[k] = '\t';
10683 break;
10684 case 'a':
10685 d[k] = '\a';
10686 break;
10687 case 'b':
10688 d[k] = '\b';
10689 break;
10690 case 'f':
10691 d[k] = '\f';
10692 break;
10693 case 'r':
10694 d[k] = '\r';
10695 break;
10696 case 'v':
10697 d[k] = '\v';
10698 break;
10699 case '\\':
10700 d[k] = '\\';
10701 break;
10702 case '\"':
10703 d[k] = '\"';
10704 break;
10705 case '\'':
10706 d[k] = '\'';
10707 break;
10708 default:
10709 d[k] = '\\';
10710 d[k] = ch;
10711 }
10712 break;
10713 default:
10714 d[k] = ch;
10715 }
10716 j++, k++;
10717 }
10718 d[k] = '\0';
10719 return k;
10720 }
10721
10722 char * OffsetEscapedString(char * s, int len, int offset)
10723 {
10724 char ch;
10725 int j = 0, k = 0;
10726
10727 while(j < len && k < offset && (ch = s[j]))
10728 {
10729 if(ch == '\\')
10730 ++j;
10731 j++, k++;
10732 }
10733 return (k == offset) ? s + j : (((void *)0));
10734 }
10735
10736 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
10737
10738 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
10739
10740 extern double strtod(char * , char * * );
10741
10742 extern float (* __ecereMethod_float_inf)(void);
10743
10744 extern float (* __ecereMethod_float_nan)(void);
10745
10746 extern double (* __ecereMethod_double_inf)(void);
10747
10748 extern double (* __ecereMethod_double_nan)(void);
10749
10750 struct Operand GetOperand(struct Expression * exp)
10751 {
10752 struct Operand op =
10753 {
10754 0, 0, 0, .c = 0,
10755 {
10756 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10757 }
10758 };
10759 struct Type * type = exp->expType;
10760
10761 if(type)
10762 {
10763 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
10764 {
10765 if(!type->_class->registered->dataType)
10766 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10767 type = type->_class->registered->dataType;
10768 }
10769 if(exp->type == 3 && op.kind == 13)
10770 {
10771 op.ui64 = (uint64)exp->string;
10772 op.kind = 13;
10773 op.ops = uint64Ops;
10774 }
10775 else if(exp->isConstant && exp->type == 2)
10776 {
10777 op.kind = type->kind;
10778 op.type = exp->expType;
10779 switch(op.kind)
10780 {
10781 case 24:
10782 case 1:
10783 {
10784 if(exp->constant[0] == '\'')
10785 {
10786 op.c = exp->constant[1];
10787 op.ops = charOps;
10788 }
10789 else if(type->isSigned)
10790 {
10791 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
10792 op.ops = charOps;
10793 }
10794 else
10795 {
10796 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
10797 op.ops = ucharOps;
10798 }
10799 break;
10800 }
10801 case 2:
10802 if(type->isSigned)
10803 {
10804 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
10805 op.ops = shortOps;
10806 }
10807 else
10808 {
10809 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
10810 op.ops = ushortOps;
10811 }
10812 break;
10813 case 3:
10814 case 5:
10815 if(type->isSigned)
10816 {
10817 op.i = strtol(exp->constant, (((void *)0)), 0);
10818 op.ops = intOps;
10819 }
10820 else
10821 {
10822 op.ui = strtoul(exp->constant, (((void *)0)), 0);
10823 op.ops = uintOps;
10824 }
10825 op.kind = 3;
10826 break;
10827 case 4:
10828 if(type->isSigned)
10829 {
10830 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10831 op.ops = int64Ops;
10832 }
10833 else
10834 {
10835 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10836 op.ops = uint64Ops;
10837 }
10838 op.kind = 4;
10839 break;
10840 case 22:
10841 if(type->isSigned)
10842 {
10843 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10844 op.ops = int64Ops;
10845 }
10846 else
10847 {
10848 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10849 op.ops = uint64Ops;
10850 }
10851 op.kind = 4;
10852 break;
10853 case 23:
10854 if(type->isSigned)
10855 {
10856 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10857 op.ops = int64Ops;
10858 }
10859 else
10860 {
10861 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10862 op.ops = uint64Ops;
10863 }
10864 op.kind = 4;
10865 break;
10866 case 6:
10867 if(!strcmp(exp->constant, "inf"))
10868 op.f = __ecereMethod_float_inf();
10869 else if(!strcmp(exp->constant, "-inf"))
10870 op.f = -__ecereMethod_float_inf();
10871 else if(!strcmp(exp->constant, "nan"))
10872 op.f = __ecereMethod_float_nan();
10873 else if(!strcmp(exp->constant, "-nan"))
10874 op.f = -__ecereMethod_float_nan();
10875 else
10876 op.f = (float)strtod(exp->constant, (((void *)0)));
10877 op.ops = floatOps;
10878 break;
10879 case 7:
10880 if(!strcmp(exp->constant, "inf"))
10881 op.d = __ecereMethod_double_inf();
10882 else if(!strcmp(exp->constant, "-inf"))
10883 op.d = -__ecereMethod_double_inf();
10884 else if(!strcmp(exp->constant, "nan"))
10885 op.d = __ecereMethod_double_nan();
10886 else if(!strcmp(exp->constant, "-nan"))
10887 op.d = -__ecereMethod_double_nan();
10888 else
10889 op.d = (double)strtod(exp->constant, (((void *)0)));
10890 op.ops = doubleOps;
10891 break;
10892 case 12:
10893 case 13:
10894 case 8:
10895 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10896 op.kind = 13;
10897 op.ops = uint64Ops;
10898 break;
10899 }
10900 }
10901 }
10902 return op;
10903 }
10904
10905 int __ecereVMethodID_class_OnGetString;
10906
10907 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
10908
10909 static __attribute__((unused)) void UnusedFunction()
10910 {
10911 int a;
10912
10913 ((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);
10914 }
10915
10916 extern int __ecereVMethodID_class_OnGetString;
10917
10918 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
10919 {
10920 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
10921
10922 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
10923 {
10924 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
10925 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
10926 else
10927 {
10928 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10929 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
10930 struct Type * type;
10931 void * ptr = inst->data + dataMember->offset + offset;
10932 char * result = (((void *)0));
10933
10934 exp->loc = member->loc = inst->loc;
10935 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
10936 if(!dataMember->dataType)
10937 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
10938 type = dataMember->dataType;
10939 if(type->kind == 8)
10940 {
10941 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10942
10943 if(_class->type == 4)
10944 {
10945 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
10946
10947 if(enumClass)
10948 {
10949 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
10950 struct __ecereNameSpace__ecere__sys__NamedLink * item;
10951
10952 for(item = e->values.first; item; item = item->next)
10953 {
10954 if((int)item->data == *(int *)ptr)
10955 {
10956 result = item->name;
10957 break;
10958 }
10959 }
10960 if(result)
10961 {
10962 exp->identifier = MkIdentifier(result);
10963 exp->type = 0;
10964 exp->destType = MkClassType(_class->fullName);
10965 ProcessExpressionType(exp);
10966 }
10967 }
10968 }
10969 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
10970 {
10971 if(!_class->dataType)
10972 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10973 type = _class->dataType;
10974 }
10975 }
10976 if(!result)
10977 {
10978 switch(type->kind)
10979 {
10980 case 6:
10981 {
10982 FreeExpContents(exp);
10983 exp->constant = PrintFloat(*(float *)ptr);
10984 exp->type = 2;
10985 break;
10986 }
10987 case 7:
10988 {
10989 FreeExpContents(exp);
10990 exp->constant = PrintDouble(*(double *)ptr);
10991 exp->type = 2;
10992 break;
10993 }
10994 case 3:
10995 {
10996 FreeExpContents(exp);
10997 exp->constant = PrintInt(*(int *)ptr);
10998 exp->type = 2;
10999 break;
11000 }
11001 case 4:
11002 {
11003 FreeExpContents(exp);
11004 exp->constant = PrintInt64(*(long long *)ptr);
11005 exp->type = 2;
11006 break;
11007 }
11008 case 22:
11009 {
11010 FreeExpContents(exp);
11011 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11012 exp->type = 2;
11013 break;
11014 }
11015 case 23:
11016 {
11017 FreeExpContents(exp);
11018 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11019 exp->type = 2;
11020 break;
11021 }
11022 default:
11023 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11024 }
11025 }
11026 ListAdd(memberList, member);
11027 }
11028 if(parentDataMember->type == 1)
11029 break;
11030 }
11031 }
11032
11033 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
11034
11035 void PopulateInstance(struct Instantiation * inst)
11036 {
11037 struct Symbol * classSym = inst->_class->symbol;
11038 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
11039 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
11040 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
11041
11042 if(!inst->members)
11043 inst->members = MkListOne(MkMembersInitList(memberList));
11044 else
11045 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
11046 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
11047 {
11048 if(!dataMember->isProperty)
11049 {
11050 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
11051 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
11052 else
11053 {
11054 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11055 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
11056 struct Type * type;
11057 void * ptr = inst->data + dataMember->offset;
11058 char * result = (((void *)0));
11059
11060 exp->loc = member->loc = inst->loc;
11061 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
11062 if(!dataMember->dataType)
11063 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11064 type = dataMember->dataType;
11065 if(type->kind == 8)
11066 {
11067 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11068
11069 if(_class->type == 4)
11070 {
11071 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11072
11073 if(enumClass)
11074 {
11075 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
11076 struct __ecereNameSpace__ecere__sys__NamedLink * item;
11077
11078 for(item = e->values.first; item; item = item->next)
11079 {
11080 if((int)item->data == *(int *)ptr)
11081 {
11082 result = item->name;
11083 break;
11084 }
11085 }
11086 }
11087 if(result)
11088 {
11089 exp->identifier = MkIdentifier(result);
11090 exp->type = 0;
11091 exp->destType = MkClassType(_class->fullName);
11092 ProcessExpressionType(exp);
11093 }
11094 }
11095 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
11096 {
11097 if(!_class->dataType)
11098 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11099 type = _class->dataType;
11100 }
11101 }
11102 if(!result)
11103 {
11104 switch(type->kind)
11105 {
11106 case 6:
11107 {
11108 exp->constant = PrintFloat(*(float *)ptr);
11109 exp->type = 2;
11110 break;
11111 }
11112 case 7:
11113 {
11114 exp->constant = PrintDouble(*(double *)ptr);
11115 exp->type = 2;
11116 break;
11117 }
11118 case 3:
11119 {
11120 exp->constant = PrintInt(*(int *)ptr);
11121 exp->type = 2;
11122 break;
11123 }
11124 case 4:
11125 {
11126 exp->constant = PrintInt64(*(long long *)ptr);
11127 exp->type = 2;
11128 break;
11129 }
11130 case 22:
11131 {
11132 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11133 exp->type = 2;
11134 break;
11135 }
11136 default:
11137 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11138 }
11139 }
11140 ListAdd(memberList, member);
11141 }
11142 }
11143 }
11144 }
11145
11146 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);
11147
11148 extern void FreeInstance(struct Instantiation * inst);
11149
11150 void ComputeInstantiation(struct Expression * exp)
11151 {
11152 struct Instantiation * inst = exp->instance;
11153 struct MembersInit * members;
11154 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
11155 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
11156 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
11157 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
11158 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
11159 int subMemberStackPos = 0;
11160 uint64 bits = 0;
11161
11162 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11163 {
11164 if(inst->data)
11165 return ;
11166 if(_class->type == 0 || _class->type == 5)
11167 {
11168 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
11169 if(_class->type == 0)
11170 ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)inst->data))->_refCount++;
11171 }
11172 else
11173 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
11174 }
11175 if(inst->members)
11176 {
11177 for(members = (*inst->members).first; members; members = members->next)
11178 {
11179 switch(members->type)
11180 {
11181 case 0:
11182 {
11183 if(members->dataMembers)
11184 {
11185 struct MemberInit * member;
11186
11187 for(member = (*members->dataMembers).first; member; member = member->next)
11188 {
11189 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
11190 unsigned int found = 0x0;
11191 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11192 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
11193 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11194 unsigned int dataMemberOffset;
11195
11196 if(!ident)
11197 {
11198 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
11199 if(curMember)
11200 {
11201 if(curMember->isProperty)
11202 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
11203 else
11204 {
11205 dataMember = curMember;
11206 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11207 if(_class->type == 0)
11208 dataMemberOffset += _class->base->structSize;
11209 }
11210 found = 0x1;
11211 }
11212 }
11213 else
11214 {
11215 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
11216 if(prop)
11217 {
11218 found = 0x1;
11219 if(prop->memberAccess == 1)
11220 {
11221 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
11222 curClass = prop->_class;
11223 }
11224 }
11225 else
11226 {
11227 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
11228 int _subMemberStackPos = 0;
11229
11230 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
11231 if(dataMember)
11232 {
11233 found = 0x1;
11234 if(dataMember->memberAccess == 1)
11235 {
11236 curMember = dataMember;
11237 curClass = dataMember->_class;
11238 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
11239 subMemberStackPos = _subMemberStackPos;
11240 }
11241 }
11242 }
11243 }
11244 if(found && member->initializer && member->initializer->type == 0)
11245 {
11246 struct Expression * value = member->initializer->exp;
11247 struct Type * type = (((void *)0));
11248 unsigned int deepMember = 0x0;
11249
11250 if(prop)
11251 {
11252 type = prop->dataType;
11253 }
11254 else if(dataMember)
11255 {
11256 if(!dataMember->dataType)
11257 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11258 type = dataMember->dataType;
11259 }
11260 if(ident && ident->next)
11261 {
11262 deepMember = 0x1;
11263 for(ident = ident->next; ident && type; ident = ident->next)
11264 {
11265 if(type->kind == 8)
11266 {
11267 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
11268 if(prop)
11269 type = prop->dataType;
11270 else
11271 {
11272 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11273 if(dataMember)
11274 type = dataMember->dataType;
11275 }
11276 }
11277 else if(type->kind == 9 || type->kind == 10)
11278 {
11279 struct Type * memberType;
11280
11281 for(memberType = type->members.first; memberType; memberType = memberType->next)
11282 {
11283 if(!strcmp(memberType->name, ident->string))
11284 {
11285 type = memberType;
11286 break;
11287 }
11288 }
11289 }
11290 }
11291 }
11292 if(value)
11293 {
11294 FreeType(value->destType);
11295 value->destType = type;
11296 if(type)
11297 type->refCount++;
11298 ComputeExpression(value);
11299 }
11300 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11301 {
11302 if(type->kind == 8)
11303 {
11304 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11305
11306 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
11307 {
11308 if(!_class->dataType)
11309 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11310 type = _class->dataType;
11311 }
11312 }
11313 if(dataMember)
11314 {
11315 void * ptr = inst->data + dataMemberOffset;
11316
11317 if(value->type == 2)
11318 {
11319 switch(type->kind)
11320 {
11321 case 3:
11322 {
11323 GetInt(value, (int *)ptr);
11324 break;
11325 }
11326 case 4:
11327 {
11328 GetInt64(value, (long long *)ptr);
11329 break;
11330 }
11331 case 22:
11332 {
11333 GetIntPtr(value, (intptr_t *)ptr);
11334 break;
11335 }
11336 case 23:
11337 {
11338 GetIntSize(value, (ssize_t *)ptr);
11339 break;
11340 }
11341 case 6:
11342 {
11343 GetFloat(value, (float *)ptr);
11344 break;
11345 }
11346 case 7:
11347 {
11348 GetDouble(value, (double *)ptr);
11349 break;
11350 }
11351 }
11352 }
11353 else if(value->type == 1)
11354 {
11355 if(type->kind == 8)
11356 {
11357 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11358
11359 if(_class->type == 1)
11360 {
11361 ComputeTypeSize(type);
11362 if(value->instance->data)
11363 memcpy(ptr, value->instance->data, type->size);
11364 }
11365 }
11366 }
11367 }
11368 else if(prop)
11369 {
11370 if(value->type == 1 && value->instance->data)
11371 {
11372 if(type->kind == 8)
11373 {
11374 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11375
11376 if(_class && (_class->type != 0 || __ecereNameSpace__ecere__com__eClass_IsDerived(((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)value->instance->data))->_class, _class)))
11377 {
11378 void (* Set)(void *, void *) = (void *)prop->Set;
11379
11380 Set(inst->data, value->instance->data);
11381 PopulateInstance(inst);
11382 }
11383 }
11384 }
11385 else if(value->type == 2)
11386 {
11387 switch(type->kind)
11388 {
11389 case 7:
11390 {
11391 void (* Set)(void *, double) = (void *)prop->Set;
11392
11393 Set(inst->data, strtod(value->constant, (((void *)0))));
11394 break;
11395 }
11396 case 6:
11397 {
11398 void (* Set)(void *, float) = (void *)prop->Set;
11399
11400 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
11401 break;
11402 }
11403 case 3:
11404 {
11405 void (* Set)(void *, int) = (void *)prop->Set;
11406
11407 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
11408 break;
11409 }
11410 case 4:
11411 {
11412 void (* Set)(void *, long long) = (void *)prop->Set;
11413
11414 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11415 break;
11416 }
11417 case 22:
11418 {
11419 void (* Set)(void *, intptr_t) = (void *)prop->Set;
11420
11421 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11422 break;
11423 }
11424 case 23:
11425 {
11426 void (* Set)(void *, ssize_t) = (void *)prop->Set;
11427
11428 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11429 break;
11430 }
11431 }
11432 }
11433 else if(value->type == 3)
11434 {
11435 char temp[1024];
11436
11437 ReadString(temp, value->string);
11438 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
11439 }
11440 }
11441 }
11442 else if(!deepMember && type && _class->type == 3)
11443 {
11444 if(prop)
11445 {
11446 if(value->type == 2)
11447 {
11448 if(type->kind == 8)
11449 {
11450 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11451
11452 if(_class->type == 3)
11453 {
11454 if(!_class->dataType)
11455 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11456 type = _class->dataType;
11457 }
11458 }
11459 switch(type->kind)
11460 {
11461 case 6:
11462 {
11463 float fValue;
11464 float (* Set)(float) = (void *)prop->Set;
11465
11466 GetFloat(member->initializer->exp, &fValue);
11467 exp->constant = PrintFloat(Set(fValue));
11468 exp->type = 2;
11469 break;
11470 }
11471 case 7:
11472 {
11473 double dValue;
11474 double (* Set)(double) = (void *)prop->Set;
11475
11476 GetDouble(member->initializer->exp, &dValue);
11477 exp->constant = PrintDouble(Set(dValue));
11478 exp->type = 2;
11479 break;
11480 }
11481 }
11482 }
11483 }
11484 }
11485 else if(!deepMember && type && _class->type == 2)
11486 {
11487 if(prop)
11488 {
11489 if(value->type == 1 && value->instance->data)
11490 {
11491 unsigned int (* Set)(void *) = (void *)prop->Set;
11492
11493 bits = Set(value->instance->data);
11494 }
11495 else if(value->type == 2)
11496 {
11497 }
11498 }
11499 else if(dataMember)
11500 {
11501 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
11502 struct Type * type;
11503 uint64 part;
11504
11505 bits = (bits & ~bitMember->mask);
11506 if(!bitMember->dataType)
11507 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
11508 type = bitMember->dataType;
11509 if(type->kind == 8 && type->_class && type->_class->registered)
11510 {
11511 if(!type->_class->registered->dataType)
11512 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11513 type = type->_class->registered->dataType;
11514 }
11515 switch(type->kind)
11516 {
11517 case 24:
11518 case 1:
11519 {
11520 unsigned char v;
11521
11522 type->isSigned ? GetChar(value, (char *)&v) : GetUChar(value, &v);
11523 part = (uint64)v;
11524 break;
11525 }
11526 case 2:
11527 {
11528 unsigned short v;
11529
11530 type->isSigned ? GetShort(value, &v) : GetUShort(value, &v);
11531 part = (uint64)v;
11532 break;
11533 }
11534 case 3:
11535 case 5:
11536 {
11537 unsigned int v;
11538
11539 type->isSigned ? GetInt(value, &v) : GetUInt(value, &v);
11540 part = (uint64)v;
11541 break;
11542 }
11543 case 4:
11544 {
11545 uint64 v;
11546
11547 type->isSigned ? GetInt64(value, &v) : GetUInt64(value, &v);
11548 part = v;
11549 break;
11550 }
11551 case 22:
11552 {
11553 uintptr_t v;
11554
11555 type->isSigned ? GetIntPtr(value, &v) : GetUIntPtr(value, &v);
11556 part = (uint64)v;
11557 break;
11558 }
11559 case 23:
11560 {
11561 size_t v;
11562
11563 type->isSigned ? GetIntSize(value, &v) : GetUIntSize(value, &v);
11564 part = (uint64)v;
11565 break;
11566 }
11567 }
11568 bits |= part << bitMember->pos;
11569 }
11570 }
11571 }
11572 else
11573 {
11574 if(_class && _class->type == 3)
11575 {
11576 ComputeExpression(member->initializer->exp);
11577 exp->constant = member->initializer->exp->constant;
11578 exp->type = 2;
11579 member->initializer->exp->constant = (((void *)0));
11580 }
11581 }
11582 }
11583 }
11584 break;
11585 }
11586 }
11587 }
11588 }
11589 if(_class && _class->type == 2)
11590 {
11591 exp->constant = PrintHexUInt(bits);
11592 exp->type = 2;
11593 }
11594 if(exp->type != 1)
11595 {
11596 FreeInstance(inst);
11597 }
11598 }
11599
11600 static unsigned int Promote(struct Operand * op, int kind, unsigned int isSigned)
11601 {
11602 unsigned int result = 0x0;
11603
11604 switch(kind)
11605 {
11606 case 2:
11607 if(op->kind == 1 || op->kind == 15 || op->kind == 24)
11608 result = isSigned ? GetOpShort(op, &op->s) : GetOpUShort(op, &op->us);
11609 break;
11610 case 3:
11611 case 5:
11612 if(op->kind == 1 || op->kind == 2 || op->kind == 15 || op->kind == 24)
11613 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11614 break;
11615 case 4:
11616 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 4 || op->kind == 5 || op->kind == 6 || op->kind == 7 || op->kind == 13 || op->kind == 15 || op->kind == 22 || op->kind == 23 || op->kind == 24)
11617 result = isSigned ? GetOpInt64(op, &op->i64) : GetOpUInt64(op, &op->ui64);
11618 break;
11619 case 6:
11620 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 4 || op->kind == 5 || op->kind == 15 || op->kind == 22 || op->kind == 23 || op->kind == 24)
11621 result = GetOpFloat(op, &op->f);
11622 break;
11623 case 7:
11624 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 4 || op->kind == 5 || op->kind == 6 || op->kind == 15 || op->kind == 22 || op->kind == 23 || op->kind == 24)
11625 result = GetOpDouble(op, &op->d);
11626 break;
11627 case 13:
11628 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 4 || op->kind == 5 || op->kind == 6 || op->kind == 7 || op->kind == 13 || op->kind == 15 || op->kind == 22 || op->kind == 23 || op->kind == 24)
11629 result = GetOpUIntPtr(op, &op->ui64);
11630 break;
11631 case 15:
11632 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 4 || op->kind == 5 || op->kind == 6 || op->kind == 7 || op->kind == 13 || op->kind == 15 || op->kind == 22 || op->kind == 23 || op->kind == 24)
11633 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11634 break;
11635 case 22:
11636 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11637 result = isSigned ? GetOpIntPtr(op, &op->i64) : GetOpUIntPtr(op, &op->i64);
11638 break;
11639 case 23:
11640 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11641 result = isSigned ? GetOpIntSize(op, &op->ui64) : GetOpUIntSize(op, &op->ui64);
11642 break;
11643 }
11644 return result;
11645 }
11646
11647 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
11648 {
11649 if(exp->op.op == SIZEOF)
11650 {
11651 FreeExpContents(exp);
11652 exp->type = 2;
11653 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
11654 }
11655 else
11656 {
11657 if(!exp->op.exp1)
11658 {
11659 switch(exp->op.op)
11660 {
11661 case '+':
11662 {
11663 struct Expression * exp2 = exp->op.exp2;
11664
11665 exp->op.exp2 = (((void *)0));
11666 FreeExpContents(exp);
11667 FreeType(exp->expType);
11668 FreeType(exp->destType);
11669 *exp = *exp2;
11670 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
11671 break;
11672 }
11673 case '-':
11674 if(op1->ops.Neg)
11675 {
11676 FreeExpContents(exp);
11677 op1->ops.Neg(exp, op1);
11678 }
11679 break;
11680 case '~':
11681 if(op1->ops.BitNot)
11682 {
11683 FreeExpContents(exp);
11684 op1->ops.BitNot(exp, op1);
11685 }
11686 break;
11687 case '!':
11688 if(op1->ops.Not)
11689 {
11690 FreeExpContents(exp);
11691 op1->ops.Not(exp, op1);
11692 }
11693 break;
11694 }
11695 }
11696 else
11697 {
11698 if(op1 && op2 && op1->type && op2->type && op1->kind != op2->kind)
11699 {
11700 if(Promote(op2, op1->kind, op1->type->isSigned))
11701 op2->kind = op1->kind, op2->ops = op1->ops;
11702 else if(Promote(op1, op2->kind, op2->type->isSigned))
11703 op1->kind = op2->kind, op1->ops = op2->ops;
11704 }
11705 switch(exp->op.op)
11706 {
11707 case '+':
11708 if(op1->ops.Add)
11709 {
11710 FreeExpContents(exp);
11711 op1->ops.Add(exp, op1, op2);
11712 }
11713 break;
11714 case '-':
11715 if(op1->ops.Sub)
11716 {
11717 FreeExpContents(exp);
11718 op1->ops.Sub(exp, op1, op2);
11719 }
11720 break;
11721 case '*':
11722 if(op1->ops.Mul)
11723 {
11724 FreeExpContents(exp);
11725 op1->ops.Mul(exp, op1, op2);
11726 }
11727 break;
11728 case '/':
11729 if(op1->ops.Div)
11730 {
11731 FreeExpContents(exp);
11732 op1->ops.Div(exp, op1, op2);
11733 }
11734 break;
11735 case '%':
11736 if(op1->ops.Mod)
11737 {
11738 FreeExpContents(exp);
11739 op1->ops.Mod(exp, op1, op2);
11740 }
11741 break;
11742 case '&':
11743 if(exp->op.exp2)
11744 {
11745 if(op1->ops.BitAnd)
11746 {
11747 FreeExpContents(exp);
11748 op1->ops.BitAnd(exp, op1, op2);
11749 }
11750 }
11751 break;
11752 case '|':
11753 if(op1->ops.BitOr)
11754 {
11755 FreeExpContents(exp);
11756 op1->ops.BitOr(exp, op1, op2);
11757 }
11758 break;
11759 case '^':
11760 if(op1->ops.BitXor)
11761 {
11762 FreeExpContents(exp);
11763 op1->ops.BitXor(exp, op1, op2);
11764 }
11765 break;
11766 case LEFT_OP:
11767 if(op1->ops.LShift)
11768 {
11769 FreeExpContents(exp);
11770 op1->ops.LShift(exp, op1, op2);
11771 }
11772 break;
11773 case RIGHT_OP:
11774 if(op1->ops.RShift)
11775 {
11776 FreeExpContents(exp);
11777 op1->ops.RShift(exp, op1, op2);
11778 }
11779 break;
11780 case EQ_OP:
11781 if(op1->ops.Equ)
11782 {
11783 FreeExpContents(exp);
11784 op1->ops.Equ(exp, op1, op2);
11785 }
11786 break;
11787 case NE_OP:
11788 if(op1->ops.Nqu)
11789 {
11790 FreeExpContents(exp);
11791 op1->ops.Nqu(exp, op1, op2);
11792 }
11793 break;
11794 case AND_OP:
11795 if(op1->ops.And)
11796 {
11797 FreeExpContents(exp);
11798 op1->ops.And(exp, op1, op2);
11799 }
11800 break;
11801 case OR_OP:
11802 if(op1->ops.Or)
11803 {
11804 FreeExpContents(exp);
11805 op1->ops.Or(exp, op1, op2);
11806 }
11807 break;
11808 case '>':
11809 if(op1->ops.Grt)
11810 {
11811 FreeExpContents(exp);
11812 op1->ops.Grt(exp, op1, op2);
11813 }
11814 break;
11815 case '<':
11816 if(op1->ops.Sma)
11817 {
11818 FreeExpContents(exp);
11819 op1->ops.Sma(exp, op1, op2);
11820 }
11821 break;
11822 case GE_OP:
11823 if(op1->ops.GrtEqu)
11824 {
11825 FreeExpContents(exp);
11826 op1->ops.GrtEqu(exp, op1, op2);
11827 }
11828 break;
11829 case LE_OP:
11830 if(op1->ops.SmaEqu)
11831 {
11832 FreeExpContents(exp);
11833 op1->ops.SmaEqu(exp, op1, op2);
11834 }
11835 break;
11836 }
11837 }
11838 }
11839 }
11840
11841 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
11842
11843 extern struct Expression * MkExpIdentifier(struct Identifier * id);
11844
11845 void ComputeExpression(struct Expression * exp)
11846 {
11847 char expString[10240];
11848
11849 expString[0] = '\0';
11850 switch(exp->type)
11851 {
11852 case 1:
11853 {
11854 ComputeInstantiation(exp);
11855 break;
11856 }
11857 case 4:
11858 {
11859 struct Expression * exp1, * exp2 = (((void *)0));
11860 struct Operand op1 =
11861 {
11862 0, 0, 0, .c = 0,
11863 {
11864 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11865 }
11866 };
11867 struct Operand op2 =
11868 {
11869 0, 0, 0, .c = 0,
11870 {
11871 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11872 }
11873 };
11874
11875 if(exp->op.exp2)
11876 {
11877 struct Expression * e = exp->op.exp2;
11878
11879 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
11880 {
11881 if(e->type == 5 || e->type == 32 || e->type == 23)
11882 {
11883 if(e->type == 23)
11884 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
11885 else
11886 e = (*e->list).last;
11887 }
11888 }
11889 if(exp->op.op == 261 && e && e->expType)
11890 {
11891 if(e->type == 3 && e->string)
11892 {
11893 char * string = e->string;
11894 int len = strlen(string);
11895 char * tmp = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (len - 2 + 1));
11896
11897 len = UnescapeString(tmp, string + 1, len - 2);
11898 (__ecereNameSpace__ecere__com__eSystem_Delete(tmp), tmp = 0);
11899 FreeExpContents(exp);
11900 exp->type = 2;
11901 exp->constant = PrintUInt(len + 1);
11902 }
11903 else
11904 {
11905 struct Type * type = e->expType;
11906
11907 type->refCount++;
11908 FreeExpContents(exp);
11909 exp->type = 2;
11910 exp->constant = PrintUInt(ComputeTypeSize(type));
11911 FreeType(type);
11912 }
11913 break;
11914 }
11915 else
11916 ComputeExpression(exp->op.exp2);
11917 }
11918 if(exp->op.exp1)
11919 {
11920 ComputeExpression(exp->op.exp1);
11921 exp1 = exp->op.exp1;
11922 exp2 = exp->op.exp2;
11923 op1 = GetOperand(exp1);
11924 if(op1.type)
11925 op1.type->refCount++;
11926 if(exp2)
11927 {
11928 op2 = GetOperand(exp2);
11929 if(op2.type)
11930 op2.type->refCount++;
11931 }
11932 }
11933 else
11934 {
11935 exp1 = exp->op.exp2;
11936 op1 = GetOperand(exp1);
11937 if(op1.type)
11938 op1.type->refCount++;
11939 }
11940 CallOperator(exp, exp1, exp2, &op1, &op2);
11941 if(op1.type)
11942 FreeType(op1.type);
11943 if(op2.type)
11944 FreeType(op2.type);
11945 break;
11946 }
11947 case 5:
11948 case 32:
11949 {
11950 struct Expression * e, * n;
11951
11952 for(e = (*exp->list).first; e; e = n)
11953 {
11954 n = e->next;
11955 if(!n)
11956 {
11957 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
11958 struct Expression * prev = exp->prev;
11959 struct Expression * next = exp->next;
11960
11961 ComputeExpression(e);
11962 FreeType(exp->expType);
11963 FreeType(exp->destType);
11964 *exp = *e;
11965 exp->prev = prev;
11966 exp->next = next;
11967 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
11968 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
11969 }
11970 else
11971 {
11972 FreeExpression(e);
11973 }
11974 }
11975 break;
11976 }
11977 case 8:
11978 {
11979 struct Expression * memberExp = exp->member.exp;
11980 struct Identifier * memberID = exp->member.member;
11981 struct Type * type;
11982
11983 ComputeExpression(exp->member.exp);
11984 type = exp->member.exp->expType;
11985 if(type)
11986 {
11987 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)));
11988 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11989 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11990 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
11991
11992 if(type->kind == 19 && exp->member.exp->type == 24)
11993 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
11994 if(!_class)
11995 {
11996 char string[256];
11997 struct Symbol * classSym;
11998
11999 string[0] = '\0';
12000 PrintTypeNoConst(type, string, 0x0, 0x1);
12001 classSym = FindClass(string);
12002 _class = classSym ? classSym->registered : (((void *)0));
12003 }
12004 if(exp->member.member)
12005 {
12006 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
12007 if(!prop)
12008 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
12009 }
12010 if(!prop && !member && _class && exp->member.member)
12011 {
12012 struct Symbol * classSym = FindClass(exp->member.member->string);
12013
12014 convertTo = _class;
12015 _class = classSym ? classSym->registered : (((void *)0));
12016 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
12017 }
12018 if(prop)
12019 {
12020 if(prop->compiled)
12021 {
12022 struct Type * type = prop->dataType;
12023
12024 if(_class->type == 3)
12025 {
12026 if(type->kind == 8)
12027 {
12028 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12029
12030 if(_class->type == 3)
12031 {
12032 if(!_class->dataType)
12033 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12034 type = _class->dataType;
12035 }
12036 }
12037 switch(type->kind)
12038 {
12039 case 6:
12040 {
12041 float value;
12042 float (* Get)(float) = (void *)prop->Get;
12043
12044 GetFloat(exp->member.exp, &value);
12045 exp->constant = PrintFloat(Get ? Get(value) : value);
12046 exp->type = 2;
12047 break;
12048 }
12049 case 7:
12050 {
12051 double value;
12052 double (* Get)(double);
12053
12054 GetDouble(exp->member.exp, &value);
12055 if(convertTo)
12056 Get = (void *)prop->Set;
12057 else
12058 Get = (void *)prop->Get;
12059 exp->constant = PrintDouble(Get ? Get(value) : value);
12060 exp->type = 2;
12061 break;
12062 }
12063 }
12064 }
12065 else
12066 {
12067 if(convertTo)
12068 {
12069 struct Expression * value = exp->member.exp;
12070 struct Type * type;
12071
12072 if(!prop->dataType)
12073 ProcessPropertyType(prop);
12074 type = prop->dataType;
12075 if(!type)
12076 {
12077 }
12078 else if(_class->type == 1)
12079 {
12080 switch(type->kind)
12081 {
12082 case 8:
12083 {
12084 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12085
12086 if(propertyClass->type == 1 && value->type == 1)
12087 {
12088 void (* Set)(void *, void *) = (void *)prop->Set;
12089
12090 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12091 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12092 exp->instance->_class = MkSpecifierName(_class->fullName);
12093 exp->instance->loc = exp->loc;
12094 exp->type = 1;
12095 Set(exp->instance->data, value->instance->data);
12096 PopulateInstance(exp->instance);
12097 }
12098 break;
12099 }
12100 case 3:
12101 {
12102 int intValue;
12103 void (* Set)(void *, int) = (void *)prop->Set;
12104
12105 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12106 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12107 exp->instance->_class = MkSpecifierName(_class->fullName);
12108 exp->instance->loc = exp->loc;
12109 exp->type = 1;
12110 GetInt(value, &intValue);
12111 Set(exp->instance->data, intValue);
12112 PopulateInstance(exp->instance);
12113 break;
12114 }
12115 case 4:
12116 {
12117 long long intValue;
12118 void (* Set)(void *, long long) = (void *)prop->Set;
12119
12120 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12121 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12122 exp->instance->_class = MkSpecifierName(_class->fullName);
12123 exp->instance->loc = exp->loc;
12124 exp->type = 1;
12125 GetInt64(value, &intValue);
12126 Set(exp->instance->data, intValue);
12127 PopulateInstance(exp->instance);
12128 break;
12129 }
12130 case 22:
12131 {
12132 intptr_t intValue;
12133 void (* Set)(void *, intptr_t) = (void *)prop->Set;
12134
12135 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12136 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12137 exp->instance->_class = MkSpecifierName(_class->fullName);
12138 exp->instance->loc = exp->loc;
12139 exp->type = 1;
12140 GetIntPtr(value, &intValue);
12141 Set(exp->instance->data, intValue);
12142 PopulateInstance(exp->instance);
12143 break;
12144 }
12145 case 23:
12146 {
12147 ssize_t intValue;
12148 void (* Set)(void *, ssize_t) = (void *)prop->Set;
12149
12150 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12151 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12152 exp->instance->_class = MkSpecifierName(_class->fullName);
12153 exp->instance->loc = exp->loc;
12154 exp->type = 1;
12155 GetIntSize(value, &intValue);
12156 Set(exp->instance->data, intValue);
12157 PopulateInstance(exp->instance);
12158 break;
12159 }
12160 case 6:
12161 {
12162 float floatValue;
12163 void (* Set)(void *, float) = (void *)prop->Set;
12164
12165 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12166 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12167 exp->instance->_class = MkSpecifierName(_class->fullName);
12168 exp->instance->loc = exp->loc;
12169 exp->type = 1;
12170 GetFloat(value, &floatValue);
12171 Set(exp->instance->data, floatValue);
12172 PopulateInstance(exp->instance);
12173 break;
12174 }
12175 case 7:
12176 {
12177 double doubleValue;
12178 void (* Set)(void *, double) = (void *)prop->Set;
12179
12180 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12181 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12182 exp->instance->_class = MkSpecifierName(_class->fullName);
12183 exp->instance->loc = exp->loc;
12184 exp->type = 1;
12185 GetDouble(value, &doubleValue);
12186 Set(exp->instance->data, doubleValue);
12187 PopulateInstance(exp->instance);
12188 break;
12189 }
12190 }
12191 }
12192 else if(_class->type == 2)
12193 {
12194 switch(type->kind)
12195 {
12196 case 8:
12197 {
12198 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12199
12200 if(propertyClass->type == 1 && value->instance->data)
12201 {
12202 unsigned int (* Set)(void *) = (void *)prop->Set;
12203 unsigned int bits = Set(value->instance->data);
12204
12205 exp->constant = PrintHexUInt(bits);
12206 exp->type = 2;
12207 break;
12208 }
12209 else if(_class->type == 2)
12210 {
12211 unsigned int value;
12212 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
12213 unsigned int bits;
12214
12215 GetUInt(exp->member.exp, &value);
12216 bits = Set(value);
12217 exp->constant = PrintHexUInt(bits);
12218 exp->type = 2;
12219 }
12220 }
12221 }
12222 }
12223 }
12224 else
12225 {
12226 if(_class->type == 2)
12227 {
12228 unsigned int value;
12229
12230 GetUInt(exp->member.exp, &value);
12231 switch(type->kind)
12232 {
12233 case 8:
12234 {
12235 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12236
12237 if(_class->type == 1)
12238 {
12239 void (* Get)(unsigned int, void *) = (void *)prop->Get;
12240
12241 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12242 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12243 exp->instance->_class = MkSpecifierName(_class->fullName);
12244 exp->instance->loc = exp->loc;
12245 exp->type = 1;
12246 Get(value, exp->instance->data);
12247 PopulateInstance(exp->instance);
12248 }
12249 else if(_class->type == 2)
12250 {
12251 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
12252 uint64 bits = Get(value);
12253
12254 exp->constant = PrintHexUInt64(bits);
12255 exp->type = 2;
12256 }
12257 break;
12258 }
12259 }
12260 }
12261 else if(_class->type == 1)
12262 {
12263 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
12264
12265 switch(type->kind)
12266 {
12267 case 8:
12268 {
12269 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12270
12271 if(_class->type == 1 && value)
12272 {
12273 void (* Get)(void *, void *) = (void *)prop->Get;
12274
12275 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12276 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12277 exp->instance->_class = MkSpecifierName(_class->fullName);
12278 exp->instance->loc = exp->loc;
12279 exp->type = 1;
12280 Get(value, exp->instance->data);
12281 PopulateInstance(exp->instance);
12282 }
12283 break;
12284 }
12285 }
12286 }
12287 }
12288 }
12289 }
12290 else
12291 {
12292 exp->isConstant = 0x0;
12293 }
12294 }
12295 else if(member)
12296 {
12297 }
12298 }
12299 if(exp->type != 8)
12300 {
12301 FreeExpression(memberExp);
12302 FreeIdentifier(memberID);
12303 }
12304 break;
12305 }
12306 case 10:
12307 {
12308 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
12309
12310 FreeExpContents(exp);
12311 exp->constant = PrintUInt(ComputeTypeSize(type));
12312 exp->type = 2;
12313 FreeType(type);
12314 break;
12315 }
12316 case 15:
12317 {
12318 struct Symbol * classSym = exp->_class->symbol;
12319
12320 if(classSym && classSym->registered)
12321 {
12322 if(classSym->registered->fixed)
12323 {
12324 FreeSpecifier(exp->_class);
12325 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
12326 exp->type = 2;
12327 }
12328 else
12329 {
12330 char className[1024];
12331
12332 strcpy(className, "__ecereClass_");
12333 FullClassNameCat(className, classSym->string, 0x1);
12334 MangleClassName(className);
12335 DeclareClass(classSym, className);
12336 FreeExpContents(exp);
12337 exp->type = 9;
12338 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
12339 exp->member.member = MkIdentifier("structSize");
12340 }
12341 }
12342 break;
12343 }
12344 case 11:
12345 {
12346 struct Type * type;
12347 struct Expression * e = exp;
12348
12349 if(exp->type == 11)
12350 {
12351 if(exp->cast.exp)
12352 ComputeExpression(exp->cast.exp);
12353 e = exp->cast.exp;
12354 }
12355 if(e && exp->expType)
12356 {
12357 type = exp->expType;
12358 if(type->kind == 8)
12359 {
12360 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12361
12362 if(_class && (_class->type == 3 || _class->type == 2))
12363 {
12364 if(!_class->dataType)
12365 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12366 type = _class->dataType;
12367 }
12368 }
12369 switch(type->kind)
12370 {
12371 case 24:
12372 case 1:
12373 if(type->isSigned)
12374 {
12375 char value = (char)0;
12376
12377 if(GetChar(e, &value))
12378 {
12379 FreeExpContents(exp);
12380 exp->constant = PrintChar(value);
12381 exp->type = 2;
12382 }
12383 }
12384 else
12385 {
12386 unsigned char value = (unsigned char)0;
12387
12388 if(GetUChar(e, &value))
12389 {
12390 FreeExpContents(exp);
12391 exp->constant = PrintUChar(value);
12392 exp->type = 2;
12393 }
12394 }
12395 break;
12396 case 2:
12397 if(type->isSigned)
12398 {
12399 short value = (short)0;
12400
12401 if(GetShort(e, &value))
12402 {
12403 FreeExpContents(exp);
12404 exp->constant = PrintShort(value);
12405 exp->type = 2;
12406 }
12407 }
12408 else
12409 {
12410 unsigned short value = (unsigned short)0;
12411
12412 if(GetUShort(e, &value))
12413 {
12414 FreeExpContents(exp);
12415 exp->constant = PrintUShort(value);
12416 exp->type = 2;
12417 }
12418 }
12419 break;
12420 case 3:
12421 if(type->isSigned)
12422 {
12423 int value = 0;
12424
12425 if(GetInt(e, &value))
12426 {
12427 FreeExpContents(exp);
12428 exp->constant = PrintInt(value);
12429 exp->type = 2;
12430 }
12431 }
12432 else
12433 {
12434 unsigned int value = 0;
12435
12436 if(GetUInt(e, &value))
12437 {
12438 FreeExpContents(exp);
12439 exp->constant = PrintUInt(value);
12440 exp->type = 2;
12441 }
12442 }
12443 break;
12444 case 4:
12445 if(type->isSigned)
12446 {
12447 long long value = 0;
12448
12449 if(GetInt64(e, &value))
12450 {
12451 FreeExpContents(exp);
12452 exp->constant = PrintInt64(value);
12453 exp->type = 2;
12454 }
12455 }
12456 else
12457 {
12458 uint64 value = 0;
12459
12460 if(GetUInt64(e, &value))
12461 {
12462 FreeExpContents(exp);
12463 exp->constant = PrintUInt64(value);
12464 exp->type = 2;
12465 }
12466 }
12467 break;
12468 case 22:
12469 if(type->isSigned)
12470 {
12471 intptr_t value = 0;
12472
12473 if(GetIntPtr(e, &value))
12474 {
12475 FreeExpContents(exp);
12476 exp->constant = PrintInt64((long long)value);
12477 exp->type = 2;
12478 }
12479 }
12480 else
12481 {
12482 uintptr_t value = 0;
12483
12484 if(GetUIntPtr(e, &value))
12485 {
12486 FreeExpContents(exp);
12487 exp->constant = PrintUInt64((uint64)value);
12488 exp->type = 2;
12489 }
12490 }
12491 break;
12492 case 23:
12493 if(type->isSigned)
12494 {
12495 ssize_t value = 0;
12496
12497 if(GetIntSize(e, &value))
12498 {
12499 FreeExpContents(exp);
12500 exp->constant = PrintInt64((long long)value);
12501 exp->type = 2;
12502 }
12503 }
12504 else
12505 {
12506 size_t value = 0;
12507
12508 if(GetUIntSize(e, &value))
12509 {
12510 FreeExpContents(exp);
12511 exp->constant = PrintUInt64((uint64)value);
12512 exp->type = 2;
12513 }
12514 }
12515 break;
12516 case 6:
12517 {
12518 float value = 0;
12519
12520 if(GetFloat(e, &value))
12521 {
12522 FreeExpContents(exp);
12523 exp->constant = PrintFloat(value);
12524 exp->type = 2;
12525 }
12526 break;
12527 }
12528 case 7:
12529 {
12530 double value = 0;
12531
12532 if(GetDouble(e, &value))
12533 {
12534 FreeExpContents(exp);
12535 exp->constant = PrintDouble(value);
12536 exp->type = 2;
12537 }
12538 break;
12539 }
12540 }
12541 }
12542 break;
12543 }
12544 case 12:
12545 {
12546 struct Operand op1 =
12547 {
12548 0, 0, 0, .c = 0,
12549 {
12550 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12551 }
12552 };
12553 struct Operand op2 =
12554 {
12555 0, 0, 0, .c = 0,
12556 {
12557 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12558 }
12559 };
12560 struct Operand op3 =
12561 {
12562 0, 0, 0, .c = 0,
12563 {
12564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12565 }
12566 };
12567
12568 if(exp->cond.exp)
12569 ComputeExpression((*exp->cond.exp).last);
12570 if(exp->cond.elseExp)
12571 ComputeExpression(exp->cond.elseExp);
12572 if(exp->cond.cond)
12573 ComputeExpression(exp->cond.cond);
12574 op1 = GetOperand(exp->cond.cond);
12575 if(op1.type)
12576 op1.type->refCount++;
12577 op2 = GetOperand((*exp->cond.exp).last);
12578 if(op2.type)
12579 op2.type->refCount++;
12580 op3 = GetOperand(exp->cond.elseExp);
12581 if(op3.type)
12582 op3.type->refCount++;
12583 if(op1.ops.Cond)
12584 {
12585 FreeExpContents(exp);
12586 op1.ops.Cond(exp, &op1, &op2, &op3);
12587 }
12588 if(op1.type)
12589 FreeType(op1.type);
12590 if(op2.type)
12591 FreeType(op2.type);
12592 if(op3.type)
12593 FreeType(op3.type);
12594 break;
12595 }
12596 }
12597 }
12598
12599 void ApplyAnyObjectLogic(struct Expression * e);
12600
12601 extern void CopyTypeInto(struct Type * type, struct Type * src);
12602
12603 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
12604 {
12605 unsigned int result = 0x1;
12606
12607 if(destType)
12608 {
12609 struct __ecereNameSpace__ecere__sys__OldList converts =
12610 {
12611 0, 0, 0, 0, 0
12612 };
12613 struct Conversion * convert;
12614
12615 if(destType->kind == 0)
12616 return 0x0;
12617 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
12618 result = 0x0;
12619 if(converts.count)
12620 {
12621 for(convert = converts.first; convert; convert = convert->next)
12622 {
12623 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
12624
12625 if(!empty)
12626 {
12627 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12628 int objectType = exp->expType ? exp->expType->classObjectType : 0;
12629
12630 *newExp = *exp;
12631 newExp->prev = (((void *)0));
12632 newExp->next = (((void *)0));
12633 newExp->destType = (((void *)0));
12634 if(convert->isGet)
12635 {
12636 exp->type = 8;
12637 exp->addedThis = 0x1;
12638 exp->member.exp = newExp;
12639 FreeType(exp->member.exp->expType);
12640 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
12641 exp->member.exp->expType->classObjectType = objectType;
12642 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
12643 exp->member.memberType = 1;
12644 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12645 exp->needCast = 0x1;
12646 if(exp->expType)
12647 exp->expType->refCount++;
12648 ApplyAnyObjectLogic(exp->member.exp);
12649 }
12650 else
12651 {
12652 {
12653 exp->type = 8;
12654 exp->addedThis = 0x1;
12655 exp->member.exp = newExp;
12656 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
12657 {
12658 newExp->byReference = 0x1;
12659 }
12660 FreeType(exp->member.exp->expType);
12661 exp->member.exp->expType = (((void *)0));
12662 if(convert->convert->dataType)
12663 {
12664 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12665 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
12666 exp->member.exp->expType->refCount = 1;
12667 exp->member.exp->expType->classObjectType = objectType;
12668 ApplyAnyObjectLogic(exp->member.exp);
12669 }
12670 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
12671 exp->member.memberType = 4;
12672 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12673 exp->needCast = 0x1;
12674 if(convert->resultType)
12675 convert->resultType->refCount++;
12676 }
12677 }
12678 }
12679 else
12680 {
12681 FreeType(exp->expType);
12682 if(convert->isGet)
12683 {
12684 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12685 exp->needCast = 0x1;
12686 if(exp->expType)
12687 exp->expType->refCount++;
12688 }
12689 else
12690 {
12691 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12692 exp->needCast = 0x1;
12693 if(convert->resultType)
12694 convert->resultType->refCount++;
12695 }
12696 }
12697 }
12698 if(exp->isConstant && inCompiler)
12699 ComputeExpression(exp);
12700 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
12701 }
12702 if(!result && exp->expType && converts.count)
12703 {
12704 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
12705 }
12706 if(!result && exp->expType && exp->destType)
12707 {
12708 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))
12709 result = 0x1;
12710 }
12711 }
12712 return result;
12713 }
12714
12715 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
12716
12717 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
12718
12719 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
12720
12721 void CheckTemplateTypes(struct Expression * exp)
12722 {
12723 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
12724 {
12725 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12726 struct Context * context;
12727
12728 *newExp = *exp;
12729 if(exp->destType)
12730 exp->destType->refCount++;
12731 if(exp->expType)
12732 exp->expType->refCount++;
12733 newExp->prev = (((void *)0));
12734 newExp->next = (((void *)0));
12735 switch(exp->expType->kind)
12736 {
12737 case 7:
12738 if(exp->destType->classObjectType)
12739 {
12740 if(exp->destType)
12741 exp->destType->refCount--;
12742 if(exp->expType)
12743 exp->expType->refCount--;
12744 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12745 }
12746 else
12747 {
12748 struct __ecereNameSpace__ecere__sys__OldList * specs;
12749 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12750 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12751
12752 context = PushContext();
12753 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12754 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12755 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12756 exp->type = 23;
12757 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12758 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
12759 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
12760 exp->compound->compound.context = context;
12761 PopContext(context);
12762 }
12763 break;
12764 default:
12765 exp->type = 11;
12766 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
12767 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12768 break;
12769 }
12770 }
12771 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
12772 {
12773 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12774 struct Statement * compound;
12775 struct Context * context;
12776
12777 *newExp = *exp;
12778 if(exp->destType)
12779 exp->destType->refCount++;
12780 if(exp->expType)
12781 exp->expType->refCount++;
12782 newExp->prev = (((void *)0));
12783 newExp->next = (((void *)0));
12784 switch(exp->expType->kind)
12785 {
12786 case 7:
12787 if(exp->destType->classObjectType)
12788 {
12789 if(exp->destType)
12790 exp->destType->refCount--;
12791 if(exp->expType)
12792 exp->expType->refCount--;
12793 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12794 }
12795 else
12796 {
12797 struct __ecereNameSpace__ecere__sys__OldList * specs;
12798 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12799 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12800
12801 context = PushContext();
12802 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12803 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12804 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12805 exp->type = 23;
12806 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12807 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
12808 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
12809 exp->compound->compound.context = context;
12810 PopContext(context);
12811 }
12812 break;
12813 case 8:
12814 {
12815 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
12816 {
12817 exp->type = 5;
12818 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
12819 ProcessExpressionType((*exp->list).first);
12820 break;
12821 }
12822 else
12823 {
12824 exp->type = 5;
12825 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
12826 newExp->needCast = 0x1;
12827 ProcessExpressionType((*exp->list).first);
12828 break;
12829 }
12830 }
12831 default:
12832 {
12833 if(exp->expType->kind == 20)
12834 {
12835 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
12836
12837 if(type)
12838 {
12839 FreeType(exp->destType);
12840 FreeType(exp->expType);
12841 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12842 break;
12843 }
12844 }
12845 if(newExp->type == 8 && newExp->member.memberType == 3)
12846 {
12847 exp->type = 4;
12848 exp->op.op = '*';
12849 exp->op.exp1 = (((void *)0));
12850 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
12851 }
12852 else
12853 {
12854 char typeString[1024];
12855 struct Declarator * decl;
12856 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12857
12858 typeString[0] = '\0';
12859 PrintType(exp->expType, typeString, 0x0, 0x0);
12860 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12861 exp->type = 11;
12862 exp->cast.typeName = MkTypeName(specs, decl);
12863 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12864 exp->cast.exp->needCast = 0x1;
12865 }
12866 break;
12867 }
12868 }
12869 }
12870 }
12871
12872 extern int strncmp(const char * , const char * , size_t n);
12873
12874 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
12875
12876 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
12877 {
12878 int nsLen = strlen(nameSpace);
12879 struct Symbol * symbol;
12880
12881 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)))
12882 {
12883 char * s = symbol->string;
12884
12885 if(!strncmp(s, nameSpace, nsLen))
12886 {
12887 int c;
12888 char * namePart;
12889
12890 for(c = strlen(s) - 1; c >= 0; c--)
12891 if(s[c] == ':')
12892 break;
12893 namePart = s + c + 1;
12894 if(!strcmp(namePart, name))
12895 {
12896 return symbol;
12897 }
12898 }
12899 else
12900 break;
12901 }
12902 return (((void *)0));
12903 }
12904
12905 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
12906 {
12907 int c;
12908 char nameSpace[1024];
12909 char * namePart;
12910 unsigned int gotColon = 0x0;
12911
12912 nameSpace[0] = '\0';
12913 for(c = strlen(name) - 1; c >= 0; c--)
12914 if(name[c] == ':')
12915 {
12916 gotColon = 0x1;
12917 break;
12918 }
12919 namePart = name + c + 1;
12920 while(c >= 0 && name[c] == ':')
12921 c--;
12922 if(c >= 0)
12923 {
12924 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
12925
12926 if(symbol)
12927 return symbol;
12928 memcpy(nameSpace, name, c + 1);
12929 nameSpace[c + 1] = (char)0;
12930 return ScanWithNameSpace(tree, nameSpace, namePart);
12931 }
12932 else if(gotColon)
12933 {
12934 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12935
12936 return symbol;
12937 }
12938 else
12939 {
12940 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12941
12942 if(symbol)
12943 return symbol;
12944 return ScanWithNameSpace(tree, "", namePart);
12945 }
12946 return (((void *)0));
12947 }
12948
12949 static void ProcessDeclaration(struct Declaration * decl);
12950
12951 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
12952 {
12953 struct Context * ctx;
12954 struct Symbol * symbol = (((void *)0));
12955
12956 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
12957 {
12958 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
12959 {
12960 symbol = (((void *)0));
12961 if(thisNameSpace)
12962 {
12963 char curName[1024];
12964
12965 strcpy(curName, thisNameSpace);
12966 strcat(curName, "::");
12967 strcat(curName, name);
12968 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
12969 }
12970 if(!symbol)
12971 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
12972 }
12973 else
12974 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
12975 if(symbol || ctx == endContext)
12976 break;
12977 }
12978 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
12979 {
12980 if(symbol->pointerExternal->type == 0)
12981 {
12982 struct FunctionDefinition * function = symbol->pointerExternal->function;
12983 struct Context * tmpContext = curContext;
12984
12985 curContext = (((void *)0));
12986 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
12987 curContext = tmpContext;
12988 symbol->pointerExternal->symbol = symbol;
12989 DeclareType(symbol->type, 0x1, 0x1);
12990 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
12991 symbol->id = curExternal->symbol->idCode;
12992 }
12993 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
12994 {
12995 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
12996 symbol->id = curExternal->symbol->idCode;
12997 }
12998 }
12999 return symbol;
13000 }
13001
13002 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
13003 {
13004 if(!type->isSigned && type->kind != 22 && type->kind != 23)
13005 ListAdd(specs, MkSpecifier(UNSIGNED));
13006 switch(type->kind)
13007 {
13008 case 8:
13009 {
13010 if(type->_class->registered)
13011 {
13012 if(!type->_class->registered->dataType)
13013 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
13014 GetTypeSpecs(type->_class->registered->dataType, specs);
13015 }
13016 break;
13017 }
13018 case 7:
13019 ListAdd(specs, MkSpecifier(DOUBLE));
13020 break;
13021 case 6:
13022 ListAdd(specs, MkSpecifier(FLOAT));
13023 break;
13024 case 1:
13025 ListAdd(specs, MkSpecifier(CHAR));
13026 break;
13027 case 24:
13028 ListAdd(specs, MkSpecifier(_BOOL));
13029 break;
13030 case 2:
13031 ListAdd(specs, MkSpecifier(SHORT));
13032 break;
13033 case 4:
13034 ListAdd(specs, MkSpecifier(INT64));
13035 break;
13036 case 22:
13037 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
13038 break;
13039 case 23:
13040 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
13041 break;
13042 case 3:
13043 default:
13044 ListAdd(specs, MkSpecifier(INT));
13045 break;
13046 }
13047 }
13048
13049 static void PrintArraySize(struct Type * arrayType, char * string)
13050 {
13051 char size[256];
13052
13053 size[0] = '\0';
13054 strcat(size, "[");
13055 if(arrayType->enumClass)
13056 strcat(size, arrayType->enumClass->string);
13057 else if(arrayType->arraySizeExp)
13058 PrintExpression(arrayType->arraySizeExp, size);
13059 strcat(size, "]");
13060 strcat(string, size);
13061 }
13062
13063 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
13064 {
13065 if(type)
13066 {
13067 if(printConst && type->constant)
13068 strcat(string, "const ");
13069 switch(type->kind)
13070 {
13071 case 8:
13072 {
13073 struct Symbol * c = type->_class;
13074
13075 if(type->classObjectType == 2)
13076 strcat(string, "typed_object");
13077 else if(type->classObjectType == 3)
13078 strcat(string, "any_object");
13079 else
13080 {
13081 if(c && c->string)
13082 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
13083 }
13084 if(type->byReference)
13085 strcat(string, " &");
13086 break;
13087 }
13088 case 0:
13089 strcat(string, "void");
13090 break;
13091 case 3:
13092 strcat(string, type->isSigned ? "int" : "uint");
13093 break;
13094 case 4:
13095 strcat(string, type->isSigned ? "int64" : "uint64");
13096 break;
13097 case 22:
13098 strcat(string, type->isSigned ? "intptr" : "uintptr");
13099 break;
13100 case 23:
13101 strcat(string, type->isSigned ? "intsize" : "uintsize");
13102 break;
13103 case 1:
13104 strcat(string, type->isSigned ? "char" : "byte");
13105 break;
13106 case 24:
13107 strcat(string, "_Bool");
13108 break;
13109 case 2:
13110 strcat(string, type->isSigned ? "short" : "uint16");
13111 break;
13112 case 6:
13113 strcat(string, "float");
13114 break;
13115 case 7:
13116 strcat(string, "double");
13117 break;
13118 case 9:
13119 if(type->enumName)
13120 {
13121 strcat(string, "struct ");
13122 strcat(string, type->enumName);
13123 }
13124 else if(type->typeName)
13125 strcat(string, type->typeName);
13126 else
13127 {
13128 struct Type * member;
13129
13130 strcat(string, "struct { ");
13131 for(member = type->members.first; member; member = member->next)
13132 {
13133 PrintType(member, string, 0x1, fullName);
13134 strcat(string, "; ");
13135 }
13136 strcat(string, "}");
13137 }
13138 break;
13139 case 10:
13140 if(type->enumName)
13141 {
13142 strcat(string, "union ");
13143 strcat(string, type->enumName);
13144 }
13145 else if(type->typeName)
13146 strcat(string, type->typeName);
13147 else
13148 {
13149 strcat(string, "union ");
13150 strcat(string, "(unnamed)");
13151 }
13152 break;
13153 case 15:
13154 if(type->enumName)
13155 {
13156 strcat(string, "enum ");
13157 strcat(string, type->enumName);
13158 }
13159 else if(type->typeName)
13160 strcat(string, type->typeName);
13161 else
13162 strcat(string, "int");
13163 break;
13164 case 14:
13165 strcat(string, "...");
13166 break;
13167 case 19:
13168 strcat(string, "subclass(");
13169 strcat(string, type->_class ? type->_class->string : "int");
13170 strcat(string, ")");
13171 break;
13172 case 20:
13173 strcat(string, type->templateParameter->identifier->string);
13174 break;
13175 case 21:
13176 strcat(string, "thisclass");
13177 break;
13178 case 17:
13179 strcat(string, "__builtin_va_list");
13180 break;
13181 }
13182 }
13183 }
13184
13185 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
13186
13187 static void PrintName(struct Type * type, char * string, unsigned int fullName)
13188 {
13189 if(type->name && type->name[0])
13190 {
13191 if(fullName)
13192 strcat(string, type->name);
13193 else
13194 {
13195 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
13196
13197 if(name)
13198 name += 2;
13199 else
13200 name = type->name;
13201 strcat(string, name);
13202 }
13203 }
13204 }
13205
13206 static void PrintAttribs(struct Type * type, char * string)
13207 {
13208 if(type)
13209 {
13210 if(type->dllExport)
13211 strcat(string, "dllexport ");
13212 if(type->attrStdcall)
13213 strcat(string, "stdcall ");
13214 }
13215 }
13216
13217 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
13218 {
13219 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13220 {
13221 struct Type * attrType = (((void *)0));
13222
13223 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
13224 PrintAttribs(type, string);
13225 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
13226 strcat(string, " const");
13227 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
13228 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13229 strcat(string, " (");
13230 if(type->kind == 13)
13231 {
13232 if(type->type->kind == 11 || type->type->kind == 16)
13233 PrintAttribs(type->type, string);
13234 }
13235 if(type->kind == 13)
13236 {
13237 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
13238 strcat(string, "*");
13239 else
13240 strcat(string, " *");
13241 }
13242 if(printConst && type->constant && type->kind == 13)
13243 strcat(string, " const");
13244 }
13245 else
13246 PrintTypeSpecs(type, string, fullName, printConst);
13247 }
13248
13249 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
13250 {
13251 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13252 strcat(string, ")");
13253 if(type->kind == 12)
13254 PrintArraySize(type, string);
13255 else if(type->kind == 11)
13256 {
13257 struct Type * param;
13258
13259 strcat(string, "(");
13260 for(param = type->params.first; param; param = param->next)
13261 {
13262 PrintType(param, string, 0x1, fullName);
13263 if(param->next)
13264 strcat(string, ", ");
13265 }
13266 strcat(string, ")");
13267 }
13268 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13269 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
13270 }
13271
13272 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
13273 {
13274 PrePrintType(type, string, fullName, (((void *)0)), printConst);
13275 if(type->thisClass || (printName && type->name && type->name[0]))
13276 strcat(string, " ");
13277 if((type->thisClass || type->staticMethod))
13278 {
13279 struct Symbol * _class = type->thisClass;
13280
13281 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
13282 {
13283 if(type->classObjectType == 1)
13284 strcat(string, "class");
13285 else
13286 strcat(string, type->byReference ? "typed_object&" : "typed_object");
13287 }
13288 else if(_class && _class->string)
13289 {
13290 char * s = _class->string;
13291
13292 if(fullName)
13293 strcat(string, s);
13294 else
13295 {
13296 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
13297
13298 if(name)
13299 name += 2;
13300 else
13301 name = s;
13302 strcat(string, name);
13303 }
13304 }
13305 strcat(string, "::");
13306 }
13307 if(printName && type->name)
13308 PrintName(type, string, fullName);
13309 PostPrintType(type, string, fullName);
13310 if(type->bitFieldCount)
13311 {
13312 char count[100];
13313
13314 sprintf(count, ":%d", type->bitFieldCount);
13315 strcat(string, count);
13316 }
13317 }
13318
13319 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13320 {
13321 _PrintType(type, string, printName, fullName, 0x1);
13322 }
13323
13324 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13325 {
13326 _PrintType(type, string, printName, fullName, 0x0);
13327 }
13328
13329 static struct Type * FindMember(struct Type * type, char * string)
13330 {
13331 struct Type * memberType;
13332
13333 for(memberType = type->members.first; memberType; memberType = memberType->next)
13334 {
13335 if(!memberType->name)
13336 {
13337 struct Type * subType = FindMember(memberType, string);
13338
13339 if(subType)
13340 return subType;
13341 }
13342 else if(!strcmp(memberType->name, string))
13343 return memberType;
13344 }
13345 return (((void *)0));
13346 }
13347
13348 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
13349 {
13350 struct Type * memberType;
13351
13352 for(memberType = type->members.first; memberType; memberType = memberType->next)
13353 {
13354 if(!memberType->name)
13355 {
13356 struct Type * subType = FindMember(memberType, string);
13357
13358 if(subType)
13359 {
13360 *offset += memberType->offset;
13361 return subType;
13362 }
13363 }
13364 else if(!strcmp(memberType->name, string))
13365 {
13366 *offset += memberType->offset;
13367 return memberType;
13368 }
13369 }
13370 return (((void *)0));
13371 }
13372
13373 extern unsigned int parseError;
13374
13375 unsigned int GetParseError()
13376 {
13377 return parseError;
13378 }
13379
13380 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
13381
13382 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
13383
13384 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
13385
13386 struct Expression * ParseExpressionString(char * expression)
13387 {
13388 parseError = 0x0;
13389 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
13390 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
13391 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13392
13393 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13394 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
13395 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
13396 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13397
13398 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13399 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
13400 echoOn = 0x0;
13401 parsedExpression = (((void *)0));
13402 resetScanner();
13403 expression_yyparse();
13404 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
13405 return parsedExpression;
13406 }
13407
13408 extern char *  QMkString(char *  source);
13409
13410 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
13411 {
13412 struct Identifier * id = exp->identifier;
13413 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13414 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13415 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13416 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13417
13418 if(_class && _class->type == 4)
13419 {
13420 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
13421 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
13422
13423 if(enumClass)
13424 {
13425 struct __ecereNameSpace__ecere__com__Class * baseClass;
13426
13427 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
13428 {
13429 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
13430
13431 for(value = e->values.first; value; value = value->next)
13432 {
13433 if(!strcmp(value->name, id->string))
13434 break;
13435 }
13436 if(value)
13437 {
13438 char constant[256];
13439
13440 FreeExpContents(exp);
13441 exp->type = 2;
13442 exp->isConstant = 0x1;
13443 if(!strcmp(baseClass->dataTypeString, "int"))
13444 sprintf(constant, "%d", (int)value->data);
13445 else
13446 sprintf(constant, "0x%X", (int)value->data);
13447 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13448 exp->expType = MkClassType(baseClass->fullName);
13449 break;
13450 }
13451 }
13452 }
13453 if(value)
13454 return 0x1;
13455 }
13456 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
13457 {
13458 ProcessMethodType(method);
13459 exp->expType = __extension__ ({
13460 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13461
13462 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
13463 });
13464 return 0x1;
13465 }
13466 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
13467 {
13468 if(!prop->dataType)
13469 ProcessPropertyType(prop);
13470 exp->expType = prop->dataType;
13471 if(prop->dataType)
13472 prop->dataType->refCount++;
13473 return 0x1;
13474 }
13475 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
13476 {
13477 if(!member->dataType)
13478 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13479 exp->expType = member->dataType;
13480 if(member->dataType)
13481 member->dataType->refCount++;
13482 return 0x1;
13483 }
13484 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
13485 {
13486 if(!classProp->dataType)
13487 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
13488 if(classProp->constant)
13489 {
13490 FreeExpContents(exp);
13491 exp->isConstant = 0x1;
13492 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
13493 {
13494 exp->type = 3;
13495 exp->constant = QMkString((char *)classProp->Get(_class));
13496 }
13497 else
13498 {
13499 char constant[256];
13500
13501 exp->type = 2;
13502 sprintf(constant, "%d", (int)classProp->Get(_class));
13503 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13504 }
13505 }
13506 else
13507 {
13508 }
13509 exp->expType = classProp->dataType;
13510 if(classProp->dataType)
13511 classProp->dataType->refCount++;
13512 return 0x1;
13513 }
13514 return 0x0;
13515 }
13516
13517 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
13518 {
13519 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
13520 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
13521 struct __ecereNameSpace__ecere__com__NameSpace * child;
13522
13523 if(!data)
13524 {
13525 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)))
13526 {
13527 data = ScanGlobalData(child, name);
13528 if(data)
13529 break;
13530 }
13531 }
13532 return data;
13533 }
13534
13535 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
13536
13537 extern char *  strncpy(char * , const char * , size_t n);
13538
13539 static struct GlobalData * FindGlobalData(char * name)
13540 {
13541 int start = 0, c;
13542 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
13543
13544 nameSpace = globalData;
13545 for(c = 0; name[c]; c++)
13546 {
13547 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
13548 {
13549 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
13550 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
13551
13552 strncpy(spaceName, name + start, c - start);
13553 spaceName[c - start] = '\0';
13554 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
13555 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
13556 if(!newSpace)
13557 return (((void *)0));
13558 nameSpace = newSpace;
13559 if(name[c] == ':')
13560 c++;
13561 start = c + 1;
13562 }
13563 }
13564 if(c - start)
13565 {
13566 return ScanGlobalData(nameSpace, name + start);
13567 }
13568 return (((void *)0));
13569 }
13570
13571 static int definedExpStackPos;
13572
13573 static void * definedExpStack[512];
13574
13575 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
13576 {
13577 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
13578
13579 FreeExpContents(checkedExp);
13580 FreeType(checkedExp->expType);
13581 FreeType(checkedExp->destType);
13582 *checkedExp = *newExp;
13583 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
13584 checkedExp->prev = prev;
13585 checkedExp->next = next;
13586 }
13587
13588 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
13589
13590 extern int printf(char * , ...);
13591
13592 void __ecereMethod_Expression_Clear();
13593
13594 void ApplyAnyObjectLogic(struct Expression * e)
13595 {
13596 struct Type * destType = e->destType;
13597
13598 if(destType && (destType->classObjectType == 3))
13599 {
13600 if(e && e->expType)
13601 {
13602 struct Type * type = e->expType;
13603 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
13604
13605 if(type->kind == 8 && type->_class && type->_class->registered)
13606 {
13607 _class = type->_class->registered;
13608 }
13609 else if(type->kind == 19)
13610 {
13611 _class = FindClass("ecere::com::Class")->registered;
13612 }
13613 else
13614 {
13615 char string[1024] = "";
13616 struct Symbol * classSym;
13617
13618 PrintTypeNoConst(type, string, 0x0, 0x1);
13619 classSym = FindClass(string);
13620 if(classSym)
13621 _class = classSym->registered;
13622 }
13623 if((_class && (_class->type == 4 || _class->type == 3 || _class->type == 2 || _class->type == 1000) && strcmp(_class->fullName, "class") && strcmp(_class->fullName, "uintptr") && strcmp(_class->fullName, "intptr")) || (!e->expType->classObjectType && (((type->kind != 13 && type->kind != 22 && type->kind != 19 && (type->kind != 8 || !type->_class || !type->_class->registered || type->_class->registered->type == 1))) || destType->byReference)))
13624 {
13625 if(!_class || strcmp(_class->fullName, "char *"))
13626 {
13627 struct Expression * checkedExp = e, * newExp;
13628
13629 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13630 {
13631 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13632 {
13633 if(checkedExp->type == 23)
13634 {
13635 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13636 }
13637 else
13638 checkedExp = (*checkedExp->list).last;
13639 }
13640 else if(checkedExp->type == 11)
13641 checkedExp = checkedExp->cast.exp;
13642 }
13643 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
13644 {
13645 newExp = checkedExp->op.exp2;
13646 checkedExp->op.exp2 = (((void *)0));
13647 FreeExpContents(checkedExp);
13648 if(e->expType && e->expType->passAsTemplate)
13649 {
13650 char size[100];
13651
13652 ComputeTypeSize(e->expType);
13653 sprintf(size, "%d", e->expType->size);
13654 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))))));
13655 }
13656 ReplaceExpContents(checkedExp, newExp);
13657 e->byReference = 0x1;
13658 }
13659 else if(!e->byReference || (_class && _class->type == 5))
13660 {
13661 struct Expression * checkedExp;
13662
13663 {
13664 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;
13665
13666 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
13667 {
13668 struct Context * context = PushContext();
13669 struct Declarator * decl;
13670 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13671 char typeString[1024];
13672 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13673
13674 typeString[0] = '\0';
13675 *newExp = *e;
13676 newExp->prev = (((void *)0));
13677 newExp->next = (((void *)0));
13678 newExp->expType = (((void *)0));
13679 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
13680 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13681 newExp->destType = ProcessType(specs, decl);
13682 curContext = context;
13683 if(curCompound)
13684 {
13685 char name[100];
13686 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
13687
13688 e->type = 23;
13689 sprintf(name, "__internalValue%03X", internalValueCounter++);
13690 if(!curCompound->compound.declarations)
13691 curCompound->compound.declarations = MkList();
13692 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
13693 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
13694 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
13695 e->compound = MkCompoundStmt((((void *)0)), stmts);
13696 }
13697 else
13698 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
13699 {
13700 struct Type * type = e->destType;
13701
13702 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13703 CopyTypeInto(e->destType, type);
13704 e->destType->refCount = 1;
13705 e->destType->classObjectType = 0;
13706 FreeType(type);
13707 }
13708 e->compound->compound.context = context;
13709 PopContext(context);
13710 curContext = context->parent;
13711 }
13712 }
13713 checkedExp = e;
13714 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13715 {
13716 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13717 {
13718 if(checkedExp->type == 23)
13719 {
13720 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13721 }
13722 else
13723 checkedExp = (*checkedExp->list).last;
13724 }
13725 else if(checkedExp->type == 11)
13726 checkedExp = checkedExp->cast.exp;
13727 }
13728 {
13729 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13730
13731 *operand = *checkedExp;
13732 checkedExp->destType = (((void *)0));
13733 checkedExp->expType = (((void *)0));
13734 __ecereMethod_Expression_Clear(checkedExp);
13735 checkedExp->type = 4;
13736 checkedExp->op.op = '&';
13737 checkedExp->op.exp1 = (((void *)0));
13738 checkedExp->op.exp2 = operand;
13739 }
13740 }
13741 }
13742 }
13743 }
13744 }
13745 {
13746 }
13747 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))))
13748 {
13749 if(e->expType->classObjectType && destType && destType->classObjectType)
13750 {
13751 return ;
13752 }
13753 else
13754 {
13755 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13756
13757 *thisExp = *e;
13758 thisExp->prev = (((void *)0));
13759 thisExp->next = (((void *)0));
13760 __ecereMethod_Expression_Clear(e);
13761 e->type = 5;
13762 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
13763 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
13764 ((struct Expression *)(*e->list).first)->byReference = 0x1;
13765 {
13766 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13767 CopyTypeInto(e->expType, thisExp->expType);
13768 e->expType->byReference = 0x0;
13769 e->expType->refCount = 1;
13770 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))
13771 {
13772 e->expType->classObjectType = 0;
13773 }
13774 }
13775 }
13776 }
13777 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
13778 {
13779 if(destType->kind == 14)
13780 {
13781 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unspecified type\n", (((void *)0))));
13782 }
13783 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
13784 {
13785 unsigned int byReference = e->expType->byReference;
13786 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13787 struct Declarator * decl;
13788 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13789 char typeString[1024];
13790 struct Type * type;
13791 int backupClassObjectType;
13792 unsigned int backupByReference;
13793
13794 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
13795 type = e->expType;
13796 else
13797 type = destType;
13798 backupClassObjectType = type->classObjectType;
13799 backupByReference = type->byReference;
13800 type->classObjectType = 0;
13801 type->byReference = 0x0;
13802 typeString[0] = '\0';
13803 PrintType(type, typeString, 0x0, 0x1);
13804 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13805 type->classObjectType = backupClassObjectType;
13806 type->byReference = backupByReference;
13807 *thisExp = *e;
13808 thisExp->prev = (((void *)0));
13809 thisExp->next = (((void *)0));
13810 __ecereMethod_Expression_Clear(e);
13811 if((type->kind == 8 && type->_class && type->_class->registered && (type->_class->registered->type == 1000 || type->_class->registered->type == 2 || type->_class->registered->type == 4 || type->_class->registered->type == 3)) || (type->kind != 13 && type->kind != 22 && type->kind != 12 && type->kind != 8) || (!destType->byReference && byReference && (destType->kind != 13 || type->kind != 13)))
13812 {
13813 e->type = 4;
13814 e->op.op = '*';
13815 e->op.exp1 = (((void *)0));
13816 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
13817 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13818 CopyTypeInto(e->expType, type);
13819 e->expType->byReference = 0x0;
13820 e->expType->refCount = 1;
13821 }
13822 else
13823 {
13824 e->type = 11;
13825 e->cast.typeName = MkTypeName(specs, decl);
13826 e->cast.exp = thisExp;
13827 e->byReference = 0x1;
13828 e->expType = type;
13829 type->refCount++;
13830 }
13831 e->destType = destType;
13832 destType->refCount++;
13833 }
13834 }
13835 }
13836
13837 extern char *  strstr(const char * , const char * );
13838
13839 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
13840
13841 struct __ecereNameSpace__ecere__com__DefinedExpression
13842 {
13843 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
13844 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
13845 char *  name;
13846 char *  value;
13847 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
13848 } __attribute__ ((gcc_struct));
13849
13850 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
13851
13852 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
13853
13854 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
13855
13856 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
13857
13858 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
13859
13860 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
13861
13862 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
13863
13864 static void ProcessStatement(struct Statement * stmt);
13865
13866 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
13867
13868 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
13869
13870 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
13871
13872 extern char *  sourceFile;
13873
13874 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
13875
13876 void ProcessExpressionType(struct Expression * exp)
13877 {
13878 unsigned int unresolved = 0x0;
13879 struct Location oldyylloc = yylloc;
13880 unsigned int notByReference = 0x0;
13881
13882 if(!exp || exp->expType)
13883 return ;
13884 yylloc = exp->loc;
13885 switch(exp->type)
13886 {
13887 case 0:
13888 {
13889 struct Identifier * id = exp->identifier;
13890
13891 if(!id || !topContext)
13892 return ;
13893 if(id->_class && id->_class->name)
13894 {
13895 id->classSym = id->_class->symbol;
13896 }
13897 if(strstr(id->string, "__ecereClass") == id->string)
13898 {
13899 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
13900 break;
13901 }
13902 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
13903 {
13904 ReplaceClassMembers(exp, thisClass);
13905 if(exp->type != 0)
13906 {
13907 ProcessExpressionType(exp);
13908 break;
13909 }
13910 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
13911 break;
13912 }
13913 else
13914 {
13915 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
13916
13917 if(!symbol)
13918 {
13919 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
13920 break;
13921 else
13922 {
13923 if(thisClass)
13924 {
13925 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
13926 if(exp->type != 0)
13927 {
13928 ProcessExpressionType(exp);
13929 break;
13930 }
13931 }
13932 else if(currentClass && !id->_class)
13933 {
13934 if(ResolveIdWithClass(exp, currentClass, 0x1))
13935 break;
13936 }
13937 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
13938 }
13939 }
13940 if(symbol)
13941 {
13942 struct Type * type = symbol->type;
13943 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
13944
13945 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
13946 {
13947 struct Context * context = SetupTemplatesContext(_class);
13948
13949 type = ReplaceThisClassType(_class);
13950 FinishTemplatesContext(context);
13951 if(type)
13952 type->refCount = 0;
13953 }
13954 FreeSpecifier(id->_class);
13955 id->_class = (((void *)0));
13956 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
13957 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
13958 id->classSym = (((void *)0));
13959 exp->expType = type;
13960 if(type)
13961 type->refCount++;
13962 if(type && (type->kind == 15))
13963 exp->isConstant = 0x1;
13964 if(symbol->isParam || !strcmp(id->string, "this"))
13965 {
13966 if(_class && _class->type == 1 && !type->declaredWithStruct)
13967 exp->byReference = 0x1;
13968 }
13969 if(symbol->isIterator)
13970 {
13971 if(symbol->isIterator == 3)
13972 {
13973 exp->type = 5;
13974 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
13975 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
13976 exp->expType = (((void *)0));
13977 ProcessExpressionType(exp);
13978 }
13979 else if(symbol->isIterator != 4)
13980 {
13981 exp->type = 8;
13982 exp->member.exp = MkExpIdentifier(exp->identifier);
13983 exp->member.exp->expType = exp->expType;
13984 exp->member.member = MkIdentifier("data");
13985 exp->expType = (((void *)0));
13986 ProcessExpressionType(exp);
13987 }
13988 }
13989 break;
13990 }
13991 else
13992 {
13993 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
13994
13995 if(thisNameSpace && !(id->_class && !id->_class->name))
13996 {
13997 char name[1024];
13998
13999 strcpy(name, thisNameSpace);
14000 strcat(name, "::");
14001 strcat(name, id->string);
14002 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
14003 }
14004 if(!definedExp)
14005 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
14006 if(definedExp)
14007 {
14008 int c;
14009
14010 for(c = 0; c < definedExpStackPos; c++)
14011 if(definedExpStack[c] == definedExp)
14012 break;
14013 if(c == definedExpStackPos && c < sizeof (definedExpStack) / sizeof(void *))
14014 {
14015 struct Location backupYylloc = yylloc;
14016 struct __ecereNameSpace__ecere__com__Instance * backInput = fileInput;
14017
14018 definedExpStack[definedExpStackPos++] = definedExp;
14019 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
14020 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
14021 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14022
14023 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14024 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
14025 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
14026 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14027
14028 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14029 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
14030 echoOn = 0x0;
14031 parsedExpression = (((void *)0));
14032 resetScanner();
14033 expression_yyparse();
14034 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
14035 if(backInput)
14036 fileInput = backInput;
14037 yylloc = backupYylloc;
14038 if(parsedExpression)
14039 {
14040 FreeIdentifier(id);
14041 exp->type = 5;
14042 exp->list = MkListOne(parsedExpression);
14043 parsedExpression->loc = yylloc;
14044 ProcessExpressionType(exp);
14045 definedExpStackPos--;
14046 return ;
14047 }
14048 definedExpStackPos--;
14049 }
14050 else
14051 {
14052 if(inCompiler)
14053 {
14054 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Recursion in defined expression %s\n", (((void *)0))), id->string);
14055 }
14056 }
14057 }
14058 else
14059 {
14060 struct GlobalData * data = (((void *)0));
14061
14062 if(thisNameSpace && !(id->_class && !id->_class->name))
14063 {
14064 char name[1024];
14065
14066 strcpy(name, thisNameSpace);
14067 strcat(name, "::");
14068 strcat(name, id->string);
14069 data = FindGlobalData(name);
14070 }
14071 if(!data)
14072 data = FindGlobalData(id->string);
14073 if(data)
14074 {
14075 DeclareGlobalData(data);
14076 exp->expType = data->dataType;
14077 if(data->dataType)
14078 data->dataType->refCount++;
14079 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14080 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
14081 FreeSpecifier(id->_class);
14082 id->_class = (((void *)0));
14083 break;
14084 }
14085 else
14086 {
14087 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
14088
14089 if(thisNameSpace && !(id->_class && !id->_class->name))
14090 {
14091 char name[1024];
14092
14093 strcpy(name, thisNameSpace);
14094 strcat(name, "::");
14095 strcat(name, id->string);
14096 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
14097 }
14098 if(!function)
14099 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
14100 if(function)
14101 {
14102 char name[1024];
14103
14104 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14105 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
14106 name[0] = (char)0;
14107 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
14108 strcpy(name, "__ecereFunction_");
14109 FullClassNameCat(name, id->string, 0x0);
14110 if(DeclareFunction(function, name))
14111 {
14112 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14113 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
14114 }
14115 exp->expType = function->dataType;
14116 if(function->dataType)
14117 function->dataType->refCount++;
14118 FreeSpecifier(id->_class);
14119 id->_class = (((void *)0));
14120 break;
14121 }
14122 }
14123 }
14124 }
14125 }
14126 unresolved = 0x1;
14127 break;
14128 }
14129 case 1:
14130 {
14131 struct __ecereNameSpace__ecere__com__Class * _class;
14132
14133 if(!exp->instance->_class)
14134 {
14135 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
14136 {
14137 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
14138 }
14139 }
14140 ProcessInstantiationType(exp->instance);
14141 exp->isConstant = exp->instance->isConstant;
14142 if(exp->instance->_class)
14143 {
14144 exp->expType = MkClassType(exp->instance->_class->name);
14145 }
14146 break;
14147 }
14148 case 2:
14149 {
14150 if(!exp->expType)
14151 {
14152 char * constant = exp->constant;
14153 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
14154
14155 exp->expType = type;
14156 if(constant[0] == '\'')
14157 {
14158 if((int)((unsigned char *)constant)[1] > 127)
14159 {
14160 int nb;
14161 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(constant + 1, &nb);
14162
14163 if(nb < 2)
14164 ch = constant[1];
14165 (__ecereNameSpace__ecere__com__eSystem_Delete(constant), constant = 0);
14166 exp->constant = PrintUInt(ch);
14167 type->kind = 8;
14168 type->_class = FindClass("unichar");
14169 type->isSigned = 0x0;
14170 }
14171 else
14172 {
14173 type->kind = 1;
14174 type->isSigned = 0x1;
14175 }
14176 }
14177 else
14178 {
14179 char * dot = strchr(constant, '.');
14180 unsigned int isHex = (constant[0] == '0' && (constant[1] == 'x' || constant[1] == 'X'));
14181 char * exponent;
14182
14183 if(isHex)
14184 {
14185 exponent = strchr(constant, 'p');
14186 if(!exponent)
14187 exponent = strchr(constant, 'P');
14188 }
14189 else
14190 {
14191 exponent = strchr(constant, 'e');
14192 if(!exponent)
14193 exponent = strchr(constant, 'E');
14194 }
14195 if(dot || exponent)
14196 {
14197 if(strchr(constant, 'f') || strchr(constant, 'F'))
14198 type->kind = 6;
14199 else
14200 type->kind = 7;
14201 type->isSigned = 0x1;
14202 }
14203 else
14204 {
14205 unsigned int isSigned = constant[0] == '-';
14206 char * endP = (((void *)0));
14207 long long i64 = strtoll(constant, &endP, 0);
14208 uint64 ui64 = strtoull(constant, &endP, 0);
14209 unsigned int is64Bit = endP && (!strcmp(endP, "LL") || !strcmp(endP, "ll"));
14210
14211 if(isSigned)
14212 {
14213 if(i64 < (((int)0x80000000)))
14214 is64Bit = 0x1;
14215 }
14216 else
14217 {
14218 if(ui64 > (((int)0x7fffffff)))
14219 {
14220 if(ui64 > (0xffffffff))
14221 {
14222 is64Bit = 0x1;
14223 if(ui64 <= (((long long)0x7fffffffffffffffLL)) && (constant[0] != '0' || !constant[1]))
14224 isSigned = 0x1;
14225 }
14226 }
14227 else if(constant[0] != '0' || !constant[1])
14228 isSigned = 0x1;
14229 }
14230 type->kind = is64Bit ? 4 : 3;
14231 type->isSigned = isSigned;
14232 }
14233 }
14234 exp->isConstant = 0x1;
14235 if(exp->destType && exp->destType->kind == 7)
14236 type->kind = 7;
14237 else if(exp->destType && exp->destType->kind == 6)
14238 type->kind = 6;
14239 else if(exp->destType && exp->destType->kind == 4)
14240 type->kind = 4;
14241 }
14242 break;
14243 }
14244 case 3:
14245 {
14246 exp->isConstant = 0x1;
14247 exp->expType = __extension__ ({
14248 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14249
14250 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
14251 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14252
14253 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1->isSigned = 0x1, __ecereInstance1;
14254 }), __ecereInstance2;
14255 });
14256 break;
14257 }
14258 case 13:
14259 case 26:
14260 ProcessExpressionType(exp->_new.size);
14261 exp->expType = __extension__ ({
14262 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14263
14264 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
14265 });
14266 DeclareType(exp->expType->type, 0x0, 0x0);
14267 break;
14268 case 14:
14269 case 27:
14270 ProcessExpressionType(exp->_renew.size);
14271 ProcessExpressionType(exp->_renew.exp);
14272 exp->expType = __extension__ ({
14273 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14274
14275 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
14276 });
14277 DeclareType(exp->expType->type, 0x0, 0x0);
14278 break;
14279 case 4:
14280 {
14281 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
14282 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
14283 unsigned int useDestType = 0x0, useSideType = 0x0;
14284 struct Location oldyylloc = yylloc;
14285 unsigned int useSideUnit = 0x0;
14286 struct __ecereNameSpace__ecere__com__Class * destClass = (exp->destType && exp->destType->kind == 8 && exp->destType->_class) ? exp->destType->_class->registered : (((void *)0));
14287 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
14288
14289 switch(exp->op.op)
14290 {
14291 case '=':
14292 case MUL_ASSIGN:
14293 case DIV_ASSIGN:
14294 case MOD_ASSIGN:
14295 case ADD_ASSIGN:
14296 case SUB_ASSIGN:
14297 case LEFT_ASSIGN:
14298 case RIGHT_ASSIGN:
14299 case AND_ASSIGN:
14300 case XOR_ASSIGN:
14301 case OR_ASSIGN:
14302 assign = 0x1;
14303 break;
14304 case '!':
14305 break;
14306 case AND_OP:
14307 case OR_OP:
14308 boolOps = 0x1;
14309 boolResult = 0x1;
14310 break;
14311 case EQ_OP:
14312 case '<':
14313 case '>':
14314 case LE_OP:
14315 case GE_OP:
14316 case NE_OP:
14317 boolResult = 0x1;
14318 useSideType = 0x1;
14319 break;
14320 case '+':
14321 case '-':
14322 useSideUnit = 0x1;
14323 useSideType = 0x1;
14324 useDestType = 0x1;
14325 break;
14326 case LEFT_OP:
14327 case RIGHT_OP:
14328 useSideType = 0x1;
14329 useDestType = 0x1;
14330 break;
14331 case '|':
14332 case '^':
14333 useSideType = 0x1;
14334 useDestType = 0x1;
14335 break;
14336 case '/':
14337 case '%':
14338 useSideType = 0x1;
14339 useDestType = 0x1;
14340 break;
14341 case '&':
14342 case '*':
14343 if(exp->op.exp1)
14344 {
14345 useSideType = 0x1;
14346 useDestType = 0x1;
14347 }
14348 break;
14349 }
14350 if(exp->op.op == '&')
14351 {
14352 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
14353 {
14354 struct Identifier * id = exp->op.exp2->identifier;
14355 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
14356
14357 if(symbol && symbol->isIterator == 2)
14358 {
14359 exp->type = 8;
14360 exp->member.exp = exp->op.exp2;
14361 exp->member.member = MkIdentifier("key");
14362 exp->expType = (((void *)0));
14363 exp->op.exp2->expType = symbol->type;
14364 symbol->type->refCount++;
14365 ProcessExpressionType(exp);
14366 FreeType(dummy);
14367 break;
14368 }
14369 }
14370 }
14371 if(exp->op.exp1)
14372 {
14373 if(exp->op.exp2 && useSideUnit && useDestType && destClass && destClass->type == 3 && destClass->base->type != 3)
14374 useDestType = 0x0;
14375 if(destClass && useDestType && ((destClass->type == 3 && useSideUnit) || destClass->type == 4 || destClass->type == 2))
14376 {
14377 if(exp->op.exp1->destType)
14378 FreeType(exp->op.exp1->destType);
14379 exp->op.exp1->destType = exp->destType;
14380 exp->op.exp1->opDestType = 0x1;
14381 if(exp->destType)
14382 exp->destType->refCount++;
14383 }
14384 else if(!assign)
14385 {
14386 if(exp->op.exp1->destType)
14387 FreeType(exp->op.exp1->destType);
14388 exp->op.exp1->destType = dummy;
14389 dummy->refCount++;
14390 }
14391 if(exp->op.exp1->destType && exp->op.op != '=')
14392 exp->op.exp1->destType->count++;
14393 ProcessExpressionType(exp->op.exp1);
14394 if(exp->op.exp1->destType && exp->op.op != '=')
14395 exp->op.exp1->destType->count--;
14396 exp->op.exp1->opDestType = 0x0;
14397 if(!exp->op.exp2 && (exp->op.op == INC_OP || exp->op.op == DEC_OP) && exp->op.exp1->expType && exp->op.exp1->expType->kind == 8 && exp->op.exp1->expType->_class && exp->op.exp1->expType->_class->registered && exp->op.exp1->expType->_class->registered->type == 3)
14398 {
14399 exp->op.exp2 = MkExpConstant("1");
14400 exp->op.op = exp->op.op == INC_OP ? ADD_ASSIGN : SUB_ASSIGN;
14401 assign = 0x1;
14402 }
14403 if(exp->op.exp1->destType == dummy)
14404 {
14405 FreeType(dummy);
14406 exp->op.exp1->destType = (((void *)0));
14407 }
14408 type1 = exp->op.exp1->expType;
14409 }
14410 if(exp->op.exp2)
14411 {
14412 char expString[10240];
14413
14414 expString[0] = '\0';
14415 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
14416 {
14417 if(exp->op.exp1)
14418 {
14419 exp->op.exp2->destType = exp->op.exp1->expType;
14420 if(exp->op.exp1->expType)
14421 exp->op.exp1->expType->refCount++;
14422 }
14423 else
14424 {
14425 exp->op.exp2->destType = exp->destType;
14426 if(!exp->op.exp1 || exp->op.op != '&')
14427 exp->op.exp2->opDestType = 0x1;
14428 if(exp->destType)
14429 exp->destType->refCount++;
14430 }
14431 if(type1)
14432 type1->refCount++;
14433 exp->expType = type1;
14434 }
14435 else if(assign)
14436 {
14437 if(inCompiler)
14438 PrintExpression(exp->op.exp2, expString);
14439 if(type1 && type1->kind == 13)
14440 {
14441 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)
14442 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
14443 else if(exp->op.op == '=')
14444 {
14445 if(exp->op.exp2->destType)
14446 FreeType(exp->op.exp2->destType);
14447 exp->op.exp2->destType = type1;
14448 if(type1)
14449 type1->refCount++;
14450 }
14451 }
14452 else
14453 {
14454 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)
14455 ;
14456 else
14457 {
14458 if(exp->op.exp2->destType)
14459 FreeType(exp->op.exp2->destType);
14460 exp->op.exp2->destType = type1;
14461 if(type1)
14462 type1->refCount++;
14463 }
14464 }
14465 if(type1)
14466 type1->refCount++;
14467 exp->expType = type1;
14468 }
14469 else if(destClass && ((destClass->type == 3 && useDestType && useSideUnit) || (destClass->type == 4 && useDestType)))
14470 {
14471 if(exp->op.exp2->destType)
14472 FreeType(exp->op.exp2->destType);
14473 exp->op.exp2->destType = exp->destType;
14474 if(exp->op.op != '&')
14475 exp->op.exp2->opDestType = 0x1;
14476 if(exp->destType)
14477 exp->destType->refCount++;
14478 }
14479 else
14480 {
14481 if(exp->op.exp2->destType)
14482 FreeType(exp->op.exp2->destType);
14483 exp->op.exp2->destType = dummy;
14484 dummy->refCount++;
14485 }
14486 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
14487 {
14488 FreeType(exp->op.exp2->destType);
14489 exp->op.exp2->destType = type1;
14490 type1->refCount++;
14491 }
14492 if(exp->op.exp2->destType && exp->op.op != '=')
14493 exp->op.exp2->destType->count++;
14494 if(exp->op.op == SIZEOF)
14495 {
14496 struct Expression * e = exp->op.exp2;
14497
14498 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
14499 {
14500 if(e->type == 5 || e->type == 32 || e->type == 23)
14501 {
14502 if(e->type == 23)
14503 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
14504 else
14505 e = (*e->list).last;
14506 }
14507 }
14508 if(e->type == 11 && e->cast.exp)
14509 e->cast.exp->needCast = 0x1;
14510 }
14511 ProcessExpressionType(exp->op.exp2);
14512 exp->op.exp2->opDestType = 0x0;
14513 if(exp->op.exp2->destType && exp->op.op != '=')
14514 exp->op.exp2->destType->count--;
14515 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
14516 {
14517 if(exp->op.exp2->expType->kind == 23 || exp->op.exp2->expType->kind == 22 || exp->op.exp2->expType->kind == 4 || exp->op.exp2->expType->kind == 3 || exp->op.exp2->expType->kind == 2 || exp->op.exp2->expType->kind == 1)
14518 {
14519 if(exp->op.op != '=' && type1->type->kind == 0)
14520 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14521 }
14522 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)))
14523 {
14524 if(exp->op.op == ADD_ASSIGN)
14525 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14526 }
14527 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))
14528 {
14529 if(exp->op.op == ADD_ASSIGN)
14530 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14531 }
14532 else if(inCompiler)
14533 {
14534 char type1String[1024];
14535 char type2String[1024];
14536
14537 type1String[0] = '\0';
14538 type2String[0] = '\0';
14539 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
14540 PrintType(type1, type2String, 0x0, 0x1);
14541 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14542 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
14543 }
14544 }
14545 if(exp->op.exp2->destType == dummy)
14546 {
14547 FreeType(dummy);
14548 exp->op.exp2->destType = (((void *)0));
14549 }
14550 if(exp->op.op == '-' && !exp->op.exp1 && exp->op.exp2->expType && !exp->op.exp2->expType->isSigned)
14551 {
14552 type2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14553 type2->refCount = 1;
14554 CopyTypeInto(type2, exp->op.exp2->expType);
14555 type2->isSigned = 0x1;
14556 }
14557 else if(exp->op.op == '~' && !exp->op.exp1 && exp->op.exp2->expType && (!exp->op.exp2->expType->isSigned || exp->op.exp2->expType->kind != 3))
14558 {
14559 type2 = __extension__ ({
14560 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14561
14562 __ecereInstance1->kind = 3, __ecereInstance1;
14563 });
14564 type2->refCount = 1;
14565 type2->isSigned = 0x1;
14566 }
14567 else
14568 {
14569 type2 = exp->op.exp2->expType;
14570 if(type2)
14571 type2->refCount++;
14572 }
14573 }
14574 dummy->kind = 0;
14575 if(exp->op.op == SIZEOF)
14576 {
14577 exp->expType = __extension__ ({
14578 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14579
14580 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
14581 });
14582 exp->isConstant = 0x1;
14583 }
14584 else if(exp->op.op == '*' && !exp->op.exp1)
14585 {
14586 exp->expType = Dereference(type2);
14587 if(type2 && type2->kind == 8)
14588 notByReference = 0x1;
14589 }
14590 else if(exp->op.op == '&' && !exp->op.exp1)
14591 exp->expType = Reference(type2);
14592 else if(!assign)
14593 {
14594 if(boolOps)
14595 {
14596 if(exp->op.exp1)
14597 {
14598 if(exp->op.exp1->destType)
14599 FreeType(exp->op.exp1->destType);
14600 exp->op.exp1->destType = MkClassType("bool");
14601 exp->op.exp1->destType->truth = 0x1;
14602 if(!exp->op.exp1->expType)
14603 ProcessExpressionType(exp->op.exp1);
14604 else
14605 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14606 FreeType(exp->op.exp1->expType);
14607 exp->op.exp1->expType = MkClassType("bool");
14608 exp->op.exp1->expType->truth = 0x1;
14609 }
14610 if(exp->op.exp2)
14611 {
14612 if(exp->op.exp2->destType)
14613 FreeType(exp->op.exp2->destType);
14614 exp->op.exp2->destType = MkClassType("bool");
14615 exp->op.exp2->destType->truth = 0x1;
14616 if(!exp->op.exp2->expType)
14617 ProcessExpressionType(exp->op.exp2);
14618 else
14619 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14620 FreeType(exp->op.exp2->expType);
14621 exp->op.exp2->expType = MkClassType("bool");
14622 exp->op.exp2->expType->truth = 0x1;
14623 }
14624 }
14625 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")))))
14626 {
14627 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
14628 {
14629 if(exp->op.op == '-' && ((type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 4) || (type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 4)))
14630 {
14631 struct Type * intType;
14632
14633 if(!type1->_class->registered->dataType)
14634 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14635 if(!type2->_class->registered->dataType)
14636 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14637 intType = ProcessTypeString((type1->_class->registered->dataType->kind == 4 || type2->_class->registered->dataType->kind == 4) ? "int64" : "int", 0x0);
14638 if(exp->op.exp1->destType)
14639 FreeType(exp->op.exp1->destType);
14640 if(exp->op.exp2->destType)
14641 FreeType(exp->op.exp2->destType);
14642 exp->op.exp1->destType = intType;
14643 exp->op.exp2->destType = intType;
14644 intType->refCount++;
14645 }
14646 else
14647 {
14648 if(exp->op.exp2->destType)
14649 FreeType(exp->op.exp2->destType);
14650 exp->op.exp2->destType = type1;
14651 type1->refCount++;
14652 if(exp->op.exp1->destType)
14653 FreeType(exp->op.exp1->destType);
14654 exp->op.exp1->destType = type2;
14655 type2->refCount++;
14656 }
14657 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)
14658 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "operating on %s and %s with an untyped result, assuming %s\n", (((void *)0))), type1->_class->string, type2->_class->string, type1->_class->string);
14659 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
14660 {
14661 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14662
14663 if(argExp)
14664 {
14665 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14666
14667 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
14668 ProcessExpressionType(exp->op.exp1);
14669 if(type2->kind != 13)
14670 {
14671 ProcessExpressionType(classExp);
14672 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"))))))));
14673 if(!exp->op.exp2->expType)
14674 {
14675 if(type2)
14676 FreeType(type2);
14677 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
14678 type2->refCount++;
14679 }
14680 ProcessExpressionType(exp->op.exp2);
14681 }
14682 }
14683 }
14684 if(!boolResult && ((type1->kind == 13 || type1->kind == 12 || (type1->kind == 8 && !strcmp(type1->_class->string, "String"))) && (type2->kind == 23 || type2->kind == 22 || type2->kind == 4 || type2->kind == 3 || type2->kind == 2 || type2->kind == 1)))
14685 {
14686 if(type1->kind != 8 && type1->type->kind == 0)
14687 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14688 exp->expType = type1;
14689 if(type1)
14690 type1->refCount++;
14691 }
14692 else if(!boolResult && ((type2->kind == 13 || type2->kind == 12 || (type2->kind == 8 && !strcmp(type2->_class->string, "String"))) && (type1->kind == 23 || type1->kind == 22 || type1->kind == 4 || type1->kind == 3 || type1->kind == 2 || type1->kind == 1)))
14693 {
14694 if(type2->kind != 8 && type2->type->kind == 0)
14695 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14696 exp->expType = type2;
14697 if(type2)
14698 type2->refCount++;
14699 }
14700 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))
14701 {
14702 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "different levels of indirection\n", (((void *)0))));
14703 }
14704 else
14705 {
14706 unsigned int success = 0x0;
14707
14708 if(type1->kind == 13 && type2->kind == 13)
14709 {
14710 if(exp->op.op == '+')
14711 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14712 else if(exp->op.op == '-')
14713 {
14714 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
14715 {
14716 exp->expType = __extension__ ({
14717 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14718
14719 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
14720 });
14721 success = 0x1;
14722 if(type1->type->kind == 20)
14723 {
14724 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14725
14726 if(argExp)
14727 {
14728 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14729
14730 ProcessExpressionType(classExp);
14731 exp->type = 5;
14732 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")))))));
14733 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
14734 FreeType(dummy);
14735 return ;
14736 }
14737 }
14738 }
14739 }
14740 }
14741 if(!success && exp->op.exp1->type == 2)
14742 {
14743 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14744 {
14745 if(exp->expType)
14746 FreeType(exp->expType);
14747 exp->expType = exp->op.exp1->destType;
14748 if(exp->op.exp1->destType)
14749 exp->op.exp1->destType->refCount++;
14750 success = 0x1;
14751 }
14752 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14753 {
14754 if(exp->expType)
14755 FreeType(exp->expType);
14756 exp->expType = exp->op.exp2->destType;
14757 if(exp->op.exp2->destType)
14758 exp->op.exp2->destType->refCount++;
14759 success = 0x1;
14760 }
14761 }
14762 else if(!success)
14763 {
14764 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14765 {
14766 if(exp->expType)
14767 FreeType(exp->expType);
14768 exp->expType = exp->op.exp2->destType;
14769 if(exp->op.exp2->destType)
14770 exp->op.exp2->destType->refCount++;
14771 success = 0x1;
14772 }
14773 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14774 {
14775 if(exp->expType)
14776 FreeType(exp->expType);
14777 exp->expType = exp->op.exp1->destType;
14778 if(exp->op.exp1->destType)
14779 exp->op.exp1->destType->refCount++;
14780 success = 0x1;
14781 }
14782 }
14783 if(!success)
14784 {
14785 char expString1[10240];
14786 char expString2[10240];
14787 char type1[1024];
14788 char type2[1024];
14789
14790 expString1[0] = '\0';
14791 expString2[0] = '\0';
14792 type1[0] = '\0';
14793 type2[0] = '\0';
14794 if(inCompiler)
14795 {
14796 PrintExpression(exp->op.exp1, expString1);
14797 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
14798 PrintExpression(exp->op.exp2, expString2);
14799 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
14800 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
14801 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
14802 }
14803 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
14804 }
14805 }
14806 }
14807 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
14808 {
14809 if(exp->op.exp1->destType)
14810 FreeType(exp->op.exp1->destType);
14811 exp->op.exp1->destType = type2->_class->registered->dataType;
14812 if(type2->_class->registered->dataType)
14813 type2->_class->registered->dataType->refCount++;
14814 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14815 exp->expType = type2;
14816 if(type2)
14817 type2->refCount++;
14818 }
14819 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
14820 {
14821 if(exp->op.exp2->destType)
14822 FreeType(exp->op.exp2->destType);
14823 exp->op.exp2->destType = type1->_class->registered->dataType;
14824 if(type1->_class->registered->dataType)
14825 type1->_class->registered->dataType->refCount++;
14826 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14827 exp->expType = type1;
14828 if(type1)
14829 type1->refCount++;
14830 }
14831 else if(type1)
14832 {
14833 unsigned int valid = 0x0;
14834
14835 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
14836 {
14837 if(exp->op.exp2->destType)
14838 FreeType(exp->op.exp2->destType);
14839 if(!type1->_class->registered->dataType)
14840 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14841 exp->op.exp2->destType = type1->_class->registered->dataType;
14842 exp->op.exp2->destType->refCount++;
14843 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14844 if(type2)
14845 FreeType(type2);
14846 type2 = exp->op.exp2->destType;
14847 if(type2)
14848 type2->refCount++;
14849 exp->expType = type2;
14850 type2->refCount++;
14851 }
14852 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
14853 {
14854 if(exp->op.exp1->destType)
14855 FreeType(exp->op.exp1->destType);
14856 if(!type2->_class->registered->dataType)
14857 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14858 exp->op.exp1->destType = type2->_class->registered->dataType;
14859 exp->op.exp1->destType->refCount++;
14860 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14861 type1 = exp->op.exp1->destType;
14862 exp->expType = type1;
14863 type1->refCount++;
14864 }
14865 if(!boolResult || exp->op.op == '>' || exp->op.op == '<' || exp->op.op == GE_OP || exp->op.op == LE_OP)
14866 {
14867 unsigned int op1IsEnum = type1 && type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4;
14868 unsigned int op2IsEnum = type2 && type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4;
14869
14870 if(exp->op.op == '*' || exp->op.op == '/' || exp->op.op == '-' || exp->op.op == '|' || exp->op.op == '^')
14871 {
14872 if(op1IsEnum && exp->op.exp2->expType)
14873 {
14874 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
14875 {
14876 if(exp->expType)
14877 FreeType(exp->expType);
14878 exp->expType = exp->op.exp2->expType;
14879 if(exp->op.exp2->expType)
14880 exp->op.exp2->expType->refCount++;
14881 valid = 0x1;
14882 }
14883 }
14884 else if(op2IsEnum && exp->op.exp1->expType)
14885 {
14886 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
14887 {
14888 if(exp->expType)
14889 FreeType(exp->expType);
14890 exp->expType = exp->op.exp1->expType;
14891 if(exp->op.exp1->expType)
14892 exp->op.exp1->expType->refCount++;
14893 valid = 0x1;
14894 }
14895 }
14896 }
14897 else
14898 {
14899 if(op1IsEnum && exp->op.exp2->expType)
14900 {
14901 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
14902 {
14903 if(exp->expType)
14904 FreeType(exp->expType);
14905 exp->expType = exp->op.exp1->expType;
14906 if(exp->op.exp1->expType)
14907 exp->op.exp1->expType->refCount++;
14908 valid = 0x1;
14909 }
14910 }
14911 else if(op2IsEnum && exp->op.exp1->expType)
14912 {
14913 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
14914 {
14915 if(exp->expType)
14916 FreeType(exp->expType);
14917 exp->expType = exp->op.exp2->expType;
14918 if(exp->op.exp2->expType)
14919 exp->op.exp2->expType->refCount++;
14920 valid = 0x1;
14921 }
14922 }
14923 }
14924 }
14925 if(!valid)
14926 {
14927 if(type2 && type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3 && (type1->kind != 8 || !type1->_class || !type1->_class->registered || type1->_class->registered->type != 3))
14928 {
14929 if(exp->op.exp1->destType)
14930 FreeType(exp->op.exp1->destType);
14931 exp->op.exp1->destType = type2;
14932 type2->refCount++;
14933 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14934 {
14935 if(exp->expType)
14936 FreeType(exp->expType);
14937 exp->expType = exp->op.exp1->destType;
14938 if(exp->op.exp1->destType)
14939 exp->op.exp1->destType->refCount++;
14940 }
14941 }
14942 else
14943 {
14944 if(exp->op.exp2->destType)
14945 FreeType(exp->op.exp2->destType);
14946 exp->op.exp2->destType = type1;
14947 type1->refCount++;
14948 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14949 {
14950 if(exp->expType)
14951 FreeType(exp->expType);
14952 exp->expType = exp->op.exp2->destType;
14953 if(exp->op.exp2->destType)
14954 exp->op.exp2->destType->refCount++;
14955 }
14956 else if(type1 && type2)
14957 {
14958 char expString1[10240];
14959 char expString2[10240];
14960 char type1String[1024];
14961 char type2String[1024];
14962
14963 expString1[0] = '\0';
14964 expString2[0] = '\0';
14965 type1String[0] = '\0';
14966 type2String[0] = '\0';
14967 if(inCompiler)
14968 {
14969 PrintExpression(exp->op.exp1, expString1);
14970 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
14971 PrintExpression(exp->op.exp2, expString2);
14972 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
14973 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
14974 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
14975 }
14976 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
14977 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
14978 {
14979 exp->expType = exp->op.exp1->expType;
14980 if(exp->op.exp1->expType)
14981 exp->op.exp1->expType->refCount++;
14982 }
14983 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
14984 {
14985 exp->expType = exp->op.exp2->expType;
14986 if(exp->op.exp2->expType)
14987 exp->op.exp2->expType->refCount++;
14988 }
14989 }
14990 }
14991 }
14992 }
14993 else if(type2)
14994 {
14995 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
14996 {
14997 struct Type * oldType = exp->op.exp1->expType;
14998
14999 exp->op.exp1->expType = (((void *)0));
15000 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
15001 FreeType(oldType);
15002 else
15003 exp->op.exp1->expType = oldType;
15004 }
15005 if(exp->op.exp1->destType)
15006 FreeType(exp->op.exp1->destType);
15007 exp->op.exp1->destType = type2;
15008 type2->refCount++;
15009 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
15010 {
15011 if(exp->expType)
15012 FreeType(exp->expType);
15013 exp->expType = exp->op.exp1->destType;
15014 if(exp->op.exp1->destType)
15015 exp->op.exp1->destType->refCount++;
15016 }
15017 }
15018 }
15019 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
15020 {
15021 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
15022 {
15023 if(exp->op.exp1->destType)
15024 FreeType(exp->op.exp1->destType);
15025 exp->op.exp1->destType = type2->_class->registered->dataType;
15026 if(type2->_class->registered->dataType)
15027 type2->_class->registered->dataType->refCount++;
15028 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
15029 }
15030 if(exp->op.op == '!')
15031 {
15032 exp->expType = MkClassType("bool");
15033 exp->expType->truth = 0x1;
15034 }
15035 else
15036 {
15037 exp->expType = type2;
15038 if(type2)
15039 type2->refCount++;
15040 }
15041 }
15042 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
15043 {
15044 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
15045 {
15046 if(exp->op.exp2->destType)
15047 FreeType(exp->op.exp2->destType);
15048 exp->op.exp2->destType = type1->_class->registered->dataType;
15049 if(type1->_class->registered->dataType)
15050 type1->_class->registered->dataType->refCount++;
15051 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
15052 }
15053 exp->expType = type1;
15054 if(type1)
15055 type1->refCount++;
15056 }
15057 }
15058 yylloc = exp->loc;
15059 if(exp->op.exp1 && !exp->op.exp1->expType)
15060 {
15061 char expString[10000];
15062
15063 expString[0] = '\0';
15064 if(inCompiler)
15065 {
15066 PrintExpression(exp->op.exp1, expString);
15067 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15068 }
15069 if(expString[0])
15070 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15071 }
15072 if(exp->op.exp2 && !exp->op.exp2->expType)
15073 {
15074 char expString[10240];
15075
15076 expString[0] = '\0';
15077 if(inCompiler)
15078 {
15079 PrintExpression(exp->op.exp2, expString);
15080 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15081 }
15082 if(expString[0])
15083 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15084 }
15085 if(boolResult)
15086 {
15087 FreeType(exp->expType);
15088 exp->expType = MkClassType("bool");
15089 exp->expType->truth = 0x1;
15090 }
15091 if(exp->op.op != SIZEOF)
15092 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
15093 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
15094 {
15095 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
15096 }
15097 yylloc = oldyylloc;
15098 FreeType(dummy);
15099 if(type2)
15100 FreeType(type2);
15101 break;
15102 }
15103 case 5:
15104 case 32:
15105 {
15106 struct Expression * e;
15107
15108 exp->isConstant = 0x1;
15109 for(e = (*exp->list).first; e; e = e->next)
15110 {
15111 unsigned int inced = 0x0;
15112
15113 if(!e->next)
15114 {
15115 FreeType(e->destType);
15116 e->opDestType = exp->opDestType;
15117 e->destType = exp->destType;
15118 if(e->destType)
15119 {
15120 exp->destType->refCount++;
15121 e->destType->count++;
15122 inced = 0x1;
15123 }
15124 }
15125 ProcessExpressionType(e);
15126 if(inced)
15127 exp->destType->count--;
15128 if(!exp->expType && !e->next)
15129 {
15130 exp->expType = e->expType;
15131 if(e->expType)
15132 e->expType->refCount++;
15133 }
15134 if(!e->isConstant)
15135 exp->isConstant = 0x0;
15136 }
15137 e = (*exp->list).first;
15138 if(!e->next && e->type == 8)
15139 {
15140 struct Expression * next = exp->next, * prev = exp->prev;
15141
15142 FreeType(exp->expType);
15143 FreeType(exp->destType);
15144 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
15145 *exp = *e;
15146 exp->prev = prev;
15147 exp->next = next;
15148 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
15149 ProcessExpressionType(exp);
15150 }
15151 break;
15152 }
15153 case 6:
15154 {
15155 struct Expression * e;
15156
15157 exp->isConstant = 0x1;
15158 ProcessExpressionType(exp->index.exp);
15159 if(!exp->index.exp->isConstant)
15160 exp->isConstant = 0x0;
15161 if(exp->index.exp->expType)
15162 {
15163 struct Type * source = exp->index.exp->expType;
15164
15165 if(source->kind == 8 && source->_class && source->_class->registered)
15166 {
15167 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
15168 struct __ecereNameSpace__ecere__com__Class * c = _class->templateClass ? _class->templateClass : _class;
15169
15170 if(_class != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(c, containerClass) && _class->templateArgs)
15171 {
15172 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
15173 if(exp->index.index && (*exp->index.index).last)
15174 {
15175 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
15176 }
15177 }
15178 }
15179 }
15180 for(e = (*exp->index.index).first; e; e = e->next)
15181 {
15182 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
15183 {
15184 if(e->destType)
15185 FreeType(e->destType);
15186 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
15187 }
15188 ProcessExpressionType(e);
15189 if(!e->next)
15190 {
15191 }
15192 if(!e->isConstant)
15193 exp->isConstant = 0x0;
15194 }
15195 if(!exp->expType)
15196 exp->expType = Dereference(exp->index.exp->expType);
15197 if(exp->expType)
15198 DeclareType(exp->expType, 0x0, 0x0);
15199 break;
15200 }
15201 case 7:
15202 {
15203 struct Expression * e;
15204 struct Type * functionType;
15205 struct Type * methodType = (((void *)0));
15206 char name[1024];
15207
15208 name[0] = '\0';
15209 if(inCompiler)
15210 {
15211 PrintExpression(exp->call.exp, name);
15212 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
15213 {
15214 PrintExpression(exp->call.exp, name);
15215 }
15216 }
15217 if(exp->call.exp->type == 0)
15218 {
15219 struct Expression * idExp = exp->call.exp;
15220 struct Identifier * id = idExp->identifier;
15221
15222 if(!strcmp(id->string, "__builtin_frame_address"))
15223 {
15224 exp->expType = ProcessTypeString("void *", 0x1);
15225 if(exp->call.arguments && (*exp->call.arguments).first)
15226 ProcessExpressionType((*exp->call.arguments).first);
15227 break;
15228 }
15229 else if(!strcmp(id->string, "__ENDIAN_PAD"))
15230 {
15231 exp->expType = ProcessTypeString("int", 0x1);
15232 if(exp->call.arguments && (*exp->call.arguments).first)
15233 ProcessExpressionType((*exp->call.arguments).first);
15234 break;
15235 }
15236 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
15237 {
15238 struct Expression * a = (((void *)0));
15239 struct Expression * b = (((void *)0));
15240 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
15241
15242 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
15243 {
15244 a = (*exp->call.arguments).first;
15245 b = (*exp->call.arguments).last;
15246 tempExp1 = a;
15247 tempExp2 = b;
15248 }
15249 else if((*exp->call.arguments).count == 1)
15250 {
15251 a = (*exp->call.arguments).first;
15252 tempExp1 = a;
15253 }
15254 if(a)
15255 {
15256 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
15257 idExp->identifier = (((void *)0));
15258 FreeExpContents(exp);
15259 ProcessExpressionType(a);
15260 if(b)
15261 ProcessExpressionType(b);
15262 exp->type = 5;
15263 exp->list = MkList();
15264 if(a->expType && (!b || b->expType))
15265 {
15266 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
15267 {
15268 if(inCompiler)
15269 {
15270 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15271 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
15272 struct Declaration * decl;
15273 char temp1[1024], temp2[1024];
15274
15275 GetTypeSpecs(a->expType, specs);
15276 if(a && !a->isConstant && a->type != 0)
15277 {
15278 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
15279 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
15280 tempExp1 = QMkExpId(temp1);
15281 tempExp1->expType = a->expType;
15282 if(a->expType)
15283 a->expType->refCount++;
15284 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
15285 }
15286 if(b && !b->isConstant && b->type != 0)
15287 {
15288 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
15289 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
15290 tempExp2 = QMkExpId(temp2);
15291 tempExp2->expType = b->expType;
15292 if(b->expType)
15293 b->expType->refCount++;
15294 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
15295 }
15296 decl = MkDeclaration(specs, decls);
15297 if(!curCompound->compound.declarations)
15298 curCompound->compound.declarations = MkList();
15299 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
15300 }
15301 }
15302 }
15303 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
15304 {
15305 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
15306
15307 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
15308 exp->expType = a->expType;
15309 if(a->expType)
15310 a->expType->refCount++;
15311 }
15312 else if(!strcmp(id->string, "Abs"))
15313 {
15314 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
15315 exp->expType = a->expType;
15316 if(a->expType)
15317 a->expType->refCount++;
15318 }
15319 else if(!strcmp(id->string, "Sgn"))
15320 {
15321 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"))))));
15322 exp->expType = ProcessTypeString("int", 0x0);
15323 }
15324 FreeExpression(tempExp1);
15325 if(tempExp2)
15326 FreeExpression(tempExp2);
15327 FreeIdentifier(id);
15328 break;
15329 }
15330 }
15331 }
15332 {
15333 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
15334
15335 if(!exp->call.exp->destType)
15336 {
15337 exp->call.exp->destType = dummy;
15338 dummy->refCount++;
15339 }
15340 ProcessExpressionType(exp->call.exp);
15341 if(exp->call.exp->destType == dummy)
15342 {
15343 FreeType(dummy);
15344 exp->call.exp->destType = (((void *)0));
15345 }
15346 FreeType(dummy);
15347 }
15348 functionType = exp->call.exp->expType;
15349 if(functionType && functionType->kind == 16)
15350 {
15351 methodType = functionType;
15352 functionType = methodType->method->dataType;
15353 if(exp->call.exp->expType->usedClass)
15354 {
15355 char typeString[1024];
15356
15357 typeString[0] = '\0';
15358 {
15359 struct Symbol * back = functionType->thisClass;
15360
15361 functionType->thisClass = (((void *)0));
15362 PrintType(functionType, typeString, 0x1, 0x1);
15363 functionType->thisClass = back;
15364 }
15365 if(strstr(typeString, "thisclass"))
15366 {
15367 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15368 struct Declarator * decl;
15369
15370 {
15371 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
15372
15373 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15374 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
15375 thisClassParams = 0x0;
15376 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
15377 {
15378 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
15379
15380 thisClass = exp->call.exp->expType->usedClass;
15381 ProcessDeclarator(decl);
15382 thisClass = backupThisClass;
15383 }
15384 thisClassParams = 0x1;
15385 functionType = ProcessType(specs, decl);
15386 functionType->refCount = 0;
15387 FinishTemplatesContext(context);
15388 }
15389 FreeList(specs, FreeSpecifier);
15390 FreeDeclarator(decl);
15391 }
15392 }
15393 }
15394 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
15395 {
15396 struct Type * type = functionType->type;
15397
15398 if(!functionType->refCount)
15399 {
15400 functionType->type = (((void *)0));
15401 FreeType(functionType);
15402 }
15403 functionType = type;
15404 }
15405 if(functionType && functionType->kind != 11)
15406 {
15407 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "called object %s is not a function\n", (((void *)0))), name);
15408 }
15409 else if(functionType)
15410 {
15411 unsigned int emptyParams = 0x0, noParams = 0x0;
15412 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
15413 struct Type * type = functionType->params.first;
15414 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
15415 int extra = 0;
15416 struct Location oldyylloc = yylloc;
15417
15418 if(!type)
15419 emptyParams = 0x1;
15420 if(functionType->extraParam && e && functionType->thisClass)
15421 {
15422 e->destType = MkClassType(functionType->thisClass->string);
15423 e = e->next;
15424 }
15425 if(!functionType->staticMethod && !functionType->extraParam)
15426 {
15427 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
15428 {
15429 type = MkClassType(memberExp->member.exp->expType->_class->string);
15430 if(e)
15431 {
15432 e->destType = type;
15433 e = e->next;
15434 type = functionType->params.first;
15435 }
15436 else
15437 type->refCount = 0;
15438 }
15439 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
15440 {
15441 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
15442 type->byReference = functionType->byReference;
15443 type->typedByReference = functionType->typedByReference;
15444 if(e)
15445 {
15446 if(e->next && type->kind == 8 && (functionType && functionType->thisClass) && functionType->classObjectType == 2)
15447 e = e->next;
15448 e->destType = type;
15449 e = e->next;
15450 type = functionType->params.first;
15451 }
15452 else
15453 type->refCount = 0;
15454 }
15455 }
15456 if(type && type->kind == 0)
15457 {
15458 noParams = 0x1;
15459 if(!type->refCount)
15460 FreeType(type);
15461 type = (((void *)0));
15462 }
15463 for(; e; e = e->next)
15464 {
15465 if(!type && !emptyParams)
15466 {
15467 yylloc = e->loc;
15468 if(methodType && methodType->methodClass)
15469 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "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);
15470 else
15471 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many arguments for function %s (%d given, expected %d)\n", (((void *)0))), name, (*exp->call.arguments).count, noParams ? 0 : functionType->params.count);
15472 break;
15473 }
15474 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
15475 {
15476 struct Type * templatedType = (((void *)0));
15477 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
15478 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
15479 int id = 0;
15480
15481 if(_class && _class->templateArgs)
15482 {
15483 struct __ecereNameSpace__ecere__com__Class * sClass;
15484
15485 for(sClass = _class; sClass; sClass = sClass->base)
15486 {
15487 if(sClass->templateClass)
15488 sClass = sClass->templateClass;
15489 id = 0;
15490 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
15491 {
15492 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
15493 {
15494 struct __ecereNameSpace__ecere__com__Class * nextClass;
15495
15496 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15497 {
15498 if(nextClass->templateClass)
15499 nextClass = nextClass->templateClass;
15500 id += nextClass->templateParams.count;
15501 }
15502 break;
15503 }
15504 id++;
15505 }
15506 if(curParam)
15507 break;
15508 }
15509 }
15510 if(curParam && _class->templateArgs[id].dataTypeString)
15511 {
15512 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
15513
15514 {
15515 struct Context * context = SetupTemplatesContext(_class);
15516
15517 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
15518 FinishTemplatesContext(context);
15519 }
15520 e->destType = templatedType;
15521 if(templatedType)
15522 {
15523 templatedType->passAsTemplate = 0x1;
15524 }
15525 }
15526 else
15527 {
15528 e->destType = type;
15529 if(type)
15530 type->refCount++;
15531 }
15532 }
15533 else
15534 {
15535 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
15536 {
15537 e->destType = type->prev;
15538 e->destType->refCount++;
15539 }
15540 else
15541 {
15542 e->destType = type;
15543 if(type)
15544 type->refCount++;
15545 }
15546 }
15547 if(type && type->kind != 14)
15548 {
15549 struct Type * next = type->next;
15550
15551 if(!type->refCount)
15552 FreeType(type);
15553 type = next;
15554 }
15555 }
15556 if(type && type->kind != 14)
15557 {
15558 if(methodType && methodType->methodClass)
15559 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "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);
15560 else
15561 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "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);
15562 }
15563 yylloc = oldyylloc;
15564 if(type && !type->refCount)
15565 FreeType(type);
15566 }
15567 else
15568 {
15569 functionType = __extension__ ({
15570 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15571
15572 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
15573 });
15574 if(exp->call.exp->type == 0)
15575 {
15576 char * string = exp->call.exp->identifier->string;
15577
15578 if(inCompiler)
15579 {
15580 struct Symbol * symbol;
15581 struct Location oldyylloc = yylloc;
15582
15583 yylloc = exp->call.exp->identifier->loc;
15584 if(strstr(string, "__builtin_") == string)
15585 {
15586 if(exp->destType)
15587 {
15588 functionType->returnType = exp->destType;
15589 exp->destType->refCount++;
15590 }
15591 }
15592 else
15593 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s undefined; assuming extern returning int\n", (((void *)0))), string);
15594 symbol = __extension__ ({
15595 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
15596
15597 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
15598 });
15599 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
15600 if(strstr(symbol->string, "::"))
15601 globalContext->hasNameSpace = 0x1;
15602 yylloc = oldyylloc;
15603 }
15604 }
15605 else if(exp->call.exp->type == 8)
15606 {
15607 }
15608 else
15609 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "callable object undefined; extern assuming returning int\n", (((void *)0))));
15610 if(!functionType->returnType)
15611 {
15612 functionType->returnType = __extension__ ({
15613 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15614
15615 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
15616 });
15617 }
15618 }
15619 if(functionType && functionType->kind == 11)
15620 {
15621 exp->expType = functionType->returnType;
15622 if(functionType->returnType)
15623 functionType->returnType->refCount++;
15624 if(!functionType->refCount)
15625 FreeType(functionType);
15626 }
15627 if(exp->call.arguments)
15628 {
15629 for(e = (*exp->call.arguments).first; e; e = e->next)
15630 {
15631 struct Type * destType = e->destType;
15632
15633 ProcessExpressionType(e);
15634 }
15635 }
15636 break;
15637 }
15638 case 8:
15639 {
15640 struct Type * type;
15641 struct Location oldyylloc = yylloc;
15642 unsigned int thisPtr;
15643 struct Expression * checkExp = exp->member.exp;
15644
15645 while(checkExp)
15646 {
15647 if(checkExp->type == 11)
15648 checkExp = checkExp->cast.exp;
15649 else if(checkExp->type == 5)
15650 checkExp = checkExp->list ? (*checkExp->list).first : (((void *)0));
15651 else
15652 break;
15653 }
15654 thisPtr = (checkExp && checkExp->type == 0 && !strcmp(checkExp->identifier->string, "this"));
15655 exp->thisPtr = thisPtr;
15656 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
15657 {
15658 exp->member.member->classSym = exp->member.member->_class->symbol;
15659 }
15660 ProcessExpressionType(exp->member.exp);
15661 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)
15662 {
15663 exp->isConstant = 0x0;
15664 }
15665 else
15666 exp->isConstant = exp->member.exp->isConstant;
15667 type = exp->member.exp->expType;
15668 yylloc = exp->loc;
15669 if(type && (type->kind == 20))
15670 {
15671 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
15672 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
15673
15674 if(_class)
15675 {
15676 for(param = _class->templateParams.first; param; param = param->next)
15677 {
15678 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
15679 break;
15680 }
15681 }
15682 if(param && param->defaultArg.member)
15683 {
15684 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
15685
15686 if(argExp)
15687 {
15688 struct Expression * expMember = exp->member.exp;
15689 struct Declarator * decl;
15690 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15691 char thisClassTypeString[1024];
15692
15693 FreeIdentifier(exp->member.member);
15694 ProcessExpressionType(argExp);
15695 {
15696 char * colon = strstr(param->defaultArg.memberString, "::");
15697
15698 if(colon)
15699 {
15700 char className[1024];
15701 struct __ecereNameSpace__ecere__com__Class * sClass;
15702
15703 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
15704 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
15705 }
15706 else
15707 strcpy(thisClassTypeString, _class->fullName);
15708 }
15709 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
15710 exp->expType = ProcessType(specs, decl);
15711 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
15712 {
15713 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
15714 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
15715 int c;
15716 int paramCount = 0;
15717 int lastParam = -1;
15718 char templateString[1024];
15719 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
15720
15721 sprintf(templateString, "%s<", expClass->templateClass->fullName);
15722 for(cClass = expClass; cClass; cClass = cClass->base)
15723 {
15724 int p = 0;
15725
15726 for(param = cClass->templateParams.first; param; param = param->next)
15727 {
15728 int id = p;
15729 struct __ecereNameSpace__ecere__com__Class * sClass;
15730 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
15731
15732 for(sClass = cClass->base; sClass; sClass = sClass->base)
15733 id += sClass->templateParams.count;
15734 arg = expClass->templateArgs[id];
15735 for(sClass = _class; sClass; sClass = sClass->base)
15736 {
15737 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
15738 int p = 0;
15739 struct __ecereNameSpace__ecere__com__Class * nextClass;
15740
15741 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15742 p += nextClass->templateParams.count;
15743 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
15744 {
15745 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
15746 {
15747 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15748 {
15749 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
15750 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
15751 break;
15752 }
15753 }
15754 }
15755 }
15756 {
15757 char argument[256];
15758
15759 argument[0] = '\0';
15760 switch(param->type)
15761 {
15762 case 2:
15763 {
15764 char expString[1024];
15765 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15766 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
15767 struct Expression * exp;
15768 char * string = PrintHexUInt64(arg.expression.ui64);
15769
15770 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
15771 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
15772 ProcessExpressionType(exp);
15773 ComputeExpression(exp);
15774 expString[0] = '\0';
15775 PrintExpression(exp, expString);
15776 strcat(argument, expString);
15777 FreeExpression(exp);
15778 break;
15779 }
15780 case 1:
15781 {
15782 strcat(argument, arg.member->name);
15783 break;
15784 }
15785 case 0:
15786 {
15787 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15788 {
15789 if(!strcmp(arg.dataTypeString, "thisclass"))
15790 strcat(argument, thisClassTypeString);
15791 else
15792 strcat(argument, arg.dataTypeString);
15793 }
15794 break;
15795 }
15796 }
15797 if(argument[0])
15798 {
15799 if(paramCount)
15800 strcat(templateString, ", ");
15801 if(lastParam != p - 1)
15802 {
15803 strcat(templateString, param->name);
15804 strcat(templateString, " = ");
15805 }
15806 strcat(templateString, argument);
15807 paramCount++;
15808 lastParam = p;
15809 }
15810 p++;
15811 }
15812 }
15813 }
15814 {
15815 int len = strlen(templateString);
15816
15817 if(templateString[len - 1] == '>')
15818 templateString[len++] = ' ';
15819 templateString[len++] = '>';
15820 templateString[len++] = '\0';
15821 }
15822 {
15823 struct Context * context = SetupTemplatesContext(_class);
15824
15825 FreeType(exp->expType);
15826 exp->expType = ProcessTypeString(templateString, 0x0);
15827 FinishTemplatesContext(context);
15828 }
15829 }
15830 exp->type = 5;
15831 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")))))))));
15832 }
15833 }
15834 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
15835 {
15836 type = ProcessTemplateParameterType(type->templateParameter);
15837 }
15838 }
15839 if(type && (type->kind == 20))
15840 ;
15841 else if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15 || type->kind == 4 || type->kind == 2 || type->kind == 5 || type->kind == 1 || type->kind == 24 || type->kind == 22 || type->kind == 23 || type->kind == 6 || type->kind == 7 || (type->kind == 13 && type->type->kind == 1)))
15842 {
15843 struct Identifier * id = exp->member.member;
15844 int typeKind = type->kind;
15845 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));
15846
15847 if(typeKind == 19 && exp->member.exp->type == 24)
15848 {
15849 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
15850 typeKind = 8;
15851 }
15852 if(id)
15853 {
15854 if(typeKind == 3 || typeKind == 15)
15855 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
15856 else if(!_class)
15857 {
15858 if(type->kind == 8 && type->_class && type->_class->registered)
15859 {
15860 _class = type->_class->registered;
15861 }
15862 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
15863 {
15864 _class = FindClass("char *")->registered;
15865 }
15866 else if(type->kind == 13)
15867 {
15868 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
15869 FreeType(exp->expType);
15870 exp->expType = ProcessTypeString("uintptr", 0x0);
15871 exp->byReference = 0x1;
15872 }
15873 else
15874 {
15875 char string[1024] = "";
15876 struct Symbol * classSym;
15877
15878 PrintTypeNoConst(type, string, 0x0, 0x1);
15879 classSym = FindClass(string);
15880 if(classSym)
15881 _class = classSym->registered;
15882 }
15883 }
15884 }
15885 if(_class && id)
15886 {
15887 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
15888 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
15889 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15890 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
15891 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
15892
15893 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
15894 exp->member.memberType = 1;
15895 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
15896 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
15897 if(typeKind != 19)
15898 {
15899 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
15900 {
15901 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
15902 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
15903 {
15904 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15905 if(prop)
15906 member = (((void *)0));
15907 }
15908 if(!member && !prop)
15909 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15910 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
15911 exp->member.thisPtr = 0x1;
15912 }
15913 else
15914 {
15915 if(!id->classSym)
15916 {
15917 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
15918 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
15919 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
15920 }
15921 if(!prop && !member)
15922 {
15923 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
15924 if(!method)
15925 {
15926 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15927 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
15928 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
15929 }
15930 }
15931 if(member && prop)
15932 {
15933 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
15934 prop = (((void *)0));
15935 else
15936 member = (((void *)0));
15937 }
15938 }
15939 }
15940 if(!prop && !member && !method)
15941 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
15942 if(!prop && !member && !method)
15943 {
15944 if(typeKind == 19)
15945 {
15946 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
15947 if(classProp)
15948 {
15949 exp->member.memberType = 5;
15950 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
15951 }
15952 else
15953 {
15954 char structName[1024];
15955 struct Identifier * id = exp->member.member;
15956 struct Expression * classExp = exp->member.exp;
15957
15958 type->refCount++;
15959 FreeType(classExp->expType);
15960 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
15961 strcpy(structName, "__ecereClassData_");
15962 FullClassNameCat(structName, type->_class->string, 0x0);
15963 exp->type = 9;
15964 exp->member.member = id;
15965 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"))))))));
15966 FreeType(type);
15967 ProcessExpressionType(exp);
15968 return ;
15969 }
15970 }
15971 else
15972 {
15973 struct Symbol * classSym = FindClass(id->string);
15974
15975 if(classSym)
15976 {
15977 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
15978
15979 if(convertClass)
15980 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
15981 }
15982 }
15983 }
15984 if(prop)
15985 {
15986 exp->member.memberType = 1;
15987 if(!prop->dataType)
15988 ProcessPropertyType(prop);
15989 exp->expType = prop->dataType;
15990 if(prop->dataType)
15991 prop->dataType->refCount++;
15992 }
15993 else if(member)
15994 {
15995 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
15996 {
15997 FreeExpContents(exp);
15998 exp->type = 0;
15999 exp->identifier = MkIdentifier("class");
16000 ProcessExpressionType(exp);
16001 return ;
16002 }
16003 exp->member.memberType = 3;
16004 DeclareStruct(_class->fullName, 0x0);
16005 if(!member->dataType)
16006 {
16007 struct Context * context = SetupTemplatesContext(_class);
16008
16009 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
16010 FinishTemplatesContext(context);
16011 }
16012 exp->expType = member->dataType;
16013 if(member->dataType)
16014 member->dataType->refCount++;
16015 }
16016 else if(revConvert)
16017 {
16018 exp->member.memberType = 4;
16019 exp->expType = MkClassType(revConvert->_class->fullName);
16020 }
16021 else if(method)
16022 {
16023 {
16024 exp->member.memberType = 2;
16025 }
16026 if(!method->dataType)
16027 ProcessMethodType(method);
16028 exp->expType = __extension__ ({
16029 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16030
16031 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
16032 });
16033 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
16034 exp->expType->usedClass = _class;
16035 }
16036 else if(!classProp)
16037 {
16038 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
16039 {
16040 FreeExpContents(exp);
16041 exp->type = 0;
16042 exp->identifier = MkIdentifier("class");
16043 FreeType(exp->expType);
16044 exp->expType = MkClassType("ecere::com::Class");
16045 return ;
16046 }
16047 yylloc = exp->member.member->loc;
16048 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
16049 if(inCompiler)
16050 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
16051 }
16052 if(_class && exp->expType)
16053 {
16054 struct __ecereNameSpace__ecere__com__Class * tClass;
16055
16056 tClass = _class;
16057 while(tClass && !tClass->templateClass)
16058 tClass = tClass->base;
16059 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
16060 {
16061 int id = 0;
16062 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16063 struct __ecereNameSpace__ecere__com__Class * sClass;
16064
16065 for(sClass = tClass; sClass; sClass = sClass->base)
16066 {
16067 id = 0;
16068 if(sClass->templateClass)
16069 sClass = sClass->templateClass;
16070 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16071 {
16072 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
16073 {
16074 for(sClass = sClass->base; sClass; sClass = sClass->base)
16075 id += sClass->templateParams.count;
16076 break;
16077 }
16078 id++;
16079 }
16080 if(curParam)
16081 break;
16082 }
16083 if(curParam && tClass->templateArgs[id].dataTypeString)
16084 {
16085 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16086 struct Context * context = SetupTemplatesContext(tClass);
16087
16088 FreeType(exp->expType);
16089 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
16090 if(exp->expType)
16091 {
16092 if(exp->expType->kind == 21)
16093 {
16094 FreeType(exp->expType);
16095 exp->expType = ReplaceThisClassType(_class);
16096 }
16097 if(tClass->templateClass)
16098 exp->expType->passAsTemplate = 0x1;
16099 if(!exp->destType)
16100 {
16101 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
16102 if(exp->destType->kind == 21)
16103 {
16104 FreeType(exp->destType);
16105 exp->destType = ReplaceThisClassType(_class);
16106 }
16107 }
16108 }
16109 FinishTemplatesContext(context);
16110 }
16111 }
16112 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
16113 {
16114 int id = 0;
16115 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16116 struct __ecereNameSpace__ecere__com__Class * sClass;
16117
16118 for(sClass = tClass; sClass; sClass = sClass->base)
16119 {
16120 id = 0;
16121 if(sClass->templateClass)
16122 sClass = sClass->templateClass;
16123 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16124 {
16125 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
16126 {
16127 for(sClass = sClass->base; sClass; sClass = sClass->base)
16128 id += sClass->templateParams.count;
16129 break;
16130 }
16131 id++;
16132 }
16133 if(curParam)
16134 break;
16135 }
16136 if(curParam)
16137 {
16138 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16139 struct Context * context = SetupTemplatesContext(tClass);
16140 struct Type * basicType;
16141
16142 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
16143 if(basicType)
16144 {
16145 if(basicType->kind == 21)
16146 {
16147 FreeType(basicType);
16148 basicType = ReplaceThisClassType(_class);
16149 }
16150 FreeType(exp->expType);
16151 exp->expType = __extension__ ({
16152 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16153
16154 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
16155 });
16156 if(!exp->destType)
16157 {
16158 exp->destType = exp->expType;
16159 exp->destType->refCount++;
16160 }
16161 {
16162 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16163 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16164 struct Declarator * decl;
16165
16166 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
16167 *newExp = *exp;
16168 if(exp->destType)
16169 exp->destType->refCount++;
16170 if(exp->expType)
16171 exp->expType->refCount++;
16172 exp->type = 11;
16173 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
16174 exp->cast.exp = newExp;
16175 }
16176 }
16177 FinishTemplatesContext(context);
16178 }
16179 }
16180 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
16181 {
16182 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
16183
16184 if(expClass)
16185 {
16186 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
16187 int c;
16188 int p = 0;
16189 int paramCount = 0;
16190 int lastParam = -1;
16191 char templateString[1024];
16192 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
16193
16194 sprintf(templateString, "%s<", expClass->templateClass->fullName);
16195 while(cClass != expClass)
16196 {
16197 struct __ecereNameSpace__ecere__com__Class * sClass;
16198
16199 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
16200 ;
16201 cClass = sClass;
16202 for(param = cClass->templateParams.first; param; param = param->next)
16203 {
16204 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
16205 int c;
16206 int cp = 0;
16207 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
16208 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
16209
16210 while(cClassCur != tClass && !paramCur)
16211 {
16212 struct __ecereNameSpace__ecere__com__Class * sClassCur;
16213
16214 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
16215 ;
16216 cClassCur = sClassCur;
16217 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
16218 {
16219 if(!strcmp(paramCur->name, param->name))
16220 {
16221 break;
16222 }
16223 cp++;
16224 }
16225 }
16226 if(paramCur && paramCur->type == 0)
16227 arg = tClass->templateArgs[cp];
16228 else
16229 arg = expClass->templateArgs[p];
16230 {
16231 char argument[256];
16232
16233 argument[0] = '\0';
16234 switch(param->type)
16235 {
16236 case 2:
16237 {
16238 char expString[1024];
16239 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16240 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
16241 struct Expression * exp;
16242 char * string = PrintHexUInt64(arg.expression.ui64);
16243
16244 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
16245 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
16246 ProcessExpressionType(exp);
16247 ComputeExpression(exp);
16248 expString[0] = '\0';
16249 PrintExpression(exp, expString);
16250 strcat(argument, expString);
16251 FreeExpression(exp);
16252 break;
16253 }
16254 case 1:
16255 {
16256 strcat(argument, arg.member->name);
16257 break;
16258 }
16259 case 0:
16260 {
16261 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
16262 strcat(argument, arg.dataTypeString);
16263 break;
16264 }
16265 }
16266 if(argument[0])
16267 {
16268 if(paramCount)
16269 strcat(templateString, ", ");
16270 if(lastParam != p - 1)
16271 {
16272 strcat(templateString, param->name);
16273 strcat(templateString, " = ");
16274 }
16275 strcat(templateString, argument);
16276 paramCount++;
16277 lastParam = p;
16278 }
16279 }
16280 p++;
16281 }
16282 }
16283 {
16284 int len = strlen(templateString);
16285
16286 if(templateString[len - 1] == '>')
16287 templateString[len++] = ' ';
16288 templateString[len++] = '>';
16289 templateString[len++] = '\0';
16290 }
16291 FreeType(exp->expType);
16292 {
16293 struct Context * context = SetupTemplatesContext(tClass);
16294
16295 exp->expType = ProcessTypeString(templateString, 0x0);
16296 FinishTemplatesContext(context);
16297 }
16298 }
16299 }
16300 }
16301 }
16302 else
16303 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "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)");
16304 }
16305 else if(type && (type->kind == 9 || type->kind == 10))
16306 {
16307 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
16308
16309 if(memberType)
16310 {
16311 exp->expType = memberType;
16312 if(memberType)
16313 memberType->refCount++;
16314 }
16315 }
16316 else
16317 {
16318 char expString[10240];
16319
16320 expString[0] = '\0';
16321 if(inCompiler)
16322 {
16323 PrintExpression(exp, expString);
16324 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16325 }
16326 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "member operator on non-structure type expression %s\n", (((void *)0))), expString);
16327 }
16328 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
16329 {
16330 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
16331 {
16332 struct Identifier * id = exp->member.member;
16333 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));
16334
16335 if(_class)
16336 {
16337 FreeType(exp->expType);
16338 exp->expType = ReplaceThisClassType(_class);
16339 }
16340 }
16341 }
16342 yylloc = oldyylloc;
16343 break;
16344 }
16345 case 9:
16346 {
16347 struct Type * destType = exp->destType;
16348
16349 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
16350 {
16351 exp->member.member->classSym = exp->member.member->_class->symbol;
16352 }
16353 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
16354 exp->type = 8;
16355 if(destType)
16356 destType->count++;
16357 ProcessExpressionType(exp);
16358 if(destType)
16359 destType->count--;
16360 break;
16361 }
16362 case 15:
16363 {
16364 struct Symbol * classSym = exp->_class->symbol;
16365
16366 if(classSym && classSym->registered)
16367 {
16368 if(classSym->registered->type == 5)
16369 {
16370 char name[1024];
16371
16372 name[0] = '\0';
16373 DeclareStruct(classSym->string, 0x0);
16374 FreeSpecifier(exp->_class);
16375 exp->type = 10;
16376 FullClassNameCat(name, classSym->string, 0x0);
16377 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
16378 }
16379 else
16380 {
16381 if(classSym->registered->fixed)
16382 {
16383 FreeSpecifier(exp->_class);
16384 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
16385 exp->type = 2;
16386 }
16387 else
16388 {
16389 char className[1024];
16390
16391 strcpy(className, "__ecereClass_");
16392 FullClassNameCat(className, classSym->string, 0x1);
16393 MangleClassName(className);
16394 DeclareClass(classSym, className);
16395 FreeExpContents(exp);
16396 exp->type = 9;
16397 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
16398 exp->member.member = MkIdentifier("structSize");
16399 }
16400 }
16401 }
16402 exp->expType = __extension__ ({
16403 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16404
16405 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
16406 });
16407 break;
16408 }
16409 case 10:
16410 {
16411 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
16412
16413 exp->expType = __extension__ ({
16414 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16415
16416 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 23, __ecereInstance1;
16417 });
16418 exp->isConstant = 0x1;
16419 DeclareType(type, 0x0, 0x0);
16420 FreeType(type);
16421 break;
16422 }
16423 case 11:
16424 {
16425 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
16426
16427 type->count = 1;
16428 FreeType(exp->cast.exp->destType);
16429 exp->cast.exp->destType = type;
16430 type->refCount++;
16431 ProcessExpressionType(exp->cast.exp);
16432 type->count = 0;
16433 exp->expType = type;
16434 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
16435 {
16436 void * prev = exp->prev, * next = exp->next;
16437 struct Type * expType = exp->cast.exp->destType;
16438 struct Expression * castExp = exp->cast.exp;
16439 struct Type * destType = exp->destType;
16440
16441 if(expType)
16442 expType->refCount++;
16443 FreeType(exp->expType);
16444 FreeTypeName(exp->cast.typeName);
16445 *exp = *castExp;
16446 FreeType(exp->expType);
16447 FreeType(exp->destType);
16448 exp->expType = expType;
16449 exp->destType = destType;
16450 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
16451 exp->prev = prev;
16452 exp->next = next;
16453 }
16454 else
16455 {
16456 exp->isConstant = exp->cast.exp->isConstant;
16457 }
16458 break;
16459 }
16460 case 33:
16461 {
16462 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
16463
16464 exp->expType = type;
16465 break;
16466 }
16467 case 34:
16468 {
16469 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
16470
16471 ProcessExpressionType(exp->vaArg.exp);
16472 exp->expType = type;
16473 break;
16474 }
16475 case 12:
16476 {
16477 struct Expression * e;
16478
16479 exp->isConstant = 0x1;
16480 FreeType(exp->cond.cond->destType);
16481 exp->cond.cond->destType = MkClassType("bool");
16482 exp->cond.cond->destType->truth = 0x1;
16483 ProcessExpressionType(exp->cond.cond);
16484 if(!exp->cond.cond->isConstant)
16485 exp->isConstant = 0x0;
16486 for(e = (*exp->cond.exp).first; e; e = e->next)
16487 {
16488 if(!e->next)
16489 {
16490 FreeType(e->destType);
16491 e->destType = exp->destType;
16492 if(e->destType)
16493 e->destType->refCount++;
16494 }
16495 ProcessExpressionType(e);
16496 if(!e->next)
16497 {
16498 exp->expType = e->expType;
16499 if(e->expType)
16500 e->expType->refCount++;
16501 }
16502 if(!e->isConstant)
16503 exp->isConstant = 0x0;
16504 }
16505 FreeType(exp->cond.elseExp->destType);
16506 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
16507 if(exp->cond.elseExp->destType)
16508 exp->cond.elseExp->destType->refCount++;
16509 ProcessExpressionType(exp->cond.elseExp);
16510 if(!exp->cond.elseExp->isConstant)
16511 exp->isConstant = 0x0;
16512 break;
16513 }
16514 case 23:
16515 {
16516 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
16517 {
16518 struct Statement * last = (*exp->compound->compound.statements).last;
16519
16520 if(last->type == 3 && last->expressions && (*last->expressions).last)
16521 {
16522 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
16523 if(exp->destType)
16524 exp->destType->refCount++;
16525 }
16526 ProcessStatement(exp->compound);
16527 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
16528 if(exp->expType)
16529 exp->expType->refCount++;
16530 }
16531 break;
16532 }
16533 case 24:
16534 {
16535 struct Specifier * spec = (*exp->_classExp.specifiers).first;
16536
16537 if(spec && spec->type == 1)
16538 {
16539 exp->expType = MkClassType(spec->name);
16540 exp->expType->kind = 19;
16541 exp->byReference = 0x1;
16542 }
16543 else
16544 {
16545 exp->expType = MkClassType("ecere::com::Class");
16546 exp->byReference = 0x1;
16547 }
16548 break;
16549 }
16550 case 25:
16551 {
16552 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
16553
16554 if(_class)
16555 {
16556 struct Identifier * id = exp->classData.id;
16557 char structName[1024];
16558 struct Expression * classExp;
16559
16560 strcpy(structName, "__ecereClassData_");
16561 FullClassNameCat(structName, _class->fullName, 0x0);
16562 exp->type = 9;
16563 exp->member.member = id;
16564 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
16565 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
16566 else
16567 classExp = MkExpIdentifier(MkIdentifier("class"));
16568 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"))))))));
16569 ProcessExpressionType(exp);
16570 return ;
16571 }
16572 break;
16573 }
16574 case 35:
16575 {
16576 struct Type * type = (((void *)0));
16577 char * typeString = (((void *)0));
16578 char typeStringBuf[1024];
16579
16580 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))
16581 {
16582 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
16583
16584 typeString = templateClass->templateArgs[2].dataTypeString;
16585 }
16586 else if(exp->list)
16587 {
16588 struct Expression * e;
16589
16590 for(e = (*exp->list).first; e; e = e->next)
16591 {
16592 ProcessExpressionType(e);
16593 if(e->expType)
16594 {
16595 if(!type)
16596 {
16597 type = e->expType;
16598 type->refCount++;
16599 }
16600 else
16601 {
16602 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
16603 {
16604 FreeType(type);
16605 type = e->expType;
16606 e->expType = (((void *)0));
16607 e = (*exp->list).first;
16608 ProcessExpressionType(e);
16609 if(e->expType)
16610 {
16611 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
16612 {
16613 FreeType(e->expType);
16614 e->expType = (((void *)0));
16615 FreeType(type);
16616 type = (((void *)0));
16617 break;
16618 }
16619 }
16620 }
16621 }
16622 if(e->expType)
16623 {
16624 FreeType(e->expType);
16625 e->expType = (((void *)0));
16626 }
16627 }
16628 }
16629 if(type)
16630 {
16631 typeStringBuf[0] = '\0';
16632 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
16633 typeString = typeStringBuf;
16634 FreeType(type);
16635 type = (((void *)0));
16636 }
16637 }
16638 if(typeString)
16639 {
16640 char templateString[1024];
16641 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
16642 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
16643 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16644 struct Expression * expExt;
16645 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
16646
16647 sprintf(templateString, "Container<%s>", typeString);
16648 if(exp->list)
16649 {
16650 struct Expression * e;
16651
16652 type = ProcessTypeString(typeString, 0x0);
16653 while(e = (*exp->list).first)
16654 {
16655 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
16656 e->destType = type;
16657 type->refCount++;
16658 ProcessExpressionType(e);
16659 ListAdd(initializers, MkInitializerAssignment(e));
16660 }
16661 FreeType(type);
16662 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
16663 }
16664 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
16665 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
16666 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16667 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
16668 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16669 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
16670 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16671 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
16672 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16673 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
16674 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16675
16676 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
16677 })));
16678 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16679 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
16680 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16681 exp->expType = ProcessTypeString(templateString, 0x0);
16682 exp->type = 5;
16683 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
16684 ProcessExpressionType(expExt);
16685 }
16686 else
16687 {
16688 exp->expType = ProcessTypeString("Container", 0x0);
16689 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
16690 }
16691 break;
16692 }
16693 }
16694 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
16695 {
16696 FreeType(exp->expType);
16697 exp->expType = ReplaceThisClassType(thisClass);
16698 }
16699 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
16700 {
16701 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
16702
16703 if(symbol)
16704 {
16705 if(exp->expType->kind != 15)
16706 {
16707 struct Type * member;
16708 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
16709
16710 FreeType(exp->expType);
16711 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16712 exp->expType->kind = symbol->type->kind;
16713 exp->expType->refCount++;
16714 exp->expType->enumName = enumName;
16715 exp->expType->members = symbol->type->members;
16716 for(member = symbol->type->members.first; member; member = member->next)
16717 member->refCount++;
16718 }
16719 else
16720 {
16721 struct __ecereNameSpace__ecere__sys__NamedLink * member;
16722
16723 for(member = symbol->type->members.first; member; member = member->next)
16724 {
16725 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
16726
16727 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
16728 }
16729 }
16730 }
16731 }
16732 yylloc = exp->loc;
16733 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
16734 ;
16735 else if(exp->destType && !exp->destType->keepCast)
16736 {
16737 if(!CheckExpressionType(exp, exp->destType, 0x0))
16738 {
16739 if(!exp->destType->count || unresolved)
16740 {
16741 if(!exp->expType)
16742 {
16743 yylloc = exp->loc;
16744 if(exp->destType->kind != 14)
16745 {
16746 char type2[1024];
16747
16748 type2[0] = '\0';
16749 if(inCompiler)
16750 {
16751 char expString[10240];
16752
16753 expString[0] = '\0';
16754 PrintType(exp->destType, type2, 0x0, 0x1);
16755 if(inCompiler)
16756 {
16757 PrintExpression(exp, expString);
16758 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16759 }
16760 if(unresolved)
16761 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
16762 else if(exp->type != 16)
16763 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
16764 }
16765 }
16766 else
16767 {
16768 char expString[10240];
16769
16770 expString[0] = '\0';
16771 if(inCompiler)
16772 {
16773 PrintExpression(exp, expString);
16774 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16775 }
16776 if(unresolved)
16777 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), expString);
16778 else if(exp->type != 16)
16779 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
16780 }
16781 }
16782 else
16783 {
16784 char type1[1024];
16785 char type2[1024];
16786
16787 type1[0] = '\0';
16788 type2[0] = '\0';
16789 if(inCompiler)
16790 {
16791 PrintType(exp->expType, type1, 0x0, 0x1);
16792 PrintType(exp->destType, type2, 0x0, 0x1);
16793 }
16794 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)))
16795 ;
16796 else
16797 {
16798 char expString[10240];
16799
16800 expString[0] = '\0';
16801 if(inCompiler)
16802 {
16803 PrintExpression(exp, expString);
16804 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16805 }
16806 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
16807 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
16808 FreeType(exp->expType);
16809 exp->destType->refCount++;
16810 exp->expType = exp->destType;
16811 }
16812 }
16813 }
16814 }
16815 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
16816 {
16817 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16818 char typeString[1024];
16819 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16820 struct Declarator * decl;
16821
16822 typeString[0] = '\0';
16823 *newExp = *exp;
16824 if(exp->expType)
16825 exp->expType->refCount++;
16826 if(exp->expType)
16827 exp->expType->refCount++;
16828 exp->type = 11;
16829 newExp->destType = exp->expType;
16830 PrintType(exp->expType, typeString, 0x0, 0x0);
16831 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
16832 exp->cast.typeName = MkTypeName(specs, decl);
16833 exp->cast.exp = newExp;
16834 }
16835 }
16836 else if(unresolved)
16837 {
16838 if(exp->identifier->_class && exp->identifier->_class->name)
16839 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
16840 else if(exp->identifier->string && exp->identifier->string[0])
16841 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
16842 }
16843 else if(!exp->expType && exp->type != 16)
16844 {
16845 char expString[10240];
16846
16847 expString[0] = '\0';
16848 if(inCompiler)
16849 {
16850 PrintExpression(exp, expString);
16851 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16852 }
16853 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
16854 }
16855 if(inCompiler)
16856 ApplyAnyObjectLogic(exp);
16857 if(!notByReference && exp->expType && exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 5 && (!exp->destType || (exp->destType->kind != 3 && exp->destType->kind != 4 && exp->destType->kind != 22 && exp->destType->kind != 23 && exp->destType->kind != 5 && exp->destType->kind != 2 && exp->destType->kind != 1 && exp->destType->kind != 24)))
16858 {
16859 exp->byReference = 0x1;
16860 }
16861 yylloc = oldyylloc;
16862 }
16863
16864 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)
16865 {
16866 if(*curMember)
16867 {
16868 *curMember = (*curMember)->next;
16869 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
16870 {
16871 *curMember = subMemberStack[--(*subMemberStackPos)];
16872 *curMember = (*curMember)->next;
16873 }
16874 while((*curMember) && (*curMember)->isProperty)
16875 *curMember = (*curMember)->next;
16876 if(subMemberStackPos)
16877 {
16878 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
16879 {
16880 subMemberStack[(*subMemberStackPos)++] = *curMember;
16881 *curMember = (*curMember)->members.first;
16882 while(*curMember && (*curMember)->isProperty)
16883 *curMember = (*curMember)->next;
16884 }
16885 }
16886 }
16887 while(!*curMember)
16888 {
16889 if(!*curMember)
16890 {
16891 if(subMemberStackPos && *subMemberStackPos)
16892 {
16893 *curMember = subMemberStack[--(*subMemberStackPos)];
16894 *curMember = (*curMember)->next;
16895 }
16896 else
16897 {
16898 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
16899
16900 if(*curClass == _class)
16901 break;
16902 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
16903 ;
16904 *curMember = (*curClass)->membersAndProperties.first;
16905 }
16906 while((*curMember) && (*curMember)->isProperty)
16907 *curMember = (*curMember)->next;
16908 if(subMemberStackPos)
16909 {
16910 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
16911 {
16912 subMemberStack[(*subMemberStackPos)++] = *curMember;
16913 *curMember = (*curMember)->members.first;
16914 while(*curMember && (*curMember)->isProperty)
16915 *curMember = (*curMember)->next;
16916 }
16917 }
16918 }
16919 }
16920 }
16921
16922 static void ProcessInitializer(struct Initializer * init, struct Type * type)
16923 {
16924 switch(init->type)
16925 {
16926 case 0:
16927 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
16928 {
16929 if(init->exp && !init->exp->destType)
16930 {
16931 FreeType(init->exp->destType);
16932 init->exp->destType = type;
16933 if(type)
16934 type->refCount++;
16935 }
16936 if(init->exp)
16937 {
16938 ProcessExpressionType(init->exp);
16939 init->isConstant = init->exp->isConstant;
16940 }
16941 break;
16942 }
16943 else
16944 {
16945 struct Expression * exp = init->exp;
16946 struct Instantiation * inst = exp->instance;
16947 struct MembersInit * members;
16948
16949 init->type = 1;
16950 init->list = MkList();
16951 if(inst->members)
16952 {
16953 for(members = (*inst->members).first; members; members = members->next)
16954 {
16955 if(members->type == 0)
16956 {
16957 struct MemberInit * member;
16958
16959 for(member = (*members->dataMembers).first; member; member = member->next)
16960 {
16961 ListAdd(init->list, member->initializer);
16962 member->initializer = (((void *)0));
16963 }
16964 }
16965 }
16966 }
16967 FreeExpression(exp);
16968 }
16969 case 1:
16970 {
16971 struct Initializer * i;
16972 struct Type * initializerType = (((void *)0));
16973 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
16974 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
16975 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
16976 int subMemberStackPos = 0;
16977
16978 if(type && type->kind == 12)
16979 initializerType = Dereference(type);
16980 else if(type && (type->kind == 9 || type->kind == 10))
16981 initializerType = type->members.first;
16982 for(i = (*init->list).first; i; i = i->next)
16983 {
16984 if(type && type->kind == 8 && type->_class && type->_class->registered)
16985 {
16986 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
16987 if(curMember)
16988 {
16989 if(!curMember->dataType)
16990 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
16991 initializerType = curMember->dataType;
16992 }
16993 }
16994 ProcessInitializer(i, initializerType);
16995 if(initializerType && type && (type->kind == 9 || type->kind == 10))
16996 initializerType = initializerType->next;
16997 if(!i->isConstant)
16998 init->isConstant = 0x0;
16999 }
17000 if(type && type->kind == 12)
17001 FreeType(initializerType);
17002 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
17003 {
17004 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Assigning list initializer to non list\n", (((void *)0))));
17005 }
17006 break;
17007 }
17008 }
17009 }
17010
17011 extern struct Symbol * FindType(struct Context * ctx, char *  name);
17012
17013 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
17014
17015 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
17016 {
17017 switch(spec->type)
17018 {
17019 case 0:
17020 {
17021 if(spec->specifier == THISCLASS)
17022 {
17023 if(thisClass)
17024 {
17025 spec->type = 1;
17026 spec->name = ReplaceThisClass(thisClass);
17027 spec->symbol = FindClass(spec->name);
17028 ProcessSpecifier(spec, declareStruct);
17029 }
17030 }
17031 break;
17032 }
17033 case 1:
17034 {
17035 struct Symbol * symbol = FindType(curContext, spec->name);
17036
17037 if(symbol)
17038 DeclareType(symbol->type, 0x1, 0x1);
17039 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
17040 DeclareStruct(spec->name, 0x0);
17041 break;
17042 }
17043 case 2:
17044 {
17045 struct Enumerator * e;
17046
17047 if(spec->list)
17048 {
17049 for(e = (*spec->list).first; e; e = e->next)
17050 {
17051 if(e->exp)
17052 ProcessExpressionType(e->exp);
17053 }
17054 }
17055 break;
17056 }
17057 case 3:
17058 case 4:
17059 {
17060 if(spec->definitions)
17061 {
17062 struct ClassDef * def;
17063 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
17064
17065 ProcessClass(spec->definitions, symbol);
17066 }
17067 break;
17068 }
17069 }
17070 }
17071
17072 static void ProcessDeclarator(struct Declarator * decl)
17073 {
17074 switch(decl->type)
17075 {
17076 case 1:
17077 if(decl->identifier->classSym)
17078 {
17079 FreeSpecifier(decl->identifier->_class);
17080 decl->identifier->_class = (((void *)0));
17081 }
17082 break;
17083 case 3:
17084 if(decl->array.exp)
17085 ProcessExpressionType(decl->array.exp);
17086 case 0:
17087 case 2:
17088 case 4:
17089 case 5:
17090 case 6:
17091 case 7:
17092 if(decl->declarator)
17093 ProcessDeclarator(decl->declarator);
17094 if(decl->type == 4)
17095 {
17096 struct Identifier * id = GetDeclId(decl);
17097
17098 if(id && id->_class)
17099 {
17100 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
17101
17102 if(!decl->function.parameters)
17103 decl->function.parameters = MkList();
17104 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
17105 id->_class = (((void *)0));
17106 }
17107 if(decl->function.parameters)
17108 {
17109 struct TypeName * param;
17110
17111 for(param = (*decl->function.parameters).first; param; param = param->next)
17112 {
17113 if(param->qualifiers && (*param->qualifiers).first)
17114 {
17115 struct Specifier * spec = (*param->qualifiers).first;
17116
17117 if(spec && spec->specifier == TYPED_OBJECT)
17118 {
17119 struct Declarator * d = param->declarator;
17120 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);
17121
17122 FreeList(param->qualifiers, FreeSpecifier);
17123 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
17124 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
17125 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
17126 param = newParam;
17127 }
17128 else if(spec && spec->specifier == ANY_OBJECT)
17129 {
17130 struct Declarator * d = param->declarator;
17131
17132 FreeList(param->qualifiers, FreeSpecifier);
17133 param->qualifiers = MkListOne(MkSpecifier(VOID));
17134 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
17135 }
17136 else if(spec->specifier == THISCLASS)
17137 {
17138 if(thisClass)
17139 {
17140 spec->type = 1;
17141 spec->name = ReplaceThisClass(thisClass);
17142 spec->symbol = FindClass(spec->name);
17143 ProcessSpecifier(spec, 0x0);
17144 }
17145 }
17146 }
17147 if(param->declarator)
17148 ProcessDeclarator(param->declarator);
17149 }
17150 }
17151 }
17152 break;
17153 }
17154 }
17155
17156 extern struct Identifier * CopyIdentifier(struct Identifier * id);
17157
17158 extern void FreeInitDeclarator(struct InitDeclarator * decl);
17159
17160 static void ProcessDeclaration(struct Declaration * decl)
17161 {
17162 yylloc = decl->loc;
17163 switch(decl->type)
17164 {
17165 case 1:
17166 {
17167 unsigned int declareStruct = 0x0;
17168
17169 if(decl->declarators)
17170 {
17171 struct InitDeclarator * d;
17172
17173 for(d = (*decl->declarators).first; d; d = d->next)
17174 {
17175 struct Type * type, * subType;
17176
17177 ProcessDeclarator(d->declarator);
17178 type = ProcessType(decl->specifiers, d->declarator);
17179 if(d->initializer)
17180 {
17181 ProcessInitializer(d->initializer, type);
17182 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
17183 {
17184 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
17185 {
17186 struct Instantiation * inst = d->initializer->exp->instance;
17187
17188 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
17189 d->initializer->exp->instance = (((void *)0));
17190 if(decl->specifiers)
17191 FreeList(decl->specifiers, FreeSpecifier);
17192 FreeList(decl->declarators, FreeInitDeclarator);
17193 d = (((void *)0));
17194 decl->type = 2;
17195 decl->inst = inst;
17196 }
17197 }
17198 }
17199 for(subType = type; subType; )
17200 {
17201 if(subType->kind == 8)
17202 {
17203 declareStruct = 0x1;
17204 break;
17205 }
17206 else if(subType->kind == 13)
17207 break;
17208 else if(subType->kind == 12)
17209 subType = subType->arrayType;
17210 else
17211 break;
17212 }
17213 FreeType(type);
17214 if(!d)
17215 break;
17216 }
17217 }
17218 if(decl->specifiers)
17219 {
17220 struct Specifier * s;
17221
17222 for(s = (*decl->specifiers).first; s; s = s->next)
17223 {
17224 ProcessSpecifier(s, declareStruct);
17225 }
17226 }
17227 break;
17228 }
17229 case 2:
17230 {
17231 ProcessInstantiationType(decl->inst);
17232 break;
17233 }
17234 case 0:
17235 {
17236 struct Specifier * spec;
17237 struct Declarator * d;
17238 unsigned int declareStruct = 0x0;
17239
17240 if(decl->declarators)
17241 {
17242 for(d = (*decl->declarators).first; d; d = d->next)
17243 {
17244 struct Type * type = ProcessType(decl->specifiers, d->declarator);
17245 struct Type * subType;
17246
17247 ProcessDeclarator(d);
17248 for(subType = type; subType; )
17249 {
17250 if(subType->kind == 8)
17251 {
17252 declareStruct = 0x1;
17253 break;
17254 }
17255 else if(subType->kind == 13)
17256 break;
17257 else if(subType->kind == 12)
17258 subType = subType->arrayType;
17259 else
17260 break;
17261 }
17262 FreeType(type);
17263 }
17264 }
17265 if(decl->specifiers)
17266 {
17267 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
17268 ProcessSpecifier(spec, declareStruct);
17269 }
17270 break;
17271 }
17272 }
17273 }
17274
17275 static struct FunctionDefinition * curFunction;
17276
17277 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
17278 {
17279 char propName[1024], propNameM[1024];
17280 char getName[1024], setName[1024];
17281 struct __ecereNameSpace__ecere__sys__OldList * args;
17282
17283 DeclareProperty(prop, setName, getName);
17284 strcpy(propName, "__ecereProp_");
17285 FullClassNameCat(propName, prop->_class->fullName, 0x0);
17286 strcat(propName, "_");
17287 FullClassNameCat(propName, prop->name, 0x1);
17288 MangleClassName(propName);
17289 strcpy(propNameM, "__ecerePropM_");
17290 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
17291 strcat(propNameM, "_");
17292 FullClassNameCat(propNameM, prop->name, 0x1);
17293 MangleClassName(propNameM);
17294 if(prop->isWatchable)
17295 {
17296 args = MkList();
17297 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17298 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17299 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17300 args = MkList();
17301 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17302 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
17303 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17304 }
17305 {
17306 args = MkList();
17307 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17308 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17309 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
17310 args = MkList();
17311 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17312 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
17313 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireSelfWatchers")), args));
17314 }
17315 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
17316 curFunction->propSet->fireWatchersDone = 0x1;
17317 }
17318
17319 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
17320
17321 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
17322
17323 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
17324
17325 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
17326
17327 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
17328
17329 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
17330
17331 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
17332
17333 extern void FreePropertyWatch(struct PropertyWatch * watcher);
17334
17335 static void ProcessStatement(struct Statement * stmt)
17336 {
17337 yylloc = stmt->loc;
17338 switch(stmt->type)
17339 {
17340 case 0:
17341 ProcessStatement(stmt->labeled.stmt);
17342 break;
17343 case 1:
17344 if(stmt->caseStmt.exp)
17345 {
17346 FreeType(stmt->caseStmt.exp->destType);
17347 stmt->caseStmt.exp->destType = curSwitchType;
17348 if(curSwitchType)
17349 curSwitchType->refCount++;
17350 ProcessExpressionType(stmt->caseStmt.exp);
17351 ComputeExpression(stmt->caseStmt.exp);
17352 }
17353 if(stmt->caseStmt.stmt)
17354 ProcessStatement(stmt->caseStmt.stmt);
17355 break;
17356 case 2:
17357 {
17358 if(stmt->compound.context)
17359 {
17360 struct Declaration * decl;
17361 struct Statement * s;
17362 struct Statement * prevCompound = curCompound;
17363 struct Context * prevContext = curContext;
17364
17365 if(!stmt->compound.isSwitch)
17366 curCompound = stmt;
17367 curContext = stmt->compound.context;
17368 if(stmt->compound.declarations)
17369 {
17370 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
17371 ProcessDeclaration(decl);
17372 }
17373 if(stmt->compound.statements)
17374 {
17375 for(s = (*stmt->compound.statements).first; s; s = s->next)
17376 ProcessStatement(s);
17377 }
17378 curContext = prevContext;
17379 curCompound = prevCompound;
17380 }
17381 break;
17382 }
17383 case 3:
17384 {
17385 struct Expression * exp;
17386
17387 if(stmt->expressions)
17388 {
17389 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17390 ProcessExpressionType(exp);
17391 }
17392 break;
17393 }
17394 case 4:
17395 {
17396 struct Expression * exp;
17397
17398 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
17399 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
17400 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
17401 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
17402 {
17403 ProcessExpressionType(exp);
17404 }
17405 if(stmt->ifStmt.stmt)
17406 ProcessStatement(stmt->ifStmt.stmt);
17407 if(stmt->ifStmt.elseStmt)
17408 ProcessStatement(stmt->ifStmt.elseStmt);
17409 break;
17410 }
17411 case 5:
17412 {
17413 struct Type * oldSwitchType = curSwitchType;
17414
17415 if(stmt->switchStmt.exp)
17416 {
17417 struct Expression * exp;
17418
17419 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
17420 {
17421 if(!exp->next)
17422 {
17423 ProcessExpressionType(exp);
17424 }
17425 if(!exp->next)
17426 curSwitchType = exp->expType;
17427 }
17428 }
17429 ProcessStatement(stmt->switchStmt.stmt);
17430 curSwitchType = oldSwitchType;
17431 break;
17432 }
17433 case 6:
17434 {
17435 if(stmt->whileStmt.exp)
17436 {
17437 struct Expression * exp;
17438
17439 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
17440 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
17441 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
17442 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
17443 {
17444 ProcessExpressionType(exp);
17445 }
17446 }
17447 if(stmt->whileStmt.stmt)
17448 ProcessStatement(stmt->whileStmt.stmt);
17449 break;
17450 }
17451 case 7:
17452 {
17453 if(stmt->doWhile.exp)
17454 {
17455 struct Expression * exp;
17456
17457 if((*stmt->doWhile.exp).last)
17458 {
17459 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
17460 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
17461 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
17462 }
17463 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
17464 {
17465 ProcessExpressionType(exp);
17466 }
17467 }
17468 if(stmt->doWhile.stmt)
17469 ProcessStatement(stmt->doWhile.stmt);
17470 break;
17471 }
17472 case 8:
17473 {
17474 struct Expression * exp;
17475
17476 if(stmt->forStmt.init)
17477 ProcessStatement(stmt->forStmt.init);
17478 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
17479 {
17480 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
17481 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
17482 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
17483 }
17484 if(stmt->forStmt.check)
17485 ProcessStatement(stmt->forStmt.check);
17486 if(stmt->forStmt.increment)
17487 {
17488 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
17489 ProcessExpressionType(exp);
17490 }
17491 if(stmt->forStmt.stmt)
17492 ProcessStatement(stmt->forStmt.stmt);
17493 break;
17494 }
17495 case 18:
17496 {
17497 struct Identifier * id = stmt->forEachStmt.id;
17498 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
17499 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
17500 struct Statement * block = stmt->forEachStmt.stmt;
17501 char iteratorType[1024];
17502 struct Type * source;
17503 struct Expression * e;
17504 unsigned int isBuiltin = exp && (*exp).last && (((struct Expression *)(*exp).last)->type == 35 || (((struct Expression *)(*exp).last)->type == 11 && ((struct Expression *)(*exp).last)->cast.exp->type == 35));
17505 struct Expression * arrayExp;
17506 char * typeString = (((void *)0));
17507 int builtinCount = 0;
17508
17509 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
17510 {
17511 if(!e->next)
17512 {
17513 FreeType(e->destType);
17514 e->destType = ProcessTypeString("Container", 0x0);
17515 }
17516 if(!isBuiltin || e->next)
17517 ProcessExpressionType(e);
17518 }
17519 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
17520 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
17521 {
17522 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
17523 struct Symbol * symbol;
17524 struct Expression * expIt = (((void *)0));
17525 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0;
17526 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
17527 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
17528 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
17529
17530 stmt->type = 2;
17531 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
17532 stmt->compound.context->parent = curContext;
17533 curContext = stmt->compound.context;
17534 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
17535 {
17536 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
17537
17538 isCustomAVLTree = 0x1;
17539 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
17540 isMap = 0x1;
17541 }
17542 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
17543 isArray = 0x1;
17544 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
17545 {
17546 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
17547
17548 isLinkList = 0x1;
17549 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
17550 }
17551 if(isArray)
17552 {
17553 struct Declarator * decl;
17554 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17555
17556 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
17557 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17558 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
17559 }
17560 else if(isBuiltin)
17561 {
17562 struct Type * type = (((void *)0));
17563 char typeStringBuf[1024];
17564
17565 arrayExp = (((struct Expression *)(*exp).last)->type == 35) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
17566 if(((struct Expression *)(*exp).last)->type == 11)
17567 {
17568 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
17569
17570 if(typeName)
17571 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
17572 }
17573 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)
17574 {
17575 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
17576
17577 typeString = templateClass->templateArgs[2].dataTypeString;
17578 }
17579 else if(arrayExp->list)
17580 {
17581 struct Expression * e;
17582
17583 for(e = (*arrayExp->list).first; e; e = e->next)
17584 {
17585 ProcessExpressionType(e);
17586 if(e->expType)
17587 {
17588 if(!type)
17589 {
17590 type = e->expType;
17591 type->refCount++;
17592 }
17593 else
17594 {
17595 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
17596 {
17597 FreeType(type);
17598 type = e->expType;
17599 e->expType = (((void *)0));
17600 e = (*arrayExp->list).first;
17601 ProcessExpressionType(e);
17602 if(e->expType)
17603 {
17604 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
17605 {
17606 FreeType(e->expType);
17607 e->expType = (((void *)0));
17608 FreeType(type);
17609 type = (((void *)0));
17610 break;
17611 }
17612 }
17613 }
17614 }
17615 if(e->expType)
17616 {
17617 FreeType(e->expType);
17618 e->expType = (((void *)0));
17619 }
17620 }
17621 }
17622 if(type)
17623 {
17624 typeStringBuf[0] = '\0';
17625 PrintType(type, typeStringBuf, 0x0, 0x1);
17626 typeString = typeStringBuf;
17627 FreeType(type);
17628 }
17629 }
17630 if(typeString)
17631 {
17632 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
17633 struct Declarator * decl;
17634 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17635
17636 if(arrayExp->list)
17637 {
17638 struct Expression * e;
17639
17640 builtinCount = (*arrayExp->list).count;
17641 type = ProcessTypeString(typeString, 0x0);
17642 while(e = (*arrayExp->list).first)
17643 {
17644 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
17645 e->destType = type;
17646 type->refCount++;
17647 ProcessExpressionType(e);
17648 ListAdd(initializers, MkInitializerAssignment(e));
17649 }
17650 FreeType(type);
17651 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
17652 }
17653 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
17654 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
17655 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
17656 FreeList(exp, FreeExpression);
17657 }
17658 else
17659 {
17660 arrayExp->expType = ProcessTypeString("Container", 0x0);
17661 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
17662 }
17663 }
17664 else if(isLinkList && !isList)
17665 {
17666 struct Declarator * decl;
17667 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17668
17669 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
17670 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17671 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
17672 }
17673 else if(_class->templateArgs)
17674 {
17675 if(isMap)
17676 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
17677 else
17678 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
17679 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
17680 }
17681 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
17682 if(block)
17683 {
17684 switch(block->type)
17685 {
17686 case 2:
17687 if(block->compound.context)
17688 block->compound.context->parent = stmt->compound.context;
17689 break;
17690 case 4:
17691 if(block->ifStmt.stmt && block->ifStmt.stmt->type == 2 && block->ifStmt.stmt->compound.context)
17692 block->ifStmt.stmt->compound.context->parent = stmt->compound.context;
17693 if(block->ifStmt.elseStmt && block->ifStmt.elseStmt->type == 2 && block->ifStmt.elseStmt->compound.context)
17694 block->ifStmt.elseStmt->compound.context->parent = stmt->compound.context;
17695 break;
17696 case 5:
17697 if(block->switchStmt.stmt && block->switchStmt.stmt->type == 2 && block->switchStmt.stmt->compound.context)
17698 block->switchStmt.stmt->compound.context->parent = stmt->compound.context;
17699 break;
17700 case 6:
17701 if(block->whileStmt.stmt && block->whileStmt.stmt->type == 2 && block->whileStmt.stmt->compound.context)
17702 block->whileStmt.stmt->compound.context->parent = stmt->compound.context;
17703 break;
17704 case 7:
17705 if(block->doWhile.stmt && block->doWhile.stmt->type == 2 && block->doWhile.stmt->compound.context)
17706 block->doWhile.stmt->compound.context->parent = stmt->compound.context;
17707 break;
17708 case 8:
17709 if(block->forStmt.stmt && block->forStmt.stmt->type == 2 && block->forStmt.stmt->compound.context)
17710 block->forStmt.stmt->compound.context->parent = stmt->compound.context;
17711 break;
17712 case 18:
17713 if(block->forEachStmt.stmt && block->forEachStmt.stmt->type == 2 && block->forEachStmt.stmt->compound.context)
17714 block->forEachStmt.stmt->compound.context->parent = stmt->compound.context;
17715 break;
17716 }
17717 }
17718 if(filter)
17719 {
17720 block = MkIfStmt(filter, block, (((void *)0)));
17721 }
17722 if(isArray)
17723 {
17724 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));
17725 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17726 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17727 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17728 }
17729 else if(isBuiltin)
17730 {
17731 char count[128];
17732
17733 sprintf(count, "%d", builtinCount);
17734 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));
17735 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17736 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17737 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17738 }
17739 else if(isLinkList && !isList)
17740 {
17741 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
17742 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
17743
17744 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
17745 {
17746 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));
17747 }
17748 else
17749 {
17750 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17751 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
17752
17753 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));
17754 }
17755 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17756 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17757 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17758 }
17759 else
17760 {
17761 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
17762 }
17763 ProcessExpressionType(expIt);
17764 if((*stmt->compound.declarations).first)
17765 ProcessDeclaration((*stmt->compound.declarations).first);
17766 if(symbol)
17767 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
17768 ProcessStatement(stmt);
17769 curContext = stmt->compound.context->parent;
17770 break;
17771 }
17772 else
17773 {
17774 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Expression is not a container\n", (((void *)0))));
17775 }
17776 break;
17777 }
17778 case 9:
17779 break;
17780 case 10:
17781 break;
17782 case 11:
17783 break;
17784 case 12:
17785 {
17786 struct Expression * exp;
17787
17788 if(stmt->expressions)
17789 {
17790 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17791 {
17792 if(!exp->next)
17793 {
17794 if(curFunction && !curFunction->type)
17795 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
17796 FreeType(exp->destType);
17797 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
17798 if(exp->destType)
17799 exp->destType->refCount++;
17800 }
17801 ProcessExpressionType(exp);
17802 }
17803 }
17804 break;
17805 }
17806 case 14:
17807 {
17808 ProcessDeclaration(stmt->decl);
17809 break;
17810 }
17811 case 13:
17812 {
17813 struct AsmField * field;
17814
17815 if(stmt->asmStmt.inputFields)
17816 {
17817 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
17818 if(field->expression)
17819 ProcessExpressionType(field->expression);
17820 }
17821 if(stmt->asmStmt.outputFields)
17822 {
17823 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
17824 if(field->expression)
17825 ProcessExpressionType(field->expression);
17826 }
17827 if(stmt->asmStmt.clobberedFields)
17828 {
17829 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
17830 {
17831 if(field->expression)
17832 ProcessExpressionType(field->expression);
17833 }
17834 }
17835 break;
17836 }
17837 case 17:
17838 {
17839 struct PropertyWatch * propWatch;
17840 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
17841 struct Expression * object = stmt->_watch.object;
17842 struct Expression * watcher = stmt->_watch.watcher;
17843
17844 if(watcher)
17845 ProcessExpressionType(watcher);
17846 if(object)
17847 ProcessExpressionType(object);
17848 if(inCompiler)
17849 {
17850 if(watcher || thisClass)
17851 {
17852 struct External * external = curExternal;
17853 struct Context * context = curContext;
17854
17855 stmt->type = 3;
17856 stmt->expressions = MkList();
17857 curExternal = external->prev;
17858 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
17859 {
17860 struct ClassFunction * func;
17861 char watcherName[1024];
17862 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
17863 struct External * createdExternal;
17864 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
17865
17866 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
17867 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
17868 if(propWatch->deleteWatch)
17869 strcat(watcherName, "_delete");
17870 else
17871 {
17872 struct Identifier * propID;
17873
17874 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
17875 {
17876 strcat(watcherName, "_");
17877 strcat(watcherName, propID->string);
17878 }
17879 }
17880 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
17881 {
17882 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
17883 ProcessClassFunctionBody(func, propWatch->compound);
17884 propWatch->compound = (((void *)0));
17885 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
17886 createdExternal->symbol->idCode = external->symbol->idCode;
17887 curExternal = createdExternal;
17888 ProcessFunction(createdExternal->function);
17889 {
17890 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
17891
17892 externalDecl->declaration = decl;
17893 if(decl->symbol && !decl->symbol->pointerExternal)
17894 decl->symbol->pointerExternal = externalDecl;
17895 }
17896 if(propWatch->deleteWatch)
17897 {
17898 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
17899
17900 ListAdd(args, CopyExpression(object));
17901 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
17902 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
17903 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
17904 }
17905 else
17906 {
17907 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
17908 struct Identifier * propID;
17909
17910 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
17911 {
17912 char propName[1024];
17913 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
17914
17915 if(prop)
17916 {
17917 char getName[1024], setName[1024];
17918 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
17919
17920 DeclareProperty(prop, setName, getName);
17921 strcpy(propName, "__ecereProp_");
17922 FullClassNameCat(propName, prop->_class->fullName, 0x0);
17923 strcat(propName, "_");
17924 FullClassNameCat(propName, prop->name, 0x1);
17925 ListAdd(args, CopyExpression(object));
17926 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17927 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
17928 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
17929 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
17930 }
17931 else
17932 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
17933 }
17934 }
17935 }
17936 else
17937 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid watched object\n", (((void *)0))));
17938 }
17939 curExternal = external;
17940 curContext = context;
17941 if(watcher)
17942 FreeExpression(watcher);
17943 if(object)
17944 FreeExpression(object);
17945 FreeList(watches, FreePropertyWatch);
17946 }
17947 else
17948 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a _class\n", (((void *)0))));
17949 }
17950 else
17951 {
17952 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
17953 {
17954 ProcessStatement(propWatch->compound);
17955 }
17956 }
17957 break;
17958 }
17959 case 15:
17960 {
17961 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
17962 struct Expression * object = stmt->_watch.object;
17963 struct __ecereNameSpace__ecere__com__Class * _class;
17964
17965 if(object)
17966 ProcessExpressionType(object);
17967 if(inCompiler)
17968 {
17969 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
17970 if(_class)
17971 {
17972 struct Identifier * propID;
17973
17974 stmt->type = 3;
17975 stmt->expressions = MkList();
17976 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
17977 {
17978 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
17979 }
17980 else if(!watches)
17981 {
17982 }
17983 if(watches)
17984 {
17985 for(propID = (*watches).first; propID; propID = propID->next)
17986 {
17987 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
17988
17989 if(prop)
17990 {
17991 CreateFireWatcher(prop, object, stmt);
17992 }
17993 else
17994 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
17995 }
17996 }
17997 else
17998 {
17999 struct __ecereNameSpace__ecere__com__Property * prop;
18000 struct __ecereNameSpace__ecere__com__Class * base;
18001
18002 for(base = _class; base; base = base->base)
18003 {
18004 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
18005 {
18006 if(prop->isProperty && prop->isWatchable)
18007 {
18008 CreateFireWatcher(prop, object, stmt);
18009 }
18010 }
18011 }
18012 }
18013 if(object)
18014 FreeExpression(object);
18015 FreeList(watches, FreeIdentifier);
18016 }
18017 else
18018 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18019 }
18020 break;
18021 }
18022 case 16:
18023 {
18024 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
18025 struct Expression * object = stmt->_watch.object;
18026 struct Expression * watcher = stmt->_watch.watcher;
18027 struct __ecereNameSpace__ecere__com__Class * _class;
18028
18029 if(object)
18030 ProcessExpressionType(object);
18031 if(watcher)
18032 ProcessExpressionType(watcher);
18033 if(inCompiler)
18034 {
18035 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
18036 if(watcher || thisClass)
18037 {
18038 if(_class)
18039 {
18040 struct Identifier * propID;
18041
18042 stmt->type = 3;
18043 stmt->expressions = MkList();
18044 if(!watches)
18045 {
18046 struct __ecereNameSpace__ecere__sys__OldList * args;
18047
18048 args = MkList();
18049 ListAdd(args, CopyExpression(object));
18050 ListAdd(args, MkExpConstant("0"));
18051 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18052 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18053 }
18054 else
18055 {
18056 for(propID = (*watches).first; propID; propID = propID->next)
18057 {
18058 char propName[1024];
18059 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
18060
18061 if(prop)
18062 {
18063 char getName[1024], setName[1024];
18064 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
18065
18066 DeclareProperty(prop, setName, getName);
18067 strcpy(propName, "__ecereProp_");
18068 FullClassNameCat(propName, prop->_class->fullName, 0x0);
18069 strcat(propName, "_");
18070 FullClassNameCat(propName, prop->name, 0x1);
18071 MangleClassName(propName);
18072 ListAdd(args, CopyExpression(object));
18073 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
18074 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18075 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18076 }
18077 else
18078 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
18079 }
18080 }
18081 if(object)
18082 FreeExpression(object);
18083 if(watcher)
18084 FreeExpression(watcher);
18085 FreeList(watches, FreeIdentifier);
18086 }
18087 else
18088 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18089 }
18090 else
18091 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a class\n", (((void *)0))));
18092 }
18093 break;
18094 }
18095 }
18096 }
18097
18098 extern struct Expression * QBrackets(struct Expression * exp);
18099
18100 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
18101
18102 extern struct Declarator * QMkPtrDecl(char *  id);
18103
18104 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
18105
18106 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
18107
18108 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
18109
18110 static void ProcessFunction(struct FunctionDefinition * function)
18111 {
18112 struct Identifier * id = GetDeclId(function->declarator);
18113 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
18114 struct Type * type = symbol ? symbol->type : (((void *)0));
18115 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
18116 struct Context * oldTopContext = topContext;
18117
18118 yylloc = function->loc;
18119 if(type && type->thisClass)
18120 {
18121 struct Symbol * classSym = type->thisClass;
18122 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
18123 char className[1024];
18124 char structName[1024];
18125 struct Declarator * funcDecl;
18126 struct Symbol * thisSymbol;
18127 unsigned int typedObject = 0x0;
18128
18129 if(_class && !_class->base)
18130 {
18131 _class = currentClass;
18132 if(_class && !_class->symbol)
18133 _class->symbol = FindClass(_class->fullName);
18134 classSym = _class ? _class->symbol : (((void *)0));
18135 typedObject = 0x1;
18136 }
18137 thisClass = _class;
18138 if(inCompiler && _class)
18139 {
18140 if(type->kind == 11)
18141 {
18142 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
18143 {
18144 struct Type * param = symbol->type->params.first;
18145
18146 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
18147 FreeType(param);
18148 }
18149 if(type->classObjectType != 1)
18150 {
18151 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
18152 symbol->type->staticMethod = 0x1;
18153 symbol->type->thisClass = (((void *)0));
18154 symbol->type->extraParam = 0x0;
18155 }
18156 }
18157 strcpy(className, "__ecereClass_");
18158 FullClassNameCat(className, _class->fullName, 0x1);
18159 MangleClassName(className);
18160 structName[0] = (char)0;
18161 FullClassNameCat(structName, _class->fullName, 0x0);
18162 funcDecl = GetFuncDecl(function->declarator);
18163 if(funcDecl)
18164 {
18165 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18166 {
18167 struct TypeName * param = (*funcDecl->function.parameters).first;
18168
18169 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18170 {
18171 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18172 FreeTypeName(param);
18173 }
18174 }
18175 if(!function->propertyNoThis)
18176 {
18177 struct TypeName * thisParam;
18178
18179 if(type->classObjectType != 1)
18180 {
18181 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18182 if(!funcDecl->function.parameters)
18183 funcDecl->function.parameters = MkList();
18184 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18185 }
18186 if(typedObject)
18187 {
18188 if(type->classObjectType != 1)
18189 {
18190 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
18191 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
18192 }
18193 thisParam = __extension__ ({
18194 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
18195
18196 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
18197 });
18198 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18199 }
18200 }
18201 }
18202 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18203 {
18204 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18205
18206 funcDecl = GetFuncDecl(initDecl->declarator);
18207 if(funcDecl)
18208 {
18209 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18210 {
18211 struct TypeName * param = (*funcDecl->function.parameters).first;
18212
18213 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18214 {
18215 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18216 FreeTypeName(param);
18217 }
18218 }
18219 if(type->classObjectType != 1)
18220 {
18221 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
18222 {
18223 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18224
18225 if(!funcDecl->function.parameters)
18226 funcDecl->function.parameters = MkList();
18227 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18228 }
18229 }
18230 }
18231 }
18232 }
18233 if(function->body)
18234 {
18235 if(type->classObjectType != 1)
18236 {
18237 thisSymbol = __extension__ ({
18238 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18239
18240 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
18241 });
18242 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18243 if(typedObject && thisSymbol->type)
18244 {
18245 thisSymbol->type->classObjectType = 2;
18246 thisSymbol->type->byReference = type->byReference;
18247 thisSymbol->type->typedByReference = type->byReference;
18248 }
18249 }
18250 }
18251 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
18252 {
18253 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
18254
18255 {
18256 struct __ecereNameSpace__ecere__com__Class * base;
18257
18258 for(base = _class; base && base->type != 1000; base = base->next)
18259 {
18260 for(member = base->membersAndProperties.first; member; member = member->next)
18261 if(!member->isProperty)
18262 break;
18263 if(member)
18264 break;
18265 }
18266 }
18267 for(member = _class->membersAndProperties.first; member; member = member->next)
18268 if(!member->isProperty)
18269 break;
18270 if(member)
18271 {
18272 char pointerName[1024];
18273 struct Declaration * decl;
18274 struct Initializer * initializer;
18275 struct Expression * exp, * bytePtr;
18276
18277 strcpy(pointerName, "__ecerePointer_");
18278 FullClassNameCat(pointerName, _class->fullName, 0x0);
18279 {
18280 char className[1024];
18281
18282 strcpy(className, "__ecereClass_");
18283 FullClassNameCat(className, classSym->string, 0x1);
18284 MangleClassName(className);
18285 DeclareClass(classSym, className);
18286 }
18287 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
18288 if(_class->fixed)
18289 {
18290 char string[256];
18291
18292 sprintf(string, "%d", _class->offset);
18293 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
18294 }
18295 else
18296 {
18297 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
18298 }
18299 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
18300 exp->expType = __extension__ ({
18301 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18302
18303 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
18304 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18305
18306 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
18307 }), __ecereInstance2;
18308 });
18309 if(function->body)
18310 {
18311 yylloc = function->body->loc;
18312 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
18313 {
18314 struct Context * prevContext = curContext;
18315
18316 curContext = function->body->compound.context;
18317 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
18318 curContext = prevContext;
18319 }
18320 decl->symbol = (((void *)0));
18321 if(!function->body->compound.declarations)
18322 function->body->compound.declarations = MkList();
18323 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
18324 }
18325 }
18326 }
18327 }
18328 else
18329 thisClass = (((void *)0));
18330 if(id)
18331 {
18332 FreeSpecifier(id->_class);
18333 id->_class = (((void *)0));
18334 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18335 {
18336 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18337
18338 id = GetDeclId(initDecl->declarator);
18339 FreeSpecifier(id->_class);
18340 id->_class = (((void *)0));
18341 }
18342 }
18343 if(function->body)
18344 topContext = function->body->compound.context;
18345 {
18346 struct FunctionDefinition * oldFunction = curFunction;
18347
18348 curFunction = function;
18349 if(function->body)
18350 ProcessStatement(function->body);
18351 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
18352 {
18353 struct Statement * prevCompound = curCompound;
18354 struct Context * prevContext = curContext;
18355 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
18356
18357 if(!function->body->compound.statements)
18358 function->body->compound.statements = MkList();
18359 ListAdd(function->body->compound.statements, fireWatchers);
18360 curCompound = function->body;
18361 curContext = function->body->compound.context;
18362 ProcessStatement(fireWatchers);
18363 curContext = prevContext;
18364 curCompound = prevCompound;
18365 }
18366 curFunction = oldFunction;
18367 }
18368 if(function->declarator)
18369 {
18370 ProcessDeclarator(function->declarator);
18371 }
18372 topContext = oldTopContext;
18373 thisClass = oldThisClass;
18374 }
18375
18376 extern void FreeSymbol(struct Symbol * symbol);
18377
18378 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
18379
18380 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
18381 {
18382 struct ClassDef * def;
18383 struct External * external = curExternal;
18384 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
18385
18386 for(def = definitions->first; def; def = def->next)
18387 {
18388 if(def->type == 0)
18389 {
18390 if(def->function->declarator)
18391 curExternal = def->function->declarator->symbol->pointerExternal;
18392 else
18393 curExternal = external;
18394 ProcessFunction((struct FunctionDefinition *)def->function);
18395 }
18396 else if(def->type == 2)
18397 {
18398 if(def->decl->type == 2)
18399 {
18400 thisClass = regClass;
18401 ProcessInstantiationType(def->decl->inst);
18402 thisClass = (((void *)0));
18403 }
18404 else
18405 {
18406 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
18407
18408 if(regClass)
18409 thisClass = regClass;
18410 ProcessDeclaration(def->decl);
18411 thisClass = backThisClass;
18412 }
18413 }
18414 else if(def->type == 1 && def->defProperties)
18415 {
18416 struct MemberInit * defProperty;
18417 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);
18418
18419 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18420 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
18421 {
18422 thisClass = regClass;
18423 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
18424 thisClass = (((void *)0));
18425 }
18426 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18427 FreeSymbol(thisSymbol);
18428 }
18429 else if(def->type == 3 && def->propertyDef)
18430 {
18431 struct PropertyDef * prop = def->propertyDef;
18432
18433 thisClass = regClass;
18434 if(prop->setStmt)
18435 {
18436 if(regClass)
18437 {
18438 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18439
18440 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18441 }
18442 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
18443 ProcessStatement(prop->setStmt);
18444 }
18445 if(prop->getStmt)
18446 {
18447 if(regClass)
18448 {
18449 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18450
18451 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18452 }
18453 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
18454 ProcessStatement(prop->getStmt);
18455 }
18456 if(prop->issetStmt)
18457 {
18458 if(regClass)
18459 {
18460 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18461
18462 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18463 }
18464 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
18465 ProcessStatement(prop->issetStmt);
18466 }
18467 thisClass = (((void *)0));
18468 }
18469 else if(def->type == 4 && def->propertyWatch)
18470 {
18471 struct PropertyWatch * propertyWatch = def->propertyWatch;
18472
18473 thisClass = regClass;
18474 if(propertyWatch->compound)
18475 {
18476 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);
18477
18478 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18479 curExternal = (((void *)0));
18480 ProcessStatement(propertyWatch->compound);
18481 }
18482 thisClass = (((void *)0));
18483 }
18484 }
18485 }
18486
18487 void DeclareFunctionUtil(char * s)
18488 {
18489 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
18490
18491 if(function)
18492 {
18493 char name[1024];
18494
18495 name[0] = (char)0;
18496 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
18497 strcpy(name, "__ecereFunction_");
18498 FullClassNameCat(name, s, 0x0);
18499 DeclareFunction(function, name);
18500 }
18501 }
18502
18503 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
18504
18505 void ComputeDataTypes()
18506 {
18507 struct External * external;
18508 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
18509 struct External * after = (((void *)0));
18510
18511 currentClass = (((void *)0));
18512 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
18513 for(external = (*ast).first; external; external = external->next)
18514 {
18515 if(external->type == 1)
18516 {
18517 struct Declaration * decl = external->declaration;
18518
18519 if(decl)
18520 {
18521 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
18522
18523 if(decls)
18524 {
18525 struct InitDeclarator * initDecl = (*decls).first;
18526
18527 if(initDecl)
18528 {
18529 struct Declarator * declarator = initDecl->declarator;
18530
18531 if(declarator && declarator->type == 1)
18532 {
18533 struct Identifier * id = declarator->identifier;
18534
18535 if(id && id->string)
18536 {
18537 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
18538 {
18539 external->symbol->id = -1001, external->symbol->idCode = -1001;
18540 after = external;
18541 }
18542 }
18543 }
18544 }
18545 }
18546 }
18547 }
18548 }
18549 temp->symbol = __extension__ ({
18550 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18551
18552 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
18553 });
18554 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
18555 curExternal = temp;
18556 DeclareFunctionUtil("eSystem_New");
18557 DeclareFunctionUtil("eSystem_New0");
18558 DeclareFunctionUtil("eSystem_Renew");
18559 DeclareFunctionUtil("eSystem_Renew0");
18560 DeclareFunctionUtil("eSystem_Delete");
18561 DeclareFunctionUtil("eClass_GetProperty");
18562 DeclareFunctionUtil("eClass_SetProperty");
18563 DeclareFunctionUtil("eInstance_FireSelfWatchers");
18564 DeclareFunctionUtil("eInstance_SetMethod");
18565 DeclareFunctionUtil("eInstance_IncRef");
18566 DeclareFunctionUtil("eInstance_StopWatching");
18567 DeclareFunctionUtil("eInstance_Watch");
18568 DeclareFunctionUtil("eInstance_FireWatchers");
18569 DeclareStruct("ecere::com::Class", 0x0);
18570 DeclareStruct("ecere::com::Instance", 0x0);
18571 DeclareStruct("ecere::com::Property", 0x0);
18572 DeclareStruct("ecere::com::DataMember", 0x0);
18573 DeclareStruct("ecere::com::Method", 0x0);
18574 DeclareStruct("ecere::com::SerialBuffer", 0x0);
18575 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
18576 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
18577 for(external = (*ast).first; external; external = external->next)
18578 {
18579 afterExternal = curExternal = external;
18580 if(external->type == 0)
18581 {
18582 currentClass = external->function->_class;
18583 ProcessFunction(external->function);
18584 }
18585 else if(external->type == 1)
18586 {
18587 currentClass = (((void *)0));
18588 if(external->declaration)
18589 ProcessDeclaration(external->declaration);
18590 }
18591 else if(external->type == 2)
18592 {
18593 struct ClassDefinition * _class = external->_class;
18594
18595 currentClass = external->symbol->registered;
18596 if(_class->definitions)
18597 {
18598 ProcessClass(_class->definitions, _class->symbol);
18599 }
18600 if(inCompiler)
18601 {
18602 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
18603 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor((void *)external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
18604 }
18605 }
18606 else if(external->type == 4)
18607 {
18608 thisNameSpace = external->id->string;
18609 }
18610 }
18611 currentClass = (((void *)0));
18612 thisNameSpace = (((void *)0));
18613 curExternal = (((void *)0));
18614 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor((void *)temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
18615 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor((void *)temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
18616 }
18617
18618 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);
18619
18620 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_RegisterClass(int type, char *  name, char *  baseName, int size, int sizeClass, unsigned int (*  Constructor)(void * ), void (*  Destructor)(void * ), struct __ecereNameSpace__ecere__com__Instance * module, int declMode, int inheritanceAccess);
18621
18622 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
18623
18624 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18625 {
18626 struct __ecereNameSpace__ecere__com__Class * class;
18627
18628 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
18629 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
18630 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
18631 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
18632 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
18633 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
18634 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
18635 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
18636 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
18637 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
18638 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
18639 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
18640 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
18641 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
18642 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
18643 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
18644 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
18645 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
18646 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt", "bool GetOpInt(Operand op2, int * value2)", GetOpInt, module, 1);
18647 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
18648 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt", "bool GetOpUInt(Operand op2, uint * value2)", GetOpUInt, module, 1);
18649 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
18650 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt64", "bool GetOpInt64(Operand op2, int64 * value2)", GetOpInt64, module, 1);
18651 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
18652 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt64", "bool GetOpUInt64(Operand op2, uint64 * value2)", GetOpUInt64, module, 1);
18653 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
18654 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntPtr", "bool GetOpIntPtr(Operand op2, intptr * value2)", GetOpIntPtr, module, 1);
18655 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
18656 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntPtr", "bool GetOpUIntPtr(Operand op2, uintptr * value2)", GetOpUIntPtr, module, 1);
18657 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
18658 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntSize", "bool GetOpIntSize(Operand op2, intsize * value2)", GetOpIntSize, module, 1);
18659 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
18660 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntSize", "bool GetOpUIntSize(Operand op2, uintsize * value2)", GetOpUIntSize, module, 1);
18661 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
18662 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpShort", "bool GetOpShort(Operand op2, short * value2)", GetOpShort, module, 1);
18663 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
18664 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUShort", "bool GetOpUShort(Operand op2, uint16 * value2)", GetOpUShort, module, 1);
18665 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
18666 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpChar", "bool GetOpChar(Operand op2, char * value2)", GetOpChar, module, 1);
18667 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
18668 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUChar", "bool GetOpUChar(Operand op2, byte * value2)", GetOpUChar, module, 1);
18669 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
18670 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpFloat", "bool GetOpFloat(Operand op2, float * value2)", GetOpFloat, module, 1);
18671 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
18672 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpDouble", "bool GetOpDouble(Operand op2, double * value2)", GetOpDouble, module, 1);
18673 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
18674 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
18675 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
18676 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
18677 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("AddMembers", "int AddMembers(ecere::sys::OldList * declarations, ecere::com::Class _class, bool isMember, uint * retSize, ecere::com::Class topClass, bool * addedPadding)", AddMembers, module, 2);
18678 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
18679 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
18680 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
18681 __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);
18682 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
18683 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
18684 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
18685 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
18686 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
18687 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
18688 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
18689 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
18690 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
18691 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
18692 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
18693 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
18694 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
18695 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
18696 __ecereClass_Conversion = class;
18697 __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);
18698 __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);
18699 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
18700 __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);
18701 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
18702 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
18703 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("UnescapeString", "int UnescapeString(char * d, char * s, int len)", UnescapeString, module, 1);
18704 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OffsetEscapedString", "char * OffsetEscapedString(char * s, int len, int offset)", OffsetEscapedString, module, 1);
18705 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
18706 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
18707 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
18708 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
18709 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
18710 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
18711 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
18712 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
18713 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
18714 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
18715 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetParseError", "bool GetParseError(void)", GetParseError, module, 1);
18716 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
18717 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
18718 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
18719 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
18720 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
18721 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
18722 }
18723
18724 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18725 {
18726
18727 }
18728