compiler/libec: (#341, #351, #644, #771) Improved enum type matching and type handlin...
[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 } __attribute__ ((gcc_struct));
356
357 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataValue;
358
359 struct __ecereNameSpace__ecere__com__DataValue
360 {
361 union
362 {
363 char c;
364 unsigned char uc;
365 short s;
366 unsigned short us;
367 int i;
368 unsigned int ui;
369 void *  p;
370 float f;
371 double d;
372 long long i64;
373 uint64 ui64;
374 } __attribute__ ((gcc_struct));
375 } __attribute__ ((gcc_struct));
376
377 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Expression;
378
379 struct Expression
380 {
381 struct Expression * prev;
382 struct Expression * next;
383 struct Location loc;
384 int type;
385 union
386 {
387 struct
388 {
389 char *  constant;
390 struct Identifier * identifier;
391 } __attribute__ ((gcc_struct));
392 struct Statement * compound;
393 struct Instantiation * instance;
394 struct
395 {
396 char *  string;
397 unsigned int intlString;
398 } __attribute__ ((gcc_struct));
399 struct __ecereNameSpace__ecere__sys__OldList *  list;
400 struct
401 {
402 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
403 struct Declarator * decl;
404 } __attribute__ ((gcc_struct)) _classExp;
405 struct
406 {
407 struct Identifier * id;
408 } __attribute__ ((gcc_struct)) classData;
409 struct
410 {
411 struct Expression * exp;
412 struct __ecereNameSpace__ecere__sys__OldList * arguments;
413 struct Location argLoc;
414 } __attribute__ ((gcc_struct)) call;
415 struct
416 {
417 struct Expression * exp;
418 struct __ecereNameSpace__ecere__sys__OldList * index;
419 } __attribute__ ((gcc_struct)) index;
420 struct
421 {
422 struct Expression * exp;
423 struct Identifier * member;
424 int memberType;
425 unsigned int thisPtr;
426 } __attribute__ ((gcc_struct)) member;
427 struct
428 {
429 int op;
430 struct Expression * exp1;
431 struct Expression * exp2;
432 } __attribute__ ((gcc_struct)) op;
433 struct TypeName * typeName;
434 struct Specifier * _class;
435 struct
436 {
437 struct TypeName * typeName;
438 struct Expression * exp;
439 } __attribute__ ((gcc_struct)) cast;
440 struct
441 {
442 struct Expression * cond;
443 struct __ecereNameSpace__ecere__sys__OldList * exp;
444 struct Expression * elseExp;
445 } __attribute__ ((gcc_struct)) cond;
446 struct
447 {
448 struct TypeName * typeName;
449 struct Expression * size;
450 } __attribute__ ((gcc_struct)) _new;
451 struct
452 {
453 struct TypeName * typeName;
454 struct Expression * size;
455 struct Expression * exp;
456 } __attribute__ ((gcc_struct)) _renew;
457 struct
458 {
459 char * table;
460 struct Identifier * id;
461 } __attribute__ ((gcc_struct)) db;
462 struct
463 {
464 struct Expression * ds;
465 struct Expression * name;
466 } __attribute__ ((gcc_struct)) dbopen;
467 struct
468 {
469 struct TypeName * typeName;
470 struct Initializer * initializer;
471 } __attribute__ ((gcc_struct)) initializer;
472 struct
473 {
474 struct Expression * exp;
475 struct TypeName * typeName;
476 } __attribute__ ((gcc_struct)) vaArg;
477 } __attribute__ ((gcc_struct));
478 unsigned int debugValue;
479 struct __ecereNameSpace__ecere__com__DataValue val;
480 uint64 address;
481 unsigned int hasAddress;
482 struct Type * expType;
483 struct Type * destType;
484 unsigned int usage;
485 int tempCount;
486 unsigned int byReference;
487 unsigned int isConstant;
488 unsigned int addedThis;
489 unsigned int needCast;
490 unsigned int thisPtr;
491 unsigned int opDestType;
492 } __attribute__ ((gcc_struct));
493
494 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateDatatype;
495
496 struct TemplateDatatype
497 {
498 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
499 struct Declarator * decl;
500 } __attribute__ ((gcc_struct));
501
502 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateArgument;
503
504 struct TemplateArgument;
505
506 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplateParameter;
507
508 struct TemplateParameter
509 {
510 struct TemplateParameter * prev;
511 struct TemplateParameter * next;
512 struct Location loc;
513 int type;
514 struct Identifier * identifier;
515 union
516 {
517 struct TemplateDatatype * dataType;
518 int memberType;
519 } __attribute__ ((gcc_struct));
520 struct TemplateArgument * defaultArgument;
521 char *  dataTypeString;
522 struct Type * baseType;
523 } __attribute__ ((gcc_struct));
524
525 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Specifier;
526
527 struct Specifier
528 {
529 struct Specifier * prev;
530 struct Specifier * next;
531 struct Location loc;
532 int type;
533 union
534 {
535 int specifier;
536 struct
537 {
538 struct ExtDecl * extDecl;
539 char *  name;
540 struct Symbol * symbol;
541 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
542 } __attribute__ ((gcc_struct));
543 struct
544 {
545 struct Identifier * id;
546 struct __ecereNameSpace__ecere__sys__OldList *  list;
547 struct __ecereNameSpace__ecere__sys__OldList *  baseSpecs;
548 struct __ecereNameSpace__ecere__sys__OldList *  definitions;
549 unsigned int addNameSpace;
550 struct Context * ctx;
551 struct ExtDecl * extDeclStruct;
552 } __attribute__ ((gcc_struct));
553 struct Expression * expression;
554 struct Specifier * _class;
555 struct TemplateParameter * templateParameter;
556 } __attribute__ ((gcc_struct));
557 } __attribute__ ((gcc_struct));
558
559 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Identifier;
560
561 struct Identifier
562 {
563 struct Identifier * prev;
564 struct Identifier * next;
565 struct Location loc;
566 struct Symbol * classSym;
567 struct Specifier * _class;
568 char *  string;
569 struct Identifier * badID;
570 } __attribute__ ((gcc_struct));
571
572 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Pointer;
573
574 struct Pointer;
575
576 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Declarator;
577
578 struct Declarator
579 {
580 struct Declarator * prev;
581 struct Declarator * next;
582 struct Location loc;
583 int type;
584 struct Symbol * symbol;
585 struct Declarator * declarator;
586 union
587 {
588 struct Identifier * identifier;
589 struct
590 {
591 struct Expression * exp;
592 struct Expression * posExp;
593 struct Attrib * attrib;
594 } __attribute__ ((gcc_struct)) structDecl;
595 struct
596 {
597 struct Expression * exp;
598 struct Specifier * enumClass;
599 } __attribute__ ((gcc_struct)) array;
600 struct
601 {
602 struct __ecereNameSpace__ecere__sys__OldList * parameters;
603 } __attribute__ ((gcc_struct)) function;
604 struct
605 {
606 struct Pointer * pointer;
607 } __attribute__ ((gcc_struct)) pointer;
608 struct
609 {
610 struct ExtDecl * extended;
611 } __attribute__ ((gcc_struct)) extended;
612 } __attribute__ ((gcc_struct));
613 } __attribute__ ((gcc_struct));
614
615 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionDefinition;
616
617 struct FunctionDefinition
618 {
619 struct FunctionDefinition * prev;
620 struct FunctionDefinition * next;
621 struct Location loc;
622 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
623 struct Declarator * declarator;
624 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
625 struct Statement * body;
626 struct __ecereNameSpace__ecere__com__Class * _class;
627 struct __ecereNameSpace__ecere__sys__OldList attached;
628 int declMode;
629 struct Type * type;
630 struct Symbol * propSet;
631 int tempCount;
632 unsigned int propertyNoThis;
633 } __attribute__ ((gcc_struct));
634
635 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableDef;
636
637 struct DBTableDef;
638
639 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_External;
640
641 struct External
642 {
643 struct External * prev;
644 struct External * next;
645 struct Location loc;
646 int type;
647 struct Symbol * symbol;
648 union
649 {
650 struct FunctionDefinition * function;
651 struct ClassDefinition * _class;
652 struct Declaration * declaration;
653 char *  importString;
654 struct Identifier * id;
655 struct DBTableDef * table;
656 } __attribute__ ((gcc_struct));
657 int importType;
658 } __attribute__ ((gcc_struct));
659
660 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ModuleImport;
661
662 struct ModuleImport
663 {
664 struct ModuleImport * prev;
665 struct ModuleImport * next;
666 char *  name;
667 struct __ecereNameSpace__ecere__sys__OldList classes;
668 struct __ecereNameSpace__ecere__sys__OldList functions;
669 int importType;
670 int importAccess;
671 } __attribute__ ((gcc_struct));
672
673 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassImport;
674
675 struct ClassImport
676 {
677 struct ClassImport * prev;
678 struct ClassImport * next;
679 char *  name;
680 struct __ecereNameSpace__ecere__sys__OldList methods;
681 struct __ecereNameSpace__ecere__sys__OldList properties;
682 unsigned int itself;
683 int isRemote;
684 } __attribute__ ((gcc_struct));
685
686 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Symbol;
687
688 struct Symbol
689 {
690 char *  string;
691 struct Symbol * parent;
692 struct Symbol * left;
693 struct Symbol * right;
694 int depth;
695 struct Type * type;
696 union
697 {
698 struct __ecereNameSpace__ecere__com__Method * method;
699 struct __ecereNameSpace__ecere__com__Property * _property;
700 struct __ecereNameSpace__ecere__com__Class * registered;
701 } __attribute__ ((gcc_struct));
702 int id;
703 int idCode;
704 union
705 {
706 struct
707 {
708 struct External * pointerExternal;
709 struct External * structExternal;
710 } __attribute__ ((gcc_struct));
711 struct
712 {
713 struct External * externalGet;
714 struct External * externalSet;
715 struct External * externalPtr;
716 struct External * externalIsSet;
717 } __attribute__ ((gcc_struct));
718 struct
719 {
720 struct External * methodExternal;
721 struct External * methodCodeExternal;
722 } __attribute__ ((gcc_struct));
723 } __attribute__ ((gcc_struct));
724 unsigned int imported;
725 unsigned int declaredStructSym;
726 struct __ecereNameSpace__ecere__com__Class * _class;
727 unsigned int declaredStruct;
728 unsigned int needConstructor;
729 unsigned int needDestructor;
730 char *  constructorName;
731 char *  structName;
732 char *  className;
733 char *  destructorName;
734 struct ModuleImport * module;
735 struct ClassImport * _import;
736 struct Location nameLoc;
737 unsigned int isParam;
738 unsigned int isRemote;
739 unsigned int isStruct;
740 unsigned int fireWatchersDone;
741 int declaring;
742 unsigned int classData;
743 unsigned int isStatic;
744 char *  shortName;
745 struct __ecereNameSpace__ecere__sys__OldList *  templateParams;
746 struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
747 struct Context * ctx;
748 int isIterator;
749 struct Expression * propCategory;
750 } __attribute__ ((gcc_struct));
751
752 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Type;
753
754 struct Type
755 {
756 struct Type * prev;
757 struct Type * next;
758 int refCount;
759 union
760 {
761 struct Symbol * _class;
762 struct
763 {
764 struct __ecereNameSpace__ecere__sys__OldList members;
765 char *  enumName;
766 } __attribute__ ((gcc_struct));
767 struct
768 {
769 struct Type * returnType;
770 struct __ecereNameSpace__ecere__sys__OldList params;
771 struct Symbol * thisClass;
772 unsigned int staticMethod;
773 struct TemplateParameter * thisClassTemplate;
774 } __attribute__ ((gcc_struct));
775 struct
776 {
777 struct __ecereNameSpace__ecere__com__Method * method;
778 struct __ecereNameSpace__ecere__com__Class * methodClass;
779 struct __ecereNameSpace__ecere__com__Class * usedClass;
780 } __attribute__ ((gcc_struct));
781 struct
782 {
783 struct Type * arrayType;
784 int arraySize;
785 struct Expression * arraySizeExp;
786 unsigned int freeExp;
787 struct Symbol * enumClass;
788 } __attribute__ ((gcc_struct));
789 struct Type * type;
790 struct TemplateParameter * templateParameter;
791 } __attribute__ ((gcc_struct));
792 int kind;
793 unsigned int size;
794 char *  name;
795 char *  typeName;
796 int classObjectType;
797 int alignment;
798 unsigned int offset;
799 int bitFieldCount;
800 int count;
801 unsigned int isSigned : 1;
802 unsigned int constant : 1;
803 unsigned int truth : 1;
804 unsigned int byReference : 1;
805 unsigned int extraParam : 1;
806 unsigned int directClassAccess : 1;
807 unsigned int computing : 1;
808 unsigned int keepCast : 1;
809 unsigned int passAsTemplate : 1;
810 unsigned int dllExport : 1;
811 unsigned int attrStdcall : 1;
812 unsigned int declaredWithStruct : 1;
813 unsigned int typedByReference : 1;
814 } __attribute__ ((gcc_struct));
815
816 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Class;
817
818 struct __ecereNameSpace__ecere__com__Class
819 {
820 struct __ecereNameSpace__ecere__com__Class * prev;
821 struct __ecereNameSpace__ecere__com__Class * next;
822 char *  name;
823 int offset;
824 int structSize;
825 int (* *  _vTbl)();
826 int vTblSize;
827 int (*  Constructor)(struct __ecereNameSpace__ecere__com__Instance *);
828 void (*  Destructor)(struct __ecereNameSpace__ecere__com__Instance *);
829 int offsetClass;
830 int sizeClass;
831 struct __ecereNameSpace__ecere__com__Class * base;
832 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
833 struct __ecereNameSpace__ecere__sys__BinaryTree members;
834 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
835 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
836 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
837 struct __ecereNameSpace__ecere__sys__OldList derivatives;
838 int memberID;
839 int startMemberID;
840 int type;
841 struct __ecereNameSpace__ecere__com__Instance * module;
842 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
843 char *  dataTypeString;
844 struct Type * dataType;
845 int typeSize;
846 int defaultAlignment;
847 void (*  Initialize)();
848 int memberOffset;
849 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
850 char *  designerClass;
851 unsigned int noExpansion;
852 char *  defaultProperty;
853 unsigned int comRedefinition;
854 int count;
855 int isRemote;
856 unsigned int internalDecl;
857 void *  data;
858 unsigned int computeSize;
859 int structAlignment;
860 int destructionWatchOffset;
861 unsigned int fixed;
862 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
863 int inheritanceAccess;
864 char *  fullName;
865 void *  symbol;
866 struct __ecereNameSpace__ecere__sys__OldList conversions;
867 struct __ecereNameSpace__ecere__sys__OldList templateParams;
868 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
869 struct __ecereNameSpace__ecere__com__Class * templateClass;
870 struct __ecereNameSpace__ecere__sys__OldList templatized;
871 int numParams;
872 unsigned int isInstanceClass;
873 unsigned int byValueSystemClass;
874 } __attribute__ ((gcc_struct));
875
876 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
877
878 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
879
880 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Instance;
881
882 struct __ecereNameSpace__ecere__com__Instance
883 {
884 int (* *  _vTbl)();
885 struct __ecereNameSpace__ecere__com__Class * _class;
886 int _refCount;
887 } __attribute__ ((gcc_struct));
888
889 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DataMember;
890
891 struct __ecereNameSpace__ecere__com__DataMember
892 {
893 struct __ecereNameSpace__ecere__com__DataMember * prev;
894 struct __ecereNameSpace__ecere__com__DataMember * next;
895 char *  name;
896 unsigned int isProperty;
897 int memberAccess;
898 int id;
899 struct __ecereNameSpace__ecere__com__Class * _class;
900 char *  dataTypeString;
901 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
902 struct Type * dataType;
903 int type;
904 int offset;
905 int memberID;
906 struct __ecereNameSpace__ecere__sys__OldList members;
907 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
908 int memberOffset;
909 int structAlignment;
910 } __attribute__ ((gcc_struct));
911
912 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SerialBuffer;
913
914 struct __ecereNameSpace__ecere__com__SerialBuffer
915 {
916 unsigned char *  _buffer;
917 unsigned int count;
918 unsigned int _size;
919 unsigned int pos;
920 } __attribute__ ((gcc_struct));
921
922 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateArgument;
923
924 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
925 {
926 union
927 {
928 struct
929 {
930 char *  dataTypeString;
931 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
932 } __attribute__ ((gcc_struct));
933 struct __ecereNameSpace__ecere__com__DataValue expression;
934 struct
935 {
936 char *  memberString;
937 union
938 {
939 struct __ecereNameSpace__ecere__com__DataMember * member;
940 struct __ecereNameSpace__ecere__com__Property * prop;
941 struct __ecereNameSpace__ecere__com__Method * method;
942 } __attribute__ ((gcc_struct));
943 } __attribute__ ((gcc_struct));
944 } __attribute__ ((gcc_struct));
945 } __attribute__ ((gcc_struct));
946
947 void exit(int status);
948
949 void * calloc(size_t nmemb, size_t size);
950
951 void free(void * ptr);
952
953 void * malloc(size_t size);
954
955 void * realloc(void * ptr, size_t size);
956
957 long int strtol(const char * nptr, char ** endptr, int base);
958
959 long long int strtoll(const char * nptr, char ** endptr, int base);
960
961 unsigned long long int strtoull(const char * nptr, char ** endptr, int base);
962
963 enum yytokentype
964 {
965 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
966 };
967
968 typedef union YYSTYPE
969 {
970 int specifierType;
971 int i;
972 int declMode;
973 struct Identifier * id;
974 struct Expression * exp;
975 struct Specifier * specifier;
976 struct __ecereNameSpace__ecere__sys__OldList * list;
977 struct Enumerator * enumerator;
978 struct Declarator * declarator;
979 struct Pointer * pointer;
980 struct Initializer * initializer;
981 struct InitDeclarator * initDeclarator;
982 struct TypeName * typeName;
983 struct Declaration * declaration;
984 struct Statement * stmt;
985 struct FunctionDefinition * function;
986 struct External * external;
987 struct Context * context;
988 struct AsmField * asmField;
989 struct Attrib * attrib;
990 struct ExtDecl * extDecl;
991 struct Attribute * attribute;
992 struct Instantiation * instance;
993 struct MembersInit * membersInit;
994 struct MemberInit * memberInit;
995 struct ClassFunction * classFunction;
996 struct ClassDefinition * _class;
997 struct ClassDef * classDef;
998 struct PropertyDef * prop;
999 char * string;
1000 struct Symbol * symbol;
1001 struct PropertyWatch * propertyWatch;
1002 struct TemplateParameter * templateParameter;
1003 struct TemplateArgument * templateArgument;
1004 struct TemplateDatatype * templateDatatype;
1005 struct DBTableEntry * dbtableEntry;
1006 struct DBIndexItem * dbindexItem;
1007 struct DBTableDef * dbtableDef;
1008 } __attribute__ ((gcc_struct)) YYSTYPE;
1009
1010 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Enumerator;
1011
1012 struct Enumerator
1013 {
1014 struct Enumerator * prev;
1015 struct Enumerator * next;
1016 struct Location loc;
1017 struct Identifier * id;
1018 struct Expression * exp;
1019 } __attribute__ ((gcc_struct));
1020
1021 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_InitDeclarator;
1022
1023 struct InitDeclarator
1024 {
1025 struct InitDeclarator * prev;
1026 struct InitDeclarator * next;
1027 struct Location loc;
1028 struct Declarator * declarator;
1029 struct Initializer * initializer;
1030 } __attribute__ ((gcc_struct));
1031
1032 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_AsmField;
1033
1034 struct AsmField
1035 {
1036 struct AsmField * prev;
1037 struct AsmField * next;
1038 struct Location loc;
1039 char *  command;
1040 struct Expression * expression;
1041 struct Identifier * symbolic;
1042 } __attribute__ ((gcc_struct));
1043
1044 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Attribute;
1045
1046 struct Attribute;
1047
1048 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassFunction;
1049
1050 struct ClassFunction
1051 {
1052 struct ClassFunction * prev;
1053 struct ClassFunction * next;
1054 struct Location loc;
1055 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1056 struct Declarator * declarator;
1057 struct __ecereNameSpace__ecere__sys__OldList *  declarations;
1058 struct Statement * body;
1059 struct __ecereNameSpace__ecere__com__Class * _class;
1060 struct __ecereNameSpace__ecere__sys__OldList attached;
1061 int declMode;
1062 struct Type * type;
1063 struct Symbol * propSet;
1064 unsigned int isVirtual;
1065 unsigned int isConstructor;
1066 unsigned int isDestructor;
1067 unsigned int dontMangle;
1068 int id;
1069 int idCode;
1070 } __attribute__ ((gcc_struct));
1071
1072 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MembersInit;
1073
1074 struct MembersInit
1075 {
1076 struct MembersInit * prev;
1077 struct MembersInit * next;
1078 struct Location loc;
1079 int type;
1080 union
1081 {
1082 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
1083 struct ClassFunction * function;
1084 } __attribute__ ((gcc_struct));
1085 } __attribute__ ((gcc_struct));
1086
1087 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MemberInit;
1088
1089 struct MemberInit
1090 {
1091 struct MemberInit * prev;
1092 struct MemberInit * next;
1093 struct Location loc;
1094 struct Location realLoc;
1095 struct __ecereNameSpace__ecere__sys__OldList *  identifiers;
1096 struct Initializer * initializer;
1097 unsigned int used;
1098 unsigned int variable;
1099 unsigned int takeOutExp;
1100 } __attribute__ ((gcc_struct));
1101
1102 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyDef;
1103
1104 struct PropertyDef
1105 {
1106 struct PropertyDef * prev;
1107 struct PropertyDef * next;
1108 struct Location loc;
1109 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
1110 struct Declarator * declarator;
1111 struct Identifier * id;
1112 struct Statement * getStmt;
1113 struct Statement * setStmt;
1114 struct Statement * issetStmt;
1115 struct Symbol * symbol;
1116 struct Expression * category;
1117 struct
1118 {
1119 unsigned int conversion : 1;
1120 unsigned int isWatchable : 1;
1121 unsigned int isDBProp : 1;
1122 } __attribute__ ((gcc_struct));
1123 } __attribute__ ((gcc_struct));
1124
1125 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
1126
1127 struct PropertyWatch
1128 {
1129 struct PropertyWatch * prev;
1130 struct PropertyWatch * next;
1131 struct Location loc;
1132 struct Statement * compound;
1133 struct __ecereNameSpace__ecere__sys__OldList *  properties;
1134 unsigned int deleteWatch;
1135 } __attribute__ ((gcc_struct));
1136
1137 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_ClassDef;
1138
1139 struct ClassDef
1140 {
1141 struct ClassDef * prev;
1142 struct ClassDef * next;
1143 struct Location loc;
1144 int type;
1145 union
1146 {
1147 struct Declaration * decl;
1148 struct ClassFunction * function;
1149 struct __ecereNameSpace__ecere__sys__OldList *  defProperties;
1150 struct PropertyDef * propertyDef;
1151 struct PropertyWatch * propertyWatch;
1152 char *  designer;
1153 struct Identifier * defaultProperty;
1154 struct
1155 {
1156 struct Identifier * id;
1157 struct Initializer * initializer;
1158 } __attribute__ ((gcc_struct));
1159 } __attribute__ ((gcc_struct));
1160 int memberAccess;
1161 void *  object;
1162 } __attribute__ ((gcc_struct));
1163
1164 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBTableEntry;
1165
1166 struct DBTableEntry;
1167
1168 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_DBIndexItem;
1169
1170 struct DBIndexItem;
1171
1172 extern YYSTYPE yylval;
1173
1174 extern struct Location yylloc;
1175
1176 extern struct __ecereNameSpace__ecere__sys__OldList * ast;
1177
1178 extern int returnCode;
1179
1180 extern struct Expression * parsedExpression;
1181
1182 extern unsigned int yydebug;
1183
1184 void SetYydebug(unsigned int b)
1185 {
1186 yydebug = b;
1187 }
1188
1189 extern unsigned int echoOn;
1190
1191 void resetScanner();
1192
1193 int propWatcherID;
1194
1195 int expression_yyparse();
1196
1197 static struct Statement * curCompound;
1198
1199 struct External * curExternal, * afterExternal;
1200
1201 static struct Type * curSwitchType;
1202
1203 static struct __ecereNameSpace__ecere__com__Class * currentClass;
1204
1205 struct __ecereNameSpace__ecere__com__Class * thisClass;
1206
1207 void SetThisClass(struct __ecereNameSpace__ecere__com__Class * c)
1208 {
1209 thisClass = c;
1210 }
1211
1212 struct __ecereNameSpace__ecere__com__Class * GetThisClass()
1213 {
1214 return thisClass;
1215 }
1216
1217 static char * thisNameSpace;
1218
1219 struct __ecereNameSpace__ecere__com__Class * containerClass;
1220
1221 unsigned int thisClassParams = 0x1;
1222
1223 unsigned int internalValueCounter;
1224
1225 extern unsigned int outputLineNumbers;
1226
1227 extern void OutputExpression(struct Expression * exp, struct __ecereNameSpace__ecere__com__Instance * f);
1228
1229 extern size_t strlen(const char * );
1230
1231 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__TempFile;
1232
1233 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
1234
1235 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek;
1236
1237 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Read;
1238
1239 extern void __ecereNameSpace__ecere__com__eInstance_DecRef(struct __ecereNameSpace__ecere__com__Instance * instance);
1240
1241 void PrintExpression(struct Expression * exp, char * string)
1242 {
1243 {
1244 struct __ecereNameSpace__ecere__com__Instance * f = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
1245 int count;
1246 unsigned int backOutputLineNumbers = outputLineNumbers;
1247
1248 outputLineNumbers = 0x0;
1249 if(exp)
1250 OutputExpression(exp, f);
1251 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
1252 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1253
1254 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1255 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(f, 0, 0);
1256 count = strlen(string);
1257 count += ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
1258 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = f;
1259
1260 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__TempFile->_vTbl;
1261 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(f, string + count, 1, 1023);
1262 string[count] = '\0';
1263 (__ecereNameSpace__ecere__com__eInstance_DecRef(f), f = 0);
1264 outputLineNumbers = backOutputLineNumbers;
1265 }
1266 }
1267
1268 extern struct Type * ProcessTypeString(char *  string, unsigned int staticMethod);
1269
1270 extern struct Type * ProcessType(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Declarator * decl);
1271
1272 struct Type * ProcessTemplateParameterType(struct TemplateParameter * param)
1273 {
1274 if(param && param->type == 0 && (param->dataType || param->dataTypeString))
1275 {
1276 if(!param->baseType)
1277 {
1278 if(param->dataTypeString)
1279 param->baseType = ProcessTypeString(param->dataTypeString, 0x0);
1280 else
1281 param->baseType = ProcessType(param->dataType->specifiers, param->dataType->decl);
1282 }
1283 return param->baseType;
1284 }
1285 return (((void *)0));
1286 }
1287
1288 unsigned int NeedCast(struct Type * type1, struct Type * type2)
1289 {
1290 if(!type1 || !type2 || type1->keepCast || type2->keepCast)
1291 return 0x1;
1292 if(type1->kind == 20 && type2->kind == 4 && type2->passAsTemplate == 0x0)
1293 {
1294 return 0x0;
1295 }
1296 if(type1->kind == type2->kind)
1297 {
1298 switch(type1->kind)
1299 {
1300 case 24:
1301 case 1:
1302 case 2:
1303 case 3:
1304 case 4:
1305 case 22:
1306 case 23:
1307 if(type1->passAsTemplate && !type2->passAsTemplate)
1308 return 0x1;
1309 return type1->isSigned != type2->isSigned;
1310 case 8:
1311 return type1->_class != type2->_class;
1312 case 13:
1313 return NeedCast(type1->type, type2->type);
1314 default:
1315 return 0x1;
1316 }
1317 }
1318 return 0x1;
1319 }
1320
1321 extern int strcmp(const char * , const char * );
1322
1323 extern struct Context * curContext;
1324
1325 extern struct Context * topContext;
1326
1327 extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
1328
1329 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);
1330
1331 extern struct __ecereNameSpace__ecere__com__Instance * privateModule;
1332
1333 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);
1334
1335 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);
1336
1337 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassProperty;
1338
1339 struct __ecereNameSpace__ecere__com__ClassProperty
1340 {
1341 char *  name;
1342 struct __ecereNameSpace__ecere__com__ClassProperty * parent;
1343 struct __ecereNameSpace__ecere__com__ClassProperty * left;
1344 struct __ecereNameSpace__ecere__com__ClassProperty * right;
1345 int depth;
1346 void (*  Set)(struct __ecereNameSpace__ecere__com__Class *, long long);
1347 long long (*  Get)(struct __ecereNameSpace__ecere__com__Class *);
1348 char *  dataTypeString;
1349 struct Type * dataType;
1350 unsigned int constant;
1351 } __attribute__ ((gcc_struct));
1352
1353 extern struct __ecereNameSpace__ecere__com__ClassProperty * __ecereNameSpace__ecere__com__eClass_FindClassProperty(struct __ecereNameSpace__ecere__com__Class * _class, char *  name);
1354
1355 extern struct Expression * QMkExpId(char *  id);
1356
1357 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__ClassTemplateParameter;
1358
1359 struct __ecereNameSpace__ecere__com__ClassTemplateParameter
1360 {
1361 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * prev;
1362 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * next;
1363 char *  name;
1364 int type;
1365 union
1366 {
1367 char *  dataTypeString;
1368 int memberType;
1369 } __attribute__ ((gcc_struct));
1370 struct __ecereNameSpace__ecere__com__ClassTemplateArgument defaultArg;
1371 void *  param;
1372 } __attribute__ ((gcc_struct));
1373
1374 extern struct Expression * GetTemplateArgExpByName(char *  paramName, struct __ecereNameSpace__ecere__com__Class * curClass, int tplType);
1375
1376 extern struct __ecereNameSpace__ecere__sys__OldList *  MkList(void);
1377
1378 extern void FreeIdentifier(struct Identifier * id);
1379
1380 void ProcessExpressionType(struct Expression * exp);
1381
1382 extern struct Declarator * SpecDeclFromString(char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
1383
1384 extern struct __ecereNameSpace__ecere__sys__OldList *  MkListOne(void *  item);
1385
1386 extern struct Expression * MkExpOp(struct Expression * exp1, int op, struct Expression * exp2);
1387
1388 extern struct Expression * MkExpCast(struct TypeName * typeName, struct Expression * expression);
1389
1390 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
1391
1392 extern struct Declarator * MkDeclaratorPointer(struct Pointer * pointer, struct Declarator * declarator);
1393
1394 extern struct Pointer * MkPointer(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Pointer * pointer);
1395
1396 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
1397
1398 static void ReplaceClassMembers(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class)
1399 {
1400 if(exp->type == 0 && exp->identifier)
1401 {
1402 struct Identifier * id = exp->identifier;
1403 struct Context * ctx;
1404 struct Symbol * symbol = (((void *)0));
1405
1406 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
1407 {
1408 for(ctx = curContext; ctx != topContext->parent && !symbol; ctx = ctx->parent)
1409 {
1410 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&ctx->symbols, id->string);
1411 if(symbol)
1412 break;
1413 }
1414 }
1415 if(!symbol && ((!id->_class || (id->_class->name && !strcmp(id->_class->name, "property"))) || (id->classSym && __ecereNameSpace__ecere__com__eClass_IsDerived(_class, id->classSym->registered))))
1416 {
1417 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
1418 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
1419 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
1420 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
1421
1422 if(!prop)
1423 {
1424 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
1425 }
1426 if(!prop && !method)
1427 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
1428 if(!prop && !method && !member)
1429 {
1430 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string);
1431 }
1432 if(prop || method || member || classProp)
1433 {
1434 exp->type = 8;
1435 exp->member.member = id;
1436 exp->member.memberType = 0;
1437 exp->member.exp = QMkExpId("this");
1438 exp->addedThis = 0x1;
1439 }
1440 else if(_class && _class->templateParams.first)
1441 {
1442 struct __ecereNameSpace__ecere__com__Class * sClass;
1443
1444 for(sClass = _class; sClass; sClass = sClass->base)
1445 {
1446 if(sClass->templateParams.first)
1447 {
1448 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
1449
1450 for(param = sClass->templateParams.first; param; param = param->next)
1451 {
1452 if(param->type == 2 && !strcmp(param->name, id->string))
1453 {
1454 struct Expression * argExp = GetTemplateArgExpByName(param->name, _class, 2);
1455
1456 if(argExp)
1457 {
1458 struct Declarator * decl;
1459 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
1460
1461 FreeIdentifier(exp->member.member);
1462 ProcessExpressionType(argExp);
1463 decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
1464 exp->expType = ProcessType(specs, decl);
1465 exp->type = 5;
1466 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), MkExpOp((((void *)0)), '&', argExp))));
1467 }
1468 }
1469 }
1470 }
1471 }
1472 }
1473 }
1474 }
1475 }
1476
1477 extern int sprintf(char * , char * , ...);
1478
1479 extern int __ecereNameSpace__ecere__com__GetRuntimePlatform(void);
1480
1481 extern char *  strcat(char * , const char * );
1482
1483 extern char *  __ecereNameSpace__ecere__sys__CopyString(char *  string);
1484
1485 char * PrintInt(long long result)
1486 {
1487 char temp[100];
1488
1489 if(result > (((int)0x7fffffff)))
1490 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1491 else
1492 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1493 if(result > (((int)0x7fffffff)) || result < (((int)0x80000000)))
1494 strcat(temp, "LL");
1495 return __ecereNameSpace__ecere__sys__CopyString(temp);
1496 }
1497
1498 char * PrintUInt(uint64 result)
1499 {
1500 char temp[100];
1501
1502 if(result > (0xffffffff))
1503 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1504 else if(result > (((int)0x7fffffff)))
1505 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1506 else
1507 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64d" : "%lld"), result);
1508 return __ecereNameSpace__ecere__sys__CopyString(temp);
1509 }
1510
1511 char * PrintInt64(long long result)
1512 {
1513 char temp[100];
1514
1515 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1516 return __ecereNameSpace__ecere__sys__CopyString(temp);
1517 }
1518
1519 char * PrintUInt64(uint64 result)
1520 {
1521 char temp[100];
1522
1523 if(result > (((long long)0x7fffffffffffffffLL)))
1524 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1525 else
1526 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "%I64dLL" : "%lldLL"), result);
1527 return __ecereNameSpace__ecere__sys__CopyString(temp);
1528 }
1529
1530 char * PrintHexUInt(uint64 result)
1531 {
1532 char temp[100];
1533
1534 if(result > (0xffffffff))
1535 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1536 else
1537 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1538 if(result > (0xffffffff))
1539 strcat(temp, "LL");
1540 return __ecereNameSpace__ecere__sys__CopyString(temp);
1541 }
1542
1543 char * PrintHexUInt64(uint64 result)
1544 {
1545 char temp[100];
1546
1547 if(result > (0xffffffff))
1548 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64XLL" : "0x%llXLL"), result);
1549 else
1550 sprintf(temp, ((__ecereNameSpace__ecere__com__GetRuntimePlatform() == 1) ? "0x%I64X" : "0x%llX"), result);
1551 return __ecereNameSpace__ecere__sys__CopyString(temp);
1552 }
1553
1554 char * PrintShort(short result)
1555 {
1556 char temp[100];
1557
1558 sprintf(temp, "%d", (unsigned short)result);
1559 return __ecereNameSpace__ecere__sys__CopyString(temp);
1560 }
1561
1562 char * PrintUShort(unsigned short result)
1563 {
1564 char temp[100];
1565
1566 if(result > (unsigned short)32767)
1567 sprintf(temp, "0x%X", (int)result);
1568 else
1569 sprintf(temp, "%d", (int)result);
1570 return __ecereNameSpace__ecere__sys__CopyString(temp);
1571 }
1572
1573 extern int isprint(int c);
1574
1575 char * PrintChar(char result)
1576 {
1577 char temp[100];
1578
1579 if(result > (char)0 && isprint(result))
1580 sprintf(temp, "'%c'", result);
1581 else if(result < (char)0)
1582 sprintf(temp, "%d", (int)result);
1583 else
1584 sprintf(temp, "0x%X", (unsigned char)result);
1585 return __ecereNameSpace__ecere__sys__CopyString(temp);
1586 }
1587
1588 char * PrintUChar(unsigned char result)
1589 {
1590 char temp[100];
1591
1592 sprintf(temp, "0x%X", result);
1593 return __ecereNameSpace__ecere__sys__CopyString(temp);
1594 }
1595
1596 extern char *  strcpy(char * , const char * );
1597
1598 extern unsigned int (* __ecereProp_float_Get_isInf)(float this);
1599
1600 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isInf;
1601
1602 extern int (* __ecereProp_float_Get_signBit)(float this);
1603
1604 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_signBit;
1605
1606 extern unsigned int (* __ecereProp_float_Get_isNan)(float this);
1607
1608 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_float_isNan;
1609
1610 char * PrintFloat(float result)
1611 {
1612 char temp[350];
1613
1614 if(__ecereProp_float_Get_isInf(result))
1615 {
1616 if(__ecereProp_float_Get_signBit(result))
1617 strcpy(temp, "-inf");
1618 else
1619 strcpy(temp, "inf");
1620 }
1621 else if(__ecereProp_float_Get_isNan(result))
1622 {
1623 if(__ecereProp_float_Get_signBit(result))
1624 strcpy(temp, "-nan");
1625 else
1626 strcpy(temp, "nan");
1627 }
1628 else
1629 sprintf(temp, "%.16ff", result);
1630 return __ecereNameSpace__ecere__sys__CopyString(temp);
1631 }
1632
1633 extern unsigned int (* __ecereProp_double_Get_isInf)(double this);
1634
1635 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isInf;
1636
1637 extern int (* __ecereProp_double_Get_signBit)(double this);
1638
1639 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_signBit;
1640
1641 extern unsigned int (* __ecereProp_double_Get_isNan)(double this);
1642
1643 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp_double_isNan;
1644
1645 char * PrintDouble(double result)
1646 {
1647 char temp[350];
1648
1649 if(__ecereProp_double_Get_isInf(result))
1650 {
1651 if(__ecereProp_double_Get_signBit(result))
1652 strcpy(temp, "-inf");
1653 else
1654 strcpy(temp, "inf");
1655 }
1656 else if(__ecereProp_double_Get_isNan(result))
1657 {
1658 if(__ecereProp_double_Get_signBit(result))
1659 strcpy(temp, "-nan");
1660 else
1661 strcpy(temp, "nan");
1662 }
1663 else
1664 sprintf(temp, "%.16f", result);
1665 return __ecereNameSpace__ecere__sys__CopyString(temp);
1666 }
1667
1668 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_OpTable;
1669
1670 struct OpTable
1671 {
1672 unsigned int (*  Add)(struct Expression *, struct Operand *, struct Operand *);
1673 unsigned int (*  Sub)(struct Expression *, struct Operand *, struct Operand *);
1674 unsigned int (*  Mul)(struct Expression *, struct Operand *, struct Operand *);
1675 unsigned int (*  Div)(struct Expression *, struct Operand *, struct Operand *);
1676 unsigned int (*  Mod)(struct Expression *, struct Operand *, struct Operand *);
1677 unsigned int (*  Neg)(struct Expression *, struct Operand *);
1678 unsigned int (*  Inc)(struct Expression *, struct Operand *);
1679 unsigned int (*  Dec)(struct Expression *, struct Operand *);
1680 unsigned int (*  Asign)(struct Expression *, struct Operand *, struct Operand *);
1681 unsigned int (*  AddAsign)(struct Expression *, struct Operand *, struct Operand *);
1682 unsigned int (*  SubAsign)(struct Expression *, struct Operand *, struct Operand *);
1683 unsigned int (*  MulAsign)(struct Expression *, struct Operand *, struct Operand *);
1684 unsigned int (*  DivAsign)(struct Expression *, struct Operand *, struct Operand *);
1685 unsigned int (*  ModAsign)(struct Expression *, struct Operand *, struct Operand *);
1686 unsigned int (*  BitAnd)(struct Expression *, struct Operand *, struct Operand *);
1687 unsigned int (*  BitOr)(struct Expression *, struct Operand *, struct Operand *);
1688 unsigned int (*  BitXor)(struct Expression *, struct Operand *, struct Operand *);
1689 unsigned int (*  LShift)(struct Expression *, struct Operand *, struct Operand *);
1690 unsigned int (*  RShift)(struct Expression *, struct Operand *, struct Operand *);
1691 unsigned int (*  BitNot)(struct Expression *, struct Operand *);
1692 unsigned int (*  AndAsign)(struct Expression *, struct Operand *, struct Operand *);
1693 unsigned int (*  OrAsign)(struct Expression *, struct Operand *, struct Operand *);
1694 unsigned int (*  XorAsign)(struct Expression *, struct Operand *, struct Operand *);
1695 unsigned int (*  LShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1696 unsigned int (*  RShiftAsign)(struct Expression *, struct Operand *, struct Operand *);
1697 unsigned int (*  Not)(struct Expression *, struct Operand *);
1698 unsigned int (*  Equ)(struct Expression *, struct Operand *, struct Operand *);
1699 unsigned int (*  Nqu)(struct Expression *, struct Operand *, struct Operand *);
1700 unsigned int (*  And)(struct Expression *, struct Operand *, struct Operand *);
1701 unsigned int (*  Or)(struct Expression *, struct Operand *, struct Operand *);
1702 unsigned int (*  Grt)(struct Expression *, struct Operand *, struct Operand *);
1703 unsigned int (*  Sma)(struct Expression *, struct Operand *, struct Operand *);
1704 unsigned int (*  GrtEqu)(struct Expression *, struct Operand *, struct Operand *);
1705 unsigned int (*  SmaEqu)(struct Expression *, struct Operand *, struct Operand *);
1706 unsigned int (*  Cond)(struct Expression *, struct Operand *, struct Operand *, struct Operand *);
1707 } __attribute__ ((gcc_struct));
1708
1709 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_Operand;
1710
1711 struct Operand
1712 {
1713 int kind;
1714 struct Type * type;
1715 unsigned int ptrSize;
1716 union
1717 {
1718 char c;
1719 unsigned char uc;
1720 short s;
1721 unsigned short us;
1722 int i;
1723 unsigned int ui;
1724 float f;
1725 double d;
1726 long long i64;
1727 uint64 ui64;
1728 } __attribute__ ((gcc_struct));
1729 struct OpTable ops;
1730 } __attribute__ ((gcc_struct));
1731
1732 unsigned int GetOpInt(struct Operand * op2, int * value2)
1733 {
1734 if(op2->kind == 3 && op2->type->isSigned)
1735 *value2 = op2->i;
1736 else if(op2->kind == 3)
1737 *value2 = (int)op2->ui;
1738 else if(op2->kind == 4 && op2->type->isSigned)
1739 *value2 = (int)op2->i64;
1740 else if(op2->kind == 4)
1741 *value2 = (int)op2->ui64;
1742 else if(op2->kind == 23 && op2->type->isSigned)
1743 *value2 = (int)op2->i64;
1744 else if(op2->kind == 23)
1745 *value2 = (int)op2->ui64;
1746 else if(op2->kind == 22 && op2->type->isSigned)
1747 *value2 = (int)op2->i64;
1748 else if(op2->kind == 22)
1749 *value2 = (int)op2->ui64;
1750 else if(op2->kind == 2 && op2->type->isSigned)
1751 *value2 = (int)op2->s;
1752 else if(op2->kind == 2)
1753 *value2 = (int)op2->us;
1754 else if(op2->kind == 1 && op2->type->isSigned)
1755 *value2 = (int)op2->c;
1756 else if(op2->kind == 24 || op2->kind == 1)
1757 *value2 = (int)op2->uc;
1758 else if(op2->kind == 6)
1759 *value2 = (int)op2->f;
1760 else if(op2->kind == 7)
1761 *value2 = (int)op2->d;
1762 else if(op2->kind == 13)
1763 *value2 = (int)op2->ui64;
1764 else
1765 return 0x0;
1766 return 0x1;
1767 }
1768
1769 struct Operand GetOperand(struct Expression * exp);
1770
1771 unsigned int GetInt(struct Expression * exp, int * value2)
1772 {
1773 struct Operand op2 = GetOperand(exp);
1774
1775 return GetOpInt(&op2, value2);
1776 }
1777
1778 unsigned int GetOpUInt(struct Operand * op2, unsigned int * value2)
1779 {
1780 if(op2->kind == 3 && op2->type->isSigned)
1781 *value2 = (unsigned int)op2->i;
1782 else if(op2->kind == 3)
1783 *value2 = op2->ui;
1784 else if(op2->kind == 4 && op2->type->isSigned)
1785 *value2 = (unsigned int)op2->i64;
1786 else if(op2->kind == 4)
1787 *value2 = (unsigned int)op2->ui64;
1788 else if(op2->kind == 23 && op2->type->isSigned)
1789 *value2 = (unsigned int)op2->i64;
1790 else if(op2->kind == 23)
1791 *value2 = (unsigned int)op2->ui64;
1792 else if(op2->kind == 22 && op2->type->isSigned)
1793 *value2 = (unsigned int)op2->i64;
1794 else if(op2->kind == 22)
1795 *value2 = (unsigned int)op2->ui64;
1796 else if(op2->kind == 2 && op2->type->isSigned)
1797 *value2 = (unsigned int)op2->s;
1798 else if(op2->kind == 2)
1799 *value2 = (unsigned int)op2->us;
1800 else if(op2->kind == 1 && op2->type->isSigned)
1801 *value2 = (unsigned int)op2->c;
1802 else if(op2->kind == 24 || op2->kind == 1)
1803 *value2 = (unsigned int)op2->uc;
1804 else if(op2->kind == 6)
1805 *value2 = (unsigned int)op2->f;
1806 else if(op2->kind == 7)
1807 *value2 = (unsigned int)op2->d;
1808 else if(op2->kind == 13)
1809 *value2 = (unsigned int)op2->ui64;
1810 else
1811 return 0x0;
1812 return 0x1;
1813 }
1814
1815 unsigned int GetUInt(struct Expression * exp, unsigned int * value2)
1816 {
1817 struct Operand op2 = GetOperand(exp);
1818
1819 return GetOpUInt(&op2, value2);
1820 }
1821
1822 unsigned int GetOpInt64(struct Operand * op2, long long * value2)
1823 {
1824 if(op2->kind == 3 && op2->type->isSigned)
1825 *value2 = (long long)op2->i;
1826 else if(op2->kind == 3)
1827 *value2 = (long long)op2->ui;
1828 else if(op2->kind == 4 && op2->type->isSigned)
1829 *value2 = op2->i64;
1830 else if(op2->kind == 4)
1831 *value2 = (long long)op2->ui64;
1832 else if(op2->kind == 23 && op2->type->isSigned)
1833 *value2 = op2->i64;
1834 else if(op2->kind == 23)
1835 *value2 = (long long)op2->ui64;
1836 else if(op2->kind == 22 && op2->type->isSigned)
1837 *value2 = op2->i64;
1838 else if(op2->kind == 22)
1839 *value2 = (long long)op2->ui64;
1840 else if(op2->kind == 2 && op2->type->isSigned)
1841 *value2 = (long long)op2->s;
1842 else if(op2->kind == 2)
1843 *value2 = (long long)op2->us;
1844 else if(op2->kind == 1 && op2->type->isSigned)
1845 *value2 = (long long)op2->c;
1846 else if(op2->kind == 24 || op2->kind == 1)
1847 *value2 = (long long)op2->uc;
1848 else if(op2->kind == 6)
1849 *value2 = (long long)op2->f;
1850 else if(op2->kind == 7)
1851 *value2 = (long long)op2->d;
1852 else if(op2->kind == 13)
1853 *value2 = (long long)op2->ui64;
1854 else
1855 return 0x0;
1856 return 0x1;
1857 }
1858
1859 unsigned int GetInt64(struct Expression * exp, long long * value2)
1860 {
1861 struct Operand op2 = GetOperand(exp);
1862
1863 return GetOpInt64(&op2, value2);
1864 }
1865
1866 unsigned int GetOpUInt64(struct Operand * op2, uint64 * value2)
1867 {
1868 if(op2->kind == 3 && op2->type->isSigned)
1869 *value2 = (uint64)op2->i;
1870 else if(op2->kind == 3)
1871 *value2 = (uint64)op2->ui;
1872 else if(op2->kind == 4 && op2->type->isSigned)
1873 *value2 = (uint64)op2->i64;
1874 else if(op2->kind == 4)
1875 *value2 = op2->ui64;
1876 else if(op2->kind == 23 && op2->type->isSigned)
1877 *value2 = (uint64)op2->i64;
1878 else if(op2->kind == 23)
1879 *value2 = op2->ui64;
1880 else if(op2->kind == 22 && op2->type->isSigned)
1881 *value2 = (uint64)op2->i64;
1882 else if(op2->kind == 22)
1883 *value2 = op2->ui64;
1884 else if(op2->kind == 2 && op2->type->isSigned)
1885 *value2 = (uint64)op2->s;
1886 else if(op2->kind == 2)
1887 *value2 = (uint64)op2->us;
1888 else if(op2->kind == 1 && op2->type->isSigned)
1889 *value2 = (uint64)op2->c;
1890 else if(op2->kind == 24 || op2->kind == 1)
1891 *value2 = (uint64)op2->uc;
1892 else if(op2->kind == 6)
1893 *value2 = (uint64)op2->f;
1894 else if(op2->kind == 7)
1895 *value2 = (uint64)op2->d;
1896 else if(op2->kind == 13)
1897 *value2 = op2->ui64;
1898 else
1899 return 0x0;
1900 return 0x1;
1901 }
1902
1903 unsigned int GetUInt64(struct Expression * exp, uint64 * value2)
1904 {
1905 struct Operand op2 = GetOperand(exp);
1906
1907 return GetOpUInt64(&op2, value2);
1908 }
1909
1910 unsigned int GetOpIntPtr(struct Operand * op2, intptr_t * value2)
1911 {
1912 if(op2->kind == 3 && op2->type->isSigned)
1913 *value2 = (intptr_t)op2->i;
1914 else if(op2->kind == 3)
1915 *value2 = (intptr_t)op2->ui;
1916 else if(op2->kind == 4 && op2->type->isSigned)
1917 *value2 = (intptr_t)op2->i64;
1918 else if(op2->kind == 4)
1919 *value2 = (intptr_t)op2->ui64;
1920 else if(op2->kind == 23 && op2->type->isSigned)
1921 *value2 = (intptr_t)op2->i64;
1922 else if(op2->kind == 23)
1923 *value2 = (intptr_t)op2->ui64;
1924 else if(op2->kind == 22 && op2->type->isSigned)
1925 *value2 = (intptr_t)op2->i64;
1926 else if(op2->kind == 22)
1927 *value2 = (intptr_t)op2->ui64;
1928 else if(op2->kind == 2 && op2->type->isSigned)
1929 *value2 = (intptr_t)op2->s;
1930 else if(op2->kind == 2)
1931 *value2 = (intptr_t)op2->us;
1932 else if(op2->kind == 1 && op2->type->isSigned)
1933 *value2 = (intptr_t)op2->c;
1934 else if(op2->kind == 24 || op2->kind == 1)
1935 *value2 = (intptr_t)op2->uc;
1936 else if(op2->kind == 6)
1937 *value2 = (intptr_t)op2->f;
1938 else if(op2->kind == 7)
1939 *value2 = (intptr_t)op2->d;
1940 else if(op2->kind == 13)
1941 *value2 = (intptr_t)op2->ui64;
1942 else
1943 return 0x0;
1944 return 0x1;
1945 }
1946
1947 unsigned int GetIntPtr(struct Expression * exp, intptr_t * value2)
1948 {
1949 struct Operand op2 = GetOperand(exp);
1950
1951 return GetOpIntPtr(&op2, value2);
1952 }
1953
1954 unsigned int GetOpUIntPtr(struct Operand * op2, uintptr_t * value2)
1955 {
1956 if(op2->kind == 3 && op2->type->isSigned)
1957 *value2 = (uintptr_t)op2->i;
1958 else if(op2->kind == 3)
1959 *value2 = (uintptr_t)op2->ui;
1960 else if(op2->kind == 4 && op2->type->isSigned)
1961 *value2 = (uintptr_t)op2->i64;
1962 else if(op2->kind == 4)
1963 *value2 = (uintptr_t)op2->ui64;
1964 else if(op2->kind == 23 && op2->type->isSigned)
1965 *value2 = (uintptr_t)op2->i64;
1966 else if(op2->kind == 23)
1967 *value2 = (uintptr_t)op2->ui64;
1968 else if(op2->kind == 22 && op2->type->isSigned)
1969 *value2 = (uintptr_t)op2->i64;
1970 else if(op2->kind == 22)
1971 *value2 = (uintptr_t)op2->ui64;
1972 else if(op2->kind == 2 && op2->type->isSigned)
1973 *value2 = (uintptr_t)op2->s;
1974 else if(op2->kind == 2)
1975 *value2 = (uintptr_t)op2->us;
1976 else if(op2->kind == 1 && op2->type->isSigned)
1977 *value2 = (uintptr_t)op2->c;
1978 else if(op2->kind == 24 || op2->kind == 1)
1979 *value2 = (uintptr_t)op2->uc;
1980 else if(op2->kind == 6)
1981 *value2 = (uintptr_t)op2->f;
1982 else if(op2->kind == 7)
1983 *value2 = (uintptr_t)op2->d;
1984 else if(op2->kind == 13)
1985 *value2 = (uintptr_t)op2->ui64;
1986 else
1987 return 0x0;
1988 return 0x1;
1989 }
1990
1991 unsigned int GetUIntPtr(struct Expression * exp, uintptr_t * value2)
1992 {
1993 struct Operand op2 = GetOperand(exp);
1994
1995 return GetOpUIntPtr(&op2, value2);
1996 }
1997
1998 unsigned int GetOpIntSize(struct Operand * op2, ssize_t * value2)
1999 {
2000 if(op2->kind == 3 && op2->type->isSigned)
2001 *value2 = (ssize_t)op2->i;
2002 else if(op2->kind == 3)
2003 *value2 = (ssize_t)op2->ui;
2004 else if(op2->kind == 4 && op2->type->isSigned)
2005 *value2 = (ssize_t)op2->i64;
2006 else if(op2->kind == 4)
2007 *value2 = (ssize_t)op2->ui64;
2008 else if(op2->kind == 23 && op2->type->isSigned)
2009 *value2 = (ssize_t)op2->i64;
2010 else if(op2->kind == 23)
2011 *value2 = (ssize_t)op2->ui64;
2012 else if(op2->kind == 22 && op2->type->isSigned)
2013 *value2 = (ssize_t)op2->i64;
2014 else if(op2->kind == 22)
2015 *value2 = (ssize_t)op2->ui64;
2016 else if(op2->kind == 2 && op2->type->isSigned)
2017 *value2 = (ssize_t)op2->s;
2018 else if(op2->kind == 2)
2019 *value2 = (ssize_t)op2->us;
2020 else if(op2->kind == 1 && op2->type->isSigned)
2021 *value2 = (ssize_t)op2->c;
2022 else if(op2->kind == 24 || op2->kind == 1)
2023 *value2 = (ssize_t)op2->uc;
2024 else if(op2->kind == 6)
2025 *value2 = (ssize_t)op2->f;
2026 else if(op2->kind == 7)
2027 *value2 = (ssize_t)op2->d;
2028 else if(op2->kind == 13)
2029 *value2 = (ssize_t)op2->ui64;
2030 else
2031 return 0x0;
2032 return 0x1;
2033 }
2034
2035 unsigned int GetIntSize(struct Expression * exp, ssize_t * value2)
2036 {
2037 struct Operand op2 = GetOperand(exp);
2038
2039 return GetOpIntSize(&op2, value2);
2040 }
2041
2042 unsigned int GetOpUIntSize(struct Operand * op2, size_t * value2)
2043 {
2044 if(op2->kind == 3 && op2->type->isSigned)
2045 *value2 = (size_t)op2->i;
2046 else if(op2->kind == 3)
2047 *value2 = (size_t)op2->ui;
2048 else if(op2->kind == 4 && op2->type->isSigned)
2049 *value2 = (size_t)op2->i64;
2050 else if(op2->kind == 4)
2051 *value2 = (size_t)op2->ui64;
2052 else if(op2->kind == 23 && op2->type->isSigned)
2053 *value2 = (size_t)op2->i64;
2054 else if(op2->kind == 23)
2055 *value2 = (size_t)op2->ui64;
2056 else if(op2->kind == 22 && op2->type->isSigned)
2057 *value2 = (size_t)op2->i64;
2058 else if(op2->kind == 22)
2059 *value2 = (size_t)op2->ui64;
2060 else if(op2->kind == 2 && op2->type->isSigned)
2061 *value2 = (size_t)op2->s;
2062 else if(op2->kind == 2)
2063 *value2 = (size_t)op2->us;
2064 else if(op2->kind == 1 && op2->type->isSigned)
2065 *value2 = (size_t)op2->c;
2066 else if(op2->kind == 24 || op2->kind == 1)
2067 *value2 = (size_t)op2->uc;
2068 else if(op2->kind == 6)
2069 *value2 = (size_t)op2->f;
2070 else if(op2->kind == 7)
2071 *value2 = (size_t)op2->d;
2072 else if(op2->kind == 13)
2073 *value2 = (size_t)op2->ui64;
2074 else
2075 return 0x0;
2076 return 0x1;
2077 }
2078
2079 unsigned int GetUIntSize(struct Expression * exp, size_t * value2)
2080 {
2081 struct Operand op2 = GetOperand(exp);
2082
2083 return GetOpUIntSize(&op2, value2);
2084 }
2085
2086 unsigned int GetOpShort(struct Operand * op2, short * value2)
2087 {
2088 if(op2->kind == 3 && op2->type->isSigned)
2089 *value2 = (short)op2->i;
2090 else if(op2->kind == 3)
2091 *value2 = (short)op2->ui;
2092 else if(op2->kind == 4 && op2->type->isSigned)
2093 *value2 = (short)op2->i64;
2094 else if(op2->kind == 4)
2095 *value2 = (short)op2->ui64;
2096 else if(op2->kind == 23 && op2->type->isSigned)
2097 *value2 = (short)op2->i64;
2098 else if(op2->kind == 23)
2099 *value2 = (short)op2->ui64;
2100 else if(op2->kind == 22 && op2->type->isSigned)
2101 *value2 = (short)op2->i64;
2102 else if(op2->kind == 22)
2103 *value2 = (short)op2->ui64;
2104 else if(op2->kind == 2 && op2->type->isSigned)
2105 *value2 = op2->s;
2106 else if(op2->kind == 2)
2107 *value2 = (short)op2->us;
2108 else if(op2->kind == 1 && op2->type->isSigned)
2109 *value2 = (short)op2->c;
2110 else if(op2->kind == 24 || op2->kind == 1)
2111 *value2 = (short)op2->uc;
2112 else if(op2->kind == 6)
2113 *value2 = (short)op2->f;
2114 else if(op2->kind == 7)
2115 *value2 = (short)op2->d;
2116 else if(op2->kind == 13)
2117 *value2 = (short)op2->ui64;
2118 else
2119 return 0x0;
2120 return 0x1;
2121 }
2122
2123 unsigned int GetShort(struct Expression * exp, short * value2)
2124 {
2125 struct Operand op2 = GetOperand(exp);
2126
2127 return GetOpShort(&op2, value2);
2128 }
2129
2130 unsigned int GetOpUShort(struct Operand * op2, unsigned short * value2)
2131 {
2132 if(op2->kind == 3 && op2->type->isSigned)
2133 *value2 = (unsigned short)op2->i;
2134 else if(op2->kind == 3)
2135 *value2 = (unsigned short)op2->ui;
2136 else if(op2->kind == 4 && op2->type->isSigned)
2137 *value2 = (unsigned short)op2->i64;
2138 else if(op2->kind == 4)
2139 *value2 = (unsigned short)op2->ui64;
2140 else if(op2->kind == 23 && op2->type->isSigned)
2141 *value2 = (unsigned short)op2->i64;
2142 else if(op2->kind == 23)
2143 *value2 = (unsigned short)op2->ui64;
2144 else if(op2->kind == 22 && op2->type->isSigned)
2145 *value2 = (unsigned short)op2->i64;
2146 else if(op2->kind == 22)
2147 *value2 = (unsigned short)op2->ui64;
2148 else if(op2->kind == 2 && op2->type->isSigned)
2149 *value2 = (unsigned short)op2->s;
2150 else if(op2->kind == 2)
2151 *value2 = op2->us;
2152 else if(op2->kind == 1 && op2->type->isSigned)
2153 *value2 = (unsigned short)op2->c;
2154 else if(op2->kind == 24 || op2->kind == 1)
2155 *value2 = (unsigned short)op2->uc;
2156 else if(op2->kind == 6)
2157 *value2 = (unsigned short)op2->f;
2158 else if(op2->kind == 7)
2159 *value2 = (unsigned short)op2->d;
2160 else if(op2->kind == 13)
2161 *value2 = (unsigned short)op2->ui64;
2162 else
2163 return 0x0;
2164 return 0x1;
2165 }
2166
2167 unsigned int GetUShort(struct Expression * exp, unsigned short * value2)
2168 {
2169 struct Operand op2 = GetOperand(exp);
2170
2171 return GetOpUShort(&op2, value2);
2172 }
2173
2174 unsigned int GetOpChar(struct Operand * op2, char * value2)
2175 {
2176 if(op2->kind == 3 && op2->type->isSigned)
2177 *value2 = (char)op2->i;
2178 else if(op2->kind == 3)
2179 *value2 = (char)op2->ui;
2180 else if(op2->kind == 4 && op2->type->isSigned)
2181 *value2 = (char)op2->i64;
2182 else if(op2->kind == 4)
2183 *value2 = (char)op2->ui64;
2184 else if(op2->kind == 23 && op2->type->isSigned)
2185 *value2 = (char)op2->i64;
2186 else if(op2->kind == 23)
2187 *value2 = (char)op2->ui64;
2188 else if(op2->kind == 22 && op2->type->isSigned)
2189 *value2 = (char)op2->i64;
2190 else if(op2->kind == 22)
2191 *value2 = (char)op2->ui64;
2192 else if(op2->kind == 2 && op2->type->isSigned)
2193 *value2 = (char)op2->s;
2194 else if(op2->kind == 2)
2195 *value2 = (char)op2->us;
2196 else if(op2->kind == 1 && op2->type->isSigned)
2197 *value2 = op2->c;
2198 else if(op2->kind == 24 || op2->kind == 1)
2199 *value2 = (char)op2->uc;
2200 else if(op2->kind == 6)
2201 *value2 = (char)op2->f;
2202 else if(op2->kind == 7)
2203 *value2 = (char)op2->d;
2204 else if(op2->kind == 13)
2205 *value2 = (char)op2->ui64;
2206 else
2207 return 0x0;
2208 return 0x1;
2209 }
2210
2211 unsigned int GetChar(struct Expression * exp, char * value2)
2212 {
2213 struct Operand op2 = GetOperand(exp);
2214
2215 return GetOpChar(&op2, value2);
2216 }
2217
2218 unsigned int GetOpUChar(struct Operand * op2, unsigned char * value2)
2219 {
2220 if(op2->kind == 3 && op2->type->isSigned)
2221 *value2 = (unsigned char)op2->i;
2222 else if(op2->kind == 3)
2223 *value2 = (unsigned char)op2->ui;
2224 else if(op2->kind == 4 && op2->type->isSigned)
2225 *value2 = (unsigned char)op2->i64;
2226 else if(op2->kind == 4)
2227 *value2 = (unsigned char)op2->ui64;
2228 else if(op2->kind == 23 && op2->type->isSigned)
2229 *value2 = (unsigned char)op2->i64;
2230 else if(op2->kind == 23)
2231 *value2 = (unsigned char)op2->ui64;
2232 else if(op2->kind == 22 && op2->type->isSigned)
2233 *value2 = (unsigned char)op2->i64;
2234 else if(op2->kind == 22)
2235 *value2 = (unsigned char)op2->ui64;
2236 else if(op2->kind == 2 && op2->type->isSigned)
2237 *value2 = (unsigned char)op2->s;
2238 else if(op2->kind == 2)
2239 *value2 = (unsigned char)op2->us;
2240 else if(op2->kind == 1 && op2->type->isSigned)
2241 *value2 = (unsigned char)op2->c;
2242 else if(op2->kind == 24 || op2->kind == 1)
2243 *value2 = op2->uc;
2244 else if(op2->kind == 6)
2245 *value2 = (unsigned char)op2->f;
2246 else if(op2->kind == 7)
2247 *value2 = (unsigned char)op2->d;
2248 else if(op2->kind == 13)
2249 *value2 = (unsigned char)op2->ui64;
2250 else
2251 return 0x0;
2252 return 0x1;
2253 }
2254
2255 unsigned int GetUChar(struct Expression * exp, unsigned char * value2)
2256 {
2257 struct Operand op2 = GetOperand(exp);
2258
2259 return GetOpUChar(&op2, value2);
2260 }
2261
2262 unsigned int GetOpFloat(struct Operand * op2, float * value2)
2263 {
2264 if(op2->kind == 3 && op2->type->isSigned)
2265 *value2 = (float)(float)op2->i;
2266 else if(op2->kind == 3)
2267 *value2 = (float)(float)op2->ui;
2268 else if(op2->kind == 4 && op2->type->isSigned)
2269 *value2 = (float)(float)op2->i64;
2270 else if(op2->kind == 4)
2271 *value2 = (float)(float)op2->ui64;
2272 else if(op2->kind == 23 && op2->type->isSigned)
2273 *value2 = (float)(float)op2->i64;
2274 else if(op2->kind == 23)
2275 *value2 = (float)(float)op2->ui64;
2276 else if(op2->kind == 22 && op2->type->isSigned)
2277 *value2 = (float)(float)op2->i64;
2278 else if(op2->kind == 22)
2279 *value2 = (float)(float)op2->ui64;
2280 else if(op2->kind == 2 && op2->type->isSigned)
2281 *value2 = (float)(float)op2->s;
2282 else if(op2->kind == 2)
2283 *value2 = (float)(float)op2->us;
2284 else if(op2->kind == 1 && op2->type->isSigned)
2285 *value2 = (float)(float)op2->c;
2286 else if(op2->kind == 24 || op2->kind == 1)
2287 *value2 = (float)(float)op2->uc;
2288 else if(op2->kind == 6)
2289 *value2 = (float)op2->f;
2290 else if(op2->kind == 7)
2291 *value2 = (float)op2->d;
2292 else if(op2->kind == 13)
2293 *value2 = (float)(float)op2->ui64;
2294 else
2295 return 0x0;
2296 return 0x1;
2297 }
2298
2299 unsigned int GetFloat(struct Expression * exp, float * value2)
2300 {
2301 struct Operand op2 = GetOperand(exp);
2302
2303 return GetOpFloat(&op2, value2);
2304 }
2305
2306 unsigned int GetOpDouble(struct Operand * op2, double * value2)
2307 {
2308 if(op2->kind == 3 && op2->type->isSigned)
2309 *value2 = (double)(double)op2->i;
2310 else if(op2->kind == 3)
2311 *value2 = (double)(double)op2->ui;
2312 else if(op2->kind == 4 && op2->type->isSigned)
2313 *value2 = (double)(double)op2->i64;
2314 else if(op2->kind == 4)
2315 *value2 = (double)(double)op2->ui64;
2316 else if(op2->kind == 23 && op2->type->isSigned)
2317 *value2 = (double)(double)op2->i64;
2318 else if(op2->kind == 23)
2319 *value2 = (double)(double)op2->ui64;
2320 else if(op2->kind == 22 && op2->type->isSigned)
2321 *value2 = (double)(double)op2->i64;
2322 else if(op2->kind == 22)
2323 *value2 = (double)(double)op2->ui64;
2324 else if(op2->kind == 2 && op2->type->isSigned)
2325 *value2 = (double)(double)op2->s;
2326 else if(op2->kind == 2)
2327 *value2 = (double)(double)op2->us;
2328 else if(op2->kind == 1 && op2->type->isSigned)
2329 *value2 = (double)(double)op2->c;
2330 else if(op2->kind == 24 || op2->kind == 1)
2331 *value2 = (double)(double)op2->uc;
2332 else if(op2->kind == 6)
2333 *value2 = (double)op2->f;
2334 else if(op2->kind == 7)
2335 *value2 = (double)op2->d;
2336 else if(op2->kind == 13)
2337 *value2 = (double)(double)op2->ui64;
2338 else
2339 return 0x0;
2340 return 0x1;
2341 }
2342
2343 unsigned int GetDouble(struct Expression * exp, double * value2)
2344 {
2345 struct Operand op2 = GetOperand(exp);
2346
2347 return GetOpDouble(&op2, value2);
2348 }
2349
2350 void ComputeExpression(struct Expression * exp);
2351
2352 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class);
2353
2354 extern int targetBits;
2355
2356 int ComputeTypeSize(struct Type * type);
2357
2358 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BitMember;
2359
2360 struct __ecereNameSpace__ecere__com__BitMember
2361 {
2362 struct __ecereNameSpace__ecere__com__BitMember * prev;
2363 struct __ecereNameSpace__ecere__com__BitMember * next;
2364 char *  name;
2365 unsigned int isProperty;
2366 int memberAccess;
2367 int id;
2368 struct __ecereNameSpace__ecere__com__Class * _class;
2369 char *  dataTypeString;
2370 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
2371 struct Type * dataType;
2372 int type;
2373 int size;
2374 int pos;
2375 uint64 mask;
2376 } __attribute__ ((gcc_struct));
2377
2378 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__OldLink;
2379
2380 struct __ecereNameSpace__ecere__sys__OldLink
2381 {
2382 struct __ecereNameSpace__ecere__sys__OldLink * prev;
2383 struct __ecereNameSpace__ecere__sys__OldLink * next;
2384 void *  data;
2385 } __attribute__ ((gcc_struct));
2386
2387 void FinishTemplatesContext(struct Context * context);
2388
2389 void ComputeClassMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
2390 {
2391 struct __ecereNameSpace__ecere__com__DataMember * member = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2392 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2393
2394 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))
2395 {
2396 int c;
2397 int unionMemberOffset = 0;
2398 int bitFields = 0;
2399
2400 if(member)
2401 {
2402 member->memberOffset = 0;
2403 if(targetBits < sizeof(void *) * 8)
2404 member->structAlignment = 0;
2405 }
2406 else if(targetBits < sizeof(void *) * 8)
2407 _class->structAlignment = 0;
2408 if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize)))
2409 _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0;
2410 if(!member && _class->destructionWatchOffset)
2411 _class->memberOffset += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2412 {
2413 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2414
2415 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2416 {
2417 if(!dataMember->isProperty)
2418 {
2419 if(dataMember->type == 0 && dataMember->dataTypeString && !dataMember->dataType)
2420 {
2421 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
2422 }
2423 }
2424 }
2425 }
2426 {
2427 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
2428
2429 for(dataMember = member ? member->members.first : _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
2430 {
2431 if(!dataMember->isProperty && (dataMember->type != 0 || dataMember->dataTypeString))
2432 {
2433 if(!isMember && _class->type == 2 && dataMember->dataType)
2434 {
2435 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
2436 uint64 mask = 0;
2437 int d;
2438
2439 ComputeTypeSize(dataMember->dataType);
2440 if(bitMember->pos == -1)
2441 bitMember->pos = _class->memberOffset;
2442 if(!bitMember->size)
2443 bitMember->size = dataMember->dataType->size * 8;
2444 _class->memberOffset = bitMember->pos + bitMember->size;
2445 for(d = 0; d < bitMember->size; d++)
2446 {
2447 if(d)
2448 mask <<= 1;
2449 mask |= 1;
2450 }
2451 bitMember->mask = mask << bitMember->pos;
2452 }
2453 else if(dataMember->type == 0 && dataMember->dataType)
2454 {
2455 int size;
2456 int alignment = 0;
2457
2458 if(dataMember->dataType->kind != 8 || ((!dataMember->dataType->_class || !dataMember->dataType->_class->registered || dataMember->dataType->_class->registered != _class || _class->type != 1)))
2459 ComputeTypeSize(dataMember->dataType);
2460 if(dataMember->dataType->bitFieldCount)
2461 {
2462 bitFields += dataMember->dataType->bitFieldCount;
2463 size = 0;
2464 }
2465 else
2466 {
2467 if(bitFields)
2468 {
2469 int size = (bitFields + 7) / 8;
2470
2471 if(isMember)
2472 {
2473 int __simpleStruct0;
2474
2475 if(alignment)
2476 {
2477 int __simpleStruct0;
2478
2479 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2480 if(member->memberOffset % alignment)
2481 member->memberOffset += alignment - (member->memberOffset % alignment);
2482 }
2483 dataMember->offset = member->memberOffset;
2484 if(member->type == 1)
2485 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2486 else
2487 {
2488 member->memberOffset += size;
2489 }
2490 }
2491 else
2492 {
2493 if(alignment)
2494 {
2495 int __simpleStruct0;
2496
2497 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2498 if(_class->memberOffset % alignment)
2499 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2500 }
2501 dataMember->offset = _class->memberOffset;
2502 _class->memberOffset += size;
2503 }
2504 bitFields = 0;
2505 }
2506 size = dataMember->dataType->size;
2507 alignment = dataMember->dataType->alignment;
2508 }
2509 if(isMember)
2510 {
2511 int __simpleStruct0;
2512
2513 if(alignment)
2514 {
2515 int __simpleStruct0;
2516
2517 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2518 if(member->memberOffset % alignment)
2519 member->memberOffset += alignment - (member->memberOffset % alignment);
2520 }
2521 dataMember->offset = member->memberOffset;
2522 if(member->type == 1)
2523 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2524 else
2525 {
2526 member->memberOffset += size;
2527 }
2528 }
2529 else
2530 {
2531 if(alignment)
2532 {
2533 int __simpleStruct0;
2534
2535 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2536 if(_class->memberOffset % alignment)
2537 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2538 }
2539 dataMember->offset = _class->memberOffset;
2540 _class->memberOffset += size;
2541 }
2542 }
2543 else
2544 {
2545 int alignment;
2546
2547 ComputeClassMembers((struct __ecereNameSpace__ecere__com__Class *)dataMember, 0x1);
2548 alignment = dataMember->structAlignment;
2549 if(isMember)
2550 {
2551 int __simpleStruct0;
2552
2553 if(alignment)
2554 {
2555 int __simpleStruct0;
2556
2557 if(member->memberOffset % alignment)
2558 member->memberOffset += alignment - (member->memberOffset % alignment);
2559 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2560 }
2561 dataMember->offset = member->memberOffset;
2562 if(member->type == 1)
2563 unionMemberOffset = (__simpleStruct0 = dataMember->memberOffset, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2564 else
2565 member->memberOffset += dataMember->memberOffset;
2566 }
2567 else
2568 {
2569 if(alignment)
2570 {
2571 int __simpleStruct0;
2572
2573 if(_class->memberOffset % alignment)
2574 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2575 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2576 }
2577 dataMember->offset = _class->memberOffset;
2578 _class->memberOffset += dataMember->memberOffset;
2579 }
2580 }
2581 }
2582 }
2583 if(bitFields)
2584 {
2585 int alignment = 0;
2586 int size = (bitFields + 7) / 8;
2587
2588 if(isMember)
2589 {
2590 int __simpleStruct0;
2591
2592 if(alignment)
2593 {
2594 int __simpleStruct0;
2595
2596 member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2597 if(member->memberOffset % alignment)
2598 member->memberOffset += alignment - (member->memberOffset % alignment);
2599 }
2600 if(member->type == 1)
2601 unionMemberOffset = (__simpleStruct0 = dataMember->dataType->size, (unionMemberOffset > __simpleStruct0) ? unionMemberOffset : __simpleStruct0);
2602 else
2603 {
2604 member->memberOffset += size;
2605 }
2606 }
2607 else
2608 {
2609 if(alignment)
2610 {
2611 int __simpleStruct0;
2612
2613 _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment);
2614 if(_class->memberOffset % alignment)
2615 _class->memberOffset += alignment - (_class->memberOffset % alignment);
2616 }
2617 _class->memberOffset += size;
2618 }
2619 bitFields = 0;
2620 }
2621 }
2622 if(member && member->type == 1)
2623 {
2624 member->memberOffset = unionMemberOffset;
2625 }
2626 if(!isMember)
2627 {
2628 if(_class->type != 2)
2629 {
2630 int extra = 0;
2631
2632 if(_class->structAlignment)
2633 {
2634 if(_class->memberOffset % _class->structAlignment)
2635 extra += _class->structAlignment - (_class->memberOffset % _class->structAlignment);
2636 }
2637 _class->structSize = (_class->base ? (_class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize) : 0) + _class->memberOffset + extra;
2638 if(!member)
2639 {
2640 struct __ecereNameSpace__ecere__com__Property * prop;
2641
2642 for(prop = _class->membersAndProperties.first; prop; prop = prop->next)
2643 {
2644 if(prop->isProperty && prop->isWatchable)
2645 {
2646 prop->watcherOffset = _class->structSize;
2647 _class->structSize += sizeof(struct __ecereNameSpace__ecere__sys__OldList);
2648 }
2649 }
2650 }
2651 {
2652 struct __ecereNameSpace__ecere__sys__OldLink * derivative;
2653
2654 for(derivative = _class->derivatives.first; derivative; derivative = derivative->next)
2655 {
2656 struct __ecereNameSpace__ecere__com__Class * deriv = derivative->data;
2657
2658 if(deriv->computeSize)
2659 {
2660 deriv->offset = _class->structSize;
2661 deriv->memberOffset = 0;
2662 deriv->structSize = deriv->offset;
2663 ComputeClassMembers(deriv, 0x0);
2664 }
2665 }
2666 }
2667 }
2668 }
2669 }
2670 if(context)
2671 FinishTemplatesContext(context);
2672 }
2673
2674 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__NameSpace;
2675
2676 struct __ecereNameSpace__ecere__com__NameSpace
2677 {
2678 char *  name;
2679 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
2680 struct __ecereNameSpace__ecere__com__NameSpace *  left;
2681 struct __ecereNameSpace__ecere__com__NameSpace *  right;
2682 int depth;
2683 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
2684 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
2685 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
2686 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
2687 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
2688 } __attribute__ ((gcc_struct));
2689
2690 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Module;
2691
2692 struct __ecereNameSpace__ecere__com__Module
2693 {
2694 struct __ecereNameSpace__ecere__com__Instance * application;
2695 struct __ecereNameSpace__ecere__sys__OldList classes;
2696 struct __ecereNameSpace__ecere__sys__OldList defines;
2697 struct __ecereNameSpace__ecere__sys__OldList functions;
2698 struct __ecereNameSpace__ecere__sys__OldList modules;
2699 struct __ecereNameSpace__ecere__com__Instance * prev;
2700 struct __ecereNameSpace__ecere__com__Instance * next;
2701 char *  name;
2702 void *  library;
2703 void *  Unload;
2704 int importType;
2705 int origImportType;
2706 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
2707 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
2708 } __attribute__ ((gcc_struct));
2709
2710 void ComputeModuleClasses(struct __ecereNameSpace__ecere__com__Instance * module)
2711 {
2712 struct __ecereNameSpace__ecere__com__Class * _class;
2713 struct __ecereNameSpace__ecere__sys__OldLink * subModule;
2714
2715 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
2716 ComputeModuleClasses(subModule->data);
2717 for(_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->classes.first; _class; _class = _class->next)
2718 ComputeClassMembers(_class, 0x0);
2719 }
2720
2721 extern unsigned int inCompiler;
2722
2723 extern void Compiler_Error(char *  format, ...);
2724
2725 extern char *  __ecereNameSpace__ecere__GetTranslatedString(char * name, char *  string, char *  stringAndContext);
2726
2727 int ComputeTypeSize(struct Type * type)
2728 {
2729 unsigned int size = type ? type->size : 0;
2730
2731 if(!size && type && !type->computing)
2732 {
2733 type->computing = 0x1;
2734 switch(type->kind)
2735 {
2736 case 24:
2737 type->alignment = size = sizeof(char);
2738 break;
2739 case 1:
2740 type->alignment = size = sizeof(char);
2741 break;
2742 case 3:
2743 type->alignment = size = sizeof(int);
2744 break;
2745 case 4:
2746 type->alignment = size = sizeof(long long);
2747 break;
2748 case 22:
2749 type->alignment = size = targetBits / 8;
2750 break;
2751 case 23:
2752 type->alignment = size = targetBits / 8;
2753 break;
2754 case 5:
2755 type->alignment = size = sizeof(long);
2756 break;
2757 case 2:
2758 type->alignment = size = sizeof(short);
2759 break;
2760 case 6:
2761 type->alignment = size = sizeof(float);
2762 break;
2763 case 7:
2764 type->alignment = size = sizeof(double);
2765 break;
2766 case 8:
2767 {
2768 struct __ecereNameSpace__ecere__com__Class * _class = type->_class ? type->_class->registered : (((void *)0));
2769
2770 if(_class && _class->type == 1)
2771 {
2772 ComputeClassMembers(_class, 0x0);
2773 type->alignment = _class->structAlignment;
2774 size = _class->structSize;
2775 if(type->alignment && size % type->alignment)
2776 size += type->alignment - (size % type->alignment);
2777 }
2778 else if(_class && (_class->type == 3 || _class->type == 4 || _class->type == 2))
2779 {
2780 if(!_class->dataType)
2781 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
2782 size = type->alignment = ComputeTypeSize(_class->dataType);
2783 }
2784 else
2785 size = type->alignment = targetBits / 8;
2786 break;
2787 }
2788 case 13:
2789 case 19:
2790 size = type->alignment = targetBits / 8;
2791 break;
2792 case 12:
2793 if(type->arraySizeExp)
2794 {
2795 ProcessExpressionType(type->arraySizeExp);
2796 ComputeExpression(type->arraySizeExp);
2797 if(!type->arraySizeExp->isConstant || (type->arraySizeExp->expType->kind != 3 && type->arraySizeExp->expType->kind != 15 && (type->arraySizeExp->expType->kind != 8 || !type->arraySizeExp->expType->_class->registered || type->arraySizeExp->expType->_class->registered->type != 4)))
2798 {
2799 struct Location oldLoc = yylloc;
2800 char expression[10240];
2801
2802 expression[0] = '\0';
2803 type->arraySizeExp->expType = (((void *)0));
2804 yylloc = type->arraySizeExp->loc;
2805 if(inCompiler)
2806 PrintExpression(type->arraySizeExp, expression);
2807 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Array size not constant int (%s)\n", (((void *)0))), expression);
2808 yylloc = oldLoc;
2809 }
2810 GetInt(type->arraySizeExp, &type->arraySize);
2811 }
2812 else if(type->enumClass)
2813 {
2814 if(type->enumClass && type->enumClass->registered && type->enumClass->registered->type == 4)
2815 {
2816 type->arraySize = (int)__ecereNameSpace__ecere__com__eClass_GetProperty(type->enumClass->registered, "enumSize");
2817 }
2818 else
2819 type->arraySize = 0;
2820 }
2821 else
2822 {
2823 type->arraySize = 0;
2824 }
2825 size = ComputeTypeSize(type->type) * type->arraySize;
2826 if(type->type)
2827 type->alignment = type->type->alignment;
2828 break;
2829 case 9:
2830 {
2831 struct Type * member;
2832
2833 for(member = type->members.first; member; member = member->next)
2834 {
2835 int __simpleStruct0, __simpleStruct1;
2836 unsigned int addSize = ComputeTypeSize(member);
2837
2838 member->offset = size;
2839 if(member->alignment && size % member->alignment)
2840 member->offset += member->alignment - (size % member->alignment);
2841 size = member->offset;
2842 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2843 size += addSize;
2844 }
2845 if(type->alignment && size % type->alignment)
2846 size += type->alignment - (size % type->alignment);
2847 break;
2848 }
2849 case 10:
2850 {
2851 struct Type * member;
2852
2853 for(member = type->members.first; member; member = member->next)
2854 {
2855 int __simpleStruct0, __simpleStruct1;
2856 unsigned int addSize = ComputeTypeSize(member);
2857
2858 member->offset = size;
2859 if(member->alignment && size % member->alignment)
2860 member->offset += member->alignment - (size % member->alignment);
2861 size = member->offset;
2862 type->alignment = (__simpleStruct0 = type->alignment, __simpleStruct1 = member->alignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1);
2863 size = ((size > addSize) ? size : addSize);
2864 }
2865 if(type->alignment && size % type->alignment)
2866 size += type->alignment - (size % type->alignment);
2867 break;
2868 }
2869 case 20:
2870 {
2871 struct TemplateParameter * param = type->templateParameter;
2872 struct Type * baseType = ProcessTemplateParameterType(param);
2873
2874 if(baseType)
2875 {
2876 size = ComputeTypeSize(baseType);
2877 type->alignment = baseType->alignment;
2878 }
2879 else
2880 type->alignment = size = sizeof(uint64);
2881 break;
2882 }
2883 case 15:
2884 {
2885 type->alignment = size = sizeof(enum
2886 {
2887 test
2888 });
2889 break;
2890 }
2891 case 21:
2892 {
2893 type->alignment = size = targetBits / 8;
2894 break;
2895 }
2896 }
2897 type->size = size;
2898 type->computing = 0x0;
2899 }
2900 return size;
2901 }
2902
2903 extern struct Declarator * MkDeclaratorIdentifier(struct Identifier * id);
2904
2905 extern struct Identifier * MkIdentifier(char *  string);
2906
2907 extern void ListAdd(struct __ecereNameSpace__ecere__sys__OldList * list, void *  item);
2908
2909 extern struct Declarator * MkStructDeclarator(struct Declarator * declarator, struct Expression * exp);
2910
2911 extern struct ClassDef * MkClassDefDeclaration(struct Declaration * decl);
2912
2913 extern struct Declaration * MkStructDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * declarators, struct Specifier * extStorage);
2914
2915 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class);
2916
2917 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams);
2918
2919 extern void FreeType(struct Type * type);
2920
2921 extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * definitions);
2922
2923 extern struct Specifier * MkSpecifier(int specifier);
2924
2925 extern struct Declarator * MkDeclaratorArray(struct Declarator * declarator, struct Expression * exp);
2926
2927 extern struct Expression * MkExpConstant(char *  string);
2928
2929 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)
2930 {
2931 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
2932 unsigned int totalSize = 0;
2933 unsigned int maxSize = 0;
2934 int alignment, size;
2935 struct __ecereNameSpace__ecere__com__DataMember * member;
2936 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
2937
2938 if(addedPadding)
2939 *addedPadding = 0x0;
2940 if(!isMember && _class->base)
2941 {
2942 maxSize = _class->structSize;
2943 {
2944 if(_class->type == 1 || _class->type == 5)
2945 AddMembers(declarations, _class->base, 0x0, &totalSize, topClass, (((void *)0)));
2946 else
2947 {
2948 unsigned int baseSize = _class->base->templateClass ? _class->base->templateClass->structSize : _class->base->structSize;
2949
2950 if(maxSize > baseSize)
2951 maxSize -= baseSize;
2952 else
2953 maxSize = 0;
2954 }
2955 }
2956 }
2957 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
2958 {
2959 if(!member->isProperty)
2960 {
2961 switch(member->type)
2962 {
2963 case 0:
2964 {
2965 if(member->dataTypeString)
2966 {
2967 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList();
2968 struct Declarator * decl;
2969
2970 decl = SpecDeclFromString(member->dataTypeString, specs, MkDeclaratorIdentifier(MkIdentifier(member->name)));
2971 ListAdd(decls, MkStructDeclarator(decl, (((void *)0))));
2972 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, decls, (((void *)0)))));
2973 if(!member->dataType)
2974 member->dataType = ProcessType(specs, decl);
2975 ReplaceThisClassSpecifiers(specs, topClass);
2976 {
2977 struct Type * type = ProcessType(specs, decl);
2978
2979 DeclareType(member->dataType, 0x0, 0x0);
2980 FreeType(type);
2981 }
2982 ComputeTypeSize(member->dataType);
2983 size = member->dataType->size;
2984 alignment = member->dataType->alignment;
2985 if(alignment)
2986 {
2987 if(totalSize % alignment)
2988 totalSize += alignment - (totalSize % alignment);
2989 }
2990 totalSize += size;
2991 }
2992 break;
2993 }
2994 case 1:
2995 case 2:
2996 {
2997 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * list = MkList();
2998
2999 size = 0;
3000 AddMembers(list, (struct __ecereNameSpace__ecere__com__Class *)member, 0x1, &size, topClass, (((void *)0)));
3001 ListAdd(specs, MkStructOrUnion((member->type == 1) ? 4 : 3, (((void *)0)), list));
3002 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(specs, (((void *)0)), (((void *)0)))));
3003 alignment = member->structAlignment;
3004 if(alignment)
3005 {
3006 if(totalSize % alignment)
3007 totalSize += alignment - (totalSize % alignment);
3008 }
3009 totalSize += size;
3010 break;
3011 }
3012 }
3013 }
3014 }
3015 if(retSize)
3016 {
3017 unsigned int __simpleStruct0;
3018
3019 if(topMember && topMember->type == 1)
3020 *retSize = (__simpleStruct0 = *retSize, (__simpleStruct0 > totalSize) ? __simpleStruct0 : totalSize);
3021 else
3022 *retSize += totalSize;
3023 }
3024 else if(totalSize < maxSize && _class->type != 1000)
3025 {
3026 int autoPadding = 0;
3027
3028 if(!isMember && _class->structAlignment && totalSize % _class->structAlignment)
3029 autoPadding = _class->structAlignment - (totalSize % _class->structAlignment);
3030 if(totalSize + autoPadding < maxSize)
3031 {
3032 char sizeString[50];
3033
3034 sprintf(sizeString, "%d", maxSize - totalSize);
3035 ListAdd(declarations, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(CHAR)), MkListOne(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__ecere_padding")), MkExpConstant(sizeString))), (((void *)0)))));
3036 if(addedPadding)
3037 *addedPadding = 0x1;
3038 }
3039 }
3040 if(context)
3041 FinishTemplatesContext(context);
3042 return topMember ? topMember->memberID : _class->memberID;
3043 }
3044
3045 static int DeclareMembers(struct __ecereNameSpace__ecere__com__Class * _class, unsigned int isMember)
3046 {
3047 struct __ecereNameSpace__ecere__com__DataMember * topMember = isMember ? (struct __ecereNameSpace__ecere__com__DataMember *)_class : (((void *)0));
3048 unsigned int totalSize = 0;
3049 struct __ecereNameSpace__ecere__com__DataMember * member;
3050 struct Context * context = isMember ? (((void *)0)) : SetupTemplatesContext(_class);
3051
3052 if(!isMember && (_class->type == 1 || _class->type == 5) && _class->base->type != 1000)
3053 DeclareMembers(_class->base, 0x0);
3054 for(member = isMember ? topMember->members.first : _class->membersAndProperties.first; member; member = member->next)
3055 {
3056 if(!member->isProperty)
3057 {
3058 switch(member->type)
3059 {
3060 case 0:
3061 {
3062 if(!member->dataType && member->dataTypeString)
3063 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
3064 if(member->dataType)
3065 DeclareType(member->dataType, 0x0, 0x0);
3066 break;
3067 }
3068 case 1:
3069 case 2:
3070 {
3071 DeclareMembers((struct __ecereNameSpace__ecere__com__Class *)member, 0x1);
3072 break;
3073 }
3074 }
3075 }
3076 }
3077 if(context)
3078 FinishTemplatesContext(context);
3079 return topMember ? topMember->memberID : _class->memberID;
3080 }
3081
3082 extern struct Symbol * FindClass(char *  name);
3083
3084 extern char *  strchr(const char * , int);
3085
3086 extern void FullClassNameCat(char *  output, char *  className, unsigned int includeTemplateParams);
3087
3088 extern void FreeList(struct __ecereNameSpace__ecere__sys__OldList * list, void (*  FreeFunction)(void * ));
3089
3090 extern void FreeClassDef(struct ClassDef * def);
3091
3092 extern struct External * MkExternalDeclaration(struct Declaration * declaration);
3093
3094 extern struct Declaration * MkDeclaration(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct __ecereNameSpace__ecere__sys__OldList * initDeclarators);
3095
3096 extern void MangleClassName(char *  className);
3097
3098 extern void DeclareClass(struct Symbol * classSym, char *  className);
3099
3100 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item, void *  prevItem);
3101
3102 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(struct __ecereNameSpace__ecere__sys__OldList * this, void *  prevItem, void *  item);
3103
3104 void DeclareStruct(char * name, unsigned int skipNoHead)
3105 {
3106 struct External * external = (((void *)0));
3107 struct Symbol * classSym = FindClass(name);
3108
3109 if(!inCompiler || !classSym)
3110 return ;
3111 if(classSym->registered && (classSym->registered->type == 2 || classSym->registered->type == 3 || classSym->registered->type == 4))
3112 return ;
3113 if(classSym->registered && classSym->imported && !classSym->declaredStructSym)
3114 {
3115 struct Declaration * decl;
3116 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3117 struct __ecereNameSpace__ecere__sys__OldList * declarations = (((void *)0));
3118 char structName[1024];
3119 struct Specifier * spec = (((void *)0));
3120
3121 external = (classSym->registered && classSym->registered->type == 1) ? classSym->pointerExternal : classSym->structExternal;
3122 classSym->declaring++;
3123 if(strchr(classSym->string, '<'))
3124 {
3125 if(classSym->registered->templateClass)
3126 {
3127 DeclareStruct(classSym->registered->templateClass->fullName, skipNoHead);
3128 classSym->declaring--;
3129 }
3130 return ;
3131 }
3132 DeclareMembers(classSym->registered, 0x0);
3133 structName[0] = (char)0;
3134 FullClassNameCat(structName, name, 0x0);
3135 if(external && external->declaration && external->declaration->specifiers)
3136 {
3137 for(spec = (*external->declaration->specifiers).first; spec; spec = spec->next)
3138 {
3139 if(spec->type == 3 || spec->type == 4)
3140 break;
3141 }
3142 }
3143 if(!skipNoHead && (!spec || !spec->definitions))
3144 {
3145 unsigned int addedPadding = 0x0;
3146
3147 classSym->declaredStructSym = 0x1;
3148 declarations = MkList();
3149 AddMembers(declarations, classSym->registered, 0x0, (((void *)0)), classSym->registered, &addedPadding);
3150 if(!(*declarations).count || ((*declarations).count == 1 && addedPadding))
3151 {
3152 FreeList(declarations, FreeClassDef);
3153 declarations = (((void *)0));
3154 }
3155 }
3156 if(skipNoHead || declarations)
3157 {
3158 if(spec)
3159 {
3160 if(declarations)
3161 spec->definitions = declarations;
3162 if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3163 {
3164 if(classSym->structExternal)
3165 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3166 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3167 classSym->id = curExternal->symbol->idCode;
3168 classSym->idCode = curExternal->symbol->idCode;
3169 }
3170 }
3171 else
3172 {
3173 if(!external)
3174 external = MkExternalDeclaration((((void *)0)));
3175 specifiers = MkList();
3176 declarators = MkList();
3177 ListAdd(specifiers, MkStructOrUnion(3, MkIdentifier(structName), declarations));
3178 external->declaration = decl = MkDeclaration(specifiers, declarators);
3179 if(decl->symbol && !decl->symbol->pointerExternal)
3180 decl->symbol->pointerExternal = external;
3181 if(classSym->registered && classSym->registered->type == 1)
3182 {
3183 char className[1024];
3184
3185 strcpy(className, "__ecereClass_");
3186 FullClassNameCat(className, classSym->string, 0x1);
3187 MangleClassName(className);
3188 DeclareClass(classSym, className);
3189 external->symbol = classSym;
3190 classSym->pointerExternal = external;
3191 classSym->id = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3192 classSym->idCode = (curExternal && curExternal->symbol) ? curExternal->symbol->idCode : 0;
3193 }
3194 else
3195 {
3196 char className[1024];
3197
3198 strcpy(className, "__ecereClass_");
3199 FullClassNameCat(className, classSym->string, 0x1);
3200 MangleClassName(className);
3201 classSym->structExternal = external;
3202 DeclareClass(classSym, className);
3203 external->symbol = classSym;
3204 }
3205 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
3206 }
3207 }
3208 classSym->declaring--;
3209 }
3210 else if(curExternal && curExternal->symbol && curExternal->symbol->idCode < classSym->id)
3211 {
3212 classSym->declaring++;
3213 {
3214 if(classSym->registered)
3215 DeclareMembers(classSym->registered, 0x0);
3216 }
3217 if(classSym->registered && (classSym->registered->type == 1 || classSym->registered->type == 5))
3218 {
3219 if(classSym->structExternal)
3220 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->structExternal, curExternal->prev);
3221 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), classSym->pointerExternal, curExternal->prev);
3222 classSym->id = curExternal->symbol->idCode;
3223 classSym->idCode = curExternal->symbol->idCode;
3224 }
3225 classSym->declaring--;
3226 }
3227 }
3228
3229 extern struct ModuleImport * FindModule(struct __ecereNameSpace__ecere__com__Instance * moduleToFind);
3230
3231 extern struct ModuleImport * mainModule;
3232
3233 extern struct Specifier * MkSpecifierName(char *  name);
3234
3235 extern struct Declarator * MkDeclaratorBrackets(struct Declarator * declarator);
3236
3237 extern struct Declarator * PlugDeclarator(struct Declarator * decl, struct Declarator * baseDecl);
3238
3239 extern struct Declarator * MkDeclaratorFunction(struct Declarator * declarator, struct __ecereNameSpace__ecere__sys__OldList * parameters);
3240
3241 extern struct InitDeclarator * MkInitDeclarator(struct Declarator * declarator, struct Initializer * initializer);
3242
3243 extern void FreeDeclarator(struct Declarator * decl);
3244
3245 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyImport;
3246
3247 struct PropertyImport
3248 {
3249 struct PropertyImport * prev;
3250 struct PropertyImport * next;
3251 char *  name;
3252 unsigned int isVirtual;
3253 unsigned int hasSet;
3254 unsigned int hasGet;
3255 } __attribute__ ((gcc_struct));
3256
3257 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
3258
3259 void DeclareProperty(struct __ecereNameSpace__ecere__com__Property * prop, char * setName, char * getName)
3260 {
3261 struct Symbol * symbol = prop->symbol;
3262 char propName[1024];
3263
3264 strcpy(setName, "__ecereProp_");
3265 FullClassNameCat(setName, prop->_class->fullName, 0x0);
3266 strcat(setName, "_Set_");
3267 FullClassNameCat(setName, prop->name, 0x1);
3268 strcpy(getName, "__ecereProp_");
3269 FullClassNameCat(getName, prop->_class->fullName, 0x0);
3270 strcat(getName, "_Get_");
3271 FullClassNameCat(getName, prop->name, 0x1);
3272 strcpy(propName, "__ecereProp_");
3273 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3274 strcat(propName, "_");
3275 FullClassNameCat(propName, prop->name, 0x1);
3276 MangleClassName(getName);
3277 MangleClassName(setName);
3278 MangleClassName(propName);
3279 if(prop->_class->type == 1)
3280 DeclareStruct(prop->_class->fullName, 0x0);
3281 if(!symbol || curExternal->symbol->idCode < symbol->id)
3282 {
3283 unsigned int imported = 0x0;
3284 unsigned int dllImport = 0x0;
3285
3286 if(!symbol || symbol->_import)
3287 {
3288 if(!symbol)
3289 {
3290 struct Symbol * classSym;
3291
3292 if(!prop->_class->symbol)
3293 prop->_class->symbol = FindClass(prop->_class->fullName);
3294 classSym = prop->_class->symbol;
3295 if(classSym && !classSym->_import)
3296 {
3297 struct ModuleImport * module;
3298
3299 if(prop->_class->module)
3300 module = FindModule(prop->_class->module);
3301 else
3302 module = mainModule;
3303 classSym->_import = __extension__ ({
3304 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
3305
3306 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->_class->fullName), __ecereInstance1->isRemote = prop->_class->isRemote, __ecereInstance1;
3307 });
3308 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
3309 }
3310 symbol = prop->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
3311 symbol->_import = (struct ClassImport *)__extension__ ({
3312 struct PropertyImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_PropertyImport);
3313
3314 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(prop->name), __ecereInstance1->isVirtual = 0x0, __ecereInstance1->hasSet = prop->Set ? 0x1 : 0x0, __ecereInstance1->hasGet = prop->Get ? 0x1 : 0x0, __ecereInstance1;
3315 });
3316 if(classSym)
3317 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->properties, symbol->_import);
3318 }
3319 imported = 0x1;
3320 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)
3321 dllImport = 0x1;
3322 }
3323 if(!symbol->type)
3324 {
3325 struct Context * context = SetupTemplatesContext(prop->_class);
3326
3327 symbol->type = ProcessTypeString(prop->dataTypeString, 0x0);
3328 FinishTemplatesContext(context);
3329 }
3330 if(prop->Get)
3331 {
3332 if(!symbol->externalGet || symbol->externalGet->type == 0)
3333 {
3334 struct Declaration * decl;
3335 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3336 struct Declarator * d;
3337 struct __ecereNameSpace__ecere__sys__OldList * params;
3338 struct Specifier * spec;
3339 struct External * external;
3340 struct Declarator * typeDecl;
3341 unsigned int simple = 0x0;
3342
3343 specifiers = MkList();
3344 declarators = MkList();
3345 params = MkList();
3346 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3347 d = MkDeclaratorIdentifier(MkIdentifier(getName));
3348 if(dllImport)
3349 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3350 {
3351 struct Context * context = SetupTemplatesContext(prop->_class);
3352
3353 typeDecl = SpecDeclFromString(prop->dataTypeString, specifiers, (((void *)0)));
3354 FinishTemplatesContext(context);
3355 }
3356 for(spec = (*specifiers).first; spec; spec = spec->next)
3357 {
3358 if(spec->type == 1)
3359 {
3360 if((!typeDecl || typeDecl->type == 1))
3361 {
3362 struct Symbol * classSym = spec->symbol;
3363
3364 symbol->_class = classSym->registered;
3365 if(classSym->registered && classSym->registered->type == 1)
3366 {
3367 DeclareStruct(spec->name, 0x0);
3368 simple = 0x1;
3369 }
3370 }
3371 }
3372 }
3373 if(!simple)
3374 d = PlugDeclarator(typeDecl, d);
3375 else
3376 {
3377 ListAdd(params, MkTypeName(specifiers, PlugDeclarator(typeDecl, MkDeclaratorIdentifier(MkIdentifier("value")))));
3378 specifiers = MkList();
3379 }
3380 d = MkDeclaratorFunction(d, params);
3381 if(dllImport)
3382 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3383 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3384 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3385 if(simple)
3386 ListAdd(specifiers, MkSpecifier(VOID));
3387 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3388 decl = MkDeclaration(specifiers, declarators);
3389 external = MkExternalDeclaration(decl);
3390 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3391 external->symbol = symbol;
3392 symbol->externalGet = external;
3393 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3394 if(typeDecl)
3395 FreeDeclarator(typeDecl);
3396 }
3397 else
3398 {
3399 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalGet, curExternal->prev);
3400 }
3401 }
3402 if(prop->Set)
3403 {
3404 if(!symbol->externalSet || symbol->externalSet->type == 0)
3405 {
3406 struct Declaration * decl;
3407 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
3408 struct Declarator * d;
3409 struct __ecereNameSpace__ecere__sys__OldList * params;
3410 struct Specifier * spec;
3411 struct External * external;
3412 struct Declarator * typeDecl;
3413
3414 declarators = MkList();
3415 params = MkList();
3416 if(!prop->conversion || prop->_class->type == 1)
3417 {
3418 ListAdd(params, MkTypeName(MkListOne(MkSpecifierName(prop->_class->fullName)), MkDeclaratorIdentifier(MkIdentifier("this"))));
3419 }
3420 specifiers = MkList();
3421 {
3422 struct Context * context = SetupTemplatesContext(prop->_class);
3423
3424 typeDecl = d = SpecDeclFromString(prop->dataTypeString, specifiers, MkDeclaratorIdentifier(MkIdentifier("value")));
3425 FinishTemplatesContext(context);
3426 }
3427 ListAdd(params, MkTypeName(specifiers, d));
3428 d = MkDeclaratorIdentifier(MkIdentifier(setName));
3429 if(dllImport)
3430 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
3431 d = MkDeclaratorFunction(d, params);
3432 for(spec = (*specifiers).first; spec; spec = spec->next)
3433 {
3434 if(spec->type == 1)
3435 {
3436 if((!typeDecl || typeDecl->type == 1))
3437 {
3438 struct Symbol * classSym = spec->symbol;
3439
3440 symbol->_class = classSym->registered;
3441 if(classSym->registered && classSym->registered->type == 1)
3442 DeclareStruct(spec->name, 0x0);
3443 }
3444 }
3445 }
3446 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
3447 specifiers = MkList();
3448 if(dllImport)
3449 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3450 else if(prop->_class->symbol && ((struct Symbol *)prop->_class->symbol)->isStatic)
3451 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3452 if(!prop->conversion || prop->_class->type == 1)
3453 ListAdd(specifiers, MkSpecifier(VOID));
3454 else
3455 ListAdd(specifiers, MkSpecifierName(prop->_class->fullName));
3456 decl = MkDeclaration(specifiers, declarators);
3457 external = MkExternalDeclaration(decl);
3458 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3459 external->symbol = symbol;
3460 symbol->externalSet = external;
3461 ReplaceThisClassSpecifiers(specifiers, prop->_class);
3462 }
3463 else
3464 {
3465 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalSet, curExternal->prev);
3466 }
3467 }
3468 if(!symbol->externalPtr)
3469 {
3470 struct Declaration * decl;
3471 struct External * external;
3472 struct __ecereNameSpace__ecere__sys__OldList * specifiers = MkList();
3473
3474 if(imported)
3475 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(EXTERN));
3476 else
3477 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*specifiers), (((void *)0)), MkSpecifier(STATIC));
3478 ListAdd(specifiers, MkSpecifierName("Property"));
3479 {
3480 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
3481
3482 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3483 if(!imported)
3484 {
3485 strcpy(propName, "__ecerePropM_");
3486 FullClassNameCat(propName, prop->_class->fullName, 0x0);
3487 strcat(propName, "_");
3488 FullClassNameCat(propName, prop->name, 0x1);
3489 MangleClassName(propName);
3490 ListAdd(list, MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier(propName))), (((void *)0))));
3491 }
3492 decl = MkDeclaration(specifiers, list);
3493 }
3494 external = MkExternalDeclaration(decl);
3495 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
3496 external->symbol = symbol;
3497 symbol->externalPtr = external;
3498 }
3499 else
3500 {
3501 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->externalPtr, curExternal->prev);
3502 }
3503 symbol->id = curExternal->symbol->idCode;
3504 }
3505 }
3506
3507 struct Type * Dereference(struct Type * source)
3508 {
3509 struct Type * type = (((void *)0));
3510
3511 if(source)
3512 {
3513 if(source->kind == 13 || source->kind == 12)
3514 {
3515 type = source->type;
3516 source->type->refCount++;
3517 }
3518 else if(source->kind == 8 && !strcmp(source->_class->string, "String"))
3519 {
3520 type = __extension__ ({
3521 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3522
3523 __ecereInstance1->kind = 1, __ecereInstance1->refCount = 1, __ecereInstance1;
3524 });
3525 }
3526 else if(source->kind == 8 && source->_class && source->_class->registered && source->_class->registered->type == 5)
3527 {
3528 type = source;
3529 source->refCount++;
3530 }
3531 else
3532 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot dereference type\n", (((void *)0))));
3533 }
3534 return type;
3535 }
3536
3537 static struct Type * Reference(struct Type * source)
3538 {
3539 struct Type * type = (((void *)0));
3540
3541 if(source)
3542 {
3543 type = __extension__ ({
3544 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
3545
3546 __ecereInstance1->kind = 13, __ecereInstance1->type = source, __ecereInstance1->refCount = 1, __ecereInstance1;
3547 });
3548 source->refCount++;
3549 }
3550 return type;
3551 }
3552
3553 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);
3554
3555 extern void *  memcpy(void * , const void * , size_t size);
3556
3557 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
3558
3559 extern void FreeExpression(struct Expression * exp);
3560
3561 extern void __ecereNameSpace__ecere__sys__ChangeCh(char *  string, char ch1, char ch2);
3562
3563 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);
3564
3565 static void ProcessInitializer(struct Initializer * init, struct Type * type);
3566
3567 extern struct Type * MkClassType(char *  name);
3568
3569 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);
3570
3571 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)
3572 {
3573 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
3574 unsigned int found = 0x0;
3575 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
3576 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
3577 unsigned int freeType = 0x0;
3578
3579 yylloc = member->loc;
3580 if(!ident)
3581 {
3582 if(curMember)
3583 {
3584 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, curClass, curMember, subMemberStack, subMemberStackPos);
3585 if(*curMember)
3586 {
3587 found = 0x1;
3588 dataMember = *curMember;
3589 }
3590 }
3591 }
3592 else
3593 {
3594 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
3595 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
3596 int _subMemberStackPos = 0;
3597
3598 if(!thisMember)
3599 thisMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, ident->string, privateModule, _subMemberStack, &_subMemberStackPos);
3600 if(thisMember)
3601 {
3602 dataMember = thisMember;
3603 if(curMember && thisMember->memberAccess == 1)
3604 {
3605 *curMember = thisMember;
3606 *curClass = thisMember->_class;
3607 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
3608 *subMemberStackPos = _subMemberStackPos;
3609 }
3610 found = 0x1;
3611 }
3612 else
3613 {
3614 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, ident->string, privateModule);
3615 if(method && method->type == 1)
3616 found = 0x1;
3617 else
3618 method = (((void *)0));
3619 }
3620 }
3621 if(found)
3622 {
3623 struct Type * type = (((void *)0));
3624
3625 if(dataMember)
3626 {
3627 if(!dataMember->dataType && dataMember->dataTypeString)
3628 {
3629 struct Context * context = SetupTemplatesContext(_class);
3630
3631 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
3632 FinishTemplatesContext(context);
3633 }
3634 type = dataMember->dataType;
3635 }
3636 else if(method)
3637 {
3638 if(!method->dataType)
3639 ProcessMethodType(method);
3640 type = method->dataType;
3641 }
3642 if(ident && ident->next)
3643 {
3644 for(ident = ident->next; ident && type; ident = ident->next)
3645 {
3646 if(type->kind == 8)
3647 {
3648 dataMember = (struct __ecereNameSpace__ecere__com__DataMember *)__ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
3649 if(!dataMember)
3650 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMember(type->_class->registered, ident->string, privateModule, (((void *)0)), (((void *)0)));
3651 if(dataMember)
3652 type = dataMember->dataType;
3653 }
3654 else if(type->kind == 9 || type->kind == 10)
3655 {
3656 struct Type * memberType;
3657
3658 for(memberType = type->members.first; memberType; memberType = memberType->next)
3659 {
3660 if(!strcmp(memberType->name, ident->string))
3661 {
3662 type = memberType;
3663 break;
3664 }
3665 }
3666 }
3667 }
3668 }
3669 if(type && type->kind == 20 && type->templateParameter->type == 0 && _class->templateArgs)
3670 {
3671 int id = 0;
3672 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
3673 struct __ecereNameSpace__ecere__com__Class * sClass;
3674
3675 for(sClass = _class; sClass; sClass = sClass->base)
3676 {
3677 id = 0;
3678 if(sClass->templateClass)
3679 sClass = sClass->templateClass;
3680 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
3681 {
3682 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
3683 {
3684 for(sClass = sClass->base; sClass; sClass = sClass->base)
3685 {
3686 if(sClass->templateClass)
3687 sClass = sClass->templateClass;
3688 id += sClass->templateParams.count;
3689 }
3690 break;
3691 }
3692 id++;
3693 }
3694 if(curParam)
3695 break;
3696 }
3697 if(curParam)
3698 {
3699 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
3700
3701 if(arg.dataTypeString)
3702 {
3703 type = ProcessTypeString(arg.dataTypeString, 0x0);
3704 freeType = 0x1;
3705 if(type && _class->templateClass)
3706 type->passAsTemplate = 0x1;
3707 if(type)
3708 {
3709 }
3710 }
3711 }
3712 }
3713 if(type && type->kind == 8 && type->_class && type->_class->registered && strchr(type->_class->registered->fullName, '<'))
3714 {
3715 struct __ecereNameSpace__ecere__com__Class * expClass = type->_class->registered;
3716 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
3717 int c;
3718 int paramCount = 0;
3719 int lastParam = -1;
3720 char templateString[1024];
3721 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
3722
3723 sprintf(templateString, "%s<", expClass->templateClass->fullName);
3724 for(cClass = expClass; cClass; cClass = cClass->base)
3725 {
3726 int p = 0;
3727
3728 if(cClass->templateClass)
3729 cClass = cClass->templateClass;
3730 for(param = cClass->templateParams.first; param; param = param->next)
3731 {
3732 int id = p;
3733 struct __ecereNameSpace__ecere__com__Class * sClass;
3734 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
3735
3736 for(sClass = cClass->base; sClass; sClass = sClass->base)
3737 {
3738 if(sClass->templateClass)
3739 sClass = sClass->templateClass;
3740 id += sClass->templateParams.count;
3741 }
3742 arg = expClass->templateArgs[id];
3743 for(sClass = _class; sClass; sClass = sClass->base)
3744 {
3745 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
3746 int p = 0;
3747 struct __ecereNameSpace__ecere__com__Class * nextClass;
3748
3749 if(sClass->templateClass)
3750 sClass = sClass->templateClass;
3751 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
3752 {
3753 if(nextClass->templateClass)
3754 nextClass = nextClass->templateClass;
3755 p += nextClass->templateParams.count;
3756 }
3757 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
3758 {
3759 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
3760 {
3761 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3762 {
3763 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
3764 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
3765 break;
3766 }
3767 }
3768 }
3769 }
3770 {
3771 char argument[256];
3772
3773 argument[0] = '\0';
3774 switch(param->type)
3775 {
3776 case 2:
3777 {
3778 char expString[1024];
3779 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
3780 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
3781 struct Expression * exp;
3782 char * string = PrintHexUInt64(arg.expression.ui64);
3783
3784 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
3785 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
3786 ProcessExpressionType(exp);
3787 ComputeExpression(exp);
3788 expString[0] = '\0';
3789 PrintExpression(exp, expString);
3790 strcat(argument, expString);
3791 FreeExpression(exp);
3792 break;
3793 }
3794 case 1:
3795 {
3796 strcat(argument, arg.member->name);
3797 break;
3798 }
3799 case 0:
3800 {
3801 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
3802 strcat(argument, arg.dataTypeString);
3803 break;
3804 }
3805 }
3806 if(argument[0])
3807 {
3808 if(paramCount)
3809 strcat(templateString, ", ");
3810 if(lastParam != p - 1)
3811 {
3812 strcat(templateString, param->name);
3813 strcat(templateString, " = ");
3814 }
3815 strcat(templateString, argument);
3816 paramCount++;
3817 lastParam = p;
3818 }
3819 p++;
3820 }
3821 }
3822 }
3823 {
3824 int len = strlen(templateString);
3825
3826 if(templateString[len - 1] == '<')
3827 len--;
3828 else
3829 {
3830 if(templateString[len - 1] == '>')
3831 templateString[len++] = ' ';
3832 templateString[len++] = '>';
3833 }
3834 templateString[len++] = '\0';
3835 }
3836 {
3837 struct Context * context = SetupTemplatesContext(_class);
3838
3839 if(freeType)
3840 FreeType(type);
3841 type = ProcessTypeString(templateString, 0x0);
3842 freeType = 0x1;
3843 FinishTemplatesContext(context);
3844 }
3845 }
3846 if(method && member->initializer && member->initializer->type == 0 && member->initializer->exp)
3847 {
3848 ProcessExpressionType(member->initializer->exp);
3849 if(!member->initializer->exp->expType)
3850 {
3851 if(inCompiler)
3852 {
3853 char expString[10240];
3854
3855 expString[0] = '\0';
3856 PrintExpression(member->initializer->exp, expString);
3857 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
3858 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved symbol used as an instance method %s\n", (((void *)0))), expString);
3859 }
3860 }
3861 else if(!MatchTypes(member->initializer->exp->expType, type, (((void *)0)), (((void *)0)), _class, 0x1, 0x1, 0x0, 0x0))
3862 {
3863 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible instance method %s\n", (((void *)0))), ident->string);
3864 }
3865 }
3866 else if(member->initializer)
3867 {
3868 ProcessInitializer(member->initializer, type);
3869 }
3870 if(freeType)
3871 FreeType(type);
3872 }
3873 else
3874 {
3875 if(_class && _class->type == 3)
3876 {
3877 if(member->initializer)
3878 {
3879 struct Type * type = MkClassType(_class->fullName);
3880
3881 ProcessInitializer(member->initializer, type);
3882 FreeType(type);
3883 }
3884 }
3885 else
3886 {
3887 if(member->initializer)
3888 {
3889 ProcessInitializer(member->initializer, (((void *)0)));
3890 }
3891 if(ident)
3892 {
3893 if(method)
3894 {
3895 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3896 }
3897 else if(_class)
3898 {
3899 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), ident->string, _class->fullName);
3900 if(inCompiler)
3901 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, ident->string, "int", 0, 0, 1);
3902 }
3903 }
3904 else if(_class)
3905 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many initializers for instantiation of class %s\n", (((void *)0))), _class->fullName);
3906 }
3907 }
3908 }
3909
3910 extern struct Identifier * GetDeclId(struct Declarator * decl);
3911
3912 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);
3913
3914 extern void FreeSpecifier(struct Specifier * spec);
3915
3916 static void ProcessFunction(struct FunctionDefinition * function);
3917
3918 extern struct __ecereNameSpace__ecere__sys__OldList *  CopyList(struct __ecereNameSpace__ecere__sys__OldList *  source, void *  (*  CopyFunction)(void * ));
3919
3920 extern struct Specifier * CopySpecifier(struct Specifier * spec);
3921
3922 extern struct Declarator * CopyDeclarator(struct Declarator * declarator);
3923
3924 extern void FreeClassFunction(struct ClassFunction * func);
3925
3926 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
3927
3928 extern struct Initializer * MkInitializerAssignment(struct Expression * exp);
3929
3930 void ProcessInstantiationType(struct Instantiation * inst)
3931 {
3932 yylloc = inst->loc;
3933 if(inst->_class)
3934 {
3935 struct MembersInit * members;
3936 struct Symbol * classSym;
3937 struct __ecereNameSpace__ecere__com__Class * _class;
3938
3939 classSym = inst->_class->symbol;
3940 _class = classSym ? classSym->registered : (((void *)0));
3941 if(!_class || _class->type != 5)
3942 DeclareStruct(inst->_class->name, 0x0);
3943 afterExternal = afterExternal ? afterExternal : curExternal;
3944 if(inst->exp)
3945 ProcessExpressionType(inst->exp);
3946 inst->isConstant = 0x1;
3947 if(inst->members)
3948 {
3949 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
3950 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
3951 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
3952 int subMemberStackPos = 0;
3953
3954 for(members = (*inst->members).first; members; members = members->next)
3955 {
3956 switch(members->type)
3957 {
3958 case 1:
3959 {
3960 char name[1024];
3961 static unsigned int instMethodID = 0;
3962 struct External * external = curExternal;
3963 struct Context * context = curContext;
3964 struct Declarator * declarator = members->function->declarator;
3965 struct Identifier * nameID = GetDeclId(declarator);
3966 char * unmangled = nameID ? nameID->string : (((void *)0));
3967 struct Expression * exp;
3968 struct External * createdExternal = (((void *)0));
3969
3970 if(inCompiler)
3971 {
3972 char number[16];
3973
3974 strcpy(name, "__ecereInstMeth_");
3975 FullClassNameCat(name, _class ? _class->fullName : "_UNKNOWNCLASS", 0x0);
3976 strcat(name, "_");
3977 strcat(name, nameID->string);
3978 strcat(name, "_");
3979 sprintf(number, "_%08d", instMethodID++);
3980 strcat(name, number);
3981 nameID->string = __ecereNameSpace__ecere__sys__CopyString(name);
3982 }
3983 if(declarator)
3984 {
3985 struct Symbol * symbol = declarator->symbol;
3986 struct __ecereNameSpace__ecere__com__Method * method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, unmangled, privateModule);
3987
3988 if(method && method->type == 1)
3989 {
3990 symbol->method = method;
3991 ProcessMethodType(method);
3992 if(!symbol->type->thisClass)
3993 {
3994 if(method->dataType->thisClass && currentClass && __ecereNameSpace__ecere__com__eClass_IsDerived(currentClass, method->dataType->thisClass->registered))
3995 {
3996 if(!currentClass->symbol)
3997 currentClass->symbol = FindClass(currentClass->fullName);
3998 symbol->type->thisClass = currentClass->symbol;
3999 }
4000 else
4001 {
4002 if(!_class->symbol)
4003 _class->symbol = FindClass(_class->fullName);
4004 symbol->type->thisClass = _class->symbol;
4005 }
4006 }
4007 DeclareType(symbol->type, 0x1, 0x1);
4008 }
4009 else if(classSym)
4010 {
4011 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find virtual method %s in class %s\n", (((void *)0))), unmangled, classSym->string);
4012 }
4013 }
4014 createdExternal = ProcessClassFunction(classSym ? classSym->registered : (((void *)0)), members->function, ast, afterExternal, 0x1);
4015 if(nameID)
4016 {
4017 FreeSpecifier(nameID->_class);
4018 nameID->_class = (((void *)0));
4019 }
4020 if(inCompiler)
4021 {
4022 struct Type * type = declarator->symbol->type;
4023 struct External * oldExternal = curExternal;
4024
4025 declarator->symbol->id = declarator->symbol->idCode = curExternal->symbol->idCode;
4026 {
4027 struct External * externalDecl;
4028
4029 externalDecl = MkExternalDeclaration((((void *)0)));
4030 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), oldExternal->prev, externalDecl);
4031 if(createdExternal->function)
4032 {
4033 ProcessFunction(createdExternal->function);
4034 {
4035 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(declarator), (((void *)0)))));
4036
4037 externalDecl->declaration = decl;
4038 if(decl->symbol && !decl->symbol->pointerExternal)
4039 decl->symbol->pointerExternal = externalDecl;
4040 declarator->symbol->pointerExternal = externalDecl;
4041 }
4042 }
4043 }
4044 }
4045 else if(declarator)
4046 {
4047 curExternal = declarator->symbol->pointerExternal;
4048 ProcessFunction((struct FunctionDefinition *)members->function);
4049 }
4050 curExternal = external;
4051 curContext = context;
4052 if(inCompiler)
4053 {
4054 FreeClassFunction(members->function);
4055 exp = QMkExpId(name);
4056 members->type = 0;
4057 members->dataMembers = MkListOne(MkMemberInit(MkListOne(MkIdentifier(unmangled)), MkInitializerAssignment(exp)));
4058 (__ecereNameSpace__ecere__com__eSystem_Delete(unmangled), unmangled = 0);
4059 }
4060 break;
4061 }
4062 case 0:
4063 {
4064 if(members->dataMembers && classSym)
4065 {
4066 struct MemberInit * member;
4067 struct Location oldyyloc = yylloc;
4068
4069 for(member = (*members->dataMembers).first; member; member = member->next)
4070 {
4071 ProcessMemberInitData(member, classSym->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
4072 if(member->initializer && !member->initializer->isConstant)
4073 inst->isConstant = 0x0;
4074 }
4075 yylloc = oldyyloc;
4076 }
4077 break;
4078 }
4079 }
4080 }
4081 }
4082 }
4083 }
4084
4085 static void DeclareType(struct Type * type, unsigned int declarePointers, unsigned int declareParams)
4086 {
4087 if(inCompiler)
4088 {
4089 if(type->kind == 11)
4090 {
4091 struct Type * param;
4092
4093 if(declareParams)
4094 {
4095 for(param = type->params.first; param; param = param->next)
4096 DeclareType(param, declarePointers, 0x1);
4097 }
4098 DeclareType(type->returnType, declarePointers, 0x1);
4099 }
4100 else if(type->kind == 13 && declarePointers)
4101 DeclareType(type->type, declarePointers, 0x0);
4102 else if(type->kind == 8)
4103 {
4104 if(type->_class->registered && (type->_class->registered->type == 1 || type->_class->registered->type == 5) && !type->_class->declaring)
4105 DeclareStruct(type->_class->registered->fullName, type->_class->registered->type == 5);
4106 }
4107 else if(type->kind == 9 || type->kind == 10)
4108 {
4109 struct Type * member;
4110
4111 for(member = type->members.first; member; member = member->next)
4112 DeclareType(member, 0x0, 0x0);
4113 }
4114 else if(type->kind == 12)
4115 DeclareType(type->arrayType, declarePointers, 0x0);
4116 }
4117 }
4118
4119 extern struct __ecereNameSpace__ecere__com__Class * __ecereNameSpace__ecere__com__eSystem_FindClass(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
4120
4121 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * FindTemplateArg(struct __ecereNameSpace__ecere__com__Class * _class, struct TemplateParameter * param)
4122 {
4123 struct __ecereNameSpace__ecere__com__ClassTemplateArgument * arg = (((void *)0));
4124 int id = 0;
4125 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
4126 struct __ecereNameSpace__ecere__com__Class * sClass;
4127
4128 for(sClass = _class; sClass; sClass = sClass->base)
4129 {
4130 id = 0;
4131 if(sClass->templateClass)
4132 sClass = sClass->templateClass;
4133 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
4134 {
4135 if(curParam->type == 0 && !strcmp(param->identifier->string, curParam->name))
4136 {
4137 for(sClass = sClass->base; sClass; sClass = sClass->base)
4138 {
4139 if(sClass->templateClass)
4140 sClass = sClass->templateClass;
4141 id += sClass->templateParams.count;
4142 }
4143 break;
4144 }
4145 id++;
4146 }
4147 if(curParam)
4148 break;
4149 }
4150 if(curParam)
4151 {
4152 arg = &_class->templateArgs[id];
4153 if(arg && param->type == 0)
4154 (*arg).dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, (*arg).dataTypeString);
4155 }
4156 return arg;
4157 }
4158
4159 extern struct Context * PushContext(void);
4160
4161 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_TemplatedType;
4162
4163 struct TemplatedType
4164 {
4165 uintptr_t key;
4166 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4167 struct __ecereNameSpace__ecere__sys__BTNode * left;
4168 struct __ecereNameSpace__ecere__sys__BTNode * right;
4169 int depth;
4170 struct TemplateParameter * param;
4171 } __attribute__ ((gcc_struct));
4172
4173 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
4174
4175 struct Context * SetupTemplatesContext(struct __ecereNameSpace__ecere__com__Class * _class)
4176 {
4177 struct Context * context = PushContext();
4178
4179 context->templateTypesOnly = 0x1;
4180 if(_class->symbol && ((struct Symbol *)_class->symbol)->templateParams)
4181 {
4182 struct TemplateParameter * param = (*((struct Symbol *)_class->symbol)->templateParams).first;
4183
4184 for(; param; param = param->next)
4185 {
4186 if(param->type == 0 && param->identifier)
4187 {
4188 struct TemplatedType * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType), type->key = (uintptr_t)param->identifier->string, type->param = param, type);
4189
4190 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4191 }
4192 }
4193 }
4194 else if(_class)
4195 {
4196 struct __ecereNameSpace__ecere__com__Class * sClass;
4197
4198 for(sClass = _class; sClass; sClass = sClass->base)
4199 {
4200 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * p;
4201
4202 for(p = sClass->templateParams.first; p; p = p->next)
4203 {
4204 if(p->type == 0)
4205 {
4206 struct TemplateParameter * param = p->param;
4207 struct TemplatedType * type;
4208
4209 if(!param)
4210 {
4211 p->param = param = __extension__ ({
4212 struct TemplateParameter * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplateParameter);
4213
4214 __ecereInstance1->identifier = MkIdentifier(p->name), __ecereInstance1->type = p->type, __ecereInstance1->dataTypeString = p->dataTypeString, __ecereInstance1;
4215 });
4216 }
4217 type = __extension__ ({
4218 struct TemplatedType * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TemplatedType);
4219
4220 __ecereInstance1->key = (uintptr_t)p->name, __ecereInstance1->param = param, __ecereInstance1;
4221 });
4222 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&curContext->templateTypes, (struct __ecereNameSpace__ecere__sys__BTNode *)type);
4223 }
4224 }
4225 }
4226 }
4227 return context;
4228 }
4229
4230 extern void PopContext(struct Context * ctx);
4231
4232 extern void FreeContext(struct Context * context);
4233
4234 void FinishTemplatesContext(struct Context * context)
4235 {
4236 PopContext(context);
4237 FreeContext(context);
4238 ((context ? (__ecereClass_Context->Destructor ? __ecereClass_Context->Destructor(context) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(context)) : 0), context = 0);
4239 }
4240
4241 void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method)
4242 {
4243 if(!method->dataType)
4244 {
4245 struct Context * context = SetupTemplatesContext(method->_class);
4246
4247 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4248 FinishTemplatesContext(context);
4249 if(method->type != 1 && method->dataType)
4250 {
4251 if(!method->dataType->thisClass && !method->dataType->staticMethod)
4252 {
4253 if(!method->_class->symbol)
4254 method->_class->symbol = FindClass(method->_class->fullName);
4255 method->dataType->thisClass = method->_class->symbol;
4256 }
4257 }
4258 }
4259 }
4260
4261 void ProcessPropertyType(struct __ecereNameSpace__ecere__com__Property * prop)
4262 {
4263 if(!prop->dataType)
4264 {
4265 struct Context * context = SetupTemplatesContext(prop->_class);
4266
4267 prop->dataType = ProcessTypeString(prop->dataTypeString, 0x0);
4268 FinishTemplatesContext(context);
4269 }
4270 }
4271
4272 extern struct Declarator * GetFuncDecl(struct Declarator * decl);
4273
4274 extern void FreeTypeName(struct TypeName * typeName);
4275
4276 static void ProcessDeclarator(struct Declarator * decl);
4277
4278 extern struct __ecereNameSpace__ecere__sys__OldList *  excludedSymbols;
4279
4280 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_MethodImport;
4281
4282 struct MethodImport
4283 {
4284 struct MethodImport * prev;
4285 struct MethodImport * next;
4286 char *  name;
4287 unsigned int isVirtual;
4288 } __attribute__ ((gcc_struct));
4289
4290 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(struct __ecereNameSpace__ecere__sys__OldList * this, void *  item);
4291
4292 void DeclareMethod(struct __ecereNameSpace__ecere__com__Method * method, char * name)
4293 {
4294 struct Symbol * symbol = method->symbol;
4295
4296 if(!symbol || (!symbol->pointerExternal && method->type == 1) || symbol->id > (curExternal ? curExternal->symbol->idCode : -1))
4297 {
4298 unsigned int imported = 0x0;
4299 unsigned int dllImport = 0x0;
4300
4301 if(!method->dataType)
4302 method->dataType = ProcessTypeString(method->dataTypeString, 0x0);
4303 if(!symbol || symbol->_import || method->type == 1)
4304 {
4305 if(!symbol || method->type == 1)
4306 {
4307 struct Symbol * classSym;
4308
4309 if(!method->_class->symbol)
4310 method->_class->symbol = FindClass(method->_class->fullName);
4311 classSym = method->_class->symbol;
4312 if(!classSym->_import)
4313 {
4314 struct ModuleImport * module;
4315
4316 if(method->_class->module && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)method->_class->module + structSize_Instance)))->name)
4317 module = FindModule(method->_class->module);
4318 else
4319 module = mainModule;
4320 classSym->_import = __extension__ ({
4321 struct ClassImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_ClassImport);
4322
4323 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->_class->fullName), __ecereInstance1->isRemote = method->_class->isRemote, __ecereInstance1;
4324 });
4325 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->classes, classSym->_import);
4326 }
4327 if(!symbol)
4328 {
4329 symbol = method->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4330 }
4331 if(!symbol->_import)
4332 {
4333 symbol->_import = (struct ClassImport *)__extension__ ({
4334 struct MethodImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_MethodImport);
4335
4336 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(method->name), __ecereInstance1->isVirtual = method->type == 1, __ecereInstance1;
4337 });
4338 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->_import->methods, symbol->_import);
4339 }
4340 if(!symbol)
4341 {
4342 symbol->type = method->dataType;
4343 if(symbol->type)
4344 symbol->type->refCount++;
4345 }
4346 }
4347 if(!method->dataType->dllExport)
4348 {
4349 imported = 0x1;
4350 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)
4351 dllImport = 0x1;
4352 }
4353 }
4354 if(method->type != 1 && method->dataType)
4355 DeclareType(method->dataType, 0x1, 0x1);
4356 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4357 {
4358 struct Declaration * decl;
4359 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4360 struct Declarator * d;
4361 struct Declarator * funcDecl;
4362 struct External * external;
4363
4364 specifiers = MkList();
4365 declarators = MkList();
4366 if(dllImport)
4367 ListAdd(specifiers, MkSpecifier(EXTERN));
4368 else if(method->_class->symbol && ((struct Symbol *)method->_class->symbol)->isStatic)
4369 ListAdd(specifiers, MkSpecifier(STATIC));
4370 if(method->type == 1)
4371 {
4372 ListAdd(specifiers, MkSpecifier(INT));
4373 d = MkDeclaratorIdentifier(MkIdentifier(name));
4374 }
4375 else
4376 {
4377 d = MkDeclaratorIdentifier(MkIdentifier(name));
4378 if(dllImport)
4379 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4380 {
4381 struct Context * context = SetupTemplatesContext(method->_class);
4382
4383 d = SpecDeclFromString(method->dataTypeString, specifiers, d);
4384 FinishTemplatesContext(context);
4385 }
4386 funcDecl = GetFuncDecl(d);
4387 if(dllImport)
4388 {
4389 struct Specifier * spec, * next;
4390
4391 for(spec = (*specifiers).first; spec; spec = next)
4392 {
4393 next = spec->next;
4394 if(spec->type == 5)
4395 {
4396 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4397 FreeSpecifier(spec);
4398 }
4399 }
4400 }
4401 if(method->dataType && !method->dataType->staticMethod)
4402 {
4403 if(funcDecl && funcDecl->function.parameters && (*funcDecl->function.parameters).count)
4404 {
4405 struct __ecereNameSpace__ecere__com__Class * _class = method->dataType->thisClass ? method->dataType->thisClass->registered : method->_class;
4406 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")));
4407 struct TypeName * firstParam = ((struct TypeName *)(*funcDecl->function.parameters).first);
4408 struct Specifier * firstSpec = firstParam->qualifiers ? (*firstParam->qualifiers).first : (((void *)0));
4409
4410 if(firstSpec && firstSpec->type == 0 && firstSpec->specifier == VOID && !firstParam->declarator)
4411 {
4412 struct TypeName * param = (*funcDecl->function.parameters).first;
4413
4414 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
4415 FreeTypeName(param);
4416 }
4417 if(!funcDecl->function.parameters)
4418 funcDecl->function.parameters = MkList();
4419 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
4420 }
4421 }
4422 }
4423 ProcessDeclarator(d);
4424 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4425 decl = MkDeclaration(specifiers, declarators);
4426 ReplaceThisClassSpecifiers(specifiers, method->_class);
4427 if(symbol->pointerExternal)
4428 {
4429 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4430
4431 {
4432 *functionSymbol = *symbol;
4433 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4434 if(functionSymbol->type)
4435 functionSymbol->type->refCount++;
4436 }
4437 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4438 symbol->pointerExternal->symbol = functionSymbol;
4439 }
4440 external = MkExternalDeclaration(decl);
4441 if(curExternal)
4442 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal ? curExternal->prev : (((void *)0)), external);
4443 external->symbol = symbol;
4444 symbol->pointerExternal = external;
4445 }
4446 else if(ast)
4447 {
4448 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4449 }
4450 symbol->id = curExternal ? curExternal->symbol->idCode : (((int)0x7fffffff));
4451 }
4452 }
4453
4454 char * ReplaceThisClass(struct __ecereNameSpace__ecere__com__Class * _class)
4455 {
4456 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4457 {
4458 unsigned int first = 0x1;
4459 int p = 0;
4460 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4461 int lastParam = -1;
4462 char className[1024];
4463
4464 strcpy(className, _class->fullName);
4465 for(param = _class->templateParams.first; param; param = param->next)
4466 {
4467 {
4468 if(first)
4469 strcat(className, "<");
4470 if(!first)
4471 strcat(className, ", ");
4472 if(lastParam + 1 != p)
4473 {
4474 strcat(className, param->name);
4475 strcat(className, " = ");
4476 }
4477 strcat(className, param->name);
4478 first = 0x0;
4479 lastParam = p;
4480 }
4481 p++;
4482 }
4483 if(!first)
4484 {
4485 int len = strlen(className);
4486
4487 if(className[len - 1] == '>')
4488 className[len++] = ' ';
4489 className[len++] = '>';
4490 className[len++] = '\0';
4491 }
4492 return __ecereNameSpace__ecere__sys__CopyString(className);
4493 }
4494 else
4495 return __ecereNameSpace__ecere__sys__CopyString(_class->fullName);
4496 }
4497
4498 struct Type * ReplaceThisClassType(struct __ecereNameSpace__ecere__com__Class * _class)
4499 {
4500 if(thisClassParams && _class->templateParams.count && !_class->templateClass)
4501 {
4502 unsigned int first = 0x1;
4503 int p = 0;
4504 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
4505 int lastParam = -1;
4506 char className[1024];
4507
4508 strcpy(className, _class->fullName);
4509 for(param = _class->templateParams.first; param; param = param->next)
4510 {
4511 {
4512 if(first)
4513 strcat(className, "<");
4514 if(!first)
4515 strcat(className, ", ");
4516 if(lastParam + 1 != p)
4517 {
4518 strcat(className, param->name);
4519 strcat(className, " = ");
4520 }
4521 strcat(className, param->name);
4522 first = 0x0;
4523 lastParam = p;
4524 }
4525 p++;
4526 }
4527 if(!first)
4528 {
4529 int len = strlen(className);
4530
4531 if(className[len - 1] == '>')
4532 className[len++] = ' ';
4533 className[len++] = '>';
4534 className[len++] = '\0';
4535 }
4536 return MkClassType(className);
4537 }
4538 else
4539 {
4540 return MkClassType(_class->fullName);
4541 }
4542 }
4543
4544 void ReplaceThisClassSpecifiers(struct __ecereNameSpace__ecere__sys__OldList * specs, struct __ecereNameSpace__ecere__com__Class * _class)
4545 {
4546 if(specs != (((void *)0)) && _class)
4547 {
4548 struct Specifier * spec;
4549
4550 for(spec = specs->first; spec; spec = spec->next)
4551 {
4552 if(spec->type == 0 && spec->specifier == THISCLASS)
4553 {
4554 spec->type = 1;
4555 spec->name = ReplaceThisClass(_class);
4556 spec->symbol = FindClass(spec->name);
4557 }
4558 }
4559 }
4560 }
4561
4562 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__GlobalFunction;
4563
4564 struct __ecereNameSpace__ecere__com__GlobalFunction
4565 {
4566 struct __ecereNameSpace__ecere__com__GlobalFunction * prev;
4567 struct __ecereNameSpace__ecere__com__GlobalFunction * next;
4568 char *  name;
4569 int (*  function)();
4570 struct __ecereNameSpace__ecere__com__Instance * module;
4571 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
4572 char *  dataTypeString;
4573 struct Type * dataType;
4574 void *  symbol;
4575 } __attribute__ ((gcc_struct));
4576
4577 extern struct Context * globalContext;
4578
4579 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_FunctionImport;
4580
4581 struct FunctionImport
4582 {
4583 struct FunctionImport * prev;
4584 struct FunctionImport * next;
4585 char *  name;
4586 } __attribute__ ((gcc_struct));
4587
4588 unsigned int DeclareFunction(struct __ecereNameSpace__ecere__com__GlobalFunction * function, char * name)
4589 {
4590 struct Symbol * symbol = function->symbol;
4591
4592 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4593 {
4594 unsigned int imported = 0x0;
4595 unsigned int dllImport = 0x0;
4596
4597 if(!function->dataType)
4598 {
4599 function->dataType = ProcessTypeString(function->dataTypeString, 0x0);
4600 if(!function->dataType->thisClass)
4601 function->dataType->staticMethod = 0x1;
4602 }
4603 if(inCompiler)
4604 {
4605 if(!symbol)
4606 {
4607 struct ModuleImport * module = FindModule(function->module);
4608
4609 symbol = function->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4610 if(module->name)
4611 {
4612 if(!function->dataType->dllExport)
4613 {
4614 symbol->_import = (struct ClassImport *)__extension__ ({
4615 struct FunctionImport * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_FunctionImport);
4616
4617 __ecereInstance1->name = __ecereNameSpace__ecere__sys__CopyString(function->name), __ecereInstance1;
4618 });
4619 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&module->functions, symbol->_import);
4620 }
4621 }
4622 {
4623 symbol->type = ProcessTypeString(function->dataTypeString, 0x0);
4624 if(!symbol->type->thisClass)
4625 symbol->type->staticMethod = 0x1;
4626 }
4627 }
4628 imported = symbol->_import ? 0x1 : 0x0;
4629 if(imported && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1)
4630 dllImport = 0x1;
4631 }
4632 DeclareType(function->dataType, 0x1, 0x1);
4633 if(inCompiler)
4634 {
4635 if(!symbol->pointerExternal || symbol->pointerExternal->type == 0)
4636 {
4637 struct Declaration * decl;
4638 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4639 struct Declarator * d;
4640 struct Declarator * funcDecl;
4641 struct External * external;
4642
4643 specifiers = MkList();
4644 declarators = MkList();
4645 ListAdd(specifiers, MkSpecifier(EXTERN));
4646 d = MkDeclaratorIdentifier(MkIdentifier(imported ? name : function->name));
4647 if(dllImport)
4648 d = MkDeclaratorBrackets(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d));
4649 d = SpecDeclFromString(function->dataTypeString, specifiers, d);
4650 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType == 1)
4651 {
4652 struct Specifier * spec;
4653
4654 for(spec = (*specifiers).first; spec; spec = spec->next)
4655 if(spec->type == 5 && spec->extDecl && spec->extDecl->type == 0 && !strcmp(spec->extDecl->s, "dllexport"))
4656 {
4657 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*specifiers), spec);
4658 FreeSpecifier(spec);
4659 break;
4660 }
4661 }
4662 funcDecl = GetFuncDecl(d);
4663 if(funcDecl && !funcDecl->function.parameters)
4664 {
4665 funcDecl->function.parameters = MkList();
4666 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), MkTypeName(MkListOne(MkSpecifier(VOID)), (((void *)0))));
4667 }
4668 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4669 {
4670 struct Context * oldCtx = curContext;
4671
4672 curContext = globalContext;
4673 decl = MkDeclaration(specifiers, declarators);
4674 curContext = oldCtx;
4675 }
4676 if(symbol->pointerExternal)
4677 {
4678 struct Symbol * functionSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4679
4680 {
4681 *functionSymbol = *symbol;
4682 functionSymbol->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
4683 if(functionSymbol->type)
4684 functionSymbol->type->refCount++;
4685 }
4686 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*excludedSymbols), functionSymbol);
4687 symbol->pointerExternal->symbol = functionSymbol;
4688 }
4689 external = MkExternalDeclaration(decl);
4690 if(curExternal)
4691 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4692 external->symbol = symbol;
4693 symbol->pointerExternal = external;
4694 }
4695 else
4696 {
4697 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4698 }
4699 if(curExternal)
4700 symbol->id = curExternal->symbol->idCode;
4701 }
4702 }
4703 return (symbol && symbol->_import && function->module != privateModule && ((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1) ? 0x1 : 0x0;
4704 }
4705
4706 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_GlobalData;
4707
4708 struct GlobalData
4709 {
4710 uintptr_t key;
4711 struct __ecereNameSpace__ecere__sys__BTNode * parent;
4712 struct __ecereNameSpace__ecere__sys__BTNode * left;
4713 struct __ecereNameSpace__ecere__sys__BTNode * right;
4714 int depth;
4715 struct __ecereNameSpace__ecere__com__Instance * module;
4716 char *  dataTypeString;
4717 struct Type * dataType;
4718 void *  symbol;
4719 char *  fullName;
4720 } __attribute__ ((gcc_struct));
4721
4722 void DeclareGlobalData(struct GlobalData * data)
4723 {
4724 struct Symbol * symbol = data->symbol;
4725
4726 if(curExternal && (!symbol || symbol->id > curExternal->symbol->idCode))
4727 {
4728 if(inCompiler)
4729 {
4730 if(!symbol)
4731 symbol = data->symbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
4732 }
4733 if(!data->dataType)
4734 data->dataType = ProcessTypeString(data->dataTypeString, 0x0);
4735 DeclareType(data->dataType, 0x1, 0x1);
4736 if(inCompiler)
4737 {
4738 if(!symbol->pointerExternal)
4739 {
4740 struct Declaration * decl;
4741 struct __ecereNameSpace__ecere__sys__OldList * specifiers, * declarators;
4742 struct Declarator * d;
4743 struct External * external;
4744
4745 specifiers = MkList();
4746 declarators = MkList();
4747 ListAdd(specifiers, MkSpecifier(EXTERN));
4748 d = MkDeclaratorIdentifier(MkIdentifier(data->fullName));
4749 d = SpecDeclFromString(data->dataTypeString, specifiers, d);
4750 ListAdd(declarators, MkInitDeclarator(d, (((void *)0))));
4751 decl = MkDeclaration(specifiers, declarators);
4752 external = MkExternalDeclaration(decl);
4753 if(curExternal)
4754 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, external);
4755 external->symbol = symbol;
4756 symbol->pointerExternal = external;
4757 }
4758 else
4759 {
4760 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
4761 }
4762 if(curExternal)
4763 symbol->id = curExternal->symbol->idCode;
4764 }
4765 }
4766 }
4767
4768 struct Conversion
4769 {
4770 struct Conversion * prev, * next;
4771 struct __ecereNameSpace__ecere__com__Property * convert;
4772 unsigned int isGet;
4773 struct Type * resultType;
4774 } __attribute__ ((gcc_struct));
4775
4776 static struct __ecereNameSpace__ecere__com__Class * __ecereClass_Conversion;
4777
4778 extern void Compiler_Warning(char *  format, ...);
4779
4780 void PrintType(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
4781
4782 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)
4783 {
4784 if(source && dest)
4785 {
4786 if(source->kind == 20 && dest->kind != 20)
4787 {
4788 struct Type * type = ProcessTemplateParameterType(source->templateParameter);
4789
4790 if(type)
4791 source = type;
4792 }
4793 if(dest->kind == 20 && source->kind != 20)
4794 {
4795 struct Type * type = ProcessTemplateParameterType(dest->templateParameter);
4796
4797 if(type)
4798 dest = type;
4799 }
4800 if(dest->classObjectType == 2)
4801 {
4802 if(source->classObjectType != 3)
4803 return 0x1;
4804 else
4805 {
4806 if((dest->_class && strcmp(dest->_class->string, "class")) || (source->_class && strcmp(source->_class->string, "class")))
4807 {
4808 return 0x1;
4809 }
4810 }
4811 }
4812 else
4813 {
4814 if(source->classObjectType == 3)
4815 return 0x1;
4816 if(dest->classObjectType == 3 && source->classObjectType != 2)
4817 return 0x1;
4818 }
4819 if((dest->kind == 9 && source->kind == 9) || (dest->kind == 10 && source->kind == 10))
4820 {
4821 if((dest->enumName && source->enumName && !strcmp(dest->enumName, source->enumName)) || (source->members.first && source->members.first == dest->members.first))
4822 return 0x1;
4823 }
4824 if(dest->kind == 14 && source->kind != 0)
4825 return 0x1;
4826 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))
4827 return 0x1;
4828 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))
4829 return 0x1;
4830 if(((source->kind == 8 && dest->kind == 8) || (source->kind == 19 && dest->kind == 19)) && source->_class)
4831 {
4832 if(source->_class->registered && source->_class->registered->type == 3)
4833 {
4834 if(conversions != (((void *)0)))
4835 {
4836 if(source->_class->registered == dest->_class->registered)
4837 return 0x1;
4838 }
4839 else
4840 {
4841 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
4842
4843 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
4844 ;
4845 for(destBase = dest->_class->registered; destBase && destBase->base->type != 1000; destBase = destBase->base)
4846 ;
4847 if(sourceBase == destBase)
4848 return 0x1;
4849 }
4850 }
4851 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))
4852 return 0x1;
4853 else
4854 {
4855 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))
4856 {
4857 if(__ecereNameSpace__ecere__com__eClass_IsDerived(dest->_class->registered, source->_class->registered))
4858 {
4859 return 0x1;
4860 }
4861 }
4862 }
4863 }
4864 if(source->kind == 19 && dest->kind == 8 && dest->_class && !strcmp(dest->_class->string, "ecere::com::Class"))
4865 return 0x1;
4866 if(doConversion)
4867 {
4868 if(source->kind == 8)
4869 {
4870 struct __ecereNameSpace__ecere__com__Class * _class;
4871
4872 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4873 {
4874 struct __ecereNameSpace__ecere__com__Property * convert;
4875
4876 for(convert = _class->conversions.first; convert; convert = convert->next)
4877 {
4878 if(convert->memberAccess == 1 || _class->module == privateModule)
4879 {
4880 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4881
4882 if(!convert->dataType)
4883 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4884 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))
4885 {
4886 if(!conversions && !convert->Get)
4887 return 0x1;
4888 else if(conversions != (((void *)0)))
4889 {
4890 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))
4891 return 0x1;
4892 else
4893 {
4894 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4895
4896 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4897 return 0x1;
4898 }
4899 }
4900 }
4901 }
4902 }
4903 }
4904 }
4905 if(dest->kind == 8)
4906 {
4907 struct __ecereNameSpace__ecere__com__Class * _class;
4908
4909 for(_class = dest->_class ? dest->_class->registered : (((void *)0)); _class; _class = _class->base)
4910 {
4911 struct __ecereNameSpace__ecere__com__Property * convert;
4912
4913 for(convert = _class->conversions.first; convert; convert = convert->next)
4914 {
4915 if(convert->memberAccess == 1 || _class->module == privateModule)
4916 {
4917 if(!convert->dataType)
4918 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4919 if(convert->dataType != dest && MatchTypes(source, convert->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x1))
4920 {
4921 if(!conversions && !convert->Set)
4922 return 0x1;
4923 else if(conversions != (((void *)0)))
4924 {
4925 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))
4926 return 0x1;
4927 else
4928 {
4929 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv);
4930
4931 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, conv);
4932 return 0x1;
4933 }
4934 }
4935 }
4936 }
4937 }
4938 }
4939 if(enumBaseType && dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
4940 {
4941 if(!dest->_class->registered->dataType)
4942 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
4943 if(dest->_class->registered->dataType->kind == 8 || source->truth || dest->truth)
4944 {
4945 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, dest->_class->registered->dataType->kind == 8, 0x0, 0x0))
4946 {
4947 return 0x1;
4948 }
4949 }
4950 }
4951 }
4952 if(source->kind == 8)
4953 {
4954 struct __ecereNameSpace__ecere__com__Class * _class;
4955
4956 for(_class = source->_class ? source->_class->registered : (((void *)0)); _class; _class = _class->base)
4957 {
4958 struct __ecereNameSpace__ecere__com__Property * convert;
4959
4960 for(convert = _class->conversions.first; convert; convert = convert->next)
4961 {
4962 if(convert->memberAccess == 1 || _class->module == privateModule)
4963 {
4964 struct Conversion * after = (conversions != (((void *)0))) ? conversions->last : (((void *)0));
4965
4966 if(!convert->dataType)
4967 convert->dataType = ProcessTypeString(convert->dataTypeString, 0x0);
4968 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))
4969 {
4970 if(!conversions && !convert->Get)
4971 return 0x1;
4972 else if(conversions != (((void *)0)))
4973 {
4974 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))
4975 return 0x1;
4976 else
4977 {
4978 struct Conversion * conv = (conv = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Conversion), conv->convert = convert, conv->isGet = 0x1, conv);
4979
4980 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(conversions, after, conv);
4981 return 0x1;
4982 }
4983 }
4984 }
4985 }
4986 }
4987 }
4988 if(enumBaseType && source->_class && source->_class->registered && source->_class->registered->type == 4)
4989 {
4990 if(!source->_class->registered->dataType)
4991 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
4992 if(!isConversionExploration || source->_class->registered->dataType->kind == 8 || !strcmp(source->_class->registered->name, "String"))
4993 {
4994 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))
4995 return 0x1;
4996 else if(MatchTypes(dest, source->_class->registered->dataType, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
4997 return 0x1;
4998 }
4999 }
5000 }
5001 }
5002 if(source->kind == 8 || source->kind == 19)
5003 ;
5004 else if(dest->kind == source->kind && (dest->kind != 9 && dest->kind != 10 && dest->kind != 11 && dest->kind != 12 && dest->kind != 13 && dest->kind != 16))
5005 return 0x1;
5006 else if(dest->kind == 7 && source->kind == 6)
5007 return 0x1;
5008 else if(dest->kind == 2 && (source->kind == 1 || source->kind == 24))
5009 return 0x1;
5010 else if(dest->kind == 3 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 23))
5011 return 0x1;
5012 else if(dest->kind == 4 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 22 || source->kind == 23))
5013 return 0x1;
5014 else if(dest->kind == 22 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 23 || source->kind == 4))
5015 return 0x1;
5016 else if(dest->kind == 23 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 4 || source->kind == 22))
5017 return 0x1;
5018 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))
5019 return 0x1;
5020 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))
5021 return 0x1;
5022 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)))
5023 {
5024 struct Type * paramSource, * paramDest;
5025
5026 if(dest->kind == 16)
5027 owningClassDest = dest->methodClass ? dest->methodClass : dest->method->_class;
5028 if(source->kind == 16)
5029 owningClassSource = source->methodClass ? source->methodClass : source->method->_class;
5030 if(dest->kind == 13 && dest->type->kind == 11)
5031 dest = dest->type;
5032 if(source->kind == 13 && source->type->kind == 11)
5033 source = source->type;
5034 if(dest->kind == 16)
5035 dest = dest->method->dataType;
5036 if(source->kind == 16)
5037 source = source->method->dataType;
5038 paramSource = source->params.first;
5039 if(paramSource && paramSource->kind == 0)
5040 paramSource = (((void *)0));
5041 paramDest = dest->params.first;
5042 if(paramDest && paramDest->kind == 0)
5043 paramDest = (((void *)0));
5044 if((dest->staticMethod || (!dest->thisClass && !owningClassDest)) && !(source->staticMethod || (!source->thisClass && !owningClassSource)))
5045 {
5046 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))))
5047 {
5048 if(paramDest && paramDest->kind == 8)
5049 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), paramDest->_class->string);
5050 else
5051 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class should not take an object\n", (((void *)0))));
5052 return 0x0;
5053 }
5054 paramDest = paramDest->next;
5055 }
5056 else if(!dest->staticMethod && (dest->thisClass || owningClassDest))
5057 {
5058 if((source->staticMethod || (!source->thisClass && !owningClassSource)))
5059 {
5060 if(dest->thisClass)
5061 {
5062 if(!paramSource || paramSource->kind != 8 || !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, dest->thisClass->registered))
5063 {
5064 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5065 return 0x0;
5066 }
5067 }
5068 else
5069 {
5070 if(!paramSource || paramSource->kind != 8 || (owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(paramSource->_class->registered, owningClassDest)))
5071 {
5072 if(owningClassDest)
5073 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), owningClassDest->fullName);
5074 else
5075 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "overriding class expected to be derived from method class\n", (((void *)0))));
5076 return 0x0;
5077 }
5078 }
5079 paramSource = paramSource->next;
5080 }
5081 else
5082 {
5083 if(dest->thisClass)
5084 {
5085 if(!__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass ? source->thisClass->registered : owningClassSource, dest->thisClass->registered))
5086 {
5087 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "method class must be derived from %s\n", (((void *)0))), dest->thisClass->string);
5088 return 0x0;
5089 }
5090 }
5091 else
5092 {
5093 if(source->thisClass && source->thisClass->registered && owningClassDest && !__ecereNameSpace__ecere__com__eClass_IsDerived(source->thisClass->registered, owningClassDest))
5094 {
5095 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s expected to be derived from method class\n", (((void *)0))), source->thisClass->registered->fullName);
5096 return 0x0;
5097 }
5098 }
5099 }
5100 }
5101 if(!MatchTypes(source->returnType, dest->returnType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5102 {
5103 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible return type for function\n", (((void *)0))));
5104 return 0x0;
5105 }
5106 for(; paramDest; paramDest = paramDest->next)
5107 {
5108 if(!paramSource)
5109 {
5110 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "not enough parameters\n", (((void *)0))));
5111 return 0x0;
5112 }
5113 {
5114 struct Type * paramDestType = paramDest;
5115 struct Type * paramSourceType = paramSource;
5116 struct Type * type = paramDestType;
5117
5118 if(paramDest->kind == 20 && paramDest->templateParameter->type == 0 && owningClassSource && paramSource->kind != 20)
5119 {
5120 int id = 0;
5121 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
5122 struct __ecereNameSpace__ecere__com__Class * sClass;
5123
5124 for(sClass = owningClassSource; sClass; sClass = sClass->base)
5125 {
5126 id = 0;
5127 if(sClass->templateClass)
5128 sClass = sClass->templateClass;
5129 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
5130 {
5131 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
5132 {
5133 for(sClass = sClass->base; sClass; sClass = sClass->base)
5134 {
5135 if(sClass->templateClass)
5136 sClass = sClass->templateClass;
5137 id += sClass->templateParams.count;
5138 }
5139 break;
5140 }
5141 id++;
5142 }
5143 if(curParam)
5144 break;
5145 }
5146 if(curParam)
5147 {
5148 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = owningClassSource->templateArgs[id];
5149
5150 paramDestType = type = ProcessTypeString(arg.dataTypeString, 0x0);
5151 }
5152 }
5153 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)))
5154 {
5155 char type[1024];
5156
5157 type[0] = (char)0;
5158 PrintType(paramDest, type, 0x0, 0x1);
5159 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type);
5160 if(paramDestType != paramDest)
5161 FreeType(paramDestType);
5162 return 0x0;
5163 }
5164 if(paramDestType != paramDest)
5165 FreeType(paramDestType);
5166 }
5167 paramSource = paramSource->next;
5168 }
5169 if(paramSource)
5170 {
5171 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "too many parameters\n", (((void *)0))));
5172 return 0x0;
5173 }
5174 return 0x1;
5175 }
5176 else if((dest->kind == 11 || (dest->kind == 13 && dest->type->kind == 11) || dest->kind == 16) && (source->kind == 13 && source->type->kind == 0))
5177 {
5178 return 0x1;
5179 }
5180 else if((dest->kind == 13 || dest->kind == 12) && (source->kind == 12 || source->kind == 13))
5181 {
5182 if(MatchTypes(source->type, dest->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5183 return 0x1;
5184 }
5185 }
5186 return 0x0;
5187 }
5188
5189 static void FreeConvert(struct Conversion * convert)
5190 {
5191 if(convert->resultType)
5192 FreeType(convert->resultType);
5193 }
5194
5195 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__BTNamedLink;
5196
5197 struct __ecereNameSpace__ecere__com__BTNamedLink
5198 {
5199 char *  name;
5200 struct __ecereNameSpace__ecere__com__BTNamedLink * parent;
5201 struct __ecereNameSpace__ecere__com__BTNamedLink * left;
5202 struct __ecereNameSpace__ecere__com__BTNamedLink * right;
5203 int depth;
5204 void *  data;
5205 } __attribute__ ((gcc_struct));
5206
5207 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__EnumClassData;
5208
5209 struct __ecereNameSpace__ecere__com__EnumClassData
5210 {
5211 struct __ecereNameSpace__ecere__sys__OldList values;
5212 int largest;
5213 } __attribute__ ((gcc_struct));
5214
5215 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__NamedLink;
5216
5217 struct __ecereNameSpace__ecere__sys__NamedLink
5218 {
5219 struct __ecereNameSpace__ecere__sys__NamedLink * prev;
5220 struct __ecereNameSpace__ecere__sys__NamedLink * next;
5221 char *  name;
5222 void *  data;
5223 } __attribute__ ((gcc_struct));
5224
5225 extern void FreeExpContents(struct Expression * exp);
5226
5227 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_Get_first(struct __ecereNameSpace__ecere__sys__BinaryTree * this);
5228
5229 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BinaryTree_first;
5230
5231 struct __ecereNameSpace__ecere__sys__BTNode * __ecereProp___ecereNameSpace__ecere__sys__BTNode_Get_next(struct __ecereNameSpace__ecere__sys__BTNode * this);
5232
5233 extern struct __ecereNameSpace__ecere__com__Property ** __ecereProp___ecereNameSpace__ecere__sys__BTNode_next;
5234
5235 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(struct __ecereNameSpace__ecere__sys__OldList * this, void (*  freeFn)(void * ));
5236
5237 unsigned int MatchWithEnums_NameSpace(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5238 {
5239 struct __ecereNameSpace__ecere__com__BTNamedLink * link;
5240
5241 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)))
5242 {
5243 struct __ecereNameSpace__ecere__com__Class * _class = link->data;
5244
5245 if(_class->type == 4)
5246 {
5247 struct __ecereNameSpace__ecere__sys__OldList converts = 
5248 {
5249 0, 0, 0, 0, 0
5250 };
5251 struct Type * type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5252
5253 type->kind = 8;
5254 if(!_class->symbol)
5255 _class->symbol = FindClass(_class->fullName);
5256 type->_class = _class->symbol;
5257 if(MatchTypes(type, dest, &converts, (((void *)0)), (((void *)0)), 0x1, 0x0, 0x0, 0x0))
5258 {
5259 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5260 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5261
5262 if(enumClass)
5263 {
5264 struct __ecereNameSpace__ecere__com__Class * baseClass;
5265
5266 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
5267 {
5268 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
5269
5270 for(value = e->values.first; value; value = value->next)
5271 {
5272 if(!strcmp(value->name, string))
5273 break;
5274 }
5275 if(value)
5276 {
5277 FreeExpContents(sourceExp);
5278 FreeType(sourceExp->expType);
5279 sourceExp->isConstant = 0x1;
5280 sourceExp->expType = MkClassType(baseClass->fullName);
5281 {
5282 char constant[256];
5283
5284 sourceExp->type = 2;
5285 if(!strcmp(baseClass->dataTypeString, "int"))
5286 sprintf(constant, "%d", (int)value->data);
5287 else
5288 sprintf(constant, "0x%X", (int)value->data);
5289 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5290 }
5291 while(converts.first)
5292 {
5293 struct Conversion * convert = converts.first;
5294
5295 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&converts, convert);
5296 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(conversions, convert);
5297 }
5298 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5299 return 0x1;
5300 }
5301 }
5302 }
5303 }
5304 if(converts.first)
5305 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
5306 ((type ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(type) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(type)) : 0), type = 0);
5307 }
5308 }
5309 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)))
5310 if(MatchWithEnums_NameSpace(nameSpace, sourceExp, dest, string, conversions))
5311 return 0x1;
5312 return 0x0;
5313 }
5314
5315 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__SubModule;
5316
5317 struct __ecereNameSpace__ecere__com__SubModule
5318 {
5319 struct __ecereNameSpace__ecere__com__SubModule * prev;
5320 struct __ecereNameSpace__ecere__com__SubModule * next;
5321 struct __ecereNameSpace__ecere__com__Instance * module;
5322 int importMode;
5323 } __attribute__ ((gcc_struct));
5324
5325 unsigned int ModuleVisibility(struct __ecereNameSpace__ecere__com__Instance * searchIn, struct __ecereNameSpace__ecere__com__Instance * searchFor)
5326 {
5327 struct __ecereNameSpace__ecere__com__SubModule * subModule;
5328
5329 if(searchFor == searchIn)
5330 return 0x1;
5331 for(subModule = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->modules.first; subModule; subModule = subModule->next)
5332 {
5333 if(subModule->importMode == 1 || searchIn == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)searchIn + structSize_Instance)))->application)
5334 {
5335 if(ModuleVisibility(subModule->module, searchFor))
5336 return 0x1;
5337 }
5338 }
5339 return 0x0;
5340 }
5341
5342 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__Application;
5343
5344 struct __ecereNameSpace__ecere__com__Application
5345 {
5346 int argc;
5347 char * *  argv;
5348 int exitCode;
5349 unsigned int isGUIApp;
5350 struct __ecereNameSpace__ecere__sys__OldList allModules;
5351 char *  parsedCommand;
5352 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
5353 } __attribute__ ((gcc_struct));
5354
5355 unsigned int MatchWithEnums_Module(struct __ecereNameSpace__ecere__com__Instance * mainModule, struct Expression * sourceExp, struct Type * dest, char * string, struct __ecereNameSpace__ecere__sys__OldList * conversions)
5356 {
5357 struct __ecereNameSpace__ecere__com__Instance * module;
5358
5359 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))
5360 return 0x1;
5361 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))
5362 return 0x1;
5363 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))
5364 return 0x1;
5365 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)
5366 {
5367 if(ModuleVisibility(mainModule, module) && MatchWithEnums_NameSpace(&((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->publicNameSpace, sourceExp, dest, string, conversions))
5368 return 0x1;
5369 }
5370 return 0x0;
5371 }
5372
5373 extern struct Expression * CopyExpression(struct Expression * exp);
5374
5375 extern unsigned long strtoul(const char *  nptr, char * *  endptr, int base);
5376
5377 void ReadString(char *  output, char *  string);
5378
5379 extern struct Specifier * MkEnum(struct Identifier * id, struct __ecereNameSpace__ecere__sys__OldList * list);
5380
5381 extern struct TypeName * QMkClass(char *  spec, struct Declarator * decl);
5382
5383 extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__OldList * expressions);
5384
5385 unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * dest, struct __ecereNameSpace__ecere__sys__OldList * conversions, unsigned int skipUnitBla)
5386 {
5387 struct Type * source;
5388 struct Type * realDest = dest;
5389 struct Type * backupSourceExpType = (((void *)0));
5390 struct Expression * computedExp = sourceExp;
5391
5392 dest->refCount++;
5393 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)
5394 {
5395 computedExp = CopyExpression(sourceExp);
5396 ComputeExpression(computedExp);
5397 }
5398 source = sourceExp->expType;
5399 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
5400 {
5401 if(computedExp != sourceExp)
5402 {
5403 FreeExpression(computedExp);
5404 computedExp = sourceExp;
5405 }
5406 FreeType(dest);
5407 return 0x1;
5408 }
5409 if(!skipUnitBla && source && dest && source->kind == 8 && dest->kind == 8)
5410 {
5411 if(source->_class && source->_class->registered && source->_class->registered->type == 3)
5412 {
5413 struct __ecereNameSpace__ecere__com__Class * sourceBase, * destBase;
5414
5415 for(sourceBase = source->_class->registered; sourceBase && sourceBase->base && sourceBase->base->type != 1000; sourceBase = sourceBase->base)
5416 ;
5417 for(destBase = dest->_class->registered; destBase && destBase->base && destBase->base->type != 1000; destBase = destBase->base)
5418 ;
5419 if(sourceBase == destBase)
5420 {
5421 if(computedExp != sourceExp)
5422 {
5423 FreeExpression(computedExp);
5424 computedExp = sourceExp;
5425 }
5426 FreeType(dest);
5427 return 0x1;
5428 }
5429 }
5430 }
5431 if(source)
5432 {
5433 struct __ecereNameSpace__ecere__sys__OldList * specs;
5434 unsigned int flag = 0x0;
5435 long long value = (((int)0x7fffffff));
5436
5437 source->refCount++;
5438 if(computedExp->type == 2)
5439 {
5440 if(source->isSigned)
5441 value = strtoll(computedExp->constant, (((void *)0)), 0);
5442 else
5443 value = strtoull(computedExp->constant, (((void *)0)), 0);
5444 }
5445 else if(computedExp->type == 4 && sourceExp->op.op == '-' && !computedExp->op.exp1 && computedExp->op.exp2 && computedExp->op.exp2->type == 2)
5446 {
5447 if(source->isSigned)
5448 value = -strtoll(computedExp->op.exp2->constant, (((void *)0)), 0);
5449 else
5450 value = -strtoull(computedExp->op.exp2->constant, (((void *)0)), 0);
5451 }
5452 if(computedExp != sourceExp)
5453 {
5454 FreeExpression(computedExp);
5455 computedExp = sourceExp;
5456 }
5457 if(dest->kind != 8 && source->kind == 8 && source->_class && source->_class->registered && !strcmp(source->_class->registered->fullName, "ecere::com::unichar"))
5458 {
5459 FreeType(source);
5460 source = __extension__ ({
5461 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5462
5463 __ecereInstance1->kind = 3, __ecereInstance1->isSigned = 0x0, __ecereInstance1->refCount = 1, __ecereInstance1;
5464 });
5465 }
5466 if(dest->kind == 8)
5467 {
5468 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5469
5470 if(_class && _class->type == 3)
5471 {
5472 if(source->kind != 8)
5473 {
5474 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5475 struct Type * tempDest, * tempSource;
5476
5477 for(; _class->base->type != 1000; _class = _class->base)
5478 ;
5479 tempSource = dest;
5480 tempDest = tempType;
5481 tempType->kind = 8;
5482 if(!_class->symbol)
5483 _class->symbol = FindClass(_class->fullName);
5484 tempType->_class = _class->symbol;
5485 tempType->truth = dest->truth;
5486 if(tempType->_class)
5487 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5488 backupSourceExpType = sourceExp->expType;
5489 sourceExp->expType = dest;
5490 dest->refCount++;
5491 flag = 0x1;
5492 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5493 }
5494 }
5495 if(_class && _class->type == 2 && source->kind != 8)
5496 {
5497 if(!dest->_class->registered->dataType)
5498 dest->_class->registered->dataType = ProcessTypeString(dest->_class->registered->dataTypeString, 0x0);
5499 if(MatchTypes(source, dest->_class->registered->dataType, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5500 {
5501 FreeType(source);
5502 FreeType(sourceExp->expType);
5503 source = sourceExp->expType = MkClassType(dest->_class->string);
5504 source->refCount++;
5505 }
5506 }
5507 if(_class && !strcmp(_class->fullName, "ecere::com::Class") && source->kind == 13 && source->type && source->type->kind == 1 && sourceExp->type == 3)
5508 {
5509 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
5510 struct Declarator * decl;
5511 char string[1024];
5512
5513 ReadString(string, sourceExp->string);
5514 decl = SpecDeclFromString(string, specs, (((void *)0)));
5515 FreeExpContents(sourceExp);
5516 FreeType(sourceExp->expType);
5517 sourceExp->type = 24;
5518 sourceExp->_classExp.specifiers = specs;
5519 sourceExp->_classExp.decl = decl;
5520 sourceExp->expType = dest;
5521 dest->refCount++;
5522 FreeType(source);
5523 FreeType(dest);
5524 if(backupSourceExpType)
5525 FreeType(backupSourceExpType);
5526 return 0x1;
5527 }
5528 }
5529 else if(source->kind == 8)
5530 {
5531 struct __ecereNameSpace__ecere__com__Class * _class = source->_class ? source->_class->registered : (((void *)0));
5532
5533 if(_class && (_class->type == 3 || _class->type == 2))
5534 {
5535 if(dest->kind != 8)
5536 {
5537 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
5538 struct Type * tempDest, * tempSource;
5539
5540 if(!source->_class->registered->dataType)
5541 source->_class->registered->dataType = ProcessTypeString(source->_class->registered->dataTypeString, 0x0);
5542 for(; _class->base->type != 1000; _class = _class->base)
5543 ;
5544 tempDest = source;
5545 tempSource = tempType;
5546 tempType->kind = 8;
5547 tempType->_class = FindClass(_class->fullName);
5548 tempType->truth = source->truth;
5549 tempType->classObjectType = source->classObjectType;
5550 if(tempType->_class)
5551 MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
5552 if(conversions->last)
5553 {
5554 ((struct Conversion *)conversions->last)->resultType = dest;
5555 dest->refCount++;
5556 }
5557 FreeType(sourceExp->expType);
5558 sourceExp->expType = MkClassType(_class->fullName);
5559 sourceExp->expType->truth = source->truth;
5560 sourceExp->expType->classObjectType = source->classObjectType;
5561 if(!sourceExp->destType)
5562 {
5563 FreeType(sourceExp->destType);
5564 sourceExp->destType = sourceExp->expType;
5565 if(sourceExp->expType)
5566 sourceExp->expType->refCount++;
5567 }
5568 if(!_class->dataType)
5569 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5570 FreeType(dest);
5571 dest = MkClassType(source->_class->string);
5572 dest->truth = source->truth;
5573 dest->classObjectType = source->classObjectType;
5574 FreeType(source);
5575 source = _class->dataType;
5576 source->refCount++;
5577 ((tempType ? (__ecereClass_Type->Destructor ? __ecereClass_Type->Destructor(tempType) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(tempType)) : 0), tempType = 0);
5578 }
5579 }
5580 }
5581 if(!flag)
5582 {
5583 if(MatchTypes(source, dest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0))
5584 {
5585 FreeType(source);
5586 FreeType(dest);
5587 return 0x1;
5588 }
5589 }
5590 if(dest->kind == 8)
5591 {
5592 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class ? dest->_class->registered : (((void *)0));
5593 unsigned int fittingValue = 0x0;
5594
5595 if(_class && _class->type == 4)
5596 {
5597 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5598 struct __ecereNameSpace__ecere__com__EnumClassData * c = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5599
5600 if(c && value >= 0 && value <= c->largest)
5601 fittingValue = 0x1;
5602 }
5603 if(_class && !dest->truth && (_class->type == 3 || fittingValue || (_class->type != 1 && !value && source->kind == 3) || _class->type == 2))
5604 {
5605 if(_class->type == 0 || _class->type == 5)
5606 {
5607 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5608
5609 *newExp = *sourceExp;
5610 if(sourceExp->destType)
5611 sourceExp->destType->refCount++;
5612 if(sourceExp->expType)
5613 sourceExp->expType->refCount++;
5614 sourceExp->type = 11;
5615 sourceExp->cast.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0))));
5616 sourceExp->cast.exp = newExp;
5617 FreeType(sourceExp->expType);
5618 sourceExp->expType = (((void *)0));
5619 ProcessExpressionType(sourceExp);
5620 if(!inCompiler)
5621 {
5622 FreeType(sourceExp->expType);
5623 sourceExp->expType = dest;
5624 }
5625 FreeType(source);
5626 if(inCompiler)
5627 FreeType(dest);
5628 if(backupSourceExpType)
5629 FreeType(backupSourceExpType);
5630 return 0x1;
5631 }
5632 if(!_class->dataType)
5633 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
5634 FreeType(dest);
5635 dest = _class->dataType;
5636 dest->refCount++;
5637 }
5638 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))
5639 {
5640 specs = MkListOne(MkSpecifier(DOUBLE));
5641 }
5642 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))
5643 {
5644 specs = MkListOne(MkSpecifier(FLOAT));
5645 }
5646 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))
5647 {
5648 specs = MkList();
5649 if(!dest->isSigned)
5650 ListAdd(specs, MkSpecifier(UNSIGNED));
5651 ListAdd(specs, MkSpecifier(INT64));
5652 }
5653 else if(dest->kind == 3 && (source->kind == 3 || source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 6 || source->kind == 7))
5654 {
5655 specs = MkList();
5656 if(!dest->isSigned)
5657 ListAdd(specs, MkSpecifier(UNSIGNED));
5658 ListAdd(specs, MkSpecifier(INT));
5659 }
5660 else if(dest->kind == 2 && (source->kind == 2 || source->kind == 1 || source->kind == 24 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5661 {
5662 specs = MkList();
5663 if(!dest->isSigned)
5664 ListAdd(specs, MkSpecifier(UNSIGNED));
5665 ListAdd(specs, MkSpecifier(SHORT));
5666 }
5667 else if(dest->kind == 1 && (source->kind == 1 || source->kind == 24 || source->kind == 2 || source->kind == 3 || source->kind == 6 || source->kind == 7))
5668 {
5669 specs = MkList();
5670 if(!dest->isSigned)
5671 ListAdd(specs, MkSpecifier(UNSIGNED));
5672 ListAdd(specs, MkSpecifier(CHAR));
5673 }
5674 else
5675 {
5676 FreeType(source);
5677 FreeType(dest);
5678 if(backupSourceExpType)
5679 {
5680 if(sourceExp->expType)
5681 FreeType(sourceExp->expType);
5682 sourceExp->expType = backupSourceExpType;
5683 }
5684 return 0x0;
5685 }
5686 }
5687 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))
5688 {
5689 specs = MkListOne(MkSpecifier(DOUBLE));
5690 }
5691 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))
5692 {
5693 specs = MkListOne(MkSpecifier(FLOAT));
5694 }
5695 else if(dest->kind == 24 && (source->kind == 24 || source->kind == 1 || source->kind == 15 || source->kind == 2 || source->kind == 3) && (value == 1 || value == 0))
5696 {
5697 specs = MkList();
5698 ListAdd(specs, MkSpecifier(BOOL));
5699 }
5700 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)))
5701 {
5702 specs = MkList();
5703 if(!dest->isSigned)
5704 ListAdd(specs, MkSpecifier(UNSIGNED));
5705 ListAdd(specs, MkSpecifier(CHAR));
5706 }
5707 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)))))
5708 {
5709 specs = MkList();
5710 if(!dest->isSigned)
5711 ListAdd(specs, MkSpecifier(UNSIGNED));
5712 ListAdd(specs, MkSpecifier(SHORT));
5713 }
5714 else if(dest->kind == 3 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3))
5715 {
5716 specs = MkList();
5717 if(!dest->isSigned)
5718 ListAdd(specs, MkSpecifier(UNSIGNED));
5719 ListAdd(specs, MkSpecifier(INT));
5720 }
5721 else if(dest->kind == 4 && (source->kind == 15 || source->kind == 2 || source->kind == 24 || source->kind == 1 || source->kind == 3 || source->kind == 4))
5722 {
5723 specs = MkList();
5724 if(!dest->isSigned)
5725 ListAdd(specs, MkSpecifier(UNSIGNED));
5726 ListAdd(specs, MkSpecifier(INT64));
5727 }
5728 else if(dest->kind == 15 && (source->kind == 4 || source->kind == 3 || source->kind == 2 || source->kind == 24 || source->kind == 1))
5729 {
5730 specs = MkListOne(MkEnum(MkIdentifier(dest->enumName), (((void *)0))));
5731 }
5732 else
5733 {
5734 FreeType(source);
5735 FreeType(dest);
5736 if(backupSourceExpType)
5737 {
5738 if(sourceExp->expType)
5739 FreeType(sourceExp->expType);
5740 sourceExp->expType = backupSourceExpType;
5741 }
5742 return 0x0;
5743 }
5744 if(!flag && !sourceExp->opDestType)
5745 {
5746 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
5747
5748 *newExp = *sourceExp;
5749 newExp->prev = (((void *)0));
5750 newExp->next = (((void *)0));
5751 if(sourceExp->destType)
5752 sourceExp->destType->refCount++;
5753 if(sourceExp->expType)
5754 sourceExp->expType->refCount++;
5755 sourceExp->type = 11;
5756 if(realDest->kind == 8)
5757 {
5758 sourceExp->cast.typeName = QMkClass(realDest->_class->string, (((void *)0)));
5759 FreeList(specs, FreeSpecifier);
5760 }
5761 else
5762 sourceExp->cast.typeName = MkTypeName(specs, (((void *)0)));
5763 if(newExp->type == 4)
5764 {
5765 sourceExp->cast.exp = MkExpBrackets(MkListOne(newExp));
5766 }
5767 else
5768 sourceExp->cast.exp = newExp;
5769 FreeType(sourceExp->expType);
5770 sourceExp->expType = (((void *)0));
5771 ProcessExpressionType(sourceExp);
5772 }
5773 else
5774 FreeList(specs, FreeSpecifier);
5775 FreeType(dest);
5776 FreeType(source);
5777 if(backupSourceExpType)
5778 FreeType(backupSourceExpType);
5779 return 0x1;
5780 }
5781 else
5782 {
5783 if(computedExp != sourceExp)
5784 {
5785 FreeExpression(computedExp);
5786 computedExp = sourceExp;
5787 }
5788 while((sourceExp->type == 5 || sourceExp->type == 32) && sourceExp->list)
5789 sourceExp = (*sourceExp->list).last;
5790 if(sourceExp->type == 0)
5791 {
5792 struct Identifier * id = sourceExp->identifier;
5793
5794 if(dest->kind == 8)
5795 {
5796 if(dest->_class && dest->_class->registered && dest->_class->registered->type == 4)
5797 {
5798 struct __ecereNameSpace__ecere__com__Class * _class = dest->_class->registered;
5799 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
5800
5801 if(enumClass)
5802 {
5803 for(; _class && _class->type == 4; _class = _class->base)
5804 {
5805 struct __ecereNameSpace__ecere__sys__NamedLink * value;
5806 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
5807
5808 for(value = e->values.first; value; value = value->next)
5809 {
5810 if(!strcmp(value->name, id->string))
5811 break;
5812 }
5813 if(value)
5814 {
5815 FreeExpContents(sourceExp);
5816 FreeType(sourceExp->expType);
5817 sourceExp->isConstant = 0x1;
5818 sourceExp->expType = MkClassType(_class->fullName);
5819 {
5820 char constant[256];
5821
5822 sourceExp->type = 2;
5823 if(_class->dataTypeString && !strcmp(_class->dataTypeString, "int"))
5824 sprintf(constant, "%d", (int)value->data);
5825 else
5826 sprintf(constant, "0x%X", (int)value->data);
5827 sourceExp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
5828 }
5829 FreeType(dest);
5830 return 0x1;
5831 }
5832 }
5833 }
5834 }
5835 }
5836 if(dest->classObjectType != 2 && dest->kind == 8 && MatchWithEnums_Module(privateModule, sourceExp, dest, id->string, conversions))
5837 {
5838 FreeType(dest);
5839 return 0x1;
5840 }
5841 }
5842 FreeType(dest);
5843 }
5844 return 0x0;
5845 }
5846
5847 static unsigned int IntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5848 {
5849 int value2 = op2->i;
5850
5851 exp->type = 2;
5852 exp->string = PrintInt((op1->i + value2));
5853 if(!exp->expType)
5854 {
5855 exp->expType = op1->type;
5856 if(op1->type)
5857 op1->type->refCount++;
5858 }
5859 return 0x1;
5860 }
5861
5862 static unsigned int UIntAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5863 {
5864 unsigned int value2 = op2->ui;
5865
5866 exp->type = 2;
5867 exp->string = PrintUInt((op1->ui + value2));
5868 if(!exp->expType)
5869 {
5870 exp->expType = op1->type;
5871 if(op1->type)
5872 op1->type->refCount++;
5873 }
5874 return 0x1;
5875 }
5876
5877 static unsigned int Int64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5878 {
5879 long long value2 = op2->i64;
5880
5881 exp->type = 2;
5882 exp->string = PrintInt64((op1->i64 + value2));
5883 if(!exp->expType)
5884 {
5885 exp->expType = op1->type;
5886 if(op1->type)
5887 op1->type->refCount++;
5888 }
5889 return 0x1;
5890 }
5891
5892 static unsigned int UInt64Add(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5893 {
5894 uint64 value2 = op2->ui64;
5895
5896 exp->type = 2;
5897 exp->string = PrintUInt64((op1->ui64 + value2));
5898 if(!exp->expType)
5899 {
5900 exp->expType = op1->type;
5901 if(op1->type)
5902 op1->type->refCount++;
5903 }
5904 return 0x1;
5905 }
5906
5907 static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5908 {
5909 short value2 = op2->s;
5910
5911 exp->type = 2;
5912 exp->string = PrintShort((op1->s + value2));
5913 if(!exp->expType)
5914 {
5915 exp->expType = op1->type;
5916 if(op1->type)
5917 op1->type->refCount++;
5918 }
5919 return 0x1;
5920 }
5921
5922 static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5923 {
5924 unsigned short value2 = op2->us;
5925
5926 exp->type = 2;
5927 exp->string = PrintUShort((op1->us + value2));
5928 if(!exp->expType)
5929 {
5930 exp->expType = op1->type;
5931 if(op1->type)
5932 op1->type->refCount++;
5933 }
5934 return 0x1;
5935 }
5936
5937 static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5938 {
5939 char value2 = op2->c;
5940
5941 exp->type = 2;
5942 exp->string = PrintChar((op1->c + value2));
5943 if(!exp->expType)
5944 {
5945 exp->expType = op1->type;
5946 if(op1->type)
5947 op1->type->refCount++;
5948 }
5949 return 0x1;
5950 }
5951
5952 static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5953 {
5954 unsigned char value2 = op2->uc;
5955
5956 exp->type = 2;
5957 exp->string = PrintUChar((op1->uc + value2));
5958 if(!exp->expType)
5959 {
5960 exp->expType = op1->type;
5961 if(op1->type)
5962 op1->type->refCount++;
5963 }
5964 return 0x1;
5965 }
5966
5967 static unsigned int FloatAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5968 {
5969 float value2 = op2->f;
5970
5971 exp->type = 2;
5972 exp->string = PrintFloat((float)(op1->f + value2));
5973 if(!exp->expType)
5974 {
5975 exp->expType = op1->type;
5976 if(op1->type)
5977 op1->type->refCount++;
5978 }
5979 return 0x1;
5980 }
5981
5982 static unsigned int DoubleAdd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5983 {
5984 double value2 = op2->d;
5985
5986 exp->type = 2;
5987 exp->string = PrintDouble((double)(op1->d + value2));
5988 if(!exp->expType)
5989 {
5990 exp->expType = op1->type;
5991 if(op1->type)
5992 op1->type->refCount++;
5993 }
5994 return 0x1;
5995 }
5996
5997 static unsigned int IntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
5998 {
5999 int value2 = op2->i;
6000
6001 exp->type = 2;
6002 exp->string = PrintInt((op1->i - value2));
6003 if(!exp->expType)
6004 {
6005 exp->expType = op1->type;
6006 if(op1->type)
6007 op1->type->refCount++;
6008 }
6009 return 0x1;
6010 }
6011
6012 static unsigned int UIntSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6013 {
6014 unsigned int value2 = op2->ui;
6015
6016 exp->type = 2;
6017 exp->string = PrintUInt((op1->ui - value2));
6018 if(!exp->expType)
6019 {
6020 exp->expType = op1->type;
6021 if(op1->type)
6022 op1->type->refCount++;
6023 }
6024 return 0x1;
6025 }
6026
6027 static unsigned int Int64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6028 {
6029 long long value2 = op2->i64;
6030
6031 exp->type = 2;
6032 exp->string = PrintInt64((op1->i64 - value2));
6033 if(!exp->expType)
6034 {
6035 exp->expType = op1->type;
6036 if(op1->type)
6037 op1->type->refCount++;
6038 }
6039 return 0x1;
6040 }
6041
6042 static unsigned int UInt64Sub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6043 {
6044 uint64 value2 = op2->ui64;
6045
6046 exp->type = 2;
6047 exp->string = PrintUInt64((op1->ui64 - value2));
6048 if(!exp->expType)
6049 {
6050 exp->expType = op1->type;
6051 if(op1->type)
6052 op1->type->refCount++;
6053 }
6054 return 0x1;
6055 }
6056
6057 static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6058 {
6059 short value2 = op2->s;
6060
6061 exp->type = 2;
6062 exp->string = PrintShort((op1->s - value2));
6063 if(!exp->expType)
6064 {
6065 exp->expType = op1->type;
6066 if(op1->type)
6067 op1->type->refCount++;
6068 }
6069 return 0x1;
6070 }
6071
6072 static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6073 {
6074 unsigned short value2 = op2->us;
6075
6076 exp->type = 2;
6077 exp->string = PrintUShort((op1->us - value2));
6078 if(!exp->expType)
6079 {
6080 exp->expType = op1->type;
6081 if(op1->type)
6082 op1->type->refCount++;
6083 }
6084 return 0x1;
6085 }
6086
6087 static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6088 {
6089 char value2 = op2->c;
6090
6091 exp->type = 2;
6092 exp->string = PrintChar((op1->c - value2));
6093 if(!exp->expType)
6094 {
6095 exp->expType = op1->type;
6096 if(op1->type)
6097 op1->type->refCount++;
6098 }
6099 return 0x1;
6100 }
6101
6102 static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6103 {
6104 unsigned char value2 = op2->uc;
6105
6106 exp->type = 2;
6107 exp->string = PrintUChar((op1->uc - value2));
6108 if(!exp->expType)
6109 {
6110 exp->expType = op1->type;
6111 if(op1->type)
6112 op1->type->refCount++;
6113 }
6114 return 0x1;
6115 }
6116
6117 static unsigned int FloatSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6118 {
6119 float value2 = op2->f;
6120
6121 exp->type = 2;
6122 exp->string = PrintFloat((float)(op1->f - value2));
6123 if(!exp->expType)
6124 {
6125 exp->expType = op1->type;
6126 if(op1->type)
6127 op1->type->refCount++;
6128 }
6129 return 0x1;
6130 }
6131
6132 static unsigned int DoubleSub(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6133 {
6134 double value2 = op2->d;
6135
6136 exp->type = 2;
6137 exp->string = PrintDouble((double)(op1->d - value2));
6138 if(!exp->expType)
6139 {
6140 exp->expType = op1->type;
6141 if(op1->type)
6142 op1->type->refCount++;
6143 }
6144 return 0x1;
6145 }
6146
6147 static unsigned int IntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6148 {
6149 int value2 = op2->i;
6150
6151 exp->type = 2;
6152 exp->string = PrintInt((op1->i * value2));
6153 if(!exp->expType)
6154 {
6155 exp->expType = op1->type;
6156 if(op1->type)
6157 op1->type->refCount++;
6158 }
6159 return 0x1;
6160 }
6161
6162 static unsigned int UIntMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6163 {
6164 unsigned int value2 = op2->ui;
6165
6166 exp->type = 2;
6167 exp->string = PrintUInt((op1->ui * value2));
6168 if(!exp->expType)
6169 {
6170 exp->expType = op1->type;
6171 if(op1->type)
6172 op1->type->refCount++;
6173 }
6174 return 0x1;
6175 }
6176
6177 static unsigned int Int64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6178 {
6179 long long value2 = op2->i64;
6180
6181 exp->type = 2;
6182 exp->string = PrintInt64((op1->i64 * value2));
6183 if(!exp->expType)
6184 {
6185 exp->expType = op1->type;
6186 if(op1->type)
6187 op1->type->refCount++;
6188 }
6189 return 0x1;
6190 }
6191
6192 static unsigned int UInt64Mul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6193 {
6194 uint64 value2 = op2->ui64;
6195
6196 exp->type = 2;
6197 exp->string = PrintUInt64((op1->ui64 * value2));
6198 if(!exp->expType)
6199 {
6200 exp->expType = op1->type;
6201 if(op1->type)
6202 op1->type->refCount++;
6203 }
6204 return 0x1;
6205 }
6206
6207 static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6208 {
6209 short value2 = op2->s;
6210
6211 exp->type = 2;
6212 exp->string = PrintShort((op1->s * value2));
6213 if(!exp->expType)
6214 {
6215 exp->expType = op1->type;
6216 if(op1->type)
6217 op1->type->refCount++;
6218 }
6219 return 0x1;
6220 }
6221
6222 static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6223 {
6224 unsigned short value2 = op2->us;
6225
6226 exp->type = 2;
6227 exp->string = PrintUShort((op1->us * value2));
6228 if(!exp->expType)
6229 {
6230 exp->expType = op1->type;
6231 if(op1->type)
6232 op1->type->refCount++;
6233 }
6234 return 0x1;
6235 }
6236
6237 static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6238 {
6239 char value2 = op2->c;
6240
6241 exp->type = 2;
6242 exp->string = PrintChar((op1->c * value2));
6243 if(!exp->expType)
6244 {
6245 exp->expType = op1->type;
6246 if(op1->type)
6247 op1->type->refCount++;
6248 }
6249 return 0x1;
6250 }
6251
6252 static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6253 {
6254 unsigned char value2 = op2->uc;
6255
6256 exp->type = 2;
6257 exp->string = PrintUChar((op1->uc * value2));
6258 if(!exp->expType)
6259 {
6260 exp->expType = op1->type;
6261 if(op1->type)
6262 op1->type->refCount++;
6263 }
6264 return 0x1;
6265 }
6266
6267 static unsigned int FloatMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6268 {
6269 float value2 = op2->f;
6270
6271 exp->type = 2;
6272 exp->string = PrintFloat((float)(op1->f * value2));
6273 if(!exp->expType)
6274 {
6275 exp->expType = op1->type;
6276 if(op1->type)
6277 op1->type->refCount++;
6278 }
6279 return 0x1;
6280 }
6281
6282 static unsigned int DoubleMul(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6283 {
6284 double value2 = op2->d;
6285
6286 exp->type = 2;
6287 exp->string = PrintDouble((double)(op1->d * value2));
6288 if(!exp->expType)
6289 {
6290 exp->expType = op1->type;
6291 if(op1->type)
6292 op1->type->refCount++;
6293 }
6294 return 0x1;
6295 }
6296
6297 static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6298 {
6299 int value2 = op2->i;
6300
6301 exp->type = 2;
6302 exp->string = PrintInt(value2 ? (op1->i / value2) : 0);
6303 if(!exp->expType)
6304 {
6305 exp->expType = op1->type;
6306 if(op1->type)
6307 op1->type->refCount++;
6308 }
6309 return 0x1;
6310 }
6311
6312 static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6313 {
6314 unsigned int value2 = op2->ui;
6315
6316 exp->type = 2;
6317 exp->string = PrintUInt(value2 ? (op1->ui / value2) : 0);
6318 if(!exp->expType)
6319 {
6320 exp->expType = op1->type;
6321 if(op1->type)
6322 op1->type->refCount++;
6323 }
6324 return 0x1;
6325 }
6326
6327 static unsigned int Int64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6328 {
6329 long long value2 = op2->i64;
6330
6331 exp->type = 2;
6332 exp->string = PrintInt64(value2 ? (op1->i64 / value2) : 0);
6333 if(!exp->expType)
6334 {
6335 exp->expType = op1->type;
6336 if(op1->type)
6337 op1->type->refCount++;
6338 }
6339 return 0x1;
6340 }
6341
6342 static unsigned int UInt64Div(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6343 {
6344 uint64 value2 = op2->ui64;
6345
6346 exp->type = 2;
6347 exp->string = PrintUInt64(value2 ? (op1->ui64 / value2) : 0);
6348 if(!exp->expType)
6349 {
6350 exp->expType = op1->type;
6351 if(op1->type)
6352 op1->type->refCount++;
6353 }
6354 return 0x1;
6355 }
6356
6357 static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6358 {
6359 short value2 = op2->s;
6360
6361 exp->type = 2;
6362 exp->string = PrintShort(value2 ? (op1->s / value2) : (short)0);
6363 if(!exp->expType)
6364 {
6365 exp->expType = op1->type;
6366 if(op1->type)
6367 op1->type->refCount++;
6368 }
6369 return 0x1;
6370 }
6371
6372 static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6373 {
6374 unsigned short value2 = op2->us;
6375
6376 exp->type = 2;
6377 exp->string = PrintUShort(value2 ? (op1->us / value2) : (unsigned short)0);
6378 if(!exp->expType)
6379 {
6380 exp->expType = op1->type;
6381 if(op1->type)
6382 op1->type->refCount++;
6383 }
6384 return 0x1;
6385 }
6386
6387 static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6388 {
6389 char value2 = op2->c;
6390
6391 exp->type = 2;
6392 exp->string = PrintChar(value2 ? (op1->c / value2) : (char)0);
6393 if(!exp->expType)
6394 {
6395 exp->expType = op1->type;
6396 if(op1->type)
6397 op1->type->refCount++;
6398 }
6399 return 0x1;
6400 }
6401
6402 static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6403 {
6404 unsigned char value2 = op2->uc;
6405
6406 exp->type = 2;
6407 exp->string = PrintUChar(value2 ? (op1->uc / value2) : (unsigned char)0);
6408 if(!exp->expType)
6409 {
6410 exp->expType = op1->type;
6411 if(op1->type)
6412 op1->type->refCount++;
6413 }
6414 return 0x1;
6415 }
6416
6417 static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6418 {
6419 float value2 = op2->f;
6420
6421 exp->type = 2;
6422 exp->string = PrintFloat(op1->f / value2);
6423 if(!exp->expType)
6424 {
6425 exp->expType = op1->type;
6426 if(op1->type)
6427 op1->type->refCount++;
6428 }
6429 return 0x1;
6430 }
6431
6432 static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6433 {
6434 double value2 = op2->d;
6435
6436 exp->type = 2;
6437 exp->string = PrintDouble(op1->d / value2);
6438 if(!exp->expType)
6439 {
6440 exp->expType = op1->type;
6441 if(op1->type)
6442 op1->type->refCount++;
6443 }
6444 return 0x1;
6445 }
6446
6447 static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6448 {
6449 int value2 = op2->i;
6450
6451 exp->type = 2;
6452 exp->string = PrintInt(value2 ? (op1->i % value2) : 0);
6453 if(!exp->expType)
6454 {
6455 exp->expType = op1->type;
6456 if(op1->type)
6457 op1->type->refCount++;
6458 }
6459 return 0x1;
6460 }
6461
6462 static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6463 {
6464 unsigned int value2 = op2->ui;
6465
6466 exp->type = 2;
6467 exp->string = PrintUInt(value2 ? (op1->ui % value2) : 0);
6468 if(!exp->expType)
6469 {
6470 exp->expType = op1->type;
6471 if(op1->type)
6472 op1->type->refCount++;
6473 }
6474 return 0x1;
6475 }
6476
6477 static unsigned int Int64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6478 {
6479 long long value2 = op2->i64;
6480
6481 exp->type = 2;
6482 exp->string = PrintInt64(value2 ? (op1->i64 % value2) : 0);
6483 if(!exp->expType)
6484 {
6485 exp->expType = op1->type;
6486 if(op1->type)
6487 op1->type->refCount++;
6488 }
6489 return 0x1;
6490 }
6491
6492 static unsigned int UInt64Mod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6493 {
6494 uint64 value2 = op2->ui64;
6495
6496 exp->type = 2;
6497 exp->string = PrintUInt64(value2 ? (op1->ui64 % value2) : 0);
6498 if(!exp->expType)
6499 {
6500 exp->expType = op1->type;
6501 if(op1->type)
6502 op1->type->refCount++;
6503 }
6504 return 0x1;
6505 }
6506
6507 static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6508 {
6509 short value2 = op2->s;
6510
6511 exp->type = 2;
6512 exp->string = PrintShort(value2 ? (op1->s % value2) : (short)0);
6513 if(!exp->expType)
6514 {
6515 exp->expType = op1->type;
6516 if(op1->type)
6517 op1->type->refCount++;
6518 }
6519 return 0x1;
6520 }
6521
6522 static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6523 {
6524 unsigned short value2 = op2->us;
6525
6526 exp->type = 2;
6527 exp->string = PrintUShort(value2 ? (op1->us % value2) : (unsigned short)0);
6528 if(!exp->expType)
6529 {
6530 exp->expType = op1->type;
6531 if(op1->type)
6532 op1->type->refCount++;
6533 }
6534 return 0x1;
6535 }
6536
6537 static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6538 {
6539 char value2 = op2->c;
6540
6541 exp->type = 2;
6542 exp->string = PrintChar(value2 ? (op1->c % value2) : (char)0);
6543 if(!exp->expType)
6544 {
6545 exp->expType = op1->type;
6546 if(op1->type)
6547 op1->type->refCount++;
6548 }
6549 return 0x1;
6550 }
6551
6552 static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6553 {
6554 unsigned char value2 = op2->uc;
6555
6556 exp->type = 2;
6557 exp->string = PrintUChar(value2 ? (op1->uc % value2) : (unsigned char)0);
6558 if(!exp->expType)
6559 {
6560 exp->expType = op1->type;
6561 if(op1->type)
6562 op1->type->refCount++;
6563 }
6564 return 0x1;
6565 }
6566
6567 static unsigned int IntNeg(struct Expression * exp, struct Operand * op1)
6568 {
6569 exp->type = 2;
6570 exp->string = PrintInt((-op1->i));
6571 if(!exp->expType)
6572 {
6573 exp->expType = op1->type;
6574 if(op1->type)
6575 op1->type->refCount++;
6576 }
6577 return 0x1;
6578 }
6579
6580 static unsigned int UIntNeg(struct Expression * exp, struct Operand * op1)
6581 {
6582 exp->type = 2;
6583 exp->string = PrintUInt((unsigned int)(-op1->ui));
6584 if(!exp->expType)
6585 {
6586 exp->expType = op1->type;
6587 if(op1->type)
6588 op1->type->refCount++;
6589 }
6590 return 0x1;
6591 }
6592
6593 static unsigned int Int64Neg(struct Expression * exp, struct Operand * op1)
6594 {
6595 exp->type = 2;
6596 exp->string = PrintInt64((-op1->i64));
6597 if(!exp->expType)
6598 {
6599 exp->expType = op1->type;
6600 if(op1->type)
6601 op1->type->refCount++;
6602 }
6603 return 0x1;
6604 }
6605
6606 static unsigned int UInt64Neg(struct Expression * exp, struct Operand * op1)
6607 {
6608 exp->type = 2;
6609 exp->string = PrintUInt64((uint64)(-op1->ui64));
6610 if(!exp->expType)
6611 {
6612 exp->expType = op1->type;
6613 if(op1->type)
6614 op1->type->refCount++;
6615 }
6616 return 0x1;
6617 }
6618
6619 static unsigned int ShortNeg(struct Expression * exp, struct Operand * op1)
6620 {
6621 exp->type = 2;
6622 exp->string = PrintShort((-op1->s));
6623 if(!exp->expType)
6624 {
6625 exp->expType = op1->type;
6626 if(op1->type)
6627 op1->type->refCount++;
6628 }
6629 return 0x1;
6630 }
6631
6632 static unsigned int UShortNeg(struct Expression * exp, struct Operand * op1)
6633 {
6634 exp->type = 2;
6635 exp->string = PrintUShort((unsigned short)(-op1->us));
6636 if(!exp->expType)
6637 {
6638 exp->expType = op1->type;
6639 if(op1->type)
6640 op1->type->refCount++;
6641 }
6642 return 0x1;
6643 }
6644
6645 static unsigned int CharNeg(struct Expression * exp, struct Operand * op1)
6646 {
6647 exp->type = 2;
6648 exp->string = PrintChar((-op1->c));
6649 if(!exp->expType)
6650 {
6651 exp->expType = op1->type;
6652 if(op1->type)
6653 op1->type->refCount++;
6654 }
6655 return 0x1;
6656 }
6657
6658 static unsigned int UCharNeg(struct Expression * exp, struct Operand * op1)
6659 {
6660 exp->type = 2;
6661 exp->string = PrintUChar((unsigned char)(-op1->uc));
6662 if(!exp->expType)
6663 {
6664 exp->expType = op1->type;
6665 if(op1->type)
6666 op1->type->refCount++;
6667 }
6668 return 0x1;
6669 }
6670
6671 static unsigned int FloatNeg(struct Expression * exp, struct Operand * op1)
6672 {
6673 exp->type = 2;
6674 exp->string = PrintFloat((float)(-op1->f));
6675 if(!exp->expType)
6676 {
6677 exp->expType = op1->type;
6678 if(op1->type)
6679 op1->type->refCount++;
6680 }
6681 return 0x1;
6682 }
6683
6684 static unsigned int DoubleNeg(struct Expression * exp, struct Operand * op1)
6685 {
6686 exp->type = 2;
6687 exp->string = PrintDouble((double)(-op1->d));
6688 if(!exp->expType)
6689 {
6690 exp->expType = op1->type;
6691 if(op1->type)
6692 op1->type->refCount++;
6693 }
6694 return 0x1;
6695 }
6696
6697 static unsigned int IntInc(struct Expression * exp, struct Operand * op1)
6698 {
6699 exp->type = 2;
6700 exp->string = PrintInt((++op1->i));
6701 if(!exp->expType)
6702 {
6703 exp->expType = op1->type;
6704 if(op1->type)
6705 op1->type->refCount++;
6706 }
6707 return 0x1;
6708 }
6709
6710 static unsigned int UIntInc(struct Expression * exp, struct Operand * op1)
6711 {
6712 exp->type = 2;
6713 exp->string = PrintUInt((++op1->ui));
6714 if(!exp->expType)
6715 {
6716 exp->expType = op1->type;
6717 if(op1->type)
6718 op1->type->refCount++;
6719 }
6720 return 0x1;
6721 }
6722
6723 static unsigned int Int64Inc(struct Expression * exp, struct Operand * op1)
6724 {
6725 exp->type = 2;
6726 exp->string = PrintInt64((++op1->i64));
6727 if(!exp->expType)
6728 {
6729 exp->expType = op1->type;
6730 if(op1->type)
6731 op1->type->refCount++;
6732 }
6733 return 0x1;
6734 }
6735
6736 static unsigned int UInt64Inc(struct Expression * exp, struct Operand * op1)
6737 {
6738 exp->type = 2;
6739 exp->string = PrintUInt64((++op1->ui64));
6740 if(!exp->expType)
6741 {
6742 exp->expType = op1->type;
6743 if(op1->type)
6744 op1->type->refCount++;
6745 }
6746 return 0x1;
6747 }
6748
6749 static unsigned int ShortInc(struct Expression * exp, struct Operand * op1)
6750 {
6751 exp->type = 2;
6752 exp->string = PrintShort((++op1->s));
6753 if(!exp->expType)
6754 {
6755 exp->expType = op1->type;
6756 if(op1->type)
6757 op1->type->refCount++;
6758 }
6759 return 0x1;
6760 }
6761
6762 static unsigned int UShortInc(struct Expression * exp, struct Operand * op1)
6763 {
6764 exp->type = 2;
6765 exp->string = PrintUShort((++op1->us));
6766 if(!exp->expType)
6767 {
6768 exp->expType = op1->type;
6769 if(op1->type)
6770 op1->type->refCount++;
6771 }
6772 return 0x1;
6773 }
6774
6775 static unsigned int CharInc(struct Expression * exp, struct Operand * op1)
6776 {
6777 exp->type = 2;
6778 exp->string = PrintChar((++op1->c));
6779 if(!exp->expType)
6780 {
6781 exp->expType = op1->type;
6782 if(op1->type)
6783 op1->type->refCount++;
6784 }
6785 return 0x1;
6786 }
6787
6788 static unsigned int UCharInc(struct Expression * exp, struct Operand * op1)
6789 {
6790 exp->type = 2;
6791 exp->string = PrintUChar((++op1->uc));
6792 if(!exp->expType)
6793 {
6794 exp->expType = op1->type;
6795 if(op1->type)
6796 op1->type->refCount++;
6797 }
6798 return 0x1;
6799 }
6800
6801 static unsigned int FloatInc(struct Expression * exp, struct Operand * op1)
6802 {
6803 exp->type = 2;
6804 exp->string = PrintFloat((float)(++op1->f));
6805 if(!exp->expType)
6806 {
6807 exp->expType = op1->type;
6808 if(op1->type)
6809 op1->type->refCount++;
6810 }
6811 return 0x1;
6812 }
6813
6814 static unsigned int DoubleInc(struct Expression * exp, struct Operand * op1)
6815 {
6816 exp->type = 2;
6817 exp->string = PrintDouble((double)(++op1->d));
6818 if(!exp->expType)
6819 {
6820 exp->expType = op1->type;
6821 if(op1->type)
6822 op1->type->refCount++;
6823 }
6824 return 0x1;
6825 }
6826
6827 static unsigned int IntDec(struct Expression * exp, struct Operand * op1)
6828 {
6829 exp->type = 2;
6830 exp->string = PrintInt((--op1->i));
6831 if(!exp->expType)
6832 {
6833 exp->expType = op1->type;
6834 if(op1->type)
6835 op1->type->refCount++;
6836 }
6837 return 0x1;
6838 }
6839
6840 static unsigned int UIntDec(struct Expression * exp, struct Operand * op1)
6841 {
6842 exp->type = 2;
6843 exp->string = PrintUInt((--op1->ui));
6844 if(!exp->expType)
6845 {
6846 exp->expType = op1->type;
6847 if(op1->type)
6848 op1->type->refCount++;
6849 }
6850 return 0x1;
6851 }
6852
6853 static unsigned int Int64Dec(struct Expression * exp, struct Operand * op1)
6854 {
6855 exp->type = 2;
6856 exp->string = PrintInt64((--op1->i64));
6857 if(!exp->expType)
6858 {
6859 exp->expType = op1->type;
6860 if(op1->type)
6861 op1->type->refCount++;
6862 }
6863 return 0x1;
6864 }
6865
6866 static unsigned int UInt64Dec(struct Expression * exp, struct Operand * op1)
6867 {
6868 exp->type = 2;
6869 exp->string = PrintUInt64((--op1->ui64));
6870 if(!exp->expType)
6871 {
6872 exp->expType = op1->type;
6873 if(op1->type)
6874 op1->type->refCount++;
6875 }
6876 return 0x1;
6877 }
6878
6879 static unsigned int ShortDec(struct Expression * exp, struct Operand * op1)
6880 {
6881 exp->type = 2;
6882 exp->string = PrintShort((--op1->s));
6883 if(!exp->expType)
6884 {
6885 exp->expType = op1->type;
6886 if(op1->type)
6887 op1->type->refCount++;
6888 }
6889 return 0x1;
6890 }
6891
6892 static unsigned int UShortDec(struct Expression * exp, struct Operand * op1)
6893 {
6894 exp->type = 2;
6895 exp->string = PrintUShort((--op1->us));
6896 if(!exp->expType)
6897 {
6898 exp->expType = op1->type;
6899 if(op1->type)
6900 op1->type->refCount++;
6901 }
6902 return 0x1;
6903 }
6904
6905 static unsigned int CharDec(struct Expression * exp, struct Operand * op1)
6906 {
6907 exp->type = 2;
6908 exp->string = PrintChar((--op1->c));
6909 if(!exp->expType)
6910 {
6911 exp->expType = op1->type;
6912 if(op1->type)
6913 op1->type->refCount++;
6914 }
6915 return 0x1;
6916 }
6917
6918 static unsigned int UCharDec(struct Expression * exp, struct Operand * op1)
6919 {
6920 exp->type = 2;
6921 exp->string = PrintUChar((--op1->uc));
6922 if(!exp->expType)
6923 {
6924 exp->expType = op1->type;
6925 if(op1->type)
6926 op1->type->refCount++;
6927 }
6928 return 0x1;
6929 }
6930
6931 static unsigned int FloatDec(struct Expression * exp, struct Operand * op1)
6932 {
6933 exp->type = 2;
6934 exp->string = PrintFloat((float)(--op1->f));
6935 if(!exp->expType)
6936 {
6937 exp->expType = op1->type;
6938 if(op1->type)
6939 op1->type->refCount++;
6940 }
6941 return 0x1;
6942 }
6943
6944 static unsigned int DoubleDec(struct Expression * exp, struct Operand * op1)
6945 {
6946 exp->type = 2;
6947 exp->string = PrintDouble((double)(--op1->d));
6948 if(!exp->expType)
6949 {
6950 exp->expType = op1->type;
6951 if(op1->type)
6952 op1->type->refCount++;
6953 }
6954 return 0x1;
6955 }
6956
6957 static unsigned int IntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6958 {
6959 int value2 = op2->i;
6960
6961 exp->type = 2;
6962 exp->string = PrintInt((op1->i = value2));
6963 if(!exp->expType)
6964 {
6965 exp->expType = op1->type;
6966 if(op1->type)
6967 op1->type->refCount++;
6968 }
6969 return 0x1;
6970 }
6971
6972 static unsigned int UIntAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6973 {
6974 unsigned int value2 = op2->ui;
6975
6976 exp->type = 2;
6977 exp->string = PrintUInt((op1->ui = value2));
6978 if(!exp->expType)
6979 {
6980 exp->expType = op1->type;
6981 if(op1->type)
6982 op1->type->refCount++;
6983 }
6984 return 0x1;
6985 }
6986
6987 static unsigned int Int64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
6988 {
6989 long long value2 = op2->i64;
6990
6991 exp->type = 2;
6992 exp->string = PrintInt64((op1->i64 = value2));
6993 if(!exp->expType)
6994 {
6995 exp->expType = op1->type;
6996 if(op1->type)
6997 op1->type->refCount++;
6998 }
6999 return 0x1;
7000 }
7001
7002 static unsigned int UInt64Asign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7003 {
7004 uint64 value2 = op2->ui64;
7005
7006 exp->type = 2;
7007 exp->string = PrintUInt64((op1->ui64 = value2));
7008 if(!exp->expType)
7009 {
7010 exp->expType = op1->type;
7011 if(op1->type)
7012 op1->type->refCount++;
7013 }
7014 return 0x1;
7015 }
7016
7017 static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7018 {
7019 short value2 = op2->s;
7020
7021 exp->type = 2;
7022 exp->string = PrintShort((op1->s = value2));
7023 if(!exp->expType)
7024 {
7025 exp->expType = op1->type;
7026 if(op1->type)
7027 op1->type->refCount++;
7028 }
7029 return 0x1;
7030 }
7031
7032 static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7033 {
7034 unsigned short value2 = op2->us;
7035
7036 exp->type = 2;
7037 exp->string = PrintUShort((op1->us = value2));
7038 if(!exp->expType)
7039 {
7040 exp->expType = op1->type;
7041 if(op1->type)
7042 op1->type->refCount++;
7043 }
7044 return 0x1;
7045 }
7046
7047 static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7048 {
7049 char value2 = op2->c;
7050
7051 exp->type = 2;
7052 exp->string = PrintChar((op1->c = value2));
7053 if(!exp->expType)
7054 {
7055 exp->expType = op1->type;
7056 if(op1->type)
7057 op1->type->refCount++;
7058 }
7059 return 0x1;
7060 }
7061
7062 static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7063 {
7064 unsigned char value2 = op2->uc;
7065
7066 exp->type = 2;
7067 exp->string = PrintUChar((op1->uc = value2));
7068 if(!exp->expType)
7069 {
7070 exp->expType = op1->type;
7071 if(op1->type)
7072 op1->type->refCount++;
7073 }
7074 return 0x1;
7075 }
7076
7077 static unsigned int FloatAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7078 {
7079 float value2 = op2->f;
7080
7081 exp->type = 2;
7082 exp->string = PrintFloat((float)(op1->f = value2));
7083 if(!exp->expType)
7084 {
7085 exp->expType = op1->type;
7086 if(op1->type)
7087 op1->type->refCount++;
7088 }
7089 return 0x1;
7090 }
7091
7092 static unsigned int DoubleAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7093 {
7094 double value2 = op2->d;
7095
7096 exp->type = 2;
7097 exp->string = PrintDouble((double)(op1->d = value2));
7098 if(!exp->expType)
7099 {
7100 exp->expType = op1->type;
7101 if(op1->type)
7102 op1->type->refCount++;
7103 }
7104 return 0x1;
7105 }
7106
7107 static unsigned int IntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7108 {
7109 int value2 = op2->i;
7110
7111 exp->type = 2;
7112 exp->string = PrintInt((op1->i += value2));
7113 if(!exp->expType)
7114 {
7115 exp->expType = op1->type;
7116 if(op1->type)
7117 op1->type->refCount++;
7118 }
7119 return 0x1;
7120 }
7121
7122 static unsigned int UIntAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7123 {
7124 unsigned int value2 = op2->ui;
7125
7126 exp->type = 2;
7127 exp->string = PrintUInt((op1->ui += value2));
7128 if(!exp->expType)
7129 {
7130 exp->expType = op1->type;
7131 if(op1->type)
7132 op1->type->refCount++;
7133 }
7134 return 0x1;
7135 }
7136
7137 static unsigned int Int64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7138 {
7139 long long value2 = op2->i64;
7140
7141 exp->type = 2;
7142 exp->string = PrintInt64((op1->i64 += value2));
7143 if(!exp->expType)
7144 {
7145 exp->expType = op1->type;
7146 if(op1->type)
7147 op1->type->refCount++;
7148 }
7149 return 0x1;
7150 }
7151
7152 static unsigned int UInt64AddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7153 {
7154 uint64 value2 = op2->ui64;
7155
7156 exp->type = 2;
7157 exp->string = PrintUInt64((op1->ui64 += value2));
7158 if(!exp->expType)
7159 {
7160 exp->expType = op1->type;
7161 if(op1->type)
7162 op1->type->refCount++;
7163 }
7164 return 0x1;
7165 }
7166
7167 static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7168 {
7169 short value2 = op2->s;
7170
7171 exp->type = 2;
7172 exp->string = PrintShort((op1->s += value2));
7173 if(!exp->expType)
7174 {
7175 exp->expType = op1->type;
7176 if(op1->type)
7177 op1->type->refCount++;
7178 }
7179 return 0x1;
7180 }
7181
7182 static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7183 {
7184 unsigned short value2 = op2->us;
7185
7186 exp->type = 2;
7187 exp->string = PrintUShort((op1->us += value2));
7188 if(!exp->expType)
7189 {
7190 exp->expType = op1->type;
7191 if(op1->type)
7192 op1->type->refCount++;
7193 }
7194 return 0x1;
7195 }
7196
7197 static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7198 {
7199 char value2 = op2->c;
7200
7201 exp->type = 2;
7202 exp->string = PrintChar((op1->c += value2));
7203 if(!exp->expType)
7204 {
7205 exp->expType = op1->type;
7206 if(op1->type)
7207 op1->type->refCount++;
7208 }
7209 return 0x1;
7210 }
7211
7212 static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7213 {
7214 unsigned char value2 = op2->uc;
7215
7216 exp->type = 2;
7217 exp->string = PrintUChar((op1->uc += value2));
7218 if(!exp->expType)
7219 {
7220 exp->expType = op1->type;
7221 if(op1->type)
7222 op1->type->refCount++;
7223 }
7224 return 0x1;
7225 }
7226
7227 static unsigned int FloatAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7228 {
7229 float value2 = op2->f;
7230
7231 exp->type = 2;
7232 exp->string = PrintFloat((float)(op1->f += value2));
7233 if(!exp->expType)
7234 {
7235 exp->expType = op1->type;
7236 if(op1->type)
7237 op1->type->refCount++;
7238 }
7239 return 0x1;
7240 }
7241
7242 static unsigned int DoubleAddAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7243 {
7244 double value2 = op2->d;
7245
7246 exp->type = 2;
7247 exp->string = PrintDouble((double)(op1->d += value2));
7248 if(!exp->expType)
7249 {
7250 exp->expType = op1->type;
7251 if(op1->type)
7252 op1->type->refCount++;
7253 }
7254 return 0x1;
7255 }
7256
7257 static unsigned int IntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7258 {
7259 int value2 = op2->i;
7260
7261 exp->type = 2;
7262 exp->string = PrintInt((op1->i -= value2));
7263 if(!exp->expType)
7264 {
7265 exp->expType = op1->type;
7266 if(op1->type)
7267 op1->type->refCount++;
7268 }
7269 return 0x1;
7270 }
7271
7272 static unsigned int UIntSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7273 {
7274 unsigned int value2 = op2->ui;
7275
7276 exp->type = 2;
7277 exp->string = PrintUInt((op1->ui -= value2));
7278 if(!exp->expType)
7279 {
7280 exp->expType = op1->type;
7281 if(op1->type)
7282 op1->type->refCount++;
7283 }
7284 return 0x1;
7285 }
7286
7287 static unsigned int Int64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7288 {
7289 long long value2 = op2->i64;
7290
7291 exp->type = 2;
7292 exp->string = PrintInt64((op1->i64 -= value2));
7293 if(!exp->expType)
7294 {
7295 exp->expType = op1->type;
7296 if(op1->type)
7297 op1->type->refCount++;
7298 }
7299 return 0x1;
7300 }
7301
7302 static unsigned int UInt64SubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7303 {
7304 uint64 value2 = op2->ui64;
7305
7306 exp->type = 2;
7307 exp->string = PrintUInt64((op1->ui64 -= value2));
7308 if(!exp->expType)
7309 {
7310 exp->expType = op1->type;
7311 if(op1->type)
7312 op1->type->refCount++;
7313 }
7314 return 0x1;
7315 }
7316
7317 static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7318 {
7319 short value2 = op2->s;
7320
7321 exp->type = 2;
7322 exp->string = PrintShort((op1->s -= value2));
7323 if(!exp->expType)
7324 {
7325 exp->expType = op1->type;
7326 if(op1->type)
7327 op1->type->refCount++;
7328 }
7329 return 0x1;
7330 }
7331
7332 static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7333 {
7334 unsigned short value2 = op2->us;
7335
7336 exp->type = 2;
7337 exp->string = PrintUShort((op1->us -= value2));
7338 if(!exp->expType)
7339 {
7340 exp->expType = op1->type;
7341 if(op1->type)
7342 op1->type->refCount++;
7343 }
7344 return 0x1;
7345 }
7346
7347 static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7348 {
7349 char value2 = op2->c;
7350
7351 exp->type = 2;
7352 exp->string = PrintChar((op1->c -= value2));
7353 if(!exp->expType)
7354 {
7355 exp->expType = op1->type;
7356 if(op1->type)
7357 op1->type->refCount++;
7358 }
7359 return 0x1;
7360 }
7361
7362 static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7363 {
7364 unsigned char value2 = op2->uc;
7365
7366 exp->type = 2;
7367 exp->string = PrintUChar((op1->uc -= value2));
7368 if(!exp->expType)
7369 {
7370 exp->expType = op1->type;
7371 if(op1->type)
7372 op1->type->refCount++;
7373 }
7374 return 0x1;
7375 }
7376
7377 static unsigned int FloatSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7378 {
7379 float value2 = op2->f;
7380
7381 exp->type = 2;
7382 exp->string = PrintFloat((float)(op1->f -= value2));
7383 if(!exp->expType)
7384 {
7385 exp->expType = op1->type;
7386 if(op1->type)
7387 op1->type->refCount++;
7388 }
7389 return 0x1;
7390 }
7391
7392 static unsigned int DoubleSubAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7393 {
7394 double value2 = op2->d;
7395
7396 exp->type = 2;
7397 exp->string = PrintDouble((double)(op1->d -= value2));
7398 if(!exp->expType)
7399 {
7400 exp->expType = op1->type;
7401 if(op1->type)
7402 op1->type->refCount++;
7403 }
7404 return 0x1;
7405 }
7406
7407 static unsigned int IntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7408 {
7409 int value2 = op2->i;
7410
7411 exp->type = 2;
7412 exp->string = PrintInt((op1->i *= value2));
7413 if(!exp->expType)
7414 {
7415 exp->expType = op1->type;
7416 if(op1->type)
7417 op1->type->refCount++;
7418 }
7419 return 0x1;
7420 }
7421
7422 static unsigned int UIntMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7423 {
7424 unsigned int value2 = op2->ui;
7425
7426 exp->type = 2;
7427 exp->string = PrintUInt((op1->ui *= value2));
7428 if(!exp->expType)
7429 {
7430 exp->expType = op1->type;
7431 if(op1->type)
7432 op1->type->refCount++;
7433 }
7434 return 0x1;
7435 }
7436
7437 static unsigned int Int64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7438 {
7439 long long value2 = op2->i64;
7440
7441 exp->type = 2;
7442 exp->string = PrintInt64((op1->i64 *= value2));
7443 if(!exp->expType)
7444 {
7445 exp->expType = op1->type;
7446 if(op1->type)
7447 op1->type->refCount++;
7448 }
7449 return 0x1;
7450 }
7451
7452 static unsigned int UInt64MulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7453 {
7454 uint64 value2 = op2->ui64;
7455
7456 exp->type = 2;
7457 exp->string = PrintUInt64((op1->ui64 *= value2));
7458 if(!exp->expType)
7459 {
7460 exp->expType = op1->type;
7461 if(op1->type)
7462 op1->type->refCount++;
7463 }
7464 return 0x1;
7465 }
7466
7467 static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7468 {
7469 short value2 = op2->s;
7470
7471 exp->type = 2;
7472 exp->string = PrintShort((op1->s *= value2));
7473 if(!exp->expType)
7474 {
7475 exp->expType = op1->type;
7476 if(op1->type)
7477 op1->type->refCount++;
7478 }
7479 return 0x1;
7480 }
7481
7482 static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7483 {
7484 unsigned short value2 = op2->us;
7485
7486 exp->type = 2;
7487 exp->string = PrintUShort((op1->us *= value2));
7488 if(!exp->expType)
7489 {
7490 exp->expType = op1->type;
7491 if(op1->type)
7492 op1->type->refCount++;
7493 }
7494 return 0x1;
7495 }
7496
7497 static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7498 {
7499 char value2 = op2->c;
7500
7501 exp->type = 2;
7502 exp->string = PrintChar((op1->c *= value2));
7503 if(!exp->expType)
7504 {
7505 exp->expType = op1->type;
7506 if(op1->type)
7507 op1->type->refCount++;
7508 }
7509 return 0x1;
7510 }
7511
7512 static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7513 {
7514 unsigned char value2 = op2->uc;
7515
7516 exp->type = 2;
7517 exp->string = PrintUChar((op1->uc *= value2));
7518 if(!exp->expType)
7519 {
7520 exp->expType = op1->type;
7521 if(op1->type)
7522 op1->type->refCount++;
7523 }
7524 return 0x1;
7525 }
7526
7527 static unsigned int FloatMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7528 {
7529 float value2 = op2->f;
7530
7531 exp->type = 2;
7532 exp->string = PrintFloat((float)(op1->f *= value2));
7533 if(!exp->expType)
7534 {
7535 exp->expType = op1->type;
7536 if(op1->type)
7537 op1->type->refCount++;
7538 }
7539 return 0x1;
7540 }
7541
7542 static unsigned int DoubleMulAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7543 {
7544 double value2 = op2->d;
7545
7546 exp->type = 2;
7547 exp->string = PrintDouble((double)(op1->d *= value2));
7548 if(!exp->expType)
7549 {
7550 exp->expType = op1->type;
7551 if(op1->type)
7552 op1->type->refCount++;
7553 }
7554 return 0x1;
7555 }
7556
7557 static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7558 {
7559 int value2 = op2->i;
7560
7561 exp->type = 2;
7562 exp->string = PrintInt(value2 ? (op1->i /= value2) : 0);
7563 if(!exp->expType)
7564 {
7565 exp->expType = op1->type;
7566 if(op1->type)
7567 op1->type->refCount++;
7568 }
7569 return 0x1;
7570 }
7571
7572 static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7573 {
7574 unsigned int value2 = op2->ui;
7575
7576 exp->type = 2;
7577 exp->string = PrintUInt(value2 ? (op1->ui /= value2) : 0);
7578 if(!exp->expType)
7579 {
7580 exp->expType = op1->type;
7581 if(op1->type)
7582 op1->type->refCount++;
7583 }
7584 return 0x1;
7585 }
7586
7587 static unsigned int Int64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7588 {
7589 long long value2 = op2->i64;
7590
7591 exp->type = 2;
7592 exp->string = PrintInt64(value2 ? (op1->i64 /= value2) : 0);
7593 if(!exp->expType)
7594 {
7595 exp->expType = op1->type;
7596 if(op1->type)
7597 op1->type->refCount++;
7598 }
7599 return 0x1;
7600 }
7601
7602 static unsigned int UInt64DivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7603 {
7604 uint64 value2 = op2->ui64;
7605
7606 exp->type = 2;
7607 exp->string = PrintUInt64(value2 ? (op1->ui64 /= value2) : 0);
7608 if(!exp->expType)
7609 {
7610 exp->expType = op1->type;
7611 if(op1->type)
7612 op1->type->refCount++;
7613 }
7614 return 0x1;
7615 }
7616
7617 static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7618 {
7619 short value2 = op2->s;
7620
7621 exp->type = 2;
7622 exp->string = PrintShort(value2 ? (op1->s /= value2) : (short)0);
7623 if(!exp->expType)
7624 {
7625 exp->expType = op1->type;
7626 if(op1->type)
7627 op1->type->refCount++;
7628 }
7629 return 0x1;
7630 }
7631
7632 static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7633 {
7634 unsigned short value2 = op2->us;
7635
7636 exp->type = 2;
7637 exp->string = PrintUShort(value2 ? (op1->us /= value2) : (unsigned short)0);
7638 if(!exp->expType)
7639 {
7640 exp->expType = op1->type;
7641 if(op1->type)
7642 op1->type->refCount++;
7643 }
7644 return 0x1;
7645 }
7646
7647 static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7648 {
7649 char value2 = op2->c;
7650
7651 exp->type = 2;
7652 exp->string = PrintChar(value2 ? (op1->c /= value2) : (char)0);
7653 if(!exp->expType)
7654 {
7655 exp->expType = op1->type;
7656 if(op1->type)
7657 op1->type->refCount++;
7658 }
7659 return 0x1;
7660 }
7661
7662 static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7663 {
7664 unsigned char value2 = op2->uc;
7665
7666 exp->type = 2;
7667 exp->string = PrintUChar(value2 ? (op1->uc /= value2) : (unsigned char)0);
7668 if(!exp->expType)
7669 {
7670 exp->expType = op1->type;
7671 if(op1->type)
7672 op1->type->refCount++;
7673 }
7674 return 0x1;
7675 }
7676
7677 static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7678 {
7679 float value2 = op2->f;
7680
7681 exp->type = 2;
7682 exp->string = PrintFloat(op1->f /= value2);
7683 if(!exp->expType)
7684 {
7685 exp->expType = op1->type;
7686 if(op1->type)
7687 op1->type->refCount++;
7688 }
7689 return 0x1;
7690 }
7691
7692 static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7693 {
7694 double value2 = op2->d;
7695
7696 exp->type = 2;
7697 exp->string = PrintDouble(op1->d /= value2);
7698 if(!exp->expType)
7699 {
7700 exp->expType = op1->type;
7701 if(op1->type)
7702 op1->type->refCount++;
7703 }
7704 return 0x1;
7705 }
7706
7707 static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7708 {
7709 int value2 = op2->i;
7710
7711 exp->type = 2;
7712 exp->string = PrintInt(value2 ? (op1->i %= value2) : 0);
7713 if(!exp->expType)
7714 {
7715 exp->expType = op1->type;
7716 if(op1->type)
7717 op1->type->refCount++;
7718 }
7719 return 0x1;
7720 }
7721
7722 static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7723 {
7724 unsigned int value2 = op2->ui;
7725
7726 exp->type = 2;
7727 exp->string = PrintUInt(value2 ? (op1->ui %= value2) : 0);
7728 if(!exp->expType)
7729 {
7730 exp->expType = op1->type;
7731 if(op1->type)
7732 op1->type->refCount++;
7733 }
7734 return 0x1;
7735 }
7736
7737 static unsigned int Int64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7738 {
7739 long long value2 = op2->i64;
7740
7741 exp->type = 2;
7742 exp->string = PrintInt64(value2 ? (op1->i64 %= value2) : 0);
7743 if(!exp->expType)
7744 {
7745 exp->expType = op1->type;
7746 if(op1->type)
7747 op1->type->refCount++;
7748 }
7749 return 0x1;
7750 }
7751
7752 static unsigned int UInt64ModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7753 {
7754 uint64 value2 = op2->ui64;
7755
7756 exp->type = 2;
7757 exp->string = PrintUInt64(value2 ? (op1->ui64 %= value2) : 0);
7758 if(!exp->expType)
7759 {
7760 exp->expType = op1->type;
7761 if(op1->type)
7762 op1->type->refCount++;
7763 }
7764 return 0x1;
7765 }
7766
7767 static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7768 {
7769 short value2 = op2->s;
7770
7771 exp->type = 2;
7772 exp->string = PrintShort(value2 ? (op1->s %= value2) : (short)0);
7773 if(!exp->expType)
7774 {
7775 exp->expType = op1->type;
7776 if(op1->type)
7777 op1->type->refCount++;
7778 }
7779 return 0x1;
7780 }
7781
7782 static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7783 {
7784 unsigned short value2 = op2->us;
7785
7786 exp->type = 2;
7787 exp->string = PrintUShort(value2 ? (op1->us %= value2) : (unsigned short)0);
7788 if(!exp->expType)
7789 {
7790 exp->expType = op1->type;
7791 if(op1->type)
7792 op1->type->refCount++;
7793 }
7794 return 0x1;
7795 }
7796
7797 static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7798 {
7799 char value2 = op2->c;
7800
7801 exp->type = 2;
7802 exp->string = PrintChar(value2 ? (op1->c %= value2) : (char)0);
7803 if(!exp->expType)
7804 {
7805 exp->expType = op1->type;
7806 if(op1->type)
7807 op1->type->refCount++;
7808 }
7809 return 0x1;
7810 }
7811
7812 static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7813 {
7814 unsigned char value2 = op2->uc;
7815
7816 exp->type = 2;
7817 exp->string = PrintUChar(value2 ? (op1->uc %= value2) : (unsigned char)0);
7818 if(!exp->expType)
7819 {
7820 exp->expType = op1->type;
7821 if(op1->type)
7822 op1->type->refCount++;
7823 }
7824 return 0x1;
7825 }
7826
7827 static unsigned int IntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7828 {
7829 int value2 = op2->i;
7830
7831 exp->type = 2;
7832 exp->string = PrintInt((op1->i & value2));
7833 if(!exp->expType)
7834 {
7835 exp->expType = op1->type;
7836 if(op1->type)
7837 op1->type->refCount++;
7838 }
7839 return 0x1;
7840 }
7841
7842 static unsigned int UIntBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7843 {
7844 unsigned int value2 = op2->ui;
7845
7846 exp->type = 2;
7847 exp->string = PrintUInt((op1->ui & value2));
7848 if(!exp->expType)
7849 {
7850 exp->expType = op1->type;
7851 if(op1->type)
7852 op1->type->refCount++;
7853 }
7854 return 0x1;
7855 }
7856
7857 static unsigned int Int64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7858 {
7859 long long value2 = op2->i64;
7860
7861 exp->type = 2;
7862 exp->string = PrintInt64((op1->i64 & value2));
7863 if(!exp->expType)
7864 {
7865 exp->expType = op1->type;
7866 if(op1->type)
7867 op1->type->refCount++;
7868 }
7869 return 0x1;
7870 }
7871
7872 static unsigned int UInt64BitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7873 {
7874 uint64 value2 = op2->ui64;
7875
7876 exp->type = 2;
7877 exp->string = PrintUInt64((op1->ui64 & value2));
7878 if(!exp->expType)
7879 {
7880 exp->expType = op1->type;
7881 if(op1->type)
7882 op1->type->refCount++;
7883 }
7884 return 0x1;
7885 }
7886
7887 static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7888 {
7889 short value2 = op2->s;
7890
7891 exp->type = 2;
7892 exp->string = PrintShort((op1->s & value2));
7893 if(!exp->expType)
7894 {
7895 exp->expType = op1->type;
7896 if(op1->type)
7897 op1->type->refCount++;
7898 }
7899 return 0x1;
7900 }
7901
7902 static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7903 {
7904 unsigned short value2 = op2->us;
7905
7906 exp->type = 2;
7907 exp->string = PrintUShort((op1->us & value2));
7908 if(!exp->expType)
7909 {
7910 exp->expType = op1->type;
7911 if(op1->type)
7912 op1->type->refCount++;
7913 }
7914 return 0x1;
7915 }
7916
7917 static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7918 {
7919 char value2 = op2->c;
7920
7921 exp->type = 2;
7922 exp->string = PrintChar((op1->c & value2));
7923 if(!exp->expType)
7924 {
7925 exp->expType = op1->type;
7926 if(op1->type)
7927 op1->type->refCount++;
7928 }
7929 return 0x1;
7930 }
7931
7932 static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7933 {
7934 unsigned char value2 = op2->uc;
7935
7936 exp->type = 2;
7937 exp->string = PrintUChar((op1->uc & value2));
7938 if(!exp->expType)
7939 {
7940 exp->expType = op1->type;
7941 if(op1->type)
7942 op1->type->refCount++;
7943 }
7944 return 0x1;
7945 }
7946
7947 static unsigned int IntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7948 {
7949 int value2 = op2->i;
7950
7951 exp->type = 2;
7952 exp->string = PrintInt((op1->i | value2));
7953 if(!exp->expType)
7954 {
7955 exp->expType = op1->type;
7956 if(op1->type)
7957 op1->type->refCount++;
7958 }
7959 return 0x1;
7960 }
7961
7962 static unsigned int UIntBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7963 {
7964 unsigned int value2 = op2->ui;
7965
7966 exp->type = 2;
7967 exp->string = PrintUInt((op1->ui | value2));
7968 if(!exp->expType)
7969 {
7970 exp->expType = op1->type;
7971 if(op1->type)
7972 op1->type->refCount++;
7973 }
7974 return 0x1;
7975 }
7976
7977 static unsigned int Int64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7978 {
7979 long long value2 = op2->i64;
7980
7981 exp->type = 2;
7982 exp->string = PrintInt64((op1->i64 | value2));
7983 if(!exp->expType)
7984 {
7985 exp->expType = op1->type;
7986 if(op1->type)
7987 op1->type->refCount++;
7988 }
7989 return 0x1;
7990 }
7991
7992 static unsigned int UInt64BitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
7993 {
7994 uint64 value2 = op2->ui64;
7995
7996 exp->type = 2;
7997 exp->string = PrintUInt64((op1->ui64 | value2));
7998 if(!exp->expType)
7999 {
8000 exp->expType = op1->type;
8001 if(op1->type)
8002 op1->type->refCount++;
8003 }
8004 return 0x1;
8005 }
8006
8007 static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8008 {
8009 short value2 = op2->s;
8010
8011 exp->type = 2;
8012 exp->string = PrintShort((op1->s | value2));
8013 if(!exp->expType)
8014 {
8015 exp->expType = op1->type;
8016 if(op1->type)
8017 op1->type->refCount++;
8018 }
8019 return 0x1;
8020 }
8021
8022 static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8023 {
8024 unsigned short value2 = op2->us;
8025
8026 exp->type = 2;
8027 exp->string = PrintUShort((op1->us | value2));
8028 if(!exp->expType)
8029 {
8030 exp->expType = op1->type;
8031 if(op1->type)
8032 op1->type->refCount++;
8033 }
8034 return 0x1;
8035 }
8036
8037 static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8038 {
8039 char value2 = op2->c;
8040
8041 exp->type = 2;
8042 exp->string = PrintChar((op1->c | value2));
8043 if(!exp->expType)
8044 {
8045 exp->expType = op1->type;
8046 if(op1->type)
8047 op1->type->refCount++;
8048 }
8049 return 0x1;
8050 }
8051
8052 static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8053 {
8054 unsigned char value2 = op2->uc;
8055
8056 exp->type = 2;
8057 exp->string = PrintUChar((op1->uc | value2));
8058 if(!exp->expType)
8059 {
8060 exp->expType = op1->type;
8061 if(op1->type)
8062 op1->type->refCount++;
8063 }
8064 return 0x1;
8065 }
8066
8067 static unsigned int IntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8068 {
8069 int value2 = op2->i;
8070
8071 exp->type = 2;
8072 exp->string = PrintInt((op1->i ^ value2));
8073 if(!exp->expType)
8074 {
8075 exp->expType = op1->type;
8076 if(op1->type)
8077 op1->type->refCount++;
8078 }
8079 return 0x1;
8080 }
8081
8082 static unsigned int UIntBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8083 {
8084 unsigned int value2 = op2->ui;
8085
8086 exp->type = 2;
8087 exp->string = PrintUInt((op1->ui ^ value2));
8088 if(!exp->expType)
8089 {
8090 exp->expType = op1->type;
8091 if(op1->type)
8092 op1->type->refCount++;
8093 }
8094 return 0x1;
8095 }
8096
8097 static unsigned int Int64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8098 {
8099 long long value2 = op2->i64;
8100
8101 exp->type = 2;
8102 exp->string = PrintInt64((op1->i64 ^ value2));
8103 if(!exp->expType)
8104 {
8105 exp->expType = op1->type;
8106 if(op1->type)
8107 op1->type->refCount++;
8108 }
8109 return 0x1;
8110 }
8111
8112 static unsigned int UInt64BitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8113 {
8114 uint64 value2 = op2->ui64;
8115
8116 exp->type = 2;
8117 exp->string = PrintUInt64((op1->ui64 ^ value2));
8118 if(!exp->expType)
8119 {
8120 exp->expType = op1->type;
8121 if(op1->type)
8122 op1->type->refCount++;
8123 }
8124 return 0x1;
8125 }
8126
8127 static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8128 {
8129 short value2 = op2->s;
8130
8131 exp->type = 2;
8132 exp->string = PrintShort((op1->s ^ value2));
8133 if(!exp->expType)
8134 {
8135 exp->expType = op1->type;
8136 if(op1->type)
8137 op1->type->refCount++;
8138 }
8139 return 0x1;
8140 }
8141
8142 static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8143 {
8144 unsigned short value2 = op2->us;
8145
8146 exp->type = 2;
8147 exp->string = PrintUShort((op1->us ^ value2));
8148 if(!exp->expType)
8149 {
8150 exp->expType = op1->type;
8151 if(op1->type)
8152 op1->type->refCount++;
8153 }
8154 return 0x1;
8155 }
8156
8157 static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8158 {
8159 char value2 = op2->c;
8160
8161 exp->type = 2;
8162 exp->string = PrintChar((op1->c ^ value2));
8163 if(!exp->expType)
8164 {
8165 exp->expType = op1->type;
8166 if(op1->type)
8167 op1->type->refCount++;
8168 }
8169 return 0x1;
8170 }
8171
8172 static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8173 {
8174 unsigned char value2 = op2->uc;
8175
8176 exp->type = 2;
8177 exp->string = PrintUChar((op1->uc ^ value2));
8178 if(!exp->expType)
8179 {
8180 exp->expType = op1->type;
8181 if(op1->type)
8182 op1->type->refCount++;
8183 }
8184 return 0x1;
8185 }
8186
8187 static unsigned int IntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8188 {
8189 int value2 = op2->i;
8190
8191 exp->type = 2;
8192 exp->string = PrintInt((op1->i << value2));
8193 if(!exp->expType)
8194 {
8195 exp->expType = op1->type;
8196 if(op1->type)
8197 op1->type->refCount++;
8198 }
8199 return 0x1;
8200 }
8201
8202 static unsigned int UIntLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8203 {
8204 unsigned int value2 = op2->ui;
8205
8206 exp->type = 2;
8207 exp->string = PrintUInt((op1->ui << value2));
8208 if(!exp->expType)
8209 {
8210 exp->expType = op1->type;
8211 if(op1->type)
8212 op1->type->refCount++;
8213 }
8214 return 0x1;
8215 }
8216
8217 static unsigned int Int64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8218 {
8219 long long value2 = op2->i64;
8220
8221 exp->type = 2;
8222 exp->string = PrintInt64((op1->i64 << value2));
8223 if(!exp->expType)
8224 {
8225 exp->expType = op1->type;
8226 if(op1->type)
8227 op1->type->refCount++;
8228 }
8229 return 0x1;
8230 }
8231
8232 static unsigned int UInt64LShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8233 {
8234 uint64 value2 = op2->ui64;
8235
8236 exp->type = 2;
8237 exp->string = PrintUInt64((op1->ui64 << value2));
8238 if(!exp->expType)
8239 {
8240 exp->expType = op1->type;
8241 if(op1->type)
8242 op1->type->refCount++;
8243 }
8244 return 0x1;
8245 }
8246
8247 static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8248 {
8249 short value2 = op2->s;
8250
8251 exp->type = 2;
8252 exp->string = PrintShort((op1->s << value2));
8253 if(!exp->expType)
8254 {
8255 exp->expType = op1->type;
8256 if(op1->type)
8257 op1->type->refCount++;
8258 }
8259 return 0x1;
8260 }
8261
8262 static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8263 {
8264 unsigned short value2 = op2->us;
8265
8266 exp->type = 2;
8267 exp->string = PrintUShort((op1->us << value2));
8268 if(!exp->expType)
8269 {
8270 exp->expType = op1->type;
8271 if(op1->type)
8272 op1->type->refCount++;
8273 }
8274 return 0x1;
8275 }
8276
8277 static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8278 {
8279 char value2 = op2->c;
8280
8281 exp->type = 2;
8282 exp->string = PrintChar((op1->c << value2));
8283 if(!exp->expType)
8284 {
8285 exp->expType = op1->type;
8286 if(op1->type)
8287 op1->type->refCount++;
8288 }
8289 return 0x1;
8290 }
8291
8292 static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8293 {
8294 unsigned char value2 = op2->uc;
8295
8296 exp->type = 2;
8297 exp->string = PrintUChar((op1->uc << value2));
8298 if(!exp->expType)
8299 {
8300 exp->expType = op1->type;
8301 if(op1->type)
8302 op1->type->refCount++;
8303 }
8304 return 0x1;
8305 }
8306
8307 static unsigned int IntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8308 {
8309 int value2 = op2->i;
8310
8311 exp->type = 2;
8312 exp->string = PrintInt((op1->i >> value2));
8313 if(!exp->expType)
8314 {
8315 exp->expType = op1->type;
8316 if(op1->type)
8317 op1->type->refCount++;
8318 }
8319 return 0x1;
8320 }
8321
8322 static unsigned int UIntRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8323 {
8324 unsigned int value2 = op2->ui;
8325
8326 exp->type = 2;
8327 exp->string = PrintUInt((op1->ui >> value2));
8328 if(!exp->expType)
8329 {
8330 exp->expType = op1->type;
8331 if(op1->type)
8332 op1->type->refCount++;
8333 }
8334 return 0x1;
8335 }
8336
8337 static unsigned int Int64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8338 {
8339 long long value2 = op2->i64;
8340
8341 exp->type = 2;
8342 exp->string = PrintInt64((op1->i64 >> value2));
8343 if(!exp->expType)
8344 {
8345 exp->expType = op1->type;
8346 if(op1->type)
8347 op1->type->refCount++;
8348 }
8349 return 0x1;
8350 }
8351
8352 static unsigned int UInt64RShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8353 {
8354 uint64 value2 = op2->ui64;
8355
8356 exp->type = 2;
8357 exp->string = PrintUInt64((op1->ui64 >> value2));
8358 if(!exp->expType)
8359 {
8360 exp->expType = op1->type;
8361 if(op1->type)
8362 op1->type->refCount++;
8363 }
8364 return 0x1;
8365 }
8366
8367 static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8368 {
8369 short value2 = op2->s;
8370
8371 exp->type = 2;
8372 exp->string = PrintShort((op1->s >> value2));
8373 if(!exp->expType)
8374 {
8375 exp->expType = op1->type;
8376 if(op1->type)
8377 op1->type->refCount++;
8378 }
8379 return 0x1;
8380 }
8381
8382 static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8383 {
8384 unsigned short value2 = op2->us;
8385
8386 exp->type = 2;
8387 exp->string = PrintUShort((op1->us >> value2));
8388 if(!exp->expType)
8389 {
8390 exp->expType = op1->type;
8391 if(op1->type)
8392 op1->type->refCount++;
8393 }
8394 return 0x1;
8395 }
8396
8397 static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8398 {
8399 char value2 = op2->c;
8400
8401 exp->type = 2;
8402 exp->string = PrintChar((op1->c >> value2));
8403 if(!exp->expType)
8404 {
8405 exp->expType = op1->type;
8406 if(op1->type)
8407 op1->type->refCount++;
8408 }
8409 return 0x1;
8410 }
8411
8412 static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8413 {
8414 unsigned char value2 = op2->uc;
8415
8416 exp->type = 2;
8417 exp->string = PrintUChar((op1->uc >> value2));
8418 if(!exp->expType)
8419 {
8420 exp->expType = op1->type;
8421 if(op1->type)
8422 op1->type->refCount++;
8423 }
8424 return 0x1;
8425 }
8426
8427 static unsigned int IntBitNot(struct Expression * exp, struct Operand * op1)
8428 {
8429 exp->type = 2;
8430 exp->string = PrintInt((~op1->i));
8431 if(!exp->expType)
8432 {
8433 exp->expType = op1->type;
8434 if(op1->type)
8435 op1->type->refCount++;
8436 }
8437 return 0x1;
8438 }
8439
8440 static unsigned int UIntBitNot(struct Expression * exp, struct Operand * op1)
8441 {
8442 exp->type = 2;
8443 exp->string = PrintUInt((unsigned int)(~op1->ui));
8444 if(!exp->expType)
8445 {
8446 exp->expType = op1->type;
8447 if(op1->type)
8448 op1->type->refCount++;
8449 }
8450 return 0x1;
8451 }
8452
8453 static unsigned int Int64BitNot(struct Expression * exp, struct Operand * op1)
8454 {
8455 exp->type = 2;
8456 exp->string = PrintInt64((long long)(~op1->i64));
8457 if(!exp->expType)
8458 {
8459 exp->expType = op1->type;
8460 if(op1->type)
8461 op1->type->refCount++;
8462 }
8463 return 0x1;
8464 }
8465
8466 static unsigned int UInt64BitNot(struct Expression * exp, struct Operand * op1)
8467 {
8468 exp->type = 2;
8469 exp->string = PrintUInt64((uint64)(~op1->ui64));
8470 if(!exp->expType)
8471 {
8472 exp->expType = op1->type;
8473 if(op1->type)
8474 op1->type->refCount++;
8475 }
8476 return 0x1;
8477 }
8478
8479 static unsigned int ShortBitNot(struct Expression * exp, struct Operand * op1)
8480 {
8481 exp->type = 2;
8482 exp->string = PrintShort((short)(~op1->s));
8483 if(!exp->expType)
8484 {
8485 exp->expType = op1->type;
8486 if(op1->type)
8487 op1->type->refCount++;
8488 }
8489 return 0x1;
8490 }
8491
8492 static unsigned int UShortBitNot(struct Expression * exp, struct Operand * op1)
8493 {
8494 exp->type = 2;
8495 exp->string = PrintUShort((unsigned short)(~op1->us));
8496 if(!exp->expType)
8497 {
8498 exp->expType = op1->type;
8499 if(op1->type)
8500 op1->type->refCount++;
8501 }
8502 return 0x1;
8503 }
8504
8505 static unsigned int CharBitNot(struct Expression * exp, struct Operand * op1)
8506 {
8507 exp->type = 2;
8508 exp->string = PrintChar((char)(~op1->c));
8509 if(!exp->expType)
8510 {
8511 exp->expType = op1->type;
8512 if(op1->type)
8513 op1->type->refCount++;
8514 }
8515 return 0x1;
8516 }
8517
8518 static unsigned int UCharBitNot(struct Expression * exp, struct Operand * op1)
8519 {
8520 exp->type = 2;
8521 exp->string = PrintUChar((unsigned char)(~op1->uc));
8522 if(!exp->expType)
8523 {
8524 exp->expType = op1->type;
8525 if(op1->type)
8526 op1->type->refCount++;
8527 }
8528 return 0x1;
8529 }
8530
8531 static unsigned int IntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8532 {
8533 int value2 = op2->i;
8534
8535 exp->type = 2;
8536 exp->string = PrintInt((op1->i &= value2));
8537 if(!exp->expType)
8538 {
8539 exp->expType = op1->type;
8540 if(op1->type)
8541 op1->type->refCount++;
8542 }
8543 return 0x1;
8544 }
8545
8546 static unsigned int UIntAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8547 {
8548 unsigned int value2 = op2->ui;
8549
8550 exp->type = 2;
8551 exp->string = PrintUInt((op1->ui &= value2));
8552 if(!exp->expType)
8553 {
8554 exp->expType = op1->type;
8555 if(op1->type)
8556 op1->type->refCount++;
8557 }
8558 return 0x1;
8559 }
8560
8561 static unsigned int Int64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8562 {
8563 long long value2 = op2->i64;
8564
8565 exp->type = 2;
8566 exp->string = PrintInt64((op1->i64 &= value2));
8567 if(!exp->expType)
8568 {
8569 exp->expType = op1->type;
8570 if(op1->type)
8571 op1->type->refCount++;
8572 }
8573 return 0x1;
8574 }
8575
8576 static unsigned int UInt64AndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8577 {
8578 uint64 value2 = op2->ui64;
8579
8580 exp->type = 2;
8581 exp->string = PrintUInt64((op1->ui64 &= value2));
8582 if(!exp->expType)
8583 {
8584 exp->expType = op1->type;
8585 if(op1->type)
8586 op1->type->refCount++;
8587 }
8588 return 0x1;
8589 }
8590
8591 static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8592 {
8593 short value2 = op2->s;
8594
8595 exp->type = 2;
8596 exp->string = PrintShort((op1->s &= value2));
8597 if(!exp->expType)
8598 {
8599 exp->expType = op1->type;
8600 if(op1->type)
8601 op1->type->refCount++;
8602 }
8603 return 0x1;
8604 }
8605
8606 static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8607 {
8608 unsigned short value2 = op2->us;
8609
8610 exp->type = 2;
8611 exp->string = PrintUShort((op1->us &= value2));
8612 if(!exp->expType)
8613 {
8614 exp->expType = op1->type;
8615 if(op1->type)
8616 op1->type->refCount++;
8617 }
8618 return 0x1;
8619 }
8620
8621 static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8622 {
8623 char value2 = op2->c;
8624
8625 exp->type = 2;
8626 exp->string = PrintChar((op1->c &= value2));
8627 if(!exp->expType)
8628 {
8629 exp->expType = op1->type;
8630 if(op1->type)
8631 op1->type->refCount++;
8632 }
8633 return 0x1;
8634 }
8635
8636 static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8637 {
8638 unsigned char value2 = op2->uc;
8639
8640 exp->type = 2;
8641 exp->string = PrintUChar((op1->uc &= value2));
8642 if(!exp->expType)
8643 {
8644 exp->expType = op1->type;
8645 if(op1->type)
8646 op1->type->refCount++;
8647 }
8648 return 0x1;
8649 }
8650
8651 static unsigned int IntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8652 {
8653 int value2 = op2->i;
8654
8655 exp->type = 2;
8656 exp->string = PrintInt((op1->i |= value2));
8657 if(!exp->expType)
8658 {
8659 exp->expType = op1->type;
8660 if(op1->type)
8661 op1->type->refCount++;
8662 }
8663 return 0x1;
8664 }
8665
8666 static unsigned int UIntOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8667 {
8668 unsigned int value2 = op2->ui;
8669
8670 exp->type = 2;
8671 exp->string = PrintUInt((op1->ui |= value2));
8672 if(!exp->expType)
8673 {
8674 exp->expType = op1->type;
8675 if(op1->type)
8676 op1->type->refCount++;
8677 }
8678 return 0x1;
8679 }
8680
8681 static unsigned int Int64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8682 {
8683 long long value2 = op2->i64;
8684
8685 exp->type = 2;
8686 exp->string = PrintInt64((op1->i64 |= value2));
8687 if(!exp->expType)
8688 {
8689 exp->expType = op1->type;
8690 if(op1->type)
8691 op1->type->refCount++;
8692 }
8693 return 0x1;
8694 }
8695
8696 static unsigned int UInt64OrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8697 {
8698 uint64 value2 = op2->ui64;
8699
8700 exp->type = 2;
8701 exp->string = PrintUInt64((op1->ui64 |= value2));
8702 if(!exp->expType)
8703 {
8704 exp->expType = op1->type;
8705 if(op1->type)
8706 op1->type->refCount++;
8707 }
8708 return 0x1;
8709 }
8710
8711 static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8712 {
8713 short value2 = op2->s;
8714
8715 exp->type = 2;
8716 exp->string = PrintShort((op1->s |= value2));
8717 if(!exp->expType)
8718 {
8719 exp->expType = op1->type;
8720 if(op1->type)
8721 op1->type->refCount++;
8722 }
8723 return 0x1;
8724 }
8725
8726 static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8727 {
8728 unsigned short value2 = op2->us;
8729
8730 exp->type = 2;
8731 exp->string = PrintUShort((op1->us |= value2));
8732 if(!exp->expType)
8733 {
8734 exp->expType = op1->type;
8735 if(op1->type)
8736 op1->type->refCount++;
8737 }
8738 return 0x1;
8739 }
8740
8741 static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8742 {
8743 char value2 = op2->c;
8744
8745 exp->type = 2;
8746 exp->string = PrintChar((op1->c |= value2));
8747 if(!exp->expType)
8748 {
8749 exp->expType = op1->type;
8750 if(op1->type)
8751 op1->type->refCount++;
8752 }
8753 return 0x1;
8754 }
8755
8756 static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8757 {
8758 unsigned char value2 = op2->uc;
8759
8760 exp->type = 2;
8761 exp->string = PrintUChar((op1->uc |= value2));
8762 if(!exp->expType)
8763 {
8764 exp->expType = op1->type;
8765 if(op1->type)
8766 op1->type->refCount++;
8767 }
8768 return 0x1;
8769 }
8770
8771 static unsigned int IntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8772 {
8773 int value2 = op2->i;
8774
8775 exp->type = 2;
8776 exp->string = PrintInt((op1->i ^= value2));
8777 if(!exp->expType)
8778 {
8779 exp->expType = op1->type;
8780 if(op1->type)
8781 op1->type->refCount++;
8782 }
8783 return 0x1;
8784 }
8785
8786 static unsigned int UIntXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8787 {
8788 unsigned int value2 = op2->ui;
8789
8790 exp->type = 2;
8791 exp->string = PrintUInt((op1->ui ^= value2));
8792 if(!exp->expType)
8793 {
8794 exp->expType = op1->type;
8795 if(op1->type)
8796 op1->type->refCount++;
8797 }
8798 return 0x1;
8799 }
8800
8801 static unsigned int Int64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8802 {
8803 long long value2 = op2->i64;
8804
8805 exp->type = 2;
8806 exp->string = PrintInt64((op1->i64 ^= value2));
8807 if(!exp->expType)
8808 {
8809 exp->expType = op1->type;
8810 if(op1->type)
8811 op1->type->refCount++;
8812 }
8813 return 0x1;
8814 }
8815
8816 static unsigned int UInt64XorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8817 {
8818 uint64 value2 = op2->ui64;
8819
8820 exp->type = 2;
8821 exp->string = PrintUInt64((op1->ui64 ^= value2));
8822 if(!exp->expType)
8823 {
8824 exp->expType = op1->type;
8825 if(op1->type)
8826 op1->type->refCount++;
8827 }
8828 return 0x1;
8829 }
8830
8831 static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8832 {
8833 short value2 = op2->s;
8834
8835 exp->type = 2;
8836 exp->string = PrintShort((op1->s ^= value2));
8837 if(!exp->expType)
8838 {
8839 exp->expType = op1->type;
8840 if(op1->type)
8841 op1->type->refCount++;
8842 }
8843 return 0x1;
8844 }
8845
8846 static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8847 {
8848 unsigned short value2 = op2->us;
8849
8850 exp->type = 2;
8851 exp->string = PrintUShort((op1->us ^= value2));
8852 if(!exp->expType)
8853 {
8854 exp->expType = op1->type;
8855 if(op1->type)
8856 op1->type->refCount++;
8857 }
8858 return 0x1;
8859 }
8860
8861 static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8862 {
8863 char value2 = op2->c;
8864
8865 exp->type = 2;
8866 exp->string = PrintChar((op1->c ^= value2));
8867 if(!exp->expType)
8868 {
8869 exp->expType = op1->type;
8870 if(op1->type)
8871 op1->type->refCount++;
8872 }
8873 return 0x1;
8874 }
8875
8876 static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8877 {
8878 unsigned char value2 = op2->uc;
8879
8880 exp->type = 2;
8881 exp->string = PrintUChar((op1->uc ^= value2));
8882 if(!exp->expType)
8883 {
8884 exp->expType = op1->type;
8885 if(op1->type)
8886 op1->type->refCount++;
8887 }
8888 return 0x1;
8889 }
8890
8891 static unsigned int IntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8892 {
8893 int value2 = op2->i;
8894
8895 exp->type = 2;
8896 exp->string = PrintInt((op1->i <<= value2));
8897 if(!exp->expType)
8898 {
8899 exp->expType = op1->type;
8900 if(op1->type)
8901 op1->type->refCount++;
8902 }
8903 return 0x1;
8904 }
8905
8906 static unsigned int UIntLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8907 {
8908 unsigned int value2 = op2->ui;
8909
8910 exp->type = 2;
8911 exp->string = PrintUInt((op1->ui <<= value2));
8912 if(!exp->expType)
8913 {
8914 exp->expType = op1->type;
8915 if(op1->type)
8916 op1->type->refCount++;
8917 }
8918 return 0x1;
8919 }
8920
8921 static unsigned int Int64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8922 {
8923 long long value2 = op2->i64;
8924
8925 exp->type = 2;
8926 exp->string = PrintInt64((op1->i64 <<= value2));
8927 if(!exp->expType)
8928 {
8929 exp->expType = op1->type;
8930 if(op1->type)
8931 op1->type->refCount++;
8932 }
8933 return 0x1;
8934 }
8935
8936 static unsigned int UInt64LShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8937 {
8938 uint64 value2 = op2->ui64;
8939
8940 exp->type = 2;
8941 exp->string = PrintUInt64((op1->ui64 <<= value2));
8942 if(!exp->expType)
8943 {
8944 exp->expType = op1->type;
8945 if(op1->type)
8946 op1->type->refCount++;
8947 }
8948 return 0x1;
8949 }
8950
8951 static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8952 {
8953 short value2 = op2->s;
8954
8955 exp->type = 2;
8956 exp->string = PrintShort((op1->s <<= value2));
8957 if(!exp->expType)
8958 {
8959 exp->expType = op1->type;
8960 if(op1->type)
8961 op1->type->refCount++;
8962 }
8963 return 0x1;
8964 }
8965
8966 static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8967 {
8968 unsigned short value2 = op2->us;
8969
8970 exp->type = 2;
8971 exp->string = PrintUShort((op1->us <<= value2));
8972 if(!exp->expType)
8973 {
8974 exp->expType = op1->type;
8975 if(op1->type)
8976 op1->type->refCount++;
8977 }
8978 return 0x1;
8979 }
8980
8981 static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8982 {
8983 char value2 = op2->c;
8984
8985 exp->type = 2;
8986 exp->string = PrintChar((op1->c <<= value2));
8987 if(!exp->expType)
8988 {
8989 exp->expType = op1->type;
8990 if(op1->type)
8991 op1->type->refCount++;
8992 }
8993 return 0x1;
8994 }
8995
8996 static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
8997 {
8998 unsigned char value2 = op2->uc;
8999
9000 exp->type = 2;
9001 exp->string = PrintUChar((op1->uc <<= value2));
9002 if(!exp->expType)
9003 {
9004 exp->expType = op1->type;
9005 if(op1->type)
9006 op1->type->refCount++;
9007 }
9008 return 0x1;
9009 }
9010
9011 static unsigned int IntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9012 {
9013 int value2 = op2->i;
9014
9015 exp->type = 2;
9016 exp->string = PrintInt((op1->i >>= value2));
9017 if(!exp->expType)
9018 {
9019 exp->expType = op1->type;
9020 if(op1->type)
9021 op1->type->refCount++;
9022 }
9023 return 0x1;
9024 }
9025
9026 static unsigned int UIntRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9027 {
9028 unsigned int value2 = op2->ui;
9029
9030 exp->type = 2;
9031 exp->string = PrintUInt((op1->ui >>= value2));
9032 if(!exp->expType)
9033 {
9034 exp->expType = op1->type;
9035 if(op1->type)
9036 op1->type->refCount++;
9037 }
9038 return 0x1;
9039 }
9040
9041 static unsigned int Int64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9042 {
9043 long long value2 = op2->i64;
9044
9045 exp->type = 2;
9046 exp->string = PrintInt64((op1->i64 >>= value2));
9047 if(!exp->expType)
9048 {
9049 exp->expType = op1->type;
9050 if(op1->type)
9051 op1->type->refCount++;
9052 }
9053 return 0x1;
9054 }
9055
9056 static unsigned int UInt64RShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9057 {
9058 uint64 value2 = op2->ui64;
9059
9060 exp->type = 2;
9061 exp->string = PrintUInt64((op1->ui64 >>= value2));
9062 if(!exp->expType)
9063 {
9064 exp->expType = op1->type;
9065 if(op1->type)
9066 op1->type->refCount++;
9067 }
9068 return 0x1;
9069 }
9070
9071 static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9072 {
9073 short value2 = op2->s;
9074
9075 exp->type = 2;
9076 exp->string = PrintShort((op1->s >>= value2));
9077 if(!exp->expType)
9078 {
9079 exp->expType = op1->type;
9080 if(op1->type)
9081 op1->type->refCount++;
9082 }
9083 return 0x1;
9084 }
9085
9086 static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9087 {
9088 unsigned short value2 = op2->us;
9089
9090 exp->type = 2;
9091 exp->string = PrintUShort((op1->us >>= value2));
9092 if(!exp->expType)
9093 {
9094 exp->expType = op1->type;
9095 if(op1->type)
9096 op1->type->refCount++;
9097 }
9098 return 0x1;
9099 }
9100
9101 static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9102 {
9103 char value2 = op2->c;
9104
9105 exp->type = 2;
9106 exp->string = PrintChar((op1->c >>= value2));
9107 if(!exp->expType)
9108 {
9109 exp->expType = op1->type;
9110 if(op1->type)
9111 op1->type->refCount++;
9112 }
9113 return 0x1;
9114 }
9115
9116 static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9117 {
9118 unsigned char value2 = op2->uc;
9119
9120 exp->type = 2;
9121 exp->string = PrintUChar((op1->uc >>= value2));
9122 if(!exp->expType)
9123 {
9124 exp->expType = op1->type;
9125 if(op1->type)
9126 op1->type->refCount++;
9127 }
9128 return 0x1;
9129 }
9130
9131 static unsigned int IntNot(struct Expression * exp, struct Operand * op1)
9132 {
9133 exp->type = 2;
9134 exp->string = PrintInt((int)(!op1->i));
9135 if(!exp->expType)
9136 {
9137 exp->expType = op1->type;
9138 if(op1->type)
9139 op1->type->refCount++;
9140 }
9141 return 0x1;
9142 }
9143
9144 static unsigned int UIntNot(struct Expression * exp, struct Operand * op1)
9145 {
9146 exp->type = 2;
9147 exp->string = PrintUInt((unsigned int)(!op1->ui));
9148 if(!exp->expType)
9149 {
9150 exp->expType = op1->type;
9151 if(op1->type)
9152 op1->type->refCount++;
9153 }
9154 return 0x1;
9155 }
9156
9157 static unsigned int Int64Not(struct Expression * exp, struct Operand * op1)
9158 {
9159 exp->type = 2;
9160 exp->string = PrintInt64((long long)(!op1->i64));
9161 if(!exp->expType)
9162 {
9163 exp->expType = op1->type;
9164 if(op1->type)
9165 op1->type->refCount++;
9166 }
9167 return 0x1;
9168 }
9169
9170 static unsigned int UInt64Not(struct Expression * exp, struct Operand * op1)
9171 {
9172 exp->type = 2;
9173 exp->string = PrintUInt64((uint64)(!op1->ui64));
9174 if(!exp->expType)
9175 {
9176 exp->expType = op1->type;
9177 if(op1->type)
9178 op1->type->refCount++;
9179 }
9180 return 0x1;
9181 }
9182
9183 static unsigned int ShortNot(struct Expression * exp, struct Operand * op1)
9184 {
9185 exp->type = 2;
9186 exp->string = PrintShort((short)(!op1->s));
9187 if(!exp->expType)
9188 {
9189 exp->expType = op1->type;
9190 if(op1->type)
9191 op1->type->refCount++;
9192 }
9193 return 0x1;
9194 }
9195
9196 static unsigned int UShortNot(struct Expression * exp, struct Operand * op1)
9197 {
9198 exp->type = 2;
9199 exp->string = PrintUShort((unsigned short)(!op1->us));
9200 if(!exp->expType)
9201 {
9202 exp->expType = op1->type;
9203 if(op1->type)
9204 op1->type->refCount++;
9205 }
9206 return 0x1;
9207 }
9208
9209 static unsigned int CharNot(struct Expression * exp, struct Operand * op1)
9210 {
9211 exp->type = 2;
9212 exp->string = PrintChar((char)(!op1->c));
9213 if(!exp->expType)
9214 {
9215 exp->expType = op1->type;
9216 if(op1->type)
9217 op1->type->refCount++;
9218 }
9219 return 0x1;
9220 }
9221
9222 static unsigned int UCharNot(struct Expression * exp, struct Operand * op1)
9223 {
9224 exp->type = 2;
9225 exp->string = PrintUChar((unsigned char)(!op1->uc));
9226 if(!exp->expType)
9227 {
9228 exp->expType = op1->type;
9229 if(op1->type)
9230 op1->type->refCount++;
9231 }
9232 return 0x1;
9233 }
9234
9235 static unsigned int IntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9236 {
9237 int value2 = op2->i;
9238
9239 exp->type = 2;
9240 exp->string = PrintInt((int)(op1->i == value2));
9241 if(!exp->expType)
9242 {
9243 exp->expType = op1->type;
9244 if(op1->type)
9245 op1->type->refCount++;
9246 }
9247 return 0x1;
9248 }
9249
9250 static unsigned int UIntEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9251 {
9252 unsigned int value2 = op2->ui;
9253
9254 exp->type = 2;
9255 exp->string = PrintUInt((unsigned int)(op1->ui == value2));
9256 if(!exp->expType)
9257 {
9258 exp->expType = op1->type;
9259 if(op1->type)
9260 op1->type->refCount++;
9261 }
9262 return 0x1;
9263 }
9264
9265 static unsigned int Int64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9266 {
9267 long long value2 = op2->i64;
9268
9269 exp->type = 2;
9270 exp->string = PrintInt64((long long)(op1->i64 == value2));
9271 if(!exp->expType)
9272 {
9273 exp->expType = op1->type;
9274 if(op1->type)
9275 op1->type->refCount++;
9276 }
9277 return 0x1;
9278 }
9279
9280 static unsigned int UInt64Equ(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9281 {
9282 uint64 value2 = op2->ui64;
9283
9284 exp->type = 2;
9285 exp->string = PrintUInt64((uint64)(op1->ui64 == value2));
9286 if(!exp->expType)
9287 {
9288 exp->expType = op1->type;
9289 if(op1->type)
9290 op1->type->refCount++;
9291 }
9292 return 0x1;
9293 }
9294
9295 static unsigned int ShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9296 {
9297 short value2 = op2->s;
9298
9299 exp->type = 2;
9300 exp->string = PrintShort((short)(op1->s == value2));
9301 if(!exp->expType)
9302 {
9303 exp->expType = op1->type;
9304 if(op1->type)
9305 op1->type->refCount++;
9306 }
9307 return 0x1;
9308 }
9309
9310 static unsigned int UShortEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9311 {
9312 unsigned short value2 = op2->us;
9313
9314 exp->type = 2;
9315 exp->string = PrintUShort((unsigned short)(op1->us == value2));
9316 if(!exp->expType)
9317 {
9318 exp->expType = op1->type;
9319 if(op1->type)
9320 op1->type->refCount++;
9321 }
9322 return 0x1;
9323 }
9324
9325 static unsigned int CharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9326 {
9327 char value2 = op2->c;
9328
9329 exp->type = 2;
9330 exp->string = PrintChar((char)(op1->c == value2));
9331 if(!exp->expType)
9332 {
9333 exp->expType = op1->type;
9334 if(op1->type)
9335 op1->type->refCount++;
9336 }
9337 return 0x1;
9338 }
9339
9340 static unsigned int UCharEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9341 {
9342 unsigned char value2 = op2->uc;
9343
9344 exp->type = 2;
9345 exp->string = PrintUChar((unsigned char)(op1->uc == value2));
9346 if(!exp->expType)
9347 {
9348 exp->expType = op1->type;
9349 if(op1->type)
9350 op1->type->refCount++;
9351 }
9352 return 0x1;
9353 }
9354
9355 static unsigned int FloatEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9356 {
9357 float value2 = op2->f;
9358
9359 exp->type = 2;
9360 exp->string = PrintFloat((float)(op1->f == value2));
9361 if(!exp->expType)
9362 {
9363 exp->expType = op1->type;
9364 if(op1->type)
9365 op1->type->refCount++;
9366 }
9367 return 0x1;
9368 }
9369
9370 static unsigned int DoubleEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9371 {
9372 double value2 = op2->d;
9373
9374 exp->type = 2;
9375 exp->string = PrintDouble((double)(op1->d == value2));
9376 if(!exp->expType)
9377 {
9378 exp->expType = op1->type;
9379 if(op1->type)
9380 op1->type->refCount++;
9381 }
9382 return 0x1;
9383 }
9384
9385 static unsigned int IntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9386 {
9387 int value2 = op2->i;
9388
9389 exp->type = 2;
9390 exp->string = PrintInt((int)(op1->i != value2));
9391 if(!exp->expType)
9392 {
9393 exp->expType = op1->type;
9394 if(op1->type)
9395 op1->type->refCount++;
9396 }
9397 return 0x1;
9398 }
9399
9400 static unsigned int UIntNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9401 {
9402 unsigned int value2 = op2->ui;
9403
9404 exp->type = 2;
9405 exp->string = PrintUInt((unsigned int)(op1->ui != value2));
9406 if(!exp->expType)
9407 {
9408 exp->expType = op1->type;
9409 if(op1->type)
9410 op1->type->refCount++;
9411 }
9412 return 0x1;
9413 }
9414
9415 static unsigned int Int64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9416 {
9417 long long value2 = op2->i64;
9418
9419 exp->type = 2;
9420 exp->string = PrintInt64((long long)(op1->i64 != value2));
9421 if(!exp->expType)
9422 {
9423 exp->expType = op1->type;
9424 if(op1->type)
9425 op1->type->refCount++;
9426 }
9427 return 0x1;
9428 }
9429
9430 static unsigned int UInt64Nqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9431 {
9432 uint64 value2 = op2->ui64;
9433
9434 exp->type = 2;
9435 exp->string = PrintUInt64((uint64)(op1->ui64 != value2));
9436 if(!exp->expType)
9437 {
9438 exp->expType = op1->type;
9439 if(op1->type)
9440 op1->type->refCount++;
9441 }
9442 return 0x1;
9443 }
9444
9445 static unsigned int ShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9446 {
9447 short value2 = op2->s;
9448
9449 exp->type = 2;
9450 exp->string = PrintShort((short)(op1->s != value2));
9451 if(!exp->expType)
9452 {
9453 exp->expType = op1->type;
9454 if(op1->type)
9455 op1->type->refCount++;
9456 }
9457 return 0x1;
9458 }
9459
9460 static unsigned int UShortNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9461 {
9462 unsigned short value2 = op2->us;
9463
9464 exp->type = 2;
9465 exp->string = PrintUShort((unsigned short)(op1->us != value2));
9466 if(!exp->expType)
9467 {
9468 exp->expType = op1->type;
9469 if(op1->type)
9470 op1->type->refCount++;
9471 }
9472 return 0x1;
9473 }
9474
9475 static unsigned int CharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9476 {
9477 char value2 = op2->c;
9478
9479 exp->type = 2;
9480 exp->string = PrintChar((char)(op1->c != value2));
9481 if(!exp->expType)
9482 {
9483 exp->expType = op1->type;
9484 if(op1->type)
9485 op1->type->refCount++;
9486 }
9487 return 0x1;
9488 }
9489
9490 static unsigned int UCharNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9491 {
9492 unsigned char value2 = op2->uc;
9493
9494 exp->type = 2;
9495 exp->string = PrintUChar((unsigned char)(op1->uc != value2));
9496 if(!exp->expType)
9497 {
9498 exp->expType = op1->type;
9499 if(op1->type)
9500 op1->type->refCount++;
9501 }
9502 return 0x1;
9503 }
9504
9505 static unsigned int FloatNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9506 {
9507 float value2 = op2->f;
9508
9509 exp->type = 2;
9510 exp->string = PrintFloat((float)(op1->f != value2));
9511 if(!exp->expType)
9512 {
9513 exp->expType = op1->type;
9514 if(op1->type)
9515 op1->type->refCount++;
9516 }
9517 return 0x1;
9518 }
9519
9520 static unsigned int DoubleNqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9521 {
9522 double value2 = op2->d;
9523
9524 exp->type = 2;
9525 exp->string = PrintDouble((double)(op1->d != value2));
9526 if(!exp->expType)
9527 {
9528 exp->expType = op1->type;
9529 if(op1->type)
9530 op1->type->refCount++;
9531 }
9532 return 0x1;
9533 }
9534
9535 static unsigned int IntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9536 {
9537 int value2 = op2->i;
9538
9539 exp->type = 2;
9540 exp->string = PrintInt((int)(op1->i && value2));
9541 if(!exp->expType)
9542 {
9543 exp->expType = op1->type;
9544 if(op1->type)
9545 op1->type->refCount++;
9546 }
9547 return 0x1;
9548 }
9549
9550 static unsigned int UIntAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9551 {
9552 unsigned int value2 = op2->ui;
9553
9554 exp->type = 2;
9555 exp->string = PrintUInt((unsigned int)(op1->ui && value2));
9556 if(!exp->expType)
9557 {
9558 exp->expType = op1->type;
9559 if(op1->type)
9560 op1->type->refCount++;
9561 }
9562 return 0x1;
9563 }
9564
9565 static unsigned int Int64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9566 {
9567 long long value2 = op2->i64;
9568
9569 exp->type = 2;
9570 exp->string = PrintInt64((long long)(op1->i64 && value2));
9571 if(!exp->expType)
9572 {
9573 exp->expType = op1->type;
9574 if(op1->type)
9575 op1->type->refCount++;
9576 }
9577 return 0x1;
9578 }
9579
9580 static unsigned int UInt64And(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9581 {
9582 uint64 value2 = op2->ui64;
9583
9584 exp->type = 2;
9585 exp->string = PrintUInt64((uint64)(op1->ui64 && value2));
9586 if(!exp->expType)
9587 {
9588 exp->expType = op1->type;
9589 if(op1->type)
9590 op1->type->refCount++;
9591 }
9592 return 0x1;
9593 }
9594
9595 static unsigned int ShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9596 {
9597 short value2 = op2->s;
9598
9599 exp->type = 2;
9600 exp->string = PrintShort((short)(op1->s && value2));
9601 if(!exp->expType)
9602 {
9603 exp->expType = op1->type;
9604 if(op1->type)
9605 op1->type->refCount++;
9606 }
9607 return 0x1;
9608 }
9609
9610 static unsigned int UShortAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9611 {
9612 unsigned short value2 = op2->us;
9613
9614 exp->type = 2;
9615 exp->string = PrintUShort((unsigned short)(op1->us && value2));
9616 if(!exp->expType)
9617 {
9618 exp->expType = op1->type;
9619 if(op1->type)
9620 op1->type->refCount++;
9621 }
9622 return 0x1;
9623 }
9624
9625 static unsigned int CharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9626 {
9627 char value2 = op2->c;
9628
9629 exp->type = 2;
9630 exp->string = PrintChar((char)(op1->c && value2));
9631 if(!exp->expType)
9632 {
9633 exp->expType = op1->type;
9634 if(op1->type)
9635 op1->type->refCount++;
9636 }
9637 return 0x1;
9638 }
9639
9640 static unsigned int UCharAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9641 {
9642 unsigned char value2 = op2->uc;
9643
9644 exp->type = 2;
9645 exp->string = PrintUChar((unsigned char)(op1->uc && value2));
9646 if(!exp->expType)
9647 {
9648 exp->expType = op1->type;
9649 if(op1->type)
9650 op1->type->refCount++;
9651 }
9652 return 0x1;
9653 }
9654
9655 static unsigned int FloatAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9656 {
9657 float value2 = op2->f;
9658
9659 exp->type = 2;
9660 exp->string = PrintFloat((float)(op1->f && value2));
9661 if(!exp->expType)
9662 {
9663 exp->expType = op1->type;
9664 if(op1->type)
9665 op1->type->refCount++;
9666 }
9667 return 0x1;
9668 }
9669
9670 static unsigned int DoubleAnd(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9671 {
9672 double value2 = op2->d;
9673
9674 exp->type = 2;
9675 exp->string = PrintDouble((double)(op1->d && value2));
9676 if(!exp->expType)
9677 {
9678 exp->expType = op1->type;
9679 if(op1->type)
9680 op1->type->refCount++;
9681 }
9682 return 0x1;
9683 }
9684
9685 static unsigned int IntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9686 {
9687 int value2 = op2->i;
9688
9689 exp->type = 2;
9690 exp->string = PrintInt((int)(op1->i || value2));
9691 if(!exp->expType)
9692 {
9693 exp->expType = op1->type;
9694 if(op1->type)
9695 op1->type->refCount++;
9696 }
9697 return 0x1;
9698 }
9699
9700 static unsigned int UIntOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9701 {
9702 unsigned int value2 = op2->ui;
9703
9704 exp->type = 2;
9705 exp->string = PrintUInt((unsigned int)(op1->ui || value2));
9706 if(!exp->expType)
9707 {
9708 exp->expType = op1->type;
9709 if(op1->type)
9710 op1->type->refCount++;
9711 }
9712 return 0x1;
9713 }
9714
9715 static unsigned int Int64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9716 {
9717 long long value2 = op2->i64;
9718
9719 exp->type = 2;
9720 exp->string = PrintInt64((long long)(op1->i64 || value2));
9721 if(!exp->expType)
9722 {
9723 exp->expType = op1->type;
9724 if(op1->type)
9725 op1->type->refCount++;
9726 }
9727 return 0x1;
9728 }
9729
9730 static unsigned int UInt64Or(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9731 {
9732 uint64 value2 = op2->ui64;
9733
9734 exp->type = 2;
9735 exp->string = PrintUInt64((uint64)(op1->ui64 || value2));
9736 if(!exp->expType)
9737 {
9738 exp->expType = op1->type;
9739 if(op1->type)
9740 op1->type->refCount++;
9741 }
9742 return 0x1;
9743 }
9744
9745 static unsigned int ShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9746 {
9747 short value2 = op2->s;
9748
9749 exp->type = 2;
9750 exp->string = PrintShort((short)(op1->s || value2));
9751 if(!exp->expType)
9752 {
9753 exp->expType = op1->type;
9754 if(op1->type)
9755 op1->type->refCount++;
9756 }
9757 return 0x1;
9758 }
9759
9760 static unsigned int UShortOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9761 {
9762 unsigned short value2 = op2->us;
9763
9764 exp->type = 2;
9765 exp->string = PrintUShort((unsigned short)(op1->us || value2));
9766 if(!exp->expType)
9767 {
9768 exp->expType = op1->type;
9769 if(op1->type)
9770 op1->type->refCount++;
9771 }
9772 return 0x1;
9773 }
9774
9775 static unsigned int CharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9776 {
9777 char value2 = op2->c;
9778
9779 exp->type = 2;
9780 exp->string = PrintChar((char)(op1->c || value2));
9781 if(!exp->expType)
9782 {
9783 exp->expType = op1->type;
9784 if(op1->type)
9785 op1->type->refCount++;
9786 }
9787 return 0x1;
9788 }
9789
9790 static unsigned int UCharOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9791 {
9792 unsigned char value2 = op2->uc;
9793
9794 exp->type = 2;
9795 exp->string = PrintUChar((unsigned char)(op1->uc || value2));
9796 if(!exp->expType)
9797 {
9798 exp->expType = op1->type;
9799 if(op1->type)
9800 op1->type->refCount++;
9801 }
9802 return 0x1;
9803 }
9804
9805 static unsigned int FloatOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9806 {
9807 float value2 = op2->f;
9808
9809 exp->type = 2;
9810 exp->string = PrintFloat((float)(op1->f || value2));
9811 if(!exp->expType)
9812 {
9813 exp->expType = op1->type;
9814 if(op1->type)
9815 op1->type->refCount++;
9816 }
9817 return 0x1;
9818 }
9819
9820 static unsigned int DoubleOr(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9821 {
9822 double value2 = op2->d;
9823
9824 exp->type = 2;
9825 exp->string = PrintDouble((double)(op1->d || value2));
9826 if(!exp->expType)
9827 {
9828 exp->expType = op1->type;
9829 if(op1->type)
9830 op1->type->refCount++;
9831 }
9832 return 0x1;
9833 }
9834
9835 static unsigned int IntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9836 {
9837 int value2 = op2->i;
9838
9839 exp->type = 2;
9840 exp->string = PrintInt((int)(op1->i > value2));
9841 if(!exp->expType)
9842 {
9843 exp->expType = op1->type;
9844 if(op1->type)
9845 op1->type->refCount++;
9846 }
9847 return 0x1;
9848 }
9849
9850 static unsigned int UIntGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9851 {
9852 unsigned int value2 = op2->ui;
9853
9854 exp->type = 2;
9855 exp->string = PrintUInt((unsigned int)(op1->ui > value2));
9856 if(!exp->expType)
9857 {
9858 exp->expType = op1->type;
9859 if(op1->type)
9860 op1->type->refCount++;
9861 }
9862 return 0x1;
9863 }
9864
9865 static unsigned int Int64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9866 {
9867 long long value2 = op2->i64;
9868
9869 exp->type = 2;
9870 exp->string = PrintInt64((long long)(op1->i64 > value2));
9871 if(!exp->expType)
9872 {
9873 exp->expType = op1->type;
9874 if(op1->type)
9875 op1->type->refCount++;
9876 }
9877 return 0x1;
9878 }
9879
9880 static unsigned int UInt64Grt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9881 {
9882 uint64 value2 = op2->ui64;
9883
9884 exp->type = 2;
9885 exp->string = PrintUInt64((uint64)(op1->ui64 > value2));
9886 if(!exp->expType)
9887 {
9888 exp->expType = op1->type;
9889 if(op1->type)
9890 op1->type->refCount++;
9891 }
9892 return 0x1;
9893 }
9894
9895 static unsigned int ShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9896 {
9897 short value2 = op2->s;
9898
9899 exp->type = 2;
9900 exp->string = PrintShort((short)(op1->s > value2));
9901 if(!exp->expType)
9902 {
9903 exp->expType = op1->type;
9904 if(op1->type)
9905 op1->type->refCount++;
9906 }
9907 return 0x1;
9908 }
9909
9910 static unsigned int UShortGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9911 {
9912 unsigned short value2 = op2->us;
9913
9914 exp->type = 2;
9915 exp->string = PrintUShort((unsigned short)(op1->us > value2));
9916 if(!exp->expType)
9917 {
9918 exp->expType = op1->type;
9919 if(op1->type)
9920 op1->type->refCount++;
9921 }
9922 return 0x1;
9923 }
9924
9925 static unsigned int CharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9926 {
9927 char value2 = op2->c;
9928
9929 exp->type = 2;
9930 exp->string = PrintChar((char)(op1->c > value2));
9931 if(!exp->expType)
9932 {
9933 exp->expType = op1->type;
9934 if(op1->type)
9935 op1->type->refCount++;
9936 }
9937 return 0x1;
9938 }
9939
9940 static unsigned int UCharGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9941 {
9942 unsigned char value2 = op2->uc;
9943
9944 exp->type = 2;
9945 exp->string = PrintUChar((unsigned char)(op1->uc > value2));
9946 if(!exp->expType)
9947 {
9948 exp->expType = op1->type;
9949 if(op1->type)
9950 op1->type->refCount++;
9951 }
9952 return 0x1;
9953 }
9954
9955 static unsigned int FloatGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9956 {
9957 float value2 = op2->f;
9958
9959 exp->type = 2;
9960 exp->string = PrintFloat((float)(op1->f > value2));
9961 if(!exp->expType)
9962 {
9963 exp->expType = op1->type;
9964 if(op1->type)
9965 op1->type->refCount++;
9966 }
9967 return 0x1;
9968 }
9969
9970 static unsigned int DoubleGrt(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9971 {
9972 double value2 = op2->d;
9973
9974 exp->type = 2;
9975 exp->string = PrintDouble((double)(op1->d > value2));
9976 if(!exp->expType)
9977 {
9978 exp->expType = op1->type;
9979 if(op1->type)
9980 op1->type->refCount++;
9981 }
9982 return 0x1;
9983 }
9984
9985 static unsigned int IntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
9986 {
9987 int value2 = op2->i;
9988
9989 exp->type = 2;
9990 exp->string = PrintInt((int)(op1->i < value2));
9991 if(!exp->expType)
9992 {
9993 exp->expType = op1->type;
9994 if(op1->type)
9995 op1->type->refCount++;
9996 }
9997 return 0x1;
9998 }
9999
10000 static unsigned int UIntSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10001 {
10002 unsigned int value2 = op2->ui;
10003
10004 exp->type = 2;
10005 exp->string = PrintUInt((unsigned int)(op1->ui < value2));
10006 if(!exp->expType)
10007 {
10008 exp->expType = op1->type;
10009 if(op1->type)
10010 op1->type->refCount++;
10011 }
10012 return 0x1;
10013 }
10014
10015 static unsigned int Int64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10016 {
10017 long long value2 = op2->i64;
10018
10019 exp->type = 2;
10020 exp->string = PrintInt64((long long)(op1->i64 < value2));
10021 if(!exp->expType)
10022 {
10023 exp->expType = op1->type;
10024 if(op1->type)
10025 op1->type->refCount++;
10026 }
10027 return 0x1;
10028 }
10029
10030 static unsigned int UInt64Sma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10031 {
10032 uint64 value2 = op2->ui64;
10033
10034 exp->type = 2;
10035 exp->string = PrintUInt64((uint64)(op1->ui64 < value2));
10036 if(!exp->expType)
10037 {
10038 exp->expType = op1->type;
10039 if(op1->type)
10040 op1->type->refCount++;
10041 }
10042 return 0x1;
10043 }
10044
10045 static unsigned int ShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10046 {
10047 short value2 = op2->s;
10048
10049 exp->type = 2;
10050 exp->string = PrintShort((short)(op1->s < value2));
10051 if(!exp->expType)
10052 {
10053 exp->expType = op1->type;
10054 if(op1->type)
10055 op1->type->refCount++;
10056 }
10057 return 0x1;
10058 }
10059
10060 static unsigned int UShortSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10061 {
10062 unsigned short value2 = op2->us;
10063
10064 exp->type = 2;
10065 exp->string = PrintUShort((unsigned short)(op1->us < value2));
10066 if(!exp->expType)
10067 {
10068 exp->expType = op1->type;
10069 if(op1->type)
10070 op1->type->refCount++;
10071 }
10072 return 0x1;
10073 }
10074
10075 static unsigned int CharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10076 {
10077 char value2 = op2->c;
10078
10079 exp->type = 2;
10080 exp->string = PrintChar((char)(op1->c < value2));
10081 if(!exp->expType)
10082 {
10083 exp->expType = op1->type;
10084 if(op1->type)
10085 op1->type->refCount++;
10086 }
10087 return 0x1;
10088 }
10089
10090 static unsigned int UCharSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10091 {
10092 unsigned char value2 = op2->uc;
10093
10094 exp->type = 2;
10095 exp->string = PrintUChar((unsigned char)(op1->uc < value2));
10096 if(!exp->expType)
10097 {
10098 exp->expType = op1->type;
10099 if(op1->type)
10100 op1->type->refCount++;
10101 }
10102 return 0x1;
10103 }
10104
10105 static unsigned int FloatSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10106 {
10107 float value2 = op2->f;
10108
10109 exp->type = 2;
10110 exp->string = PrintFloat((float)(op1->f < value2));
10111 if(!exp->expType)
10112 {
10113 exp->expType = op1->type;
10114 if(op1->type)
10115 op1->type->refCount++;
10116 }
10117 return 0x1;
10118 }
10119
10120 static unsigned int DoubleSma(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10121 {
10122 double value2 = op2->d;
10123
10124 exp->type = 2;
10125 exp->string = PrintDouble((double)(op1->d < value2));
10126 if(!exp->expType)
10127 {
10128 exp->expType = op1->type;
10129 if(op1->type)
10130 op1->type->refCount++;
10131 }
10132 return 0x1;
10133 }
10134
10135 static unsigned int IntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10136 {
10137 int value2 = op2->i;
10138
10139 exp->type = 2;
10140 exp->string = PrintInt((int)(op1->i >= value2));
10141 if(!exp->expType)
10142 {
10143 exp->expType = op1->type;
10144 if(op1->type)
10145 op1->type->refCount++;
10146 }
10147 return 0x1;
10148 }
10149
10150 static unsigned int UIntGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10151 {
10152 unsigned int value2 = op2->ui;
10153
10154 exp->type = 2;
10155 exp->string = PrintUInt((unsigned int)(op1->ui >= value2));
10156 if(!exp->expType)
10157 {
10158 exp->expType = op1->type;
10159 if(op1->type)
10160 op1->type->refCount++;
10161 }
10162 return 0x1;
10163 }
10164
10165 static unsigned int Int64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10166 {
10167 long long value2 = op2->i64;
10168
10169 exp->type = 2;
10170 exp->string = PrintInt64((long long)(op1->i64 >= value2));
10171 if(!exp->expType)
10172 {
10173 exp->expType = op1->type;
10174 if(op1->type)
10175 op1->type->refCount++;
10176 }
10177 return 0x1;
10178 }
10179
10180 static unsigned int UInt64GrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10181 {
10182 uint64 value2 = op2->ui64;
10183
10184 exp->type = 2;
10185 exp->string = PrintUInt64((uint64)(op1->ui64 >= value2));
10186 if(!exp->expType)
10187 {
10188 exp->expType = op1->type;
10189 if(op1->type)
10190 op1->type->refCount++;
10191 }
10192 return 0x1;
10193 }
10194
10195 static unsigned int ShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10196 {
10197 short value2 = op2->s;
10198
10199 exp->type = 2;
10200 exp->string = PrintShort((short)(op1->s >= value2));
10201 if(!exp->expType)
10202 {
10203 exp->expType = op1->type;
10204 if(op1->type)
10205 op1->type->refCount++;
10206 }
10207 return 0x1;
10208 }
10209
10210 static unsigned int UShortGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10211 {
10212 unsigned short value2 = op2->us;
10213
10214 exp->type = 2;
10215 exp->string = PrintUShort((unsigned short)(op1->us >= value2));
10216 if(!exp->expType)
10217 {
10218 exp->expType = op1->type;
10219 if(op1->type)
10220 op1->type->refCount++;
10221 }
10222 return 0x1;
10223 }
10224
10225 static unsigned int CharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10226 {
10227 char value2 = op2->c;
10228
10229 exp->type = 2;
10230 exp->string = PrintChar((char)(op1->c >= value2));
10231 if(!exp->expType)
10232 {
10233 exp->expType = op1->type;
10234 if(op1->type)
10235 op1->type->refCount++;
10236 }
10237 return 0x1;
10238 }
10239
10240 static unsigned int UCharGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10241 {
10242 unsigned char value2 = op2->uc;
10243
10244 exp->type = 2;
10245 exp->string = PrintUChar((unsigned char)(op1->uc >= value2));
10246 if(!exp->expType)
10247 {
10248 exp->expType = op1->type;
10249 if(op1->type)
10250 op1->type->refCount++;
10251 }
10252 return 0x1;
10253 }
10254
10255 static unsigned int FloatGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10256 {
10257 float value2 = op2->f;
10258
10259 exp->type = 2;
10260 exp->string = PrintFloat((float)(op1->f >= value2));
10261 if(!exp->expType)
10262 {
10263 exp->expType = op1->type;
10264 if(op1->type)
10265 op1->type->refCount++;
10266 }
10267 return 0x1;
10268 }
10269
10270 static unsigned int DoubleGrtEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10271 {
10272 double value2 = op2->d;
10273
10274 exp->type = 2;
10275 exp->string = PrintDouble((double)(op1->d >= value2));
10276 if(!exp->expType)
10277 {
10278 exp->expType = op1->type;
10279 if(op1->type)
10280 op1->type->refCount++;
10281 }
10282 return 0x1;
10283 }
10284
10285 static unsigned int IntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10286 {
10287 int value2 = op2->i;
10288
10289 exp->type = 2;
10290 exp->string = PrintInt((int)(op1->i <= value2));
10291 if(!exp->expType)
10292 {
10293 exp->expType = op1->type;
10294 if(op1->type)
10295 op1->type->refCount++;
10296 }
10297 return 0x1;
10298 }
10299
10300 static unsigned int UIntSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10301 {
10302 unsigned int value2 = op2->ui;
10303
10304 exp->type = 2;
10305 exp->string = PrintUInt((unsigned int)(op1->ui <= value2));
10306 if(!exp->expType)
10307 {
10308 exp->expType = op1->type;
10309 if(op1->type)
10310 op1->type->refCount++;
10311 }
10312 return 0x1;
10313 }
10314
10315 static unsigned int Int64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10316 {
10317 long long value2 = op2->i64;
10318
10319 exp->type = 2;
10320 exp->string = PrintInt64((long long)(op1->i64 <= value2));
10321 if(!exp->expType)
10322 {
10323 exp->expType = op1->type;
10324 if(op1->type)
10325 op1->type->refCount++;
10326 }
10327 return 0x1;
10328 }
10329
10330 static unsigned int UInt64SmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10331 {
10332 uint64 value2 = op2->ui64;
10333
10334 exp->type = 2;
10335 exp->string = PrintUInt64((uint64)(op1->ui64 <= value2));
10336 if(!exp->expType)
10337 {
10338 exp->expType = op1->type;
10339 if(op1->type)
10340 op1->type->refCount++;
10341 }
10342 return 0x1;
10343 }
10344
10345 static unsigned int ShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10346 {
10347 short value2 = op2->s;
10348
10349 exp->type = 2;
10350 exp->string = PrintShort((short)(op1->s <= value2));
10351 if(!exp->expType)
10352 {
10353 exp->expType = op1->type;
10354 if(op1->type)
10355 op1->type->refCount++;
10356 }
10357 return 0x1;
10358 }
10359
10360 static unsigned int UShortSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10361 {
10362 unsigned short value2 = op2->us;
10363
10364 exp->type = 2;
10365 exp->string = PrintUShort((unsigned short)(op1->us <= value2));
10366 if(!exp->expType)
10367 {
10368 exp->expType = op1->type;
10369 if(op1->type)
10370 op1->type->refCount++;
10371 }
10372 return 0x1;
10373 }
10374
10375 static unsigned int CharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10376 {
10377 char value2 = op2->c;
10378
10379 exp->type = 2;
10380 exp->string = PrintChar((char)(op1->c <= value2));
10381 if(!exp->expType)
10382 {
10383 exp->expType = op1->type;
10384 if(op1->type)
10385 op1->type->refCount++;
10386 }
10387 return 0x1;
10388 }
10389
10390 static unsigned int UCharSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10391 {
10392 unsigned char value2 = op2->uc;
10393
10394 exp->type = 2;
10395 exp->string = PrintUChar((unsigned char)(op1->uc <= value2));
10396 if(!exp->expType)
10397 {
10398 exp->expType = op1->type;
10399 if(op1->type)
10400 op1->type->refCount++;
10401 }
10402 return 0x1;
10403 }
10404
10405 static unsigned int FloatSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10406 {
10407 float value2 = op2->f;
10408
10409 exp->type = 2;
10410 exp->string = PrintFloat((float)(op1->f <= value2));
10411 if(!exp->expType)
10412 {
10413 exp->expType = op1->type;
10414 if(op1->type)
10415 op1->type->refCount++;
10416 }
10417 return 0x1;
10418 }
10419
10420 static unsigned int DoubleSmaEqu(struct Expression * exp, struct Operand * op1, struct Operand * op2)
10421 {
10422 double value2 = op2->d;
10423
10424 exp->type = 2;
10425 exp->string = PrintDouble((double)(op1->d <= value2));
10426 if(!exp->expType)
10427 {
10428 exp->expType = op1->type;
10429 if(op1->type)
10430 op1->type->refCount++;
10431 }
10432 return 0x1;
10433 }
10434
10435 static unsigned int IntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10436 {
10437 exp->type = 2;
10438 exp->string = PrintInt(op1->i ? op2->i : op3->i);
10439 if(!exp->expType)
10440 {
10441 exp->expType = op1->type;
10442 if(op1->type)
10443 op1->type->refCount++;
10444 }
10445 return 0x1;
10446 }
10447
10448 static unsigned int UIntCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10449 {
10450 exp->type = 2;
10451 exp->string = PrintUInt(op1->ui ? op2->ui : op3->ui);
10452 if(!exp->expType)
10453 {
10454 exp->expType = op1->type;
10455 if(op1->type)
10456 op1->type->refCount++;
10457 }
10458 return 0x1;
10459 }
10460
10461 static unsigned int Int64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10462 {
10463 exp->type = 2;
10464 exp->string = PrintInt64(op1->i64 ? op2->i64 : op3->i64);
10465 if(!exp->expType)
10466 {
10467 exp->expType = op1->type;
10468 if(op1->type)
10469 op1->type->refCount++;
10470 }
10471 return 0x1;
10472 }
10473
10474 static unsigned int UInt64Cond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10475 {
10476 exp->type = 2;
10477 exp->string = PrintUInt64(op1->ui64 ? op2->ui64 : op3->ui64);
10478 if(!exp->expType)
10479 {
10480 exp->expType = op1->type;
10481 if(op1->type)
10482 op1->type->refCount++;
10483 }
10484 return 0x1;
10485 }
10486
10487 static unsigned int ShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10488 {
10489 exp->type = 2;
10490 exp->string = PrintShort(op1->s ? op2->s : op3->s);
10491 if(!exp->expType)
10492 {
10493 exp->expType = op1->type;
10494 if(op1->type)
10495 op1->type->refCount++;
10496 }
10497 return 0x1;
10498 }
10499
10500 static unsigned int UShortCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10501 {
10502 exp->type = 2;
10503 exp->string = PrintUShort(op1->us ? op2->us : op3->us);
10504 if(!exp->expType)
10505 {
10506 exp->expType = op1->type;
10507 if(op1->type)
10508 op1->type->refCount++;
10509 }
10510 return 0x1;
10511 }
10512
10513 static unsigned int CharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10514 {
10515 exp->type = 2;
10516 exp->string = PrintChar(op1->c ? op2->c : op3->c);
10517 if(!exp->expType)
10518 {
10519 exp->expType = op1->type;
10520 if(op1->type)
10521 op1->type->refCount++;
10522 }
10523 return 0x1;
10524 }
10525
10526 static unsigned int UCharCond(struct Expression * exp, struct Operand * op1, struct Operand * op2, struct Operand * op3)
10527 {
10528 exp->type = 2;
10529 exp->string = PrintUChar(op1->uc ? op2->uc : op3->uc);
10530 if(!exp->expType)
10531 {
10532 exp->expType = op1->type;
10533 if(op1->type)
10534 op1->type->refCount++;
10535 }
10536 return 0x1;
10537 }
10538
10539 struct OpTable intOps = 
10540 {
10541 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
10542 };
10543
10544 struct OpTable uintOps = 
10545 {
10546 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
10547 };
10548
10549 struct OpTable int64Ops = 
10550 {
10551 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
10552 };
10553
10554 struct OpTable uint64Ops = 
10555 {
10556 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
10557 };
10558
10559 struct OpTable shortOps = 
10560 {
10561 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
10562 };
10563
10564 struct OpTable ushortOps = 
10565 {
10566 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
10567 };
10568
10569 struct OpTable floatOps = 
10570 {
10571 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
10572 };
10573
10574 struct OpTable doubleOps = 
10575 {
10576 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
10577 };
10578
10579 struct OpTable charOps = 
10580 {
10581 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
10582 };
10583
10584 struct OpTable ucharOps = 
10585 {
10586 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
10587 };
10588
10589 void ReadString(char * output, char * string)
10590 {
10591 int len = strlen(string);
10592 int c, d = 0;
10593 unsigned int quoted = 0x0, escaped = 0x0;
10594
10595 for(c = 0; c < len; c++)
10596 {
10597 char ch = string[c];
10598
10599 if(escaped)
10600 {
10601 switch(ch)
10602 {
10603 case 'n':
10604 output[d] = '\n';
10605 break;
10606 case 't':
10607 output[d] = '\t';
10608 break;
10609 case 'a':
10610 output[d] = '\a';
10611 break;
10612 case 'b':
10613 output[d] = '\b';
10614 break;
10615 case 'f':
10616 output[d] = '\f';
10617 break;
10618 case 'r':
10619 output[d] = '\r';
10620 break;
10621 case 'v':
10622 output[d] = '\v';
10623 break;
10624 case '\\':
10625 output[d] = '\\';
10626 break;
10627 case '\"':
10628 output[d] = '\"';
10629 break;
10630 case '\'':
10631 output[d] = '\'';
10632 break;
10633 default:
10634 output[d] = ch;
10635 }
10636 d++;
10637 escaped = 0x0;
10638 }
10639 else
10640 {
10641 if(ch == '\"')
10642 quoted ^= 0x1;
10643 else if(quoted)
10644 {
10645 if(ch == '\\')
10646 escaped = 0x1;
10647 else
10648 output[d++] = ch;
10649 }
10650 }
10651 }
10652 output[d] = '\0';
10653 }
10654
10655 int UnescapeString(char * d, char * s, int len)
10656 {
10657 int j = 0, k = 0;
10658 char ch;
10659
10660 while(j < len && (ch = s[j]))
10661 {
10662 switch(ch)
10663 {
10664 case '\\':
10665 switch((ch = s[++j]))
10666 {
10667 case 'n':
10668 d[k] = '\n';
10669 break;
10670 case 't':
10671 d[k] = '\t';
10672 break;
10673 case 'a':
10674 d[k] = '\a';
10675 break;
10676 case 'b':
10677 d[k] = '\b';
10678 break;
10679 case 'f':
10680 d[k] = '\f';
10681 break;
10682 case 'r':
10683 d[k] = '\r';
10684 break;
10685 case 'v':
10686 d[k] = '\v';
10687 break;
10688 case '\\':
10689 d[k] = '\\';
10690 break;
10691 case '\"':
10692 d[k] = '\"';
10693 break;
10694 case '\'':
10695 d[k] = '\'';
10696 break;
10697 default:
10698 d[k] = '\\';
10699 d[k] = ch;
10700 }
10701 break;
10702 default:
10703 d[k] = ch;
10704 }
10705 j++, k++;
10706 }
10707 d[k] = '\0';
10708 return k;
10709 }
10710
10711 char * OffsetEscapedString(char * s, int len, int offset)
10712 {
10713 char ch;
10714 int j = 0, k = 0;
10715
10716 while(j < len && k < offset && (ch = s[j]))
10717 {
10718 if(ch == '\\')
10719 ++j;
10720 j++, k++;
10721 }
10722 return (k == offset) ? s + j : (((void *)0));
10723 }
10724
10725 extern long long __ecereNameSpace__ecere__com___strtoi64(char *  string, char * *  endString, int base);
10726
10727 extern uint64 __ecereNameSpace__ecere__com___strtoui64(char *  string, char * *  endString, int base);
10728
10729 extern double strtod(char * , char * * );
10730
10731 extern float (* __ecereMethod_float_inf)(void);
10732
10733 extern float (* __ecereMethod_float_nan)(void);
10734
10735 extern double (* __ecereMethod_double_inf)(void);
10736
10737 extern double (* __ecereMethod_double_nan)(void);
10738
10739 struct Operand GetOperand(struct Expression * exp)
10740 {
10741 struct Operand op = 
10742 {
10743 0, 0, 0, 0, 
10744 {
10745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10746 }
10747 };
10748 struct Type * type = exp->expType;
10749
10750 if(type)
10751 {
10752 while(type->kind == 8 && type->_class->registered && (type->_class->registered->type == 2 || type->_class->registered->type == 3 || type->_class->registered->type == 4))
10753 {
10754 if(!type->_class->registered->dataType)
10755 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
10756 type = type->_class->registered->dataType;
10757 }
10758 if(exp->type == 3 && op.kind == 13)
10759 {
10760 op.ui64 = (uint64)exp->string;
10761 op.kind = 13;
10762 op.ops = uint64Ops;
10763 }
10764 else if(exp->isConstant && exp->type == 2)
10765 {
10766 op.kind = type->kind;
10767 op.type = exp->expType;
10768 switch(op.kind)
10769 {
10770 case 24:
10771 case 1:
10772 {
10773 if(exp->constant[0] == '\'')
10774 {
10775 op.c = exp->constant[1];
10776 op.ops = charOps;
10777 }
10778 else if(type->isSigned)
10779 {
10780 op.c = (char)strtol(exp->constant, (((void *)0)), 0);
10781 op.ops = charOps;
10782 }
10783 else
10784 {
10785 op.uc = (unsigned char)strtoul(exp->constant, (((void *)0)), 0);
10786 op.ops = ucharOps;
10787 }
10788 break;
10789 }
10790 case 2:
10791 if(type->isSigned)
10792 {
10793 op.s = (short)strtol(exp->constant, (((void *)0)), 0);
10794 op.ops = shortOps;
10795 }
10796 else
10797 {
10798 op.us = (unsigned short)strtoul(exp->constant, (((void *)0)), 0);
10799 op.ops = ushortOps;
10800 }
10801 break;
10802 case 3:
10803 case 5:
10804 if(type->isSigned)
10805 {
10806 op.i = strtol(exp->constant, (((void *)0)), 0);
10807 op.ops = intOps;
10808 }
10809 else
10810 {
10811 op.ui = strtoul(exp->constant, (((void *)0)), 0);
10812 op.ops = uintOps;
10813 }
10814 op.kind = 3;
10815 break;
10816 case 4:
10817 if(type->isSigned)
10818 {
10819 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10820 op.ops = int64Ops;
10821 }
10822 else
10823 {
10824 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10825 op.ops = uint64Ops;
10826 }
10827 op.kind = 4;
10828 break;
10829 case 22:
10830 if(type->isSigned)
10831 {
10832 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10833 op.ops = int64Ops;
10834 }
10835 else
10836 {
10837 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10838 op.ops = uint64Ops;
10839 }
10840 op.kind = 4;
10841 break;
10842 case 23:
10843 if(type->isSigned)
10844 {
10845 op.i64 = __ecereNameSpace__ecere__com___strtoi64(exp->constant, (((void *)0)), 0);
10846 op.ops = int64Ops;
10847 }
10848 else
10849 {
10850 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10851 op.ops = uint64Ops;
10852 }
10853 op.kind = 4;
10854 break;
10855 case 6:
10856 if(!strcmp(exp->constant, "inf"))
10857 op.f = __ecereMethod_float_inf();
10858 else if(!strcmp(exp->constant, "-inf"))
10859 op.f = -__ecereMethod_float_inf();
10860 else if(!strcmp(exp->constant, "nan"))
10861 op.f = __ecereMethod_float_nan();
10862 else if(!strcmp(exp->constant, "-nan"))
10863 op.f = -__ecereMethod_float_nan();
10864 else
10865 op.f = (float)strtod(exp->constant, (((void *)0)));
10866 op.ops = floatOps;
10867 break;
10868 case 7:
10869 if(!strcmp(exp->constant, "inf"))
10870 op.d = __ecereMethod_double_inf();
10871 else if(!strcmp(exp->constant, "-inf"))
10872 op.d = -__ecereMethod_double_inf();
10873 else if(!strcmp(exp->constant, "nan"))
10874 op.d = __ecereMethod_double_nan();
10875 else if(!strcmp(exp->constant, "-nan"))
10876 op.d = -__ecereMethod_double_nan();
10877 else
10878 op.d = (double)strtod(exp->constant, (((void *)0)));
10879 op.ops = doubleOps;
10880 break;
10881 case 12:
10882 case 13:
10883 case 8:
10884 op.ui64 = __ecereNameSpace__ecere__com___strtoui64(exp->constant, (((void *)0)), 0);
10885 op.kind = 13;
10886 op.ops = uint64Ops;
10887 break;
10888 }
10889 }
10890 }
10891 return op;
10892 }
10893
10894 int __ecereVMethodID_class_OnGetString;
10895
10896 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_int;
10897
10898 static void UnusedFunction()
10899 {
10900 int a;
10901
10902 ((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);
10903 }
10904
10905 extern int __ecereVMethodID_class_OnGetString;
10906
10907 static void PopulateInstanceProcessMember(struct Instantiation * inst, struct __ecereNameSpace__ecere__sys__OldList * memberList, struct __ecereNameSpace__ecere__com__DataMember * parentDataMember, unsigned int offset)
10908 {
10909 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
10910
10911 for(dataMember = parentDataMember->members.first; dataMember; dataMember = dataMember->next)
10912 {
10913 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
10914 PopulateInstanceProcessMember(inst, memberList, dataMember, offset + dataMember->offset);
10915 else
10916 {
10917 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
10918 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
10919 struct Type * type;
10920 void * ptr = inst->data + dataMember->offset + offset;
10921 char * result = (((void *)0));
10922
10923 exp->loc = member->loc = inst->loc;
10924 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
10925 if(!dataMember->dataType)
10926 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
10927 type = dataMember->dataType;
10928 if(type->kind == 8)
10929 {
10930 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
10931
10932 if(_class->type == 4)
10933 {
10934 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
10935
10936 if(enumClass)
10937 {
10938 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
10939 struct __ecereNameSpace__ecere__sys__NamedLink * item;
10940
10941 for(item = e->values.first; item; item = item->next)
10942 {
10943 if((int)item->data == *(int *)ptr)
10944 {
10945 result = item->name;
10946 break;
10947 }
10948 }
10949 if(result)
10950 {
10951 exp->identifier = MkIdentifier(result);
10952 exp->type = 0;
10953 exp->destType = MkClassType(_class->fullName);
10954 ProcessExpressionType(exp);
10955 }
10956 }
10957 }
10958 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
10959 {
10960 if(!_class->dataType)
10961 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
10962 type = _class->dataType;
10963 }
10964 }
10965 if(!result)
10966 {
10967 switch(type->kind)
10968 {
10969 case 6:
10970 {
10971 FreeExpContents(exp);
10972 exp->constant = PrintFloat(*(float *)ptr);
10973 exp->type = 2;
10974 break;
10975 }
10976 case 7:
10977 {
10978 FreeExpContents(exp);
10979 exp->constant = PrintDouble(*(double *)ptr);
10980 exp->type = 2;
10981 break;
10982 }
10983 case 3:
10984 {
10985 FreeExpContents(exp);
10986 exp->constant = PrintInt(*(int *)ptr);
10987 exp->type = 2;
10988 break;
10989 }
10990 case 4:
10991 {
10992 FreeExpContents(exp);
10993 exp->constant = PrintInt64(*(long long *)ptr);
10994 exp->type = 2;
10995 break;
10996 }
10997 case 22:
10998 {
10999 FreeExpContents(exp);
11000 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11001 exp->type = 2;
11002 break;
11003 }
11004 case 23:
11005 {
11006 FreeExpContents(exp);
11007 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11008 exp->type = 2;
11009 break;
11010 }
11011 default:
11012 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11013 }
11014 }
11015 ListAdd(memberList, member);
11016 }
11017 if(parentDataMember->type == 1)
11018 break;
11019 }
11020 }
11021
11022 extern struct MembersInit * MkMembersInitList(struct __ecereNameSpace__ecere__sys__OldList * dataMembers);
11023
11024 void PopulateInstance(struct Instantiation * inst)
11025 {
11026 struct Symbol * classSym = inst->_class->symbol;
11027 struct __ecereNameSpace__ecere__com__Class * _class = classSym->registered;
11028 struct __ecereNameSpace__ecere__com__DataMember * dataMember;
11029 struct __ecereNameSpace__ecere__sys__OldList * memberList = MkList();
11030
11031 if(!inst->members)
11032 inst->members = MkListOne(MkMembersInitList(memberList));
11033 else
11034 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add((&*inst->members), MkMembersInitList(memberList));
11035 for(dataMember = _class->membersAndProperties.first; dataMember; dataMember = dataMember->next)
11036 {
11037 if(!dataMember->isProperty)
11038 {
11039 if(!dataMember->name && (dataMember->type == 2 || dataMember->type == 1))
11040 PopulateInstanceProcessMember(inst, memberList, dataMember, dataMember->offset);
11041 else
11042 {
11043 struct Expression * exp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
11044 struct MemberInit * member = MkMemberInit(MkListOne(MkIdentifier(dataMember->name)), MkInitializerAssignment(exp));
11045 struct Type * type;
11046 void * ptr = inst->data + dataMember->offset;
11047 char * result = (((void *)0));
11048
11049 exp->loc = member->loc = inst->loc;
11050 ((struct Identifier *)(*member->identifiers).first)->loc = inst->loc;
11051 if(!dataMember->dataType)
11052 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11053 type = dataMember->dataType;
11054 if(type->kind == 8)
11055 {
11056 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11057
11058 if(_class->type == 4)
11059 {
11060 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
11061
11062 if(enumClass)
11063 {
11064 struct __ecereNameSpace__ecere__com__EnumClassData * e = (_class ? ((void *)(((char *)_class->data) + enumClass->offsetClass)) : (((void *)0)));
11065 struct __ecereNameSpace__ecere__sys__NamedLink * item;
11066
11067 for(item = e->values.first; item; item = item->next)
11068 {
11069 if((int)item->data == *(int *)ptr)
11070 {
11071 result = item->name;
11072 break;
11073 }
11074 }
11075 }
11076 if(result)
11077 {
11078 exp->identifier = MkIdentifier(result);
11079 exp->type = 0;
11080 exp->destType = MkClassType(_class->fullName);
11081 ProcessExpressionType(exp);
11082 }
11083 }
11084 if(_class->type == 4 || _class->type == 3 || _class->type == 2)
11085 {
11086 if(!_class->dataType)
11087 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11088 type = _class->dataType;
11089 }
11090 }
11091 if(!result)
11092 {
11093 switch(type->kind)
11094 {
11095 case 6:
11096 {
11097 exp->constant = PrintFloat(*(float *)ptr);
11098 exp->type = 2;
11099 break;
11100 }
11101 case 7:
11102 {
11103 exp->constant = PrintDouble(*(double *)ptr);
11104 exp->type = 2;
11105 break;
11106 }
11107 case 3:
11108 {
11109 exp->constant = PrintInt(*(int *)ptr);
11110 exp->type = 2;
11111 break;
11112 }
11113 case 4:
11114 {
11115 exp->constant = PrintInt64(*(long long *)ptr);
11116 exp->type = 2;
11117 break;
11118 }
11119 case 22:
11120 {
11121 exp->constant = PrintInt64((long long)*(intptr_t *)ptr);
11122 exp->type = 2;
11123 break;
11124 }
11125 default:
11126 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unhandled type populating instance\n", (((void *)0))));
11127 }
11128 }
11129 ListAdd(memberList, member);
11130 }
11131 }
11132 }
11133 }
11134
11135 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);
11136
11137 extern void FreeInstance(struct Instantiation * inst);
11138
11139 void ComputeInstantiation(struct Expression * exp)
11140 {
11141 struct Instantiation * inst = exp->instance;
11142 struct MembersInit * members;
11143 struct Symbol * classSym = inst->_class ? inst->_class->symbol : (((void *)0));
11144 struct __ecereNameSpace__ecere__com__Class * _class = classSym ? classSym->registered : (((void *)0));
11145 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
11146 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
11147 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
11148 int subMemberStackPos = 0;
11149 uint64 bits = 0;
11150
11151 if(_class && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11152 {
11153 if(inst->data)
11154 return ;
11155 if(_class->type == 0 || _class->type == 5)
11156 {
11157 inst->data = (unsigned char *)__ecereNameSpace__ecere__com__eInstance_New(_class);
11158 if(_class->type == 0)
11159 ((struct __ecereNameSpace__ecere__com__Instance *)(char *)((struct __ecereNameSpace__ecere__com__Instance *)inst->data))->_refCount++;
11160 }
11161 else
11162 inst->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
11163 }
11164 if(inst->members)
11165 {
11166 for(members = (*inst->members).first; members; members = members->next)
11167 {
11168 switch(members->type)
11169 {
11170 case 0:
11171 {
11172 if(members->dataMembers)
11173 {
11174 struct MemberInit * member;
11175
11176 for(member = (*members->dataMembers).first; member; member = member->next)
11177 {
11178 struct Identifier * ident = member->identifiers ? (*member->identifiers).first : (((void *)0));
11179 unsigned int found = 0x0;
11180 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11181 struct __ecereNameSpace__ecere__com__DataMember * dataMember = (((void *)0));
11182 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
11183 unsigned int dataMemberOffset;
11184
11185 if(!ident)
11186 {
11187 __ecereNameSpace__ecere__com__eClass_FindNextMember(_class, &curClass, &curMember, subMemberStack, &subMemberStackPos);
11188 if(curMember)
11189 {
11190 if(curMember->isProperty)
11191 prop = (struct __ecereNameSpace__ecere__com__Property *)curMember;
11192 else
11193 {
11194 dataMember = curMember;
11195 __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, dataMember->name, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11196 if(_class->type == 0)
11197 dataMemberOffset += _class->base->structSize;
11198 }
11199 found = 0x1;
11200 }
11201 }
11202 else
11203 {
11204 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, ident->string, privateModule);
11205 if(prop)
11206 {
11207 found = 0x1;
11208 if(prop->memberAccess == 1)
11209 {
11210 curMember = (struct __ecereNameSpace__ecere__com__DataMember *)prop;
11211 curClass = prop->_class;
11212 }
11213 }
11214 else
11215 {
11216 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
11217 int _subMemberStackPos = 0;
11218
11219 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(_class, ident->string, &dataMemberOffset, privateModule, _subMemberStack, &_subMemberStackPos);
11220 if(dataMember)
11221 {
11222 found = 0x1;
11223 if(dataMember->memberAccess == 1)
11224 {
11225 curMember = dataMember;
11226 curClass = dataMember->_class;
11227 memcpy(subMemberStack, _subMemberStack, sizeof(struct __ecereNameSpace__ecere__com__DataMember *) * _subMemberStackPos);
11228 subMemberStackPos = _subMemberStackPos;
11229 }
11230 }
11231 }
11232 }
11233 if(found && member->initializer && member->initializer->type == 0)
11234 {
11235 struct Expression * value = member->initializer->exp;
11236 struct Type * type = (((void *)0));
11237 unsigned int deepMember = 0x0;
11238
11239 if(prop)
11240 {
11241 type = prop->dataType;
11242 }
11243 else if(dataMember)
11244 {
11245 if(!dataMember->dataType)
11246 dataMember->dataType = ProcessTypeString(dataMember->dataTypeString, 0x0);
11247 type = dataMember->dataType;
11248 }
11249 if(ident && ident->next)
11250 {
11251 deepMember = 0x1;
11252 for(ident = ident->next; ident && type; ident = ident->next)
11253 {
11254 if(type->kind == 8)
11255 {
11256 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(type->_class->registered, ident->string, privateModule);
11257 if(prop)
11258 type = prop->dataType;
11259 else
11260 {
11261 dataMember = __ecereNameSpace__ecere__com__eClass_FindDataMemberAndOffset(type->_class->registered, ident->string, &dataMemberOffset, privateModule, (((void *)0)), (((void *)0)));
11262 if(dataMember)
11263 type = dataMember->dataType;
11264 }
11265 }
11266 else if(type->kind == 9 || type->kind == 10)
11267 {
11268 struct Type * memberType;
11269
11270 for(memberType = type->members.first; memberType; memberType = memberType->next)
11271 {
11272 if(!strcmp(memberType->name, ident->string))
11273 {
11274 type = memberType;
11275 break;
11276 }
11277 }
11278 }
11279 }
11280 }
11281 if(value)
11282 {
11283 FreeType(value->destType);
11284 value->destType = type;
11285 if(type)
11286 type->refCount++;
11287 ComputeExpression(value);
11288 }
11289 if(!deepMember && type && value && (_class->type == 1 || _class->type == 0 || _class->type == 5))
11290 {
11291 if(type->kind == 8)
11292 {
11293 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11294
11295 if(_class->type == 2 || _class->type == 3 || _class->type == 4)
11296 {
11297 if(!_class->dataType)
11298 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11299 type = _class->dataType;
11300 }
11301 }
11302 if(dataMember)
11303 {
11304 void * ptr = inst->data + dataMemberOffset;
11305
11306 if(value->type == 2)
11307 {
11308 switch(type->kind)
11309 {
11310 case 3:
11311 {
11312 GetInt(value, (int *)ptr);
11313 break;
11314 }
11315 case 4:
11316 {
11317 GetInt64(value, (long long *)ptr);
11318 break;
11319 }
11320 case 22:
11321 {
11322 GetIntPtr(value, (intptr_t *)ptr);
11323 break;
11324 }
11325 case 23:
11326 {
11327 GetIntSize(value, (ssize_t *)ptr);
11328 break;
11329 }
11330 case 6:
11331 {
11332 GetFloat(value, (float *)ptr);
11333 break;
11334 }
11335 case 7:
11336 {
11337 GetDouble(value, (double *)ptr);
11338 break;
11339 }
11340 }
11341 }
11342 else if(value->type == 1)
11343 {
11344 if(type->kind == 8)
11345 {
11346 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11347
11348 if(_class->type == 1)
11349 {
11350 ComputeTypeSize(type);
11351 if(value->instance->data)
11352 memcpy(ptr, value->instance->data, type->size);
11353 }
11354 }
11355 }
11356 }
11357 else if(prop)
11358 {
11359 if(value->type == 1 && value->instance->data)
11360 {
11361 if(type->kind == 8)
11362 {
11363 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11364
11365 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)))
11366 {
11367 void (* Set)(void *, void *) = (void *)prop->Set;
11368
11369 Set(inst->data, value->instance->data);
11370 PopulateInstance(inst);
11371 }
11372 }
11373 }
11374 else if(value->type == 2)
11375 {
11376 switch(type->kind)
11377 {
11378 case 7:
11379 {
11380 void (* Set)(void *, double) = (void *)prop->Set;
11381
11382 Set(inst->data, strtod(value->constant, (((void *)0))));
11383 break;
11384 }
11385 case 6:
11386 {
11387 void (* Set)(void *, float) = (void *)prop->Set;
11388
11389 Set(inst->data, (float)(strtod(value->constant, (((void *)0)))));
11390 break;
11391 }
11392 case 3:
11393 {
11394 void (* Set)(void *, int) = (void *)prop->Set;
11395
11396 Set(inst->data, strtol(value->constant, (((void *)0)), 0));
11397 break;
11398 }
11399 case 4:
11400 {
11401 void (* Set)(void *, long long) = (void *)prop->Set;
11402
11403 Set(inst->data, __ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11404 break;
11405 }
11406 case 22:
11407 {
11408 void (* Set)(void *, intptr_t) = (void *)prop->Set;
11409
11410 Set(inst->data, (intptr_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11411 break;
11412 }
11413 case 23:
11414 {
11415 void (* Set)(void *, ssize_t) = (void *)prop->Set;
11416
11417 Set(inst->data, (ssize_t)__ecereNameSpace__ecere__com___strtoi64(value->constant, (((void *)0)), 0));
11418 break;
11419 }
11420 }
11421 }
11422 else if(value->type == 3)
11423 {
11424 char temp[1024];
11425
11426 ReadString(temp, value->string);
11427 ((void (*)(void *, void *))(void *)prop->Set)(inst->data, temp);
11428 }
11429 }
11430 }
11431 else if(!deepMember && type && _class->type == 3)
11432 {
11433 if(prop)
11434 {
11435 if(value->type == 2)
11436 {
11437 if(type->kind == 8)
11438 {
11439 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
11440
11441 if(_class->type == 3)
11442 {
11443 if(!_class->dataType)
11444 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
11445 type = _class->dataType;
11446 }
11447 }
11448 switch(type->kind)
11449 {
11450 case 6:
11451 {
11452 float fValue;
11453 float (* Set)(float) = (void *)prop->Set;
11454
11455 GetFloat(member->initializer->exp, &fValue);
11456 exp->constant = PrintFloat(Set(fValue));
11457 exp->type = 2;
11458 break;
11459 }
11460 case 7:
11461 {
11462 double dValue;
11463 double (* Set)(double) = (void *)prop->Set;
11464
11465 GetDouble(member->initializer->exp, &dValue);
11466 exp->constant = PrintDouble(Set(dValue));
11467 exp->type = 2;
11468 break;
11469 }
11470 }
11471 }
11472 }
11473 }
11474 else if(!deepMember && type && _class->type == 2)
11475 {
11476 if(prop)
11477 {
11478 if(value->type == 1 && value->instance->data)
11479 {
11480 unsigned int (* Set)(void *) = (void *)prop->Set;
11481
11482 bits = Set(value->instance->data);
11483 }
11484 else if(value->type == 2)
11485 {
11486 }
11487 }
11488 else if(dataMember)
11489 {
11490 struct __ecereNameSpace__ecere__com__BitMember * bitMember = (struct __ecereNameSpace__ecere__com__BitMember *)dataMember;
11491 struct Type * type;
11492 uint64 part;
11493
11494 bits = (bits & ~bitMember->mask);
11495 if(!bitMember->dataType)
11496 bitMember->dataType = ProcessTypeString(bitMember->dataTypeString, 0x0);
11497 type = bitMember->dataType;
11498 if(type->kind == 8 && type->_class && type->_class->registered)
11499 {
11500 if(!type->_class->registered->dataType)
11501 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
11502 type = type->_class->registered->dataType;
11503 }
11504 switch(type->kind)
11505 {
11506 case 24:
11507 case 1:
11508 {
11509 unsigned char v;
11510
11511 type->isSigned ? GetChar(value, &v) : GetUChar(value, &v);
11512 part = (uint64)v;
11513 break;
11514 }
11515 case 2:
11516 {
11517 unsigned short v;
11518
11519 type->isSigned ? GetShort(value, &v) : GetUShort(value, &v);
11520 part = (uint64)v;
11521 break;
11522 }
11523 case 3:
11524 case 5:
11525 {
11526 unsigned int v;
11527
11528 type->isSigned ? GetInt(value, &v) : GetUInt(value, &v);
11529 part = (uint64)v;
11530 break;
11531 }
11532 case 4:
11533 {
11534 uint64 v;
11535
11536 type->isSigned ? GetInt64(value, &v) : GetUInt64(value, &v);
11537 part = v;
11538 break;
11539 }
11540 case 22:
11541 {
11542 intptr_t v;
11543
11544 type->isSigned ? GetIntPtr(value, &v) : GetUIntPtr(value, &v);
11545 part = (uint64)v;
11546 break;
11547 }
11548 case 23:
11549 {
11550 ssize_t v;
11551
11552 type->isSigned ? GetIntSize(value, &v) : GetUIntSize(value, &v);
11553 part = (uint64)v;
11554 break;
11555 }
11556 }
11557 bits += part << bitMember->pos;
11558 }
11559 }
11560 }
11561 else
11562 {
11563 if(_class && _class->type == 3)
11564 {
11565 ComputeExpression(member->initializer->exp);
11566 exp->constant = member->initializer->exp->constant;
11567 exp->type = 2;
11568 member->initializer->exp->constant = (((void *)0));
11569 }
11570 }
11571 }
11572 }
11573 break;
11574 }
11575 }
11576 }
11577 }
11578 if(_class && _class->type == 2)
11579 {
11580 exp->constant = PrintHexUInt(bits);
11581 exp->type = 2;
11582 }
11583 if(exp->type != 1)
11584 {
11585 FreeInstance(inst);
11586 }
11587 }
11588
11589 static unsigned int Promote(struct Operand * op, int kind, unsigned int isSigned)
11590 {
11591 unsigned int result = 0x0;
11592
11593 switch(kind)
11594 {
11595 case 2:
11596 if(op->kind == 1 || op->kind == 15 || op->kind == 24)
11597 result = isSigned ? GetOpShort(op, &op->s) : GetOpUShort(op, &op->us);
11598 break;
11599 case 3:
11600 case 5:
11601 if(op->kind == 1 || op->kind == 2 || op->kind == 15 || op->kind == 24)
11602 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11603 break;
11604 case 4:
11605 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)
11606 result = isSigned ? GetOpInt64(op, &op->i64) : GetOpUInt64(op, &op->ui64);
11607 break;
11608 case 6:
11609 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)
11610 result = GetOpFloat(op, &op->f);
11611 break;
11612 case 7:
11613 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)
11614 result = GetOpDouble(op, &op->d);
11615 break;
11616 case 13:
11617 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)
11618 result = GetOpUIntPtr(op, &op->ui64);
11619 break;
11620 case 15:
11621 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)
11622 result = isSigned ? GetOpInt(op, &op->i) : GetOpUInt(op, &op->ui);
11623 break;
11624 case 22:
11625 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11626 result = isSigned ? GetOpIntPtr(op, &op->i64) : GetOpUIntPtr(op, &op->i64);
11627 break;
11628 case 23:
11629 if(op->kind == 1 || op->kind == 2 || op->kind == 3 || op->kind == 5 || op->kind == 15 || op->kind == 24)
11630 result = isSigned ? GetOpIntSize(op, &op->ui64) : GetOpUIntSize(op, &op->ui64);
11631 break;
11632 }
11633 return result;
11634 }
11635
11636 void CallOperator(struct Expression * exp, struct Expression * exp1, struct Expression * exp2, struct Operand * op1, struct Operand * op2)
11637 {
11638 if(exp->op.op == SIZEOF)
11639 {
11640 FreeExpContents(exp);
11641 exp->type = 2;
11642 exp->constant = PrintUInt(ComputeTypeSize(op1->type));
11643 }
11644 else
11645 {
11646 if(!exp->op.exp1)
11647 {
11648 switch(exp->op.op)
11649 {
11650 case '+':
11651 {
11652 struct Expression * exp2 = exp->op.exp2;
11653
11654 exp->op.exp2 = (((void *)0));
11655 FreeExpContents(exp);
11656 FreeType(exp->expType);
11657 FreeType(exp->destType);
11658 *exp = *exp2;
11659 ((exp2 ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(exp2) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(exp2)) : 0), exp2 = 0);
11660 break;
11661 }
11662 case '-':
11663 if(op1->ops.Neg)
11664 {
11665 FreeExpContents(exp);
11666 op1->ops.Neg(exp, op1);
11667 }
11668 break;
11669 case '~':
11670 if(op1->ops.BitNot)
11671 {
11672 FreeExpContents(exp);
11673 op1->ops.BitNot(exp, op1);
11674 }
11675 break;
11676 case '!':
11677 if(op1->ops.Not)
11678 {
11679 FreeExpContents(exp);
11680 op1->ops.Not(exp, op1);
11681 }
11682 break;
11683 }
11684 }
11685 else
11686 {
11687 if(op1 && op2 && op1->type && op2->type && op1->kind != op2->kind)
11688 {
11689 if(Promote(op2, op1->kind, op1->type->isSigned))
11690 op2->kind = op1->kind, op2->ops = op1->ops;
11691 else if(Promote(op1, op2->kind, op2->type->isSigned))
11692 op1->kind = op2->kind, op1->ops = op2->ops;
11693 }
11694 switch(exp->op.op)
11695 {
11696 case '+':
11697 if(op1->ops.Add)
11698 {
11699 FreeExpContents(exp);
11700 op1->ops.Add(exp, op1, op2);
11701 }
11702 break;
11703 case '-':
11704 if(op1->ops.Sub)
11705 {
11706 FreeExpContents(exp);
11707 op1->ops.Sub(exp, op1, op2);
11708 }
11709 break;
11710 case '*':
11711 if(op1->ops.Mul)
11712 {
11713 FreeExpContents(exp);
11714 op1->ops.Mul(exp, op1, op2);
11715 }
11716 break;
11717 case '/':
11718 if(op1->ops.Div)
11719 {
11720 FreeExpContents(exp);
11721 op1->ops.Div(exp, op1, op2);
11722 }
11723 break;
11724 case '%':
11725 if(op1->ops.Mod)
11726 {
11727 FreeExpContents(exp);
11728 op1->ops.Mod(exp, op1, op2);
11729 }
11730 break;
11731 case '&':
11732 if(exp->op.exp2)
11733 {
11734 if(op1->ops.BitAnd)
11735 {
11736 FreeExpContents(exp);
11737 op1->ops.BitAnd(exp, op1, op2);
11738 }
11739 }
11740 break;
11741 case '|':
11742 if(op1->ops.BitOr)
11743 {
11744 FreeExpContents(exp);
11745 op1->ops.BitOr(exp, op1, op2);
11746 }
11747 break;
11748 case '^':
11749 if(op1->ops.BitXor)
11750 {
11751 FreeExpContents(exp);
11752 op1->ops.BitXor(exp, op1, op2);
11753 }
11754 break;
11755 case LEFT_OP:
11756 if(op1->ops.LShift)
11757 {
11758 FreeExpContents(exp);
11759 op1->ops.LShift(exp, op1, op2);
11760 }
11761 break;
11762 case RIGHT_OP:
11763 if(op1->ops.RShift)
11764 {
11765 FreeExpContents(exp);
11766 op1->ops.RShift(exp, op1, op2);
11767 }
11768 break;
11769 case EQ_OP:
11770 if(op1->ops.Equ)
11771 {
11772 FreeExpContents(exp);
11773 op1->ops.Equ(exp, op1, op2);
11774 }
11775 break;
11776 case NE_OP:
11777 if(op1->ops.Nqu)
11778 {
11779 FreeExpContents(exp);
11780 op1->ops.Nqu(exp, op1, op2);
11781 }
11782 break;
11783 case AND_OP:
11784 if(op1->ops.And)
11785 {
11786 FreeExpContents(exp);
11787 op1->ops.And(exp, op1, op2);
11788 }
11789 break;
11790 case OR_OP:
11791 if(op1->ops.Or)
11792 {
11793 FreeExpContents(exp);
11794 op1->ops.Or(exp, op1, op2);
11795 }
11796 break;
11797 case '>':
11798 if(op1->ops.Grt)
11799 {
11800 FreeExpContents(exp);
11801 op1->ops.Grt(exp, op1, op2);
11802 }
11803 break;
11804 case '<':
11805 if(op1->ops.Sma)
11806 {
11807 FreeExpContents(exp);
11808 op1->ops.Sma(exp, op1, op2);
11809 }
11810 break;
11811 case GE_OP:
11812 if(op1->ops.GrtEqu)
11813 {
11814 FreeExpContents(exp);
11815 op1->ops.GrtEqu(exp, op1, op2);
11816 }
11817 break;
11818 case LE_OP:
11819 if(op1->ops.SmaEqu)
11820 {
11821 FreeExpContents(exp);
11822 op1->ops.SmaEqu(exp, op1, op2);
11823 }
11824 break;
11825 }
11826 }
11827 }
11828 }
11829
11830 void PrintTypeNoConst(struct Type * type, char *  string, unsigned int printName, unsigned int fullName);
11831
11832 extern struct Expression * MkExpIdentifier(struct Identifier * id);
11833
11834 void ComputeExpression(struct Expression * exp)
11835 {
11836 char expString[10240];
11837
11838 expString[0] = '\0';
11839 switch(exp->type)
11840 {
11841 case 1:
11842 {
11843 ComputeInstantiation(exp);
11844 break;
11845 }
11846 case 4:
11847 {
11848 struct Expression * exp1, * exp2 = (((void *)0));
11849 struct Operand op1 = 
11850 {
11851 0, 0, 0, 0, 
11852 {
11853 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11854 }
11855 };
11856 struct Operand op2 = 
11857 {
11858 0, 0, 0, 0, 
11859 {
11860 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
11861 }
11862 };
11863
11864 if(exp->op.exp2)
11865 {
11866 struct Expression * e = exp->op.exp2;
11867
11868 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
11869 {
11870 if(e->type == 5 || e->type == 32 || e->type == 23)
11871 {
11872 if(e->type == 23)
11873 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
11874 else
11875 e = (*e->list).last;
11876 }
11877 }
11878 if(exp->op.op == 261 && e && e->expType)
11879 {
11880 if(e->type == 3 && e->string)
11881 {
11882 char * string = e->string;
11883 int len = strlen(string);
11884 char * tmp = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (len - 2 + 1));
11885
11886 len = UnescapeString(tmp, string + 1, len - 2);
11887 (__ecereNameSpace__ecere__com__eSystem_Delete(tmp), tmp = 0);
11888 FreeExpContents(exp);
11889 exp->type = 2;
11890 exp->constant = PrintUInt(len + 1);
11891 }
11892 else
11893 {
11894 struct Type * type = e->expType;
11895
11896 type->refCount++;
11897 FreeExpContents(exp);
11898 exp->type = 2;
11899 exp->constant = PrintUInt(ComputeTypeSize(type));
11900 FreeType(type);
11901 }
11902 break;
11903 }
11904 else
11905 ComputeExpression(exp->op.exp2);
11906 }
11907 if(exp->op.exp1)
11908 {
11909 ComputeExpression(exp->op.exp1);
11910 exp1 = exp->op.exp1;
11911 exp2 = exp->op.exp2;
11912 op1 = GetOperand(exp1);
11913 if(op1.type)
11914 op1.type->refCount++;
11915 if(exp2)
11916 {
11917 op2 = GetOperand(exp2);
11918 if(op2.type)
11919 op2.type->refCount++;
11920 }
11921 }
11922 else
11923 {
11924 exp1 = exp->op.exp2;
11925 op1 = GetOperand(exp1);
11926 if(op1.type)
11927 op1.type->refCount++;
11928 }
11929 CallOperator(exp, exp1, exp2, &op1, &op2);
11930 if(op1.type)
11931 FreeType(op1.type);
11932 if(op2.type)
11933 FreeType(op2.type);
11934 break;
11935 }
11936 case 5:
11937 case 32:
11938 {
11939 struct Expression * e, * n;
11940
11941 for(e = (*exp->list).first; e; e = n)
11942 {
11943 n = e->next;
11944 if(!n)
11945 {
11946 struct __ecereNameSpace__ecere__sys__OldList * list = exp->list;
11947 struct Expression * prev = exp->prev;
11948 struct Expression * next = exp->next;
11949
11950 ComputeExpression(e);
11951 FreeType(exp->expType);
11952 FreeType(exp->destType);
11953 *exp = *e;
11954 exp->prev = prev;
11955 exp->next = next;
11956 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
11957 (__ecereNameSpace__ecere__com__eSystem_Delete(list), list = 0);
11958 }
11959 else
11960 {
11961 FreeExpression(e);
11962 }
11963 }
11964 break;
11965 }
11966 case 8:
11967 {
11968 struct Expression * memberExp = exp->member.exp;
11969 struct Identifier * memberID = exp->member.member;
11970 struct Type * type;
11971
11972 ComputeExpression(exp->member.exp);
11973 type = exp->member.exp->expType;
11974 if(type)
11975 {
11976 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)));
11977 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
11978 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
11979 struct __ecereNameSpace__ecere__com__Class * convertTo = (((void *)0));
11980
11981 if(type->kind == 19 && exp->member.exp->type == 24)
11982 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
11983 if(!_class)
11984 {
11985 char string[256];
11986 struct Symbol * classSym;
11987
11988 string[0] = '\0';
11989 PrintTypeNoConst(type, string, 0x0, 0x1);
11990 classSym = FindClass(string);
11991 _class = classSym ? classSym->registered : (((void *)0));
11992 }
11993 if(exp->member.member)
11994 {
11995 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, exp->member.member->string, privateModule);
11996 if(!prop)
11997 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, exp->member.member->string, privateModule, (((void *)0)), (((void *)0)));
11998 }
11999 if(!prop && !member && _class && exp->member.member)
12000 {
12001 struct Symbol * classSym = FindClass(exp->member.member->string);
12002
12003 convertTo = _class;
12004 _class = classSym ? classSym->registered : (((void *)0));
12005 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, convertTo->fullName, privateModule);
12006 }
12007 if(prop)
12008 {
12009 if(prop->compiled)
12010 {
12011 struct Type * type = prop->dataType;
12012
12013 if(_class->type == 3)
12014 {
12015 if(type->kind == 8)
12016 {
12017 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12018
12019 if(_class->type == 3)
12020 {
12021 if(!_class->dataType)
12022 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12023 type = _class->dataType;
12024 }
12025 }
12026 switch(type->kind)
12027 {
12028 case 6:
12029 {
12030 float value;
12031 float (* Get)(float) = (void *)prop->Get;
12032
12033 GetFloat(exp->member.exp, &value);
12034 exp->constant = PrintFloat(Get ? Get(value) : value);
12035 exp->type = 2;
12036 break;
12037 }
12038 case 7:
12039 {
12040 double value;
12041 double (* Get)(double);
12042
12043 GetDouble(exp->member.exp, &value);
12044 if(convertTo)
12045 Get = (void *)prop->Set;
12046 else
12047 Get = (void *)prop->Get;
12048 exp->constant = PrintDouble(Get ? Get(value) : value);
12049 exp->type = 2;
12050 break;
12051 }
12052 }
12053 }
12054 else
12055 {
12056 if(convertTo)
12057 {
12058 struct Expression * value = exp->member.exp;
12059 struct Type * type;
12060
12061 if(!prop->dataType)
12062 ProcessPropertyType(prop);
12063 type = prop->dataType;
12064 if(!type)
12065 {
12066 }
12067 else if(_class->type == 1)
12068 {
12069 switch(type->kind)
12070 {
12071 case 8:
12072 {
12073 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12074
12075 if(propertyClass->type == 1 && value->type == 1)
12076 {
12077 void (* Set)(void *, void *) = (void *)prop->Set;
12078
12079 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12080 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12081 exp->instance->_class = MkSpecifierName(_class->fullName);
12082 exp->instance->loc = exp->loc;
12083 exp->type = 1;
12084 Set(exp->instance->data, value->instance->data);
12085 PopulateInstance(exp->instance);
12086 }
12087 break;
12088 }
12089 case 3:
12090 {
12091 int intValue;
12092 void (* Set)(void *, int) = (void *)prop->Set;
12093
12094 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12095 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12096 exp->instance->_class = MkSpecifierName(_class->fullName);
12097 exp->instance->loc = exp->loc;
12098 exp->type = 1;
12099 GetInt(value, &intValue);
12100 Set(exp->instance->data, intValue);
12101 PopulateInstance(exp->instance);
12102 break;
12103 }
12104 case 4:
12105 {
12106 long long intValue;
12107 void (* Set)(void *, long long) = (void *)prop->Set;
12108
12109 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12110 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12111 exp->instance->_class = MkSpecifierName(_class->fullName);
12112 exp->instance->loc = exp->loc;
12113 exp->type = 1;
12114 GetInt64(value, &intValue);
12115 Set(exp->instance->data, intValue);
12116 PopulateInstance(exp->instance);
12117 break;
12118 }
12119 case 22:
12120 {
12121 intptr_t intValue;
12122 void (* Set)(void *, intptr_t) = (void *)prop->Set;
12123
12124 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12125 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12126 exp->instance->_class = MkSpecifierName(_class->fullName);
12127 exp->instance->loc = exp->loc;
12128 exp->type = 1;
12129 GetIntPtr(value, &intValue);
12130 Set(exp->instance->data, intValue);
12131 PopulateInstance(exp->instance);
12132 break;
12133 }
12134 case 23:
12135 {
12136 ssize_t intValue;
12137 void (* Set)(void *, ssize_t) = (void *)prop->Set;
12138
12139 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12140 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12141 exp->instance->_class = MkSpecifierName(_class->fullName);
12142 exp->instance->loc = exp->loc;
12143 exp->type = 1;
12144 GetIntSize(value, &intValue);
12145 Set(exp->instance->data, intValue);
12146 PopulateInstance(exp->instance);
12147 break;
12148 }
12149 case 6:
12150 {
12151 float floatValue;
12152 void (* Set)(void *, float) = (void *)prop->Set;
12153
12154 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12155 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12156 exp->instance->_class = MkSpecifierName(_class->fullName);
12157 exp->instance->loc = exp->loc;
12158 exp->type = 1;
12159 GetFloat(value, &floatValue);
12160 Set(exp->instance->data, floatValue);
12161 PopulateInstance(exp->instance);
12162 break;
12163 }
12164 case 7:
12165 {
12166 double doubleValue;
12167 void (* Set)(void *, double) = (void *)prop->Set;
12168
12169 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12170 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12171 exp->instance->_class = MkSpecifierName(_class->fullName);
12172 exp->instance->loc = exp->loc;
12173 exp->type = 1;
12174 GetDouble(value, &doubleValue);
12175 Set(exp->instance->data, doubleValue);
12176 PopulateInstance(exp->instance);
12177 break;
12178 }
12179 }
12180 }
12181 else if(_class->type == 2)
12182 {
12183 switch(type->kind)
12184 {
12185 case 8:
12186 {
12187 struct __ecereNameSpace__ecere__com__Class * propertyClass = type->_class->registered;
12188
12189 if(propertyClass->type == 1 && value->instance->data)
12190 {
12191 unsigned int (* Set)(void *) = (void *)prop->Set;
12192 unsigned int bits = Set(value->instance->data);
12193
12194 exp->constant = PrintHexUInt(bits);
12195 exp->type = 2;
12196 break;
12197 }
12198 else if(_class->type == 2)
12199 {
12200 unsigned int value;
12201 unsigned int (* Set)(unsigned int) = (void *)prop->Set;
12202 unsigned int bits;
12203
12204 GetUInt(exp->member.exp, &value);
12205 bits = Set(value);
12206 exp->constant = PrintHexUInt(bits);
12207 exp->type = 2;
12208 }
12209 }
12210 }
12211 }
12212 }
12213 else
12214 {
12215 if(_class->type == 2)
12216 {
12217 unsigned int value;
12218
12219 GetUInt(exp->member.exp, &value);
12220 switch(type->kind)
12221 {
12222 case 8:
12223 {
12224 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12225
12226 if(_class->type == 1)
12227 {
12228 void (* Get)(unsigned int, void *) = (void *)prop->Get;
12229
12230 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12231 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12232 exp->instance->_class = MkSpecifierName(_class->fullName);
12233 exp->instance->loc = exp->loc;
12234 exp->type = 1;
12235 Get(value, exp->instance->data);
12236 PopulateInstance(exp->instance);
12237 }
12238 else if(_class->type == 2)
12239 {
12240 unsigned int (* Get)(unsigned int) = (void *)prop->Get;
12241 uint64 bits = Get(value);
12242
12243 exp->constant = PrintHexUInt64(bits);
12244 exp->type = 2;
12245 }
12246 break;
12247 }
12248 }
12249 }
12250 else if(_class->type == 1)
12251 {
12252 char * value = (exp->member.exp->type == 1) ? exp->member.exp->instance->data : (((void *)0));
12253
12254 switch(type->kind)
12255 {
12256 case 8:
12257 {
12258 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12259
12260 if(_class->type == 1 && value)
12261 {
12262 void (* Get)(void *, void *) = (void *)prop->Get;
12263
12264 exp->instance = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Instantiation);
12265 exp->instance->data = __ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (_class->structSize));
12266 exp->instance->_class = MkSpecifierName(_class->fullName);
12267 exp->instance->loc = exp->loc;
12268 exp->type = 1;
12269 Get(value, exp->instance->data);
12270 PopulateInstance(exp->instance);
12271 }
12272 break;
12273 }
12274 }
12275 }
12276 }
12277 }
12278 }
12279 else
12280 {
12281 exp->isConstant = 0x0;
12282 }
12283 }
12284 else if(member)
12285 {
12286 }
12287 }
12288 if(exp->type != 8)
12289 {
12290 FreeExpression(memberExp);
12291 FreeIdentifier(memberID);
12292 }
12293 break;
12294 }
12295 case 10:
12296 {
12297 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
12298
12299 FreeExpContents(exp);
12300 exp->constant = PrintUInt(ComputeTypeSize(type));
12301 exp->type = 2;
12302 FreeType(type);
12303 break;
12304 }
12305 case 15:
12306 {
12307 struct Symbol * classSym = exp->_class->symbol;
12308
12309 if(classSym && classSym->registered)
12310 {
12311 if(classSym->registered->fixed)
12312 {
12313 FreeSpecifier(exp->_class);
12314 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
12315 exp->type = 2;
12316 }
12317 else
12318 {
12319 char className[1024];
12320
12321 strcpy(className, "__ecereClass_");
12322 FullClassNameCat(className, classSym->string, 0x1);
12323 MangleClassName(className);
12324 DeclareClass(classSym, className);
12325 FreeExpContents(exp);
12326 exp->type = 9;
12327 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
12328 exp->member.member = MkIdentifier("structSize");
12329 }
12330 }
12331 break;
12332 }
12333 case 11:
12334 {
12335 struct Type * type;
12336 struct Expression * e = exp;
12337
12338 if(exp->type == 11)
12339 {
12340 if(exp->cast.exp)
12341 ComputeExpression(exp->cast.exp);
12342 e = exp->cast.exp;
12343 }
12344 if(e && exp->expType)
12345 {
12346 type = exp->expType;
12347 if(type->kind == 8)
12348 {
12349 struct __ecereNameSpace__ecere__com__Class * _class = type->_class->registered;
12350
12351 if(_class && (_class->type == 3 || _class->type == 2))
12352 {
12353 if(!_class->dataType)
12354 _class->dataType = ProcessTypeString(_class->dataTypeString, 0x0);
12355 type = _class->dataType;
12356 }
12357 }
12358 switch(type->kind)
12359 {
12360 case 24:
12361 case 1:
12362 if(type->isSigned)
12363 {
12364 char value = (char)0;
12365
12366 if(GetChar(e, &value))
12367 {
12368 FreeExpContents(exp);
12369 exp->constant = PrintChar(value);
12370 exp->type = 2;
12371 }
12372 }
12373 else
12374 {
12375 unsigned char value = (unsigned char)0;
12376
12377 if(GetUChar(e, &value))
12378 {
12379 FreeExpContents(exp);
12380 exp->constant = PrintUChar(value);
12381 exp->type = 2;
12382 }
12383 }
12384 break;
12385 case 2:
12386 if(type->isSigned)
12387 {
12388 short value = (short)0;
12389
12390 if(GetShort(e, &value))
12391 {
12392 FreeExpContents(exp);
12393 exp->constant = PrintShort(value);
12394 exp->type = 2;
12395 }
12396 }
12397 else
12398 {
12399 unsigned short value = (unsigned short)0;
12400
12401 if(GetUShort(e, &value))
12402 {
12403 FreeExpContents(exp);
12404 exp->constant = PrintUShort(value);
12405 exp->type = 2;
12406 }
12407 }
12408 break;
12409 case 3:
12410 if(type->isSigned)
12411 {
12412 int value = 0;
12413
12414 if(GetInt(e, &value))
12415 {
12416 FreeExpContents(exp);
12417 exp->constant = PrintInt(value);
12418 exp->type = 2;
12419 }
12420 }
12421 else
12422 {
12423 unsigned int value = 0;
12424
12425 if(GetUInt(e, &value))
12426 {
12427 FreeExpContents(exp);
12428 exp->constant = PrintUInt(value);
12429 exp->type = 2;
12430 }
12431 }
12432 break;
12433 case 4:
12434 if(type->isSigned)
12435 {
12436 long long value = 0;
12437
12438 if(GetInt64(e, &value))
12439 {
12440 FreeExpContents(exp);
12441 exp->constant = PrintInt64(value);
12442 exp->type = 2;
12443 }
12444 }
12445 else
12446 {
12447 uint64 value = 0;
12448
12449 if(GetUInt64(e, &value))
12450 {
12451 FreeExpContents(exp);
12452 exp->constant = PrintUInt64(value);
12453 exp->type = 2;
12454 }
12455 }
12456 break;
12457 case 22:
12458 if(type->isSigned)
12459 {
12460 intptr_t value = 0;
12461
12462 if(GetIntPtr(e, &value))
12463 {
12464 FreeExpContents(exp);
12465 exp->constant = PrintInt64((long long)value);
12466 exp->type = 2;
12467 }
12468 }
12469 else
12470 {
12471 uintptr_t value = 0;
12472
12473 if(GetUIntPtr(e, &value))
12474 {
12475 FreeExpContents(exp);
12476 exp->constant = PrintUInt64((uint64)value);
12477 exp->type = 2;
12478 }
12479 }
12480 break;
12481 case 23:
12482 if(type->isSigned)
12483 {
12484 ssize_t value = 0;
12485
12486 if(GetIntSize(e, &value))
12487 {
12488 FreeExpContents(exp);
12489 exp->constant = PrintInt64((long long)value);
12490 exp->type = 2;
12491 }
12492 }
12493 else
12494 {
12495 size_t value = 0;
12496
12497 if(GetUIntSize(e, &value))
12498 {
12499 FreeExpContents(exp);
12500 exp->constant = PrintUInt64((uint64)value);
12501 exp->type = 2;
12502 }
12503 }
12504 break;
12505 case 6:
12506 {
12507 float value = 0;
12508
12509 if(GetFloat(e, &value))
12510 {
12511 FreeExpContents(exp);
12512 exp->constant = PrintFloat(value);
12513 exp->type = 2;
12514 }
12515 break;
12516 }
12517 case 7:
12518 {
12519 double value = 0;
12520
12521 if(GetDouble(e, &value))
12522 {
12523 FreeExpContents(exp);
12524 exp->constant = PrintDouble(value);
12525 exp->type = 2;
12526 }
12527 break;
12528 }
12529 }
12530 }
12531 break;
12532 }
12533 case 12:
12534 {
12535 struct Operand op1 = 
12536 {
12537 0, 0, 0, 0, 
12538 {
12539 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12540 }
12541 };
12542 struct Operand op2 = 
12543 {
12544 0, 0, 0, 0, 
12545 {
12546 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12547 }
12548 };
12549 struct Operand op3 = 
12550 {
12551 0, 0, 0, 0, 
12552 {
12553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
12554 }
12555 };
12556
12557 if(exp->cond.exp)
12558 ComputeExpression((*exp->cond.exp).last);
12559 if(exp->cond.elseExp)
12560 ComputeExpression(exp->cond.elseExp);
12561 if(exp->cond.cond)
12562 ComputeExpression(exp->cond.cond);
12563 op1 = GetOperand(exp->cond.cond);
12564 if(op1.type)
12565 op1.type->refCount++;
12566 op2 = GetOperand((*exp->cond.exp).last);
12567 if(op2.type)
12568 op2.type->refCount++;
12569 op3 = GetOperand(exp->cond.elseExp);
12570 if(op3.type)
12571 op3.type->refCount++;
12572 if(op1.ops.Cond)
12573 {
12574 FreeExpContents(exp);
12575 op1.ops.Cond(exp, &op1, &op2, &op3);
12576 }
12577 if(op1.type)
12578 FreeType(op1.type);
12579 if(op2.type)
12580 FreeType(op2.type);
12581 if(op3.type)
12582 FreeType(op3.type);
12583 break;
12584 }
12585 }
12586 }
12587
12588 void ApplyAnyObjectLogic(struct Expression * e);
12589
12590 extern void CopyTypeInto(struct Type * type, struct Type * src);
12591
12592 static unsigned int CheckExpressionType(struct Expression * exp, struct Type * destType, unsigned int skipUnitBla)
12593 {
12594 unsigned int result = 0x1;
12595
12596 if(destType)
12597 {
12598 struct __ecereNameSpace__ecere__sys__OldList converts = 
12599 {
12600 0, 0, 0, 0, 0
12601 };
12602 struct Conversion * convert;
12603
12604 if(destType->kind == 0)
12605 return 0x0;
12606 if(!MatchTypeExpression(exp, destType, &converts, skipUnitBla))
12607 result = 0x0;
12608 if(converts.count)
12609 {
12610 for(convert = converts.first; convert; convert = convert->next)
12611 {
12612 unsigned int empty = !(convert->isGet ? (void *)convert->convert->Get : (void *)convert->convert->Set);
12613
12614 if(!empty)
12615 {
12616 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12617 int objectType = exp->expType ? exp->expType->classObjectType : 0;
12618
12619 *newExp = *exp;
12620 newExp->prev = (((void *)0));
12621 newExp->next = (((void *)0));
12622 newExp->destType = (((void *)0));
12623 if(convert->isGet)
12624 {
12625 exp->type = 8;
12626 exp->addedThis = 0x1;
12627 exp->member.exp = newExp;
12628 FreeType(exp->member.exp->expType);
12629 exp->member.exp->expType = MkClassType(convert->convert->_class->fullName);
12630 exp->member.exp->expType->classObjectType = objectType;
12631 exp->member.member = MkIdentifier(convert->convert->dataTypeString);
12632 exp->member.memberType = 1;
12633 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12634 exp->needCast = 0x1;
12635 if(exp->expType)
12636 exp->expType->refCount++;
12637 ApplyAnyObjectLogic(exp->member.exp);
12638 }
12639 else
12640 {
12641 {
12642 exp->type = 8;
12643 exp->addedThis = 0x1;
12644 exp->member.exp = newExp;
12645 if(newExp->expType && newExp->expType->kind == 8 && newExp->expType->_class && newExp->expType->_class->registered && newExp->expType->_class->registered->type == 5)
12646 {
12647 newExp->byReference = 0x1;
12648 }
12649 FreeType(exp->member.exp->expType);
12650 exp->member.exp->expType = (((void *)0));
12651 if(convert->convert->dataType)
12652 {
12653 exp->member.exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
12654 CopyTypeInto(exp->member.exp->expType, convert->convert->dataType);
12655 exp->member.exp->expType->refCount = 1;
12656 exp->member.exp->expType->classObjectType = objectType;
12657 ApplyAnyObjectLogic(exp->member.exp);
12658 }
12659 exp->member.member = MkIdentifier(convert->convert->_class->fullName);
12660 exp->member.memberType = 4;
12661 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12662 exp->needCast = 0x1;
12663 if(convert->resultType)
12664 convert->resultType->refCount++;
12665 }
12666 }
12667 }
12668 else
12669 {
12670 FreeType(exp->expType);
12671 if(convert->isGet)
12672 {
12673 exp->expType = convert->resultType ? convert->resultType : convert->convert->dataType;
12674 exp->needCast = 0x1;
12675 if(exp->expType)
12676 exp->expType->refCount++;
12677 }
12678 else
12679 {
12680 exp->expType = convert->resultType ? convert->resultType : MkClassType(convert->convert->_class->fullName);
12681 exp->needCast = 0x1;
12682 if(convert->resultType)
12683 convert->resultType->refCount++;
12684 }
12685 }
12686 }
12687 if(exp->isConstant && inCompiler)
12688 ComputeExpression(exp);
12689 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Free(&converts, FreeConvert);
12690 }
12691 if(!result && exp->expType && converts.count)
12692 {
12693 result = MatchTypes(exp->expType, exp->destType, (((void *)0)), (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
12694 }
12695 if(!result && exp->expType && exp->destType)
12696 {
12697 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))
12698 result = 0x1;
12699 }
12700 }
12701 return result;
12702 }
12703
12704 extern struct Statement * MkCompoundStmt(struct __ecereNameSpace__ecere__sys__OldList * declarations, struct __ecereNameSpace__ecere__sys__OldList * statements);
12705
12706 extern struct Statement * MkExpressionStmt(struct __ecereNameSpace__ecere__sys__OldList * expressions);
12707
12708 extern struct Expression * MkExpMember(struct Expression * expression, struct Identifier * member);
12709
12710 void CheckTemplateTypes(struct Expression * exp)
12711 {
12712 if(exp->destType && exp->destType->passAsTemplate && exp->expType && exp->expType->kind != 20 && !exp->expType->passAsTemplate)
12713 {
12714 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12715 struct Statement * compound;
12716 struct Context * context;
12717
12718 *newExp = *exp;
12719 if(exp->destType)
12720 exp->destType->refCount++;
12721 if(exp->expType)
12722 exp->expType->refCount++;
12723 newExp->prev = (((void *)0));
12724 newExp->next = (((void *)0));
12725 switch(exp->expType->kind)
12726 {
12727 case 7:
12728 if(exp->destType->classObjectType)
12729 {
12730 if(exp->destType)
12731 exp->destType->refCount--;
12732 if(exp->expType)
12733 exp->expType->refCount--;
12734 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12735 }
12736 else
12737 {
12738 struct __ecereNameSpace__ecere__sys__OldList * specs;
12739 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12740 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12741
12742 context = PushContext();
12743 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12744 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12745 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12746 exp->type = 23;
12747 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12748 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")), '=', newExp))));
12749 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")))));
12750 exp->compound->compound.context = context;
12751 PopContext(context);
12752 }
12753 break;
12754 default:
12755 exp->type = 11;
12756 exp->cast.typeName = MkTypeName(MkListOne(MkSpecifierName("uint64")), (((void *)0)));
12757 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12758 break;
12759 }
12760 }
12761 else if(exp->expType && exp->expType->passAsTemplate && exp->destType && ((unsigned int)((exp->usage & 0x1) >> 0)) && exp->destType->kind != 20 && !exp->destType->passAsTemplate)
12762 {
12763 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
12764 struct Statement * compound;
12765 struct Context * context;
12766
12767 *newExp = *exp;
12768 if(exp->destType)
12769 exp->destType->refCount++;
12770 if(exp->expType)
12771 exp->expType->refCount++;
12772 newExp->prev = (((void *)0));
12773 newExp->next = (((void *)0));
12774 switch(exp->expType->kind)
12775 {
12776 case 7:
12777 if(exp->destType->classObjectType)
12778 {
12779 if(exp->destType)
12780 exp->destType->refCount--;
12781 if(exp->expType)
12782 exp->expType->refCount--;
12783 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12784 }
12785 else
12786 {
12787 struct __ecereNameSpace__ecere__sys__OldList * specs;
12788 struct __ecereNameSpace__ecere__sys__OldList * unionDefs = MkList();
12789 struct __ecereNameSpace__ecere__sys__OldList * statements = MkList();
12790
12791 context = PushContext();
12792 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifier(DOUBLE)), MkListOne(MkDeclaratorIdentifier(MkIdentifier("d"))), (((void *)0)))));
12793 ListAdd(unionDefs, MkClassDefDeclaration(MkStructDeclaration(MkListOne(MkSpecifierName("uint64")), MkListOne(MkDeclaratorIdentifier(MkIdentifier("i"))), (((void *)0)))));
12794 specs = MkListOne(MkStructOrUnion(4, (((void *)0)), unionDefs));
12795 exp->type = 23;
12796 exp->compound = MkCompoundStmt(MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internal_union")), (((void *)0)))))), statements);
12797 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpOp(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("i")), '=', newExp))));
12798 ListAdd(statements, MkExpressionStmt(MkListOne(MkExpMember(MkExpIdentifier(MkIdentifier("__internal_union")), MkIdentifier("d")))));
12799 exp->compound->compound.context = context;
12800 PopContext(context);
12801 }
12802 break;
12803 case 8:
12804 {
12805 if(exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->type == 1)
12806 {
12807 exp->type = 5;
12808 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), newExp)));
12809 ProcessExpressionType((*exp->list).first);
12810 break;
12811 }
12812 else
12813 {
12814 exp->type = 5;
12815 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(exp->expType->_class->string)), (((void *)0))), newExp));
12816 newExp->needCast = 0x1;
12817 ProcessExpressionType((*exp->list).first);
12818 break;
12819 }
12820 }
12821 default:
12822 {
12823 if(exp->expType->kind == 20)
12824 {
12825 struct Type * type = ProcessTemplateParameterType(exp->expType->templateParameter);
12826
12827 if(type)
12828 {
12829 FreeType(exp->destType);
12830 FreeType(exp->expType);
12831 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
12832 break;
12833 }
12834 }
12835 if(newExp->type == 8 && newExp->member.memberType == 3)
12836 {
12837 exp->type = 4;
12838 exp->op.op = '*';
12839 exp->op.exp1 = (((void *)0));
12840 exp->op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp))));
12841 }
12842 else
12843 {
12844 char typeString[1024];
12845 struct Declarator * decl;
12846 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
12847
12848 typeString[0] = '\0';
12849 PrintType(exp->expType, typeString, 0x0, 0x0);
12850 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
12851 exp->type = 11;
12852 exp->cast.typeName = MkTypeName(specs, decl);
12853 exp->cast.exp = MkExpBrackets(MkListOne(newExp));
12854 exp->cast.exp->needCast = 0x1;
12855 }
12856 break;
12857 }
12858 }
12859 }
12860 }
12861
12862 extern int strncmp(const char * , const char * , size_t n);
12863
12864 struct __ecereNameSpace__ecere__sys__BTNode * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindPrefix(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char *  key);
12865
12866 static struct Symbol * ScanWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * nameSpace, char * name)
12867 {
12868 int nsLen = strlen(nameSpace);
12869 struct Symbol * symbol;
12870
12871 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)))
12872 {
12873 char * s = symbol->string;
12874
12875 if(!strncmp(s, nameSpace, nsLen))
12876 {
12877 int c;
12878 char * namePart;
12879
12880 for(c = strlen(s) - 1; c >= 0; c--)
12881 if(s[c] == ':')
12882 break;
12883 namePart = s + c + 1;
12884 if(!strcmp(namePart, name))
12885 {
12886 return symbol;
12887 }
12888 }
12889 else
12890 break;
12891 }
12892 return (((void *)0));
12893 }
12894
12895 static struct Symbol * FindWithNameSpace(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, char * name)
12896 {
12897 int c;
12898 char nameSpace[1024];
12899 char * namePart;
12900 unsigned int gotColon = 0x0;
12901
12902 nameSpace[0] = '\0';
12903 for(c = strlen(name) - 1; c >= 0; c--)
12904 if(name[c] == ':')
12905 {
12906 gotColon = 0x1;
12907 break;
12908 }
12909 namePart = name + c + 1;
12910 while(c >= 0 && name[c] == ':')
12911 c--;
12912 if(c >= 0)
12913 {
12914 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, name);
12915
12916 if(symbol)
12917 return symbol;
12918 memcpy(nameSpace, name, c + 1);
12919 nameSpace[c + 1] = (char)0;
12920 return ScanWithNameSpace(tree, nameSpace, namePart);
12921 }
12922 else if(gotColon)
12923 {
12924 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12925
12926 return symbol;
12927 }
12928 else
12929 {
12930 struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(tree, namePart);
12931
12932 if(symbol)
12933 return symbol;
12934 return ScanWithNameSpace(tree, "", namePart);
12935 }
12936 return (((void *)0));
12937 }
12938
12939 static void ProcessDeclaration(struct Declaration * decl);
12940
12941 struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace)
12942 {
12943 struct Context * ctx;
12944 struct Symbol * symbol = (((void *)0));
12945
12946 for(ctx = startContext; ctx && !symbol; ctx = ctx->parent)
12947 {
12948 if(ctx == globalContext && !globalNameSpace && ctx->hasNameSpace)
12949 {
12950 symbol = (((void *)0));
12951 if(thisNameSpace)
12952 {
12953 char curName[1024];
12954
12955 strcpy(curName, thisNameSpace);
12956 strcat(curName, "::");
12957 strcat(curName, name);
12958 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, curName);
12959 }
12960 if(!symbol)
12961 symbol = FindWithNameSpace(isStruct ? &ctx->structSymbols : &ctx->symbols, name);
12962 }
12963 else
12964 symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((isStruct ? &ctx->structSymbols : &ctx->symbols), name);
12965 if(symbol || ctx == endContext)
12966 break;
12967 }
12968 if(inCompiler && curExternal && symbol && ctx == globalContext && curExternal->symbol && symbol->id > curExternal->symbol->idCode && symbol->pointerExternal)
12969 {
12970 if(symbol->pointerExternal->type == 0)
12971 {
12972 struct FunctionDefinition * function = symbol->pointerExternal->function;
12973 struct Context * tmpContext = curContext;
12974
12975 curContext = (((void *)0));
12976 symbol->pointerExternal = MkExternalDeclaration(MkDeclaration(CopyList(function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(function->declarator), (((void *)0))))));
12977 curContext = tmpContext;
12978 symbol->pointerExternal->symbol = symbol;
12979 DeclareType(symbol->type, 0x1, 0x1);
12980 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, symbol->pointerExternal);
12981 symbol->id = curExternal->symbol->idCode;
12982 }
12983 else if(symbol->pointerExternal->type == 1 && curExternal->symbol->idCode < symbol->pointerExternal->symbol->id)
12984 {
12985 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Move((&*ast), symbol->pointerExternal, curExternal->prev);
12986 symbol->id = curExternal->symbol->idCode;
12987 }
12988 }
12989 return symbol;
12990 }
12991
12992 static void GetTypeSpecs(struct Type * type, struct __ecereNameSpace__ecere__sys__OldList * specs)
12993 {
12994 if(!type->isSigned && type->kind != 22 && type->kind != 23)
12995 ListAdd(specs, MkSpecifier(UNSIGNED));
12996 switch(type->kind)
12997 {
12998 case 8:
12999 {
13000 if(type->_class->registered)
13001 {
13002 if(!type->_class->registered->dataType)
13003 type->_class->registered->dataType = ProcessTypeString(type->_class->registered->dataTypeString, 0x0);
13004 GetTypeSpecs(type->_class->registered->dataType, specs);
13005 }
13006 break;
13007 }
13008 case 7:
13009 ListAdd(specs, MkSpecifier(DOUBLE));
13010 break;
13011 case 6:
13012 ListAdd(specs, MkSpecifier(FLOAT));
13013 break;
13014 case 1:
13015 ListAdd(specs, MkSpecifier(CHAR));
13016 break;
13017 case 24:
13018 ListAdd(specs, MkSpecifier(_BOOL));
13019 break;
13020 case 2:
13021 ListAdd(specs, MkSpecifier(SHORT));
13022 break;
13023 case 4:
13024 ListAdd(specs, MkSpecifier(INT64));
13025 break;
13026 case 22:
13027 ListAdd(specs, MkSpecifierName(type->isSigned ? "intptr" : "uintptr"));
13028 break;
13029 case 23:
13030 ListAdd(specs, MkSpecifierName(type->isSigned ? "intsize" : "uintsize"));
13031 break;
13032 case 3:
13033 default:
13034 ListAdd(specs, MkSpecifier(INT));
13035 break;
13036 }
13037 }
13038
13039 static void PrintArraySize(struct Type * arrayType, char * string)
13040 {
13041 char size[256];
13042
13043 size[0] = '\0';
13044 strcat(size, "[");
13045 if(arrayType->enumClass)
13046 strcat(size, arrayType->enumClass->string);
13047 else if(arrayType->arraySizeExp)
13048 PrintExpression(arrayType->arraySizeExp, size);
13049 strcat(size, "]");
13050 strcat(string, size);
13051 }
13052
13053 static void PrintTypeSpecs(struct Type * type, char * string, unsigned int fullName, unsigned int printConst)
13054 {
13055 if(type)
13056 {
13057 if(printConst && type->constant)
13058 strcat(string, "const ");
13059 switch(type->kind)
13060 {
13061 case 8:
13062 {
13063 struct Symbol * c = type->_class;
13064
13065 if(type->classObjectType == 2)
13066 strcat(string, "typed_object");
13067 else if(type->classObjectType == 3)
13068 strcat(string, "any_object");
13069 else
13070 {
13071 if(c && c->string)
13072 strcat(string, (fullName || !c->registered) ? c->string : c->registered->name);
13073 }
13074 if(type->byReference)
13075 strcat(string, " &");
13076 break;
13077 }
13078 case 0:
13079 strcat(string, "void");
13080 break;
13081 case 3:
13082 strcat(string, type->isSigned ? "int" : "uint");
13083 break;
13084 case 4:
13085 strcat(string, type->isSigned ? "int64" : "uint64");
13086 break;
13087 case 22:
13088 strcat(string, type->isSigned ? "intptr" : "uintptr");
13089 break;
13090 case 23:
13091 strcat(string, type->isSigned ? "intsize" : "uintsize");
13092 break;
13093 case 1:
13094 strcat(string, type->isSigned ? "char" : "byte");
13095 break;
13096 case 24:
13097 strcat(string, "_Bool");
13098 break;
13099 case 2:
13100 strcat(string, type->isSigned ? "short" : "uint16");
13101 break;
13102 case 6:
13103 strcat(string, "float");
13104 break;
13105 case 7:
13106 strcat(string, "double");
13107 break;
13108 case 9:
13109 if(type->enumName)
13110 {
13111 strcat(string, "struct ");
13112 strcat(string, type->enumName);
13113 }
13114 else if(type->typeName)
13115 strcat(string, type->typeName);
13116 else
13117 {
13118 struct Type * member;
13119
13120 strcat(string, "struct { ");
13121 for(member = type->members.first; member; member = member->next)
13122 {
13123 PrintType(member, string, 0x1, fullName);
13124 strcat(string, "; ");
13125 }
13126 strcat(string, "}");
13127 }
13128 break;
13129 case 10:
13130 if(type->enumName)
13131 {
13132 strcat(string, "union ");
13133 strcat(string, type->enumName);
13134 }
13135 else if(type->typeName)
13136 strcat(string, type->typeName);
13137 else
13138 {
13139 strcat(string, "union ");
13140 strcat(string, "(unnamed)");
13141 }
13142 break;
13143 case 15:
13144 if(type->enumName)
13145 {
13146 strcat(string, "enum ");
13147 strcat(string, type->enumName);
13148 }
13149 else if(type->typeName)
13150 strcat(string, type->typeName);
13151 else
13152 strcat(string, "int");
13153 break;
13154 case 14:
13155 strcat(string, "...");
13156 break;
13157 case 19:
13158 strcat(string, "subclass(");
13159 strcat(string, type->_class ? type->_class->string : "int");
13160 strcat(string, ")");
13161 break;
13162 case 20:
13163 strcat(string, type->templateParameter->identifier->string);
13164 break;
13165 case 21:
13166 strcat(string, "thisclass");
13167 break;
13168 case 17:
13169 strcat(string, "__builtin_va_list");
13170 break;
13171 }
13172 }
13173 }
13174
13175 extern char *  __ecereNameSpace__ecere__sys__RSearchString(char *  buffer, char *  subStr, int maxLen, unsigned int matchCase, unsigned int matchWord);
13176
13177 static void PrintName(struct Type * type, char * string, unsigned int fullName)
13178 {
13179 if(type->name && type->name[0])
13180 {
13181 if(fullName)
13182 strcat(string, type->name);
13183 else
13184 {
13185 char * name = __ecereNameSpace__ecere__sys__RSearchString(type->name, "::", strlen(type->name), 0x1, 0x0);
13186
13187 if(name)
13188 name += 2;
13189 else
13190 name = type->name;
13191 strcat(string, name);
13192 }
13193 }
13194 }
13195
13196 static void PrintAttribs(struct Type * type, char * string)
13197 {
13198 if(type)
13199 {
13200 if(type->dllExport)
13201 strcat(string, "dllexport ");
13202 if(type->attrStdcall)
13203 strcat(string, "stdcall ");
13204 }
13205 }
13206
13207 static void PrePrintType(struct Type * type, char * string, unsigned int fullName, struct Type * parentType, unsigned int printConst)
13208 {
13209 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13210 {
13211 struct Type * attrType = (((void *)0));
13212
13213 if((type->kind == 11 || type->kind == 16) && (!parentType || parentType->kind != 13))
13214 PrintAttribs(type, string);
13215 if(printConst && type->constant && (type->kind == 11 || type->kind == 16))
13216 strcat(string, " const");
13217 PrePrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName, type, printConst);
13218 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13219 strcat(string, " (");
13220 if(type->kind == 13)
13221 {
13222 if(type->type->kind == 11 || type->type->kind == 16)
13223 PrintAttribs(type->type, string);
13224 }
13225 if(type->kind == 13)
13226 {
13227 if(type->type->kind == 11 || type->type->kind == 16 || type->type->kind == 12)
13228 strcat(string, "*");
13229 else
13230 strcat(string, " *");
13231 }
13232 if(printConst && type->constant && type->kind == 13)
13233 strcat(string, " const");
13234 }
13235 else
13236 PrintTypeSpecs(type, string, fullName, printConst);
13237 }
13238
13239 static void PostPrintType(struct Type * type, char * string, unsigned int fullName)
13240 {
13241 if(type->kind == 13 && (type->type->kind == 12 || type->type->kind == 11 || type->type->kind == 16))
13242 strcat(string, ")");
13243 if(type->kind == 12)
13244 PrintArraySize(type, string);
13245 else if(type->kind == 11)
13246 {
13247 struct Type * param;
13248
13249 strcat(string, "(");
13250 for(param = type->params.first; param; param = param->next)
13251 {
13252 PrintType(param, string, 0x1, fullName);
13253 if(param->next)
13254 strcat(string, ", ");
13255 }
13256 strcat(string, ")");
13257 }
13258 if(type->kind == 12 || type->kind == 13 || type->kind == 11 || type->kind == 16)
13259 PostPrintType(type->kind == 16 ? type->method->dataType : type->type, string, fullName);
13260 }
13261
13262 static void _PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName, unsigned int printConst)
13263 {
13264 PrePrintType(type, string, fullName, (((void *)0)), printConst);
13265 if(type->thisClass || (printName && type->name && type->name[0]))
13266 strcat(string, " ");
13267 if((type->thisClass || type->staticMethod))
13268 {
13269 struct Symbol * _class = type->thisClass;
13270
13271 if((type->classObjectType == 2 || type->classObjectType == 1) || (_class && !strcmp(_class->string, "class")))
13272 {
13273 if(type->classObjectType == 1)
13274 strcat(string, "class");
13275 else
13276 strcat(string, type->byReference ? "typed_object&" : "typed_object");
13277 }
13278 else if(_class && _class->string)
13279 {
13280 char * s = _class->string;
13281
13282 if(fullName)
13283 strcat(string, s);
13284 else
13285 {
13286 char * name = __ecereNameSpace__ecere__sys__RSearchString(s, "::", strlen(s), 0x1, 0x0);
13287
13288 if(name)
13289 name += 2;
13290 else
13291 name = s;
13292 strcat(string, name);
13293 }
13294 }
13295 strcat(string, "::");
13296 }
13297 if(printName && type->name)
13298 PrintName(type, string, fullName);
13299 PostPrintType(type, string, fullName);
13300 if(type->bitFieldCount)
13301 {
13302 char count[100];
13303
13304 sprintf(count, ":%d", type->bitFieldCount);
13305 strcat(string, count);
13306 }
13307 }
13308
13309 void PrintType(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13310 {
13311 _PrintType(type, string, printName, fullName, 0x1);
13312 }
13313
13314 void PrintTypeNoConst(struct Type * type, char * string, unsigned int printName, unsigned int fullName)
13315 {
13316 _PrintType(type, string, printName, fullName, 0x0);
13317 }
13318
13319 static struct Type * FindMember(struct Type * type, char * string)
13320 {
13321 struct Type * memberType;
13322
13323 for(memberType = type->members.first; memberType; memberType = memberType->next)
13324 {
13325 if(!memberType->name)
13326 {
13327 struct Type * subType = FindMember(memberType, string);
13328
13329 if(subType)
13330 return subType;
13331 }
13332 else if(!strcmp(memberType->name, string))
13333 return memberType;
13334 }
13335 return (((void *)0));
13336 }
13337
13338 struct Type * FindMemberAndOffset(struct Type * type, char * string, unsigned int * offset)
13339 {
13340 struct Type * memberType;
13341
13342 for(memberType = type->members.first; memberType; memberType = memberType->next)
13343 {
13344 if(!memberType->name)
13345 {
13346 struct Type * subType = FindMember(memberType, string);
13347
13348 if(subType)
13349 {
13350 *offset += memberType->offset;
13351 return subType;
13352 }
13353 }
13354 else if(!strcmp(memberType->name, string))
13355 {
13356 *offset += memberType->offset;
13357 return memberType;
13358 }
13359 }
13360 return (((void *)0));
13361 }
13362
13363 extern unsigned int parseError;
13364
13365 unsigned int GetParseError()
13366 {
13367 return parseError;
13368 }
13369
13370 extern struct __ecereNameSpace__ecere__com__Instance * fileInput;
13371
13372 int __ecereVMethodID___ecereNameSpace__ecere__sys__File_Write;
13373
13374 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__sys__File;
13375
13376 struct Expression * ParseExpressionString(char * expression)
13377 {
13378 parseError = 0x0;
13379 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
13380 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
13381 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13382
13383 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13384 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, expression, 1, strlen(expression));
13385 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
13386 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
13387
13388 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
13389 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
13390 echoOn = 0x0;
13391 parsedExpression = (((void *)0));
13392 resetScanner();
13393 expression_yyparse();
13394 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
13395 return parsedExpression;
13396 }
13397
13398 extern char *  QMkString(char *  source);
13399
13400 static unsigned int ResolveIdWithClass(struct Expression * exp, struct __ecereNameSpace__ecere__com__Class * _class, unsigned int skipIDClassCheck)
13401 {
13402 struct Identifier * id = exp->identifier;
13403 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
13404 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
13405 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
13406 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
13407
13408 if(_class && _class->type == 4)
13409 {
13410 struct __ecereNameSpace__ecere__sys__NamedLink * value = (((void *)0));
13411 struct __ecereNameSpace__ecere__com__Class * enumClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "enum");
13412
13413 if(enumClass)
13414 {
13415 struct __ecereNameSpace__ecere__com__Class * baseClass;
13416
13417 for(baseClass = _class; baseClass && baseClass->type == 4; baseClass = baseClass->base)
13418 {
13419 struct __ecereNameSpace__ecere__com__EnumClassData * e = (baseClass ? ((void *)(((char *)baseClass->data) + enumClass->offsetClass)) : (((void *)0)));
13420
13421 for(value = e->values.first; value; value = value->next)
13422 {
13423 if(!strcmp(value->name, id->string))
13424 break;
13425 }
13426 if(value)
13427 {
13428 char constant[256];
13429
13430 FreeExpContents(exp);
13431 exp->type = 2;
13432 exp->isConstant = 0x1;
13433 if(!strcmp(baseClass->dataTypeString, "int"))
13434 sprintf(constant, "%d", (int)value->data);
13435 else
13436 sprintf(constant, "0x%X", (int)value->data);
13437 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13438 exp->expType = MkClassType(baseClass->fullName);
13439 break;
13440 }
13441 }
13442 }
13443 if(value)
13444 return 0x1;
13445 }
13446 if((method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule)))
13447 {
13448 ProcessMethodType(method);
13449 exp->expType = __extension__ ({
13450 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13451
13452 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1->methodClass = (skipIDClassCheck || (id && id->_class)) ? _class : (((void *)0)), __ecereInstance1;
13453 });
13454 return 0x1;
13455 }
13456 else if((prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule)))
13457 {
13458 if(!prop->dataType)
13459 ProcessPropertyType(prop);
13460 exp->expType = prop->dataType;
13461 if(prop->dataType)
13462 prop->dataType->refCount++;
13463 return 0x1;
13464 }
13465 else if((member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)))))
13466 {
13467 if(!member->dataType)
13468 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
13469 exp->expType = member->dataType;
13470 if(member->dataType)
13471 member->dataType->refCount++;
13472 return 0x1;
13473 }
13474 else if((classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, id->string)))
13475 {
13476 if(!classProp->dataType)
13477 classProp->dataType = ProcessTypeString(classProp->dataTypeString, 0x0);
13478 if(classProp->constant)
13479 {
13480 FreeExpContents(exp);
13481 exp->isConstant = 0x1;
13482 if(classProp->dataType->kind == 13 && classProp->dataType->type->kind == 1)
13483 {
13484 exp->type = 3;
13485 exp->constant = QMkString((char *)classProp->Get(_class));
13486 }
13487 else
13488 {
13489 char constant[256];
13490
13491 exp->type = 2;
13492 sprintf(constant, "%d", (int)classProp->Get(_class));
13493 exp->constant = __ecereNameSpace__ecere__sys__CopyString(constant);
13494 }
13495 }
13496 else
13497 {
13498 }
13499 exp->expType = classProp->dataType;
13500 if(classProp->dataType)
13501 classProp->dataType->refCount++;
13502 return 0x1;
13503 }
13504 return 0x0;
13505 }
13506
13507 static struct GlobalData * ScanGlobalData(struct __ecereNameSpace__ecere__com__NameSpace * nameSpace, char * name)
13508 {
13509 struct __ecereNameSpace__ecere__sys__BinaryTree * tree = &nameSpace->functions;
13510 struct GlobalData * data = (struct GlobalData *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString((&*tree), name);
13511 struct __ecereNameSpace__ecere__com__NameSpace * child;
13512
13513 if(!data)
13514 {
13515 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)))
13516 {
13517 data = ScanGlobalData(child, name);
13518 if(data)
13519 break;
13520 }
13521 }
13522 return data;
13523 }
13524
13525 extern struct __ecereNameSpace__ecere__com__NameSpace *  globalData;
13526
13527 extern char *  strncpy(char * , const char * , size_t n);
13528
13529 static struct GlobalData * FindGlobalData(char * name)
13530 {
13531 int start = 0, c;
13532 struct __ecereNameSpace__ecere__com__NameSpace * nameSpace;
13533
13534 nameSpace = globalData;
13535 for(c = 0; name[c]; c++)
13536 {
13537 if(name[c] == '.' || (name[c] == ':' && name[c + 1] == ':'))
13538 {
13539 struct __ecereNameSpace__ecere__com__NameSpace * newSpace;
13540 char * spaceName = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (c - start + 1));
13541
13542 strncpy(spaceName, name + start, c - start);
13543 spaceName[c - start] = '\0';
13544 newSpace = (struct __ecereNameSpace__ecere__com__NameSpace *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*nameSpace).nameSpaces, spaceName);
13545 (__ecereNameSpace__ecere__com__eSystem_Delete(spaceName), spaceName = 0);
13546 if(!newSpace)
13547 return (((void *)0));
13548 nameSpace = newSpace;
13549 if(name[c] == ':')
13550 c++;
13551 start = c + 1;
13552 }
13553 }
13554 if(c - start)
13555 {
13556 return ScanGlobalData(nameSpace, name + start);
13557 }
13558 return (((void *)0));
13559 }
13560
13561 static int definedExpStackPos;
13562
13563 static void * definedExpStack[512];
13564
13565 void ReplaceExpContents(struct Expression * checkedExp, struct Expression * newExp)
13566 {
13567 struct Expression * prev = checkedExp->prev, * next = checkedExp->next;
13568
13569 FreeExpContents(checkedExp);
13570 FreeType(checkedExp->expType);
13571 FreeType(checkedExp->destType);
13572 *checkedExp = *newExp;
13573 ((newExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(newExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newExp)) : 0), newExp = 0);
13574 checkedExp->prev = prev;
13575 checkedExp->next = next;
13576 }
13577
13578 extern struct Expression * MkExpCall(struct Expression * expression, struct __ecereNameSpace__ecere__sys__OldList * arguments);
13579
13580 extern int printf(char * , ...);
13581
13582 void __ecereMethod_Expression_Clear();
13583
13584 void ApplyAnyObjectLogic(struct Expression * e)
13585 {
13586 struct Type * destType = e->destType;
13587
13588 if(destType && (destType->classObjectType == 3))
13589 {
13590 if(e && e->expType)
13591 {
13592 struct Type * type = e->expType;
13593 struct __ecereNameSpace__ecere__com__Class * _class = (((void *)0));
13594
13595 if(type->kind == 8 && type->_class && type->_class->registered)
13596 {
13597 _class = type->_class->registered;
13598 }
13599 else if(type->kind == 19)
13600 {
13601 _class = FindClass("ecere::com::Class")->registered;
13602 }
13603 else
13604 {
13605 char string[1024] = "";
13606 struct Symbol * classSym;
13607
13608 PrintTypeNoConst(type, string, 0x0, 0x1);
13609 classSym = FindClass(string);
13610 if(classSym)
13611 _class = classSym->registered;
13612 }
13613 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)))
13614 {
13615 if(!_class || strcmp(_class->fullName, "char *"))
13616 {
13617 struct Expression * checkedExp = e, * newExp;
13618
13619 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13620 {
13621 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13622 {
13623 if(checkedExp->type == 23)
13624 {
13625 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13626 }
13627 else
13628 checkedExp = (*checkedExp->list).last;
13629 }
13630 else if(checkedExp->type == 11)
13631 checkedExp = checkedExp->cast.exp;
13632 }
13633 if(checkedExp && checkedExp->type == 4 && checkedExp->op.op == '*' && !checkedExp->op.exp1)
13634 {
13635 newExp = checkedExp->op.exp2;
13636 checkedExp->op.exp2 = (((void *)0));
13637 FreeExpContents(checkedExp);
13638 if(e->expType && e->expType->passAsTemplate)
13639 {
13640 char size[100];
13641
13642 ComputeTypeSize(e->expType);
13643 sprintf(size, "%d", e->expType->size);
13644 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))))));
13645 }
13646 ReplaceExpContents(checkedExp, newExp);
13647 e->byReference = 0x1;
13648 }
13649 else if(!e->byReference || (_class && _class->type == 5))
13650 {
13651 struct Expression * checkedExp, * newExp;
13652
13653 {
13654 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;
13655
13656 if(_class && _class->type != 5 && _class->type != 0 && _class->type != 1 && !hasAddress)
13657 {
13658 struct Context * context = PushContext();
13659 struct Declarator * decl;
13660 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13661 char typeString[1024];
13662 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13663
13664 typeString[0] = '\0';
13665 *newExp = *e;
13666 newExp->prev = (((void *)0));
13667 newExp->next = (((void *)0));
13668 newExp->expType = (((void *)0));
13669 PrintTypeNoConst(e->expType, typeString, 0x0, 0x1);
13670 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13671 newExp->destType = ProcessType(specs, decl);
13672 curContext = context;
13673 if(curCompound)
13674 {
13675 char name[100];
13676 struct __ecereNameSpace__ecere__sys__OldList * stmts = MkList();
13677
13678 e->type = 23;
13679 sprintf(name, "__internalValue%03X", internalValueCounter++);
13680 if(!curCompound->compound.declarations)
13681 curCompound->compound.declarations = MkList();
13682 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(name)), (((void *)0))))));
13683 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpOp(MkExpIdentifier(MkIdentifier(name)), '=', newExp))));
13684 ListAdd(stmts, MkExpressionStmt(MkListOne(MkExpIdentifier(MkIdentifier(name)))));
13685 e->compound = MkCompoundStmt((((void *)0)), stmts);
13686 }
13687 else
13688 printf("libec: compiler error, curCompound is null in ApplyAnyObjectLogic\n");
13689 {
13690 struct Type * type = e->destType;
13691
13692 e->destType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13693 CopyTypeInto(e->destType, type);
13694 e->destType->refCount = 1;
13695 e->destType->classObjectType = 0;
13696 FreeType(type);
13697 }
13698 e->compound->compound.context = context;
13699 PopContext(context);
13700 curContext = context->parent;
13701 }
13702 }
13703 checkedExp = e;
13704 while(((checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23) && checkedExp->list) || checkedExp->type == 11)
13705 {
13706 if(checkedExp->type == 5 || checkedExp->type == 32 || checkedExp->type == 23)
13707 {
13708 if(checkedExp->type == 23)
13709 {
13710 checkedExp = (*((struct Statement *)(*checkedExp->compound->compound.statements).last)->expressions).last;
13711 }
13712 else
13713 checkedExp = (*checkedExp->list).last;
13714 }
13715 else if(checkedExp->type == 11)
13716 checkedExp = checkedExp->cast.exp;
13717 }
13718 {
13719 struct Expression * operand = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13720
13721 *operand = *checkedExp;
13722 checkedExp->destType = (((void *)0));
13723 checkedExp->expType = (((void *)0));
13724 __ecereMethod_Expression_Clear(checkedExp);
13725 checkedExp->type = 4;
13726 checkedExp->op.op = '&';
13727 checkedExp->op.exp1 = (((void *)0));
13728 checkedExp->op.exp2 = operand;
13729 }
13730 }
13731 }
13732 }
13733 }
13734 }
13735 {
13736 }
13737 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))))
13738 {
13739 if(e->expType->classObjectType && destType && destType->classObjectType)
13740 {
13741 return ;
13742 }
13743 else
13744 {
13745 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13746
13747 *thisExp = *e;
13748 thisExp->prev = (((void *)0));
13749 thisExp->next = (((void *)0));
13750 __ecereMethod_Expression_Clear(e);
13751 e->type = 5;
13752 e->list = MkListOne(MkExpOp((((void *)0)), '*', thisExp->type == 0 ? thisExp : MkExpBrackets(MkListOne(thisExp))));
13753 if(thisExp->expType->kind == 8 && thisExp->expType->_class && thisExp->expType->_class->registered && thisExp->expType->_class->registered->type == 5)
13754 ((struct Expression *)(*e->list).first)->byReference = 0x1;
13755 {
13756 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13757 CopyTypeInto(e->expType, thisExp->expType);
13758 e->expType->byReference = 0x0;
13759 e->expType->refCount = 1;
13760 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))
13761 {
13762 e->expType->classObjectType = 0;
13763 }
13764 }
13765 }
13766 }
13767 else if(destType && e->expType && (e->expType->classObjectType == 3 || e->expType->classObjectType == 2) && !destType->classObjectType && destType->kind != 0)
13768 {
13769 if(destType->kind == 14)
13770 {
13771 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Unspecified type\n", (((void *)0))));
13772 }
13773 else if(!(destType->truth && e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && e->expType->_class->registered->type == 1))
13774 {
13775 unsigned int byReference = e->expType->byReference;
13776 struct Expression * thisExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
13777 struct Declarator * decl;
13778 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
13779 char typeString[1024];
13780 struct Type * type;
13781 int backupClassObjectType;
13782 unsigned int backupByReference;
13783
13784 if(e->expType->kind == 8 && e->expType->_class && e->expType->_class->registered && strcmp(e->expType->_class->registered->name, "class"))
13785 type = e->expType;
13786 else
13787 type = destType;
13788 backupClassObjectType = type->classObjectType;
13789 backupByReference = type->byReference;
13790 type->classObjectType = 0;
13791 type->byReference = 0x0;
13792 typeString[0] = '\0';
13793 PrintType(type, typeString, 0x0, 0x1);
13794 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
13795 type->classObjectType = backupClassObjectType;
13796 type->byReference = backupByReference;
13797 *thisExp = *e;
13798 thisExp->prev = (((void *)0));
13799 thisExp->next = (((void *)0));
13800 __ecereMethod_Expression_Clear(e);
13801 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)))
13802 {
13803 e->type = 4;
13804 e->op.op = '*';
13805 e->op.exp1 = (((void *)0));
13806 e->op.exp2 = MkExpCast(MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl)), thisExp);
13807 e->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
13808 CopyTypeInto(e->expType, type);
13809 e->expType->byReference = 0x0;
13810 e->expType->refCount = 1;
13811 }
13812 else
13813 {
13814 e->type = 11;
13815 e->cast.typeName = MkTypeName(specs, decl);
13816 e->cast.exp = thisExp;
13817 e->byReference = 0x1;
13818 e->expType = type;
13819 type->refCount++;
13820 }
13821 e->destType = destType;
13822 destType->refCount++;
13823 }
13824 }
13825 }
13826
13827 extern char *  strstr(const char * , const char * );
13828
13829 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass___ecereNameSpace__ecere__com__DefinedExpression;
13830
13831 struct __ecereNameSpace__ecere__com__DefinedExpression
13832 {
13833 struct __ecereNameSpace__ecere__com__DefinedExpression * prev;
13834 struct __ecereNameSpace__ecere__com__DefinedExpression * next;
13835 char *  name;
13836 char *  value;
13837 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
13838 } __attribute__ ((gcc_struct));
13839
13840 extern struct __ecereNameSpace__ecere__com__DefinedExpression * __ecereNameSpace__ecere__com__eSystem_FindDefine(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
13841
13842 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_FindFunction(struct __ecereNameSpace__ecere__com__Instance * module, char *  name);
13843
13844 extern unsigned int __ecereNameSpace__ecere__sys__UTF8GetChar(char *  string, int *  numBytes);
13845
13846 extern struct Expression * GetTemplateArgExp(struct TemplateParameter * param, struct __ecereNameSpace__ecere__com__Class * curClass, unsigned int pointer);
13847
13848 extern struct Expression * MkExpCondition(struct Expression * cond, struct __ecereNameSpace__ecere__sys__OldList * expressions, struct Expression * elseExp);
13849
13850 extern struct Expression * MkExpTypeSize(struct TypeName * typeName);
13851
13852 extern struct Expression * MkExpClass(struct __ecereNameSpace__ecere__sys__OldList *  specifiers, struct Declarator * decl);
13853
13854 static void ProcessStatement(struct Statement * stmt);
13855
13856 extern struct Expression * MkExpExtensionInitializer(struct TypeName * typeName, struct Initializer * initializer);
13857
13858 extern struct Initializer * MkInitializerList(struct __ecereNameSpace__ecere__sys__OldList * list);
13859
13860 extern char *  __ecereNameSpace__ecere__com__PrintString(struct __ecereNameSpace__ecere__com__Class * class, void * object, ...);
13861
13862 extern char *  sourceFile;
13863
13864 void __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear(struct __ecereNameSpace__ecere__sys__OldList * this);
13865
13866 void ProcessExpressionType(struct Expression * exp)
13867 {
13868 unsigned int unresolved = 0x0;
13869 struct Location oldyylloc = yylloc;
13870 unsigned int notByReference = 0x0;
13871
13872 if(!exp || exp->expType)
13873 return ;
13874 yylloc = exp->loc;
13875 switch(exp->type)
13876 {
13877 case 0:
13878 {
13879 struct Identifier * id = exp->identifier;
13880
13881 if(!id || !topContext)
13882 return ;
13883 if(id->_class && id->_class->name)
13884 {
13885 id->classSym = id->_class->symbol;
13886 }
13887 if(strstr(id->string, "__ecereClass") == id->string)
13888 {
13889 exp->expType = ProcessTypeString("ecere::com::Class", 0x1);
13890 break;
13891 }
13892 else if(id->_class && (id->classSym || (id->_class->name && !strcmp(id->_class->name, "property"))))
13893 {
13894 ReplaceClassMembers(exp, thisClass);
13895 if(exp->type != 0)
13896 {
13897 ProcessExpressionType(exp);
13898 break;
13899 }
13900 if(id->classSym && ResolveIdWithClass(exp, id->classSym->registered, 0x0))
13901 break;
13902 }
13903 else
13904 {
13905 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
13906
13907 if(!symbol)
13908 {
13909 if(exp->destType && CheckExpressionType(exp, exp->destType, 0x0))
13910 break;
13911 else
13912 {
13913 if(thisClass)
13914 {
13915 ReplaceClassMembers(exp, thisClass ? thisClass : currentClass);
13916 if(exp->type != 0)
13917 {
13918 ProcessExpressionType(exp);
13919 break;
13920 }
13921 }
13922 else if(currentClass && !id->_class)
13923 {
13924 if(ResolveIdWithClass(exp, currentClass, 0x1))
13925 break;
13926 }
13927 symbol = FindSymbol(id->string, topContext->parent, globalContext, 0x0, id->_class && id->_class->name == (((void *)0)));
13928 }
13929 }
13930 if(symbol)
13931 {
13932 struct Type * type = symbol->type;
13933 struct __ecereNameSpace__ecere__com__Class * _class = (type && type->kind == 8 && type->_class) ? type->_class->registered : (((void *)0));
13934
13935 if(_class && !strcmp(id->string, "this") && !type->classObjectType)
13936 {
13937 struct Context * context = SetupTemplatesContext(_class);
13938
13939 type = ReplaceThisClassType(_class);
13940 FinishTemplatesContext(context);
13941 if(type)
13942 type->refCount = 0;
13943 }
13944 FreeSpecifier(id->_class);
13945 id->_class = (((void *)0));
13946 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
13947 id->string = __ecereNameSpace__ecere__sys__CopyString(symbol->string);
13948 id->classSym = (((void *)0));
13949 exp->expType = type;
13950 if(type)
13951 type->refCount++;
13952 if(type && (type->kind == 15))
13953 exp->isConstant = 0x1;
13954 if(symbol->isParam || !strcmp(id->string, "this"))
13955 {
13956 if(_class && _class->type == 1 && !type->declaredWithStruct)
13957 exp->byReference = 0x1;
13958 }
13959 if(symbol->isIterator)
13960 {
13961 if(symbol->isIterator == 3)
13962 {
13963 exp->type = 5;
13964 exp->list = MkListOne(MkExpOp((((void *)0)), '*', MkExpIdentifier(exp->identifier)));
13965 ((struct Expression *)(*exp->list).first)->op.exp2->expType = exp->expType;
13966 exp->expType = (((void *)0));
13967 ProcessExpressionType(exp);
13968 }
13969 else if(symbol->isIterator != 4)
13970 {
13971 exp->type = 8;
13972 exp->member.exp = MkExpIdentifier(exp->identifier);
13973 exp->member.exp->expType = exp->expType;
13974 exp->member.member = MkIdentifier("data");
13975 exp->expType = (((void *)0));
13976 ProcessExpressionType(exp);
13977 }
13978 }
13979 break;
13980 }
13981 else
13982 {
13983 struct __ecereNameSpace__ecere__com__DefinedExpression * definedExp = (((void *)0));
13984
13985 if(thisNameSpace && !(id->_class && !id->_class->name))
13986 {
13987 char name[1024];
13988
13989 strcpy(name, thisNameSpace);
13990 strcat(name, "::");
13991 strcat(name, id->string);
13992 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, name);
13993 }
13994 if(!definedExp)
13995 definedExp = __ecereNameSpace__ecere__com__eSystem_FindDefine(privateModule, id->string);
13996 if(definedExp)
13997 {
13998 int c;
13999
14000 for(c = 0; c < definedExpStackPos; c++)
14001 if(definedExpStack[c] == definedExp)
14002 break;
14003 if(c == definedExpStackPos && c < sizeof (definedExpStack) / sizeof(void *))
14004 {
14005 struct Location backupYylloc = yylloc;
14006 struct __ecereNameSpace__ecere__com__Instance * backInput = fileInput;
14007
14008 definedExpStack[definedExpStackPos++] = definedExp;
14009 fileInput = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass___ecereNameSpace__ecere__sys__TempFile);
14010 ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void *  buffer, unsigned int size, unsigned int count))__extension__ ({
14011 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14012
14013 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14014 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Write])(fileInput, definedExp->value, 1, strlen(definedExp->value));
14015 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__extension__ ({
14016 struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = fileInput;
14017
14018 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__sys__File->_vTbl;
14019 })[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(fileInput, 0, 0);
14020 echoOn = 0x0;
14021 parsedExpression = (((void *)0));
14022 resetScanner();
14023 expression_yyparse();
14024 (__ecereNameSpace__ecere__com__eInstance_DecRef(fileInput), fileInput = 0);
14025 if(backInput)
14026 fileInput = backInput;
14027 yylloc = backupYylloc;
14028 if(parsedExpression)
14029 {
14030 FreeIdentifier(id);
14031 exp->type = 5;
14032 exp->list = MkListOne(parsedExpression);
14033 parsedExpression->loc = yylloc;
14034 ProcessExpressionType(exp);
14035 definedExpStackPos--;
14036 return ;
14037 }
14038 definedExpStackPos--;
14039 }
14040 else
14041 {
14042 if(inCompiler)
14043 {
14044 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Recursion in defined expression %s\n", (((void *)0))), id->string);
14045 }
14046 }
14047 }
14048 else
14049 {
14050 struct GlobalData * data = (((void *)0));
14051
14052 if(thisNameSpace && !(id->_class && !id->_class->name))
14053 {
14054 char name[1024];
14055
14056 strcpy(name, thisNameSpace);
14057 strcat(name, "::");
14058 strcat(name, id->string);
14059 data = FindGlobalData(name);
14060 }
14061 if(!data)
14062 data = FindGlobalData(id->string);
14063 if(data)
14064 {
14065 DeclareGlobalData(data);
14066 exp->expType = data->dataType;
14067 if(data->dataType)
14068 data->dataType->refCount++;
14069 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14070 id->string = __ecereNameSpace__ecere__sys__CopyString(data->fullName);
14071 FreeSpecifier(id->_class);
14072 id->_class = (((void *)0));
14073 break;
14074 }
14075 else
14076 {
14077 struct __ecereNameSpace__ecere__com__GlobalFunction * function = (((void *)0));
14078
14079 if(thisNameSpace && !(id->_class && !id->_class->name))
14080 {
14081 char name[1024];
14082
14083 strcpy(name, thisNameSpace);
14084 strcat(name, "::");
14085 strcat(name, id->string);
14086 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, name);
14087 }
14088 if(!function)
14089 function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, id->string);
14090 if(function)
14091 {
14092 char name[1024];
14093
14094 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14095 id->string = __ecereNameSpace__ecere__sys__CopyString(function->name);
14096 name[0] = (char)0;
14097 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
14098 strcpy(name, "__ecereFunction_");
14099 FullClassNameCat(name, id->string, 0x0);
14100 if(DeclareFunction(function, name))
14101 {
14102 (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0);
14103 id->string = __ecereNameSpace__ecere__sys__CopyString(name);
14104 }
14105 exp->expType = function->dataType;
14106 if(function->dataType)
14107 function->dataType->refCount++;
14108 FreeSpecifier(id->_class);
14109 id->_class = (((void *)0));
14110 break;
14111 }
14112 }
14113 }
14114 }
14115 }
14116 unresolved = 0x1;
14117 break;
14118 }
14119 case 1:
14120 {
14121 struct __ecereNameSpace__ecere__com__Class * _class;
14122
14123 if(!exp->instance->_class)
14124 {
14125 if(exp->destType && exp->destType->kind == 8 && exp->destType->_class)
14126 {
14127 exp->instance->_class = MkSpecifierName(exp->destType->_class->string);
14128 }
14129 }
14130 ProcessInstantiationType(exp->instance);
14131 exp->isConstant = exp->instance->isConstant;
14132 if(exp->instance->_class)
14133 {
14134 exp->expType = MkClassType(exp->instance->_class->name);
14135 }
14136 break;
14137 }
14138 case 2:
14139 {
14140 if(!exp->expType)
14141 {
14142 char * constant = exp->constant;
14143 struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->refCount = 1, type->constant = 0x1, type);
14144
14145 exp->expType = type;
14146 if(constant[0] == '\'')
14147 {
14148 if((int)((unsigned char *)constant)[1] > 127)
14149 {
14150 int nb;
14151 unsigned int ch = __ecereNameSpace__ecere__sys__UTF8GetChar(constant + 1, &nb);
14152
14153 if(nb < 2)
14154 ch = constant[1];
14155 (__ecereNameSpace__ecere__com__eSystem_Delete(constant), constant = 0);
14156 exp->constant = PrintUInt(ch);
14157 type->kind = 8;
14158 type->_class = FindClass("unichar");
14159 type->isSigned = 0x0;
14160 }
14161 else
14162 {
14163 type->kind = 1;
14164 type->isSigned = 0x1;
14165 }
14166 }
14167 else
14168 {
14169 char * dot = strchr(constant, '.');
14170 unsigned int isHex = (constant[0] == '0' && (constant[1] == 'x' || constant[1] == 'X'));
14171 char * exponent;
14172
14173 if(isHex)
14174 {
14175 exponent = strchr(constant, 'p');
14176 if(!exponent)
14177 exponent = strchr(constant, 'P');
14178 }
14179 else
14180 {
14181 exponent = strchr(constant, 'e');
14182 if(!exponent)
14183 exponent = strchr(constant, 'E');
14184 }
14185 if(dot || exponent)
14186 {
14187 if(strchr(constant, 'f') || strchr(constant, 'F'))
14188 type->kind = 6;
14189 else
14190 type->kind = 7;
14191 type->isSigned = 0x1;
14192 }
14193 else
14194 {
14195 unsigned int isSigned = constant[0] == '-';
14196 char * endP = (((void *)0));
14197 long long i64 = strtoll(constant, &endP, 0);
14198 uint64 ui64 = strtoull(constant, &endP, 0);
14199 unsigned int is64Bit = endP && (!strcmp(endP, "LL") || !strcmp(endP, "ll"));
14200
14201 if(isSigned)
14202 {
14203 if(i64 < (((int)0x80000000)))
14204 is64Bit = 0x1;
14205 }
14206 else
14207 {
14208 if(ui64 > (((int)0x7fffffff)))
14209 {
14210 if(ui64 > (0xffffffff))
14211 {
14212 is64Bit = 0x1;
14213 if(ui64 <= (((long long)0x7fffffffffffffffLL)) && (constant[0] != '0' || !constant[1]))
14214 isSigned = 0x1;
14215 }
14216 }
14217 else if(constant[0] != '0' || !constant[1])
14218 isSigned = 0x1;
14219 }
14220 type->kind = is64Bit ? 4 : 3;
14221 type->isSigned = isSigned;
14222 }
14223 }
14224 exp->isConstant = 0x1;
14225 if(exp->destType && exp->destType->kind == 7)
14226 type->kind = 7;
14227 else if(exp->destType && exp->destType->kind == 6)
14228 type->kind = 6;
14229 else if(exp->destType && exp->destType->kind == 4)
14230 type->kind = 4;
14231 }
14232 break;
14233 }
14234 case 3:
14235 {
14236 exp->isConstant = 0x1;
14237 exp->expType = __extension__ ({
14238 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14239
14240 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
14241 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14242
14243 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 1, __ecereInstance1->constant = 0x1, __ecereInstance1->isSigned = 0x1, __ecereInstance1;
14244 }), __ecereInstance2;
14245 });
14246 break;
14247 }
14248 case 13:
14249 case 26:
14250 ProcessExpressionType(exp->_new.size);
14251 exp->expType = __extension__ ({
14252 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14253
14254 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_new.typeName->qualifiers, exp->_new.typeName->declarator), __ecereInstance1;
14255 });
14256 DeclareType(exp->expType->type, 0x0, 0x0);
14257 break;
14258 case 14:
14259 case 27:
14260 ProcessExpressionType(exp->_renew.size);
14261 ProcessExpressionType(exp->_renew.exp);
14262 exp->expType = __extension__ ({
14263 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14264
14265 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = ProcessType(exp->_renew.typeName->qualifiers, exp->_renew.typeName->declarator), __ecereInstance1;
14266 });
14267 DeclareType(exp->expType->type, 0x0, 0x0);
14268 break;
14269 case 4:
14270 {
14271 unsigned int assign = 0x0, boolResult = 0x0, boolOps = 0x0;
14272 struct Type * type1 = (((void *)0)), * type2 = (((void *)0));
14273 unsigned int useDestType = 0x0, useSideType = 0x0;
14274 struct Location oldyylloc = yylloc;
14275 unsigned int useSideUnit = 0x0;
14276 struct __ecereNameSpace__ecere__com__Class * destClass = (exp->destType && exp->destType->kind == 8 && exp->destType->_class) ? exp->destType->_class->registered : (((void *)0));
14277 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
14278
14279 switch(exp->op.op)
14280 {
14281 case '=':
14282 case MUL_ASSIGN:
14283 case DIV_ASSIGN:
14284 case MOD_ASSIGN:
14285 case ADD_ASSIGN:
14286 case SUB_ASSIGN:
14287 case LEFT_ASSIGN:
14288 case RIGHT_ASSIGN:
14289 case AND_ASSIGN:
14290 case XOR_ASSIGN:
14291 case OR_ASSIGN:
14292 assign = 0x1;
14293 break;
14294 case '!':
14295 break;
14296 case AND_OP:
14297 case OR_OP:
14298 boolOps = 0x1;
14299 boolResult = 0x1;
14300 break;
14301 case EQ_OP:
14302 case '<':
14303 case '>':
14304 case LE_OP:
14305 case GE_OP:
14306 case NE_OP:
14307 boolResult = 0x1;
14308 useSideType = 0x1;
14309 break;
14310 case '+':
14311 case '-':
14312 useSideUnit = 0x1;
14313 useSideType = 0x1;
14314 useDestType = 0x1;
14315 break;
14316 case LEFT_OP:
14317 case RIGHT_OP:
14318 useSideType = 0x1;
14319 useDestType = 0x1;
14320 break;
14321 case '|':
14322 case '^':
14323 useSideType = 0x1;
14324 useDestType = 0x1;
14325 break;
14326 case '/':
14327 case '%':
14328 useSideType = 0x1;
14329 useDestType = 0x1;
14330 break;
14331 case '&':
14332 case '*':
14333 if(exp->op.exp1)
14334 {
14335 useSideType = 0x1;
14336 useDestType = 0x1;
14337 }
14338 break;
14339 }
14340 if(exp->op.op == '&')
14341 {
14342 if(!exp->op.exp1 && exp->op.exp2 && exp->op.exp2->type == 0 && exp->op.exp2->identifier)
14343 {
14344 struct Identifier * id = exp->op.exp2->identifier;
14345 struct Symbol * symbol = FindSymbol(id->string, curContext, topContext, 0x0, id->_class && id->_class->name == (((void *)0)));
14346
14347 if(symbol && symbol->isIterator == 2)
14348 {
14349 exp->type = 8;
14350 exp->member.exp = exp->op.exp2;
14351 exp->member.member = MkIdentifier("key");
14352 exp->expType = (((void *)0));
14353 exp->op.exp2->expType = symbol->type;
14354 symbol->type->refCount++;
14355 ProcessExpressionType(exp);
14356 FreeType(dummy);
14357 break;
14358 }
14359 }
14360 }
14361 if(exp->op.exp1)
14362 {
14363 if(exp->op.exp2 && useSideUnit && useDestType && destClass && destClass->type == 3 && destClass->base->type != 3)
14364 useDestType = 0x0;
14365 if(destClass && useDestType && ((destClass->type == 3 && useSideUnit) || destClass->type == 4 || destClass->type == 2))
14366 {
14367 if(exp->op.exp1->destType)
14368 FreeType(exp->op.exp1->destType);
14369 exp->op.exp1->destType = exp->destType;
14370 exp->op.exp1->opDestType = 0x1;
14371 if(exp->destType)
14372 exp->destType->refCount++;
14373 }
14374 else if(!assign)
14375 {
14376 if(exp->op.exp1->destType)
14377 FreeType(exp->op.exp1->destType);
14378 exp->op.exp1->destType = dummy;
14379 dummy->refCount++;
14380 }
14381 if(exp->op.exp1->destType && exp->op.op != '=')
14382 exp->op.exp1->destType->count++;
14383 ProcessExpressionType(exp->op.exp1);
14384 if(exp->op.exp1->destType && exp->op.op != '=')
14385 exp->op.exp1->destType->count--;
14386 exp->op.exp1->opDestType = 0x0;
14387 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)
14388 {
14389 exp->op.exp2 = MkExpConstant("1");
14390 exp->op.op = exp->op.op == INC_OP ? ADD_ASSIGN : SUB_ASSIGN;
14391 assign = 0x1;
14392 }
14393 if(exp->op.exp1->destType == dummy)
14394 {
14395 FreeType(dummy);
14396 exp->op.exp1->destType = (((void *)0));
14397 }
14398 type1 = exp->op.exp1->expType;
14399 }
14400 if(exp->op.exp2)
14401 {
14402 char expString[10240];
14403
14404 expString[0] = '\0';
14405 if(exp->op.exp2->type == 1 && !exp->op.exp2->instance->_class)
14406 {
14407 if(exp->op.exp1)
14408 {
14409 exp->op.exp2->destType = exp->op.exp1->expType;
14410 if(exp->op.exp1->expType)
14411 exp->op.exp1->expType->refCount++;
14412 }
14413 else
14414 {
14415 exp->op.exp2->destType = exp->destType;
14416 if(!exp->op.exp1 || exp->op.op != '&')
14417 exp->op.exp2->opDestType = 0x1;
14418 if(exp->destType)
14419 exp->destType->refCount++;
14420 }
14421 if(type1)
14422 type1->refCount++;
14423 exp->expType = type1;
14424 }
14425 else if(assign)
14426 {
14427 if(inCompiler)
14428 PrintExpression(exp->op.exp2, expString);
14429 if(type1 && type1->kind == 13)
14430 {
14431 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)
14432 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "operator %s illegal on pointer\n", (((void *)0))), exp->op.op);
14433 else if(exp->op.op == '=')
14434 {
14435 if(exp->op.exp2->destType)
14436 FreeType(exp->op.exp2->destType);
14437 exp->op.exp2->destType = type1;
14438 if(type1)
14439 type1->refCount++;
14440 }
14441 }
14442 else
14443 {
14444 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)
14445 ;
14446 else
14447 {
14448 if(exp->op.exp2->destType)
14449 FreeType(exp->op.exp2->destType);
14450 exp->op.exp2->destType = type1;
14451 if(type1)
14452 type1->refCount++;
14453 }
14454 }
14455 if(type1)
14456 type1->refCount++;
14457 exp->expType = type1;
14458 }
14459 else if(destClass && ((destClass->type == 3 && useDestType && useSideUnit) || (destClass->type == 4 && useDestType)))
14460 {
14461 if(exp->op.exp2->destType)
14462 FreeType(exp->op.exp2->destType);
14463 exp->op.exp2->destType = exp->destType;
14464 if(exp->op.op != '&')
14465 exp->op.exp2->opDestType = 0x1;
14466 if(exp->destType)
14467 exp->destType->refCount++;
14468 }
14469 else
14470 {
14471 if(exp->op.exp2->destType)
14472 FreeType(exp->op.exp2->destType);
14473 exp->op.exp2->destType = dummy;
14474 dummy->refCount++;
14475 }
14476 if(type1 && boolResult && useSideType && type1->kind == 8 && type1->_class && type1->_class->registered && (type1->_class->registered->type == 2 || type1->_class->registered->type == 4))
14477 {
14478 FreeType(exp->op.exp2->destType);
14479 exp->op.exp2->destType = type1;
14480 type1->refCount++;
14481 }
14482 if(exp->op.exp2->destType && exp->op.op != '=')
14483 exp->op.exp2->destType->count++;
14484 if(exp->op.op == SIZEOF)
14485 {
14486 struct Expression * e = exp->op.exp2;
14487
14488 while((e->type == 5 || e->type == 32 || e->type == 23) && e->list)
14489 {
14490 if(e->type == 5 || e->type == 32 || e->type == 23)
14491 {
14492 if(e->type == 23)
14493 e = (*((struct Statement *)(*e->compound->compound.statements).last)->expressions).last;
14494 else
14495 e = (*e->list).last;
14496 }
14497 }
14498 if(e->type == 11 && e->cast.exp)
14499 e->cast.exp->needCast = 0x1;
14500 }
14501 ProcessExpressionType(exp->op.exp2);
14502 exp->op.exp2->opDestType = 0x0;
14503 if(exp->op.exp2->destType && exp->op.op != '=')
14504 exp->op.exp2->destType->count--;
14505 if(assign && type1 && type1->kind == 13 && exp->op.exp2->expType)
14506 {
14507 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)
14508 {
14509 if(exp->op.op != '=' && type1->type->kind == 0)
14510 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14511 }
14512 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)))
14513 {
14514 if(exp->op.op == ADD_ASSIGN)
14515 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14516 }
14517 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))
14518 {
14519 if(exp->op.op == ADD_ASSIGN)
14520 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14521 }
14522 else if(inCompiler)
14523 {
14524 char type1String[1024];
14525 char type2String[1024];
14526
14527 type1String[0] = '\0';
14528 type2String[0] = '\0';
14529 PrintType(exp->op.exp2->expType, type1String, 0x0, 0x1);
14530 PrintType(type1, type2String, 0x0, 0x1);
14531 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
14532 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1String, type2String);
14533 }
14534 }
14535 if(exp->op.exp2->destType == dummy)
14536 {
14537 FreeType(dummy);
14538 exp->op.exp2->destType = (((void *)0));
14539 }
14540 if(exp->op.op == '-' && !exp->op.exp1 && exp->op.exp2->expType && !exp->op.exp2->expType->isSigned)
14541 {
14542 type2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14543 type2->refCount = 1;
14544 CopyTypeInto(type2, exp->op.exp2->expType);
14545 type2->isSigned = 0x1;
14546 }
14547 else if(exp->op.op == '~' && !exp->op.exp1 && exp->op.exp2->expType && (!exp->op.exp2->expType->isSigned || exp->op.exp2->expType->kind != 3))
14548 {
14549 type2 = __extension__ ({
14550 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14551
14552 __ecereInstance1->kind = 3, __ecereInstance1;
14553 });
14554 type2->refCount = 1;
14555 type2->isSigned = 0x1;
14556 }
14557 else
14558 {
14559 type2 = exp->op.exp2->expType;
14560 if(type2)
14561 type2->refCount++;
14562 }
14563 }
14564 dummy->kind = 0;
14565 if(exp->op.op == SIZEOF)
14566 {
14567 exp->expType = __extension__ ({
14568 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14569
14570 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
14571 });
14572 exp->isConstant = 0x1;
14573 }
14574 else if(exp->op.op == '*' && !exp->op.exp1)
14575 {
14576 exp->expType = Dereference(type2);
14577 if(type2 && type2->kind == 8)
14578 notByReference = 0x1;
14579 }
14580 else if(exp->op.op == '&' && !exp->op.exp1)
14581 exp->expType = Reference(type2);
14582 else if(!assign)
14583 {
14584 if(boolOps)
14585 {
14586 if(exp->op.exp1)
14587 {
14588 if(exp->op.exp1->destType)
14589 FreeType(exp->op.exp1->destType);
14590 exp->op.exp1->destType = MkClassType("bool");
14591 exp->op.exp1->destType->truth = 0x1;
14592 if(!exp->op.exp1->expType)
14593 ProcessExpressionType(exp->op.exp1);
14594 else
14595 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14596 FreeType(exp->op.exp1->expType);
14597 exp->op.exp1->expType = MkClassType("bool");
14598 exp->op.exp1->expType->truth = 0x1;
14599 }
14600 if(exp->op.exp2)
14601 {
14602 if(exp->op.exp2->destType)
14603 FreeType(exp->op.exp2->destType);
14604 exp->op.exp2->destType = MkClassType("bool");
14605 exp->op.exp2->destType->truth = 0x1;
14606 if(!exp->op.exp2->expType)
14607 ProcessExpressionType(exp->op.exp2);
14608 else
14609 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14610 FreeType(exp->op.exp2->expType);
14611 exp->op.exp2->expType = MkClassType("bool");
14612 exp->op.exp2->expType->truth = 0x1;
14613 }
14614 }
14615 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")))))
14616 {
14617 if(type1 && type2 && ((type1->kind == 8 && type1->_class && strcmp(type1->_class->string, "String")) == (type2->kind == 8 && type2->_class && strcmp(type2->_class->string, "String"))))
14618 {
14619 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)))
14620 {
14621 struct Type * intType;
14622
14623 if(!type1->_class->registered->dataType)
14624 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14625 if(!type2->_class->registered->dataType)
14626 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14627 intType = ProcessTypeString((type1->_class->registered->dataType->kind == 4 || type2->_class->registered->dataType->kind == 4) ? "int64" : "int", 0x0);
14628 if(exp->op.exp1->destType)
14629 FreeType(exp->op.exp1->destType);
14630 if(exp->op.exp2->destType)
14631 FreeType(exp->op.exp2->destType);
14632 exp->op.exp1->destType = intType;
14633 exp->op.exp2->destType = intType;
14634 intType->refCount++;
14635 }
14636 else
14637 {
14638 if(exp->op.exp2->destType)
14639 FreeType(exp->op.exp2->destType);
14640 exp->op.exp2->destType = type1;
14641 type1->refCount++;
14642 if(exp->op.exp1->destType)
14643 FreeType(exp->op.exp1->destType);
14644 exp->op.exp1->destType = type2;
14645 type2->refCount++;
14646 }
14647 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)
14648 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);
14649 if(type1->kind == 13 && type1->type->kind == 20 && type2->kind != 13)
14650 {
14651 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14652
14653 if(argExp)
14654 {
14655 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14656
14657 exp->op.exp1 = MkExpBrackets(MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("byte")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp->op.exp1)));
14658 ProcessExpressionType(exp->op.exp1);
14659 if(type2->kind != 13)
14660 {
14661 ProcessExpressionType(classExp);
14662 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"))))))));
14663 if(!exp->op.exp2->expType)
14664 {
14665 if(type2)
14666 FreeType(type2);
14667 type2 = exp->op.exp2->expType = ProcessTypeString("int", 0x0);
14668 type2->refCount++;
14669 }
14670 ProcessExpressionType(exp->op.exp2);
14671 }
14672 }
14673 }
14674 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)))
14675 {
14676 if(type1->kind != 8 && type1->type->kind == 0)
14677 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14678 exp->expType = type1;
14679 if(type1)
14680 type1->refCount++;
14681 }
14682 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)))
14683 {
14684 if(type2->kind != 8 && type2->type->kind == 0)
14685 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "void *: unknown size\n", (((void *)0))));
14686 exp->expType = type2;
14687 if(type2)
14688 type2->refCount++;
14689 }
14690 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))
14691 {
14692 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "different levels of indirection\n", (((void *)0))));
14693 }
14694 else
14695 {
14696 unsigned int success = 0x0;
14697
14698 if(type1->kind == 13 && type2->kind == 13)
14699 {
14700 if(exp->op.op == '+')
14701 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "cannot add two pointers\n", (((void *)0))));
14702 else if(exp->op.op == '-')
14703 {
14704 if(MatchTypes(type1->type, type2->type, (((void *)0)), (((void *)0)), (((void *)0)), 0x0, 0x0, 0x0, 0x0))
14705 {
14706 exp->expType = __extension__ ({
14707 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
14708
14709 __ecereInstance1->kind = 3, __ecereInstance1->refCount = 1, __ecereInstance1;
14710 });
14711 success = 0x1;
14712 if(type1->type->kind == 20)
14713 {
14714 struct Expression * argExp = GetTemplateArgExp(type1->type->templateParameter, thisClass, 0x1);
14715
14716 if(argExp)
14717 {
14718 struct Expression * classExp = MkExpMember(argExp, MkIdentifier("dataTypeClass"));
14719
14720 ProcessExpressionType(classExp);
14721 exp->type = 5;
14722 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")))))));
14723 ProcessExpressionType(((struct Expression *)(*exp->list).first)->op.exp2);
14724 FreeType(dummy);
14725 return ;
14726 }
14727 }
14728 }
14729 }
14730 }
14731 if(!success && exp->op.exp1->type == 2)
14732 {
14733 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14734 {
14735 if(exp->expType)
14736 FreeType(exp->expType);
14737 exp->expType = exp->op.exp1->destType;
14738 if(exp->op.exp1->destType)
14739 exp->op.exp1->destType->refCount++;
14740 success = 0x1;
14741 }
14742 else if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14743 {
14744 if(exp->expType)
14745 FreeType(exp->expType);
14746 exp->expType = exp->op.exp2->destType;
14747 if(exp->op.exp2->destType)
14748 exp->op.exp2->destType->refCount++;
14749 success = 0x1;
14750 }
14751 }
14752 else if(!success)
14753 {
14754 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14755 {
14756 if(exp->expType)
14757 FreeType(exp->expType);
14758 exp->expType = exp->op.exp2->destType;
14759 if(exp->op.exp2->destType)
14760 exp->op.exp2->destType->refCount++;
14761 success = 0x1;
14762 }
14763 else if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14764 {
14765 if(exp->expType)
14766 FreeType(exp->expType);
14767 exp->expType = exp->op.exp1->destType;
14768 if(exp->op.exp1->destType)
14769 exp->op.exp1->destType->refCount++;
14770 success = 0x1;
14771 }
14772 }
14773 if(!success)
14774 {
14775 char expString1[10240];
14776 char expString2[10240];
14777 char type1[1024];
14778 char type2[1024];
14779
14780 expString1[0] = '\0';
14781 expString2[0] = '\0';
14782 type1[0] = '\0';
14783 type2[0] = '\0';
14784 if(inCompiler)
14785 {
14786 PrintExpression(exp->op.exp1, expString1);
14787 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
14788 PrintExpression(exp->op.exp2, expString2);
14789 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
14790 PrintType(exp->op.exp1->expType, type1, 0x0, 0x1);
14791 PrintType(exp->op.exp2->expType, type2, 0x0, 0x1);
14792 }
14793 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1, expString2, type2);
14794 }
14795 }
14796 }
14797 else if(!boolResult && (!useSideUnit) && type2 && type1 && type2->kind == 8 && type1->kind != 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
14798 {
14799 if(exp->op.exp1->destType)
14800 FreeType(exp->op.exp1->destType);
14801 exp->op.exp1->destType = type2->_class->registered->dataType;
14802 if(type2->_class->registered->dataType)
14803 type2->_class->registered->dataType->refCount++;
14804 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14805 exp->expType = type2;
14806 if(type2)
14807 type2->refCount++;
14808 }
14809 else if(!boolResult && (!useSideUnit) && type1 && type2 && type1->kind == 8 && type2->kind != 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
14810 {
14811 if(exp->op.exp2->destType)
14812 FreeType(exp->op.exp2->destType);
14813 exp->op.exp2->destType = type1->_class->registered->dataType;
14814 if(type1->_class->registered->dataType)
14815 type1->_class->registered->dataType->refCount++;
14816 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14817 exp->expType = type1;
14818 if(type1)
14819 type1->refCount++;
14820 }
14821 else if(type1)
14822 {
14823 unsigned int valid = 0x0;
14824
14825 if(!boolResult && useSideUnit && type1 && type1->kind == 8 && type1->_class->registered && type1->_class->registered->type == 3 && type2 && type2->kind != 8)
14826 {
14827 if(exp->op.exp2->destType)
14828 FreeType(exp->op.exp2->destType);
14829 if(!type1->_class->registered->dataType)
14830 type1->_class->registered->dataType = ProcessTypeString(type1->_class->registered->dataTypeString, 0x0);
14831 exp->op.exp2->destType = type1->_class->registered->dataType;
14832 exp->op.exp2->destType->refCount++;
14833 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
14834 if(type2)
14835 FreeType(type2);
14836 type2 = exp->op.exp2->destType;
14837 if(type2)
14838 type2->refCount++;
14839 exp->expType = type2;
14840 type2->refCount++;
14841 }
14842 if(!boolResult && useSideUnit && type2 && type2->kind == 8 && type2->_class->registered && type2->_class->registered->type == 3 && type1 && type1->kind != 8)
14843 {
14844 if(exp->op.exp1->destType)
14845 FreeType(exp->op.exp1->destType);
14846 if(!type2->_class->registered->dataType)
14847 type2->_class->registered->dataType = ProcessTypeString(type2->_class->registered->dataTypeString, 0x0);
14848 exp->op.exp1->destType = type2->_class->registered->dataType;
14849 exp->op.exp1->destType->refCount++;
14850 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
14851 type1 = exp->op.exp1->destType;
14852 exp->expType = type1;
14853 type1->refCount++;
14854 }
14855 if(!boolResult || exp->op.op == '>' || exp->op.op == '<' || exp->op.op == GE_OP || exp->op.op == LE_OP)
14856 {
14857 unsigned int op1IsEnum = type1 && type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4;
14858 unsigned int op2IsEnum = type2 && type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4;
14859
14860 if(exp->op.op == '*' || exp->op.op == '/' || exp->op.op == '-' || exp->op.op == '|' || exp->op.op == '^')
14861 {
14862 if(op1IsEnum && exp->op.exp2->expType)
14863 {
14864 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
14865 {
14866 if(exp->expType)
14867 FreeType(exp->expType);
14868 exp->expType = exp->op.exp2->expType;
14869 if(exp->op.exp2->expType)
14870 exp->op.exp2->expType->refCount++;
14871 valid = 0x1;
14872 }
14873 }
14874 else if(op2IsEnum && exp->op.exp1->expType)
14875 {
14876 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
14877 {
14878 if(exp->expType)
14879 FreeType(exp->expType);
14880 exp->expType = exp->op.exp1->expType;
14881 if(exp->op.exp1->expType)
14882 exp->op.exp1->expType->refCount++;
14883 valid = 0x1;
14884 }
14885 }
14886 }
14887 else
14888 {
14889 if(op1IsEnum && exp->op.exp2->expType)
14890 {
14891 if(CheckExpressionType(exp->op.exp1, exp->op.exp2->expType, 0x0))
14892 {
14893 if(exp->expType)
14894 FreeType(exp->expType);
14895 exp->expType = exp->op.exp1->expType;
14896 if(exp->op.exp1->expType)
14897 exp->op.exp1->expType->refCount++;
14898 valid = 0x1;
14899 }
14900 }
14901 else if(op2IsEnum && exp->op.exp1->expType)
14902 {
14903 if(CheckExpressionType(exp->op.exp2, exp->op.exp1->expType, 0x0))
14904 {
14905 if(exp->expType)
14906 FreeType(exp->expType);
14907 exp->expType = exp->op.exp2->expType;
14908 if(exp->op.exp2->expType)
14909 exp->op.exp2->expType->refCount++;
14910 valid = 0x1;
14911 }
14912 }
14913 }
14914 }
14915 if(!valid)
14916 {
14917 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))
14918 {
14919 if(exp->op.exp1->destType)
14920 FreeType(exp->op.exp1->destType);
14921 exp->op.exp1->destType = type2;
14922 type2->refCount++;
14923 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14924 {
14925 if(exp->expType)
14926 FreeType(exp->expType);
14927 exp->expType = exp->op.exp1->destType;
14928 if(exp->op.exp1->destType)
14929 exp->op.exp1->destType->refCount++;
14930 }
14931 }
14932 else
14933 {
14934 if(exp->op.exp2->destType)
14935 FreeType(exp->op.exp2->destType);
14936 exp->op.exp2->destType = type1;
14937 type1->refCount++;
14938 if(CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0))
14939 {
14940 if(exp->expType)
14941 FreeType(exp->expType);
14942 exp->expType = exp->op.exp2->destType;
14943 if(exp->op.exp2->destType)
14944 exp->op.exp2->destType->refCount++;
14945 }
14946 else if(type1 && type2)
14947 {
14948 char expString1[10240];
14949 char expString2[10240];
14950 char type1String[1024];
14951 char type2String[1024];
14952
14953 expString1[0] = '\0';
14954 expString2[0] = '\0';
14955 type1String[0] = '\0';
14956 type2String[0] = '\0';
14957 if(inCompiler)
14958 {
14959 PrintExpression(exp->op.exp1, expString1);
14960 __ecereNameSpace__ecere__sys__ChangeCh(expString1, '\n', ' ');
14961 PrintExpression(exp->op.exp2, expString2);
14962 __ecereNameSpace__ecere__sys__ChangeCh(expString2, '\n', ' ');
14963 PrintType(exp->op.exp1->expType, type1String, 0x0, 0x1);
14964 PrintType(exp->op.exp2->expType, type2String, 0x0, 0x1);
14965 }
14966 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expressions %s (%s) and %s (%s)\n", (((void *)0))), expString1, type1String, expString2, type2String);
14967 if(type1->kind == 8 && type1->_class && type1->_class->registered && type1->_class->registered->type == 4)
14968 {
14969 exp->expType = exp->op.exp1->expType;
14970 if(exp->op.exp1->expType)
14971 exp->op.exp1->expType->refCount++;
14972 }
14973 else if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
14974 {
14975 exp->expType = exp->op.exp2->expType;
14976 if(exp->op.exp2->expType)
14977 exp->op.exp2->expType->refCount++;
14978 }
14979 }
14980 }
14981 }
14982 }
14983 else if(type2)
14984 {
14985 if(type2->kind == 8 && type2->_class && type2->_class->registered && type2->_class->registered->type == 4)
14986 {
14987 struct Type * oldType = exp->op.exp1->expType;
14988
14989 exp->op.exp1->expType = (((void *)0));
14990 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
14991 FreeType(oldType);
14992 else
14993 exp->op.exp1->expType = oldType;
14994 }
14995 if(exp->op.exp1->destType)
14996 FreeType(exp->op.exp1->destType);
14997 exp->op.exp1->destType = type2;
14998 type2->refCount++;
14999 if(CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0))
15000 {
15001 if(exp->expType)
15002 FreeType(exp->expType);
15003 exp->expType = exp->op.exp1->destType;
15004 if(exp->op.exp1->destType)
15005 exp->op.exp1->destType->refCount++;
15006 }
15007 }
15008 }
15009 else if(type2 && (!type1 || (type2->kind == 8 && type1->kind != 8)))
15010 {
15011 if(type1 && type2->_class && type2->_class->registered && type2->_class->registered->type == 3)
15012 {
15013 if(exp->op.exp1->destType)
15014 FreeType(exp->op.exp1->destType);
15015 exp->op.exp1->destType = type2->_class->registered->dataType;
15016 if(type2->_class->registered->dataType)
15017 type2->_class->registered->dataType->refCount++;
15018 CheckExpressionType(exp->op.exp1, exp->op.exp1->destType, 0x0);
15019 }
15020 if(exp->op.op == '!')
15021 {
15022 exp->expType = MkClassType("bool");
15023 exp->expType->truth = 0x1;
15024 }
15025 else
15026 {
15027 exp->expType = type2;
15028 if(type2)
15029 type2->refCount++;
15030 }
15031 }
15032 else if(type1 && (!type2 || (type1->kind == 8 && type2->kind != 8)))
15033 {
15034 if(type2 && type1->_class && type1->_class->registered && type1->_class->registered->type == 3)
15035 {
15036 if(exp->op.exp2->destType)
15037 FreeType(exp->op.exp2->destType);
15038 exp->op.exp2->destType = type1->_class->registered->dataType;
15039 if(type1->_class->registered->dataType)
15040 type1->_class->registered->dataType->refCount++;
15041 CheckExpressionType(exp->op.exp2, exp->op.exp2->destType, 0x0);
15042 }
15043 exp->expType = type1;
15044 if(type1)
15045 type1->refCount++;
15046 }
15047 }
15048 yylloc = exp->loc;
15049 if(exp->op.exp1 && !exp->op.exp1->expType)
15050 {
15051 char expString[10000];
15052
15053 expString[0] = '\0';
15054 if(inCompiler)
15055 {
15056 PrintExpression(exp->op.exp1, expString);
15057 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15058 }
15059 if(expString[0])
15060 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15061 }
15062 if(exp->op.exp2 && !exp->op.exp2->expType)
15063 {
15064 char expString[10240];
15065
15066 expString[0] = '\0';
15067 if(inCompiler)
15068 {
15069 PrintExpression(exp->op.exp2, expString);
15070 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
15071 }
15072 if(expString[0])
15073 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
15074 }
15075 if(boolResult)
15076 {
15077 FreeType(exp->expType);
15078 exp->expType = MkClassType("bool");
15079 exp->expType->truth = 0x1;
15080 }
15081 if(exp->op.op != SIZEOF)
15082 exp->isConstant = (!exp->op.exp1 || exp->op.exp1->isConstant) && (!exp->op.exp2 || exp->op.exp2->isConstant);
15083 if(exp->op.op == SIZEOF && exp->op.exp2->expType)
15084 {
15085 DeclareType(exp->op.exp2->expType, 0x0, 0x0);
15086 }
15087 yylloc = oldyylloc;
15088 FreeType(dummy);
15089 if(type2)
15090 FreeType(type2);
15091 break;
15092 }
15093 case 5:
15094 case 32:
15095 {
15096 struct Expression * e;
15097
15098 exp->isConstant = 0x1;
15099 for(e = (*exp->list).first; e; e = e->next)
15100 {
15101 unsigned int inced = 0x0;
15102
15103 if(!e->next)
15104 {
15105 FreeType(e->destType);
15106 e->opDestType = exp->opDestType;
15107 e->destType = exp->destType;
15108 if(e->destType)
15109 {
15110 exp->destType->refCount++;
15111 e->destType->count++;
15112 inced = 0x1;
15113 }
15114 }
15115 ProcessExpressionType(e);
15116 if(inced)
15117 exp->destType->count--;
15118 if(!exp->expType && !e->next)
15119 {
15120 exp->expType = e->expType;
15121 if(e->expType)
15122 e->expType->refCount++;
15123 }
15124 if(!e->isConstant)
15125 exp->isConstant = 0x0;
15126 }
15127 e = (*exp->list).first;
15128 if(!e->next && e->type == 8)
15129 {
15130 struct Expression * next = exp->next, * prev = exp->prev;
15131
15132 FreeType(exp->expType);
15133 FreeType(exp->destType);
15134 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
15135 *exp = *e;
15136 exp->prev = prev;
15137 exp->next = next;
15138 ((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
15139 ProcessExpressionType(exp);
15140 }
15141 break;
15142 }
15143 case 6:
15144 {
15145 struct Expression * e;
15146
15147 exp->isConstant = 0x1;
15148 ProcessExpressionType(exp->index.exp);
15149 if(!exp->index.exp->isConstant)
15150 exp->isConstant = 0x0;
15151 if(exp->index.exp->expType)
15152 {
15153 struct Type * source = exp->index.exp->expType;
15154
15155 if(source->kind == 8 && source->_class && source->_class->registered)
15156 {
15157 struct __ecereNameSpace__ecere__com__Class * _class = source->_class->registered;
15158 struct __ecereNameSpace__ecere__com__Class * c = _class->templateClass ? _class->templateClass : _class;
15159
15160 if(_class != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(c, containerClass) && _class->templateArgs)
15161 {
15162 exp->expType = ProcessTypeString(_class->templateArgs[2].dataTypeString, 0x0);
15163 if(exp->index.index && (*exp->index.index).last)
15164 {
15165 ((struct Expression *)(*exp->index.index).last)->destType = ProcessTypeString(_class->templateArgs[1].dataTypeString, 0x0);
15166 }
15167 }
15168 }
15169 }
15170 for(e = (*exp->index.index).first; e; e = e->next)
15171 {
15172 if(!e->next && exp->index.exp->expType && exp->index.exp->expType->kind == 12 && exp->index.exp->expType->enumClass)
15173 {
15174 if(e->destType)
15175 FreeType(e->destType);
15176 e->destType = MkClassType(exp->index.exp->expType->enumClass->string);
15177 }
15178 ProcessExpressionType(e);
15179 if(!e->next)
15180 {
15181 }
15182 if(!e->isConstant)
15183 exp->isConstant = 0x0;
15184 }
15185 if(!exp->expType)
15186 exp->expType = Dereference(exp->index.exp->expType);
15187 if(exp->expType)
15188 DeclareType(exp->expType, 0x0, 0x0);
15189 break;
15190 }
15191 case 7:
15192 {
15193 struct Expression * e;
15194 struct Type * functionType;
15195 struct Type * methodType = (((void *)0));
15196 char name[1024];
15197
15198 name[0] = '\0';
15199 if(inCompiler)
15200 {
15201 PrintExpression(exp->call.exp, name);
15202 if(exp->call.exp->expType && !exp->call.exp->expType->returnType)
15203 {
15204 PrintExpression(exp->call.exp, name);
15205 }
15206 }
15207 if(exp->call.exp->type == 0)
15208 {
15209 struct Expression * idExp = exp->call.exp;
15210 struct Identifier * id = idExp->identifier;
15211
15212 if(!strcmp(id->string, "__builtin_frame_address"))
15213 {
15214 exp->expType = ProcessTypeString("void *", 0x1);
15215 if(exp->call.arguments && (*exp->call.arguments).first)
15216 ProcessExpressionType((*exp->call.arguments).first);
15217 break;
15218 }
15219 else if(!strcmp(id->string, "__ENDIAN_PAD"))
15220 {
15221 exp->expType = ProcessTypeString("int", 0x1);
15222 if(exp->call.arguments && (*exp->call.arguments).first)
15223 ProcessExpressionType((*exp->call.arguments).first);
15224 break;
15225 }
15226 else if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min") || !strcmp(id->string, "Sgn") || !strcmp(id->string, "Abs"))
15227 {
15228 struct Expression * a = (((void *)0));
15229 struct Expression * b = (((void *)0));
15230 struct Expression * tempExp1 = (((void *)0)), * tempExp2 = (((void *)0));
15231
15232 if((!strcmp(id->string, "Max") || !strcmp(id->string, "Min")) && (*exp->call.arguments).count == 2)
15233 {
15234 a = (*exp->call.arguments).first;
15235 b = (*exp->call.arguments).last;
15236 tempExp1 = a;
15237 tempExp2 = b;
15238 }
15239 else if((*exp->call.arguments).count == 1)
15240 {
15241 a = (*exp->call.arguments).first;
15242 tempExp1 = a;
15243 }
15244 if(a)
15245 {
15246 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Clear((&*exp->call.arguments));
15247 idExp->identifier = (((void *)0));
15248 FreeExpContents(exp);
15249 ProcessExpressionType(a);
15250 if(b)
15251 ProcessExpressionType(b);
15252 exp->type = 5;
15253 exp->list = MkList();
15254 if(a->expType && (!b || b->expType))
15255 {
15256 if((!a->isConstant && a->type != 0) || (b && !b->isConstant && b->type != 0))
15257 {
15258 if(inCompiler)
15259 {
15260 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15261 struct __ecereNameSpace__ecere__sys__OldList * decls = MkList();
15262 struct Declaration * decl;
15263 char temp1[1024], temp2[1024];
15264
15265 GetTypeSpecs(a->expType, specs);
15266 if(a && !a->isConstant && a->type != 0)
15267 {
15268 sprintf(temp1, "__simpleStruct%d", curContext->simpleID++);
15269 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp1)), (((void *)0))));
15270 tempExp1 = QMkExpId(temp1);
15271 tempExp1->expType = a->expType;
15272 if(a->expType)
15273 a->expType->refCount++;
15274 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp1), '=', a));
15275 }
15276 if(b && !b->isConstant && b->type != 0)
15277 {
15278 sprintf(temp2, "__simpleStruct%d", curContext->simpleID++);
15279 ListAdd(decls, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(temp2)), (((void *)0))));
15280 tempExp2 = QMkExpId(temp2);
15281 tempExp2->expType = b->expType;
15282 if(b->expType)
15283 b->expType->refCount++;
15284 ListAdd(exp->list, MkExpOp(CopyExpression(tempExp2), '=', b));
15285 }
15286 decl = MkDeclaration(specs, decls);
15287 if(!curCompound->compound.declarations)
15288 curCompound->compound.declarations = MkList();
15289 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->compound.declarations), (((void *)0)), decl);
15290 }
15291 }
15292 }
15293 if(!strcmp(id->string, "Max") || !strcmp(id->string, "Min"))
15294 {
15295 int op = (!strcmp(id->string, "Max")) ? '>' : '<';
15296
15297 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), op, CopyExpression(tempExp2)))), MkListOne(CopyExpression(tempExp1)), CopyExpression(tempExp2)));
15298 exp->expType = a->expType;
15299 if(a->expType)
15300 a->expType->refCount++;
15301 }
15302 else if(!strcmp(id->string, "Abs"))
15303 {
15304 ListAdd(exp->list, MkExpCondition(MkExpBrackets(MkListOne(MkExpOp(CopyExpression(tempExp1), '<', MkExpConstant("0")))), MkListOne(MkExpOp((((void *)0)), '-', CopyExpression(tempExp1))), CopyExpression(tempExp1)));
15305 exp->expType = a->expType;
15306 if(a->expType)
15307 a->expType->refCount++;
15308 }
15309 else if(!strcmp(id->string, "Sgn"))
15310 {
15311 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"))))));
15312 exp->expType = ProcessTypeString("int", 0x0);
15313 }
15314 FreeExpression(tempExp1);
15315 if(tempExp2)
15316 FreeExpression(tempExp2);
15317 FreeIdentifier(id);
15318 break;
15319 }
15320 }
15321 }
15322 {
15323 struct Type * dummy = (dummy = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), dummy->count = 1, dummy->refCount = 1, dummy);
15324
15325 if(!exp->call.exp->destType)
15326 {
15327 exp->call.exp->destType = dummy;
15328 dummy->refCount++;
15329 }
15330 ProcessExpressionType(exp->call.exp);
15331 if(exp->call.exp->destType == dummy)
15332 {
15333 FreeType(dummy);
15334 exp->call.exp->destType = (((void *)0));
15335 }
15336 FreeType(dummy);
15337 }
15338 functionType = exp->call.exp->expType;
15339 if(functionType && functionType->kind == 16)
15340 {
15341 methodType = functionType;
15342 functionType = methodType->method->dataType;
15343 if(exp->call.exp->expType->usedClass)
15344 {
15345 char typeString[1024];
15346
15347 typeString[0] = '\0';
15348 {
15349 struct Symbol * back = functionType->thisClass;
15350
15351 functionType->thisClass = (((void *)0));
15352 PrintType(functionType, typeString, 0x1, 0x1);
15353 functionType->thisClass = back;
15354 }
15355 if(strstr(typeString, "thisclass"))
15356 {
15357 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15358 struct Declarator * decl;
15359
15360 {
15361 struct Context * context = SetupTemplatesContext(exp->call.exp->expType->usedClass);
15362
15363 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
15364 if(thisClass != (exp->call.exp->expType->usedClass->templateClass ? exp->call.exp->expType->usedClass->templateClass : exp->call.exp->expType->usedClass))
15365 thisClassParams = 0x0;
15366 ReplaceThisClassSpecifiers(specs, exp->call.exp->expType->usedClass);
15367 {
15368 struct __ecereNameSpace__ecere__com__Class * backupThisClass = thisClass;
15369
15370 thisClass = exp->call.exp->expType->usedClass;
15371 ProcessDeclarator(decl);
15372 thisClass = backupThisClass;
15373 }
15374 thisClassParams = 0x1;
15375 functionType = ProcessType(specs, decl);
15376 functionType->refCount = 0;
15377 FinishTemplatesContext(context);
15378 }
15379 FreeList(specs, FreeSpecifier);
15380 FreeDeclarator(decl);
15381 }
15382 }
15383 }
15384 if(functionType && functionType->kind == 13 && functionType->type && functionType->type->kind == 11)
15385 {
15386 struct Type * type = functionType->type;
15387
15388 if(!functionType->refCount)
15389 {
15390 functionType->type = (((void *)0));
15391 FreeType(functionType);
15392 }
15393 functionType = type;
15394 }
15395 if(functionType && functionType->kind != 11)
15396 {
15397 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "called object %s is not a function\n", (((void *)0))), name);
15398 }
15399 else if(functionType)
15400 {
15401 unsigned int emptyParams = 0x0, noParams = 0x0;
15402 struct Expression * e = exp->call.arguments ? (*exp->call.arguments).first : (((void *)0));
15403 struct Type * type = functionType->params.first;
15404 struct Expression * memberExp = (exp->call.exp->type == 8) ? exp->call.exp : (((void *)0));
15405 int extra = 0;
15406 struct Location oldyylloc = yylloc;
15407
15408 if(!type)
15409 emptyParams = 0x1;
15410 if(functionType->extraParam && e && functionType->thisClass)
15411 {
15412 e->destType = MkClassType(functionType->thisClass->string);
15413 e = e->next;
15414 }
15415 if(!functionType->staticMethod && !functionType->extraParam)
15416 {
15417 if(memberExp && memberExp->member.exp && memberExp->member.exp->expType && memberExp->member.exp->expType->kind == 19 && memberExp->member.exp->expType->_class)
15418 {
15419 type = MkClassType(memberExp->member.exp->expType->_class->string);
15420 if(e)
15421 {
15422 e->destType = type;
15423 e = e->next;
15424 type = functionType->params.first;
15425 }
15426 else
15427 type->refCount = 0;
15428 }
15429 else if(!memberExp && (functionType->thisClass || (methodType && methodType->methodClass)))
15430 {
15431 type = MkClassType(functionType->thisClass ? functionType->thisClass->string : (methodType ? methodType->methodClass->fullName : (((void *)0))));
15432 type->byReference = functionType->byReference;
15433 type->typedByReference = functionType->typedByReference;
15434 if(e)
15435 {
15436 if(e->next && type->kind == 8 && (functionType && functionType->thisClass) && functionType->classObjectType == 2)
15437 e = e->next;
15438 e->destType = type;
15439 e = e->next;
15440 type = functionType->params.first;
15441 }
15442 else
15443 type->refCount = 0;
15444 }
15445 }
15446 if(type && type->kind == 0)
15447 {
15448 noParams = 0x1;
15449 if(!type->refCount)
15450 FreeType(type);
15451 type = (((void *)0));
15452 }
15453 for(; e; e = e->next)
15454 {
15455 if(!type && !emptyParams)
15456 {
15457 yylloc = e->loc;
15458 if(methodType && methodType->methodClass)
15459 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);
15460 else
15461 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);
15462 break;
15463 }
15464 if(methodType && type && type->kind == 20 && type->templateParameter->type == 0)
15465 {
15466 struct Type * templatedType = (((void *)0));
15467 struct __ecereNameSpace__ecere__com__Class * _class = methodType->usedClass;
15468 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
15469 int id = 0;
15470
15471 if(_class && _class->templateArgs)
15472 {
15473 struct __ecereNameSpace__ecere__com__Class * sClass;
15474
15475 for(sClass = _class; sClass; sClass = sClass->base)
15476 {
15477 if(sClass->templateClass)
15478 sClass = sClass->templateClass;
15479 id = 0;
15480 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
15481 {
15482 if(curParam->type == 0 && !strcmp(type->templateParameter->identifier->string, curParam->name))
15483 {
15484 struct __ecereNameSpace__ecere__com__Class * nextClass;
15485
15486 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15487 {
15488 if(nextClass->templateClass)
15489 nextClass = nextClass->templateClass;
15490 id += nextClass->templateParams.count;
15491 }
15492 break;
15493 }
15494 id++;
15495 }
15496 if(curParam)
15497 break;
15498 }
15499 }
15500 if(curParam && _class->templateArgs[id].dataTypeString)
15501 {
15502 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = _class->templateArgs[id];
15503
15504 {
15505 struct Context * context = SetupTemplatesContext(_class);
15506
15507 templatedType = ProcessTypeString(arg.dataTypeString, 0x0);
15508 FinishTemplatesContext(context);
15509 }
15510 e->destType = templatedType;
15511 if(templatedType)
15512 {
15513 templatedType->passAsTemplate = 0x1;
15514 }
15515 }
15516 else
15517 {
15518 e->destType = type;
15519 if(type)
15520 type->refCount++;
15521 }
15522 }
15523 else
15524 {
15525 if(type && type->kind == 14 && type->prev && type->prev->kind == 8 && type->prev->classObjectType)
15526 {
15527 e->destType = type->prev;
15528 e->destType->refCount++;
15529 }
15530 else
15531 {
15532 e->destType = type;
15533 if(type)
15534 type->refCount++;
15535 }
15536 }
15537 if(type && type->kind != 14)
15538 {
15539 struct Type * next = type->next;
15540
15541 if(!type->refCount)
15542 FreeType(type);
15543 type = next;
15544 }
15545 }
15546 if(type && type->kind != 14)
15547 {
15548 if(methodType && methodType->methodClass)
15549 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);
15550 else
15551 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);
15552 }
15553 yylloc = oldyylloc;
15554 if(type && !type->refCount)
15555 FreeType(type);
15556 }
15557 else
15558 {
15559 functionType = __extension__ ({
15560 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15561
15562 __ecereInstance1->refCount = 0, __ecereInstance1->kind = 11, __ecereInstance1;
15563 });
15564 if(exp->call.exp->type == 0)
15565 {
15566 char * string = exp->call.exp->identifier->string;
15567
15568 if(inCompiler)
15569 {
15570 struct Symbol * symbol;
15571 struct Location oldyylloc = yylloc;
15572
15573 yylloc = exp->call.exp->identifier->loc;
15574 if(strstr(string, "__builtin_") == string)
15575 {
15576 if(exp->destType)
15577 {
15578 functionType->returnType = exp->destType;
15579 exp->destType->refCount++;
15580 }
15581 }
15582 else
15583 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "%s undefined; assuming extern returning int\n", (((void *)0))), string);
15584 symbol = __extension__ ({
15585 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
15586
15587 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString(string), __ecereInstance1->type = ProcessTypeString("int()", 0x1), __ecereInstance1;
15588 });
15589 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)symbol);
15590 if(strstr(symbol->string, "::"))
15591 globalContext->hasNameSpace = 0x1;
15592 yylloc = oldyylloc;
15593 }
15594 }
15595 else if(exp->call.exp->type == 8)
15596 {
15597 }
15598 else
15599 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "callable object undefined; extern assuming returning int\n", (((void *)0))));
15600 if(!functionType->returnType)
15601 {
15602 functionType->returnType = __extension__ ({
15603 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
15604
15605 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
15606 });
15607 }
15608 }
15609 if(functionType && functionType->kind == 11)
15610 {
15611 exp->expType = functionType->returnType;
15612 if(functionType->returnType)
15613 functionType->returnType->refCount++;
15614 if(!functionType->refCount)
15615 FreeType(functionType);
15616 }
15617 if(exp->call.arguments)
15618 {
15619 for(e = (*exp->call.arguments).first; e; e = e->next)
15620 {
15621 struct Type * destType = e->destType;
15622
15623 ProcessExpressionType(e);
15624 }
15625 }
15626 break;
15627 }
15628 case 8:
15629 {
15630 struct Type * type;
15631 struct Location oldyylloc = yylloc;
15632 unsigned int thisPtr;
15633 struct Expression * checkExp = exp->member.exp;
15634
15635 while(checkExp)
15636 {
15637 if(checkExp->type == 11)
15638 checkExp = checkExp->cast.exp;
15639 else if(checkExp->type == 5)
15640 checkExp = checkExp->list ? (*checkExp->list).first : (((void *)0));
15641 else
15642 break;
15643 }
15644 thisPtr = (checkExp && checkExp->type == 0 && !strcmp(checkExp->identifier->string, "this"));
15645 exp->thisPtr = thisPtr;
15646 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
15647 {
15648 exp->member.member->classSym = exp->member.member->_class->symbol;
15649 }
15650 ProcessExpressionType(exp->member.exp);
15651 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)
15652 {
15653 exp->isConstant = 0x0;
15654 }
15655 else
15656 exp->isConstant = exp->member.exp->isConstant;
15657 type = exp->member.exp->expType;
15658 yylloc = exp->loc;
15659 if(type && (type->kind == 20))
15660 {
15661 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
15662 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param = (((void *)0));
15663
15664 if(_class)
15665 {
15666 for(param = _class->templateParams.first; param; param = param->next)
15667 {
15668 if(param->type == 1 && exp->member.member && exp->member.member->string && !strcmp(param->name, exp->member.member->string))
15669 break;
15670 }
15671 }
15672 if(param && param->defaultArg.member)
15673 {
15674 struct Expression * argExp = GetTemplateArgExpByName(param->name, thisClass, 1);
15675
15676 if(argExp)
15677 {
15678 struct Expression * expMember = exp->member.exp;
15679 struct Declarator * decl;
15680 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15681 char thisClassTypeString[1024];
15682
15683 FreeIdentifier(exp->member.member);
15684 ProcessExpressionType(argExp);
15685 {
15686 char * colon = strstr(param->defaultArg.memberString, "::");
15687
15688 if(colon)
15689 {
15690 char className[1024];
15691 struct __ecereNameSpace__ecere__com__Class * sClass;
15692
15693 memcpy(thisClassTypeString, param->defaultArg.memberString, colon - param->defaultArg.memberString);
15694 thisClassTypeString[colon - param->defaultArg.memberString] = '\0';
15695 }
15696 else
15697 strcpy(thisClassTypeString, _class->fullName);
15698 }
15699 decl = SpecDeclFromString(param->defaultArg.member->dataTypeString, specs, (((void *)0)));
15700 exp->expType = ProcessType(specs, decl);
15701 if(exp->expType->kind == 8 && exp->expType->_class && exp->expType->_class->registered && exp->expType->_class->registered->templateClass)
15702 {
15703 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
15704 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
15705 int c;
15706 int paramCount = 0;
15707 int lastParam = -1;
15708 char templateString[1024];
15709 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
15710
15711 sprintf(templateString, "%s<", expClass->templateClass->fullName);
15712 for(cClass = expClass; cClass; cClass = cClass->base)
15713 {
15714 int p = 0;
15715
15716 for(param = cClass->templateParams.first; param; param = param->next)
15717 {
15718 int id = p;
15719 struct __ecereNameSpace__ecere__com__Class * sClass;
15720 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
15721
15722 for(sClass = cClass->base; sClass; sClass = sClass->base)
15723 id += sClass->templateParams.count;
15724 arg = expClass->templateArgs[id];
15725 for(sClass = _class; sClass; sClass = sClass->base)
15726 {
15727 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * cParam;
15728 int p = 0;
15729 struct __ecereNameSpace__ecere__com__Class * nextClass;
15730
15731 for(nextClass = sClass->base; nextClass; nextClass = nextClass->base)
15732 p += nextClass->templateParams.count;
15733 for(cParam = sClass->templateParams.first; cParam; cParam = cParam->next, p++)
15734 {
15735 if(cParam->type == 0 && arg.dataTypeString && !strcmp(cParam->name, arg.dataTypeString))
15736 {
15737 if(_class->templateArgs && arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15738 {
15739 arg.dataTypeString = _class->templateArgs[p].dataTypeString;
15740 arg.dataTypeClass = _class->templateArgs[p].dataTypeClass;
15741 break;
15742 }
15743 }
15744 }
15745 }
15746 {
15747 char argument[256];
15748
15749 argument[0] = '\0';
15750 switch(param->type)
15751 {
15752 case 2:
15753 {
15754 char expString[1024];
15755 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
15756 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
15757 struct Expression * exp;
15758 char * string = PrintHexUInt64(arg.expression.ui64);
15759
15760 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
15761 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
15762 ProcessExpressionType(exp);
15763 ComputeExpression(exp);
15764 expString[0] = '\0';
15765 PrintExpression(exp, expString);
15766 strcat(argument, expString);
15767 FreeExpression(exp);
15768 break;
15769 }
15770 case 1:
15771 {
15772 strcat(argument, arg.member->name);
15773 break;
15774 }
15775 case 0:
15776 {
15777 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
15778 {
15779 if(!strcmp(arg.dataTypeString, "thisclass"))
15780 strcat(argument, thisClassTypeString);
15781 else
15782 strcat(argument, arg.dataTypeString);
15783 }
15784 break;
15785 }
15786 }
15787 if(argument[0])
15788 {
15789 if(paramCount)
15790 strcat(templateString, ", ");
15791 if(lastParam != p - 1)
15792 {
15793 strcat(templateString, param->name);
15794 strcat(templateString, " = ");
15795 }
15796 strcat(templateString, argument);
15797 paramCount++;
15798 lastParam = p;
15799 }
15800 p++;
15801 }
15802 }
15803 }
15804 {
15805 int len = strlen(templateString);
15806
15807 if(templateString[len - 1] == '>')
15808 templateString[len++] = ' ';
15809 templateString[len++] = '>';
15810 templateString[len++] = '\0';
15811 }
15812 {
15813 struct Context * context = SetupTemplatesContext(_class);
15814
15815 FreeType(exp->expType);
15816 exp->expType = ProcessTypeString(templateString, 0x0);
15817 FinishTemplatesContext(context);
15818 }
15819 }
15820 exp->type = 5;
15821 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")))))))));
15822 }
15823 }
15824 else if(type->templateParameter && type->templateParameter->type == 0 && (type->templateParameter->dataType || type->templateParameter->dataTypeString))
15825 {
15826 type = ProcessTemplateParameterType(type->templateParameter);
15827 }
15828 }
15829 if(type && (type->kind == 20))
15830 ;
15831 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)))
15832 {
15833 struct Identifier * id = exp->member.member;
15834 int typeKind = type->kind;
15835 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));
15836
15837 if(typeKind == 19 && exp->member.exp->type == 24)
15838 {
15839 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "ecere::com::Class");
15840 typeKind = 8;
15841 }
15842 if(id)
15843 {
15844 if(typeKind == 3 || typeKind == 15)
15845 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "int");
15846 else if(!_class)
15847 {
15848 if(type->kind == 8 && type->_class && type->_class->registered)
15849 {
15850 _class = type->_class->registered;
15851 }
15852 else if((type->kind == 12 || type->kind == 13) && type->type && type->type->kind == 1)
15853 {
15854 _class = FindClass("char *")->registered;
15855 }
15856 else if(type->kind == 13)
15857 {
15858 _class = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "uintptr");
15859 FreeType(exp->expType);
15860 exp->expType = ProcessTypeString("uintptr", 0x0);
15861 exp->byReference = 0x1;
15862 }
15863 else
15864 {
15865 char string[1024] = "";
15866 struct Symbol * classSym;
15867
15868 PrintTypeNoConst(type, string, 0x0, 0x1);
15869 classSym = FindClass(string);
15870 if(classSym)
15871 _class = classSym->registered;
15872 }
15873 }
15874 }
15875 if(_class && id)
15876 {
15877 struct __ecereNameSpace__ecere__com__Property * prop = (((void *)0));
15878 struct __ecereNameSpace__ecere__com__Method * method = (((void *)0));
15879 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
15880 struct __ecereNameSpace__ecere__com__Property * revConvert = (((void *)0));
15881 struct __ecereNameSpace__ecere__com__ClassProperty * classProp = (((void *)0));
15882
15883 if(id && id->_class && id->_class->name && !strcmp(id->_class->name, "property"))
15884 exp->member.memberType = 1;
15885 if(id && id->_class && type->_class && !__ecereNameSpace__ecere__com__eClass_IsDerived(type->_class->registered, _class))
15886 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "invalid class specifier %s for object of class %s\n", (((void *)0))), _class->fullName, type->_class->string);
15887 if(typeKind != 19)
15888 {
15889 if((exp->member.memberType == 0 && thisPtr) || exp->member.memberType == 3)
15890 {
15891 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
15892 if(member && member->_class != (_class->templateClass ? _class->templateClass : _class) && exp->member.memberType != 3)
15893 {
15894 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15895 if(prop)
15896 member = (((void *)0));
15897 }
15898 if(!member && !prop)
15899 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15900 if((member && member->_class == (_class->templateClass ? _class->templateClass : _class)) || (prop && prop->_class == (_class->templateClass ? _class->templateClass : _class)))
15901 exp->member.thisPtr = 0x1;
15902 }
15903 else
15904 {
15905 if(!id->classSym)
15906 {
15907 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, (((void *)0)));
15908 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
15909 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, (((void *)0)), (((void *)0)), (((void *)0)));
15910 }
15911 if(!prop && !member)
15912 {
15913 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, (((void *)0)));
15914 if(!method)
15915 {
15916 prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, id->string, privateModule);
15917 if(!id->_class || !id->_class->name || strcmp(id->_class->name, "property"))
15918 member = __ecereNameSpace__ecere__com__eClass_FindDataMember(_class, id->string, privateModule, (((void *)0)), (((void *)0)));
15919 }
15920 }
15921 if(member && prop)
15922 {
15923 if(member->_class != prop->_class && !id->_class && __ecereNameSpace__ecere__com__eClass_IsDerived(member->_class, prop->_class))
15924 prop = (((void *)0));
15925 else
15926 member = (((void *)0));
15927 }
15928 }
15929 }
15930 if(!prop && !member && !method)
15931 method = __ecereNameSpace__ecere__com__eClass_FindMethod(_class, id->string, privateModule);
15932 if(!prop && !member && !method)
15933 {
15934 if(typeKind == 19)
15935 {
15936 classProp = __ecereNameSpace__ecere__com__eClass_FindClassProperty(type->_class->registered, exp->member.member->string);
15937 if(classProp)
15938 {
15939 exp->member.memberType = 5;
15940 exp->expType = ProcessTypeString(classProp->dataTypeString, 0x0);
15941 }
15942 else
15943 {
15944 char structName[1024];
15945 struct Identifier * id = exp->member.member;
15946 struct Expression * classExp = exp->member.exp;
15947
15948 type->refCount++;
15949 FreeType(classExp->expType);
15950 classExp->expType = ProcessTypeString("ecere::com::Class", 0x0);
15951 strcpy(structName, "__ecereClassData_");
15952 FullClassNameCat(structName, type->_class->string, 0x0);
15953 exp->type = 9;
15954 exp->member.member = id;
15955 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"))))))));
15956 FreeType(type);
15957 ProcessExpressionType(exp);
15958 return ;
15959 }
15960 }
15961 else
15962 {
15963 struct Symbol * classSym = FindClass(id->string);
15964
15965 if(classSym)
15966 {
15967 struct __ecereNameSpace__ecere__com__Class * convertClass = classSym->registered;
15968
15969 if(convertClass)
15970 revConvert = __ecereNameSpace__ecere__com__eClass_FindProperty(convertClass, _class->fullName, privateModule);
15971 }
15972 }
15973 }
15974 if(prop)
15975 {
15976 exp->member.memberType = 1;
15977 if(!prop->dataType)
15978 ProcessPropertyType(prop);
15979 exp->expType = prop->dataType;
15980 if(prop->dataType)
15981 prop->dataType->refCount++;
15982 }
15983 else if(member)
15984 {
15985 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
15986 {
15987 FreeExpContents(exp);
15988 exp->type = 0;
15989 exp->identifier = MkIdentifier("class");
15990 ProcessExpressionType(exp);
15991 return ;
15992 }
15993 exp->member.memberType = 3;
15994 DeclareStruct(_class->fullName, 0x0);
15995 if(!member->dataType)
15996 {
15997 struct Context * context = SetupTemplatesContext(_class);
15998
15999 member->dataType = ProcessTypeString(member->dataTypeString, 0x0);
16000 FinishTemplatesContext(context);
16001 }
16002 exp->expType = member->dataType;
16003 if(member->dataType)
16004 member->dataType->refCount++;
16005 }
16006 else if(revConvert)
16007 {
16008 exp->member.memberType = 4;
16009 exp->expType = MkClassType(revConvert->_class->fullName);
16010 }
16011 else if(method)
16012 {
16013 {
16014 exp->member.memberType = 2;
16015 }
16016 if(!method->dataType)
16017 ProcessMethodType(method);
16018 exp->expType = __extension__ ({
16019 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16020
16021 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 16, __ecereInstance1->method = method, __ecereInstance1;
16022 });
16023 exp->expType->methodClass = (id && id->_class) ? _class : (((void *)0));
16024 exp->expType->usedClass = _class;
16025 }
16026 else if(!classProp)
16027 {
16028 if(exp->member.exp->expType->classObjectType == 2 && !strcmp(exp->member.member->string, "_class"))
16029 {
16030 FreeExpContents(exp);
16031 exp->type = 0;
16032 exp->identifier = MkIdentifier("class");
16033 FreeType(exp->expType);
16034 exp->expType = MkClassType("ecere::com::Class");
16035 return ;
16036 }
16037 yylloc = exp->member.member->loc;
16038 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't find member %s in class %s\n", (((void *)0))), id->string, _class->fullName);
16039 if(inCompiler)
16040 __ecereNameSpace__ecere__com__eClass_AddDataMember(_class, id->string, "int", 0, 0, 1);
16041 }
16042 if(_class && exp->expType)
16043 {
16044 struct __ecereNameSpace__ecere__com__Class * tClass;
16045
16046 tClass = _class;
16047 while(tClass && !tClass->templateClass)
16048 tClass = tClass->base;
16049 if(tClass && exp->expType->kind == 20 && exp->expType->templateParameter->type == 0)
16050 {
16051 int id = 0;
16052 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16053 struct __ecereNameSpace__ecere__com__Class * sClass;
16054
16055 for(sClass = tClass; sClass; sClass = sClass->base)
16056 {
16057 id = 0;
16058 if(sClass->templateClass)
16059 sClass = sClass->templateClass;
16060 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16061 {
16062 if(curParam->type == 0 && !strcmp(exp->expType->templateParameter->identifier->string, curParam->name))
16063 {
16064 for(sClass = sClass->base; sClass; sClass = sClass->base)
16065 id += sClass->templateParams.count;
16066 break;
16067 }
16068 id++;
16069 }
16070 if(curParam)
16071 break;
16072 }
16073 if(curParam && tClass->templateArgs[id].dataTypeString)
16074 {
16075 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16076 struct Context * context = SetupTemplatesContext(tClass);
16077
16078 FreeType(exp->expType);
16079 exp->expType = ProcessTypeString(arg.dataTypeString, 0x0);
16080 if(exp->expType)
16081 {
16082 if(exp->expType->kind == 21)
16083 {
16084 FreeType(exp->expType);
16085 exp->expType = ReplaceThisClassType(_class);
16086 }
16087 if(tClass->templateClass)
16088 exp->expType->passAsTemplate = 0x1;
16089 if(!exp->destType)
16090 {
16091 exp->destType = ProcessTypeString(arg.dataTypeString, 0x0);
16092 if(exp->destType->kind == 21)
16093 {
16094 FreeType(exp->destType);
16095 exp->destType = ReplaceThisClassType(_class);
16096 }
16097 }
16098 }
16099 FinishTemplatesContext(context);
16100 }
16101 }
16102 else if(tClass && exp->expType->kind == 13 && exp->expType->type && exp->expType->type->kind == 20 && exp->expType->type->templateParameter->type == 0)
16103 {
16104 int id = 0;
16105 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * curParam = (((void *)0));
16106 struct __ecereNameSpace__ecere__com__Class * sClass;
16107
16108 for(sClass = tClass; sClass; sClass = sClass->base)
16109 {
16110 id = 0;
16111 if(sClass->templateClass)
16112 sClass = sClass->templateClass;
16113 for(curParam = sClass->templateParams.first; curParam; curParam = curParam->next)
16114 {
16115 if(curParam->type == 0 && !strcmp(exp->expType->type->templateParameter->identifier->string, curParam->name))
16116 {
16117 for(sClass = sClass->base; sClass; sClass = sClass->base)
16118 id += sClass->templateParams.count;
16119 break;
16120 }
16121 id++;
16122 }
16123 if(curParam)
16124 break;
16125 }
16126 if(curParam)
16127 {
16128 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg = tClass->templateArgs[id];
16129 struct Context * context = SetupTemplatesContext(tClass);
16130 struct Type * basicType;
16131
16132 basicType = ProcessTypeString(arg.dataTypeString, 0x0);
16133 if(basicType)
16134 {
16135 if(basicType->kind == 21)
16136 {
16137 FreeType(basicType);
16138 basicType = ReplaceThisClassType(_class);
16139 }
16140 FreeType(exp->expType);
16141 exp->expType = __extension__ ({
16142 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16143
16144 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 13, __ecereInstance1->type = basicType, __ecereInstance1;
16145 });
16146 if(!exp->destType)
16147 {
16148 exp->destType = exp->expType;
16149 exp->destType->refCount++;
16150 }
16151 {
16152 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16153 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16154 struct Declarator * decl;
16155
16156 decl = SpecDeclFromString(arg.dataTypeString, specs, (((void *)0)));
16157 *newExp = *exp;
16158 if(exp->destType)
16159 exp->destType->refCount++;
16160 if(exp->expType)
16161 exp->expType->refCount++;
16162 exp->type = 11;
16163 exp->cast.typeName = MkTypeName(specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl));
16164 exp->cast.exp = newExp;
16165 }
16166 }
16167 FinishTemplatesContext(context);
16168 }
16169 }
16170 else if(tClass && exp->expType->kind == 8 && exp->expType->_class && strchr(exp->expType->_class->string, '<'))
16171 {
16172 struct __ecereNameSpace__ecere__com__Class * expClass = exp->expType->_class->registered;
16173
16174 if(expClass)
16175 {
16176 struct __ecereNameSpace__ecere__com__Class * cClass = (((void *)0));
16177 int c;
16178 int p = 0;
16179 int paramCount = 0;
16180 int lastParam = -1;
16181 char templateString[1024];
16182 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * param;
16183
16184 sprintf(templateString, "%s<", expClass->templateClass->fullName);
16185 while(cClass != expClass)
16186 {
16187 struct __ecereNameSpace__ecere__com__Class * sClass;
16188
16189 for(sClass = expClass; sClass && sClass->base != cClass; sClass = sClass->base)
16190 ;
16191 cClass = sClass;
16192 for(param = cClass->templateParams.first; param; param = param->next)
16193 {
16194 struct __ecereNameSpace__ecere__com__Class * cClassCur = (((void *)0));
16195 int c;
16196 int cp = 0;
16197 struct __ecereNameSpace__ecere__com__ClassTemplateParameter * paramCur = (((void *)0));
16198 struct __ecereNameSpace__ecere__com__ClassTemplateArgument arg;
16199
16200 while(cClassCur != tClass && !paramCur)
16201 {
16202 struct __ecereNameSpace__ecere__com__Class * sClassCur;
16203
16204 for(sClassCur = tClass; sClassCur && sClassCur->base != cClassCur; sClassCur = sClassCur->base)
16205 ;
16206 cClassCur = sClassCur;
16207 for(paramCur = cClassCur->templateParams.first; paramCur; paramCur = paramCur->next)
16208 {
16209 if(!strcmp(paramCur->name, param->name))
16210 {
16211 break;
16212 }
16213 cp++;
16214 }
16215 }
16216 if(paramCur && paramCur->type == 0)
16217 arg = tClass->templateArgs[cp];
16218 else
16219 arg = expClass->templateArgs[p];
16220 {
16221 char argument[256];
16222
16223 argument[0] = '\0';
16224 switch(param->type)
16225 {
16226 case 2:
16227 {
16228 char expString[1024];
16229 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16230 struct Declarator * decl = SpecDeclFromString(param->dataTypeString, specs, (((void *)0)));
16231 struct Expression * exp;
16232 char * string = PrintHexUInt64(arg.expression.ui64);
16233
16234 exp = MkExpCast(MkTypeName(specs, decl), MkExpConstant(string));
16235 (__ecereNameSpace__ecere__com__eSystem_Delete(string), string = 0);
16236 ProcessExpressionType(exp);
16237 ComputeExpression(exp);
16238 expString[0] = '\0';
16239 PrintExpression(exp, expString);
16240 strcat(argument, expString);
16241 FreeExpression(exp);
16242 break;
16243 }
16244 case 1:
16245 {
16246 strcat(argument, arg.member->name);
16247 break;
16248 }
16249 case 0:
16250 {
16251 if(arg.dataTypeString && (!param->defaultArg.dataTypeString || strcmp(arg.dataTypeString, param->defaultArg.dataTypeString)))
16252 strcat(argument, arg.dataTypeString);
16253 break;
16254 }
16255 }
16256 if(argument[0])
16257 {
16258 if(paramCount)
16259 strcat(templateString, ", ");
16260 if(lastParam != p - 1)
16261 {
16262 strcat(templateString, param->name);
16263 strcat(templateString, " = ");
16264 }
16265 strcat(templateString, argument);
16266 paramCount++;
16267 lastParam = p;
16268 }
16269 }
16270 p++;
16271 }
16272 }
16273 {
16274 int len = strlen(templateString);
16275
16276 if(templateString[len - 1] == '>')
16277 templateString[len++] = ' ';
16278 templateString[len++] = '>';
16279 templateString[len++] = '\0';
16280 }
16281 FreeType(exp->expType);
16282 {
16283 struct Context * context = SetupTemplatesContext(tClass);
16284
16285 exp->expType = ProcessTypeString(templateString, 0x0);
16286 FinishTemplatesContext(context);
16287 }
16288 }
16289 }
16290 }
16291 }
16292 else
16293 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)");
16294 }
16295 else if(type && (type->kind == 9 || type->kind == 10))
16296 {
16297 struct Type * memberType = exp->member.member ? FindMember(type, exp->member.member->string) : (((void *)0));
16298
16299 if(memberType)
16300 {
16301 exp->expType = memberType;
16302 if(memberType)
16303 memberType->refCount++;
16304 }
16305 }
16306 else
16307 {
16308 char expString[10240];
16309
16310 expString[0] = '\0';
16311 if(inCompiler)
16312 {
16313 PrintExpression(exp, expString);
16314 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16315 }
16316 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "member operator on non-structure type expression %s\n", (((void *)0))), expString);
16317 }
16318 if(exp->expType && exp->expType->kind == 21 && (!exp->destType || exp->destType->kind != 21))
16319 {
16320 if(type && (type->kind == 8 || type->kind == 19 || type->kind == 3 || type->kind == 15))
16321 {
16322 struct Identifier * id = exp->member.member;
16323 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));
16324
16325 if(_class)
16326 {
16327 FreeType(exp->expType);
16328 exp->expType = ReplaceThisClassType(_class);
16329 }
16330 }
16331 }
16332 yylloc = oldyylloc;
16333 break;
16334 }
16335 case 9:
16336 {
16337 struct Type * destType = exp->destType;
16338
16339 if(exp->member.member && exp->member.member->_class && exp->member.member->_class->name)
16340 {
16341 exp->member.member->classSym = exp->member.member->_class->symbol;
16342 }
16343 exp->member.exp = MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '*', exp->member.exp)));
16344 exp->type = 8;
16345 if(destType)
16346 destType->count++;
16347 ProcessExpressionType(exp);
16348 if(destType)
16349 destType->count--;
16350 break;
16351 }
16352 case 15:
16353 {
16354 struct Symbol * classSym = exp->_class->symbol;
16355
16356 if(classSym && classSym->registered)
16357 {
16358 if(classSym->registered->type == 5)
16359 {
16360 char name[1024];
16361
16362 name[0] = '\0';
16363 DeclareStruct(classSym->string, 0x0);
16364 FreeSpecifier(exp->_class);
16365 exp->type = 10;
16366 FullClassNameCat(name, classSym->string, 0x0);
16367 exp->typeName = MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(name), (((void *)0)))), (((void *)0)));
16368 }
16369 else
16370 {
16371 if(classSym->registered->fixed)
16372 {
16373 FreeSpecifier(exp->_class);
16374 exp->constant = PrintUInt(classSym->registered->templateClass ? classSym->registered->templateClass->structSize : classSym->registered->structSize);
16375 exp->type = 2;
16376 }
16377 else
16378 {
16379 char className[1024];
16380
16381 strcpy(className, "__ecereClass_");
16382 FullClassNameCat(className, classSym->string, 0x1);
16383 MangleClassName(className);
16384 DeclareClass(classSym, className);
16385 FreeExpContents(exp);
16386 exp->type = 9;
16387 exp->member.exp = MkExpIdentifier(MkIdentifier(className));
16388 exp->member.member = MkIdentifier("structSize");
16389 }
16390 }
16391 }
16392 exp->expType = __extension__ ({
16393 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16394
16395 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
16396 });
16397 break;
16398 }
16399 case 10:
16400 {
16401 struct Type * type = ProcessType(exp->typeName->qualifiers, exp->typeName->declarator);
16402
16403 exp->expType = __extension__ ({
16404 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16405
16406 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 3, __ecereInstance1;
16407 });
16408 exp->isConstant = 0x1;
16409 DeclareType(type, 0x0, 0x0);
16410 FreeType(type);
16411 break;
16412 }
16413 case 11:
16414 {
16415 struct Type * type = ProcessType(exp->cast.typeName->qualifiers, exp->cast.typeName->declarator);
16416
16417 type->count = 1;
16418 FreeType(exp->cast.exp->destType);
16419 exp->cast.exp->destType = type;
16420 type->refCount++;
16421 ProcessExpressionType(exp->cast.exp);
16422 type->count = 0;
16423 exp->expType = type;
16424 if(!exp->cast.exp->needCast && !NeedCast(exp->cast.exp->expType, type))
16425 {
16426 void * prev = exp->prev, * next = exp->next;
16427 struct Type * expType = exp->cast.exp->destType;
16428 struct Expression * castExp = exp->cast.exp;
16429 struct Type * destType = exp->destType;
16430
16431 if(expType)
16432 expType->refCount++;
16433 FreeType(exp->expType);
16434 FreeTypeName(exp->cast.typeName);
16435 *exp = *castExp;
16436 FreeType(exp->expType);
16437 FreeType(exp->destType);
16438 exp->expType = expType;
16439 exp->destType = destType;
16440 ((castExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor(castExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(castExp)) : 0), castExp = 0);
16441 exp->prev = prev;
16442 exp->next = next;
16443 }
16444 else
16445 {
16446 exp->isConstant = exp->cast.exp->isConstant;
16447 }
16448 break;
16449 }
16450 case 33:
16451 {
16452 struct Type * type = ProcessType(exp->initializer.typeName->qualifiers, exp->initializer.typeName->declarator);
16453
16454 exp->expType = type;
16455 break;
16456 }
16457 case 34:
16458 {
16459 struct Type * type = ProcessType(exp->vaArg.typeName->qualifiers, exp->vaArg.typeName->declarator);
16460
16461 ProcessExpressionType(exp->vaArg.exp);
16462 exp->expType = type;
16463 break;
16464 }
16465 case 12:
16466 {
16467 struct Expression * e;
16468
16469 exp->isConstant = 0x1;
16470 FreeType(exp->cond.cond->destType);
16471 exp->cond.cond->destType = MkClassType("bool");
16472 exp->cond.cond->destType->truth = 0x1;
16473 ProcessExpressionType(exp->cond.cond);
16474 if(!exp->cond.cond->isConstant)
16475 exp->isConstant = 0x0;
16476 for(e = (*exp->cond.exp).first; e; e = e->next)
16477 {
16478 if(!e->next)
16479 {
16480 FreeType(e->destType);
16481 e->destType = exp->destType;
16482 if(e->destType)
16483 e->destType->refCount++;
16484 }
16485 ProcessExpressionType(e);
16486 if(!e->next)
16487 {
16488 exp->expType = e->expType;
16489 if(e->expType)
16490 e->expType->refCount++;
16491 }
16492 if(!e->isConstant)
16493 exp->isConstant = 0x0;
16494 }
16495 FreeType(exp->cond.elseExp->destType);
16496 exp->cond.elseExp->destType = exp->destType ? exp->destType : exp->expType;
16497 if(exp->cond.elseExp->destType)
16498 exp->cond.elseExp->destType->refCount++;
16499 ProcessExpressionType(exp->cond.elseExp);
16500 if(!exp->cond.elseExp->isConstant)
16501 exp->isConstant = 0x0;
16502 break;
16503 }
16504 case 23:
16505 {
16506 if(exp->compound && exp->compound->compound.statements && (*exp->compound->compound.statements).last)
16507 {
16508 struct Statement * last = (*exp->compound->compound.statements).last;
16509
16510 if(last->type == 3 && last->expressions && (*last->expressions).last)
16511 {
16512 ((struct Expression *)(*last->expressions).last)->destType = exp->destType;
16513 if(exp->destType)
16514 exp->destType->refCount++;
16515 }
16516 ProcessStatement(exp->compound);
16517 exp->expType = (last->expressions && (*last->expressions).last) ? ((struct Expression *)(*last->expressions).last)->expType : (((void *)0));
16518 if(exp->expType)
16519 exp->expType->refCount++;
16520 }
16521 break;
16522 }
16523 case 24:
16524 {
16525 struct Specifier * spec = (*exp->_classExp.specifiers).first;
16526
16527 if(spec && spec->type == 1)
16528 {
16529 exp->expType = MkClassType(spec->name);
16530 exp->expType->kind = 19;
16531 exp->byReference = 0x1;
16532 }
16533 else
16534 {
16535 exp->expType = MkClassType("ecere::com::Class");
16536 exp->byReference = 0x1;
16537 }
16538 break;
16539 }
16540 case 25:
16541 {
16542 struct __ecereNameSpace__ecere__com__Class * _class = thisClass ? thisClass : currentClass;
16543
16544 if(_class)
16545 {
16546 struct Identifier * id = exp->classData.id;
16547 char structName[1024];
16548 struct Expression * classExp;
16549
16550 strcpy(structName, "__ecereClassData_");
16551 FullClassNameCat(structName, _class->fullName, 0x0);
16552 exp->type = 9;
16553 exp->member.member = id;
16554 if(curCompound && FindSymbol("this", curContext, curCompound->compound.context, 0x0, 0x0))
16555 classExp = MkExpMember(MkExpIdentifier(MkIdentifier("this")), MkIdentifier("_class"));
16556 else
16557 classExp = MkExpIdentifier(MkIdentifier("class"));
16558 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"))))))));
16559 ProcessExpressionType(exp);
16560 return ;
16561 }
16562 break;
16563 }
16564 case 35:
16565 {
16566 struct Type * type = (((void *)0));
16567 char * typeString = (((void *)0));
16568 char typeStringBuf[1024];
16569
16570 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))
16571 {
16572 struct __ecereNameSpace__ecere__com__Class * templateClass = exp->destType->_class->registered;
16573
16574 typeString = templateClass->templateArgs[2].dataTypeString;
16575 }
16576 else if(exp->list)
16577 {
16578 struct Expression * e;
16579
16580 for(e = (*exp->list).first; e; e = e->next)
16581 {
16582 ProcessExpressionType(e);
16583 if(e->expType)
16584 {
16585 if(!type)
16586 {
16587 type = e->expType;
16588 type->refCount++;
16589 }
16590 else
16591 {
16592 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
16593 {
16594 FreeType(type);
16595 type = e->expType;
16596 e->expType = (((void *)0));
16597 e = (*exp->list).first;
16598 ProcessExpressionType(e);
16599 if(e->expType)
16600 {
16601 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
16602 {
16603 FreeType(e->expType);
16604 e->expType = (((void *)0));
16605 FreeType(type);
16606 type = (((void *)0));
16607 break;
16608 }
16609 }
16610 }
16611 }
16612 if(e->expType)
16613 {
16614 FreeType(e->expType);
16615 e->expType = (((void *)0));
16616 }
16617 }
16618 }
16619 if(type)
16620 {
16621 typeStringBuf[0] = '\0';
16622 PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1);
16623 typeString = typeStringBuf;
16624 FreeType(type);
16625 type = (((void *)0));
16626 }
16627 }
16628 if(typeString)
16629 {
16630 char templateString[1024];
16631 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
16632 struct __ecereNameSpace__ecere__sys__OldList * structInitializers = MkList();
16633 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16634 struct Expression * expExt;
16635 struct Declarator * decl = SpecDeclFromString(typeString, specs, (((void *)0)));
16636
16637 sprintf(templateString, "Container<%s>", typeString);
16638 if(exp->list)
16639 {
16640 struct Expression * e;
16641
16642 type = ProcessTypeString(typeString, 0x0);
16643 while(e = (*exp->list).first)
16644 {
16645 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*exp->list), e);
16646 e->destType = type;
16647 type->refCount++;
16648 ProcessExpressionType(e);
16649 ListAdd(initializers, MkInitializerAssignment(e));
16650 }
16651 FreeType(type);
16652 (__ecereNameSpace__ecere__com__eSystem_Delete(exp->list), exp->list = 0);
16653 }
16654 DeclareStruct("ecere::com::BuiltInContainer", 0x0);
16655 ListAdd(structInitializers, MkInitializerAssignment(MkExpMember(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkIdentifier("_vTbl"))));
16656 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16657 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0)))));
16658 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16659 ListAdd(structInitializers, MkInitializerAssignment(MkExpConstant("0")));
16660 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16661 ListAdd(structInitializers, MkInitializerAssignment(MkExpExtensionInitializer(MkTypeName(specs, MkDeclaratorArray(decl, (((void *)0)))), MkInitializerList(initializers))));
16662 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16663 ListAdd(structInitializers, MkInitializerAssignment(__extension__ ({
16664 struct Expression * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16665
16666 __ecereInstance1->type = 2, __ecereInstance1->constant = __ecereNameSpace__ecere__com__PrintString(__ecereClass_int, &(*initializers).count, (void *)0), __ecereInstance1;
16667 })));
16668 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16669 ListAdd(structInitializers, MkInitializerAssignment(MkExpClass(CopyList(specs, CopySpecifier), CopyDeclarator(decl))));
16670 ProcessExpressionType(((struct Initializer *)(*structInitializers).last)->exp);
16671 exp->expType = ProcessTypeString(templateString, 0x0);
16672 exp->type = 5;
16673 exp->list = MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName(templateString)), (((void *)0))), MkExpOp((((void *)0)), '&', expExt = MkExpExtensionInitializer(MkTypeName(MkListOne(MkSpecifierName("BuiltInContainer")), (((void *)0))), MkInitializerList(structInitializers)))));
16674 ProcessExpressionType(expExt);
16675 }
16676 else
16677 {
16678 exp->expType = ProcessTypeString("Container", 0x0);
16679 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
16680 }
16681 break;
16682 }
16683 }
16684 if(exp->expType && exp->expType->kind == 21 && thisClass && (!exp->destType || exp->destType->kind != 21))
16685 {
16686 FreeType(exp->expType);
16687 exp->expType = ReplaceThisClassType(thisClass);
16688 }
16689 if(exp->expType && (exp->expType->kind == 9 || exp->expType->kind == 10 || exp->expType->kind == 15) && !exp->expType->members.first && exp->expType->enumName)
16690 {
16691 struct Symbol * symbol = FindSymbol(exp->expType->enumName, curContext, globalContext, 0x1, 0x0);
16692
16693 if(symbol)
16694 {
16695 if(exp->expType->kind != 15)
16696 {
16697 struct Type * member;
16698 char * enumName = __ecereNameSpace__ecere__sys__CopyString(exp->expType->enumName);
16699
16700 FreeType(exp->expType);
16701 exp->expType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
16702 exp->expType->kind = symbol->type->kind;
16703 exp->expType->refCount++;
16704 exp->expType->enumName = enumName;
16705 exp->expType->members = symbol->type->members;
16706 for(member = symbol->type->members.first; member; member = member->next)
16707 member->refCount++;
16708 }
16709 else
16710 {
16711 struct __ecereNameSpace__ecere__sys__NamedLink * member;
16712
16713 for(member = symbol->type->members.first; member; member = member->next)
16714 {
16715 struct __ecereNameSpace__ecere__sys__NamedLink * value = (value = __ecereNameSpace__ecere__com__eSystem_New0(structSize_NamedLink), value->name = __ecereNameSpace__ecere__sys__CopyString(member->name), value);
16716
16717 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&exp->expType->members, value);
16718 }
16719 }
16720 }
16721 }
16722 yylloc = exp->loc;
16723 if(exp->destType && (exp->destType->kind == 0 || exp->destType->kind == 18))
16724 ;
16725 else if(exp->destType && !exp->destType->keepCast)
16726 {
16727 if(!CheckExpressionType(exp, exp->destType, 0x0))
16728 {
16729 if(!exp->destType->count || unresolved)
16730 {
16731 if(!exp->expType)
16732 {
16733 yylloc = exp->loc;
16734 if(exp->destType->kind != 14)
16735 {
16736 char type2[1024];
16737
16738 type2[0] = '\0';
16739 if(inCompiler)
16740 {
16741 char expString[10240];
16742
16743 expString[0] = '\0';
16744 PrintType(exp->destType, type2, 0x0, 0x1);
16745 if(inCompiler)
16746 {
16747 PrintExpression(exp, expString);
16748 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16749 }
16750 if(unresolved)
16751 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s; expected %s\n", (((void *)0))), expString, type2);
16752 else if(exp->type != 16)
16753 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s; expected %s\n", (((void *)0))), expString, type2);
16754 }
16755 }
16756 else
16757 {
16758 char expString[10240];
16759
16760 expString[0] = '\0';
16761 if(inCompiler)
16762 {
16763 PrintExpression(exp, expString);
16764 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16765 }
16766 if(unresolved)
16767 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), expString);
16768 else if(exp->type != 16)
16769 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
16770 }
16771 }
16772 else
16773 {
16774 char type1[1024];
16775 char type2[1024];
16776
16777 type1[0] = '\0';
16778 type2[0] = '\0';
16779 if(inCompiler)
16780 {
16781 PrintType(exp->expType, type1, 0x0, 0x1);
16782 PrintType(exp->destType, type2, 0x0, 0x1);
16783 }
16784 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)))
16785 ;
16786 else
16787 {
16788 char expString[10240];
16789
16790 expString[0] = '\0';
16791 if(inCompiler)
16792 {
16793 PrintExpression(exp, expString);
16794 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16795 }
16796 if(!sourceFile || (strcmp(sourceFile, "src\\lexer.ec") && strcmp(sourceFile, "src/lexer.ec") && strcmp(sourceFile, "src\\grammar.ec") && strcmp(sourceFile, "src/grammar.ec")))
16797 Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2);
16798 FreeType(exp->expType);
16799 exp->destType->refCount++;
16800 exp->expType = exp->destType;
16801 }
16802 }
16803 }
16804 }
16805 else if(exp->destType && exp->destType->kind == 14 && exp->expType && exp->expType->passAsTemplate)
16806 {
16807 struct Expression * newExp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Expression);
16808 char typeString[1024];
16809 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
16810 struct Declarator * decl;
16811
16812 typeString[0] = '\0';
16813 *newExp = *exp;
16814 if(exp->expType)
16815 exp->expType->refCount++;
16816 if(exp->expType)
16817 exp->expType->refCount++;
16818 exp->type = 11;
16819 newExp->destType = exp->expType;
16820 PrintType(exp->expType, typeString, 0x0, 0x0);
16821 decl = SpecDeclFromString(typeString, specs, (((void *)0)));
16822 exp->cast.typeName = MkTypeName(specs, decl);
16823 exp->cast.exp = newExp;
16824 }
16825 }
16826 else if(unresolved)
16827 {
16828 if(exp->identifier->_class && exp->identifier->_class->name)
16829 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s::%s\n", (((void *)0))), exp->identifier->_class->name, exp->identifier->string);
16830 else if(exp->identifier->string && exp->identifier->string[0])
16831 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "unresolved identifier %s\n", (((void *)0))), exp->identifier->string);
16832 }
16833 else if(!exp->expType && exp->type != 16)
16834 {
16835 char expString[10240];
16836
16837 expString[0] = '\0';
16838 if(inCompiler)
16839 {
16840 PrintExpression(exp, expString);
16841 __ecereNameSpace__ecere__sys__ChangeCh(expString, '\n', ' ');
16842 }
16843 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "couldn't determine type of %s\n", (((void *)0))), expString);
16844 }
16845 if(inCompiler)
16846 ApplyAnyObjectLogic(exp);
16847 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)))
16848 {
16849 exp->byReference = 0x1;
16850 }
16851 yylloc = oldyylloc;
16852 }
16853
16854 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)
16855 {
16856 if(*curMember)
16857 {
16858 *curMember = (*curMember)->next;
16859 if(subMemberStackPos && *subMemberStackPos > 0 && subMemberStack[*subMemberStackPos - 1]->type == 1)
16860 {
16861 *curMember = subMemberStack[--(*subMemberStackPos)];
16862 *curMember = (*curMember)->next;
16863 }
16864 while((*curMember) && (*curMember)->isProperty)
16865 *curMember = (*curMember)->next;
16866 if(subMemberStackPos)
16867 {
16868 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
16869 {
16870 subMemberStack[(*subMemberStackPos)++] = *curMember;
16871 *curMember = (*curMember)->members.first;
16872 while(*curMember && (*curMember)->isProperty)
16873 *curMember = (*curMember)->next;
16874 }
16875 }
16876 }
16877 while(!*curMember)
16878 {
16879 if(!*curMember)
16880 {
16881 if(subMemberStackPos && *subMemberStackPos)
16882 {
16883 *curMember = subMemberStack[--(*subMemberStackPos)];
16884 *curMember = (*curMember)->next;
16885 }
16886 else
16887 {
16888 struct __ecereNameSpace__ecere__com__Class * lastCurClass = *curClass;
16889
16890 if(*curClass == _class)
16891 break;
16892 for(*curClass = _class; (*curClass)->base != lastCurClass && (*curClass)->base->type != 1000; *curClass = (*curClass)->base)
16893 ;
16894 *curMember = (*curClass)->membersAndProperties.first;
16895 }
16896 while((*curMember) && (*curMember)->isProperty)
16897 *curMember = (*curMember)->next;
16898 if(subMemberStackPos)
16899 {
16900 while((*curMember) && !(*curMember)->isProperty && !(*curMember)->name && ((*curMember)->type == 2 || (*curMember)->type == 1))
16901 {
16902 subMemberStack[(*subMemberStackPos)++] = *curMember;
16903 *curMember = (*curMember)->members.first;
16904 while(*curMember && (*curMember)->isProperty)
16905 *curMember = (*curMember)->next;
16906 }
16907 }
16908 }
16909 }
16910 }
16911
16912 static void ProcessInitializer(struct Initializer * init, struct Type * type)
16913 {
16914 switch(init->type)
16915 {
16916 case 0:
16917 if(!init->exp || init->exp->type != 1 || !init->exp->instance || init->exp->instance->_class || !type || type->kind == 8)
16918 {
16919 if(init->exp && !init->exp->destType)
16920 {
16921 FreeType(init->exp->destType);
16922 init->exp->destType = type;
16923 if(type)
16924 type->refCount++;
16925 }
16926 if(init->exp)
16927 {
16928 ProcessExpressionType(init->exp);
16929 init->isConstant = init->exp->isConstant;
16930 }
16931 break;
16932 }
16933 else
16934 {
16935 struct Expression * exp = init->exp;
16936 struct Instantiation * inst = exp->instance;
16937 struct MembersInit * members;
16938
16939 init->type = 1;
16940 init->list = MkList();
16941 if(inst->members)
16942 {
16943 for(members = (*inst->members).first; members; members = members->next)
16944 {
16945 if(members->type == 0)
16946 {
16947 struct MemberInit * member;
16948
16949 for(member = (*members->dataMembers).first; member; member = member->next)
16950 {
16951 ListAdd(init->list, member->initializer);
16952 member->initializer = (((void *)0));
16953 }
16954 }
16955 }
16956 }
16957 FreeExpression(exp);
16958 }
16959 case 1:
16960 {
16961 struct Initializer * i;
16962 struct Type * initializerType = (((void *)0));
16963 struct __ecereNameSpace__ecere__com__Class * curClass = (((void *)0));
16964 struct __ecereNameSpace__ecere__com__DataMember * curMember = (((void *)0));
16965 struct __ecereNameSpace__ecere__com__DataMember * subMemberStack[256];
16966 int subMemberStackPos = 0;
16967
16968 if(type && type->kind == 12)
16969 initializerType = Dereference(type);
16970 else if(type && (type->kind == 9 || type->kind == 10))
16971 initializerType = type->members.first;
16972 for(i = (*init->list).first; i; i = i->next)
16973 {
16974 if(type && type->kind == 8 && type->_class && type->_class->registered)
16975 {
16976 FindNextDataMember(type->_class->registered, &curClass, &curMember, subMemberStack, &subMemberStackPos);
16977 if(curMember)
16978 {
16979 if(!curMember->dataType)
16980 curMember->dataType = ProcessTypeString(curMember->dataTypeString, 0x0);
16981 initializerType = curMember->dataType;
16982 }
16983 }
16984 ProcessInitializer(i, initializerType);
16985 if(initializerType && type && (type->kind == 9 || type->kind == 10))
16986 initializerType = initializerType->next;
16987 if(!i->isConstant)
16988 init->isConstant = 0x0;
16989 }
16990 if(type && type->kind == 12)
16991 FreeType(initializerType);
16992 if(type && type->kind != 12 && type->kind != 9 && type->kind != 10 && (type->kind != 8 || !type->_class->registered || type->_class->registered->type != 1))
16993 {
16994 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Assigning list initializer to non list\n", (((void *)0))));
16995 }
16996 break;
16997 }
16998 }
16999 }
17000
17001 extern struct Symbol * FindType(struct Context * ctx, char *  name);
17002
17003 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol);
17004
17005 static void ProcessSpecifier(struct Specifier * spec, unsigned int declareStruct)
17006 {
17007 switch(spec->type)
17008 {
17009 case 0:
17010 {
17011 if(spec->specifier == THISCLASS)
17012 {
17013 if(thisClass)
17014 {
17015 spec->type = 1;
17016 spec->name = ReplaceThisClass(thisClass);
17017 spec->symbol = FindClass(spec->name);
17018 ProcessSpecifier(spec, declareStruct);
17019 }
17020 }
17021 break;
17022 }
17023 case 1:
17024 {
17025 struct Symbol * symbol = FindType(curContext, spec->name);
17026
17027 if(symbol)
17028 DeclareType(symbol->type, 0x1, 0x1);
17029 else if((symbol = spec->symbol) && symbol->registered && symbol->registered->type == 1 && declareStruct)
17030 DeclareStruct(spec->name, 0x0);
17031 break;
17032 }
17033 case 2:
17034 {
17035 struct Enumerator * e;
17036
17037 if(spec->list)
17038 {
17039 for(e = (*spec->list).first; e; e = e->next)
17040 {
17041 if(e->exp)
17042 ProcessExpressionType(e->exp);
17043 }
17044 }
17045 break;
17046 }
17047 case 3:
17048 case 4:
17049 {
17050 if(spec->definitions)
17051 {
17052 struct ClassDef * def;
17053 struct Symbol * symbol = spec->id ? FindClass(spec->id->string) : (((void *)0));
17054
17055 ProcessClass(spec->definitions, symbol);
17056 }
17057 break;
17058 }
17059 }
17060 }
17061
17062 static void ProcessDeclarator(struct Declarator * decl)
17063 {
17064 switch(decl->type)
17065 {
17066 case 1:
17067 if(decl->identifier->classSym)
17068 {
17069 FreeSpecifier(decl->identifier->_class);
17070 decl->identifier->_class = (((void *)0));
17071 }
17072 break;
17073 case 3:
17074 if(decl->array.exp)
17075 ProcessExpressionType(decl->array.exp);
17076 case 0:
17077 case 2:
17078 case 4:
17079 case 5:
17080 case 6:
17081 case 7:
17082 if(decl->declarator)
17083 ProcessDeclarator(decl->declarator);
17084 if(decl->type == 4)
17085 {
17086 struct Identifier * id = GetDeclId(decl);
17087
17088 if(id && id->_class)
17089 {
17090 struct TypeName * param = (param = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName), param->qualifiers = MkListOne(id->_class), param->declarator = (((void *)0)), param);
17091
17092 if(!decl->function.parameters)
17093 decl->function.parameters = MkList();
17094 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), (((void *)0)), param);
17095 id->_class = (((void *)0));
17096 }
17097 if(decl->function.parameters)
17098 {
17099 struct TypeName * param;
17100
17101 for(param = (*decl->function.parameters).first; param; param = param->next)
17102 {
17103 if(param->qualifiers && (*param->qualifiers).first)
17104 {
17105 struct Specifier * spec = (*param->qualifiers).first;
17106
17107 if(spec && spec->specifier == TYPED_OBJECT)
17108 {
17109 struct Declarator * d = param->declarator;
17110 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);
17111
17112 FreeList(param->qualifiers, FreeSpecifier);
17113 param->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0))));
17114 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class")));
17115 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*decl->function.parameters), param, newParam);
17116 param = newParam;
17117 }
17118 else if(spec && spec->specifier == ANY_OBJECT)
17119 {
17120 struct Declarator * d = param->declarator;
17121
17122 FreeList(param->qualifiers, FreeSpecifier);
17123 param->qualifiers = MkListOne(MkSpecifier(VOID));
17124 param->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), d);
17125 }
17126 else if(spec->specifier == THISCLASS)
17127 {
17128 if(thisClass)
17129 {
17130 spec->type = 1;
17131 spec->name = ReplaceThisClass(thisClass);
17132 spec->symbol = FindClass(spec->name);
17133 ProcessSpecifier(spec, 0x0);
17134 }
17135 }
17136 }
17137 if(param->declarator)
17138 ProcessDeclarator(param->declarator);
17139 }
17140 }
17141 }
17142 break;
17143 }
17144 }
17145
17146 extern struct Identifier * CopyIdentifier(struct Identifier * id);
17147
17148 extern void FreeInitDeclarator(struct InitDeclarator * decl);
17149
17150 static void ProcessDeclaration(struct Declaration * decl)
17151 {
17152 yylloc = decl->loc;
17153 switch(decl->type)
17154 {
17155 case 1:
17156 {
17157 unsigned int declareStruct = 0x0;
17158
17159 if(decl->declarators)
17160 {
17161 struct InitDeclarator * d;
17162
17163 for(d = (*decl->declarators).first; d; d = d->next)
17164 {
17165 struct Type * type, * subType;
17166
17167 ProcessDeclarator(d->declarator);
17168 type = ProcessType(decl->specifiers, d->declarator);
17169 if(d->initializer)
17170 {
17171 ProcessInitializer(d->initializer, type);
17172 if((*decl->declarators).count == 1 && d->initializer->type == 0 && d->initializer->exp->type == 1)
17173 {
17174 if(type->kind == 8 && type->_class == d->initializer->exp->expType->_class)
17175 {
17176 struct Instantiation * inst = d->initializer->exp->instance;
17177
17178 inst->exp = MkExpIdentifier(CopyIdentifier(GetDeclId(d->declarator)));
17179 d->initializer->exp->instance = (((void *)0));
17180 if(decl->specifiers)
17181 FreeList(decl->specifiers, FreeSpecifier);
17182 FreeList(decl->declarators, FreeInitDeclarator);
17183 d = (((void *)0));
17184 decl->type = 2;
17185 decl->inst = inst;
17186 }
17187 }
17188 }
17189 for(subType = type; subType; )
17190 {
17191 if(subType->kind == 8)
17192 {
17193 declareStruct = 0x1;
17194 break;
17195 }
17196 else if(subType->kind == 13)
17197 break;
17198 else if(subType->kind == 12)
17199 subType = subType->arrayType;
17200 else
17201 break;
17202 }
17203 FreeType(type);
17204 if(!d)
17205 break;
17206 }
17207 }
17208 if(decl->specifiers)
17209 {
17210 struct Specifier * s;
17211
17212 for(s = (*decl->specifiers).first; s; s = s->next)
17213 {
17214 ProcessSpecifier(s, declareStruct);
17215 }
17216 }
17217 break;
17218 }
17219 case 2:
17220 {
17221 ProcessInstantiationType(decl->inst);
17222 break;
17223 }
17224 case 0:
17225 {
17226 struct Specifier * spec;
17227 struct Declarator * d;
17228 unsigned int declareStruct = 0x0;
17229
17230 if(decl->declarators)
17231 {
17232 for(d = (*decl->declarators).first; d; d = d->next)
17233 {
17234 struct Type * type = ProcessType(decl->specifiers, d->declarator);
17235 struct Type * subType;
17236
17237 ProcessDeclarator(d);
17238 for(subType = type; subType; )
17239 {
17240 if(subType->kind == 8)
17241 {
17242 declareStruct = 0x1;
17243 break;
17244 }
17245 else if(subType->kind == 13)
17246 break;
17247 else if(subType->kind == 12)
17248 subType = subType->arrayType;
17249 else
17250 break;
17251 }
17252 FreeType(type);
17253 }
17254 }
17255 if(decl->specifiers)
17256 {
17257 for(spec = (*decl->specifiers).first; spec; spec = spec->next)
17258 ProcessSpecifier(spec, declareStruct);
17259 }
17260 break;
17261 }
17262 }
17263 }
17264
17265 static struct FunctionDefinition * curFunction;
17266
17267 static void CreateFireWatcher(struct __ecereNameSpace__ecere__com__Property * prop, struct Expression * object, struct Statement * stmt)
17268 {
17269 char propName[1024], propNameM[1024];
17270 char getName[1024], setName[1024];
17271 struct __ecereNameSpace__ecere__sys__OldList * args;
17272
17273 DeclareProperty(prop, setName, getName);
17274 strcpy(propName, "__ecereProp_");
17275 FullClassNameCat(propName, prop->_class->fullName, 0x0);
17276 strcat(propName, "_");
17277 FullClassNameCat(propName, prop->name, 0x1);
17278 MangleClassName(propName);
17279 strcpy(propNameM, "__ecerePropM_");
17280 FullClassNameCat(propNameM, prop->_class->fullName, 0x0);
17281 strcat(propNameM, "_");
17282 FullClassNameCat(propNameM, prop->name, 0x1);
17283 MangleClassName(propNameM);
17284 if(prop->isWatchable)
17285 {
17286 args = MkList();
17287 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17288 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17289 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17290 args = MkList();
17291 ListAdd(args, object ? CopyExpression(object) : MkExpIdentifier(MkIdentifier("this")));
17292 ListAdd(args, MkExpIdentifier(MkIdentifier(propNameM)));
17293 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_FireWatchers")), args));
17294 }
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_FireSelfWatchers")), 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_FireSelfWatchers")), args));
17304 }
17305 if(curFunction->propSet && !strcmp(curFunction->propSet->string, prop->name) && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
17306 curFunction->propSet->fireWatchersDone = 0x1;
17307 }
17308
17309 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
17310
17311 extern struct Instantiation * MkInstantiationNamed(struct __ecereNameSpace__ecere__sys__OldList * specs, struct Expression * exp, struct __ecereNameSpace__ecere__sys__OldList * members);
17312
17313 extern struct Statement * MkIfStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement, struct Statement * elseStmt);
17314
17315 extern struct Statement * MkForStmt(struct Statement * init, struct Statement * check, struct __ecereNameSpace__ecere__sys__OldList * inc, struct Statement * statement);
17316
17317 extern struct Statement * MkWhileStmt(struct __ecereNameSpace__ecere__sys__OldList * exp, struct Statement * statement);
17318
17319 extern struct ClassFunction * MkClassFunction(struct __ecereNameSpace__ecere__sys__OldList * specifiers, struct Specifier * _class, struct Declarator * decl, struct __ecereNameSpace__ecere__sys__OldList * declList);
17320
17321 extern void ProcessClassFunctionBody(struct ClassFunction * func, struct Statement * body);
17322
17323 extern void FreePropertyWatch(struct PropertyWatch * watcher);
17324
17325 static void ProcessStatement(struct Statement * stmt)
17326 {
17327 yylloc = stmt->loc;
17328 switch(stmt->type)
17329 {
17330 case 0:
17331 ProcessStatement(stmt->labeled.stmt);
17332 break;
17333 case 1:
17334 if(stmt->caseStmt.exp)
17335 {
17336 FreeType(stmt->caseStmt.exp->destType);
17337 stmt->caseStmt.exp->destType = curSwitchType;
17338 if(curSwitchType)
17339 curSwitchType->refCount++;
17340 ProcessExpressionType(stmt->caseStmt.exp);
17341 ComputeExpression(stmt->caseStmt.exp);
17342 }
17343 if(stmt->caseStmt.stmt)
17344 ProcessStatement(stmt->caseStmt.stmt);
17345 break;
17346 case 2:
17347 {
17348 if(stmt->compound.context)
17349 {
17350 struct Declaration * decl;
17351 struct Statement * s;
17352 struct Statement * prevCompound = curCompound;
17353 struct Context * prevContext = curContext;
17354
17355 if(!stmt->compound.isSwitch)
17356 curCompound = stmt;
17357 curContext = stmt->compound.context;
17358 if(stmt->compound.declarations)
17359 {
17360 for(decl = (*stmt->compound.declarations).first; decl; decl = decl->next)
17361 ProcessDeclaration(decl);
17362 }
17363 if(stmt->compound.statements)
17364 {
17365 for(s = (*stmt->compound.statements).first; s; s = s->next)
17366 ProcessStatement(s);
17367 }
17368 curContext = prevContext;
17369 curCompound = prevCompound;
17370 }
17371 break;
17372 }
17373 case 3:
17374 {
17375 struct Expression * exp;
17376
17377 if(stmt->expressions)
17378 {
17379 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17380 ProcessExpressionType(exp);
17381 }
17382 break;
17383 }
17384 case 4:
17385 {
17386 struct Expression * exp;
17387
17388 FreeType(((struct Expression *)(*stmt->ifStmt.exp).last)->destType);
17389 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType = MkClassType("bool");
17390 ((struct Expression *)(*stmt->ifStmt.exp).last)->destType->truth = 0x1;
17391 for(exp = (*stmt->ifStmt.exp).first; exp; exp = exp->next)
17392 {
17393 ProcessExpressionType(exp);
17394 }
17395 if(stmt->ifStmt.stmt)
17396 ProcessStatement(stmt->ifStmt.stmt);
17397 if(stmt->ifStmt.elseStmt)
17398 ProcessStatement(stmt->ifStmt.elseStmt);
17399 break;
17400 }
17401 case 5:
17402 {
17403 struct Type * oldSwitchType = curSwitchType;
17404
17405 if(stmt->switchStmt.exp)
17406 {
17407 struct Expression * exp;
17408
17409 for(exp = (*stmt->switchStmt.exp).first; exp; exp = exp->next)
17410 {
17411 if(!exp->next)
17412 {
17413 ProcessExpressionType(exp);
17414 }
17415 if(!exp->next)
17416 curSwitchType = exp->expType;
17417 }
17418 }
17419 ProcessStatement(stmt->switchStmt.stmt);
17420 curSwitchType = oldSwitchType;
17421 break;
17422 }
17423 case 6:
17424 {
17425 if(stmt->whileStmt.exp)
17426 {
17427 struct Expression * exp;
17428
17429 FreeType(((struct Expression *)(*stmt->whileStmt.exp).last)->destType);
17430 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType = MkClassType("bool");
17431 ((struct Expression *)(*stmt->whileStmt.exp).last)->destType->truth = 0x1;
17432 for(exp = (*stmt->whileStmt.exp).first; exp; exp = exp->next)
17433 {
17434 ProcessExpressionType(exp);
17435 }
17436 }
17437 if(stmt->whileStmt.stmt)
17438 ProcessStatement(stmt->whileStmt.stmt);
17439 break;
17440 }
17441 case 7:
17442 {
17443 if(stmt->doWhile.exp)
17444 {
17445 struct Expression * exp;
17446
17447 if((*stmt->doWhile.exp).last)
17448 {
17449 FreeType(((struct Expression *)(*stmt->doWhile.exp).last)->destType);
17450 ((struct Expression *)(*stmt->doWhile.exp).last)->destType = MkClassType("bool");
17451 ((struct Expression *)(*stmt->doWhile.exp).last)->destType->truth = 0x1;
17452 }
17453 for(exp = (*stmt->doWhile.exp).first; exp; exp = exp->next)
17454 {
17455 ProcessExpressionType(exp);
17456 }
17457 }
17458 if(stmt->doWhile.stmt)
17459 ProcessStatement(stmt->doWhile.stmt);
17460 break;
17461 }
17462 case 8:
17463 {
17464 struct Expression * exp;
17465
17466 if(stmt->forStmt.init)
17467 ProcessStatement(stmt->forStmt.init);
17468 if(stmt->forStmt.check && stmt->forStmt.check->expressions)
17469 {
17470 FreeType(((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType);
17471 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType = MkClassType("bool");
17472 ((struct Expression *)(*stmt->forStmt.check->expressions).last)->destType->truth = 0x1;
17473 }
17474 if(stmt->forStmt.check)
17475 ProcessStatement(stmt->forStmt.check);
17476 if(stmt->forStmt.increment)
17477 {
17478 for(exp = (*stmt->forStmt.increment).first; exp; exp = exp->next)
17479 ProcessExpressionType(exp);
17480 }
17481 if(stmt->forStmt.stmt)
17482 ProcessStatement(stmt->forStmt.stmt);
17483 break;
17484 }
17485 case 18:
17486 {
17487 struct Identifier * id = stmt->forEachStmt.id;
17488 struct __ecereNameSpace__ecere__sys__OldList * exp = stmt->forEachStmt.exp;
17489 struct __ecereNameSpace__ecere__sys__OldList * filter = stmt->forEachStmt.filter;
17490 struct Statement * block = stmt->forEachStmt.stmt;
17491 char iteratorType[1024];
17492 struct Type * source;
17493 struct Expression * e;
17494 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));
17495 struct Expression * arrayExp;
17496 char * typeString = (((void *)0));
17497 int builtinCount = 0;
17498
17499 for(e = exp ? (*exp).first : (((void *)0)); e; e = e->next)
17500 {
17501 if(!e->next)
17502 {
17503 FreeType(e->destType);
17504 e->destType = ProcessTypeString("Container", 0x0);
17505 }
17506 if(!isBuiltin || e->next)
17507 ProcessExpressionType(e);
17508 }
17509 source = (exp && (*exp).last) ? ((struct Expression *)(*exp).last)->expType : (((void *)0));
17510 if(isBuiltin || (source && source->kind == 8 && source->_class && source->_class->registered && source->_class->registered != containerClass && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, containerClass)))
17511 {
17512 struct __ecereNameSpace__ecere__com__Class * _class = source ? source->_class->registered : (((void *)0));
17513 struct Symbol * symbol;
17514 struct Expression * expIt = (((void *)0));
17515 unsigned int isMap = 0x0, isArray = 0x0, isLinkList = 0x0, isList = 0x0, isCustomAVLTree = 0x0, isAVLTree = 0x0;
17516 struct __ecereNameSpace__ecere__com__Class * arrayClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Array");
17517 struct __ecereNameSpace__ecere__com__Class * linkListClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "LinkList");
17518 struct __ecereNameSpace__ecere__com__Class * customAVLTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "CustomAVLTree");
17519
17520 stmt->type = 2;
17521 stmt->compound.context = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Context);
17522 stmt->compound.context->parent = curContext;
17523 curContext = stmt->compound.context;
17524 if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, customAVLTreeClass))
17525 {
17526 struct __ecereNameSpace__ecere__com__Class * mapClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "Map");
17527 struct __ecereNameSpace__ecere__com__Class * avlTreeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "AVLTree");
17528
17529 isCustomAVLTree = 0x1;
17530 if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, avlTreeClass))
17531 isAVLTree = 0x1;
17532 else if(__ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, mapClass))
17533 isMap = 0x1;
17534 }
17535 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, arrayClass))
17536 isArray = 0x1;
17537 else if(source && __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, linkListClass))
17538 {
17539 struct __ecereNameSpace__ecere__com__Class * listClass = __ecereNameSpace__ecere__com__eSystem_FindClass(privateModule, "List");
17540
17541 isLinkList = 0x1;
17542 isList = __ecereNameSpace__ecere__com__eClass_IsDerived(source->_class->registered, listClass);
17543 }
17544 if(isArray)
17545 {
17546 struct Declarator * decl;
17547 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17548
17549 decl = SpecDeclFromString(_class->templateArgs[2].dataTypeString, specs, MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(id)));
17550 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17551 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), MkInitializerAssignment(MkExpBrackets(exp))))));
17552 }
17553 else if(isBuiltin)
17554 {
17555 struct Type * type = (((void *)0));
17556 char typeStringBuf[1024];
17557
17558 arrayExp = (((struct Expression *)(*exp).last)->type == 35) ? (struct Expression *)(*exp).last : ((struct Expression *)(*exp).last)->cast.exp;
17559 if(((struct Expression *)(*exp).last)->type == 11)
17560 {
17561 struct TypeName * typeName = ((struct Expression *)(*exp).last)->cast.typeName;
17562
17563 if(typeName)
17564 arrayExp->destType = ProcessType(typeName->qualifiers, typeName->declarator);
17565 }
17566 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)
17567 {
17568 struct __ecereNameSpace__ecere__com__Class * templateClass = arrayExp->destType->_class->registered;
17569
17570 typeString = templateClass->templateArgs[2].dataTypeString;
17571 }
17572 else if(arrayExp->list)
17573 {
17574 struct Expression * e;
17575
17576 for(e = (*arrayExp->list).first; e; e = e->next)
17577 {
17578 ProcessExpressionType(e);
17579 if(e->expType)
17580 {
17581 if(!type)
17582 {
17583 type = e->expType;
17584 type->refCount++;
17585 }
17586 else
17587 {
17588 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
17589 {
17590 FreeType(type);
17591 type = e->expType;
17592 e->expType = (((void *)0));
17593 e = (*arrayExp->list).first;
17594 ProcessExpressionType(e);
17595 if(e->expType)
17596 {
17597 if(!MatchTypeExpression(e, type, (((void *)0)), 0x0))
17598 {
17599 FreeType(e->expType);
17600 e->expType = (((void *)0));
17601 FreeType(type);
17602 type = (((void *)0));
17603 break;
17604 }
17605 }
17606 }
17607 }
17608 if(e->expType)
17609 {
17610 FreeType(e->expType);
17611 e->expType = (((void *)0));
17612 }
17613 }
17614 }
17615 if(type)
17616 {
17617 typeStringBuf[0] = '\0';
17618 PrintType(type, typeStringBuf, 0x0, 0x1);
17619 typeString = typeStringBuf;
17620 FreeType(type);
17621 }
17622 }
17623 if(typeString)
17624 {
17625 struct __ecereNameSpace__ecere__sys__OldList * initializers = MkList();
17626 struct Declarator * decl;
17627 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17628
17629 if(arrayExp->list)
17630 {
17631 struct Expression * e;
17632
17633 builtinCount = (*arrayExp->list).count;
17634 type = ProcessTypeString(typeString, 0x0);
17635 while(e = (*arrayExp->list).first)
17636 {
17637 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*arrayExp->list), e);
17638 e->destType = type;
17639 type->refCount++;
17640 ProcessExpressionType(e);
17641 ListAdd(initializers, MkInitializerAssignment(e));
17642 }
17643 FreeType(type);
17644 (__ecereNameSpace__ecere__com__eSystem_Delete(arrayExp->list), arrayExp->list = 0);
17645 }
17646 decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id));
17647 stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0))))));
17648 ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers)))));
17649 FreeList(exp, FreeExpression);
17650 }
17651 else
17652 {
17653 arrayExp->expType = ProcessTypeString("Container", 0x0);
17654 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Couldn't determine type of array elements\n", (((void *)0))));
17655 }
17656 }
17657 else if(isLinkList && !isList)
17658 {
17659 struct Declarator * decl;
17660 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17661
17662 decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, MkDeclaratorIdentifier(id));
17663 stmt->compound.declarations = MkListOne(MkDeclaration(specs, MkListOne(MkInitDeclarator(decl, (((void *)0))))));
17664 ListAdd(stmt->compound.declarations, MkDeclaration(MkListOne(MkSpecifierName(source->_class->registered->fullName)), MkListOne(MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__internalLinkList")), MkInitializerAssignment(MkExpBrackets(exp))))));
17665 }
17666 else if(_class->templateArgs)
17667 {
17668 if(isMap)
17669 sprintf(iteratorType, "MapIterator<%s, %s >", _class->templateArgs[5].dataTypeString, _class->templateArgs[6].dataTypeString);
17670 else
17671 sprintf(iteratorType, "Iterator<%s, %s >", _class->templateArgs[2].dataTypeString, _class->templateArgs[1].dataTypeString);
17672 stmt->compound.declarations = MkListOne(MkDeclarationInst(MkInstantiationNamed(MkListOne(MkSpecifierName(iteratorType)), MkExpIdentifier(id), MkListOne(MkMembersInitList(MkListOne(MkMemberInit(isMap ? MkListOne(MkIdentifier("map")) : (((void *)0)), MkInitializerAssignment(MkExpBrackets(exp)))))))));
17673 }
17674 symbol = FindSymbol(id->string, curContext, curContext, 0x0, 0x0);
17675 if(block)
17676 {
17677 switch(block->type)
17678 {
17679 case 2:
17680 if(block->compound.context)
17681 block->compound.context->parent = stmt->compound.context;
17682 break;
17683 case 4:
17684 if(block->ifStmt.stmt && block->ifStmt.stmt->type == 2 && block->ifStmt.stmt->compound.context)
17685 block->ifStmt.stmt->compound.context->parent = stmt->compound.context;
17686 if(block->ifStmt.elseStmt && block->ifStmt.elseStmt->type == 2 && block->ifStmt.elseStmt->compound.context)
17687 block->ifStmt.elseStmt->compound.context->parent = stmt->compound.context;
17688 break;
17689 case 5:
17690 if(block->switchStmt.stmt && block->switchStmt.stmt->type == 2 && block->switchStmt.stmt->compound.context)
17691 block->switchStmt.stmt->compound.context->parent = stmt->compound.context;
17692 break;
17693 case 6:
17694 if(block->whileStmt.stmt && block->whileStmt.stmt->type == 2 && block->whileStmt.stmt->compound.context)
17695 block->whileStmt.stmt->compound.context->parent = stmt->compound.context;
17696 break;
17697 case 7:
17698 if(block->doWhile.stmt && block->doWhile.stmt->type == 2 && block->doWhile.stmt->compound.context)
17699 block->doWhile.stmt->compound.context->parent = stmt->compound.context;
17700 break;
17701 case 8:
17702 if(block->forStmt.stmt && block->forStmt.stmt->type == 2 && block->forStmt.stmt->compound.context)
17703 block->forStmt.stmt->compound.context->parent = stmt->compound.context;
17704 break;
17705 case 18:
17706 if(block->forEachStmt.stmt && block->forEachStmt.stmt->type == 2 && block->forEachStmt.stmt->compound.context)
17707 block->forEachStmt.stmt->compound.context->parent = stmt->compound.context;
17708 break;
17709 }
17710 }
17711 if(filter)
17712 {
17713 block = MkIfStmt(filter, block, (((void *)0)));
17714 }
17715 if(isArray)
17716 {
17717 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));
17718 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17719 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17720 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17721 }
17722 else if(isBuiltin)
17723 {
17724 char count[128];
17725
17726 sprintf(count, "%d", builtinCount);
17727 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));
17728 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17729 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17730 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17731 }
17732 else if(isLinkList && !isList)
17733 {
17734 struct __ecereNameSpace__ecere__com__Class * typeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, _class->templateArgs[3].dataTypeString);
17735 struct __ecereNameSpace__ecere__com__Class * listItemClass = __ecereNameSpace__ecere__com__eSystem_FindClass(_class->module, "ListItem");
17736
17737 if(typeClass && __ecereNameSpace__ecere__com__eClass_IsDerived(typeClass, listItemClass) && _class->templateArgs[5].dataTypeString && !strcmp(_class->templateArgs[5].dataTypeString, "LT::link"))
17738 {
17739 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));
17740 }
17741 else
17742 {
17743 struct __ecereNameSpace__ecere__sys__OldList * specs = MkList();
17744 struct Declarator * decl = SpecDeclFromString(_class->templateArgs[3].dataTypeString, specs, (((void *)0)));
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)), '=', MkExpCast(MkTypeName(specs, decl), MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("__internalLinkList")), MkIdentifier("GetNext")), MkListOne(MkExpCast(MkTypeName(MkListOne(MkSpecifierName("IteratorPointer")), (((void *)0))), MkExpIdentifier(CopyIdentifier(id)))))))), block));
17747 }
17748 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.init);
17749 ProcessStatement(((struct Statement *)(*stmt->compound.statements).first)->forStmt.check);
17750 ProcessExpressionType((*((struct Statement *)(*stmt->compound.statements).first)->forStmt.increment).first);
17751 }
17752 else
17753 {
17754 stmt->compound.statements = MkListOne(MkWhileStmt(MkListOne(MkExpCall(MkExpMember(expIt = MkExpIdentifier(CopyIdentifier(id)), MkIdentifier("Next")), (((void *)0)))), block));
17755 }
17756 ProcessExpressionType(expIt);
17757 if((*stmt->compound.declarations).first)
17758 ProcessDeclaration((*stmt->compound.declarations).first);
17759 if(symbol)
17760 symbol->isIterator = isMap ? 2 : ((isArray || isBuiltin) ? 3 : (isLinkList ? (isList ? 5 : 4) : (isCustomAVLTree ? 6 : 1)));
17761 ProcessStatement(stmt);
17762 curContext = stmt->compound.context->parent;
17763 break;
17764 }
17765 else
17766 {
17767 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Expression is not a container\n", (((void *)0))));
17768 }
17769 break;
17770 }
17771 case 9:
17772 break;
17773 case 10:
17774 break;
17775 case 11:
17776 break;
17777 case 12:
17778 {
17779 struct Expression * exp;
17780
17781 if(stmt->expressions)
17782 {
17783 for(exp = (*stmt->expressions).first; exp; exp = exp->next)
17784 {
17785 if(!exp->next)
17786 {
17787 if(curFunction && !curFunction->type)
17788 curFunction->type = ProcessType(curFunction->specifiers, curFunction->declarator);
17789 FreeType(exp->destType);
17790 exp->destType = (curFunction && curFunction->type && curFunction->type->kind == 11) ? curFunction->type->returnType : (((void *)0));
17791 if(exp->destType)
17792 exp->destType->refCount++;
17793 }
17794 ProcessExpressionType(exp);
17795 }
17796 }
17797 break;
17798 }
17799 case 14:
17800 {
17801 ProcessDeclaration(stmt->decl);
17802 break;
17803 }
17804 case 13:
17805 {
17806 struct AsmField * field;
17807
17808 if(stmt->asmStmt.inputFields)
17809 {
17810 for(field = (*stmt->asmStmt.inputFields).first; field; field = field->next)
17811 if(field->expression)
17812 ProcessExpressionType(field->expression);
17813 }
17814 if(stmt->asmStmt.outputFields)
17815 {
17816 for(field = (*stmt->asmStmt.outputFields).first; field; field = field->next)
17817 if(field->expression)
17818 ProcessExpressionType(field->expression);
17819 }
17820 if(stmt->asmStmt.clobberedFields)
17821 {
17822 for(field = (*stmt->asmStmt.clobberedFields).first; field; field = field->next)
17823 {
17824 if(field->expression)
17825 ProcessExpressionType(field->expression);
17826 }
17827 }
17828 break;
17829 }
17830 case 17:
17831 {
17832 struct PropertyWatch * propWatch;
17833 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
17834 struct Expression * object = stmt->_watch.object;
17835 struct Expression * watcher = stmt->_watch.watcher;
17836
17837 if(watcher)
17838 ProcessExpressionType(watcher);
17839 if(object)
17840 ProcessExpressionType(object);
17841 if(inCompiler)
17842 {
17843 if(watcher || thisClass)
17844 {
17845 struct External * external = curExternal;
17846 struct Context * context = curContext;
17847
17848 stmt->type = 3;
17849 stmt->expressions = MkList();
17850 curExternal = external->prev;
17851 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
17852 {
17853 struct ClassFunction * func;
17854 char watcherName[1024];
17855 struct __ecereNameSpace__ecere__com__Class * watcherClass = watcher ? ((watcher->expType && watcher->expType->kind == 8 && watcher->expType->_class) ? watcher->expType->_class->registered : (((void *)0))) : thisClass;
17856 struct External * createdExternal;
17857 struct External * externalDecl = MkExternalDeclaration((((void *)0)));
17858
17859 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), curExternal->prev, externalDecl);
17860 sprintf(watcherName, "__ecerePropertyWatcher_%d", propWatcherID++);
17861 if(propWatch->deleteWatch)
17862 strcat(watcherName, "_delete");
17863 else
17864 {
17865 struct Identifier * propID;
17866
17867 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
17868 {
17869 strcat(watcherName, "_");
17870 strcat(watcherName, propID->string);
17871 }
17872 }
17873 if(object && object->expType && object->expType->kind == 8 && object->expType->_class && object->expType->_class->registered)
17874 {
17875 func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)), MkListOne(MkTypeName(MkListOne(MkSpecifierName(object->expType->_class->string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), (((void *)0)));
17876 ProcessClassFunctionBody(func, propWatch->compound);
17877 propWatch->compound = (((void *)0));
17878 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 0x1);
17879 createdExternal->symbol->idCode = external->symbol->idCode;
17880 curExternal = createdExternal;
17881 ProcessFunction(createdExternal->function);
17882 {
17883 struct Declaration * decl = MkDeclaration(CopyList(createdExternal->function->specifiers, CopySpecifier), MkListOne(MkInitDeclarator(CopyDeclarator(createdExternal->function->declarator), (((void *)0)))));
17884
17885 externalDecl->declaration = decl;
17886 if(decl->symbol && !decl->symbol->pointerExternal)
17887 decl->symbol->pointerExternal = externalDecl;
17888 }
17889 if(propWatch->deleteWatch)
17890 {
17891 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
17892
17893 ListAdd(args, CopyExpression(object));
17894 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
17895 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
17896 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_WatchDestruction")), args));
17897 }
17898 else
17899 {
17900 struct __ecereNameSpace__ecere__com__Class * _class = object->expType->_class->registered;
17901 struct Identifier * propID;
17902
17903 for(propID = (*propWatch->properties).first; propID; propID = propID->next)
17904 {
17905 char propName[1024];
17906 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
17907
17908 if(prop)
17909 {
17910 char getName[1024], setName[1024];
17911 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
17912
17913 DeclareProperty(prop, setName, getName);
17914 strcpy(propName, "__ecereProp_");
17915 FullClassNameCat(propName, prop->_class->fullName, 0x0);
17916 strcat(propName, "_");
17917 FullClassNameCat(propName, prop->name, 0x1);
17918 ListAdd(args, CopyExpression(object));
17919 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
17920 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
17921 ListAdd(args, MkExpIdentifier(MkIdentifier(watcherName)));
17922 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_Watch")), args));
17923 }
17924 else
17925 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
17926 }
17927 }
17928 }
17929 else
17930 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid watched object\n", (((void *)0))));
17931 }
17932 curExternal = external;
17933 curContext = context;
17934 if(watcher)
17935 FreeExpression(watcher);
17936 if(object)
17937 FreeExpression(object);
17938 FreeList(watches, FreePropertyWatch);
17939 }
17940 else
17941 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a _class\n", (((void *)0))));
17942 }
17943 else
17944 {
17945 for(propWatch = (*watches).first; propWatch; propWatch = propWatch->next)
17946 {
17947 ProcessStatement(propWatch->compound);
17948 }
17949 }
17950 break;
17951 }
17952 case 15:
17953 {
17954 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
17955 struct Expression * object = stmt->_watch.object;
17956 struct __ecereNameSpace__ecere__com__Class * _class;
17957
17958 if(object)
17959 ProcessExpressionType(object);
17960 if(inCompiler)
17961 {
17962 _class = object ? ((object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0))) : thisClass;
17963 if(_class)
17964 {
17965 struct Identifier * propID;
17966
17967 stmt->type = 3;
17968 stmt->expressions = MkList();
17969 if(!watches && curFunction->propSet && (!object || (object->type == 0 && !strcmp(object->identifier->string, "this"))))
17970 {
17971 watches = MkListOne(MkIdentifier(curFunction->propSet->string));
17972 }
17973 else if(!watches)
17974 {
17975 }
17976 if(watches)
17977 {
17978 for(propID = (*watches).first; propID; propID = propID->next)
17979 {
17980 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
17981
17982 if(prop)
17983 {
17984 CreateFireWatcher(prop, object, stmt);
17985 }
17986 else
17987 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
17988 }
17989 }
17990 else
17991 {
17992 struct __ecereNameSpace__ecere__com__Property * prop;
17993 struct __ecereNameSpace__ecere__com__Class * base;
17994
17995 for(base = _class; base; base = base->base)
17996 {
17997 for(prop = base->membersAndProperties.first; prop; prop = prop->next)
17998 {
17999 if(prop->isProperty && prop->isWatchable)
18000 {
18001 CreateFireWatcher(prop, object, stmt);
18002 }
18003 }
18004 }
18005 }
18006 if(object)
18007 FreeExpression(object);
18008 FreeList(watches, FreeIdentifier);
18009 }
18010 else
18011 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18012 }
18013 break;
18014 }
18015 case 16:
18016 {
18017 struct __ecereNameSpace__ecere__sys__OldList * watches = stmt->_watch.watches;
18018 struct Expression * object = stmt->_watch.object;
18019 struct Expression * watcher = stmt->_watch.watcher;
18020 struct __ecereNameSpace__ecere__com__Class * _class;
18021
18022 if(object)
18023 ProcessExpressionType(object);
18024 if(watcher)
18025 ProcessExpressionType(watcher);
18026 if(inCompiler)
18027 {
18028 _class = (object && object->expType && object->expType->kind == 8 && object->expType->_class) ? object->expType->_class->registered : (((void *)0));
18029 if(watcher || thisClass)
18030 {
18031 if(_class)
18032 {
18033 struct Identifier * propID;
18034
18035 stmt->type = 3;
18036 stmt->expressions = MkList();
18037 if(!watches)
18038 {
18039 struct __ecereNameSpace__ecere__sys__OldList * args;
18040
18041 args = MkList();
18042 ListAdd(args, CopyExpression(object));
18043 ListAdd(args, MkExpConstant("0"));
18044 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18045 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18046 }
18047 else
18048 {
18049 for(propID = (*watches).first; propID; propID = propID->next)
18050 {
18051 char propName[1024];
18052 struct __ecereNameSpace__ecere__com__Property * prop = __ecereNameSpace__ecere__com__eClass_FindProperty(_class, propID->string, privateModule);
18053
18054 if(prop)
18055 {
18056 char getName[1024], setName[1024];
18057 struct __ecereNameSpace__ecere__sys__OldList * args = MkList();
18058
18059 DeclareProperty(prop, setName, getName);
18060 strcpy(propName, "__ecereProp_");
18061 FullClassNameCat(propName, prop->_class->fullName, 0x0);
18062 strcat(propName, "_");
18063 FullClassNameCat(propName, prop->name, 0x1);
18064 MangleClassName(propName);
18065 ListAdd(args, CopyExpression(object));
18066 ListAdd(args, MkExpIdentifier(MkIdentifier(propName)));
18067 ListAdd(args, watcher ? CopyExpression(watcher) : MkExpIdentifier(MkIdentifier("this")));
18068 ListAdd(stmt->expressions, MkExpCall(MkExpIdentifier(MkIdentifier("ecere::com::eInstance_StopWatching")), args));
18069 }
18070 else
18071 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Property %s not found in class %s\n", (((void *)0))), propID->string, _class->fullName);
18072 }
18073 }
18074 if(object)
18075 FreeExpression(object);
18076 if(watcher)
18077 FreeExpression(watcher);
18078 FreeList(watches, FreeIdentifier);
18079 }
18080 else
18081 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "Invalid object specified and not inside a class\n", (((void *)0))));
18082 }
18083 else
18084 Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "No observer specified and not inside a class\n", (((void *)0))));
18085 }
18086 break;
18087 }
18088 }
18089 }
18090
18091 extern struct Expression * QBrackets(struct Expression * exp);
18092
18093 extern struct TypeName * QMkType(char *  spec, struct Declarator * decl);
18094
18095 extern struct Declarator * QMkPtrDecl(char *  id);
18096
18097 extern struct Expression * MkExpPointer(struct Expression * expression, struct Identifier * member);
18098
18099 extern struct Expression * QMkExpCond(struct Expression * cond, struct Expression * exp, struct Expression * elseExp);
18100
18101 extern struct Statement * MkFireWatchersStmt(struct Expression * object, struct __ecereNameSpace__ecere__sys__OldList * watches);
18102
18103 static void ProcessFunction(struct FunctionDefinition * function)
18104 {
18105 struct Identifier * id = GetDeclId(function->declarator);
18106 struct Symbol * symbol = function->declarator ? function->declarator->symbol : (((void *)0));
18107 struct Type * type = symbol ? symbol->type : (((void *)0));
18108 struct __ecereNameSpace__ecere__com__Class * oldThisClass = thisClass;
18109 struct Context * oldTopContext = topContext;
18110
18111 yylloc = function->loc;
18112 if(type && type->thisClass)
18113 {
18114 struct Symbol * classSym = type->thisClass;
18115 struct __ecereNameSpace__ecere__com__Class * _class = type->thisClass->registered;
18116 char className[1024];
18117 char structName[1024];
18118 struct Declarator * funcDecl;
18119 struct Symbol * thisSymbol;
18120 unsigned int typedObject = 0x0;
18121
18122 if(_class && !_class->base)
18123 {
18124 _class = currentClass;
18125 if(_class && !_class->symbol)
18126 _class->symbol = FindClass(_class->fullName);
18127 classSym = _class ? _class->symbol : (((void *)0));
18128 typedObject = 0x1;
18129 }
18130 thisClass = _class;
18131 if(inCompiler && _class)
18132 {
18133 if(type->kind == 11)
18134 {
18135 if(symbol->type->params.count == 1 && ((struct Type *)symbol->type->params.first)->kind == 0)
18136 {
18137 struct Type * param = symbol->type->params.first;
18138
18139 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&symbol->type->params, param);
18140 FreeType(param);
18141 }
18142 if(type->classObjectType != 1)
18143 {
18144 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert(&symbol->type->params, (((void *)0)), MkClassType(_class->fullName));
18145 symbol->type->staticMethod = 0x1;
18146 symbol->type->thisClass = (((void *)0));
18147 symbol->type->extraParam = 0x0;
18148 }
18149 }
18150 strcpy(className, "__ecereClass_");
18151 FullClassNameCat(className, _class->fullName, 0x1);
18152 MangleClassName(className);
18153 structName[0] = (char)0;
18154 FullClassNameCat(structName, _class->fullName, 0x0);
18155 funcDecl = GetFuncDecl(function->declarator);
18156 if(funcDecl)
18157 {
18158 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18159 {
18160 struct TypeName * param = (*funcDecl->function.parameters).first;
18161
18162 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18163 {
18164 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18165 FreeTypeName(param);
18166 }
18167 }
18168 if(!function->propertyNoThis)
18169 {
18170 struct TypeName * thisParam;
18171
18172 if(type->classObjectType != 1)
18173 {
18174 thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18175 if(!funcDecl->function.parameters)
18176 funcDecl->function.parameters = MkList();
18177 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18178 }
18179 if(typedObject)
18180 {
18181 if(type->classObjectType != 1)
18182 {
18183 if(type->byReference || _class->type == 3 || _class->type == 1000 || _class->type == 4 || _class->type == 2)
18184 thisParam->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), thisParam->declarator);
18185 }
18186 thisParam = __extension__ ({
18187 struct TypeName * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_TypeName);
18188
18189 __ecereInstance1->declarator = MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), MkDeclaratorIdentifier(MkIdentifier("class"))), __ecereInstance1->qualifiers = MkListOne(MkStructOrUnion(3, MkIdentifier("__ecereNameSpace__ecere__com__Class"), (((void *)0)))), __ecereInstance1;
18190 });
18191 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18192 }
18193 }
18194 }
18195 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18196 {
18197 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18198
18199 funcDecl = GetFuncDecl(initDecl->declarator);
18200 if(funcDecl)
18201 {
18202 if(funcDecl->function.parameters && (*funcDecl->function.parameters).count == 1)
18203 {
18204 struct TypeName * param = (*funcDecl->function.parameters).first;
18205
18206 if(param->qualifiers && (*param->qualifiers).count == 1 && ((struct Specifier *)(*param->qualifiers).first)->specifier == VOID && !param->declarator)
18207 {
18208 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*funcDecl->function.parameters), param);
18209 FreeTypeName(param);
18210 }
18211 }
18212 if(type->classObjectType != 1)
18213 {
18214 if((_class->type != 2 && _class->type != 3 && _class->type != 4) || function != (struct FunctionDefinition *)symbol->externalSet)
18215 {
18216 struct TypeName * thisParam = QMkClass(_class->fullName, MkDeclaratorIdentifier(MkIdentifier("this")));
18217
18218 if(!funcDecl->function.parameters)
18219 funcDecl->function.parameters = MkList();
18220 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*funcDecl->function.parameters), (((void *)0)), thisParam);
18221 }
18222 }
18223 }
18224 }
18225 }
18226 if(function->body)
18227 {
18228 if(type->classObjectType != 1)
18229 {
18230 thisSymbol = __extension__ ({
18231 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18232
18233 __ecereInstance1->string = __ecereNameSpace__ecere__sys__CopyString("this"), __ecereInstance1->type = classSym ? MkClassType(classSym->string) : (((void *)0)), __ecereInstance1;
18234 });
18235 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&function->body->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18236 if(typedObject && thisSymbol->type)
18237 {
18238 thisSymbol->type->classObjectType = 2;
18239 thisSymbol->type->byReference = type->byReference;
18240 thisSymbol->type->typedByReference = type->byReference;
18241 }
18242 }
18243 }
18244 if(inCompiler && _class && (_class->type == 0) && type->classObjectType != 1)
18245 {
18246 struct __ecereNameSpace__ecere__com__DataMember * member = (((void *)0));
18247
18248 {
18249 struct __ecereNameSpace__ecere__com__Class * base;
18250
18251 for(base = _class; base && base->type != 1000; base = base->next)
18252 {
18253 for(member = base->membersAndProperties.first; member; member = member->next)
18254 if(!member->isProperty)
18255 break;
18256 if(member)
18257 break;
18258 }
18259 }
18260 for(member = _class->membersAndProperties.first; member; member = member->next)
18261 if(!member->isProperty)
18262 break;
18263 if(member)
18264 {
18265 char pointerName[1024];
18266 struct Declaration * decl;
18267 struct Initializer * initializer;
18268 struct Expression * exp, * bytePtr;
18269
18270 strcpy(pointerName, "__ecerePointer_");
18271 FullClassNameCat(pointerName, _class->fullName, 0x0);
18272 {
18273 char className[1024];
18274
18275 strcpy(className, "__ecereClass_");
18276 FullClassNameCat(className, classSym->string, 0x1);
18277 MangleClassName(className);
18278 DeclareClass(classSym, className);
18279 }
18280 bytePtr = QBrackets(MkExpCast(QMkType("char", QMkPtrDecl((((void *)0)))), QMkExpId("this")));
18281 if(_class->fixed)
18282 {
18283 char string[256];
18284
18285 sprintf(string, "%d", _class->offset);
18286 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpConstant(string)));
18287 }
18288 else
18289 {
18290 exp = QBrackets(MkExpOp(bytePtr, '+', MkExpPointer(QMkExpId(className), MkIdentifier("offset"))));
18291 }
18292 exp = QBrackets(QMkExpCond(QMkExpId("this"), exp, MkExpConstant("0")));
18293 exp->expType = __extension__ ({
18294 struct Type * __ecereInstance2 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18295
18296 __ecereInstance2->refCount = 1, __ecereInstance2->kind = 13, __ecereInstance2->type = __extension__ ({
18297 struct Type * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
18298
18299 __ecereInstance1->refCount = 1, __ecereInstance1->kind = 0, __ecereInstance1;
18300 }), __ecereInstance2;
18301 });
18302 if(function->body)
18303 {
18304 yylloc = function->body->loc;
18305 initializer = MkInitializerAssignment(MkExpCast(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), exp));
18306 {
18307 struct Context * prevContext = curContext;
18308
18309 curContext = function->body->compound.context;
18310 decl = MkDeclaration(MkListOne(MkStructOrUnion(3, MkIdentifier(structName), (((void *)0)))), MkListOne(MkInitDeclarator(QMkPtrDecl(pointerName), initializer)));
18311 curContext = prevContext;
18312 }
18313 decl->symbol = (((void *)0));
18314 if(!function->body->compound.declarations)
18315 function->body->compound.declarations = MkList();
18316 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*function->body->compound.declarations), (((void *)0)), decl);
18317 }
18318 }
18319 }
18320 }
18321 else
18322 thisClass = (((void *)0));
18323 if(id)
18324 {
18325 FreeSpecifier(id->_class);
18326 id->_class = (((void *)0));
18327 if(symbol && symbol->pointerExternal && symbol->pointerExternal->type == 1)
18328 {
18329 struct InitDeclarator * initDecl = (*symbol->pointerExternal->declaration->declarators).first;
18330
18331 id = GetDeclId(initDecl->declarator);
18332 FreeSpecifier(id->_class);
18333 id->_class = (((void *)0));
18334 }
18335 }
18336 if(function->body)
18337 topContext = function->body->compound.context;
18338 {
18339 struct FunctionDefinition * oldFunction = curFunction;
18340
18341 curFunction = function;
18342 if(function->body)
18343 ProcessStatement(function->body);
18344 if(inCompiler && function->propSet && !function->propSet->fireWatchersDone)
18345 {
18346 struct Statement * prevCompound = curCompound;
18347 struct Context * prevContext = curContext;
18348 struct Statement * fireWatchers = MkFireWatchersStmt((((void *)0)), (((void *)0)));
18349
18350 if(!function->body->compound.statements)
18351 function->body->compound.statements = MkList();
18352 ListAdd(function->body->compound.statements, fireWatchers);
18353 curCompound = function->body;
18354 curContext = function->body->compound.context;
18355 ProcessStatement(fireWatchers);
18356 curContext = prevContext;
18357 curCompound = prevCompound;
18358 }
18359 curFunction = oldFunction;
18360 }
18361 if(function->declarator)
18362 {
18363 ProcessDeclarator(function->declarator);
18364 }
18365 topContext = oldTopContext;
18366 thisClass = oldThisClass;
18367 }
18368
18369 extern void FreeSymbol(struct Symbol * symbol);
18370
18371 void __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
18372
18373 static void ProcessClass(struct __ecereNameSpace__ecere__sys__OldList * definitions, struct Symbol * symbol)
18374 {
18375 struct ClassDef * def;
18376 struct External * external = curExternal;
18377 struct __ecereNameSpace__ecere__com__Class * regClass = symbol ? symbol->registered : (((void *)0));
18378
18379 for(def = definitions->first; def; def = def->next)
18380 {
18381 if(def->type == 0)
18382 {
18383 if(def->function->declarator)
18384 curExternal = def->function->declarator->symbol->pointerExternal;
18385 else
18386 curExternal = external;
18387 ProcessFunction((struct FunctionDefinition *)def->function);
18388 }
18389 else if(def->type == 2)
18390 {
18391 if(def->decl->type == 2)
18392 {
18393 thisClass = regClass;
18394 ProcessInstantiationType(def->decl->inst);
18395 thisClass = (((void *)0));
18396 }
18397 else
18398 {
18399 struct __ecereNameSpace__ecere__com__Class * backThisClass = thisClass;
18400
18401 if(regClass)
18402 thisClass = regClass;
18403 ProcessDeclaration(def->decl);
18404 thisClass = backThisClass;
18405 }
18406 }
18407 else if(def->type == 1 && def->defProperties)
18408 {
18409 struct MemberInit * defProperty;
18410 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);
18411
18412 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18413 for(defProperty = (*def->defProperties).first; defProperty; defProperty = defProperty->next)
18414 {
18415 thisClass = regClass;
18416 ProcessMemberInitData(defProperty, regClass, (((void *)0)), (((void *)0)), (((void *)0)), (((void *)0)));
18417 thisClass = (((void *)0));
18418 }
18419 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Remove(&globalContext->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18420 FreeSymbol(thisSymbol);
18421 }
18422 else if(def->type == 3 && def->propertyDef)
18423 {
18424 struct PropertyDef * prop = def->propertyDef;
18425
18426 thisClass = regClass;
18427 if(prop->setStmt)
18428 {
18429 if(regClass)
18430 {
18431 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18432
18433 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->setStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18434 }
18435 curExternal = prop->symbol ? prop->symbol->externalSet : (((void *)0));
18436 ProcessStatement(prop->setStmt);
18437 }
18438 if(prop->getStmt)
18439 {
18440 if(regClass)
18441 {
18442 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18443
18444 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->getStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18445 }
18446 curExternal = prop->symbol ? prop->symbol->externalGet : (((void *)0));
18447 ProcessStatement(prop->getStmt);
18448 }
18449 if(prop->issetStmt)
18450 {
18451 if(regClass)
18452 {
18453 struct Symbol * thisSymbol = (thisSymbol = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol), thisSymbol->string = __ecereNameSpace__ecere__sys__CopyString("this"), thisSymbol->type = MkClassType(regClass->fullName), thisSymbol);
18454
18455 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&prop->issetStmt->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18456 }
18457 curExternal = prop->symbol ? prop->symbol->externalIsSet : (((void *)0));
18458 ProcessStatement(prop->issetStmt);
18459 }
18460 thisClass = (((void *)0));
18461 }
18462 else if(def->type == 4 && def->propertyWatch)
18463 {
18464 struct PropertyWatch * propertyWatch = def->propertyWatch;
18465
18466 thisClass = regClass;
18467 if(propertyWatch->compound)
18468 {
18469 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);
18470
18471 __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&propertyWatch->compound->compound.context->symbols, (struct __ecereNameSpace__ecere__sys__BTNode *)thisSymbol);
18472 curExternal = (((void *)0));
18473 ProcessStatement(propertyWatch->compound);
18474 }
18475 thisClass = (((void *)0));
18476 }
18477 }
18478 }
18479
18480 void DeclareFunctionUtil(char * s)
18481 {
18482 struct __ecereNameSpace__ecere__com__GlobalFunction * function = __ecereNameSpace__ecere__com__eSystem_FindFunction(privateModule, s);
18483
18484 if(function)
18485 {
18486 char name[1024];
18487
18488 name[0] = (char)0;
18489 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + structSize_Instance)))->importType != 1 && (!function->dataType || !function->dataType->dllExport))
18490 strcpy(name, "__ecereFunction_");
18491 FullClassNameCat(name, s, 0x0);
18492 DeclareFunction(function, name);
18493 }
18494 }
18495
18496 extern struct __ecereNameSpace__ecere__com__Instance * GetPrivateModule(void);
18497
18498 void ComputeDataTypes()
18499 {
18500 struct External * external;
18501 struct External * temp = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_External);
18502 struct External * after = (((void *)0));
18503
18504 currentClass = (((void *)0));
18505 containerClass = __ecereNameSpace__ecere__com__eSystem_FindClass(GetPrivateModule(), "Container");
18506 for(external = (*ast).first; external; external = external->next)
18507 {
18508 if(external->type == 1)
18509 {
18510 struct Declaration * decl = external->declaration;
18511
18512 if(decl)
18513 {
18514 struct __ecereNameSpace__ecere__sys__OldList * decls = decl->declarators;
18515
18516 if(decls)
18517 {
18518 struct InitDeclarator * initDecl = (*decls).first;
18519
18520 if(initDecl)
18521 {
18522 struct Declarator * declarator = initDecl->declarator;
18523
18524 if(declarator && declarator->type == 1)
18525 {
18526 struct Identifier * id = declarator->identifier;
18527
18528 if(id && id->string)
18529 {
18530 if(!strcmp(id->string, "uintptr_t") || !strcmp(id->string, "intptr_t") || !strcmp(id->string, "size_t") || !strcmp(id->string, "ssize_t"))
18531 {
18532 external->symbol->id = -1001, external->symbol->idCode = -1001;
18533 after = external;
18534 }
18535 }
18536 }
18537 }
18538 }
18539 }
18540 }
18541 }
18542 temp->symbol = __extension__ ({
18543 struct Symbol * __ecereInstance1 = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Symbol);
18544
18545 __ecereInstance1->id = -1000, __ecereInstance1->idCode = -1000, __ecereInstance1;
18546 });
18547 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*ast), after, temp);
18548 curExternal = temp;
18549 DeclareFunctionUtil("eSystem_New");
18550 DeclareFunctionUtil("eSystem_New0");
18551 DeclareFunctionUtil("eSystem_Renew");
18552 DeclareFunctionUtil("eSystem_Renew0");
18553 DeclareFunctionUtil("eSystem_Delete");
18554 DeclareFunctionUtil("eClass_GetProperty");
18555 DeclareFunctionUtil("eInstance_FireSelfWatchers");
18556 DeclareStruct("ecere::com::Class", 0x0);
18557 DeclareStruct("ecere::com::Instance", 0x0);
18558 DeclareStruct("ecere::com::Property", 0x0);
18559 DeclareStruct("ecere::com::DataMember", 0x0);
18560 DeclareStruct("ecere::com::Method", 0x0);
18561 DeclareStruct("ecere::com::SerialBuffer", 0x0);
18562 DeclareStruct("ecere::com::ClassTemplateArgument", 0x0);
18563 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), temp);
18564 for(external = (*ast).first; external; external = external->next)
18565 {
18566 afterExternal = curExternal = external;
18567 if(external->type == 0)
18568 {
18569 currentClass = external->function->_class;
18570 ProcessFunction(external->function);
18571 }
18572 else if(external->type == 1)
18573 {
18574 currentClass = (((void *)0));
18575 if(external->declaration)
18576 ProcessDeclaration(external->declaration);
18577 }
18578 else if(external->type == 2)
18579 {
18580 struct ClassDefinition * _class = external->_class;
18581
18582 currentClass = external->symbol->registered;
18583 if(_class->definitions)
18584 {
18585 ProcessClass(_class->definitions, _class->symbol);
18586 }
18587 if(inCompiler)
18588 {
18589 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*ast), external);
18590 ((external ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(external) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(external)) : 0), external = 0);
18591 }
18592 }
18593 else if(external->type == 4)
18594 {
18595 thisNameSpace = external->id->string;
18596 }
18597 }
18598 currentClass = (((void *)0));
18599 thisNameSpace = (((void *)0));
18600 curExternal = (((void *)0));
18601 ((temp->symbol ? (__ecereClass_Symbol->Destructor ? __ecereClass_Symbol->Destructor(temp->symbol) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp->symbol)) : 0), temp->symbol = 0);
18602 ((temp ? (__ecereClass_External->Destructor ? __ecereClass_External->Destructor(temp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(temp)) : 0), temp = 0);
18603 }
18604
18605 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);
18606
18607 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);
18608
18609 extern struct __ecereNameSpace__ecere__com__Instance * __thisModule;
18610
18611 void __ecereRegisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18612 {
18613 struct __ecereNameSpace__ecere__com__Class * class;
18614
18615 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetYydebug", "void SetYydebug(bool b)", SetYydebug, module, 1);
18616 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetThisClass", "void SetThisClass(ecere::com::Class c)", SetThisClass, module, 1);
18617 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetThisClass", "ecere::com::Class GetThisClass(void)", GetThisClass, module, 1);
18618 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintExpression", "void PrintExpression(Expression exp, char * string)", PrintExpression, module, 1);
18619 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessTemplateParameterType", "Type ProcessTemplateParameterType(TemplateParameter param)", ProcessTemplateParameterType, module, 2);
18620 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("NeedCast", "bool NeedCast(Type type1, Type type2)", NeedCast, module, 2);
18621 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt", "char * PrintInt(int64 result)", PrintInt, module, 1);
18622 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt", "char * PrintUInt(uint64 result)", PrintUInt, module, 1);
18623 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintInt64", "char * PrintInt64(int64 result)", PrintInt64, module, 1);
18624 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUInt64", "char * PrintUInt64(uint64 result)", PrintUInt64, module, 1);
18625 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt", "char * PrintHexUInt(uint64 result)", PrintHexUInt, module, 1);
18626 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintHexUInt64", "char * PrintHexUInt64(uint64 result)", PrintHexUInt64, module, 1);
18627 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintShort", "char * PrintShort(short result)", PrintShort, module, 1);
18628 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUShort", "char * PrintUShort(uint16 result)", PrintUShort, module, 1);
18629 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintChar", "char * PrintChar(char result)", PrintChar, module, 1);
18630 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintUChar", "char * PrintUChar(byte result)", PrintUChar, module, 1);
18631 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintFloat", "char * PrintFloat(float result)", PrintFloat, module, 1);
18632 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintDouble", "char * PrintDouble(double result)", PrintDouble, module, 1);
18633 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt", "bool GetOpInt(Operand op2, int * value2)", GetOpInt, module, 1);
18634 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt", "bool GetInt(Expression exp, int * value2)", GetInt, module, 1);
18635 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt", "bool GetOpUInt(Operand op2, uint * value2)", GetOpUInt, module, 1);
18636 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt", "bool GetUInt(Expression exp, uint * value2)", GetUInt, module, 1);
18637 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpInt64", "bool GetOpInt64(Operand op2, int64 * value2)", GetOpInt64, module, 1);
18638 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetInt64", "bool GetInt64(Expression exp, int64 * value2)", GetInt64, module, 1);
18639 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUInt64", "bool GetOpUInt64(Operand op2, uint64 * value2)", GetOpUInt64, module, 1);
18640 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUInt64", "bool GetUInt64(Expression exp, uint64 * value2)", GetUInt64, module, 1);
18641 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntPtr", "bool GetOpIntPtr(Operand op2, intptr * value2)", GetOpIntPtr, module, 1);
18642 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntPtr", "bool GetIntPtr(Expression exp, intptr * value2)", GetIntPtr, module, 1);
18643 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntPtr", "bool GetOpUIntPtr(Operand op2, uintptr * value2)", GetOpUIntPtr, module, 1);
18644 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntPtr", "bool GetUIntPtr(Expression exp, uintptr * value2)", GetUIntPtr, module, 1);
18645 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpIntSize", "bool GetOpIntSize(Operand op2, intsize * value2)", GetOpIntSize, module, 1);
18646 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetIntSize", "bool GetIntSize(Expression exp, intsize * value2)", GetIntSize, module, 1);
18647 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUIntSize", "bool GetOpUIntSize(Operand op2, uintsize * value2)", GetOpUIntSize, module, 1);
18648 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUIntSize", "bool GetUIntSize(Expression exp, uintsize * value2)", GetUIntSize, module, 1);
18649 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpShort", "bool GetOpShort(Operand op2, short * value2)", GetOpShort, module, 1);
18650 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetShort", "bool GetShort(Expression exp, short * value2)", GetShort, module, 1);
18651 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUShort", "bool GetOpUShort(Operand op2, uint16 * value2)", GetOpUShort, module, 1);
18652 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUShort", "bool GetUShort(Expression exp, uint16 * value2)", GetUShort, module, 1);
18653 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpChar", "bool GetOpChar(Operand op2, char * value2)", GetOpChar, module, 1);
18654 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetChar", "bool GetChar(Expression exp, char * value2)", GetChar, module, 1);
18655 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpUChar", "bool GetOpUChar(Operand op2, byte * value2)", GetOpUChar, module, 1);
18656 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetUChar", "bool GetUChar(Expression exp, byte * value2)", GetUChar, module, 1);
18657 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpFloat", "bool GetOpFloat(Operand op2, float * value2)", GetOpFloat, module, 1);
18658 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetFloat", "bool GetFloat(Expression exp, float * value2)", GetFloat, module, 1);
18659 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOpDouble", "bool GetOpDouble(Operand op2, double * value2)", GetOpDouble, module, 1);
18660 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetDouble", "bool GetDouble(Expression exp, double * value2)", GetDouble, module, 1);
18661 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeClassMembers", "void ComputeClassMembers(ecere::com::Class _class, bool isMember)", ComputeClassMembers, module, 2);
18662 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeModuleClasses", "void ComputeModuleClasses(ecere::com::Module module)", ComputeModuleClasses, module, 1);
18663 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeTypeSize", "int ComputeTypeSize(Type type)", ComputeTypeSize, module, 1);
18664 __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);
18665 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareStruct", "void DeclareStruct(char * name, bool skipNoHead)", DeclareStruct, module, 2);
18666 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareProperty", "void DeclareProperty(ecere::com::Property prop, char * setName, char * getName)", DeclareProperty, module, 2);
18667 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("Dereference", "Type Dereference(Type source)", Dereference, module, 1);
18668 __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);
18669 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessInstantiationType", "void ProcessInstantiationType(Instantiation inst)", ProcessInstantiationType, module, 2);
18670 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindTemplateArg", "ecere::com::ClassTemplateArgument * FindTemplateArg(ecere::com::Class _class, TemplateParameter param)", FindTemplateArg, module, 2);
18671 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetupTemplatesContext", "Context SetupTemplatesContext(ecere::com::Class _class)", SetupTemplatesContext, module, 1);
18672 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FinishTemplatesContext", "void FinishTemplatesContext(Context context)", FinishTemplatesContext, module, 1);
18673 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessMethodType", "void ProcessMethodType(ecere::com::Method method)", ProcessMethodType, module, 1);
18674 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessPropertyType", "void ProcessPropertyType(ecere::com::Property prop)", ProcessPropertyType, module, 1);
18675 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareMethod", "void DeclareMethod(ecere::com::Method method, char * name)", DeclareMethod, module, 1);
18676 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClass", "char * ReplaceThisClass(ecere::com::Class _class)", ReplaceThisClass, module, 2);
18677 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassType", "Type ReplaceThisClassType(ecere::com::Class _class)", ReplaceThisClassType, module, 2);
18678 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceThisClassSpecifiers", "void ReplaceThisClassSpecifiers(ecere::sys::OldList specs, ecere::com::Class _class)", ReplaceThisClassSpecifiers, module, 2);
18679 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunction", "bool DeclareFunction(ecere::com::GlobalFunction function, char * name)", DeclareFunction, module, 2);
18680 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareGlobalData", "void DeclareGlobalData(GlobalData data)", DeclareGlobalData, module, 2);
18681 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(5, "Conversion", 0, sizeof(struct Conversion), 0, 0, 0, module, 2, 1);
18682 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + structSize_Instance)))->application && class)
18683 __ecereClass_Conversion = class;
18684 __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);
18685 __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);
18686 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ModuleVisibility", "bool ModuleVisibility(ecere::com::Module searchIn, ecere::com::Module searchFor)", ModuleVisibility, module, 1);
18687 __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);
18688 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("MatchTypeExpression", "bool MatchTypeExpression(Expression sourceExp, Type dest, ecere::sys::OldList conversions, bool skipUnitBla)", MatchTypeExpression, module, 2);
18689 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReadString", "void ReadString(char * output, char * string)", ReadString, module, 1);
18690 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("UnescapeString", "int UnescapeString(char * d, char * s, int len)", UnescapeString, module, 1);
18691 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OffsetEscapedString", "char * OffsetEscapedString(char * s, int len, int offset)", OffsetEscapedString, module, 1);
18692 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetOperand", "Operand GetOperand(Expression exp)", GetOperand, module, 1);
18693 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PopulateInstance", "void PopulateInstance(Instantiation inst)", PopulateInstance, module, 1);
18694 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeInstantiation", "void ComputeInstantiation(Expression exp)", ComputeInstantiation, module, 1);
18695 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CallOperator", "void CallOperator(Expression exp, Expression exp1, Expression exp2, Operand op1, Operand op2)", CallOperator, module, 1);
18696 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeExpression", "void ComputeExpression(Expression exp)", ComputeExpression, module, 1);
18697 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("CheckTemplateTypes", "void CheckTemplateTypes(Expression exp)", CheckTemplateTypes, module, 1);
18698 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindSymbol", "Symbol FindSymbol(char * name, Context startContext, Context endContext, bool isStruct, bool globalNameSpace)", FindSymbol, module, 1);
18699 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintType", "void PrintType(Type type, char * string, bool printName, bool fullName)", PrintType, module, 1);
18700 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("PrintTypeNoConst", "void PrintTypeNoConst(Type type, char * string, bool printName, bool fullName)", PrintTypeNoConst, module, 1);
18701 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("FindMemberAndOffset", "Type FindMemberAndOffset(Type type, char * string, uint * offset)", FindMemberAndOffset, module, 1);
18702 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetParseError", "bool GetParseError(void)", GetParseError, module, 1);
18703 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ParseExpressionString", "Expression ParseExpressionString(char * expression)", ParseExpressionString, module, 1);
18704 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ReplaceExpContents", "void ReplaceExpContents(Expression checkedExp, Expression newExp)", ReplaceExpContents, module, 1);
18705 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ApplyAnyObjectLogic", "void ApplyAnyObjectLogic(Expression e)", ApplyAnyObjectLogic, module, 1);
18706 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ProcessExpressionType", "void ProcessExpressionType(Expression exp)", ProcessExpressionType, module, 1);
18707 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("DeclareFunctionUtil", "void DeclareFunctionUtil(String s)", DeclareFunctionUtil, module, 1);
18708 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ComputeDataTypes", "void ComputeDataTypes(void)", ComputeDataTypes, module, 1);
18709 }
18710
18711 void __ecereUnregisterModule_pass15(struct __ecereNameSpace__ecere__com__Instance * module)
18712 {
18713
18714 }
18715